jufubao-base 1.0.147 → 1.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@
24
24
  }"
25
25
  >
26
26
  </view>
27
+ <view v-if="!auth_code" class="app-body__jump" @click="doJump">跳过</view>
27
28
  <view class="app-body__bottom">
28
29
  <view class="app-body__bottom-btn">
29
30
  <button
@@ -35,7 +36,7 @@
35
36
  boxShadow: '0 5rpx 10rpx ' + mainColor
36
37
  }"
37
38
  @getphonenumber="decryptPhoneNumber"
38
- >微信授权登录</button>
39
+ >{{ authBtnText }}</button>
39
40
  <button
40
41
  v-else
41
42
  @click="decryptPhoneNumber()"
@@ -43,7 +44,7 @@
43
44
  background: mainColor,
44
45
  boxShadow: '0 5rpx 10rpx ' + mainColor
45
46
  }"
46
- >微信授权登录</button>
47
+ >{{ authBtnText }}</button>
47
48
  </view>
48
49
  <view class="app-body__bottom-tips" v-if="notice" v-html="notice" :style="{color: textColor}"></view>
49
50
  <view class="app-body__bottom-policy">
@@ -87,7 +88,7 @@
87
88
  return {
88
89
  isPreview: false,
89
90
  selectPolicy: false,
90
- auth_code: null,
91
+ auth_code: null, //有值说明未关联
91
92
  provider_id:null,
92
93
  nextUrl: null,
93
94
  showDialog: false,
@@ -98,11 +99,16 @@
98
99
  //面板
99
100
  bgImage: '', //背景图片
100
101
  notice: '', //授权按钮下面文案
101
- textColor: '#fff'
102
+ textColor: '#fff',
103
+ btnLoginText: "", //授权按钮文案
104
+ btnCollectPhoneText: "", //授权收集手机号按钮文案
102
105
  }
103
106
  },
104
107
  computed:{
105
108
  ...mapState(['jfbAuthorize']),
109
+ authBtnText(){
110
+ return this.auth_code ? this.btnLoginText : this.btnCollectPhoneText;
111
+ }
106
112
  },
107
113
  watch: {
108
114
  container(value) {
@@ -127,6 +133,14 @@
127
133
  this.selectPolicy = !this.selectPolicy;
128
134
  },
129
135
 
136
+ doJump(){
137
+ if(!this.auth_code){
138
+ this.$xdUniHelper.redirectTo({
139
+ url: this.nextUrl
140
+ })
141
+ }
142
+ },
143
+
130
144
  decryptPhoneNumber(e) {
131
145
  if (e === undefined) {
132
146
  this.$xdConfirm({
@@ -146,6 +160,18 @@
146
160
  let {iv, encryptedData} = e.detail;
147
161
  let raw_data = JSON.stringify({iv, encryptedData});
148
162
 
163
+ //auth_code 临时授权码,走授权登录。 否则走授权收集手机号
164
+ if(this.auth_code){
165
+ this.p_userPhoneWxLogin(raw_data)
166
+ }else{
167
+ this.p_userPhoneCollect(raw_data)
168
+ }
169
+ },
170
+
171
+ /**
172
+ * @description 授权登录
173
+ */
174
+ p_userPhoneWxLogin(raw_data){
149
175
  jfbRootExec("userPhoneWxLogin", {
150
176
  vm: this,
151
177
  data: {
@@ -183,9 +209,30 @@
183
209
  zIndex: this.isPreview ? 2000 : 1400
184
210
  });
185
211
  })
186
-
187
212
  },
188
213
 
214
+ /**
215
+ * @description 授权收集手机号
216
+ */
217
+ p_userPhoneCollect(raw_data){
218
+ uni.login({
219
+ provider: "weixin",
220
+ success: (loginRes) => {
221
+ jfbRootExec("userPhoneCollect", {
222
+ vm: this,
223
+ data: {
224
+ raw_data,
225
+ third_auth_code: loginRes.code,
226
+ provider_id: this.provider_id,
227
+ }
228
+ }).then(res => {
229
+ this.$xdUniHelper.redirectTo({
230
+ url: this.nextUrl
231
+ })
232
+ })
233
+ }
234
+ })
235
+ },
189
236
 
190
237
  /**
191
238
  * @description 监听事件变化
@@ -195,6 +242,8 @@
195
242
  let bgImage = getContainerPropsValue(container, 'content.bgImage', {});
196
243
  if(bgImage.url) this.bgImage = getServiceUrl(bgImage.url);
197
244
  this.notice = getContainerPropsValue(container, 'content.notice', '');
245
+ this.btnLoginText = getContainerPropsValue(container, 'content.btnLoginText', '微信授权登录');
246
+ this.btnCollectPhoneText = getContainerPropsValue(container, 'content.btnCollectPhoneText', '获取手机号');
198
247
  this.textColor = getContainerPropsValue(container, 'content.textColor', '#fff');
199
248
  },
200
249
 
@@ -242,6 +291,12 @@
242
291
 
243
292
  }
244
293
 
294
+ &__jump {
295
+ position: absolute;
296
+ top: 40rpx;
297
+ right: 40rpx;
298
+ }
299
+
245
300
  &__bottom {
246
301
  position: absolute;
247
302
  bottom: unit(80, rpx);