Commit 9c9f96a9 authored by 肖健's avatar 肖健

Merge remote-tracking branch 'origin/v1.0.0' into v1.0.0

parents f858ecd5 feccd1cd
...@@ -64,7 +64,7 @@ const httpTokenRequest = (opts, data) => { ...@@ -64,7 +64,7 @@ const httpTokenRequest = (opts, data) => {
// console.log(33333333333,res[1]) // console.log(33333333333,res[1])
if(res[1].data.code == 401){ if(res[1].data.code == 401){
uni.removeStorageSync('userToken') uni.removeStorageSync('userToken')
uni.navigateTo({ uni.redirectTo({
url:"/pages/login/index/index?failure=401" url:"/pages/login/index/index?failure=401"
}) })
return; return;
......
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
}, },
methods: { methods: {
tabChange(index) { tabChange(index) {
uni.setStorageSync('tabbar', index)
let that = this let that = this
switch (index) { switch (index) {
case 0: case 0:
...@@ -333,6 +334,7 @@ ...@@ -333,6 +334,7 @@
duration: 2000 duration: 2000
}); });
// 判断是否扫码进入 // 判断是否扫码进入
that.scene = uni.getStorageSync('scene') that.scene = uni.getStorageSync('scene')
// console.log(that.scene,"微信扫码进入") // console.log(that.scene,"微信扫码进入")
...@@ -360,6 +362,17 @@ ...@@ -360,6 +362,17 @@
}); });
} }
}) })
}else{
let routerLogin = uni.getStorageSync('routerLogin')
let tabbar = uni.getStorageSync('tabbar')
if(tabbar){
this.tabChange(tabbar)
}
if(routerLogin){
uni.redirectTo({
url:routerLogin
})
}
} }
}else{ }else{
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
methods: { methods: {
goUrl(vo) { goUrl(vo) {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
uni.removeStorageSync('routerLogin')
uni.setStorageSync('routerLogin',vo.url)
if (!token) { if (!token) {
// uni.navigateTo({ // uni.navigateTo({
// url: '/pages/binding/index?url=/pages/main&index=1' // url: '/pages/binding/index?url=/pages/main&index=1'
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Description: 个人中心 * @Description: 个人中心
--> -->
<template> <template>
<view class="" v-if="show"> <view class="" v-if="show">
<view class="personal"> <view class="personal">
<div class="ps__bg"> <div class="ps__bg">
<div class="ps__title"></div> <div class="ps__title"></div>
...@@ -56,16 +56,16 @@ ...@@ -56,16 +56,16 @@
<div class="ps__btn" v-if="logoutFlag" @click="loginOut">退出登录</div> <div class="ps__btn" v-if="logoutFlag" @click="loginOut">退出登录</div>
</view> </view>
<u-gap bgColor="transparent" height="70"></u-gap> <u-gap bgColor="transparent" height="70"></u-gap>
</view> </view>
</template> </template>
<script> <script>
let plugin = requirePlugin('loginPlugin'); let plugin = requirePlugin('loginPlugin');
export default { export default {
data() { data() {
return { return {
show:false, show: false,
logoutFlag : true, logoutFlag: true,
menu: [ menu: [
// { // {
// icon: require("@/static/my/my01.png"), // icon: require("@/static/my/my01.png"),
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
url: '/pages/main' url: '/pages/main'
}); });
}); });
}else{ } else {
uni.showToast({ uni.showToast({
title: res.data.msg, title: res.data.msg,
icon: 'none', icon: 'none',
...@@ -153,14 +153,15 @@ export default { ...@@ -153,14 +153,15 @@ export default {
}, },
goOrder(current) { goOrder(current) {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
if(!token){ uni.removeStorageSync('routerLogin')
if (!token) {
// uni.navigateTo({ // uni.navigateTo({
// url: '/pages/binding/index?url=/pages/main&index=4' // url: '/pages/binding/index?url=/pages/main&index=4'
// }) // })
let returnPage= '/pages/main'; let returnPage = '/pages/main';
let pageType = "reLaunch" let pageType = "reLaunch"
uni.navigateTo({ uni.navigateTo({
url:"/pages/login/index/index?returnPage="+returnPage+'&pageType='+pageType url: "/pages/login/index/index?returnPage=" + returnPage + '&pageType=' + pageType
}) })
return; return;
} }
...@@ -170,18 +171,20 @@ export default { ...@@ -170,18 +171,20 @@ export default {
}, },
goUrl(vo) { goUrl(vo) {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
if(!token){ uni.removeStorageSync('routerLogin')
uni.setStorageSync('routerLogin', vo.url)
if (!token) {
// uni.navigateTo({ // uni.navigateTo({
// url: '/pages/binding/index?url=/pages/main&index=4' // url: '/pages/binding/index?url=/pages/main&index=4'
// }) // })
let returnPage= '/pages/main'; let returnPage = '/pages/main';
let pageType = "reLaunch" let pageType = "reLaunch"
uni.navigateTo({ uni.navigateTo({
url:"/pages/login/index/index?returnPage="+returnPage+'&pageType='+pageType url: "/pages/login/index/index?returnPage=" + returnPage
}) })
return; return;
} }
if(vo.type == "jd"){ if (vo.type == "jd") {
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', // 跳转目标小程序的id appId: 'wx91d27dbf599dff74', // 跳转目标小程序的id
path: '', // 目标小程序的页面路径 path: '', // 目标小程序的页面路径
...@@ -205,7 +208,9 @@ export default { ...@@ -205,7 +208,9 @@ export default {
}, },
editInfo() { editInfo() {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
if(!token){ uni.removeStorageSync('routerLogin')
uni.setStorageSync('routerLogin', '/pagesD/pages/personal/userInfo')
if (!token) {
// uni.navigateTo({ // uni.navigateTo({
// url: '/pages/binding/index?url=/pages/main&index=4' // url: '/pages/binding/index?url=/pages/main&index=4'
// }) // })
...@@ -220,10 +225,11 @@ export default { ...@@ -220,10 +225,11 @@ export default {
}, },
async getUserInfo() { async getUserInfo() {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
if(!token){ if (!token) {
this.logoutFlag = false this.logoutFlag = false
return return
} }
this.logoutFlag = true
let opts = { let opts = {
url: '/app/user/info', url: '/app/user/info',
method: 'get' method: 'get'
...@@ -231,10 +237,10 @@ export default { ...@@ -231,10 +237,10 @@ export default {
await this.http.httpTokenRequest(opts, {}).then(res => { await this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.userInfo = res.data.data this.userInfo = res.data.data
if(this.userInfo.avatar){ if (this.userInfo.avatar) {
this.avatar = this.userInfo.avatar this.avatar = this.userInfo.avatar
} }
}else{ } else {
uni.showToast({ uni.showToast({
title: res.data.msg, title: res.data.msg,
icon: 'none', icon: 'none',
...@@ -260,7 +266,7 @@ export default { ...@@ -260,7 +266,7 @@ export default {
wx.showModal({ wx.showModal({
title: "温馨提示", title: "温馨提示",
content: "检测到您没有开启订阅消息的权限,是否去设置?", content: "检测到您没有开启订阅消息的权限,是否去设置?",
success: function (modal) { success: function(modal) {
if (modal.confirm) { if (modal.confirm) {
// 点击肯定 // 点击肯定
wx.openSetting({ wx.openSetting({
...@@ -303,14 +309,15 @@ export default { ...@@ -303,14 +309,15 @@ export default {
wx.showModal({ wx.showModal({
title: "温馨提示", title: "温馨提示",
content: "检测到您没有开启订阅消息的权限,是否去设置?", content: "检测到您没有开启订阅消息的权限,是否去设置?",
success: function (modal) { success: function(modal) {
if (modal.confirm) { if (modal.confirm) {
// 点击肯定 // 点击肯定
wx.openSetting({ wx.openSetting({
withSubscriptions: true, withSubscriptions: true,
}); });
that.is_authorization = true; that.is_authorization = true;
uni.setStorageSync("is_authorization", true); uni.setStorageSync("is_authorization",
true);
} else { } else {
uni.showToast({ uni.showToast({
title: "您已拒绝订阅消息授权,无法接收通知", title: "您已拒绝订阅消息授权,无法接收通知",
...@@ -331,25 +338,25 @@ export default { ...@@ -331,25 +338,25 @@ export default {
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.show=true this.show = true
}, 100); }, 100);
this.getUserInfo() this.getUserInfo()
}, },
onReady: function () { onReady: function() {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '个人中心' title: '个人中心'
}); });
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.personal { .personal {
.ps__bg { .ps__bg {
background: url('http://euzhi.com/my15.png') no-repeat; background: url('http://euzhi.com/my15.png') no-repeat;
background-size: cover; background-size: cover;
z-index: 999; z-index: 999;
padding-bottom:50rpx; padding-bottom: 50rpx;
.ps__title { .ps__title {
font-size: 40rpx; font-size: 40rpx;
...@@ -580,5 +587,5 @@ export default { ...@@ -580,5 +587,5 @@ export default {
font-weight: 500; font-weight: 500;
color: #666666; color: #666666;
} }
} }
</style> </style>
...@@ -166,6 +166,8 @@ export default { ...@@ -166,6 +166,8 @@ export default {
}, },
goDetail(id,link) { goDetail(id,link) {
let token = uni.getStorageSync('userToken'); let token = uni.getStorageSync('userToken');
uni.removeStorageSync('routerLogin')
uni.setStorageSync('routerLogin',false)
if(!token){ if(!token){
let returnPage= '/pages/main'; let returnPage= '/pages/main';
let pageType = "reLaunch" let pageType = "reLaunch"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment