This commit is contained in:
2024-03-15 23:20:20 +08:00
parent 3ce85e2396
commit 351e20f0c0
19 changed files with 311 additions and 72 deletions

View File

@@ -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 = {