You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.6 KiB
Vue

<template>
<view class="setting-page">
<ch-nav-bar :height="66" title="设置"></ch-nav-bar>
<uni-list>
<uni-list-item title="版本更新" show-arrow="true" clickable @click="checkAppUpdate">
<template v-slot:footer>
<uni-tag v-if="hadUpdate" text="新版本" type="primary"></uni-tag>
<text v-else>{{ appInfo.appWgtVersion }}</text>
</template>
</uni-list-item>
<uni-list-item title="家长二维码" show-arrow="true" clickable @click="checkQrcode">
</uni-list-item>
</uni-list>
<uni-popup ref="qrcodePopupRef" type="dialog">
<image :src="userInfo.qrcode" mode="aspectFit"></image>
</uni-popup>
</view>
</template>
<script setup>
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { reactive, ref, toRefs } from 'vue';
import { useSystemStore } from '@/store/system.js';
import { useUserStore } from '@/store/user.js';
const sysStore = useSystemStore();
const userStore = useUserStore();
const qrcodePopupRef = ref(null)
const data = reactive({
hadUpdate: false,
appInfo: sysStore.appInfo,
userInfo: userStore.userInfo
})
const { hadUpdate, appInfo, userInfo } = toRefs(data);
// 检查更新
function checkAppUpdate () {
// #ifdef APP
uni.showLoading({
title: '检查更新...'
})
checkUpdate().then(res => {
console.log('检查更新结果:', res)
if (res.code === 0) {
uni.showToast({
icon: 'none',
title: '暂无更新'
})
}
}).catch(error => {
console.log("检查更新错误:", error)
}).finally(() => {
uni.hideLoading()
})
// #endif
}
function checkQrcode () {
qrcodePopupRef.value.open('center')
}
</script>
<style lang="scss">
</style>