配置文件
This commit is contained in:
4
public/config.json
Normal file
4
public/config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"tenantId": "000000",
|
||||
"apiUrl": "http://124.222.254.188:8889"
|
||||
}
|
||||
15
src/App.vue
15
src/App.vue
@@ -19,18 +19,17 @@
|
||||
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)
|
||||
|
||||
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>
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@ export type Config = {
|
||||
apiUrl: string;
|
||||
}
|
||||
|
||||
export const getConfig = (): Config => {
|
||||
return t_000000
|
||||
export const getConfig = async (): Promise<Config> => {
|
||||
const config = await fetch('/config.json').then(res => res.text())
|
||||
|
||||
return JSON.parse(config) as Config
|
||||
}
|
||||
|
||||
// 配置文件
|
||||
|
||||
@@ -18,7 +18,7 @@ import {domainStoreWidthOut} from "@/store/modules/domain";
|
||||
import { getConfig } from '@/config';
|
||||
|
||||
const urlPrefix = '';
|
||||
const tenantConfig = getConfig();
|
||||
const tenantConfig = await getConfig();
|
||||
|
||||
// import router from '@/router';
|
||||
// import { storage } from '@/utils/Storage';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {isObject} from "@/utils/is";
|
||||
import { showToast } from 'vant';
|
||||
|
||||
/** px 转 vw, 375 是设置的屏幕宽度 */
|
||||
export const px2vw = (px: number): string => {
|
||||
@@ -286,3 +287,20 @@ export function debounce(func: Function, time: number, immediate = false) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>(复制)</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: #7696f8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user