|
@@ -20,13 +20,16 @@
|
|
|
</view>
|
|
|
<!-- 退出 -->
|
|
|
<view class="user-btn">
|
|
|
- <u-button type="success" :custom-style="quitButton" @click="quitSys" shape="circle">退出登录</u-button>
|
|
|
+ <u-button type="success" :custom-style="quitButton" @click="quitOutSys" shape="circle">退出登录</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { getUserInfo, logout } from '@/api/user.js'
|
|
|
+ import { getSysVersion } from '@/api/data.js'
|
|
|
+ import { checkVersionToLoadUpdate, clzConfirm } from '@/libs/tools';
|
|
|
+ import market from "@/js_sdk/dc-market/market.js"
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -47,13 +50,13 @@
|
|
|
methods:{
|
|
|
// 获取用户信息
|
|
|
getUserInfo(){
|
|
|
- // getUserInfo().then(res => {
|
|
|
- // if(res.status == 200){
|
|
|
- // this.userInfoData = res.data
|
|
|
- // }else{
|
|
|
- // this.userInfoData = null
|
|
|
- // }
|
|
|
- // })
|
|
|
+ getUserInfo().then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.userInfoData = res.data
|
|
|
+ }else{
|
|
|
+ this.userInfoData = null
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 打开对应的页面
|
|
|
toPage(index){
|
|
@@ -65,38 +68,49 @@
|
|
|
url: pageUrl[index]
|
|
|
})
|
|
|
},
|
|
|
- // 跳转
|
|
|
- toUserPage(){
|
|
|
- // 未登录跳转登录,已登录跳转用户信息页
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/userCenter/userInfo/userInfo'
|
|
|
- })
|
|
|
+ // 退出登录确认弹框
|
|
|
+ quitOutSys() {
|
|
|
+ const _this = this;
|
|
|
+ clzConfirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定退出登录?',
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm || res.index == 0) {
|
|
|
+ _this.quitSys();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- // 乐豆明细
|
|
|
- toLdPage(){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/userCenter/ldDetailed'
|
|
|
- })
|
|
|
+ // 退出登录,返回登录页
|
|
|
+ quitSys() {
|
|
|
+ logout().then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$store.commit("$closeWebsocket")
|
|
|
+ this.$store.state.vuex_token = '';
|
|
|
+ this.$store.state.vuex_userData = '';
|
|
|
+ uni.setStorageSync('setStatusIndexFunc', 0);
|
|
|
+ this.$toashMsg(res.message)
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- // 退出登录
|
|
|
- quitSys(){
|
|
|
- let _this = this
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '您确定要退出登录吗?',
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- // logout({}).then(res => {
|
|
|
- // getApp().globalData.token = ''
|
|
|
- // _this.$u.vuex('vuex_token','')
|
|
|
- // // 关闭socket
|
|
|
- // // _this.$store.commit("$closeWebsocket")
|
|
|
- // uni.reLaunch({
|
|
|
- // url: '/pages/login/pwLogin'
|
|
|
- // })
|
|
|
- // })
|
|
|
- }
|
|
|
- }
|
|
|
+ // 获取最新版本信息
|
|
|
+ getVersion() {
|
|
|
+ let version = getApp().globalData.version
|
|
|
+ console.log(version)
|
|
|
+ getSysVersion({versionType:version.platform=='android'?'ANDROID':'IOS'}).then(ret => {
|
|
|
+ console.log(JSON.stringify(ret))
|
|
|
+ if(ret.status == 200){
|
|
|
+ console.log(ret.data)
|
|
|
+ this.$store.state.vuex_versionInfo = ret.data
|
|
|
+ //进行版本型号的比对 以及下载更新请求
|
|
|
+ checkVersionToLoadUpdate(ret.data, 1, market);
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|