| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <!-- index.vue -->
- <template>
- <page-meta root-font-size="system" />
- <view class="container">
- <!-- 列表区域 -->
- <view class="list-item" @click="pwdEdit">
- <view>
- <uni-icons type="locked-filled" size="20"></uni-icons>
- <text>修改密码</text>
- </view>
- <text class="desc"></text>
- </view>
- <view class="list-item" @click="checkUpdate">
- <view>
- <uni-icons type="refreshempty" size="20"></uni-icons>
- <text>检查更新</text>
- </view>
- <text class="desc"></text>
- </view>
- <view class="list-item" @click="clearCache">
- <view>
- <uni-icons type="trash-filled" size="20"></uni-icons>
- <text>清理缓存</text>
- </view>
- <text class="desc"></text>
- </view>
- <!-- 退出登录按钮 -->
- <view class="logOut">
- <button type="warn" @click="logOut">退出登录</button>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import $tab from "@/plugins/tab.js"
- import $modal from '@/plugins/modal.js'
- import { useUserStore } from '@/store/user.js'
- import { clearCache } from '@/utils/ygoa.js'
- const userStore = useUserStore()
- // 退出登录
- function logOut() {
- $modal.confirm('确定注销并退出系统吗?')
- .then(res => {
- userStore.LogOut()
- $tab.reLaunch('/pages/login')
- }).catch(() => { })
- };
- // 修改密码
- function pwdEdit() {
- $tab.navigateTo('/pages/mine/setting/pwdEdit/pwdEdit');
- };
- // 检查更新
- function checkUpdate() {
- const updateManager = uni.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- // 请求完新版本信息的回调
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function (res) {
- $modal.confirm('新版本已经准备好,是否重启应用?', '更新提示').then(res => {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate();
- }).catch(() => { })
- });
- } else {
- $modal.showToast('暂无版本更新')
- }
- });
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding: 20px;
- }
- .list-item {
- color: #666;
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: calc(1rem + 0px);
- padding: 0.75rem;
- background-color: #ffffff;
- border-radius: 10rpx;
- margin-bottom: 0.75rem;
- border-bottom: 1px solid gainsboro;
- ::v-deep .uni-icons {
- font-size: calc(1.25rem + 0px) !important;
- margin-right: 6px;
- }
- }
- .logOut {
- margin-top: 2rem;
- button {
- font-size: calc(18px + .5*(1rem - 16px));
- }
- }
- .desc {
- color: #777;
- margin-right: 0.5rem;
- }
- .desc::after {
- content: ">";
- }
- </style>
|