123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <hc-sys class="hc-config-page" :isNavBar="false">
- <view class="cu-list menu sm-border mt-1">
- <view class="cu-item arrow" @click="toPageClick('/pages/my/info')">
- <view class="content hc-flex">
- <text class="i-ri-user-3-fill text-blue text-32 mr-1"/>
- <text class="text-gray-4">个人资料</text>
- </view>
- <view class="action">{{userInfo.real_name}}</view>
- </view>
- <view class="cu-item">
- <view class="content hc-flex">
- <text class="i-solar-calendar-search-outline text-red-4 text-32 mr-1"/>
- <text class="text-gray-4">填报提醒</text>
- </view>
- <view class="action">
- <switch class="red" :class="appCheck?'checked':''" :checked="appCheck" @change="fillSwitchChange" style="transform:scale(0.9)"/>
- </view>
- </view>
- </view>
- <view class="cu-list menu sm-border">
- <view class="cu-item">
- <view class="content hc-flex">
- <text class="i-ri-pantone-fill text-purple text-32 mr-1"/>
- <text class="text-gray-4">当前版本</text>
- </view>
- <view class="action text-gray-5">v{{appInfo.appVersion}}</view>
- </view>
- <view class="cu-item" @click="detectUpgrades">
- <view class="content hc-flex">
- <text class="i-ri-rocket-fill text-cyan text-32 mr-1"/>
- <text class="text-gray-4">检测升级</text>
- </view>
- <view class="action">
- <view class="cu-tag round bg-blue light" v-if="appInfo.isUpdate">v{{appInfo.version}}</view>
- <text class="text-26 text-gray-5" v-else>暂无新版本</text>
- </view>
- </view>
- </view>
- </hc-sys>
- </template>
- <script setup>
- import {ref, watch} from "vue";
- import {onLoad} from '@dcloudio/uni-app'
- import {useAppStore} from "@/store";
- import userApi from '~api/user/index';
- //初始变量
- const store = useAppStore()
- const userInfo = ref(store.userInfo);
- const appInfo = ref(store.appUpdate)
- //渲染完成
- onLoad(() => {
- userConfigInfo()
- })
- //监听
- watch(() => [
- store.appUpdate
- ], ([val]) => {
- appInfo.value = val
- })
- const toPageClick = (url) => {
- uni.navigateTo({url: url});
- }
- //获取配置
- const appCheck = ref(true)
- const userConfigInfo = async () => {
- const { data } = await userApi.userConfigInfo()
- appCheck.value = data?.appCheck !== 2
- }
- //填报弹窗
- const fillSwitchChange = ({detail}) => {
- const check = detail.value ? 1 : 2
- userApi.userConfigSave({
- appCheck: check
- })
- appCheck.value = detail.value
- }
- //检测升级
- const detectUpgrades = () => {
- store.setOnUpdate(new Date().getTime())
- }
- </script>
|