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.
97 lines
2.2 KiB
Vue
97 lines
2.2 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-item title="退出登录" show-arrow="true" clickable @click="clearStorage">
|
|
</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,
|
|
count: 0
|
|
})
|
|
|
|
const { hadUpdate, appInfo, userInfo, count } = 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')
|
|
}
|
|
|
|
function clearStorage () {
|
|
// count.value++;
|
|
// if (count.value < 3) return;
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确定要退出登录吗?',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
uni.clearStorageSync();
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
}
|
|
}
|
|
});
|
|
// uni.clearStorageSync();
|
|
// uni.showToast({
|
|
// title: '退出成功',
|
|
// success() {
|
|
// uni.reLaunch({
|
|
// url: '/pages/login/login'
|
|
// })
|
|
// }
|
|
// })
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
</style>
|