123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view class="user-content">
- <view class="status_bar">
- <!-- 这里是状态栏 -->
- </view>
- <!-- 头部 -->
- <view class="user-head" :style="`background:${$config('primaryColor')}`">
- <view class="user-photo">
- <u-avatar :src="userAvatarUrl" size="100" class="avatar"></u-avatar>
- </view>
- <view class="user-info">
- <text class="user-name">{{$store.state.vuex_userData.userNameCN}}</text>
- <text class="user-phone">{{$store.state.vuex_userData.username}}</text>
- </view>
- </view>
- <!-- 列表 -->
- <view class="user-list">
- <u-cell-group>
- <u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="0" @click="toPage(0)" title="服务协议及隐私政策"></u-cell-item>
- <!-- <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage" title="关于我们"></u-cell-item> -->
- <u-cell-item icon="lock" icon-size="38" :icon-style="{color:'#00aaff'}" index="2" @click="toPage(1)" title="修改密码"></u-cell-item>
- </u-cell-group>
- </view>
- <!-- 退出 -->
- <view class="user-btn">
- <u-button type="success" :custom-style="{background:$config('infoColor')}" hover-class="none" @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 {
- userInfoData: null, // 用户信息
- userAvatarUrl: '' // 用户头像
- };
- },
- onShow() {
- this.getUserInfo()
- },
- onLoad() {
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: this.$config('primaryColor')
- })
- },
- methods:{
- // 获取用户信息
- getUserInfo(){
- console.log(this.$store.state.vuex_userData)
- // getUserInfo().then(res => {
- // if(res.status == 200){
- // this.userInfoData = res.data
- // }else{
- // this.userInfoData = null
- // }
- // })
- },
- // 打开对应的页面
- toPage(index){
- let pageUrl=[
- '/pages/login/userAuthYs?fromPage=usercenter',
- '/pages/userCenter/changePwd'
- ]
- uni.navigateTo({
- url: pageUrl[index]
- })
- },
- // 退出登录确认弹框
- quitOutSys() {
- const _this = this;
- clzConfirm({
- title: '提示',
- content: '确定退出登录?',
- success: function(res) {
- if (res.confirm || res.index == 0) {
- _this.quitSys();
- }
- }
- });
- },
- // 退出登录,返回登录页
- 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);
- setTimeout(function() {
- uni.reLaunch({
- url: '/pages/login/login'
- });
- }, 500);
- }
- });
- },
- // 获取最新版本信息
- 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);
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .user-content{
- width: 100%;
- .user-head{
- display: flex;
- align-items: center;
- padding: 80rpx 35rpx;
- .user-photo{
- flex-shrink: 0;
- margin-right: 5rpx;
- }
- .user-info{
- flex-grow: 1;
- padding: 0 20rpx;
- color: #FFFFFF;
- .user-name{
- display: block;
- font-size: 36rpx;
- margin-bottom: 10rpx;
- }
- .user-phone{
- display: block;
- font-size: 28rpx;
- }
- }
- }
- .user-list{
- border-radius: 15upx;
- margin: 20upx;
- overflow: hidden;
- box-shadow: 0upx 3upx 6upx #eee;
- }
- .user-btn{
- padding: 85rpx 200rpx;
- }
- }
- </style>
|