255 lines
6.0 KiB
Vue
255 lines
6.0 KiB
Vue
<template>
|
|
<view class="myPage bgLightBlue">
|
|
<view class="bg">
|
|
<headers :showBack="false" :themeType="'white'">
|
|
<view class="headerName">
|
|
我的
|
|
</view>
|
|
</headers>
|
|
<view class="userBox">
|
|
<image class="userImg" src="../../static/userImg.png"></image>
|
|
<span v-if="uid">{{userInfo.realName}}</span>
|
|
<span v-else>{{userInfo.account}}</span>
|
|
</view>
|
|
</view>
|
|
<!-- v-if="COMPANY != 'nanchang'" -->
|
|
<view class="operateBar" @click="viewFileFn">
|
|
<view class="left">
|
|
<image class="operateIcon" src="/static/file.png" mode="widthFix"></image>
|
|
工地资料
|
|
</view>
|
|
<uni-icons class="arrowright" type="arrowright" size="20"></uni-icons>
|
|
</view>
|
|
<view class="operateBar" @click="toMessageCenter">
|
|
<view class="left">
|
|
<image class="operateIcon" src="/static/file.png" mode="widthFix"></image>
|
|
我的消息
|
|
</view>
|
|
<uni-icons class="arrowright" type="arrowright" size="20"></uni-icons>
|
|
</view>
|
|
<view class="operateBar" @click="goBackEndFn" v-if="userInfo.accountType!=5&&userInfo.accountType!=6">
|
|
<view class="left">
|
|
<image class="operateIcon" src="/static/file.png" mode="widthFix"></image>
|
|
项目后台
|
|
</view>
|
|
<uni-icons class="arrowright" type="arrowright" size="20"></uni-icons>
|
|
</view>
|
|
<!-- <view class="operateBar" @click="viewVersionInfo" v-if="COMPANY != 'longguang' && COMPANY != 'nanchang'">
|
|
<view class="left">
|
|
<image class="operateIcon" src="/static/download.png" mode="widthFix"></image>
|
|
检测新版本 {{version}}
|
|
</view>
|
|
<uni-icons class="arrowright" type="arrowright" size="20"></uni-icons>
|
|
</view> -->
|
|
<view v-if="!uid" class="operateBar logoutBar" @click="logout">
|
|
退出登录
|
|
</view>
|
|
<footers v-if="flag" :activeTab="'my'"></footers>
|
|
<footers2 v-else></footers2>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import uniIcons from "@/components/uni-icons/uni-icons.vue"
|
|
import footers from "../../components/footers/footers.vue"
|
|
import footers2 from "../../components/footers/footers2.vue"
|
|
import headers from "../../components/headers/headers.vue"
|
|
export default {
|
|
components: {
|
|
footers,
|
|
uniIcons,
|
|
headers,
|
|
footers2
|
|
},
|
|
data() {
|
|
return {
|
|
userInfo: {
|
|
accountType: 0
|
|
},
|
|
systemInfo: {},
|
|
version: '',
|
|
flag: true,
|
|
uid:'',
|
|
};
|
|
},
|
|
onLoad(val) {
|
|
this.uid = uni.getStorageSync('UID')
|
|
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
|
|
this.systemInfo = uni.getStorageSync('systemInfo')
|
|
if (typeof plus !== "undefined") {
|
|
this.version = plus.runtime.version
|
|
}
|
|
if (val.type == 1) {
|
|
this.flag = false
|
|
}
|
|
},
|
|
methods: {
|
|
viewVersionInfo() {
|
|
|
|
var that = this
|
|
// console.log('viewVersionInfo',that.url_config)
|
|
// uni.navigateTo({
|
|
// url:'versionInfo'
|
|
// })
|
|
|
|
if (this.systemInfo.platform.indexOf('android') != -1 && typeof plus !== "undefined") {
|
|
//获取最新版本
|
|
that.sendRequest({
|
|
url: "xmgl/appVersion/getAppVersion",
|
|
data: {},
|
|
method: "POST",
|
|
success(res2) {
|
|
console.log('最新版本', res2)
|
|
//获取当前应用版本
|
|
console.log('plus.runtime.version', plus.runtime.version)
|
|
if (res2.result && (res2.result.versionNo != plus.runtime.version)) {
|
|
uni.showModal({
|
|
title: '版本更新',
|
|
content: '更新内容:' + res2.result.versionDescribe,
|
|
confirmText: '更新',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
console.log('用户点击确定');
|
|
var url = that.url_config + 'image/' + JSON.parse(res2.result
|
|
.downloadUrl)[0].url
|
|
console.log('apk地址', url)
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '正在后台下载更新资源,请耐心等待。。。',
|
|
showCancel: false
|
|
})
|
|
uni.downloadFile({
|
|
url: url,
|
|
success: (res) => {
|
|
// uni.hideLoading()
|
|
console.log('res', res)
|
|
if (res.statusCode === 200) {
|
|
console.log('下载成功33');
|
|
var fileSaveUrl = plus.io
|
|
.convertLocalFileSystemURL(res
|
|
.tempFilePath);
|
|
plus.runtime.openFile(res
|
|
.tempFilePath); //选择软件打开文件
|
|
}
|
|
}
|
|
});
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: '您已经是最新版本啦!',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
},
|
|
goBackEndFn() {
|
|
uni.navigateTo({
|
|
url: '../areaTree/areaTree?type=backend'
|
|
})
|
|
},
|
|
viewFileFn() {
|
|
uni.navigateTo({
|
|
url: '../fileList/fileList'
|
|
})
|
|
},
|
|
toMessageCenter() {
|
|
uni.navigateTo({
|
|
url: '../messageCenter/messageCenter'
|
|
})
|
|
},
|
|
logout() {
|
|
|
|
|
|
|
|
this.sendRequest({
|
|
url: "xmgl/base/logout",
|
|
data: {
|
|
id:this.userInfo.userId
|
|
},
|
|
method: "POST",
|
|
success(res) {
|
|
uni.removeStorageSync('userInfo');
|
|
uni.removeStorageSync('projectDetail');
|
|
uni.redirectTo({
|
|
url: '/pages/login/login'
|
|
})
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.myPage {
|
|
height: 100%;
|
|
|
|
/deep/.headerBox {
|
|
border-bottom: none;
|
|
}
|
|
}
|
|
|
|
.bg {
|
|
background-color: #2b8df3;
|
|
;
|
|
color: #FFFFFF;
|
|
|
|
.title {
|
|
text-align: center;
|
|
// padding: 10px 0 0;
|
|
}
|
|
}
|
|
|
|
.userBox {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 40px 20px;
|
|
font-size: 20px;
|
|
}
|
|
|
|
.userImg {
|
|
width: 50px;
|
|
height: 50px;
|
|
border-radius: 50%;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.operateBar {
|
|
background-color: #FFFFFF;
|
|
font-size: 14px;
|
|
height: 58px;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
padding: 0 15px;
|
|
justify-content: space-between;
|
|
|
|
.left {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.operateIcon {
|
|
width: 20px;
|
|
height: 20px;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.arrowright {
|
|
opacity: 0.5;
|
|
}
|
|
}
|
|
|
|
.logoutBar {
|
|
justify-content: center;
|
|
}
|
|
</style>
|