|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<uv-navbar leftIcon="" title="我的" bg-color="#C6171E"></uv-navbar>
|
|
<uv-navbar leftIcon="" title="我的" bg-color="#C6171E"></uv-navbar>
|
|
|
<view class="w100 bg" style="background-color:#C6171E "></view>
|
|
<view class="w100 bg" style="background-color:#C6171E "></view>
|
|
|
-<!-- <image src="/static/user/user-bg.png" mode="widthFix" class="bg"/>-->
|
|
|
|
|
|
|
+ <!-- <image src="/static/user/user-bg.png" mode="widthFix" class="bg"/>-->
|
|
|
|
|
|
|
|
<block>
|
|
<block>
|
|
|
<view class="container" :style="containerStyle">
|
|
<view class="container" :style="containerStyle">
|
|
@@ -16,13 +16,13 @@
|
|
|
<image
|
|
<image
|
|
|
class="avatar"
|
|
class="avatar"
|
|
|
src='/static/iconfont/me.svg'>
|
|
src='/static/iconfont/me.svg'>
|
|
|
- </image>
|
|
|
|
|
|
|
+ </image>
|
|
|
<view class="phone fw-500">{{ user.mobilePhone }}</view>
|
|
<view class="phone fw-500">{{ user.mobilePhone }}</view>
|
|
|
|
|
|
|
|
<view class="money-box">
|
|
<view class="money-box">
|
|
|
<view class="money" @click="toPage({path: '/pages-user/wallet/index'})">
|
|
<view class="money" @click="toPage({path: '/pages-user/wallet/index'})">
|
|
|
<view class="money-left">
|
|
<view class="money-left">
|
|
|
- <uv-icon name="coupon" size="24" color="#C6171E"></uv-icon>
|
|
|
|
|
|
|
+ <uv-icon name="coupon" size="24" color="#C6171E"></uv-icon>
|
|
|
<!-- <image src="/static/iconfont/chongzhi.svg" mode="widthFit" style="width: 40rpx;height: 40rpx"></image>-->
|
|
<!-- <image src="/static/iconfont/chongzhi.svg" mode="widthFit" style="width: 40rpx;height: 40rpx"></image>-->
|
|
|
<!-- <uv-icon name="red-packet" size="24" color="#C6171E"></uv-icon>-->
|
|
<!-- <uv-icon name="red-packet" size="24" color="#C6171E"></uv-icon>-->
|
|
|
<view style="font-size: 16px;margin-left: 10rpx;">钱包 | 充值</view>
|
|
<view style="font-size: 16px;margin-left: 10rpx;">钱包 | 充值</view>
|
|
@@ -30,7 +30,7 @@
|
|
|
|
|
|
|
|
<view class="money-right">
|
|
<view class="money-right">
|
|
|
|
|
|
|
|
- <view class="money-right_balance"> ¥ {{ ((user.balance || 0) / 100).toFixed(2) }}</view>
|
|
|
|
|
|
|
+ <view class="money-right_balance"> ¥ {{ ((user.balance || 0) / 100).toFixed(2) }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
@@ -55,19 +55,19 @@
|
|
|
</block>
|
|
</block>
|
|
|
|
|
|
|
|
<view class="logout-btn" v-if="isLogin">
|
|
<view class="logout-btn" v-if="isLogin">
|
|
|
- <view class="mt20 logout-btn-wrap" type="error" @click="logoutUser">退出登录</view>
|
|
|
|
|
|
|
+ <view class="mt20 logout-btn-wrap" type="error" @click="logoutUser">退出登录</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</block>
|
|
</block>
|
|
|
|
|
|
|
|
-<!-- <cover-view class="login_bar" v-if="!isLogin">
|
|
|
|
|
- <login-bar class="w100 text-center"></login-bar>
|
|
|
|
|
- </cover-view>-->
|
|
|
|
|
|
|
+ <!-- <cover-view class="login_bar" v-if="!isLogin">
|
|
|
|
|
+ <login-bar class="w100 text-center"></login-bar>
|
|
|
|
|
+ </cover-view>-->
|
|
|
|
|
|
|
|
-<!-- <view class="logout-btn">
|
|
|
|
|
- <uv-button :custom-style="customStyle" type="error" @click="logoutUser">退出登录</uv-button>
|
|
|
|
|
- </view>-->
|
|
|
|
|
|
|
+ <!-- <view class="logout-btn">
|
|
|
|
|
+ <uv-button :custom-style="customStyle" type="error" @click="logoutUser">退出登录</uv-button>
|
|
|
|
|
+ </view>-->
|
|
|
|
|
|
|
|
<tab-bar :index="2"/>
|
|
<tab-bar :index="2"/>
|
|
|
</template>
|
|
</template>
|
|
@@ -77,7 +77,7 @@ import {onHide, onLoad, onShow} from "@dcloudio/uni-app";
|
|
|
import {computed, ref} from "vue";
|
|
import {computed, ref} from "vue";
|
|
|
import TabBar from "@/components/tab-bar/index.vue";
|
|
import TabBar from "@/components/tab-bar/index.vue";
|
|
|
import LoginBar from "@/components/login-bar/index.vue";
|
|
import LoginBar from "@/components/login-bar/index.vue";
|
|
|
-import {checkLogin, clearToken} from "@/utils/auth"
|
|
|
|
|
|
|
+import {checkLogin, clearToken, loadUserInfo} from "@/utils/auth"
|
|
|
import {get} from "@/utils/https";
|
|
import {get} from "@/utils/https";
|
|
|
import {getServicePhone} from "@/utils/common";
|
|
import {getServicePhone} from "@/utils/common";
|
|
|
|
|
|
|
@@ -105,7 +105,7 @@ const menu = ref([
|
|
|
title: "我的订单",
|
|
title: "我的订单",
|
|
|
path: "/pages-order/list/index",
|
|
path: "/pages-order/list/index",
|
|
|
|
|
|
|
|
- icon: '/static/user/faq.png'
|
|
|
|
|
|
|
+ icon: '/static/user/faq.png'
|
|
|
},
|
|
},
|
|
|
/* {
|
|
/* {
|
|
|
title: "我的收藏",
|
|
title: "我的收藏",
|
|
@@ -131,7 +131,6 @@ const menu = ref([
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
const toPage = (item: any) => {
|
|
const toPage = (item: any) => {
|
|
|
checkLogin().then(() => {
|
|
checkLogin().then(() => {
|
|
|
let {title, path} = item;
|
|
let {title, path} = item;
|
|
@@ -223,24 +222,51 @@ const removeListener = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
- const userData = getApp<any>().globalData.user;
|
|
|
|
|
- if (userData && userData.id) {
|
|
|
|
|
- isLogin.value = true;
|
|
|
|
|
- user.value = userData;
|
|
|
|
|
|
|
+ let gd = getApp<any>().globalData;
|
|
|
|
|
+ if(gd.refresh){
|
|
|
|
|
+ refreshUserProfile()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //半小时前登录的刷新
|
|
|
|
|
+ if(gd.user){
|
|
|
|
|
+ if (new Date().getTime() - new Date(gd.user.lastLoginTime).getTime() > 1800 * 1000) {
|
|
|
|
|
+ refreshUserProfile()
|
|
|
|
|
+ }else{
|
|
|
|
|
+ isLogin.value = true;
|
|
|
|
|
+ user.value = gd.user;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ let currentPages = getCurrentPages();
|
|
|
|
|
+ if (currentPages.length > 1) {
|
|
|
|
|
+ let lastPage = currentPages[currentPages.length - 2]
|
|
|
|
|
+ console.log('last page', lastPage.route)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// loginListen();
|
|
// loginListen();
|
|
|
addListener();
|
|
addListener();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-onHide(()=>{
|
|
|
|
|
|
|
+const refreshUserProfile = () => {
|
|
|
|
|
+ isLogin.value = true;
|
|
|
|
|
+ loadUserInfo().then(val => {
|
|
|
|
|
+ if (val && val.id) {
|
|
|
|
|
+ user.value = val;
|
|
|
|
|
+ }
|
|
|
|
|
+ getApp<any>().globalData.refresh = false;
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onHide(() => {
|
|
|
removeListener();
|
|
removeListener();
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scope>
|
|
<style lang="scss" scope>
|
|
|
-page{
|
|
|
|
|
|
|
+page {
|
|
|
background-color: #fafafa;
|
|
background-color: #fafafa;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.bg {
|
|
.bg {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
left: 0;
|
|
left: 0;
|
|
@@ -294,7 +320,7 @@ page{
|
|
|
font-size: 40rpx;
|
|
font-size: 40rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .money-box{
|
|
|
|
|
|
|
+ .money-box {
|
|
|
background: #EEB9BB;
|
|
background: #EEB9BB;
|
|
|
padding: 60rpx 20rpx;
|
|
padding: 60rpx 20rpx;
|
|
|
display: flex;
|
|
display: flex;
|
|
@@ -396,7 +422,7 @@ page{
|
|
|
width: calc(100vw - 60rpx);
|
|
width: calc(100vw - 60rpx);
|
|
|
margin: 60rpx auto;
|
|
margin: 60rpx auto;
|
|
|
|
|
|
|
|
- &-wrap{
|
|
|
|
|
|
|
+ &-wrap {
|
|
|
height: 80rpx;
|
|
height: 80rpx;
|
|
|
border-radius: 40rpx;
|
|
border-radius: 40rpx;
|
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|