一机游雄安uniapp源码
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.
 
 
 

294 lines
8.5 KiB

<template>
<view>
<!-- 头部 -->
<view class="pers_top">
<view class="mode_com">
<view class="dly_flex person_inf">
<view class="pes_inf">
<!-- 用户昵称 -->
<view class="t_adm_box">
<text class="t_hi">Hi</text>
<text class="t_nic">{{nickname}}</text>
</view>
</view>
<!-- 头像 -->
<view class="pers_box" @tap="oauthUser">
<view class="pes_img">
<!-- 默认头像 -->
<image :src="headimgurl" mode="aspectFill" class="pers_box"></image>
</view>
</view>
</view>
</view>
</view>
<!-- -->
<view class="mode_com">
<view class="pers_lst">
<view class="pers_line" @click="gotoList('dingdan')">
<image class="kou_top3" src="../../static/images/p_ddan.png"></image>
<text> 我的订单</text>
<image class="rgh_jtou" src="../../static/images/icn_down_g.png"></image>
</view>
<view class="pers_line" @click="gotoList('tousu')">
<image class="kou_top3" src="../../static/images/p_tsu.png"></image>
<text> 投诉电话</text>
<image class="rgh_jtou" src="../../static/images/icn_down_g.png"></image>
</view>
<view class="pers_line" @click="gotoList('aboutus')">
<image class="kou_top3" src="../../static/images/p_about.png"></image>
<text> 关于我们</text>
<image class="rgh_jtou" src="../../static/images/icn_down_g.png"></image>
</view>
<view class="pers_line" v-if="isUpdate" @click="gotoList('update')">
<image class="kou_top3" src="../../static/images/p_gxin.png"></image>
<text> 系统更新</text>
<image class="rgh_jtou" src="../../static/images/icn_down_g.png"></image>
</view>
<view class="pers_line" v-if="isShowOnlinets == 'YES'" @tap="gotoList('fankui')">
<image class="kou_top3" src="../../static/images/s_tsu.png"></image>
<text> 意见投诉</text>
<image class="rgh_jtou" src="../../static/images/icn_down_g.png"></image>
</view>
</view>
</view>
</view>
</template>
<script>
var that;
import aes from "@/common/aes.js";
export default {
data() {
that = this;
return {
nickname: "未授权",
headimgurl:"../../static/images/adm_img.png",
isUpdate:true,
isLogin:false,
isShowOnlinets:"NO"
// timer: null
}
},
onLoad(options) {
// options = this.$param.user_info;
var that = this;
this.getIsShow();
if(this.$wechat.isWechat()){
//weixin 是否显示更新
this.isUpdate = false;
}
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.showToast({
// title:"授权失败,点击"+that.nickname+"重新授权",
// icon:"none",
// duration: 1500
// })
uni.hideLoading();
},10000)
}
})
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授权
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;
this.$util.getUserInfo(that,options.unionid,function(){
uni.hideLoading();
});
}
}else{
if(aes.aesDecrypt(uni.getStorageSync("user_token")) == undefined || aes.aesDecrypt(uni.getStorageSync("user_token")) == null || aes.aesDecrypt(uni.getStorageSync("user_token")) == ""){
this.$util.getUserInfo(that,aes.aesDecrypt(uni.getStorageSync("unionid")),function(){
that.isLogin = true;
that.nickname = aes.aesDecrypt(uni.getStorageSync("nickname"));
that.headimgurl = aes.aesDecrypt(uni.getStorageSync("headimgurl"));
uni.hideLoading();
});
}else{
uni.hideLoading();
this.isLogin = true;
this.nickname = aes.aesDecrypt(uni.getStorageSync("nickname"));
this.headimgurl = aes.aesDecrypt(uni.getStorageSync("headimgurl"));
}
}
},
methods: {
/* 是否显示投诉功能 */
getIsShow: function(){
this.$Request.post(this.$config.getYbsjSysParam, {}).then(res => {
var d = res.data;
this.isShowOnlinets = d.is_show_onlinets;
})
},
redictUrl: function(){
uni.showModal({
title:"重新刷新",
success() {
uni.navigateTo({
url:"/pages/personcenter/aboutus?isRedirect=1"
})
}
})
},
oauthUser: function(){
if(this.isLogin){
return;
}else{
uni.showLoading({
mask:true,
title:"授权中",
success() {
setTimeout(function(){
// uni.showToast({
// title:"授权失败,点击"+that.nickname+"重新授权",
// icon:"none",
// duration: 1500
// })
uni.hideLoading();
},10000)
}
})
if(this.$wechat.isWechat()){
//weixin 授权
that.$util.getUser(this,"person","","");
}else{
//安卓授权
var that = this;
this.$util.bindGpsObj(that);
Android.gotoDetial("WxUserInfo","");
}
}
},
callBackMethod: function(){
// clearTimeout(timer);
this.isLogin = true;
that.nickname = aes.aesDecrypt(uni.getStorageSync("nickname"));
that.headimgurl = aes.aesDecrypt(uni.getStorageSync("headimgurl"));
uni.hideLoading();
},
gotoList: function(str){
var that = this;
if(str == "dingdan" || str == "tousu" || str == "fankui"){
//重新授权
if(this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync("unionid")))){
uni.showToast({
title:"点击头像进行授权",
icon:"none",
duration:1500
})
return;
}
if(aes.aesDecrypt(uni.getStorageSync("user_token")) == undefined || aes.aesDecrypt(uni.getStorageSync("user_token")) == null ||aes.aesDecrypt(uni.getStorageSync("user_token")) == ""){
this.$util.getUserInfo(that,aes.aesDecrypt(uni.getStorageSync("unionid")),function(){
this.jumpPages(str);
});
}else{
this.jumpPages(str);
}
}else{
this.jumpPages(str);
}
},
jumpPages: function(str){
if(str == "dingdan"){
uni.navigateTo({
url:"/pages/order/order?type=-1"
})
}else if(str == "tousu"){
uni.navigateTo({
url:"/pages/tousu/tousulist/tousulist"
})
}else if(str == "aboutus"){
uni.navigateTo({
url:"/pages/personcenter/aboutus"
})
}else if(str == "update"){
uni.navigateTo({
url:"/pages/personcenter/update"
})
}else if(str == "fankui"){
uni.navigateTo({
url: "/pages/suggest/sug_list"
})
}
},
gotoSugList:function(){
if(this.$util.isBlack(aes.aesDecrypt(uni.getStorageSync("unionid")))){
uni.showToast({
title:"点击头像进行授权",
icon:"none",
duration:1500
})
return;
}
uni.navigateTo({
url: "/pages/suggest/sug_list"
})
}
// getOrderCount: function(){
// var method = "getUserOrderCount";
// var sendData = {
// "api_token":that.$md5.hexMD5("API"+method+"lvyou"),
// "user_token":uni.getStorageSync("user_token"),
// "mid":uni.getStorageSync("user_info").mid
// }
// var data = {
// "data":JSON.stringify(sendData),
// "url": this.$config.getUserOrderCount
// }
// that.$Request.post(this.$config.getAittoData,data).then(res => {
// if(res.code == 0){
// that.count = res.data;
// }else{
// uni.showToast({
// icon: "none",
// title: res.msg
// })
// }
// })
// }
}
}
</script>
<style>
@import url('../../static/css/common.css');
</style>