Commit 6786f6ca154b6d67d18dad37164c9435c4bd10df
1 parent
fd870747
错误页
Showing
4 changed files
with
115 additions
and
0 deletions
pages/error/error.js
0 → 100644
1 | +var t = require("../../utils/common.js");var os=getApp().globalData.setting; | |
2 | +Page({ | |
3 | + data:{ | |
4 | + store:null, | |
5 | + imghots: os.imghost, | |
6 | + msg:"", | |
7 | + }, | |
8 | + | |
9 | + onLoad:function(t){ | |
10 | + var th=this,app = getApp(); | |
11 | + app.getConfig(function(e){ | |
12 | + th.setData({ store:e,msg:t.msg}); | |
13 | + }) | |
14 | + }, | |
15 | + | |
16 | + getphone: function(e) { | |
17 | + var that = this; | |
18 | + var app=getApp(),a=app; | |
19 | + //此处授权得到userInfo | |
20 | + console.log("getphone"); | |
21 | + e=e.detail; | |
22 | + console.log(e); | |
23 | + //接下来写业务代码登录 | |
24 | + //最后,记得返回刚才的页面 | |
25 | + if (e.encryptedData==undefined){ | |
26 | + wx.navigateTo({ | |
27 | + url: '/pages/user/binding_info/binding_info', | |
28 | + }) | |
29 | + return false; | |
30 | + } | |
31 | + var r=getApp().globalData.getu; | |
32 | + var sessionKey = getApp().globalData.sessionKey; | |
33 | + var openid = getApp().globalData.openid; | |
34 | + var dd = { | |
35 | + oauth: "miniapp", | |
36 | + nickname: r.nickName, | |
37 | + head_pic: r.avatarUrl, | |
38 | + sex: r.gender, | |
39 | + terminal: "miniapp", | |
40 | + sessionKey: sessionKey, | |
41 | + openid:openid, | |
42 | + encryptedData: e.encryptedData, | |
43 | + iv: e.iv, | |
44 | + store_id: a.globalData.setting.stoid, | |
45 | + }; | |
46 | + console.log(dd); | |
47 | + | |
48 | + app.request.get("/api/weshop/users/thirdLogin", { | |
49 | + data: dd, | |
50 | + success: function (e) { | |
51 | + console.log("thirdLogin"); | |
52 | + console.log(e); | |
53 | + if (e.data.code == 0) { | |
54 | + app.globalData.user_id = e.data.data.user_id; | |
55 | + } else { | |
56 | + return app.showWarning("授权登入失败!"); | |
57 | + } | |
58 | + wx.setStorageSync("isAuth", !0), a.globalData.userInfo = e.data.data, a.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); | |
59 | + wx.navigateBack({ delta: 1}) | |
60 | + | |
61 | + }, | |
62 | + failStatus: function (t) { | |
63 | + return "100" === t.data.result ? (i.goHome(), wx.navigateTo({ | |
64 | + url: "/pages/user/binding_info/binding_info?nickName=" + r.nickName + "&userHeadPic=" + r.avatarUrl | |
65 | + }), !1) : (i.clearAuth(), i.alertLoginErrorAndGoHome(t.data.msg), a.request.post("/api/user/logout", { | |
66 | + isShowLoading: !1, | |
67 | + data: { | |
68 | + token: a.request.getToken() | |
69 | + }, | |
70 | + failStatus: function () { | |
71 | + return !1; | |
72 | + } | |
73 | + }), !1); | |
74 | + }, | |
75 | + fail: function (t) { | |
76 | + return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | |
77 | + } | |
78 | + }); | |
79 | + } | |
80 | +}); | ... | ... |
pages/error/error.json
0 → 100644
pages/error/error.wxml
0 → 100644
1 | +<view class="all_page"> | |
2 | + <view class="content"> | |
3 | + <view><image class='logo' src="{{imghots+store.store_logo}}"> </image></view> | |
4 | + <view class="title">{{store.store_name}}</view> | |
5 | + <view>{{store.store_desc}}</view> | |
6 | + <view class="err">{{msg}}</view> | |
7 | + </view> | |
8 | +</view> | |
0 | 9 | \ No newline at end of file | ... | ... |
pages/error/error.wxss
0 → 100644
1 | +.all_page{ | |
2 | + position: fixed; | |
3 | + height: 100%; | |
4 | + width: 100%; | |
5 | + background: #fff; | |
6 | + justify-content: center;/*水平居中*/ | |
7 | +} | |
8 | +.all_page .content{ | |
9 | + font-size: 30rpx; | |
10 | + text-align: center; | |
11 | + height: 400px; | |
12 | + width: 100%; | |
13 | + position: absolute; | |
14 | + top: 50%; | |
15 | + margin-top:-200px; | |
16 | +} | |
17 | +.logo{width: 140rpx; height: 140rpx; border-radius:50% } | |
18 | +.all_page .content .title{ | |
19 | + font-size: 36rpx; margin: 20rpx 0 | |
20 | +} | |
21 | + | |
22 | +.all_page .err{ | |
23 | + color:red; | |
24 | + font-size: 36rpx; | |
25 | + margin-top: 300rpx; | |
26 | +} | |
0 | 27 | \ No newline at end of file | ... | ... |