优化
This commit is contained in:
@@ -10,8 +10,8 @@
|
||||
|
||||
<view class='qrcode-card'>
|
||||
<view class='balance-view'>
|
||||
<text class='balance-text'>账户余额:256.32元</text>
|
||||
<view class='btn-recharge'>
|
||||
<text class='balance-text'>账户余额:{{ userInfo.balance || 0 }}元</text>
|
||||
<view class='btn-recharge' @click.stop='goPath("/pages/mine/subs/recharge/index")'>
|
||||
<text>去充值</text>
|
||||
<image :src='assetsUrl("ic_arrow_right.png")' />
|
||||
</view>
|
||||
@@ -42,18 +42,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { generateBarCode, generateQrCode } from '@/api/common';
|
||||
import {getDynamicCode} from '@/api/user';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { generateBarCode, generateQrCode } from '@/api/common';
|
||||
import { getDynamicCode } from '@/api/user';
|
||||
import { useUserStore } from '@/store';
|
||||
import { goPath } from '@/utils';
|
||||
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
|
||||
const code = ref<{ barCode: string, qrCode: string }>();
|
||||
const codeContent = ref<string>(Date.now().toFixed(0));
|
||||
const codeContent = ref<string>('');
|
||||
const codeRefreshInterval = ref(30);
|
||||
|
||||
onLoad(() => {
|
||||
generateCode();
|
||||
// getDynamicCode()
|
||||
|
||||
setInterval(() => {
|
||||
codeRefreshInterval.value -= 1;
|
||||
@@ -66,6 +70,8 @@ onLoad(() => {
|
||||
});
|
||||
|
||||
const generateCode = async () => {
|
||||
const { dynccode } = await getDynamicCode();
|
||||
codeContent.value = dynccode;
|
||||
const barCode = await generateBarCode(codeContent.value);
|
||||
const qrCode = await generateQrCode(codeContent.value);
|
||||
code.value = {
|
||||
|
Reference in New Issue
Block a user