usercenter.js
11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_api = require("../../common/api.js");
const common_match = require("../../common/match.js");
require("../../common/login.js");
require("../../common/request.js");
require("../../config.js");
if (!Array) {
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
const _easycom_uni_countdown2 = common_vendor.resolveComponent("uni-countdown");
const _easycom_uni_popup_dialog2 = common_vendor.resolveComponent("uni-popup-dialog");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_easycom_uni_list_item2 + _easycom_uni_list2 + _easycom_uni_countdown2 + _easycom_uni_popup_dialog2 + _easycom_uni_popup2)();
}
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
const _easycom_uni_countdown = () => "../../uni_modules/uni-countdown/components/uni-countdown/uni-countdown.js";
const _easycom_uni_popup_dialog = () => "../../uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
(_easycom_uni_list_item + _easycom_uni_list + _easycom_uni_countdown + _easycom_uni_popup_dialog + _easycom_uni_popup)();
}
const _sfc_main = {
__name: "usercenter",
setup(__props) {
const vTypeImg = common_vendor.ref("/static/v1.png");
const card = common_vendor.ref({});
const reportData = common_vendor.ref({});
const user = common_vendor.ref({});
common_vendor.ref("");
const avatarUrl = common_vendor.ref("");
const captchaPhonenumber = common_vendor.ref("");
const captcha = common_vendor.ref("");
const inputDialog = common_vendor.ref(null);
const start = common_vendor.ref(false);
const canSend = common_vendor.ref(true);
const app = getApp();
const isMaster = common_vendor.ref(false);
common_vendor.onPullDownRefresh(() => {
getVip();
});
common_vendor.onShow(() => {
if (app.globalData.isLogin) {
init();
getVip();
} else {
app.firstLoadCallback = () => {
init();
getVip();
};
}
});
function init() {
const currUser = common_vendor.index.getStorageSync("currUser");
user.value = currUser;
if (user.value.manageFlag == "1" && app.globalData.venue.id == user.value.venueId) {
isMaster.value = true;
}
avatarUrl.value = user.value.avatar;
}
function getVip() {
getMemberInfo();
if (isMaster.value) {
common_api.getMaInfo().then((res) => {
reportData.value = res.data;
});
}
}
function onChooseavatar(e) {
common_match.uploadFile(e).then((data) => {
avatarUrl.value = data.data;
common_match.updateAvatar({ avatarUrl: avatarUrl.value }).then((res) => {
common_vendor.index.showToast({
title: "头像保存成功",
icon: "none",
duration: 2e3
});
common_vendor.index.setStorageSync("currUser", res.data);
});
});
}
function changePhoneNumber() {
inputDialog.value.open();
}
function dialogInputConfirm() {
common_vendor.index.getStorageSync("currUser");
common_api.maRebindMemberCard(captchaPhonenumber.value, captcha.value).then((res) => {
common_vendor.index.showToast({
title: res.msg,
icon: "none",
duration: 2e3
});
captcha.value = "";
getMemberInfo();
});
}
function getMemberInfo() {
common_vendor.index.getStorageSync("currUser");
common_api.getOwnMemberInfo().then((res) => {
card.value = res.data;
app.globalData.isVip = card.value.isVip;
app.globalData.relateProjectIdList = card.value.info.relateProjectIdList;
app.globalData.relateVenueProjectIdList = card.value.info.relateVenueProjectIdList;
if (card.value.isVip) {
user.value.nickName = card.value.info.memberName;
captchaPhonenumber.value = card.value.info.memberTelno;
}
});
}
function goRenew() {
let path = "/pages/usercenter/mycard/renew";
common_vendor.index.navigateTo({
url: path
});
}
function goCard() {
let path = "/pages/usercenter/mycard/mycard";
common_vendor.index.navigateTo({
url: path
});
}
function goBills() {
let path = "/pages/usercenter/bills";
common_vendor.index.navigateTo({
url: path
});
}
function goVip() {
let path = "/pages/usercenter/mycard/mycard";
common_vendor.index.navigateTo({
url: path
});
}
function goQcode() {
common_vendor.index.scanCode({
onlyFromCamera: true,
success: function(res) {
console.log("条码类型:" + res.scanType);
console.log("条码内容:" + res.result);
common_api.scanQrCode(res.result).then((res2) => {
common_vendor.index.showModal({
title: "提示",
content: res2.msg,
success: function(res3) {
if (res3.confirm) {
console.log("确定");
} else if (res3.cancel) {
console.log("取消");
}
}
});
});
}
});
}
function myTrain() {
let path = "/pages/usercenter/myTrain/index/index";
common_vendor.index.navigateTo({
url: path
});
}
function timeup() {
canSend.value = true;
}
function sendsms() {
if (captchaPhonenumber.value) {
let strTemp = /^1[3|4|5|6|7|8|9][0-9]{9}$/;
if (strTemp.test(captchaPhonenumber.value)) {
common_api.getCaptchaSms({
phonenumber: captchaPhonenumber.value
}).then((res) => {
common_vendor.index.showToast({
title: res.msg,
icon: "none",
duration: 2e3
});
start.value = true;
canSend.value = false;
});
} else {
common_vendor.index.showToast({
title: "请输入正确的手机号",
icon: "none",
duration: 2e3
});
}
} else {
common_vendor.index.showToast({
title: "请输入手机号",
icon: "none",
duration: 2e3
});
}
}
return (_ctx, _cache) => {
var _a, _b;
return common_vendor.e({
a: avatarUrl.value,
b: common_vendor.o(onChooseavatar),
c: common_vendor.t(user.value.nickName),
d: common_vendor.t(user.value.phonenumber),
e: common_vendor.o(changePhoneNumber),
f: !isMaster.value && card.value.isVip
}, !isMaster.value && card.value.isVip ? {
g: vTypeImg.value,
h: common_vendor.t(card.value.info.cardTypeStr),
i: common_vendor.t(card.value.info.cardCode),
j: common_vendor.t(card.value.info.balance),
k: common_vendor.t((100 - card.value.info.discountPercent) / 10),
l: common_vendor.o(goCard),
m: common_vendor.t((_a = card.value.info) == null ? void 0 : _a.expirationTime),
n: common_vendor.o(goRenew)
} : {}, {
o: !isMaster.value
}, !isMaster.value ? {
p: common_vendor.p({
border: false,
title: "个人信息",
showArrow: true,
to: `./myInfo`
}),
q: common_vendor.p({
border: false,
title: "参赛队信息",
showArrow: true,
to: `./teamList`
}),
r: common_vendor.p({
border: false,
title: "会员充值",
showArrow: true,
to: `./mycard/renew`
}),
s: common_vendor.p({
border: false,
title: "场地订单",
showArrow: true,
to: `./bills`
}),
t: common_vendor.o(myTrain),
v: common_vendor.p({
border: false,
title: "我的培训",
showArrow: true,
clickable: true
}),
w: common_vendor.p({
border: false,
title: "我的赛事",
showArrow: true,
to: `./match`
}),
x: common_vendor.p({
border: false
})
} : {}, {
y: isMaster.value
}, isMaster.value ? {
z: common_vendor.t((_b = card.value.info) == null ? void 0 : _b.expirationTime),
A: common_vendor.o(goRenew),
B: common_vendor.o(goBills),
C: common_vendor.o(goVip),
D: common_vendor.o(goQcode),
E: common_vendor.p({
border: false,
title: "个人信息",
showArrow: true,
to: `./myInfo`
}),
F: common_vendor.p({
border: false,
title: "团体信息",
showArrow: true,
to: `./teamList`
}),
G: common_vendor.o(myTrain),
H: common_vendor.p({
border: false,
title: "培训报名",
showArrow: true,
clickable: true
}),
I: common_vendor.p({
border: false,
title: "我的赛事",
showArrow: true,
to: `./match`
}),
J: common_vendor.p({
border: false
}),
K: common_vendor.t(reportData.value.bookCount),
L: common_vendor.t(reportData.value.bookAmount),
M: common_vendor.t(reportData.value.memberCount),
N: common_vendor.t(reportData.value.memberAmout)
} : {}, {
O: captchaPhonenumber.value,
P: common_vendor.o(($event) => captchaPhonenumber.value = $event.detail.value),
Q: captcha.value,
R: common_vendor.o(($event) => captcha.value = $event.detail.value),
S: canSend.value
}, canSend.value ? {
T: common_vendor.o(sendsms)
} : {
U: common_vendor.o(timeup),
V: common_vendor.p({
start: start.value,
["font-size"]: 14,
["show-day"]: false,
["show-hour"]: false,
["show-min"]: false,
color: "#FFFFFF",
splitorColor: "#fff",
minute: 1,
second: 0
})
}, {
W: common_vendor.sr("inputClose", "a03cfe55-13,a03cfe55-12"),
X: common_vendor.o(dialogInputConfirm),
Y: common_vendor.p({
mode: "input",
title: "修改会员卡绑定手机号"
}),
Z: common_vendor.sr(inputDialog, "a03cfe55-12", {
"k": "inputDialog"
}),
aa: common_vendor.p({
type: "dialog"
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a03cfe55"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages/usercenter/usercenter.vue"]]);
wx.createPage(MiniProgramPage);