94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
1
2
3
4
5
6
|
<template>
<div>
<div class="person-bg">
<div class="person-ifo">
<div class="person-pic"></div>
<ul class="person-con">
|
5e52ed7c
刘淇
个人中心
|
7
8
9
10
|
<li></li>
<li style="padding-top: 20px;font-size: 20px;">{{phoneNum}}</li>
<!--<li>账户余额: <span>¥100.00</span></li>-->
<!--<li>我的卡券:<span>20张</span></li>-->
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
11
12
13
14
|
</ul>
</div>
</div>
|
5e52ed7c
刘淇
个人中心
|
15
|
<!--<mt-cell title="会员卡" is-link :to="{ name: 'cardList' }"></mt-cell>-->
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
16
|
|
5e52ed7c
刘淇
个人中心
|
17
|
<!--<mt-cell title="车辆管理" is-link :to="{ name: 'myCars' }"></mt-cell>-->
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
18
|
|
5e52ed7c
刘淇
个人中心
|
19
|
<!--<mt-cell title="车辆管理" is-link :to="{ name: 'parkNotes' }"></mt-cell>-->
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
20
|
|
5e52ed7c
刘淇
个人中心
|
21
|
<!--<mt-cell title="建议反馈" is-link :to="{ name: 'suggestionBack' }"></mt-cell>-->
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
22
|
|
5e52ed7c
刘淇
个人中心
|
23
24
25
26
27
|
<van-cell-group>
<van-cell v-for="i in navList" :key="i.title" :title="i.title" size="large" is-link @click="toNextPage(i.path)"/>
</van-cell-group>
|
6ea1f7ef
刘淇
个人中心
|
28
|
<div class="leftRightPadding" style="margin-top: 34px" v-if="phoneNum">
|
5e52ed7c
刘淇
个人中心
|
29
|
<!--<mt-button type="danger" size="large"></mt-button>-->
|
6ea1f7ef
刘淇
个人中心
|
30
|
<!--<van-button type="info" block>退出账户</van-button>-->
|
5e52ed7c
刘淇
个人中心
|
31
32
33
|
</div>
<div class="leftRightPadding" style="margin-top: 34px" v-else>
<van-button type="info" block @click="toBindingPage">登录绑定</van-button>
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
34
35
36
37
38
39
|
</div>
</div>
</template>
<script>
|
5e52ed7c
刘淇
个人中心
|
40
|
|
0849334c
刘淇
宣化聚合支付
|
41
|
import { getTokenByOpenId, getOpenIdByCode } from "@/api/getUserIfo";
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
42
|
export default {
|
5e52ed7c
刘淇
个人中心
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
name: "selfNav",
data() {
return {
navList: [
{
title: "会员卡", path: "cardList"
},
{
title: "车辆管理", path: "myCars"
},
{
title: "停车记录", path: "parkNotes"
},
{
title: "建议反馈", path: "suggestionBack"
}
],
openId: "",
|
6ea1f7ef
刘淇
个人中心
|
61
|
phoneNum: ""//手机号
|
5e52ed7c
刘淇
个人中心
|
62
63
|
};
},
|
94a4ee91
刘淇
宣化 聚合支付
|
64
65
|
created() {
|
0849334c
刘淇
宣化聚合支付
|
66
|
// this.phoneNum = localStorage.getItem('userPhoneNum')
|
94a4ee91
刘淇
宣化 聚合支付
|
67
|
},
|
5e52ed7c
刘淇
个人中心
|
68
|
mounted() {
|
6ea1f7ef
刘淇
个人中心
|
69
70
71
72
73
|
// this.openId = this.$utils.openId;
// if (this.openId) {
// this.getTokenAndphoneNum();
// }
// console.log(this.openId);
|
0849334c
刘淇
宣化聚合支付
|
74
75
76
77
78
79
80
81
82
83
|
// this.phoneNum = localStorage.getItem('userPhoneNum')
if(this.$route.query.openId){
this.openId = this.$route.query.openId
this.getTokenAndphoneNum(this.openId)
}else{
this.webAppCode = this.getWxCode();
this.getOpenIdByCode()
}
|
94a4ee91
刘淇
宣化 聚合支付
|
84
|
|
6ea1f7ef
刘淇
个人中心
|
85
|
console.log(this.$utils.userPhoneNum)
|
5e52ed7c
刘淇
个人中心
|
86
87
|
},
methods: {
|
0849334c
刘淇
宣化聚合支付
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
getWxCode() {
var appID = this.$utils.myVxAppId;
var code = this.getUrlParam("code");
var local = window.location.href;
if (code == null || code === "") {
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appID + "&redirect_uri=" + encodeURIComponent(local) + "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
} else {
return code;
}
},
getUrlParam(name) { // 获取url里面的参数
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
var r = window.location.search.substr(1).match(reg)
if (r != null) return unescape(r[2])
return null
},
getOpenIdByCode() { // 获取openid
// this.bindCustByOpenId() // 正式注释
// 正式打开注释
let jsondata = {
appId: this.$utils.myVxAppId,
code: this.webAppCode
};
jsondata.sign = this.$utils.signObject(jsondata);
console.log("停车记录传参 " + JSON.stringify(jsondata));
getOpenIdByCode(jsondata).then(response => {
if(response.code=='0'){
let openId = response.data
this.openId = openId
this.getTokenAndphoneNum(openId) // 获取token和用户手机号
}
});
},
|
5e52ed7c
刘淇
个人中心
|
126
|
toNextPage(path) {
|
6ea1f7ef
刘淇
个人中心
|
127
|
if (this.phoneNum) {
|
5e52ed7c
刘淇
个人中心
|
128
129
130
131
132
133
|
this.$router.push({
name: path
}
);
} else {
this.$toast("请先登录");
|
e7ca4bcb
刘淇
会员卡
|
134
135
136
137
|
// this.$router.push({
// name: "binDing"
// }
// );
|
5e52ed7c
刘淇
个人中心
|
138
139
140
141
|
}
},
toBindingPage() {
this.$router.push({
|
0849334c
刘淇
宣化聚合支付
|
142
143
144
145
|
name: "binDing",
query:{
openid: this.openId
}
|
5e52ed7c
刘淇
个人中心
|
146
147
148
|
}
);
},
|
0849334c
刘淇
宣化聚合支付
|
149
|
getTokenAndphoneNum(openId) {
|
5e52ed7c
刘淇
个人中心
|
150
|
let jsondata = {
|
0849334c
刘淇
宣化聚合支付
|
151
|
openid: openId
|
6ea1f7ef
刘淇
个人中心
|
152
153
154
|
};
jsondata.sign = this.$utils.signObject(jsondata);
console.log("停车记录传参 " + JSON.stringify(jsondata));
|
5e52ed7c
刘淇
个人中心
|
155
|
getTokenByOpenId(jsondata).then(response => {
|
6ea1f7ef
刘淇
个人中心
|
156
157
158
159
|
console.log(response);
this.phoneNum = response.data.phoneNum;
console.log(response.data.token);
});
|
5e52ed7c
刘淇
个人中心
|
160
161
162
|
}
}
};
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
</script>
<style scoped lang="scss">
.person-bg {
height: 160px;
background: url("../../assets/images/mySelf/selfNavBg.png") no-repeat;
background-size: 100% 100%;
}
.person-ifo {
padding: $commonLeftRightPadding;
padding-top: 45px;
display: flex;
color: #ffbfbf;
|
5e52ed7c
刘淇
个人中心
|
177
|
.person-pic {
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
178
179
180
181
182
183
|
width: 64px;
height: 64px;
margin-right: 15px;
background: url("../../assets/images/mySelf/photoBG.png") no-repeat;
}
}
|
5e52ed7c
刘淇
个人中心
|
184
185
186
|
.person-con {
span {
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
187
188
189
190
191
|
font-size: 16px;
font-weight: bold;
}
}
|
5e52ed7c
刘淇
个人中心
|
192
|
|
94c1e6a3
liuqimichale
微信公众号 个人页面集合
|
193
|
</style>
|