You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
513 lines
15 KiB
513 lines
15 KiB
<template>
|
|
<view>
|
|
<!-- 头部 -->
|
|
<view class="dzhi_top">
|
|
<!-- <image src="" class="dzhi_t_bg" mode="aspectFill"></image> -->
|
|
<view class="mode_com">
|
|
<view class="dly_flex person_inf">
|
|
<view class="pers_box" @tap="oauthUser()">
|
|
<view class="pes_img">
|
|
<!-- 默认头像 -->
|
|
<button class="btn_dzhi">
|
|
<!--授权按钮-->
|
|
<image :src="headimgurl" mode="aspectFill" class="pers_box"></image>
|
|
</button>
|
|
</view>
|
|
</view>
|
|
<view class="pes_inf aml_30">
|
|
<!-- 用户昵称 -->
|
|
<view class="t_adm_box">
|
|
<text class="t_hi">Hi</text>
|
|
<!-- <text class="t_nic">{{nickname}}阳光夏~小葵</text> -- 已登录状态 显示用户昵称 -->
|
|
<text class="t_nic">{{ nickname }}</text>
|
|
<!--登录后 退出按钮-->
|
|
<text v-if="isLogin" class="pes_img_tc" @tap="jump('logoutWechat')">退出</text>
|
|
</view>
|
|
</view>
|
|
<!-- 头像 -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="mode_com">
|
|
<text class="tit_com">我的应用</text>
|
|
<view class="dly_flex hd_pter mt_hb dzhi_bq2" style="background: #fff; padding-bottom: 40rpx; border-radius: 20rpx">
|
|
<view class="w_33" @tap="jump('myReserve')">
|
|
<view class=""><image src="../../static/animg/p_wdpj.png" class="kou_top3" mode="aspectFill"></image></view>
|
|
<text class="ht_text">我的预约</text>
|
|
</view>
|
|
|
|
<view class="w_33" @tap="jump('tousu')">
|
|
<view class=""><image src="../../static/animg/p_lyts.png" class="kou_top3" mode="aspectFill"></image></view>
|
|
<text class="ht_text">我的投诉</text>
|
|
</view>
|
|
|
|
<view class="w_33" @tap="jump('aboutus')">
|
|
<view class=""><image src="../../static/animg/p_gywm.png" class="kou_top3" mode="aspectFill"></image></view>
|
|
<text class="ht_text">客服电话</text>
|
|
</view>
|
|
|
|
<view class="w_33" @tap="jump('logout')" >
|
|
<view class=""><image src="../../static/animg/p_tc.png" class="kou_top3" mode="aspectFill"></image></view>
|
|
<text class="ht_text">退出登录</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 兴趣定制 -->
|
|
|
|
<!-- 工具栏 -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
var that;
|
|
import aes from '@/common/aes.js';
|
|
export default {
|
|
data() {
|
|
that = this;
|
|
return {
|
|
headimgurl: '../../static/images/adm_img.png',
|
|
nickname: '点击头像授权',
|
|
isUpdate: true,
|
|
isLogin: false,
|
|
isShowOnlinets: 'NO',
|
|
isFlag: false,
|
|
scenicList: [],
|
|
lineList: [],
|
|
foodImgList: [],
|
|
methodImgList: [],
|
|
scenicGZType: 'NO',
|
|
lineGZType: 'NO',
|
|
foodGZType: 'NO',
|
|
methodGZType: 'NO',
|
|
scenicSelectStr: '',
|
|
lineSelectStr: '',
|
|
imgBase64: '',
|
|
adminId: '',
|
|
isAdminLogin: false
|
|
};
|
|
},
|
|
onShow() {
|
|
|
|
if (!this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
this.isLogin = true;
|
|
that.nickname = aes.aesDecrypt(uni.getStorageSync('nickname'));
|
|
that.headimgurl = aes.aesDecrypt(uni.getStorageSync('headimgurl'));
|
|
}
|
|
if (
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != undefined &&
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != null &&
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != ''
|
|
) {
|
|
this.adminId = uni.getStorageSync('adminId');
|
|
this.isAdminLogin = true;
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
if (
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != undefined &&
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != null &&
|
|
aes.aesDecrypt(uni.getStorageSync('adminId')) != ''
|
|
) {
|
|
this.adminId = aes.aesDecrypt(uni.getStorageSync('adminId'));
|
|
this.isAdminLogin = true;
|
|
}
|
|
// options = this.$param.user_info;
|
|
var that = this;
|
|
this.getIsShow();
|
|
// #ifdef H5
|
|
if (this.$wechat.isWechat()) {
|
|
//weixin 是否显示更新
|
|
this.isUpdate = false;
|
|
} else {
|
|
this.isUpdate = true;
|
|
}
|
|
// #endif
|
|
if (uni.getStorageSync('oauthTime') + this.$param.update_oauthTime < new Date().getTime()) {
|
|
// uni.removeStorageSync("user_token");
|
|
uni.removeStorageSync('nickname');
|
|
uni.removeStorageSync('unionid');
|
|
uni.removeStorageSync('headimgurl');
|
|
}
|
|
uni.showLoading({
|
|
mask: true,
|
|
title: '授权中',
|
|
success() {
|
|
setTimeout(function () {
|
|
uni.hideLoading();
|
|
}, 3000);
|
|
}
|
|
});
|
|
if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
if (options == null || options.unionid == null || options.unionid == '' || options.unionid == undefined) {
|
|
if (this.$wechat.isWechat()) {
|
|
//weixin 授权
|
|
that.$util.getUser(that, 'person', '', '');
|
|
} else {
|
|
switch (uni.getSystemInfoSync().platform) {
|
|
case 'android':
|
|
//安卓授权
|
|
var that = this;
|
|
this.$util.bindGpsObj(that);
|
|
Android.gotoDetial('WxUserInfo', '');
|
|
break;
|
|
case 'ios':
|
|
//ios授权
|
|
var that = this;
|
|
this.$util.bindGpsObj(that);
|
|
window.location.href = 'https://www.baidu.com?url=wechat';
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
// clearTimeout(timer);
|
|
//登陆后返回回来的界面
|
|
uni.setStorageSync('oauthTime', new Date().getTime());
|
|
uni.setStorageSync('nickname', aes.aesMinEncrypt(options.nickname));
|
|
uni.setStorageSync('openid', aes.aesMinEncrypt(options.openid));
|
|
uni.setStorageSync('unionid', aes.aesMinEncrypt(options.unionid));
|
|
uni.setStorageSync('headimgurl', aes.aesMinEncrypt(options.headimgurl));
|
|
that.nickname = aes.aesDecrypt(uni.getStorageSync('nickname'));
|
|
that.headimgurl = aes.aesDecrypt(uni.getStorageSync('headimgurl'));
|
|
that.isLogin = true;
|
|
that.getUserInterest(); //回显兴趣定制数据
|
|
// this.$util.getUserInfo(that,options.unionid,function(){
|
|
uni.hideLoading();
|
|
// });
|
|
}
|
|
} else {
|
|
// if(uni.getStorageSync("user_token") == undefined || uni.getStorageSync("user_token") == null || uni.getStorageSync("user_token") == ""){
|
|
// this.$util.getUserInfo(that,uni.getStorageSync("unionid"),function(){
|
|
// that.isLogin = true;
|
|
// that.nickname = uni.getStorageSync("nickname");
|
|
// that.headimgurl = uni.getStorageSync("headimgurl");
|
|
// uni.hideLoading();
|
|
// });
|
|
// }else{
|
|
this.isLogin = true;
|
|
this.nickname = aes.aesDecrypt(uni.getStorageSync('nickname'));
|
|
this.headimgurl = aes.aesDecrypt(uni.getStorageSync('headimgurl'));
|
|
that.getUserInterest(); //回显兴趣定制数据
|
|
that.getAndroidUserKey(); //推送
|
|
uni.hideLoading();
|
|
// }
|
|
}
|
|
},
|
|
methods: {
|
|
saveLoginLog: function (unionid) {
|
|
var that = this;
|
|
uni.getSystemInfo({
|
|
success(e) {
|
|
var model = e.model + ' ' + e.system;
|
|
var platform = e.platform;
|
|
var data = {
|
|
userkey: that.$param.userkey,
|
|
unionid: unionid,
|
|
model: model,
|
|
platform: platform
|
|
};
|
|
that.$Request.post(that.$config.insertLoginLog, data).then((res) => {
|
|
if (res.status == 200) {
|
|
console.log('记录成功');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
/* 是否显示投诉功能 */
|
|
getIsShow: function () {
|
|
this.$Request.post(this.$config.getYbsjSysParam, {}).then((res) => {
|
|
var d = res.data;
|
|
this.isShowOnlinets = d.is_show_onlinets;
|
|
});
|
|
},
|
|
oauthUser: function () {
|
|
// #ifdef MP-WEIXIN
|
|
wx.login({
|
|
success:(res) => {
|
|
console.log(res,'登录获取的code')
|
|
this.code = res.code;
|
|
wx.request({
|
|
url:"https://api.weixin.qq.com/sns/jscode2session?appid=wxaf70a5cd03b06c19&secret=7ae3b6e164593cf30acfd3f5b8cbea0c&js_code="+this.code+"&grant_type=authorization_code",
|
|
success:function(res){
|
|
console.log(res)
|
|
},
|
|
fail: function(err){
|
|
console.log(err)//App.json中默认超时时间为60秒
|
|
}
|
|
})
|
|
console.log(this.code,res);
|
|
},
|
|
fail: function (error) {
|
|
console.log('login failed ' + error);
|
|
}
|
|
});
|
|
wx.getUserProfile({
|
|
desc: '用于完善会员资料',
|
|
success:(res) => {
|
|
console.log(this.code,res);
|
|
},
|
|
fail: function (error) {
|
|
console.log('login failed ' + error);
|
|
}
|
|
})
|
|
wx.getUserInfo({
|
|
provider: 'weixin',
|
|
success:(res) => {
|
|
console.log(this.code,res);
|
|
},
|
|
fail: function (error) {
|
|
console.log('login failed ' + error);
|
|
}
|
|
})
|
|
uni.login({
|
|
"provider": "weixin",
|
|
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
|
success: function(event){
|
|
console.log(event)
|
|
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
|
|
|
},
|
|
fail: function (err) {
|
|
// 登录授权失败
|
|
// err.code是错误码
|
|
}
|
|
})
|
|
that.$util.getUser(that, 'person', '', '');
|
|
// #endif
|
|
// #ifndef MP-WEIXIN
|
|
if (this.isLogin) {
|
|
return;
|
|
} else {
|
|
uni.showLoading({
|
|
mask: true,
|
|
title: '授权中',
|
|
success() {
|
|
setTimeout(function () {
|
|
// uni.showToast({
|
|
// title:"授权失败,点击"+that.nickname+"重新授权",
|
|
// icon:"none",
|
|
// duration: 1500
|
|
// })
|
|
uni.hideLoading();
|
|
}, 3000);
|
|
}
|
|
});
|
|
if (this.$wechat.isWechat()) {
|
|
//weixin 授权
|
|
that.$util.getUser(this, 'person', '', '');
|
|
} else {
|
|
switch (uni.getSystemInfoSync().platform) {
|
|
case 'android':
|
|
//安卓授权
|
|
var that = this;
|
|
this.$util.bindGpsObj(that);
|
|
Android.gotoDetial('WxUserInfo', '');
|
|
break;
|
|
case 'ios':
|
|
//ios授权
|
|
var that = this;
|
|
this.$util.bindGpsObj(that);
|
|
window.location.href = 'https://www.baidu.com?url=wechat';
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// #endif
|
|
},
|
|
callBackMethod: function () {
|
|
// clearTimeout(timer);
|
|
this.isLogin = true;
|
|
that.nickname = aes.aesDecrypt(uni.getStorageSync('nickname'));
|
|
that.headimgurl = aes.aesDecrypt(uni.getStorageSync('headimgurl'));
|
|
that.getUserInterest(); //回显兴趣定制数据
|
|
that.getAndroidUserKey(); //推送
|
|
uni.hideLoading();
|
|
that.saveLoginLog(aes.aesDecrypt(uni.getStorageSync('unionid')));
|
|
},
|
|
jump: function (obj) {
|
|
if (obj == 'aboutus') {
|
|
uni.navigateTo({
|
|
url: '/pages/personcenter/aboutus'
|
|
});
|
|
} else if (obj == 'yuyue') {
|
|
// if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
// uni.showToast({
|
|
// title: '请先授权',
|
|
// icon: 'none'
|
|
// });
|
|
// return;
|
|
// }
|
|
uni.navigateTo({
|
|
url: '/pages/scenic/subscribe/yuyue/yue_list_js'
|
|
});
|
|
} else if (obj == 'tousu') {
|
|
// if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
// uni.showToast({
|
|
// title: '请先授权',
|
|
// icon: 'none'
|
|
// });
|
|
// return;
|
|
// }
|
|
uni.navigateTo({
|
|
url: '/pages/suggest/sug_list'
|
|
});
|
|
} else if (obj == 'myReserve') {
|
|
/* if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
uni.showToast({
|
|
title: '请先授权',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
} */
|
|
uni.navigateTo({
|
|
url: '/pages/myReserve/myReserve'
|
|
});
|
|
} else if (obj == 'admin') {
|
|
uni.navigateTo({
|
|
url: '/pages/personcenter/adminLogin/adminLogin'
|
|
});
|
|
} else if (obj == 'scanRecord') {
|
|
if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('adminId')))) {
|
|
uni.showToast({
|
|
title: '请先登陆管理员',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
uni.navigateTo({
|
|
url: '/pages/personcenter/scanCodeRecord/scanCodeRecord'
|
|
});
|
|
} else if (obj == 'logout') {
|
|
uni.removeStorageSync('adminId');
|
|
this.adminId = '';
|
|
this.isAdminLogin = false;
|
|
} else if (obj == 'logoutWechat') {
|
|
if (!this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
uni.removeStorageSync('nickname');
|
|
uni.removeStorageSync('headimgurl');
|
|
uni.removeStorageSync('oauthTime');
|
|
uni.removeStorageSync('openid');
|
|
uni.removeStorageSync('unionid');
|
|
this.nickname = "点击头像授权";
|
|
this.headimgurl = "../../static/images/adm_img.png";
|
|
this.isLogin = false;
|
|
}
|
|
} else if (obj == 'myComment') {
|
|
if (this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync('unionid')))) {
|
|
uni.showToast({
|
|
title: '请先授权',
|
|
icon: 'none'
|
|
});
|
|
return;
|
|
}
|
|
uni.navigateTo({
|
|
url: '/pages/myComment/list/list'
|
|
});
|
|
} else if (obj == 'delete') {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: '提示',
|
|
icon: 'none',
|
|
content:"该操作将会清空所有用户数据!是否注销账户",
|
|
success: function (res) {
|
|
if (res.confirm) {
|
|
that.deleteUserApp();
|
|
this.scenicGZType = 'NO',
|
|
this.lineGZType = 'NO',
|
|
this.foodGZType = 'NO',
|
|
this.methodGZType = 'NO',
|
|
uni.removeStorageSync('nickname');
|
|
uni.removeStorageSync('headimgurl');
|
|
uni.removeStorageSync('oauthTime');
|
|
uni.removeStorageSync('openid');
|
|
uni.removeStorageSync('unionid');
|
|
this.nickname = "点击头像授权";
|
|
this.headimgurl = "../../static/images/adm_img.png";
|
|
this.isLogin = false;
|
|
} else if (res.cancel) {
|
|
}
|
|
}
|
|
});
|
|
}
|
|
},
|
|
getUserInterest: function () {
|
|
var that = this;
|
|
var data = {
|
|
userid: aes.aesDecrypt(uni.getStorageSync('unionid')),
|
|
userkey: this.$param.userkey
|
|
//userid: "2"
|
|
};
|
|
this.$Request.post(this.$config.getUserInterest, data).then(res => {
|
|
var data = res.data;
|
|
that.scenicGZType = data.scenic_isShow;
|
|
that.lineGZType = data.line_isShow;
|
|
that.foodGZType = data.food_isShow;
|
|
that.methodGZType = data.method_isShow;
|
|
var scenicArr = data.scenic_msg.split(',');
|
|
var lineArr = data.line_msg.split(',');
|
|
for (var i = 0; i < scenicArr.length; i++) {
|
|
if (!this.$util.isBlack(scenicArr[i])) {
|
|
that.scenicSelectXQ(scenicArr[i].split('_')[1], 'hx');
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < lineArr.length; i++) {
|
|
if (!this.$util.isBlack(lineArr[i])) {
|
|
that.lineSelectXQ(lineArr[i].split('_')[1], 'hx');
|
|
}
|
|
}
|
|
});
|
|
},
|
|
deleteUserApp: function () {
|
|
var data = {
|
|
userid: aes.aesDecrypt(uni.getStorageSync('unionid')),
|
|
userkey: this.$param.userkey
|
|
};
|
|
this.$Request.post(this.$config.deleteUserApp, data).then(res => {
|
|
uni.showToast({
|
|
title: "注销成功!",
|
|
duration: 2000
|
|
});
|
|
});
|
|
},
|
|
getAndroidUserKey: function () {
|
|
this.$util.bindGpsObj(this);
|
|
switch (uni.getSystemInfoSync().platform) {
|
|
case 'android':
|
|
console.log('运行Android上');
|
|
Android.gotoDetial('DEVICEID', '');
|
|
break;
|
|
case 'ios':
|
|
console.log('运行iOS上');
|
|
window.location.href = 'https://www.baidu.com?url=tuisong';
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
},
|
|
imgPushTest: function (code) {
|
|
if (!aes.aesDecrypt(uni.getStorageSync('imgPushType'))) {
|
|
var data = {
|
|
areacode: this.$config.ARER_CODE_FOUR,
|
|
userStr: code,
|
|
lng: this.$param.lng,
|
|
lat: this.$param.lat,
|
|
imgUrl: this.$config.REAUEST_ROOTPATH,
|
|
userkey: this.$param.userkey,
|
|
userid: aes.aesDecrypt(uni.getStorageSync('unionid')),
|
|
pageType: ''
|
|
};
|
|
this.$Request.post(this.$config.imgPushFun, data).then(res => {});
|
|
}
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
@import url('../../static/css/common.css');
|
|
@import url('../../static/css/hebei.css');
|
|
</style>
|
|
|