正在显示
39 个修改的文件
包含
533 行增加
和
530 行删除
components/lfylogin/index.js
0 → 100644
1 | +import { | ||
2 | + request | ||
3 | +} from "../../request/index.js" | ||
4 | +const a = getApp() | ||
5 | +Component({ | ||
6 | + /** | ||
7 | + * 组件的属性列表 | ||
8 | + */ | ||
9 | + properties: { | ||
10 | + | ||
11 | + }, | ||
12 | + | ||
13 | + /** | ||
14 | + * 组件的初始数据 | ||
15 | + */ | ||
16 | + data: { | ||
17 | + imagesUrl: a.globalData.baseUrl, | ||
18 | + canIUseGetUserProfile: false, | ||
19 | + showDialog: false | ||
20 | + }, | ||
21 | + onload() { | ||
22 | + | ||
23 | + }, | ||
24 | + /** | ||
25 | + * 组件的方法列表 | ||
26 | + */ | ||
27 | + methods: { | ||
28 | + getLogin(dens) { | ||
29 | + console.log(dens); | ||
30 | + if (wx.getUserProfile) { | ||
31 | + this.setData({ | ||
32 | + canIUseGetUserProfile: true | ||
33 | + }) | ||
34 | + } | ||
35 | + this.toggleDialog() | ||
36 | + }, | ||
37 | + bindGetUserInfo(e) { // 立即授权 | ||
38 | + let that = this; | ||
39 | + wx.login({ | ||
40 | + success(res) { | ||
41 | + console.log(res); | ||
42 | + that.setData({ | ||
43 | + code: res.code | ||
44 | + }) | ||
45 | + request({ | ||
46 | + url: 'api/common/login', | ||
47 | + method: "POST", | ||
48 | + data: { | ||
49 | + rawData: e.detail.rawData, | ||
50 | + code: that.data.code, | ||
51 | + } | ||
52 | + }) | ||
53 | + .then(res => { | ||
54 | + console.log(res); | ||
55 | + if (res.data.code == 1) { | ||
56 | + wx.setStorageSync('token', res.data.data.userInfo.token); | ||
57 | + wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
58 | + wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
59 | + wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
60 | + } | ||
61 | + console.log(res.data.data.userInfo.token); | ||
62 | + that.toggleDialog() | ||
63 | + a.popSuccessTest(res.data.msg); | ||
64 | + that.getDetailsContent() | ||
65 | + }).catch(err => { | ||
66 | + console.log(err); | ||
67 | + }) | ||
68 | + } | ||
69 | + }) | ||
70 | + }, | ||
71 | + getUserProfile() { | ||
72 | + let that = this | ||
73 | + wx.login({ | ||
74 | + success(res) { | ||
75 | + console.log(res); | ||
76 | + that.setData({ | ||
77 | + code: res.code | ||
78 | + }) | ||
79 | + } | ||
80 | + }) | ||
81 | + wx.getUserProfile({ | ||
82 | + desc: '用于完善会员资料', | ||
83 | + success: async (res) => { | ||
84 | + console.log(res); | ||
85 | + try { | ||
86 | + const { | ||
87 | + data | ||
88 | + } = await request({ | ||
89 | + url: 'api/common/newLogin', | ||
90 | + method: "POST", | ||
91 | + data: { | ||
92 | + userInfo: res.userInfo, | ||
93 | + code: that.data.code, | ||
94 | + } | ||
95 | + }) | ||
96 | + console.log(data); | ||
97 | + wx.setStorageSync('token', data.data.userInfo.token); | ||
98 | + wx.setStorageSync('avatar', data.data.userInfo.avatar); | ||
99 | + wx.setStorageSync('name', data.data.userInfo.nickname); | ||
100 | + wx.setStorageSync('user_id', data.data.userInfo.user_id); | ||
101 | + that.setData({ | ||
102 | + showDialog: false | ||
103 | + }) | ||
104 | + a.popSuccessTest(data.msg) | ||
105 | + that.triggerEvent('istoken', '李四') | ||
106 | + } catch (err) { | ||
107 | + console.log(err); | ||
108 | + } | ||
109 | + } | ||
110 | + }) | ||
111 | + | ||
112 | + }, | ||
113 | + toggleDialog() { | ||
114 | + this.setData({ | ||
115 | + showDialog: !this.data.showDialog | ||
116 | + }) | ||
117 | + }, | ||
118 | + } | ||
119 | +}) |
components/lfylogin/index.json
0 → 100644
components/lfylogin/index.less
0 → 100644
1 | + /* 弹窗 */ | ||
2 | + .zan_dialog { | ||
3 | + width: 100%; | ||
4 | + height: 100%; | ||
5 | + position: fixed; | ||
6 | + top: 0; | ||
7 | + left: 0; | ||
8 | + background: #000; | ||
9 | + opacity: 0.5; | ||
10 | + overflow: hidden; | ||
11 | + z-index: 1000; | ||
12 | + color: #fff; | ||
13 | + } | ||
14 | + | ||
15 | + .phoneshou { | ||
16 | + height: 500rpx; | ||
17 | + width: 100%; | ||
18 | + overflow: hidden; | ||
19 | + position: fixed; | ||
20 | + bottom: 0; | ||
21 | + left: 0; | ||
22 | + z-index: 2000; | ||
23 | + background: #fff; | ||
24 | + padding: 32rpx 32rpx 0; | ||
25 | + box-sizing: border-box; | ||
26 | + border-radius: 24rpx 24rpx 0 0; | ||
27 | + | ||
28 | + .padlock { | ||
29 | + width: 100%; | ||
30 | + height: 48rpx; | ||
31 | + display: flex; | ||
32 | + align-items: center; | ||
33 | + justify-content: flex-end; | ||
34 | + | ||
35 | + image { | ||
36 | + width: 48rpx; | ||
37 | + height: 48rpx; | ||
38 | + } | ||
39 | + } | ||
40 | + | ||
41 | + .phone_title { | ||
42 | + width: 100%; | ||
43 | + height: 70rpx; | ||
44 | + font-size: 44rpx; | ||
45 | + line-height: 70rpx; | ||
46 | + color: #06121F; | ||
47 | + font-family: PingFangSC, PingFangSC-Regular; | ||
48 | + | ||
49 | + | ||
50 | + } | ||
51 | + | ||
52 | + .tips_content { | ||
53 | + width: 100%; | ||
54 | + font-size: 32rpx; | ||
55 | + line-height: 60rpx; | ||
56 | + color: #8C9198; | ||
57 | + padding: 30rpx 0; | ||
58 | + box-sizing: border-box; | ||
59 | + } | ||
60 | + | ||
61 | + .downbtn { | ||
62 | + width: 750rpx; | ||
63 | + position: fixed; | ||
64 | + bottom: 0; | ||
65 | + right: 0; | ||
66 | + padding: 20rpx 0; | ||
67 | + background-color: #fff; | ||
68 | + | ||
69 | + .btn { | ||
70 | + height: 100rpx; | ||
71 | + width: 90%; | ||
72 | + color: #fff; | ||
73 | + padding: 0; | ||
74 | + box-sizing: border-box; | ||
75 | + font-size: 32rpx; | ||
76 | + background-color: #00C25F; | ||
77 | + display: flex; | ||
78 | + align-items: center; | ||
79 | + justify-content: center; | ||
80 | + border-radius: 50rpx; | ||
81 | + | ||
82 | + image { | ||
83 | + width: 60rpx; | ||
84 | + height: 48rpx; | ||
85 | + margin-right: 20rpx; | ||
86 | + flex-shrink: 0; | ||
87 | + } | ||
88 | + | ||
89 | + } | ||
90 | + | ||
91 | + .btn1 { | ||
92 | + margin-bottom: 20rpx; | ||
93 | + background-color: #ccc; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + } |
components/lfylogin/index.wxml
0 → 100644
1 | +<!-- 弹窗 --> | ||
2 | +<view class="zan_dialog" catchtap="toggleDialog" wx:if="{{showDialog}}"></view> | ||
3 | +<view class="phoneshou" wx:if="{{showDialog}}"> | ||
4 | + <view class="padlock" catchtap="toggleDialog"> | ||
5 | + <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
6 | + </view> | ||
7 | + <view class="phone_title">请先授权登录</view> | ||
8 | + <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
9 | + <view class="downbtn"> | ||
10 | + <view class="si_box"> | ||
11 | + <button class="btn" wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> | ||
12 | + <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
13 | + 微信授权登录 | ||
14 | + </button> | ||
15 | + <button class="btn" wx:else open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
16 | + <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
17 | + 微信授权登录 | ||
18 | + </button> | ||
19 | + </view> | ||
20 | + </view> | ||
21 | +</view> |
components/lfylogin/index.wxss
0 → 100644
1 | +/* 弹窗 */ | ||
2 | +.zan_dialog { | ||
3 | + width: 100%; | ||
4 | + height: 100%; | ||
5 | + position: fixed; | ||
6 | + top: 0; | ||
7 | + left: 0; | ||
8 | + background: #000; | ||
9 | + opacity: 0.5; | ||
10 | + overflow: hidden; | ||
11 | + z-index: 1000; | ||
12 | + color: #fff; | ||
13 | +} | ||
14 | +.phoneshou { | ||
15 | + height: 500rpx; | ||
16 | + width: 100%; | ||
17 | + overflow: hidden; | ||
18 | + position: fixed; | ||
19 | + bottom: 0; | ||
20 | + left: 0; | ||
21 | + z-index: 2000; | ||
22 | + background: #fff; | ||
23 | + padding: 32rpx 32rpx 0; | ||
24 | + box-sizing: border-box; | ||
25 | + border-radius: 24rpx 24rpx 0 0; | ||
26 | +} | ||
27 | +.phoneshou .padlock { | ||
28 | + width: 100%; | ||
29 | + height: 48rpx; | ||
30 | + display: flex; | ||
31 | + align-items: center; | ||
32 | + justify-content: flex-end; | ||
33 | +} | ||
34 | +.phoneshou .padlock image { | ||
35 | + width: 48rpx; | ||
36 | + height: 48rpx; | ||
37 | +} | ||
38 | +.phoneshou .phone_title { | ||
39 | + width: 100%; | ||
40 | + height: 70rpx; | ||
41 | + font-size: 44rpx; | ||
42 | + line-height: 70rpx; | ||
43 | + color: #06121F; | ||
44 | + font-family: PingFangSC, PingFangSC-Regular; | ||
45 | +} | ||
46 | +.phoneshou .tips_content { | ||
47 | + width: 100%; | ||
48 | + font-size: 32rpx; | ||
49 | + line-height: 60rpx; | ||
50 | + color: #8C9198; | ||
51 | + padding: 30rpx 0; | ||
52 | + box-sizing: border-box; | ||
53 | +} | ||
54 | +.phoneshou .downbtn { | ||
55 | + width: 750rpx; | ||
56 | + position: fixed; | ||
57 | + bottom: 0; | ||
58 | + right: 0; | ||
59 | + padding: 20rpx 0; | ||
60 | + background-color: #fff; | ||
61 | +} | ||
62 | +.phoneshou .downbtn .btn { | ||
63 | + height: 100rpx; | ||
64 | + width: 90%; | ||
65 | + color: #fff; | ||
66 | + padding: 0; | ||
67 | + box-sizing: border-box; | ||
68 | + font-size: 32rpx; | ||
69 | + background-color: #00C25F; | ||
70 | + display: flex; | ||
71 | + align-items: center; | ||
72 | + justify-content: center; | ||
73 | + border-radius: 50rpx; | ||
74 | +} | ||
75 | +.phoneshou .downbtn .btn image { | ||
76 | + width: 60rpx; | ||
77 | + height: 48rpx; | ||
78 | + margin-right: 20rpx; | ||
79 | + flex-shrink: 0; | ||
80 | +} | ||
81 | +.phoneshou .downbtn .btn1 { | ||
82 | + margin-bottom: 20rpx; | ||
83 | + background-color: #ccc; | ||
84 | +} |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <view class="title_oage">车唛优选</view> | 5 | <view class="title_oage">车唛优选</view> |
6 | </view> | 6 | </view> |
7 | </view> | 7 | </view> |
8 | - <view class="health" wx:if="{{S4Spage}}"> | 8 | + <view class="health" wx:if="{{S4Spage == true}}"> |
9 | <view class="btd"> | 9 | <view class="btd"> |
10 | <view class="searchbox"> | 10 | <view class="searchbox"> |
11 | <view class="searchinput" bindtap="goSearch"> | 11 | <view class="searchinput" bindtap="goSearch"> |
@@ -170,6 +170,21 @@ Page({ | @@ -170,6 +170,21 @@ Page({ | ||
170 | that.getToken() | 170 | that.getToken() |
171 | } | 171 | } |
172 | }, | 172 | }, |
173 | + getToken() { | ||
174 | + let that = this | ||
175 | + wx.showModal({ | ||
176 | + title: '提示', | ||
177 | + content: '您尚未登录,请登录后操作', | ||
178 | + success: function (res) { | ||
179 | + if (res.confirm) { | ||
180 | + that.selectComponent('#lfyLogin').getLogin('hh') | ||
181 | + } else { | ||
182 | + console.log('点击取消回调') | ||
183 | + wx.navigateBack() | ||
184 | + } | ||
185 | + } | ||
186 | + }) | ||
187 | + }, | ||
173 | onShareAppMessage(options) { | 188 | onShareAppMessage(options) { |
174 | var that = this; | 189 | var that = this; |
175 | var shareObj = { | 190 | var shareObj = { |
@@ -229,6 +244,7 @@ Page({ | @@ -229,6 +244,7 @@ Page({ | ||
229 | content: '您尚未登录,请登录后操作', | 244 | content: '您尚未登录,请登录后操作', |
230 | success: function (res) { | 245 | success: function (res) { |
231 | if (res.confirm) { | 246 | if (res.confirm) { |
247 | + | ||
232 | wx.navigateTo({ | 248 | wx.navigateTo({ |
233 | url: '/pages/authorization/authorization' | 249 | url: '/pages/authorization/authorization' |
234 | }) | 250 | }) |
@@ -393,6 +409,9 @@ Page({ | @@ -393,6 +409,9 @@ Page({ | ||
393 | } | 409 | } |
394 | 410 | ||
395 | }, | 411 | }, |
412 | + bindistoken() { | ||
413 | + console.log('我回来了'); | ||
414 | + }, | ||
396 | 415 | ||
397 | 416 | ||
398 | 417 |
1 | { | 1 | { |
2 | "usingComponents": { | 2 | "usingComponents": { |
3 | - "van-count-down": "@vant/weapp/count-down/index" | 3 | + "van-count-down": "@vant/weapp/count-down/index", |
4 | + "lfy-login":"../../Components/lfylogin" | ||
4 | }, | 5 | }, |
5 | "navigationStyle": "custom", | 6 | "navigationStyle": "custom", |
6 | "navigationBarTextStyle": "white" | 7 | "navigationBarTextStyle": "white" |
@@ -217,25 +217,6 @@ | @@ -217,25 +217,6 @@ | ||
217 | </button> --> | 217 | </button> --> |
218 | </view> | 218 | </view> |
219 | </view> | 219 | </view> |
220 | - <view class="zan_dialog" catchtap="toggleDialog" wx:if="{{showDialog}}"></view> | ||
221 | - <view class="phoneshou" wx:if="{{showDialog}}"> | ||
222 | - <view class="padlock" catchtap="toggleDialog"> | ||
223 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
224 | - </view> | ||
225 | - <view class="phone_title">请先授权登录</view> | ||
226 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
227 | - <view class="downbtn"> | ||
228 | - <!-- <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
229 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
230 | - 微信授权登录 | ||
231 | - </button> --> | ||
232 | - <view class="si_box"> | ||
233 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
234 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
235 | - 微信授权登录 | ||
236 | - </button> | ||
237 | - </view> | ||
238 | - </view> | ||
239 | - </view> | 220 | + <lfy-login id="lfyLogin" bind:istoken="bindistoken" /> |
240 | </view> | 221 | </view> |
241 | </view> | 222 | </view> |
@@ -9,7 +9,8 @@ Page({ | @@ -9,7 +9,8 @@ Page({ | ||
9 | encryptedData: '', | 9 | encryptedData: '', |
10 | iv: '', | 10 | iv: '', |
11 | msg: '', | 11 | msg: '', |
12 | - num: 0 | 12 | + num: 0, |
13 | + canIUseGetUserProfile: true, | ||
13 | }, | 14 | }, |
14 | 15 | ||
15 | 16 | ||
@@ -17,14 +18,60 @@ Page({ | @@ -17,14 +18,60 @@ Page({ | ||
17 | 18 | ||
18 | }, | 19 | }, |
19 | onLoad: function (options) { | 20 | onLoad: function (options) { |
20 | - console.log(options); | ||
21 | let that = this | 21 | let that = this |
22 | + if (wx.getUserProfile) { | ||
23 | + that.setData({ | ||
24 | + canIUseGetUserProfile: true | ||
25 | + }) | ||
26 | + } | ||
27 | + console.log(options); | ||
22 | that.setData({ | 28 | that.setData({ |
23 | num: options.num || '' | 29 | num: options.num || '' |
24 | }) | 30 | }) |
25 | 31 | ||
26 | }, | 32 | }, |
27 | onShow: function () {}, | 33 | onShow: function () {}, |
34 | + getUserProfile() { | ||
35 | + let that = this | ||
36 | + wx.login({ | ||
37 | + success(res) { | ||
38 | + console.log(res); | ||
39 | + that.setData({ | ||
40 | + code: res.code | ||
41 | + }) | ||
42 | + } | ||
43 | + }) | ||
44 | + wx.getUserProfile({ | ||
45 | + desc: '用于完善会员资料', | ||
46 | + success: async (res) => { | ||
47 | + console.log(res); | ||
48 | + try { | ||
49 | + const { | ||
50 | + data | ||
51 | + } = await request({ | ||
52 | + url: 'api/common/newLogin', | ||
53 | + method: "POST", | ||
54 | + data: { | ||
55 | + userInfo: res.userInfo, | ||
56 | + code: that.data.code, | ||
57 | + } | ||
58 | + }) | ||
59 | + console.log(data); | ||
60 | + wx.setStorageSync('token', data.data.userInfo.token); | ||
61 | + wx.setStorageSync('avatar', data.data.userInfo.avatar); | ||
62 | + wx.setStorageSync('name', data.data.userInfo.nickname); | ||
63 | + wx.setStorageSync('user_id', data.data.userInfo.user_id); | ||
64 | + that.showModal(); | ||
65 | + a.popSuccessTest(data.msg) | ||
66 | + } catch (err) { | ||
67 | + console.log(err); | ||
68 | + a.popTest(err.msg) | ||
69 | + } | ||
70 | + } | ||
71 | + }) | ||
72 | + | ||
73 | + | ||
74 | + }, | ||
28 | // 立即授权 | 75 | // 立即授权 |
29 | bindGetUserInfo(e) { | 76 | bindGetUserInfo(e) { |
30 | let that = this; | 77 | let that = this; |
@@ -62,7 +109,6 @@ Page({ | @@ -62,7 +109,6 @@ Page({ | ||
62 | } | 109 | } |
63 | }).catch(err => { | 110 | }).catch(err => { |
64 | console.log(err); | 111 | console.log(err); |
65 | - | ||
66 | }) | 112 | }) |
67 | } | 113 | } |
68 | }) | 114 | }) |
@@ -5,7 +5,10 @@ | @@ -5,7 +5,10 @@ | ||
5 | <view class="title">申请获得以下权限</view> | 5 | <view class="title">申请获得以下权限</view> |
6 | <view class="title_name">获得你的公开信息(昵称、头像等)</view> | 6 | <view class="title_name">获得你的公开信息(昵称、头像等)</view> |
7 | <view class="bu"> | 7 | <view class="bu"> |
8 | - <button class="btn" open-type='getUserInfo' bindgetuserinfo="bindGetUserInfo">立即授权</button> | 8 | + <button class="btn" wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile">立即授权</button> |
9 | + <button class="btn" wx:else open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
10 | + 立即授权 | ||
11 | + </button> | ||
9 | </view> | 12 | </view> |
10 | <!-- 屏幕背景变暗的背景 --> | 13 | <!-- 屏幕背景变暗的背景 --> |
11 | <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> | 14 | <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> |
@@ -25,7 +25,6 @@ Page({ | @@ -25,7 +25,6 @@ Page({ | ||
25 | pingList: [], | 25 | pingList: [], |
26 | s4_id: '', | 26 | s4_id: '', |
27 | fx_user: '', | 27 | fx_user: '', |
28 | - showDialog: false, | ||
29 | 28 | ||
30 | }, | 29 | }, |
31 | onLoad: function (options) { | 30 | onLoad: function (options) { |
@@ -321,49 +320,6 @@ Page({ | @@ -321,49 +320,6 @@ Page({ | ||
321 | //如果有透明蒙层,弹窗的期间不能点击文档内容 | 320 | //如果有透明蒙层,弹窗的期间不能点击文档内容 |
322 | }) | 321 | }) |
323 | }, | 322 | }, |
324 | - toggleDialog() { | ||
325 | - this.setData({ | ||
326 | - showDialog: !this.data.showDialog | ||
327 | - }) | ||
328 | - }, | ||
329 | - bindGetUserInfo(e) { // 立即授权 | ||
330 | - let that = this; | ||
331 | - wx.login({ | ||
332 | - success(res) { | ||
333 | - console.log(res); | ||
334 | - that.setData({ | ||
335 | - code: res.code | ||
336 | - }) | ||
337 | - request({ | ||
338 | - url: 'api/common/login', | ||
339 | - method: "POST", | ||
340 | - data: { | ||
341 | - rawData: e.detail.rawData, | ||
342 | - code: that.data.code, | ||
343 | - } | ||
344 | - }) | ||
345 | - .then(res => { | ||
346 | - console.log(res); | ||
347 | - if (res.data.code == 1) { | ||
348 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
349 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
350 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
351 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
352 | - | ||
353 | - } | ||
354 | - console.log(res.data.data.userInfo.token); | ||
355 | - that.toggleDialog() | ||
356 | - that.setData({ | ||
357 | - msg: res.data.msg | ||
358 | - }) | ||
359 | - that.popSuccessTest(); | ||
360 | - that.getDetailsContent() | ||
361 | - }).catch(err => { | ||
362 | - console.log(err); | ||
363 | - }) | ||
364 | - } | ||
365 | - }) | ||
366 | - }, | ||
367 | GOcanvas() { | 323 | GOcanvas() { |
368 | let id = this.data.id | 324 | let id = this.data.id |
369 | let token = wx.getStorageSync("token") | 325 | let token = wx.getStorageSync("token") |
@@ -395,7 +351,7 @@ Page({ | @@ -395,7 +351,7 @@ Page({ | ||
395 | content: '您尚未登录,请登录后操作', | 351 | content: '您尚未登录,请登录后操作', |
396 | success: function (res) { | 352 | success: function (res) { |
397 | if (res.confirm) { | 353 | if (res.confirm) { |
398 | - that.toggleDialog() | 354 | + that.selectComponent('#lfyLogin').getLogin('哈哈哈是') |
399 | } else { | 355 | } else { |
400 | console.log('点击取消回调') | 356 | console.log('点击取消回调') |
401 | } | 357 | } |
@@ -118,21 +118,5 @@ | @@ -118,21 +118,5 @@ | ||
118 | </view> | 118 | </view> |
119 | </view> | 119 | </view> |
120 | </view> | 120 | </view> |
121 | - <!-- 弹窗 --> | ||
122 | - <view class="zan_dialog" catchtap="toggleDialog" wx:if="{{showDialog}}"></view> | ||
123 | - <view class="phoneshou" wx:if="{{showDialog}}"> | ||
124 | - <view class="padlock" catchtap="toggleDialog"> | ||
125 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
126 | - </view> | ||
127 | - <view class="phone_title">请先授权登录</view> | ||
128 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
129 | - <view class="downbtn"> | ||
130 | - <view class="si_box"> | ||
131 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
132 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
133 | - 微信授权登录 | ||
134 | - </button> | ||
135 | - </view> | ||
136 | - </view> | ||
137 | - </view> | 121 | + <lfy-login id="lfyLogin" /> |
138 | </view> | 122 | </view> |
@@ -36,7 +36,6 @@ Page({ | @@ -36,7 +36,6 @@ Page({ | ||
36 | onLoad: function (options) { | 36 | onLoad: function (options) { |
37 | console.log(options, "options"); | 37 | console.log(options, "options"); |
38 | let that = this | 38 | let that = this |
39 | - let token = wx.getStorageSync('token') | ||
40 | let user_id = wx.getStorageSync('user_id') | 39 | let user_id = wx.getStorageSync('user_id') |
41 | console.log(user_id, "wode user_id"); | 40 | console.log(user_id, "wode user_id"); |
42 | if (!options.scene) { | 41 | if (!options.scene) { |
@@ -70,11 +69,6 @@ Page({ | @@ -70,11 +69,6 @@ Page({ | ||
70 | } | 69 | } |
71 | that.getDetailsContent() | 70 | that.getDetailsContent() |
72 | that.getPingList() | 71 | that.getPingList() |
73 | - // if (token) { | ||
74 | - | ||
75 | - // } else { | ||
76 | - // that.getToken() | ||
77 | - // } | ||
78 | }, | 72 | }, |
79 | onShow: function () { | 73 | onShow: function () { |
80 | 74 | ||
@@ -136,7 +130,7 @@ Page({ | @@ -136,7 +130,7 @@ Page({ | ||
136 | content: '您尚未登录,请登录后操作', | 130 | content: '您尚未登录,请登录后操作', |
137 | success: function (res) { | 131 | success: function (res) { |
138 | if (res.confirm) { | 132 | if (res.confirm) { |
139 | - that.showModal1() | 133 | + that.selectComponent('#lfyLogin').getLogin('hh') |
140 | } else { | 134 | } else { |
141 | console.log('点击取消回调') | 135 | console.log('点击取消回调') |
142 | wx.navigateBack() | 136 | wx.navigateBack() |
@@ -365,26 +359,6 @@ Page({ | @@ -365,26 +359,6 @@ Page({ | ||
365 | }) | 359 | }) |
366 | }.bind(this), 100) | 360 | }.bind(this), 100) |
367 | }, | 361 | }, |
368 | - showModal1() { //显示对话框 | ||
369 | - // 显示遮罩层 | ||
370 | - var animation = wx.createAnimation({ | ||
371 | - duration: 200, | ||
372 | - timingFunction: "linear", | ||
373 | - delay: 0 | ||
374 | - }) | ||
375 | - this.animation = animation | ||
376 | - animation.translateY(300).step() | ||
377 | - this.setData({ | ||
378 | - animationData: animation.export(), | ||
379 | - showModalStatu: true | ||
380 | - }) | ||
381 | - setTimeout(function () { | ||
382 | - animation.translateY(0).step() | ||
383 | - this.setData({ | ||
384 | - animationData: animation.export() | ||
385 | - }) | ||
386 | - }.bind(this), 100) | ||
387 | - }, | ||
388 | hideModal() { //隐藏对话框 | 362 | hideModal() { //隐藏对话框 |
389 | // 隐藏遮罩层 | 363 | // 隐藏遮罩层 |
390 | var animation = wx.createAnimation({ | 364 | var animation = wx.createAnimation({ |
@@ -405,26 +379,6 @@ Page({ | @@ -405,26 +379,6 @@ Page({ | ||
405 | }) | 379 | }) |
406 | }.bind(this), 100) | 380 | }.bind(this), 100) |
407 | }, | 381 | }, |
408 | - hideModal1() { //隐藏对话框 | ||
409 | - // 隐藏遮罩层 | ||
410 | - var animation = wx.createAnimation({ | ||
411 | - duration: 200, | ||
412 | - timingFunction: "linear", | ||
413 | - delay: 0 | ||
414 | - }) | ||
415 | - this.animation = animation | ||
416 | - animation.translateY(300).step() | ||
417 | - this.setData({ | ||
418 | - animationData: animation.export(), | ||
419 | - }) | ||
420 | - setTimeout(function () { | ||
421 | - animation.translateY(0).step() | ||
422 | - this.setData({ | ||
423 | - animationData: animation.export(), | ||
424 | - showModalStatu: false | ||
425 | - }) | ||
426 | - }.bind(this), 100) | ||
427 | - }, | ||
428 | countMinus() { // 商品数量减 | 382 | countMinus() { // 商品数量减 |
429 | let that = this | 383 | let that = this |
430 | let a = that.data.num - 1 | 384 | let a = that.data.num - 1 |
@@ -503,44 +457,6 @@ Page({ | @@ -503,44 +457,6 @@ Page({ | ||
503 | // console.log(texts) | 457 | // console.log(texts) |
504 | return texts; | 458 | return texts; |
505 | }, | 459 | }, |
506 | - bindGetUserInfo(e) { // 立即授权 | ||
507 | - let that = this; | ||
508 | - wx.login({ | ||
509 | - success(res) { | ||
510 | - console.log(res); | ||
511 | - that.setData({ | ||
512 | - code: res.code | ||
513 | - }) | ||
514 | - request({ | ||
515 | - url: 'api/common/login', | ||
516 | - method: "POST", | ||
517 | - data: { | ||
518 | - rawData: e.detail.rawData, | ||
519 | - code: that.data.code, | ||
520 | - } | ||
521 | - }) | ||
522 | - .then(res => { | ||
523 | - console.log(res); | ||
524 | - if (res.data.code == 1) { | ||
525 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
526 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
527 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
528 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
529 | - | ||
530 | - } | ||
531 | - console.log(res.data.data.userInfo.token); | ||
532 | - that.hideModal1() | ||
533 | - that.setData({ | ||
534 | - msg: res.data.msg | ||
535 | - }) | ||
536 | - that.popSuccessTest(); | ||
537 | - that.getDetailsContent() | ||
538 | - }).catch(err => { | ||
539 | - console.log(err); | ||
540 | - }) | ||
541 | - } | ||
542 | - }) | ||
543 | - }, | ||
544 | popSuccessTest() { | 460 | popSuccessTest() { |
545 | wx.showToast({ | 461 | wx.showToast({ |
546 | title: this.data.msg, | 462 | title: this.data.msg, |
@@ -548,7 +464,10 @@ Page({ | @@ -548,7 +464,10 @@ Page({ | ||
548 | duration: 1300, //停留时间 | 464 | duration: 1300, //停留时间 |
549 | }) | 465 | }) |
550 | }, | 466 | }, |
551 | - | 467 | + bindistoken() { |
468 | + this.getDetailsContent() | ||
469 | + console.log('我回来了'); | ||
470 | + }, | ||
552 | 471 | ||
553 | 472 | ||
554 | }) | 473 | }) |
@@ -258,27 +258,5 @@ | @@ -258,27 +258,5 @@ | ||
258 | </button> | 258 | </button> |
259 | </view> | 259 | </view> |
260 | </view> | 260 | </view> |
261 | - <!-- 授权登录 --> | ||
262 | - <view class="login"> | ||
263 | - <!-- 屏幕背景变暗的背景 --> | ||
264 | - <view class="commodity_screen" bindtap="hideModal1" wx:if="{{showModalStatu}}"></view> | ||
265 | - <!-- 弹出框 --> | ||
266 | - <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatu}}"> | ||
267 | - <view class="phoneshou"> | ||
268 | - <view class="padlock" catchtap="hideModal1"> | ||
269 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
270 | - </view> | ||
271 | - <view class="phone_title">请先授权登录</view> | ||
272 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
273 | - <view class="downbtn"> | ||
274 | - <view class="si_box"> | ||
275 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
276 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
277 | - 微信授权登录 | ||
278 | - </button> | ||
279 | - </view> | ||
280 | - </view> | ||
281 | - </view> | ||
282 | - </view> | ||
283 | - </view> | 261 | + <lfy-login id="lfyLogin" bind:istoken="bindistoken" /> |
284 | </view> | 262 | </view> |
@@ -43,7 +43,8 @@ Page({ | @@ -43,7 +43,8 @@ Page({ | ||
43 | content: '您尚未登录,请登录后操作', | 43 | content: '您尚未登录,请登录后操作', |
44 | success: function (res) { | 44 | success: function (res) { |
45 | if (res.confirm) { | 45 | if (res.confirm) { |
46 | - that.showModal() | 46 | + // that.showModal() |
47 | + that.selectComponent('#lfyLogin').getLogin('hh') | ||
47 | } else { | 48 | } else { |
48 | wx.switchTab({ | 49 | wx.switchTab({ |
49 | url: '/pages/home/home' | 50 | url: '/pages/home/home' |
@@ -203,85 +204,6 @@ Page({ | @@ -203,85 +204,6 @@ Page({ | ||
203 | return texts | 204 | return texts |
204 | 205 | ||
205 | }, | 206 | }, |
206 | - showModal() { //显示对话框 | ||
207 | - var animation = wx.createAnimation({ | ||
208 | - duration: 200, | ||
209 | - timingFunction: "linear", | ||
210 | - delay: 0 | ||
211 | - }) | ||
212 | - this.animation = animation | ||
213 | - animation.translateY(300).step() | ||
214 | - this.setData({ | ||
215 | - animationData: animation.export(), | ||
216 | - showModalStatus: true | ||
217 | - }) | ||
218 | - setTimeout(function () { | ||
219 | - animation.translateY(0).step() | ||
220 | - this.setData({ | ||
221 | - animationData: animation.export() | ||
222 | - }) | ||
223 | - }.bind(this), 100) | ||
224 | - }, | ||
225 | - hideModal() { //隐藏对话框 | ||
226 | - var animation = wx.createAnimation({ | ||
227 | - duration: 200, | ||
228 | - timingFunction: "linear", | ||
229 | - delay: 0 | ||
230 | - }) | ||
231 | - this.animation = animation | ||
232 | - animation.translateY(300).step() | ||
233 | - this.setData({ | ||
234 | - animationData: animation.export(), | ||
235 | - }) | ||
236 | - setTimeout(function () { | ||
237 | - animation.translateY(0).step() | ||
238 | - this.setData({ | ||
239 | - animationData: animation.export(), | ||
240 | - showModalStatus: false | ||
241 | - }) | ||
242 | - }.bind(this), 100) | ||
243 | - }, | ||
244 | - bindGetUserInfo(e) { // 立即授权 | ||
245 | - let that = this; | ||
246 | - wx.login({ | ||
247 | - success(res) { | ||
248 | - console.log(res); | ||
249 | - that.setData({ | ||
250 | - code: res.code | ||
251 | - }) | ||
252 | - request({ | ||
253 | - url: 'api/common/login', | ||
254 | - method: "POST", | ||
255 | - data: { | ||
256 | - rawData: e.detail.rawData, | ||
257 | - code: that.data.code, | ||
258 | - } | ||
259 | - }) | ||
260 | - .then(res => { | ||
261 | - console.log(res); | ||
262 | - if (res.data.code == 1) { | ||
263 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
264 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
265 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
266 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
267 | - | ||
268 | - } | ||
269 | - console.log(res.data.data.userInfo.token); | ||
270 | - that.hideModal() | ||
271 | - that.setData({ | ||
272 | - msg: res.data.msg | ||
273 | - }) | ||
274 | - that.popSuccessTest(); | ||
275 | - that.gethuodong() | ||
276 | - // setTimeout(function () { | ||
277 | - // wx.navigateBack() | ||
278 | - // }, 2000) | ||
279 | - }).catch(err => { | ||
280 | - console.log(err); | ||
281 | - }) | ||
282 | - } | ||
283 | - }) | ||
284 | - }, | ||
285 | onShareAppMessage: function (options) { | 207 | onShareAppMessage: function (options) { |
286 | var that = this; | 208 | var that = this; |
287 | // 设置菜单中的转发按钮触发转发事件时的转发内容 | 209 | // 设置菜单中的转发按钮触发转发事件时的转发内容 |
@@ -319,7 +241,10 @@ Page({ | @@ -319,7 +241,10 @@ Page({ | ||
319 | duration: 1300, //停留时间 | 241 | duration: 1300, //停留时间 |
320 | }) | 242 | }) |
321 | }, | 243 | }, |
322 | - | 244 | + bindistoken() { |
245 | + this.gethuodong() | ||
246 | + console.log('我回来了'); | ||
247 | + }, | ||
323 | 248 | ||
324 | 249 | ||
325 | 250 |
@@ -82,27 +82,5 @@ | @@ -82,27 +82,5 @@ | ||
82 | </view> | 82 | </view> |
83 | </view> | 83 | </view> |
84 | </view> | 84 | </view> |
85 | - <!-- 授权登录 --> | ||
86 | - <view class="login"> | ||
87 | - <!-- 屏幕背景变暗的背景 --> | ||
88 | - <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> | ||
89 | - <!-- 弹出框 --> | ||
90 | - <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"> | ||
91 | - <view class="phoneshou"> | ||
92 | - <view class="padlock" catchtap="hideModal"> | ||
93 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
94 | - </view> | ||
95 | - <view class="phone_title">请先授权登录</view> | ||
96 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
97 | - <view class="downbtn"> | ||
98 | - <view class="si_box"> | ||
99 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
100 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
101 | - 微信授权登录 | ||
102 | - </button> | ||
103 | - </view> | ||
104 | - </view> | ||
105 | - </view> | ||
106 | - </view> | ||
107 | - </view> | 85 | + <lfy-login id="lfyLogin" bind:istoken="bindistoken" /> |
108 | </view> | 86 | </view> |
@@ -2,7 +2,6 @@ import { | @@ -2,7 +2,6 @@ import { | ||
2 | request | 2 | request |
3 | } from "../../request/index.js" | 3 | } from "../../request/index.js" |
4 | 4 | ||
5 | -// pages/distributionChanged/distributionChanged.js | ||
6 | const a = getApp() | 5 | const a = getApp() |
7 | Page({ | 6 | Page({ |
8 | data: { | 7 | data: { |
@@ -32,13 +31,7 @@ Page({ | @@ -32,13 +31,7 @@ Page({ | ||
32 | }) | 31 | }) |
33 | that.getdetails() | 32 | that.getdetails() |
34 | }, | 33 | }, |
35 | - onReady: function () { | ||
36 | - | ||
37 | - }, | ||
38 | onShow: function () {}, | 34 | onShow: function () {}, |
39 | - toggleDialog() { | ||
40 | - | ||
41 | - }, | ||
42 | async getdetails() { | 35 | async getdetails() { |
43 | let that = this | 36 | let that = this |
44 | try { | 37 | try { |
@@ -61,6 +54,7 @@ Page({ | @@ -61,6 +54,7 @@ Page({ | ||
61 | 54 | ||
62 | }) | 55 | }) |
63 | console.log(data); | 56 | console.log(data); |
57 | + console.log(this.data.jump_url); | ||
64 | } catch (err) { | 58 | } catch (err) { |
65 | console.log(err); | 59 | console.log(err); |
66 | that.setData({ | 60 | that.setData({ |
@@ -208,7 +202,6 @@ Page({ | @@ -208,7 +202,6 @@ Page({ | ||
208 | }) | 202 | }) |
209 | }, 1500); | 203 | }, 1500); |
210 | } | 204 | } |
211 | - | ||
212 | } else { | 205 | } else { |
213 | console.log(that.data.jump_img); | 206 | console.log(that.data.jump_img); |
214 | if (that.data.jump_img != '') { | 207 | if (that.data.jump_img != '') { |
@@ -242,8 +235,9 @@ Page({ | @@ -242,8 +235,9 @@ Page({ | ||
242 | }, | 235 | }, |
243 | jumpImgUrl() { | 236 | jumpImgUrl() { |
244 | let that = this | 237 | let that = this |
238 | + console.log(that.data.jump_url); | ||
245 | wx.navigateTo({ | 239 | wx.navigateTo({ |
246 | - url: '/pages/webview/webview?url=' + that.data.jump_url | 240 | + url: '/pages/webview/webview?url=' + encodeURIComponent(that.data.jump_url) |
247 | }) | 241 | }) |
248 | that.hideModal() | 242 | that.hideModal() |
249 | }, | 243 | }, |
@@ -333,48 +333,9 @@ Page({ | @@ -333,48 +333,9 @@ Page({ | ||
333 | //如果有透明蒙层,弹窗的期间不能点击文档内容 | 333 | //如果有透明蒙层,弹窗的期间不能点击文档内容 |
334 | }) | 334 | }) |
335 | }, | 335 | }, |
336 | - toggleDialog() { | ||
337 | - this.setData({ | ||
338 | - showDialog: !this.data.showDialog | ||
339 | - }) | ||
340 | - }, | ||
341 | - bindGetUserInfo(e) { // 立即授权 | ||
342 | - let that = this; | ||
343 | - wx.login({ | ||
344 | - success(res) { | ||
345 | - console.log(res); | ||
346 | - that.setData({ | ||
347 | - code: res.code | ||
348 | - }) | ||
349 | - request({ | ||
350 | - url: 'api/common/login', | ||
351 | - method: "POST", | ||
352 | - data: { | ||
353 | - rawData: e.detail.rawData, | ||
354 | - code: that.data.code, | ||
355 | - } | ||
356 | - }) | ||
357 | - .then(res => { | ||
358 | - console.log(res); | ||
359 | - if (res.data.code == 1) { | ||
360 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
361 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
362 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
363 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
364 | - | ||
365 | - } | ||
366 | - console.log(res.data.data.userInfo.token); | ||
367 | - that.toggleDialog() | ||
368 | - that.setData({ | ||
369 | - msg: res.data.msg | ||
370 | - }) | ||
371 | - that.popSuccessTest(); | ||
372 | - that.getDetailsContent() | ||
373 | - }).catch(err => { | ||
374 | - console.log(err); | ||
375 | - }) | ||
376 | - } | ||
377 | - }) | 336 | + bindistoken() { |
337 | + this.getDetailsContent() | ||
338 | + console.log('我回来了'); | ||
378 | }, | 339 | }, |
379 | GOcanvas() { | 340 | GOcanvas() { |
380 | let id = this.data.id | 341 | let id = this.data.id |
@@ -51,9 +51,11 @@ Page({ | @@ -51,9 +51,11 @@ Page({ | ||
51 | }, | 51 | }, |
52 | 52 | ||
53 | gohome() { | 53 | gohome() { |
54 | - wx.switchTab({ | ||
55 | - url: '/pages/home/home' | ||
56 | - }) | 54 | + this.selectComponent('#lfyLogin').getLogin('哈哈哈') |
55 | + }, | ||
56 | + bindisToken(e) { | ||
57 | + console.log(e); | ||
58 | + console.log('我回来了'); | ||
57 | }, | 59 | }, |
58 | onChange(e) { | 60 | onChange(e) { |
59 | this.setData({ | 61 | this.setData({ |
@@ -74,7 +76,7 @@ Page({ | @@ -74,7 +76,7 @@ Page({ | ||
74 | let index = e.currentTarget.dataset.index | 76 | let index = e.currentTarget.dataset.index |
75 | if (index == 0) { | 77 | if (index == 0) { |
76 | wx.navigateTo({ | 78 | wx.navigateTo({ |
77 | - url: '/pages/webview/webview?url=' + 'https://h5.goorcar.com/' | 79 | + url: '/pages/webview/webview?url=' + encodeURIComponent('https://h5.goorcar.com/') |
78 | }) | 80 | }) |
79 | } | 81 | } |
80 | 82 |
1 | { | 1 | { |
2 | "usingComponents": { | 2 | "usingComponents": { |
3 | - "van-count-down": "@vant/weapp/count-down/index" | 3 | + "van-count-down": "@vant/weapp/count-down/index", |
4 | + "lfy-login":"../../Components/lfylogin" | ||
4 | }, | 5 | }, |
5 | "navigationStyle": "custom", | 6 | "navigationStyle": "custom", |
6 | "navigationBarTextStyle": "white" | 7 | "navigationBarTextStyle": "white" |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <view class="header"> | 2 | <view class="header"> |
3 | <view class="s" style='height:{{statusTop}}px'></view> | 3 | <view class="s" style='height:{{statusTop}}px'></view> |
4 | <view class="left_img"> | 4 | <view class="left_img"> |
5 | - <view class="title_oage" bindtap="gohome">汽车互联网4S店</view> | 5 | + <view class="title_oage">汽车互联网4S店</view> |
6 | </view> | 6 | </view> |
7 | </view> | 7 | </view> |
8 | <view class="health"> | 8 | <view class="health"> |
@@ -192,5 +192,6 @@ | @@ -192,5 +192,6 @@ | ||
192 | <view class="more_name">关注更多4S店</view> | 192 | <view class="more_name">关注更多4S店</view> |
193 | </view> | 193 | </view> |
194 | </view> | 194 | </view> |
195 | + <lfy-login id="lfyLogin" bind:istoken="bindisToken" /> | ||
195 | </view> | 196 | </view> |
196 | </view> | 197 | </view> |
@@ -27,30 +27,21 @@ Page({ | @@ -27,30 +27,21 @@ Page({ | ||
27 | guiID: [], | 27 | guiID: [], |
28 | goodsPrice: '', | 28 | goodsPrice: '', |
29 | user_id: '', | 29 | user_id: '', |
30 | - showDialog: false, | ||
31 | fx_user: '', | 30 | fx_user: '', |
32 | s4_id: '', | 31 | s4_id: '', |
33 | }, | 32 | }, |
34 | onLoad: function (options) { | 33 | onLoad: function (options) { |
35 | let that = this | 34 | let that = this |
36 | - let token = wx.getStorageSync('token') | ||
37 | console.log(options); | 35 | console.log(options); |
38 | if (!options.scene) { | 36 | if (!options.scene) { |
39 | that.setData({ | 37 | that.setData({ |
40 | id: options.id, | 38 | id: options.id, |
41 | }) | 39 | }) |
42 | - console.log(options); | ||
43 | } else { | 40 | } else { |
44 | that.setData({ | 41 | that.setData({ |
45 | id: options.scene, | 42 | id: options.scene, |
46 | }) | 43 | }) |
47 | - console.log(options); | ||
48 | } | 44 | } |
49 | - // if (token) { | ||
50 | - | ||
51 | - // } else { | ||
52 | - // that.getToken() | ||
53 | - // } | ||
54 | that.getDetailsContent() | 45 | that.getDetailsContent() |
55 | }, | 46 | }, |
56 | previewImage: function (e) { | 47 | previewImage: function (e) { |
@@ -69,7 +60,7 @@ Page({ | @@ -69,7 +60,7 @@ Page({ | ||
69 | content: '您尚未登录,请登录后操作', | 60 | content: '您尚未登录,请登录后操作', |
70 | success: function (res) { | 61 | success: function (res) { |
71 | if (res.confirm) { | 62 | if (res.confirm) { |
72 | - that.toggleDialog() | 63 | + that.selectComponent('#lfyLogin').getLogin('hh') |
73 | } else { | 64 | } else { |
74 | console.log('点击取消回调') | 65 | console.log('点击取消回调') |
75 | wx.navigateBack() | 66 | wx.navigateBack() |
@@ -80,10 +71,6 @@ Page({ | @@ -80,10 +71,6 @@ Page({ | ||
80 | }, | 71 | }, |
81 | 72 | ||
82 | onShow: function () { | 73 | onShow: function () { |
83 | - // let token = wx.getStorageSync("token") | ||
84 | - // if (token) { | ||
85 | - | ||
86 | - // } | ||
87 | this.getPingList() | 74 | this.getPingList() |
88 | }, | 75 | }, |
89 | GOcanvas() { | 76 | GOcanvas() { |
@@ -328,23 +315,8 @@ Page({ | @@ -328,23 +315,8 @@ Page({ | ||
328 | }) | 315 | }) |
329 | 316 | ||
330 | } else { | 317 | } else { |
331 | - wx.showModal({ | ||
332 | - title: '提示', | ||
333 | - content: '您尚未登录,请登录后操作', | ||
334 | - success: function (res) { | ||
335 | - if (res.confirm) { | ||
336 | - wx.navigateTo({ | ||
337 | - url: '/pages/authorization/authorization' | ||
338 | - }) | ||
339 | - } else { | ||
340 | - console.log('点击取消回调') | ||
341 | - } | ||
342 | - } | ||
343 | - }) | 318 | + that.getToken() |
344 | } | 319 | } |
345 | - | ||
346 | - | ||
347 | - | ||
348 | }, | 320 | }, |
349 | countMinus() { // 商品数量减 | 321 | countMinus() { // 商品数量减 |
350 | let that = this | 322 | let that = this |
@@ -644,47 +616,4 @@ Page({ | @@ -644,47 +616,4 @@ Page({ | ||
644 | return shareObj; | 616 | return shareObj; |
645 | 617 | ||
646 | }, | 618 | }, |
647 | - toggleDialog() { | ||
648 | - this.setData({ | ||
649 | - showDialog: !this.data.showDialog | ||
650 | - }) | ||
651 | - }, | ||
652 | - bindGetUserInfo(e) { // 立即授权 | ||
653 | - let that = this; | ||
654 | - wx.login({ | ||
655 | - success(res) { | ||
656 | - console.log(res); | ||
657 | - that.setData({ | ||
658 | - code: res.code | ||
659 | - }) | ||
660 | - request({ | ||
661 | - url: 'api/common/login', | ||
662 | - method: "POST", | ||
663 | - data: { | ||
664 | - rawData: e.detail.rawData, | ||
665 | - code: that.data.code, | ||
666 | - } | ||
667 | - }) | ||
668 | - .then(res => { | ||
669 | - console.log(res); | ||
670 | - if (res.data.code == 1) { | ||
671 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
672 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
673 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
674 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
675 | - | ||
676 | - } | ||
677 | - console.log(res.data.data.userInfo.token); | ||
678 | - that.toggleDialog() | ||
679 | - that.setData({ | ||
680 | - msg: res.data.msg | ||
681 | - }) | ||
682 | - that.popSuccessTest(); | ||
683 | - that.getDetailsContent() | ||
684 | - }).catch(err => { | ||
685 | - console.log(err); | ||
686 | - }) | ||
687 | - } | ||
688 | - }) | ||
689 | - }, | ||
690 | }) | 619 | }) |
@@ -237,24 +237,5 @@ | @@ -237,24 +237,5 @@ | ||
237 | </button> | 237 | </button> |
238 | </view> | 238 | </view> |
239 | </view> | 239 | </view> |
240 | - <view class="zan_dialog" catchtap="toggleDialog" wx:if="{{showDialog}}"></view> | ||
241 | - <view class="phoneshou" wx:if="{{showDialog}}"> | ||
242 | - <view class="padlock" catchtap="toggleDialog"> | ||
243 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
244 | - </view> | ||
245 | - <view class="phone_title">请先授权登录</view> | ||
246 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
247 | - <view class="downbtn"> | ||
248 | - <!-- <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
249 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
250 | - 微信授权登录 | ||
251 | - </button> --> | ||
252 | - <view class="si_box"> | ||
253 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
254 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
255 | - 微信授权登录 | ||
256 | - </button> | ||
257 | - </view> | ||
258 | - </view> | ||
259 | - </view> | 240 | + <lfy-login id="lfyLogin" bind:istoken="bindistoken" /> |
260 | </view> | 241 | </view> |
@@ -9,7 +9,6 @@ Page({ | @@ -9,7 +9,6 @@ Page({ | ||
9 | id: '', | 9 | id: '', |
10 | MaintainImg: '', | 10 | MaintainImg: '', |
11 | content: '', | 11 | content: '', |
12 | - showDialog: false, | ||
13 | pingListL: [], | 12 | pingListL: [], |
14 | msg: '' | 13 | msg: '' |
15 | }, | 14 | }, |
@@ -136,7 +135,7 @@ Page({ | @@ -136,7 +135,7 @@ Page({ | ||
136 | content: '您尚未登录,请登录后操作', | 135 | content: '您尚未登录,请登录后操作', |
137 | success: function (res) { | 136 | success: function (res) { |
138 | if (res.confirm) { | 137 | if (res.confirm) { |
139 | - that.toggleDialog() | 138 | + that.selectComponent('#lfyLogin').getLogin('hh') |
140 | } else { | 139 | } else { |
141 | console.log('点击取消回调') | 140 | console.log('点击取消回调') |
142 | } | 141 | } |
@@ -190,53 +189,6 @@ Page({ | @@ -190,53 +189,6 @@ Page({ | ||
190 | 189 | ||
191 | 190 | ||
192 | }, | 191 | }, |
193 | - toggleDialog() { | ||
194 | - this.setData({ | ||
195 | - showDialog: !this.data.showDialog | ||
196 | - }) | ||
197 | - }, | ||
198 | - bindGetUserInfo(e) { // 立即授权 | ||
199 | - let that = this; | ||
200 | - wx.login({ | ||
201 | - success(res) { | ||
202 | - console.log(res); | ||
203 | - that.setData({ | ||
204 | - code: res.code | ||
205 | - }) | ||
206 | - request({ | ||
207 | - url: 'api/common/login', | ||
208 | - method: "POST", | ||
209 | - data: { | ||
210 | - rawData: e.detail.rawData, | ||
211 | - code: that.data.code, | ||
212 | - } | ||
213 | - }) | ||
214 | - .then(res => { | ||
215 | - console.log(res); | ||
216 | - if (res.data.code == 1) { | ||
217 | - wx.setStorageSync('token', res.data.data.userInfo.token); | ||
218 | - wx.setStorageSync('avatar', res.data.data.userInfo.avatar); | ||
219 | - wx.setStorageSync('name', res.data.data.userInfo.nickname); | ||
220 | - wx.setStorageSync('user_id', res.data.data.userInfo.user_id); | ||
221 | - | ||
222 | - } | ||
223 | - console.log(res.data.data.userInfo.token); | ||
224 | - that.toggleDialog() | ||
225 | - that.setData({ | ||
226 | - msg: res.data.msg | ||
227 | - }) | ||
228 | - that.popSuccessTest(); | ||
229 | - that.getStoreMaintainImg() | ||
230 | - }).catch(err => { | ||
231 | - console.log(err); | ||
232 | - that.setData({ | ||
233 | - msg: err.msg | ||
234 | - }) | ||
235 | - that.popMaskTest() | ||
236 | - }) | ||
237 | - } | ||
238 | - }) | ||
239 | - }, | ||
240 | previewImage: function (e) { | 192 | previewImage: function (e) { |
241 | var current = e.target.dataset.src; | 193 | var current = e.target.dataset.src; |
242 | var imgList = e.target.dataset.list | 194 | var imgList = e.target.dataset.list |
@@ -262,4 +214,8 @@ Page({ | @@ -262,4 +214,8 @@ Page({ | ||
262 | //如果有透明蒙层,弹窗的期间不能点击文档内容 | 214 | //如果有透明蒙层,弹窗的期间不能点击文档内容 |
263 | }) | 215 | }) |
264 | }, | 216 | }, |
217 | + bindistoken() { | ||
218 | + this.getStoreMaintainImg() | ||
219 | + console.log('我回来了'); | ||
220 | + }, | ||
265 | }) | 221 | }) |
@@ -130,24 +130,5 @@ | @@ -130,24 +130,5 @@ | ||
130 | <view class="d" wx:else>暂无评价</view> | 130 | <view class="d" wx:else>暂无评价</view> |
131 | </block> | 131 | </block> |
132 | </view> | 132 | </view> |
133 | - <view class="zan_dialog" catchtap="toggleDialog" wx:if="{{showDialog}}"></view> | ||
134 | - <view class="phoneshou" wx:if="{{showDialog}}"> | ||
135 | - <view class="padlock" catchtap="toggleDialog"> | ||
136 | - <image src="{{imagesUrl}}assets/static/img/updown.png" /> | ||
137 | - </view> | ||
138 | - <view class="phone_title">请先授权登录</view> | ||
139 | - <view class="tips_content">为了更好的为你提供服务,请允许微信授权后再使用功能</view> | ||
140 | - <view class="downbtn"> | ||
141 | - <!-- <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
142 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
143 | - 微信授权登录 | ||
144 | - </button> --> | ||
145 | - <view class="si_box"> | ||
146 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
147 | - <image src="{{imagesUrl}}assets/static/img/icon_wechat.png" /> | ||
148 | - 微信授权登录 | ||
149 | - </button> | ||
150 | - </view> | ||
151 | - </view> | ||
152 | - </view> | 133 | + <lfy-login id="lfyLogin" bind:istoken="bindistoken" /> |
153 | </view> | 134 | </view> |
@@ -12,9 +12,9 @@ Page({ | @@ -12,9 +12,9 @@ Page({ | ||
12 | * 生命周期函数--监听页面加载 | 12 | * 生命周期函数--监听页面加载 |
13 | */ | 13 | */ |
14 | onLoad: function (options) { | 14 | onLoad: function (options) { |
15 | - console.log(options) | 15 | + console.log(decodeURIComponent(options.url)) |
16 | this.setData({ | 16 | this.setData({ |
17 | - waiUrl: options.url | 17 | + waiUrl: decodeURIComponent(options.url) |
18 | }) | 18 | }) |
19 | }, | 19 | }, |
20 | 20 |
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | "minifyWXSS": true | 40 | "minifyWXSS": true |
41 | }, | 41 | }, |
42 | "compileType": "miniprogram", | 42 | "compileType": "miniprogram", |
43 | - "libVersion": "2.11.0", | 43 | + "libVersion": "2.16.0", |
44 | "appid": "wx11011d1f9492b8e0", | 44 | "appid": "wx11011d1f9492b8e0", |
45 | "projectname": "%E8%BD%A6%E5%94%9B", | 45 | "projectname": "%E8%BD%A6%E5%94%9B", |
46 | "debugOptions": { | 46 | "debugOptions": { |
project.private.config.json
0 → 100644
1 | +{ | ||
2 | + "condition": { | ||
3 | + "plugin": { | ||
4 | + "list": [] | ||
5 | + }, | ||
6 | + "game": { | ||
7 | + "list": [] | ||
8 | + }, | ||
9 | + "gamePlugin": { | ||
10 | + "list": [] | ||
11 | + }, | ||
12 | + "miniprogram": { | ||
13 | + "list": [ | ||
14 | + { | ||
15 | + "id": -1, | ||
16 | + "name": "pages/stores/index", | ||
17 | + "pathName": "pages/stores/index", | ||
18 | + "query": "", | ||
19 | + "scene": null | ||
20 | + }, | ||
21 | + { | ||
22 | + "name": "pages/praise/praise", | ||
23 | + "pathName": "pages/praise/praise", | ||
24 | + "query": "", | ||
25 | + "scene": null | ||
26 | + }, | ||
27 | + { | ||
28 | + "name": "pages/goPromotion/goPromotion", | ||
29 | + "pathName": "pages/goPromotion/goPromotion", | ||
30 | + "query": "", | ||
31 | + "scene": null | ||
32 | + }, | ||
33 | + { | ||
34 | + "name": "pages/VtuanDetail/VtuanDetail", | ||
35 | + "pathName": "pages/VtuanDetail/VtuanDetail", | ||
36 | + "query": "type=4&id=4073", | ||
37 | + "scene": null | ||
38 | + }, | ||
39 | + { | ||
40 | + "name": "pages/home/home", | ||
41 | + "pathName": "pages/home/home", | ||
42 | + "query": "", | ||
43 | + "scene": null | ||
44 | + }, | ||
45 | + { | ||
46 | + "name": "pages/details/details", | ||
47 | + "pathName": "pages/details/details", | ||
48 | + "query": "", | ||
49 | + "scene": null | ||
50 | + }, | ||
51 | + { | ||
52 | + "name": "pages/addcars/addcars", | ||
53 | + "pathName": "pages/addcars/addcars", | ||
54 | + "query": "", | ||
55 | + "scene": null | ||
56 | + }, | ||
57 | + { | ||
58 | + "name": "pages/homeNoLogin2/homeNoLogin2", | ||
59 | + "pathName": "pages/homeNoLogin2/homeNoLogin2", | ||
60 | + "query": "", | ||
61 | + "scene": null | ||
62 | + }, | ||
63 | + { | ||
64 | + "name": "pages/distributionChanged/distributionChanged", | ||
65 | + "pathName": "pages/distributionChanged/distributionChanged", | ||
66 | + "query": "id=59", | ||
67 | + "scene": null | ||
68 | + } | ||
69 | + ] | ||
70 | + } | ||
71 | + } | ||
72 | +} |
-
请 注册 或 登录 后发表评论