正在显示
5 个修改的文件
包含
31 行增加
和
6 行删除
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | App({ | 3 | App({ |
4 | onLaunch: function () { | 4 | onLaunch: function () { |
5 | - | 5 | + this.count() |
6 | }, | 6 | }, |
7 | //判断小程序是否注册 | 7 | //判断小程序是否注册 |
8 | ifregister(e){ | 8 | ifregister(e){ |
@@ -17,8 +17,6 @@ App({ | @@ -17,8 +17,6 @@ App({ | ||
17 | code: code | 17 | code: code |
18 | } | 18 | } |
19 | that.post(url, param).then((res) => { | 19 | that.post(url, param).then((res) => { |
20 | - console.log(res); | ||
21 | - | ||
22 | }).catch((errMsg) => { | 20 | }).catch((errMsg) => { |
23 | console.log(errMsg); | 21 | console.log(errMsg); |
24 | }) | 22 | }) |
@@ -27,6 +25,30 @@ App({ | @@ -27,6 +25,30 @@ App({ | ||
27 | }); | 25 | }); |
28 | 26 | ||
29 | }, | 27 | }, |
28 | + count() { | ||
29 | + let that = this; | ||
30 | + wx.login({ | ||
31 | + success: function (s) { | ||
32 | + let url = 'wxapp/public/getSessionKey'; | ||
33 | + if (s.code) { | ||
34 | + var code = s.code; | ||
35 | + var param = { | ||
36 | + code: code | ||
37 | + } | ||
38 | + that.post(url, param).then((res) => { | ||
39 | + let url = 'wxapp/public/visit'; | ||
40 | + let params = { | ||
41 | + openid: res.openid | ||
42 | + } | ||
43 | + that.post(url, params).then((res) => { | ||
44 | + }).catch((err) => { | ||
45 | + }) | ||
46 | + }).catch((errMsg) => { | ||
47 | + }) | ||
48 | + } | ||
49 | + } | ||
50 | + }); | ||
51 | + }, | ||
30 | //获取sessionKey和openid | 52 | //获取sessionKey和openid |
31 | start(e) { | 53 | start(e) { |
32 | let that = this; | 54 | let that = this; |
@@ -82,7 +82,6 @@ Page({ | @@ -82,7 +82,6 @@ Page({ | ||
82 | }, | 82 | }, |
83 | //获取sessionKey和openid (登陆授权) | 83 | //获取sessionKey和openid (登陆授权) |
84 | start(e) { | 84 | start(e) { |
85 | - | ||
86 | let exe = e.currentTarget.dataset.exe; | 85 | let exe = e.currentTarget.dataset.exe; |
87 | let that = this; | 86 | let that = this; |
88 | app.globalData.userInfo = e.detail.userInfo; | 87 | app.globalData.userInfo = e.detail.userInfo; |
@@ -137,7 +137,6 @@ | @@ -137,7 +137,6 @@ | ||
137 | <view class='index_logotxt'>让每件衣服延续它的温暖</view> | 137 | <view class='index_logotxt'>让每件衣服延续它的温暖</view> |
138 | <import src="../template/template.wxml"></import> | 138 | <import src="../template/template.wxml"></import> |
139 | <view> | 139 | <view> |
140 | - | ||
141 | <template is="poster" data='{{...posterobj}}'></template> | 140 | <template is="poster" data='{{...posterobj}}'></template> |
142 | </view> | 141 | </view> |
143 | <template is="callback" data='{{showlocation}}'></template> | 142 | <template is="callback" data='{{showlocation}}'></template> |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | }, | 12 | }, |
13 | "compileType": "miniprogram", | 13 | "compileType": "miniprogram", |
14 | "libVersion": "2.4.0", | 14 | "libVersion": "2.4.0", |
15 | - "appid": "wx4ac44ac1779dc6a6", | 15 | + "appid": "wxa00560506f66e48f", |
16 | "projectname": "recycle%E6%97%A7%E8%A1%A3%E5%9B%9E%E6%94%B6%E9%A1%B9%E7%9B%AE(%E5%AE%A2%E6%88%B7%E7%9A%84appID)", | 16 | "projectname": "recycle%E6%97%A7%E8%A1%A3%E5%9B%9E%E6%94%B6%E9%A1%B9%E7%9B%AE(%E5%AE%A2%E6%88%B7%E7%9A%84appID)", |
17 | "debugOptions": { | 17 | "debugOptions": { |
18 | "hidedInDevtools": [] | 18 | "hidedInDevtools": [] |
-
请 注册 或 登录 后发表评论