common.js
2.73 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
function e(e, t, r) {
return t in e ? Object.defineProperty(e, t, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = r, e;
}
var t = require("util.js");
module.exports = {
app: function() {
return getApp();
},
//------------获取全路径的图片地址-----------
getFullUrl: function(e) {
if(e==undefined || e=="") return "";
if(e.indexOf("http")!=-1) return e;
e=this.app().globalData.setting.imghost + e;
return e;
},
getConfigByName: function(e, t, r) {
for (var a = 0; a < e.length; a++) if (e[a].name === t && (void 0 === r || void 0 !== r && e[a].inc_type === r)) return e[a].value;
return console.warn(t), console.warn(e), null;
},
//--------跳转到支付页面--------
jumpToCart4: function(e, r) {
var a = {
order_sn: e.order_sn,
order_amount: e.order_amount
};
//t=1正常单 2组合单
if(e.type==1){ a.type=1; }
e.master_order_sn && (a.master_order_sn = e.master_order_sn);
var n = "/pages/cart/cart4/cart4?" + t.Obj2Str(a);
r ? wx.redirectTo({
url: n
}) : wx.navigateTo({
url: n
});
},
getCapache: function() {
return this.app().request.modifyUrl("/api/user/verify?is_image=1&t=" + Date.parse(new Date()));
},
wxParseAddFullImageUrl: function(t, r) {
if (void 0 !== t.data[r].images) {
for (var a = t.data[r], n = 0; n < a.images.length; n++) a.images[n].attr.src = this.getFullUrl(a.images[n].attr.src),
a.imageUrls[n] = this.getFullUrl(a.imageUrls[n]);
console.log(a), t.setData(e({}, r, a));
}
},
sendSmsCode: function(e, t, r) {
a = this;
if (!e) return a.app().showWarning("手机号码不能为空");
void 0 !== t && null !== t || (t = 6);
var a = this;
this.app().request.post("/home/api/send_validate_code", {
data: {
mobile: e,
scene: t,
type: "mobile"
},
success: function(e) {
"function" == typeof r && r(), a.app().confirmBox(e.data.msg);
}
});
},
sendBindSmsCode: function(e, t) {
r = this;
if (!e) return r.app().showWarning("手机号码不能为空");
var r = this;
this.app().request.post("/home/api/send_validate_code", {
data: {
mobile: e,
scene: "1",
type: "user_reg"
},
success: function(e) {
"function" == typeof t && t(), r.app().confirmBox(e.data.msg);
}
});
}
};