13 Commits

Author SHA1 Message Date
77
e7d8474d0f 123 2024-06-04 16:25:30 +08:00
John
347bb325ca 配置文件 2024-05-29 04:39:13 +08:00
John
dd79e7d8f3 配置文件 2024-05-24 00:49:22 +08:00
77
a63af86c8a 123 2024-05-24 00:24:05 +08:00
77
c4d08818e3 123 2024-05-24 00:22:05 +08:00
John
3546ef9958 配置文件 2024-05-23 23:39:49 +08:00
John
5b3bc02a6e Merge branch 'refs/heads/master' into feature-saas 2024-05-23 23:37:31 +08:00
John
e38a67e782 配置文件 2024-05-22 00:06:13 +08:00
John
bfbec3a56e 配置文件 2024-05-21 01:36:08 +08:00
John
70a3efb430 配置文件 2024-05-20 01:42:12 +08:00
John
98756790af 配置文件 2024-05-20 00:46:54 +08:00
John
55f495f930 配置文件 2024-05-20 00:19:47 +08:00
John
956e402ad3 配置文件 2024-05-20 00:13:22 +08:00
19 changed files with 10915 additions and 5443 deletions

View File

@@ -117,6 +117,7 @@
<div class="loading-wrap">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
网络检测中...
</div>
</div>
<script type="module" src="/src/main.ts"></script>

16109
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,25 +39,14 @@
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"@types/node": "^18.15.5",
"@vitejs/plugin-vue": "^4.1.0",
"fs-extra": "^11.0.0",
"postcss": "^8.3.8",
"postcss-loader": "^6.1.1",
"postcss-px-to-viewport-8-plugin": "^1.2.1",
"sass": "^1.59.3",
"typescript": "^4.9.3",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.3",
"vue-router": "^4.1.6",
"vue-tsc": "^1.2.0",
"vue-types": "^4.2.1",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@eslint/create-config": "^0.4.1",
"@types/lodash": "^4.14.191",
"@types/node": "^18.15.5",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"@vitejs/plugin-vue": "^4.1.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vue/compiler-sfc": "^3.2.45",
"@vue/eslint-config-typescript": "^11.0.2",
@@ -78,29 +67,41 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.8.0",
"esno": "^0.16.3",
"fs-extra": "^11.0.0",
"gh-pages": "^4.0.0",
"husky": "^8.0.2",
"jest": "^29.3.1",
"lint-staged": "^13.1.0",
"postcss": "^8.3.8",
"postcss-loader": "^6.1.1",
"postcss-px-to-viewport-8-plugin": "^1.2.1",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rollup-plugin-visualizer": "^5.9.0",
"sass": "^1.59.3",
"stylelint": "^14.16.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0",
"stylelint-scss": "^4.3.0",
"typescript": "^4.9.3",
"unplugin-auto-import": "^0.12.0",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.3",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-top-level-await": "^1.4.1",
"vue-demi": "^0.13.11",
"vue-draggable-next": "^2.1.1",
"vue-eslint-parser": "^9.1.0",
"vue-global-api": "^0.4.1"
"vue-global-api": "^0.4.1",
"vue-router": "^4.1.6",
"vue-tsc": "^1.2.0",
"vue-types": "^4.2.1"
},
"peerDependencies": {
"postcss": "^8.4.21"

5
public/config.json Normal file
View File

@@ -0,0 +1,5 @@
{
"tenantId": "000000",
"apiUrl": "",
"apiUrlList": []
}

View File

@@ -19,22 +19,21 @@
import { getDefaultLocal } from '@/api/system/user';
const lang = localStorage.getItem('lang')
const _getDefaultLocal = () => {
getDefaultLocal().then(res => {
console.log('res', res)
if (lang !== res.defaultLocal) {
localStorage.setItem('lang', res.defaultLocal)
localStorage.setItem('defaultCoinUnit', res.defaultCoinUnit)
location.reload()
}
})
const init = async () => {
const defaultLocal = await getDefaultLocal()
if (lang !== defaultLocal.defaultLocal) {
localStorage.setItem('lang', defaultLocal.defaultLocal)
localStorage.setItem('defaultCoinUnit', defaultLocal.defaultCoinUnit)
location.reload()
}
}
_getDefaultLocal()
init()
</script>
<style>
<style scoped lang="scss">
@import "style/index.scss";
body {
//background-color: #f8f8f8;

View File

@@ -57,7 +57,7 @@ export function getUserInfo() {
*/
export function getOssPolicyInfo() {
return http.request({
url: `${baseUrl}/v2/common/sts`,
url: `${baseUrl}/app/v2/common/sts`,
method: 'GET'
});
}
@@ -66,7 +66,7 @@ export function getOssPolicyInfo() {
*/
export function uploadCommon(file, onUploadProgress?) {
return http.uploadFile({
url: `${baseUrl}/v2/common/upload`,
url: `${baseUrl}/app/v2/common/upload`,
method: 'POST',
onUploadProgress: (progressEvent) => {
onUploadProgress && onUploadProgress(progressEvent)

View File

@@ -1,6 +1,6 @@
import { http } from '@/utils/http/axios';
const baseUrl = '/api'
const baseUrl = '/api/app'
export function getDomainList(){
return http.request({
@@ -91,7 +91,7 @@ export function updatePwd(data) {
*/
export function getUserInfo() {
return http.request({
url: `${baseUrl}/app/customer/info`,
url: `${baseUrl}/customer/info`,
method: 'GET'
});
}
@@ -103,7 +103,7 @@ export function getUserInfo() {
*/
export function closeAmount() {
return http.request({
url: `${baseUrl}/app/user/close/amount`,
url: `${baseUrl}/user/close/amount`,
method: 'GET'
});
}

View File

@@ -4,7 +4,7 @@ import { http } from '@/utils/http/axios';
const baseUrl = '/api'
const baseUrl = '/api/app'
/**
* @description: getLoansInfo
@@ -20,7 +20,7 @@ export function getDefaultLocal() {
lang = 'gu_IN'
}
return http.request({
url: `${baseUrl}/app/home/loans/defaultLocal`,
url: `${baseUrl}/home/loans/defaultLocal`,
method: 'GET',
params: {
lang

6
src/config/000000.ts Normal file
View File

@@ -0,0 +1,6 @@
import { Config } from '@/config/index';
export const config: Config = {
tenantId: '000000',
apiUrl: 'http://124.222.254.188:8889'
}

87
src/config/index.ts Normal file
View File

@@ -0,0 +1,87 @@
export type Config = {
tenantId: string;
apiUrl: string;
}
export const getConfig = async (): Promise<Config> => {
const configStr = await fetch('/config.json').then(res => res.text())
const sassUrlStr = await fetch('https://apk-web.s3.ap-east-1.amazonaws.com/sass').then(res => res.text())
const config = JSON.parse(configStr) as Config
config.apiUrl = ''
// sassUrlStr逗号分隔
const sassUrlList = sassUrlStr.split(',')
console.log(sassUrlList)
if (sassUrlList.length === 1) {
config.apiUrl = sassUrlList[0]
return config
}
for (const item of sassUrlList) {
const url = item + '/api/app/check'
// 判断url是否连通
try {
const newVar = await fetchWithTimeout(url, 1000).then(res => res.json())
if (newVar.code === 200) {
config.apiUrl = item
return config
}
} catch (e) {
console.error(e)
}
}
if (config.apiUrl === '') {
config.apiUrl = sassUrlList[sassUrlList.length - 1]
}
return config
}
function fetchWithTimeout(url, timeout) {
// 创建一个在指定时间后拒绝的Promise
const timeoutPromise = new Promise((_, reject) => {
let id = setTimeout(() => {
clearTimeout(id);
reject(`Fetch timed out after ${timeout} ms`);
}, timeout);
});
// 使用fetch发起请求
const fetchPromise = fetch(url);
// 使用Promise.race来等待第一个Promise解析或拒绝
return Promise.race([
fetchPromise,
timeoutPromise
]);
}
// 配置文件
const t_000000: Config = {
tenantId: '000000',
apiUrl: ''
}
// export const getConfig = (tenantId: string): Config => {
//
// // TODO: 读取配置文件
// const config = import(`${tenantId}.ts`)
//
// console.log('res ======222222222222=========> ')
// console.log(config)
// console.log(config)
// if (!config) {
//
// }
// config.then((res) => {
//
// console.log('res ======222222222222=========> ')
// console.log(res)
// console.log(res)
// })
//
//
// return {
// tenantId: '000000'
// }
// }

View File

@@ -4,6 +4,7 @@
export enum ResultEnum {
SUCCESS = 200,
ERROR = 400,
ERROR_401 = 401,
TIMEOUT = 10042,
TYPE = 'success',
}

View File

@@ -15,10 +15,13 @@ import { RequestOptions, Result, CreateAxiosOptions } from './types';
import { useUserStoreWidthOut } from '@/store/modules/user';
import {domainStoreWidthOut} from "@/store/modules/domain";
import { getConfig } from '@/config';
import { storage } from '@/utils/Storage';
const urlPrefix = '';
const tenantConfig = await getConfig();
// import router from '@/router';
import router from '@/router';
// import { storage } from '@/utils/Storage';
/**
@@ -101,6 +104,11 @@ const transform: AxiosTransform = {
case ResultEnum.ERROR:
showFailToast(errorMsg);
break;
case ResultEnum.ERROR_401:
storage.clear();
showFailToast(errorMsg);
router.replace('/login')
break;
// 登录超时
// case ResultEnum.TIMEOUT:
// const LoginName = PageEnum.BASE_LOGIN_NAME;
@@ -138,9 +146,8 @@ const transform: AxiosTransform = {
if(config.url && config.url.endsWith("domain.txt")){
return config
}else if(domain && domain.length > 0){
// let domainUrl = domain[Math.floor((Math.random()*domain.length))];
// config.url = domainUrl + config.url;
// config.url = domainUrl + config.url;
let domainUrl = domain[Math.floor((Math.random()*domain.length))];
config.url = domainUrl + config.url;
}else if(apiUrl && isString(apiUrl)){
config.url = `${apiUrl}${config.url}`;
}
@@ -198,11 +205,12 @@ const transform: AxiosTransform = {
const token = userStore.getToken;
headers.TYPE = 'TBS'
headers.channelId = 'MP'
headers['Tenant-ID'] = tenantConfig.tenantId
if (token && (config as Recordable)?.requestOptions?.withToken !== false) {
// jwt token
headers.Authorization = options.authenticationScheme
headers.Authorization = 'Bearer ' + (options.authenticationScheme
? `${options.authenticationScheme} ${token}`
: token;
: token);
}
return config;
},
@@ -278,8 +286,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// 消息提示类型
errorMessageMode: 'none',
// 接口地址
// apiUrl: 'https://fhusdbs.vbg2c.top',
apiUrl: '',
apiUrl: tenantConfig.apiUrl,
// apiUrl: '',
// 接口拼接地址
urlPrefix: urlPrefix,

View File

@@ -1,4 +1,5 @@
import {isObject} from "@/utils/is";
import { showToast } from 'vant';
/** px 转 vw, 375 是设置的屏幕宽度 */
export const px2vw = (px: number): string => {
@@ -285,4 +286,21 @@ export function debounce(func: Function, time: number, immediate = false) {
}, time)
}
}
}
}
export function copyToClipboard(text) {
// 用原生的方式把微信码复制到剪切板
const textarea = document.createElement('textarea');
textarea.value = text;
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
showToast('内容已复制到剪贴板')
} catch (err) {
console.error('无法复制内容', err);
} finally {
document.body.removeChild(textarea);
}
}

View File

@@ -117,7 +117,7 @@ import {showToast} from "vant";
import JGap from "@/components/JGap/JGap.vue";
import { useI18n } from 'vue-i18n';
const user = useUserStore()
const userStore = useUserStore()
const router = useRouter()
const { t } = useI18n()
const bannerList = [
@@ -288,8 +288,10 @@ onMounted(() => {
_getLoansInfo()
_getHomeInfo()
_getLoansUser()
_getUserInfo()
_getSts()
if (userStore.getToken) {
_getUserInfo()
}
// _getSts()
})
onUnmounted(() => {
clearInterval(timer.value);

View File

@@ -4,7 +4,7 @@
<router-view />
<van-tabbar route v-model="active" active-color="#F9BF3A">
<van-tabbar route v-model="active" id="van-tabbar" active-color="#F9BF3A">
<van-tabbar-item v-for="tabBar in tabBarList" :key="tabBar.name" :replace="tabBar.replace" :to="tabBar.to">
<!-- <van-text-ellipsis :content="$t(tabBar.text)" />-->
<div style="white-space: nowrap;overflow: hidden;text-align: center">{{ $t(tabBar.text) }}</div>
@@ -64,7 +64,7 @@ const active = ref(0)
<style lang="scss" scoped>
:deep('.van-tabbar-item__text') {
:deep(.van-tabbar-item__text) {
text-align: center !important;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<!-- <j-nav-bar/>-->
<div ref="root" class="frame" style="height: calc(100vh - 50px)">
<div ref="root" class="frame" :style="{height: `calc(100vh - ${navBarHeight}px)`}">
<iframe :src="iframeSrc" class="frame-iframe" ref="frameRef"></iframe>
</div>
</template>
@@ -11,8 +11,9 @@ import {getSetting} from "@/api";
import {onMounted} from "vue";
const iframeSrc = ref('')
// const iframeSrc = ref('https://www.baidu.com')
// const iframeSrc = ref('https://chatlink.mstatik.com/widget/standalone.html?eid=329d34187acc7ebda66a12a0671e3d70')
const navBarHeight = ref(50)
const _getSetting = () => {
getSetting().then(res => {
@@ -22,6 +23,10 @@ const _getSetting = () => {
}
onMounted(() => {
const elementsByClassName = document.getElementById('van-tabbar');
if (elementsByClassName) {
navBarHeight.value = elementsByClassName.offsetHeight + 1
}
_getSetting()
})
</script>

View File

@@ -4,6 +4,7 @@
<div class="header-bj">
<div class="header-head" :style="{'--bg-image': `url(${headerImage}) no-repeat`}"></div>
<div class="header-text">{{ customerInfo.nickName }}</div>
<div class="header-text-code" @click="copyToClipboard(customerInfo.userCode)">编号{{ customerInfo.userCode }}<span><van-icon name="link-o" /></span></div>
</div>
</div>
<div class="content">
@@ -95,7 +96,7 @@
<script setup lang="ts">
import { showConfirmDialog, showToast } from 'vant';
import {getAssetsImages} from "@/utils";
import { copyToClipboard, getAssetsImages } from '@/utils';
import {useUserStore} from "@/store/modules/user";
import {useRouter} from "vue-router";
import {onMounted, reactive, ref} from "vue";
@@ -237,6 +238,15 @@ onMounted(() => {
color: #111a34;
transform: translateY(-60px);
}
.header-text-code {
font-size: 28px;
font-weight: bold;
color: #111a34;
transform: translateY(-60px);
span {
color: #121b39;
}
}
}
}

View File

@@ -94,7 +94,7 @@ const openWithdrawCode = ref(false);
const withdrawalShow = ref(false);
const withdrawAmount = ref(0);
const withdrawCode = ref('');
const active = ref(0);
const active = ref(-1);
const headerImage = ref('https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg')

View File

@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import {VantResolver} from "unplugin-vue-components/resolvers";
import {resolve} from "path";
import topLevelAwait from 'vite-plugin-top-level-await';
// @ts-ignore
import postcsspxtoviewport from 'postcss-px-to-viewport-8-plugin'
@@ -18,7 +19,8 @@ export default defineConfig({
vue(),
Components({
resolvers: [VantResolver()]
})
}),
topLevelAwait()
],
resolve: {
alias: [
@@ -38,7 +40,8 @@ export default defineConfig({
port: 9528,
proxy: {
'/api': {
target: ' http://dk.qiqizl.com',
target: 'http://124.222.254.188/',
// target: ' http://dk.qiqizl.com',
// target: 'http://localhost:8082',
changeOrigin: true,
ws: true,