Browse Source

退出功能添加提示框

master
邓宏 2 years ago
parent
commit
fb327703ef
  1. 74
      pages/home/my.vue
  2. 2
      uni.scss

74
pages/home/my.vue

@ -79,18 +79,56 @@
<view class="item" @click="$u.route({url:'/pages/home/news'})">
<text class="plant-xitongxiaoxi"/> <text>系统消息</text> <text class="number">{{$store.state.sysMsgNum}}</text> <text class="plant-youbian"/>
</view>
<view class="item" @click="$store.commit('outLogin')">
<!-- <view class="item" @click="getVersion">
<text class="plant-banbenhao"/> <text>检测更新</text> <text class="number">{{appVersion}}</text> <text class="plant-youbian"/>
</view> -->
<view class="item" @click="outLogin">
<text class="plant-tuichu"/> <text>退出</text> <text class="plant-youbian"/>
</view>
</view>
<!-- 升级模态框 -->
<u-modal v-model="isShowModal">sfsdf</u-modal>
<u-modal
v-model="isShowModal"
ref="modal"
:confirm-text="modalOptions.okText"
cancel-text="暂不升级"
:async-close="modalOptions.asyncClose"
:title="modalOptions.modalTitle"
:content="modalOptions.modalContent"
:show-confirm-button="true"
:show-cancel-button="modalOptions.isShowCancel"
@confirm="upgrade">
<template v-if="modalOptions.isDownApp">
<u-circle-progress active-color="#2979ff" :percent="modalOptions.process" style="display:flex;margin:50rpx auto;">
<view class="u-progress-content">
<view class="u-progress-dot"></view>
<text class='u-progress-info'>{{modalOptions.process}}%</text>
</view>
</u-circle-progress>
</template>
</u-modal>
</view>
</template>
<script>
import {host} from '@/common/request'
import request,{host} from '@/common/request'
export default{
data(){
return{
host,
appVersion:"1.0.0",
isShowModal:true,
modalOptions:{
isShowCancel:true,
isDownApp:false,
modalContent:"请升级app到最新版本!",
process:0,
modalTitle:"监测到有新版本",
okText:"立刻升级",
asyncClose:true,
},
}
},
onLoad(options){
@ -99,6 +137,12 @@ import {host} from '@/common/request'
uni.navigateTo({url:`/pages/purchase/${options.toPage}`})
}
})
//#ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid, async info=>{
this.appVersion = info.version
})
//#endif
},
onShow(){
this.$store.commit("setSysMsgShow",false)
@ -110,7 +154,31 @@ import {host} from '@/common/request'
this.$store.commit("setSysMsgShow",true)
},
methods:{
outLogin(){
uni.showModal({
title:"提示",
content:"确定要退出吗?",
success:e=>{
if(e.confirm){
this.$store.commit('outLogin')
}
}
})
},
async getVersion(){
var res=await request("/appVersion/plantAppVersion/getAppVersion")
console.log(res,res.data.appVersion,'---------res----------')
if(res.statu){
this.isShowModal=true
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取版本号失败!",
showCancel:false,
})
}
},
upgrade(){},
},
}
</script>

2
uni.scss

@ -77,7 +77,7 @@ $uni-font-size-paragraph:15px;
@import '@/common/main.css';
@import 'uview-ui/theme.scss';
@import url('https://at.alicdn.com/t/c/font_3852037_huussxt3ujw.css');
@import url('https://at.alicdn.com/t/c/font_3852037_dw8vzriwv3d.css');
[class*=plant-]{
font-family: "plantMana" !important;
font-size: 16px;

Loading…
Cancel
Save