|
|
- <template>
- <view>
- <view class="se-px-30 se-pt-40 se-pb-20 se-fs-26 se-c-text-third">
- 账号设置
- </view>
- <view class="se-px-30 se-py-20 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="outLogin">
- <view class="se-flex se-flex-h-c">
- <image class="se-w-40 se-h-30 se-mr-10" src="@/static/image/7822.png" mode=""></image>
- <text>切换账号</text>
- </view>
- <view>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="se-px-30 se-pt-40 se-pb-20 se-fs-26 se-c-text-third">
- 系统设置
- </view>
- <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="onCache">
- <view class="se-flex se-flex-h-c">
- <image class="se-w-30 se-h-30 se-mr-10" src="@/static/image/47822.png" mode=""></image>
- <text>清理缓存</text>
- </view>
- <view class="">
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="checkUpdate">
- <view class="se-flex se-flex-h-c">
- <!-- <image class="se-w-50 se-h-30 se-mr-40" src="@/static/image/home.png" mode=""></image> -->
- <text>版本更新</text>
- </view>
- <view class="">
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="se-px-30 se-py-20 se-pt-40 se-flex se-flex-h-sb se-fs-28 se-c-black" @click="outLogin">
- <view class="se-flex se-flex-h-c">
- <!-- <image class="se-w-50 se-h-30 se-mr-40" src="@/static/image/home.png" mode=""></image> -->
- <text>退出登录</text>
- </view>
- <view class="">
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- export default{
- data(){
- return{
-
- }
- },
- methods:{
- onCache(){
- wx.clearStorage({
- success() {
- wx.showToast({
- title: "缓存已清除",
- icon: "none",
- });
- },
- fail() {
- wx.showToast({
- title: "清除失败",
- icon: "none",
- });
- },
- });
- },
- checkUpdate() {
- if (wx.getUpdateManager) {
- const updateManager = wx.getUpdateManager();
-
- // 监听是否有新版本
- updateManager.onCheckForUpdate((res) => {
- console.log("是否有新版本:", res.hasUpdate);
- if(!res.hasUpdate){
- uni.showToast({
- icon: "none",
- title: "暂无新版本"
- })
- }
-
- });
-
- // 监听新版本下载完成
- updateManager.onUpdateReady(() => {
- wx.showModal({
- title: "更新提示",
- content: "新版本已经准备好,是否重启应用?",
- success: (res) => {
- if (res.confirm) {
- updateManager.applyUpdate(); // 强制应用新版本
- }
- },
- });
- });
-
- // 监听更新失败
- updateManager.onUpdateFailed(() => {
- wx.showModal({
- title: "更新失败",
- content: "请删除小程序后重新打开。",
- });
- });
- } else {
- console.log("当前基础库版本不支持更新管理");
- }
- },
- outLogin(){
- uni.removeStorageSync("token")
- uni.removeStorageSync("company")
- uni.removeStorageSync("boss")
- uni.removeStorageSync("worker")
- uni.removeStorageSync("userInfo")
- uni.removeStorageSync("sysList")
- uni.redirectTo({
- url:"/pages/auth/index"
- })
- }
- }
- }
- </script>
-
- <style>
- </style>
|