182 lines
4.3 KiB
Vue
182 lines
4.3 KiB
Vue
<template>
|
|
<view class="page flex-col">
|
|
<view class="title" :style="{'top': uniMenuInfo.top + 6 + 'px'}">个人中心</view>
|
|
<view class="content" :style="{'top' : uniMenuInfo.top + 60 + 'px'}">
|
|
<view class="box_1">
|
|
<view>
|
|
<image class="head-img" src="/static/center/user_img2.png"></image>
|
|
<view class="nickname">
|
|
<text>用户编号: {{ userNumber }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="box_2">
|
|
<view class="orders" @tap="menuClick(1)">
|
|
<view class="orders-name">我的写真</view>
|
|
<view class="myOrders-icon"></view>
|
|
</view>
|
|
<view class="yjfk" @tap="menuClick(3)">
|
|
<view class="yjfk-name">意见反馈</view>
|
|
<view class="yjfk-icon"></view>
|
|
</view>
|
|
<button class="kfhh" open-type="contact">
|
|
<view class="kfhh-name">联系微信客服</view>
|
|
<view class="kfhh-icon"></view>
|
|
</button>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="section_8 flex-row justify-between">
|
|
<custom-tab-bar :selected="1" />
|
|
</view>
|
|
<!-- 隐私授权弹窗 -->
|
|
<zero-privacy ref="privacy" @agree='handleAgree' @disagree='handleDisagree'></zero-privacy>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import CustomTabBar from "@/components/customTabBar/customTabBar.vue"
|
|
export default {
|
|
components: {
|
|
CustomTabBar
|
|
},
|
|
data() {
|
|
return {
|
|
uniMenuInfo: {},
|
|
userNumber: '',
|
|
userInfo: {},
|
|
}
|
|
},
|
|
methods: {
|
|
getUserInfo() {
|
|
var _this = this;
|
|
uni.getUserInfo({
|
|
desc: '用于完善会员资料',
|
|
lang: 'zh_CN',
|
|
success: (user) => {
|
|
// >>当用户同意授权后, 获取到用户信息user
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success: loginRes => {
|
|
let userInfo = JSON.parse(user.rawData);
|
|
userInfo.code = loginRes.code;
|
|
uni.getSystemInfo({
|
|
success: function(res) {
|
|
userInfo.model = res.model
|
|
userInfo.edition = res.version
|
|
uni.request({
|
|
url: _this.java_http_url + '/applet/smart_camera/codeGetUserInfo',
|
|
method: "POST",
|
|
data: userInfo,
|
|
success(res) {
|
|
if(res.data.code == 200) {
|
|
userInfo = res.data.data;
|
|
_this.userInfo = userInfo;
|
|
_this.userNumber = _this.userInfo.openId.slice(-6);
|
|
uni.setStorageSync('userInfo', userInfo);
|
|
}
|
|
},
|
|
complete() {
|
|
uni.hideLoading();
|
|
}
|
|
})
|
|
},
|
|
})
|
|
}
|
|
})
|
|
},
|
|
fail(err) {
|
|
console.log(err);
|
|
uni.hideLoading();
|
|
}
|
|
})
|
|
},
|
|
handleDisagree() {
|
|
console.log('拒绝隐私授权');
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '拒绝授权部分功能将无法使用,是否退出小程序',
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
console.log('用户点击确定');
|
|
wx.exitMiniProgram({
|
|
success: (res) => {
|
|
console.log('退出小程序', res)
|
|
}})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
uni.switchTab({
|
|
url: '../home/home'
|
|
})
|
|
}
|
|
}
|
|
});
|
|
},
|
|
handleAgree() {
|
|
var _this = this;
|
|
uni.showLoading({
|
|
title: '正在加载...',
|
|
mask: true
|
|
});
|
|
_this.getUserInfo();
|
|
},
|
|
getPrivacySetting() {
|
|
var _this = this;
|
|
wx.getPrivacySetting({
|
|
success: res => {
|
|
if (res.needAuthorization) {
|
|
_this.$refs.privacy.open(res.privacyContractName);
|
|
}
|
|
}
|
|
})
|
|
},
|
|
menuClick(e){
|
|
console.log(e);
|
|
if(e == 1) {
|
|
uni.navigateTo({
|
|
url: '../myPhoto/myPhoto'
|
|
})
|
|
} else if(e ==2) {
|
|
uni.navigateTo({
|
|
url: '../myVideo/myVideo'
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: '该功能正在完善中!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
},
|
|
goHome() {
|
|
uni.navigateTo({
|
|
url: '../home/home'
|
|
})
|
|
}
|
|
},
|
|
onShow() {
|
|
var _this = this;
|
|
if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) {
|
|
this.$mp.page.getTabBar().setData({
|
|
selected: 1
|
|
})
|
|
}
|
|
if(!uni.getStorageSync('userInfo')) {
|
|
_this.getPrivacySetting();
|
|
} else {
|
|
_this.userInfo = uni.getStorageSync('userInfo');
|
|
_this.userNumber = _this.userInfo.openId.slice(-6);
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
var _this = this;
|
|
_this.uniMenuInfo = uni.getStorageSync('uniMenuInfo');
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import '@/css/common.css';
|
|
@import './index.css';
|
|
</style>
|