userinfo.js
2.58 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
function e(e, a, r) {
return a in e ? Object.defineProperty(e, a, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[a] = r, e;
}
var a = getApp(), r = a.globalData.setting,
t = a.request, s = require("../../../utils/common.js"), util = require("../../../utils/util.js");
Page({
data: {
url: r.url,
resourceUrl: r.resourceUrl,
iurl: r.imghost,
defaultAvatar: r.resourceUrl + "/static/images/user68.jpg",
user: null,
tc_hide:true,
stoname:"",
},
onShow: function() {
var e = this; var req=t;
a.getUserInfo(function(a) {
var txt = util.formatTime(a.birthday,'yyyy-M-d'),arr = txt.split(' ');
a.birthday=arr[0];
var txt2 = util.formatTime(a.reg_time, 'yyyy-M-d'), arr2 = txt.split(' ');
a.reg_time = arr2[0];
req.get("/api/weshop/pickup/get/" + r.stoid + "/" + a.pickup_id, {
success: function (da) {
console.log('getsto');
console.log(da);
//设置门店
e.setData({ stoname: da.data.data.pickup_name});
}
})
e.setData({
user: a
});
}, !0);
},
editUserInfo: function(e) {
var r = e.currentTarget.dataset.type;
if (("password" == r || "paypwd" == r) && !this.data.user.mobile) return a.showWarning("请先绑定手机号码");
r && this.data.user && wx.navigateTo({
url: "/pages/user/userinfo_edit/userinfo_edit?type=" + r
});
},
/*--------------------修改头像---------------------*/
changeAvatar: function() {
return false;
var r = this;
wx.chooseImage({
count: 1,
sizeType: [ "compressed", "original" ],
sourceType: [ "camera", "album" ],
success: function(u) {
t.uploadFile(r.data.url + "/api/user/upload_headpic", {
filePath: u.tempFilePaths[0],
name: "head_pic",
success: function(t) {
var u = s.getFullUrl(t.data.result);
r.setData(e({}, "user.head_pic", u)), a.globalData.userInfo.head_pic = u, a.showSuccess("设置头像成功");
}
});
}
});
},
//------卡片的显示和关闭--------
show_tc: function () {
this.setData({
tc_hide: false,
});
},
hide_tc: function () {
this.setData({
tc_hide: true,
});
},
});