jufubao-base 1.0.25 → 1.0.27

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.
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const basePath = require('./build/path');
5
+ const clog = require('./build/clog');
6
+ const fileHelper = require('./build/fileHepler');
7
+ let fromBuildPath = path.resolve('./node_modules/gxd-commands-bussiness/build');
8
+ let fromCommandsPath = path.resolve('./node_modules/gxd-commands-bussiness/commands');
9
+ const utils = require('./build/lib/utils');
10
+ const execSync = require('child_process').execSync;
11
+ const getPackage = `${basePath.buildRoot}/get.package.path.js`;
12
+
13
+ //业务项目ID
14
+ const projectPathList = [
15
+ {
16
+ name: '业务基础初始化库',
17
+ path: '/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-bussiness-base'
18
+ },
19
+ {
20
+ name: '业务组件基础插件库',
21
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-base'
22
+ },
23
+ {
24
+ name: '业务组件商城库',
25
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-mall'
26
+ },
27
+ {
28
+ name: '业务组件在线选座库',
29
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-movie'
30
+ },
31
+ {
32
+ name: '业务组件核销库',
33
+ path: '//Users/shiyonggao/Desktop/code/JFB/package/jufubao-cashier'
34
+ },
35
+ ];
36
+
37
+ const init = ()=>{
38
+ //判断是否从本地获取数据
39
+ let isLocal = process.env.isLocal === 'true';
40
+ if (isLocal && fileHelper.existFileSync(getPackage)) {
41
+ const {getPackagePath} = require(getPackage);
42
+ fromBuildPath = fileHelper.getPlatformSurePath(getPackagePath('/build', 'gxd-commands-bussiness'));
43
+ fromCommandsPath = fileHelper.getPlatformSurePath(getPackagePath('/commands', 'gxd-commands-bussiness'));
44
+ }
45
+
46
+ //获取需要拷贝的项目路径
47
+ clog(`开始更新项目`, 'cyanBG');
48
+
49
+ //更新包
50
+ execSync(`npm i --registry=https://registry.npm.taobao.org`, {stdio: 'inherit'});
51
+
52
+ //复制命令行
53
+ projectPathList.map(item=>{
54
+ let toBuildPath = `${item.path}/build`;
55
+ let toCommandsPath = `${item.path}/commands`;
56
+ fileHelper.copySync(fromBuildPath, toBuildPath);
57
+ fileHelper.copySync(fromCommandsPath, toCommandsPath);
58
+ clog(`拷贝命令行操作成功,目录:${toBuildPath}`, 'green');
59
+ clog(`拷贝命令行操作成功,目录:${toCommandsPath}`, 'green');
60
+ });
61
+
62
+ //初始化插件库
63
+ utils.logsLine(clog,'start');
64
+ clog(`开始初始化项目框架逻辑`, 'cyanBG');
65
+ projectPathList.map(item=>{
66
+ clog(`开始:${item.name}`, 'redBG');
67
+ clog(`目录:${fileHelper.getPlatformSurePath(item.path)}`, 'green');
68
+ execSync(`cd ${item.path} && cross-env oss=true node ./build/commands/copy.init.js`, {stdio: 'inherit'});
69
+ utils.logsLine(clog);
70
+ });
71
+ utils.logsLine(clog, 'end');
72
+ clog(`结束初始化项目框架逻辑`, 'cyanBG');
73
+
74
+ };
75
+
76
+ init();
77
+
78
+
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const basePath = require('./build/path');
5
+ const clog = require('./build/clog');
6
+ const fileHelper = require('./build/fileHepler');
7
+ const utils = require('./build/lib/utils');
8
+
9
+ //业务项目ID
10
+ // const projectPathList = [
11
+ // {
12
+ // name: '业务组件基础插件库',
13
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-base'
14
+ // },
15
+ // {
16
+ // name: '业务组件商城库',
17
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-mall'
18
+ // },
19
+ // {
20
+ // name: '业务组件在线选座库',
21
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-movie'
22
+ // },
23
+ // {
24
+ // name: '业务组件核销库',
25
+ // path: '/Users/shiyonggao/home/root/Base-Jufubao/jufubao-cashier'
26
+ // },
27
+ // ];
28
+
29
+ //业务项目ID
30
+ const projectPathList = [
31
+ {
32
+ name: '业务组件基础插件库',
33
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-base'
34
+ },
35
+ {
36
+ name: '业务组件商城库',
37
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-mall'
38
+ },
39
+ {
40
+ name: '业务组件在线选座库',
41
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-movie'
42
+ },
43
+ {
44
+ name: '业务组件核销库',
45
+ path: '/Users/shiyonggao/Desktop/code/JFB/package/jufubao-cashier'
46
+ },
47
+ ];
48
+
49
+
50
+ ///Users/shiyonggao/Desktop/code/BASE/UNIAPP/
51
+
52
+ const projectChange = [
53
+ '/commands.all.js',
54
+ '/src/common/authorize.js',
55
+ '/commands.update.change.js',
56
+ '/src/store/index.js',
57
+ '/src/store/mutations.js',
58
+ '/src/store/actions.js',
59
+ '/commands/preview/components/JfbBaseBlock/JfbBaseBlock.vue',
60
+ '/src/common/request.js',
61
+ ];
62
+
63
+ const init = ()=>{
64
+ let argv = utils.getArgv();
65
+ if (argv.length === 0) {
66
+ clog(`请传入参数,例如: npm run change copy(拷贝)|del(删除)`, 'red');
67
+ process.exit(-1);
68
+ }
69
+
70
+ if(argv[0] !== 'copy' && argv[0] !== 'del') {
71
+ clog(`参数错误,正确参数为:copy,del。例如: npm run change copy`, 'red');
72
+ process.exit(-1);
73
+ }
74
+
75
+ let type = argv[0];
76
+
77
+ //获取需要拷贝的项目路径
78
+ clog(`开始拷贝文件`, 'cyanBG');
79
+
80
+ //复制命令行
81
+ projectChange.map(file=>{
82
+ let toPath = fileHelper.getPlatformSurePath(basePath.buildRoot + file);
83
+ projectPathList.map(item=>{
84
+ let fromPath = fileHelper.getPlatformSurePath(item.path + file);
85
+ if(type === 'copy') {
86
+ fileHelper.copySync(toPath, fromPath);
87
+ clog(`拷贝文件成功,目录:${fromPath}`, 'green');
88
+ }
89
+ if (type === 'del') {
90
+ fileHelper.removeFileAndDir(fromPath);
91
+ clog(`删除文件成功,目录:${fromPath}`, 'green');
92
+ }
93
+ })
94
+ });
95
+
96
+ //获取需要拷贝的项目路径
97
+ clog(`结束拷贝文件`, 'cyanBG');
98
+
99
+ };
100
+
101
+ init();
102
+
103
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -7,6 +7,7 @@ import storage from "@/common/storage";
7
7
  const settings = require('./../../settings');
8
8
  import Vue from 'vue';
9
9
  let __jfbAuthorize = null;
10
+ import store from "@/store";
10
11
 
11
12
  class JfbAuthorize {
12
13
  /**
@@ -69,7 +70,6 @@ class JfbAuthorize {
69
70
  */
70
71
  setToken(key, value, options = {}) {
71
72
  key = this.getTokenKeyword(key);
72
-
73
73
  //#ifdef H5
74
74
  cookie.set(key, value, options);
75
75
  //#endif
@@ -98,7 +98,6 @@ class JfbAuthorize {
98
98
  */
99
99
  getToken(key, options = {}) {
100
100
  let tokenKey = this.getTokenKeyword(key);
101
- console.log(tokenKey)
102
101
  let token = null;
103
102
  if (storage.get(tokenKey)) token = storage.get(tokenKey);
104
103
  //#ifdef H5
@@ -107,17 +106,51 @@ class JfbAuthorize {
107
106
  return token
108
107
  }
109
108
 
109
+ /**
110
+ * @description h5中获取base
111
+ * @param $vm {Vue}
112
+ */
113
+ getBasePath($vm){
114
+ let base = '';
115
+ //#ifdef H5
116
+ base = $vm.$router.history.base;
117
+ //#endif
118
+ return base;
119
+ }
120
+
121
+ /**
122
+ * @description 跳转到卡登陆页面
123
+ * @param $vm {Vue}
124
+ */
125
+ jumpToCardLogin($vm){
126
+ $vm['$xdUniHelper'].redirectTo({
127
+ url: this.cardPath + `?inCallback=${encodeURIComponent($vm.$route.fullPath)}`,
128
+ });
129
+ }
130
+
131
+ /**
132
+ * @description 跳转到用户登陆页面
133
+ * @param $vm {Vue}
134
+ */
135
+ jumpToUserLogin($vm) {
136
+ $vm['$xdUniHelper'].redirectTo({
137
+ url: this.LoginPath + `?redirect_url=${encodeURIComponent($vm.$route.fullPath)}`,
138
+ });
139
+ }
140
+
110
141
  /**
111
142
  * @description 用户是否已登录卡信息
112
143
  * @param canCard {Boolean} 检查是否用登录购物车信息 默认:false
113
144
  * @param $vm {Vue}
145
+ * @param isAutoJump {Boolean} 是否自己跳转 默认值:true
146
+ * @return {boolean} true 已登陆或者免登 false 未登陆
114
147
  */
115
- checkCardLogin(canCard = false, $vm){
148
+ checkCardLogin(canCard = false, $vm, isAutoJump=true){
116
149
  if(!canCard) return true;
117
150
  if (!this.getToken('card')) {
118
- $vm['$xdUniHelper'].redirectTo({
119
- url: this.cardPath,
120
- });
151
+ if(isAutoJump) {
152
+ this.jumpToCardLogin($vm);
153
+ }
121
154
  return false;
122
155
  }
123
156
  return true;
@@ -127,16 +160,32 @@ class JfbAuthorize {
127
160
  * @description 用户已登录信息
128
161
  * @param canSign {Boolean} 检查是否用登录信息 默认:false
129
162
  * @param $vm {Vue}
163
+ * @param isAutoJump {Boolean} 是否自己跳转 默认值:true
164
+ * @return {Promise} true: 已登陆或者未启用,false:未登陆或刷新token已过期获取(从新交换token)
130
165
  */
131
- checkUserLogin(canSign, $vm) {
132
- if (!canSign) return true;
133
- if (!this.getToken('user')) {
134
- $vm['$xdUniHelper'].redirectTo({
135
- url: '/pages/login/login',
136
- });
137
- return false;
138
- }
139
- return true;
166
+ checkUserLogin(canSign, $vm, isAutoJump=true) {
167
+ return new Promise((resolve, reject)=>{
168
+ //免登陆操作
169
+ if (!canSign) resolve(true);
170
+
171
+ //用户登陆判断
172
+ let userToken = this.getToken('user');
173
+
174
+ //去刷新token
175
+ if (!userToken) store.dispatch('userRefreshToken')
176
+ .then(res => {
177
+ resolve(true);
178
+ })
179
+ .catch(error=>{
180
+ if (isAutoJump) {
181
+ this.jumpToUserLogin($vm);
182
+ }
183
+ resolve(false);
184
+ });
185
+ else{
186
+ resolve(true);
187
+ }
188
+ });
140
189
  }
141
190
  }
142
191
 
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+ module.exports = {
3
+
4
+ }
@@ -55,24 +55,7 @@
55
55
  if (height) this.height = height;
56
56
  },
57
57
  onJfbLoad(options) {
58
-
59
- //#ifdef H5
60
- //参考地址: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#0
61
- jfbRootExec('getH5WxAuthorize', {
62
- vm: this,
63
- data: {
64
- jsApiList: [], //可以不传,不传走系统默认
65
- url: window.location.href //可以不传
66
- },
67
- })
68
- .then(res => {
69
- console.log('success', res)
70
- })
71
- .catch(error => {
72
- console.error(error)
73
- })
74
-
75
- // #endif
58
+
76
59
  },
77
60
  }
78
61
  }
@@ -273,6 +273,13 @@
273
273
  vm: this,
274
274
  data: {}
275
275
  }).then((res) => {
276
+ res.list = res.list.map(item=>{
277
+ return {
278
+ ...item,
279
+ card_point : this.$xdUniHelper.divisionFloatNumber(item.card_point, 100),
280
+ other_card_point: this.$xdUniHelper.divisionFloatNumber(item.other_card_point, 100),
281
+ }
282
+ });
276
283
  this.cardList = res.list.filter((item) => {
277
284
  if (item['is_valide'] !== 'N' && item['card_point'] !== 0) {
278
285
  return true
@@ -295,20 +302,9 @@
295
302
  this.showList = this.cardList
296
303
  }).catch()
297
304
  },
298
- onJfbScroll(options) {
299
- console.log('event.onJfbScroll', options)
300
- },
301
- onJfbReachBottom(options) {
302
- console.log('event.onJfbReachBottom', options)
303
- },
304
- onJfbShow(options) {
305
- console.log('event.onJfbShow', options)
306
- },
307
- onJfbHide(options) {
308
- console.log('event.onJfbHide', options)
309
- },
305
+
310
306
  onJfbBack(options) {
311
- console.log('event.onJfbBack', options)
307
+ this.$xdUniHelper.navigateBack();
312
308
  },
313
309
  }
314
310
  }
@@ -13,7 +13,7 @@
13
13
  <view class="jfb-base-card-detail__edit-icon" @click="delEdit">删除</view>
14
14
  </view>
15
15
  <!-- #endif -->
16
- <view class="jfb-base-card-detail__body">
16
+ <view class="jfb-base-card-detail__body" v-if="info !== null">
17
17
  <view class="jfb-base-card-detail__body-info" v-for="(item,index) in valueKey" :key="index">
18
18
  <view class="jfb-base-card-detail__body-info-label">{{item.label}}</view>
19
19
  <view class="jfb-base-card-detail__body-info-value">{{info[item.key]}}</view>
@@ -25,13 +25,10 @@
25
25
  <view>剩余元宝</view>
26
26
  </view>
27
27
  <view class="jfb-base-card-detail__body-residue-value">
28
- <view>{{info.card_point}}</view>
29
- <xd-font-icon size="30" icon="iconyuanbao_mian"></xd-font-icon>
28
+ <xd-unit :price="info.card_point" :is-old="false"></xd-unit>
30
29
  </view>
31
30
  </view>
32
- <view class="jfb-base-card-detail__body-tips">
33
- 提示:满减券仅支持微信补差,不接受现金补差
34
- </view>
31
+ <view class="jfb-base-card-detail__body-tips">提示:满减券仅支持微信补差,不接受现金补差</view>
35
32
  <view class="jfb-base-card-detail__body-qrcode">
36
33
  <view>
37
34
  <view>
@@ -76,6 +73,7 @@
76
73
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
77
74
  import {jfbRootExec} from "@/utils/xd.event";
78
75
  import JfbBaseCardDetailMixin from "./JfbBaseCardDetailMixin";
76
+ import XdUnit from "@/components/XdUnit/XdUnit";
79
77
  import XdPwPay from "@/components/XdPwPay/XdPwPay";
80
78
  import XdEditPwd from "@/components/XdEditPwd/XdEditPwd";
81
79
  import getBusinessImageUrl from "@/common/getBusinessImageUrl";
@@ -85,7 +83,8 @@
85
83
  components: {
86
84
  XdFontIcon,
87
85
  XdPwPay,
88
- XdEditPwd
86
+ XdEditPwd,
87
+ XdUnit
89
88
  },
90
89
  mixins: [
91
90
  JfbBaseCardDetailMixin
@@ -179,23 +178,9 @@
179
178
  // }
180
179
 
181
180
  });
182
-
183
- // jfbRootExec('baiduUserLogin', {
184
-
185
- // vm: this,// data: {
186
-
187
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
188
-
189
- // }
190
-
191
- // }).then().catch()
192
- },
193
- onJfbScroll(options) {
194
- console.log('event.onJfbScroll', options)
195
- },
196
- onJfbReachBottom(options) {
197
- console.log('event.onJfbReachBottom', options)
181
+
198
182
  },
183
+
199
184
  onJfbShow(options) {
200
185
  console.log('event.onJfbShow', options)
201
186
  if (this.first) {
@@ -217,11 +202,7 @@
217
202
  }
218
203
  }
219
204
  },
220
- onJfbHide(options) {
221
- console.log('event.onJfbHide', options)
222
- },
223
205
  onJfbBack(options) {
224
- console.log('event.onJfbBack', options)
225
206
  this.$xdUniHelper.navigateBack()
226
207
  },
227
208
  setInval(time) {
@@ -63,10 +63,10 @@
63
63
  }
64
64
  },
65
65
  created() {
66
- this.view = window['jfbConfingView'] === 'preview';
66
+ this.view = this.$configProject.isPreview;
67
67
 
68
68
  //设置高度
69
- if(window['jfbConfingView'] === 'preview') {
69
+ if(this.$configProject.isPreview) {
70
70
  this.height = getComponentAttr(this.componentAttr, 'height') - 4;
71
71
  }
72
72
  else {
@@ -160,6 +160,7 @@
160
160
  import XdForm from "@/components/XdForm/XdForm";
161
161
  import XdFormItem from "@/components/XdFormItem/XdFormItem";
162
162
  import {getContainerPropsValue} from "@/utils/xd.base";
163
+ import {mapState} from 'vuex';
163
164
  export default {
164
165
  name: "JfbBaseLogin",
165
166
  components: {
@@ -211,9 +212,11 @@
211
212
  phone_number_login_url: "", //授权登录后的手机登录地址
212
213
  phone_number_collect_url: "", //授权登录后的手机号手机地址
213
214
  forget_pwd_url: "", //忘记密码跳转地址
215
+ base: '',
214
216
  }
215
217
  },
216
218
  computed: {
219
+ ...mapState(['jfbAuthorize']),
217
220
  panelIsChecked(){
218
221
  return this.panel_1_checked.includes(1);
219
222
  }
@@ -226,6 +229,7 @@
226
229
 
227
230
  created() {
228
231
  this.init(this.container);
232
+ this.base = this.jfbAuthorize.getBasePath(this)
229
233
  //todo
230
234
  },
231
235
 
@@ -247,15 +251,15 @@
247
251
  let redirectURL = new URL(decodeURIComponent(redirect_url));
248
252
  redirect_url = redirectURL.href;
249
253
  }catch(e){
250
- redirect_url = location.origin + redirect_url;
254
+ redirect_url = location.origin + this.base + redirect_url;
251
255
  }
252
256
  jfbRootExec("listSiteProvider", {
253
257
  vm: this,
254
258
  data: {
255
259
  providers: providers,
256
- callback_url: redirect_url || (location.origin + this.settings.index),
257
- phone_number_login_url: location.origin + this.phone_number_login_url,
258
- phone_number_collect_url: location.origin + this.phone_number_collect_url
260
+ callback_url: redirect_url || (location.origin + this.base + this.settings.index),
261
+ phone_number_login_url: location.origin + this.base + this.phone_number_login_url,
262
+ phone_number_collect_url: location.origin + this.base + this.phone_number_collect_url
259
263
  }
260
264
  }).then(res => {
261
265
  if(res.quick_enabled){
@@ -278,6 +282,13 @@
278
282
  reGetCode(){
279
283
  if(this.time > 0) return;
280
284
  const { phone_number } = this.accountForm;
285
+ if(!/^1[3-9]\d{9}$/.test(phone_number)){
286
+ uni.showToast({
287
+ title: "请填写正确的手机号",
288
+ icon: 'none'
289
+ });
290
+ return false;
291
+ }
281
292
 
282
293
  console.log("jfbRootExec: sendMsg");
283
294
  jfbRootExec('sendMsg', {
@@ -342,6 +353,17 @@
342
353
  doLoginForm(){
343
354
  const { accountLoginType } = this;
344
355
  const { phone_number, verification_code, password } = this.accountForm;
356
+ let err_tip = "";
357
+ if(!phone_number) err_tip = "手机号不能为空";
358
+ else if(accountLoginType == "phone" && !verification_code) err_tip = "验证码不能为空";
359
+ else if(accountLoginType == "pwd" && !password) err_tip = "密码不能为空";
360
+ if(err_tip){
361
+ return uni.showToast({
362
+ title: err_tip,
363
+ icon: 'none'
364
+ })
365
+ }
366
+
345
367
  if(accountLoginType == "phone"){
346
368
  //表单接口登录
347
369
  jfbRootExec('phoneLogin', {
@@ -136,6 +136,13 @@
136
136
  reGetCode(){
137
137
  if(this.time > 0) return;
138
138
  const { phone_number } = this.resetForm;
139
+ if(!/^1[3-9]\d{9}$/.test(phone_number)){
140
+ uni.showToast({
141
+ title: "请填写正确的手机号",
142
+ icon: 'none'
143
+ });
144
+ return false;
145
+ }
139
146
 
140
147
  jfbRootExec('sendMsg', {
141
148
  vm: this,
@@ -154,6 +161,13 @@
154
161
  })
155
162
  },
156
163
  toResetPassword(){
164
+ const { verification_code, phone_number } = this.resetForm;
165
+ if(!verification_code || !phone_number){
166
+ return uni.showToast({
167
+ title: "填写手机号跟验证码",
168
+ icon: 'none'
169
+ })
170
+ }
157
171
  jfbRootExec("verifyPhoneCode", {
158
172
  vm: this,
159
173
  data: this.resetForm
@@ -175,9 +189,9 @@
175
189
  // onJfbHide(options) {
176
190
  // console.log('event.onJfbHide', options)
177
191
  // },
178
- // onJfbBack(options) {
179
- // console.log('event.onJfbBack', options)
180
- // },
192
+ onJfbBack(options) {
193
+ this.$xdUniHelper.navigateBack();
194
+ },
181
195
  }
182
196
  }
183
197
 
@@ -130,6 +130,10 @@
130
130
  this.pwd_type = getContainerPropsValue(value, 'content.pwd_type');
131
131
  },
132
132
  doSetPassword(){
133
+ const { password, confirm_password } = this.resetForm;
134
+ if(!password || !confirm_password) return uni.showToast({title: "请输入密码",icon: 'none'});
135
+ if(password !== confirm_password) return uni.showToast({title: "密码不一致",icon: 'none'});
136
+
133
137
  let typeFn = "resetPwd"
134
138
  if(this.pwd_type == 1) typeFn = "setPwd"
135
139
  jfbRootExec(typeFn, {
@@ -141,20 +145,20 @@
141
145
  })
142
146
  })
143
147
  },
144
- onJfbScroll(options) {
145
- console.log('event.onJfbScroll', options)
146
- },
147
- onJfbReachBottom(options) {
148
- console.log('event.onJfbReachBottom', options)
149
- },
150
- onJfbShow(options) {
151
- console.log('event.onJfbShow', options)
152
- },
153
- onJfbHide(options) {
154
- console.log('event.onJfbHide', options)
155
- },
148
+ // onJfbScroll(options) {
149
+ // console.log('event.onJfbScroll', options)
150
+ // },
151
+ // onJfbReachBottom(options) {
152
+ // console.log('event.onJfbReachBottom', options)
153
+ // },
154
+ // onJfbShow(options) {
155
+ // console.log('event.onJfbShow', options)
156
+ // },
157
+ // onJfbHide(options) {
158
+ // console.log('event.onJfbHide', options)
159
+ // },
156
160
  onJfbBack(options) {
157
- console.log('event.onJfbBack', options)
161
+ this.$xdUniHelper.navigateBack();
158
162
  },
159
163
  }
160
164
  }
@@ -145,6 +145,13 @@
145
145
  reGetCode(){
146
146
  if(this.time > 0) return;
147
147
  const { phone_number } = this.accountForm;
148
+ if(!/^1[3-9]\d{9}$/.test(phone_number)){
149
+ uni.showToast({
150
+ title: "请填写正确的手机号",
151
+ icon: 'none'
152
+ });
153
+ return false;
154
+ }
148
155
 
149
156
  console.log("jfbRootExec: sendMsg");
150
157
  jfbRootExec('sendMsg', {
@@ -166,6 +173,8 @@
166
173
  doLoginForm(){
167
174
  const { provider_id } = this;
168
175
  const { phone_number, verification_code } = this.accountForm;
176
+ if(!phone_number || !verification_code) return uni.showToast({title: "手机号跟验证码不能为空",icon: 'none'});
177
+
169
178
  jfbRootExec('phoneCollect', {
170
179
  vm: this,
171
180
  data: {
@@ -193,9 +202,9 @@
193
202
  // onJfbHide(options) {
194
203
  // console.log('event.onJfbHide', options)
195
204
  // },
196
- // onJfbBack(options) {
197
- // console.log('event.onJfbBack', options)
198
- // },
205
+ onJfbBack(options) {
206
+ this.$xdUniHelper.navigateBack();
207
+ },
199
208
  }
200
209
  }
201
210
 
@@ -148,6 +148,13 @@
148
148
  reGetCode(){
149
149
  if(this.time > 0) return;
150
150
  const { phone_number } = this.accountForm;
151
+ if(!/^1[3-9]\d{9}$/.test(phone_number)){
152
+ uni.showToast({
153
+ title: "请填写正确的手机号",
154
+ icon: 'none'
155
+ });
156
+ return false;
157
+ }
151
158
 
152
159
  console.log("jfbRootExec: sendMsg");
153
160
  jfbRootExec('sendMsg', {
@@ -169,6 +176,7 @@
169
176
  doLoginForm(){
170
177
  const { auth_code, provider_id } = this;
171
178
  const { phone_number, verification_code } = this.accountForm;
179
+ if(!phone_number || !verification_code) return uni.showToast({title: "手机号跟验证码不能为空",icon: 'none'});
172
180
  jfbRootExec('phoneLogin', {
173
181
  vm: this,
174
182
  data: {
@@ -197,9 +205,9 @@
197
205
  // onJfbHide(options) {
198
206
  // console.log('event.onJfbHide', options)
199
207
  // },
200
- // onJfbBack(options) {
201
- // console.log('event.onJfbBack', options)
202
- // },
208
+ onJfbBack(options) {
209
+ this.$xdUniHelper.navigateBack();
210
+ },
203
211
  }
204
212
  }
205
213
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  //请求参数
58
58
  params:null,
59
- view: window['jfbConfingView'] === 'preview',
59
+ view: false,
60
60
  bgColor: null,
61
61
 
62
62
  //预览模式刷新插件
@@ -71,6 +71,7 @@
71
71
  },
72
72
  created() {
73
73
  this.init(this.container);
74
+ this.view = this.$configProject.isPreview || false
74
75
  },
75
76
  methods: {
76
77
  onJfbLoad(options) {
@@ -11,6 +11,17 @@
11
11
  * @type {*[]}
12
12
  */
13
13
  module.exports = [
14
+ {
15
+ mapFnName: 'getByIdCardDetail', //自定义方法名字(必选)
16
+ isRule: false,
17
+ title: '获得绑定的卡详情',
18
+ prefix: 'detal',
19
+ path: '/card/v1/card-bind/get-bind-card',
20
+ params: {
21
+ card_number: ['卡号', 'String', '必选'],
22
+ },
23
+ disabled: true,
24
+ },
14
25
  {
15
26
  mapFnName: 'getByIdTestSquate', //自定义方法名字(必选)
16
27
  isRule: false,
@@ -14,19 +14,32 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-test-api__body">
17
- <view>JfbBaseTestApi</view>
17
+ <view>
18
+ <xd-button @click="getUserStatus" type="primary">获取用户登陆状态</xd-button>
19
+ </view>
20
+ <view>
21
+ <xd-button @click="getCardStatus" type="primary">获取用户登陆卡状态</xd-button>
22
+ </view>
23
+ <view>
24
+ <xd-button @click="handleGetByIdCardDetail('101001000005193')" type="primary">获取登陆('101001000005193')</xd-button>
25
+ </view>
18
26
  </view>
19
27
  </view>
20
28
  </template>
21
29
 
22
30
  <script>
23
31
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
24
- import { jfbRootExec } from "@/utils/xd.event";
32
+ import XdButton from "@/components/XdButton/XdButton";
33
+ import {
34
+ jfbRootExec,
35
+ jfbRootFnExec
36
+ } from "@/utils/xd.event";
25
37
  import JfbBaseTestApiMixin from "./JfbBaseTestApiMixin";
26
38
  export default {
27
39
  name: "JfbBaseTestApi",
28
40
  components: {
29
- XdFontIcon
41
+ XdFontIcon,
42
+ XdButton
30
43
  },
31
44
  mixins: [
32
45
  JfbBaseTestApiMixin
@@ -39,23 +52,70 @@
39
52
  },
40
53
  created() {
41
54
 
42
- //todo
55
+ console.log('created.api', this.pageAttr.permission['can_card'])
43
56
  },
44
57
  methods: {
45
58
  onJfbLoad(options) {
46
- console.log('222')
47
- jfbRootExec('getListBindCard', {
59
+ //#ifdef H5
60
+ //参考地址: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html#0
61
+ jfbRootExec('getH5WxAuthorize', {
48
62
  vm: this,
49
63
  data: {
50
- ...options
64
+ jsApiList: [], //可以不传,不传走系统默认
65
+ url: window.location.href //可以不传
51
66
  },
52
67
  })
53
- .then(res=>{
54
- console.log(res)
68
+ .then(res => {
69
+ console.log('success', res)
70
+ })
71
+ .catch(error => {
72
+ console.error(error)
55
73
  })
56
- .catch()
74
+
75
+ // #endif
76
+
57
77
  },
58
-
78
+ getUserStatus(){
79
+ jfbRootFnExec(this, 'checkLoginAndCardLogin')(
80
+ true,
81
+ 'login',
82
+ false,//是否自动跳转到用户登陆页
83
+ )
84
+ .then(status=>{
85
+ console.log(status)
86
+ })
87
+ .catch(error=>{
88
+ console.log(error)
89
+ });
90
+ },
91
+ getCardStatus() {
92
+ jfbRootFnExec(this, 'checkLoginAndCardLogin')(
93
+ true || this.pageAttr.permission['can_card'], //是否免登陆
94
+ 'card', //检查卡类型
95
+ false,//是否自动跳转到卡登陆页
96
+ )
97
+ .then(status => {
98
+ this.$xdHideLoading();
99
+ console.log(status)
100
+ })
101
+ .catch(error => {
102
+ console.log(error)
103
+ });
104
+ },
105
+ handleGetByIdCardDetail(number){
106
+ jfbRootExec('getByIdCardDetail', {
107
+ vm: this,
108
+ data: {
109
+ card_number: number,
110
+ }
111
+ })
112
+ .then(res => {
113
+ console.log(res)
114
+ })
115
+ .catch(err => {
116
+ console.error(err)
117
+ })
118
+ }
59
119
  }
60
120
  }
61
121
 
@@ -67,7 +127,7 @@
67
127
  .jfb-base-test-api {
68
128
  &__body{
69
129
  & > view {
70
- height: unit(250, rpx);
130
+ margin: unit(20, rpx);
71
131
  }
72
132
  }
73
133
  }
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ getByIdTestSquate: {},
5
+ updateFilmPaiqiDate: {},
6
+ removeFilmAddress: {},
7
+ addFilmcart: {},
8
+ getByIdCardDetail: {
9
+ "card_number": "101001000005193",
10
+ "card_point": 100000000,
11
+ "card_type_name": "聚福宝福卡测试蛋糕",
12
+ "end_time": "2024-10-31 23:59:59",
13
+ "card_status": "Y",
14
+ "card_status_name": "开启",
15
+ "card_qrcode": "h.jufubao.HASDRcFaNi72jTf",
16
+ "card_qrcode_expire": 600,
17
+ "unit": "点",
18
+ "main_product_name": "",
19
+ "other_card_point": 0,
20
+ "is_exchange": "N",
21
+ "exchange_card_type_name": "福券",
22
+ "exchange_card_point": 90000000,
23
+ "request_id": "e73cd28f702858a7"
24
+ },
25
+ }
package/build.json.tpl DELETED
@@ -1,103 +0,0 @@
1
- {
2
- "apps": [
3
- {
4
- "app_id": "jufubao_base",
5
- "app_name": "聚福宝业务组件基础插件包",
6
- "app_version": "1.0.0",
7
- "parameters": {
8
- "key1": "value1",
9
- "key2": "value2"
10
- },
11
- "package_json": {
12
- "dependencies": { },
13
- "devDependencies": { }
14
- }
15
- },
16
- {
17
- "app_id": "jufubao_store",
18
- "app_name": "聚福宝商城业务组件包",
19
- "app_version": "1.0.0",
20
- "parameters": {
21
- "key1": "value1",
22
- "key2": "value2"
23
- },
24
- "package_json": {
25
- "dependencies": {},
26
- "devDependencies": {}
27
- }
28
- }
29
- ],
30
- "routers": [
31
- {
32
- "package": "body",
33
- "pages": [
34
- {
35
- "page_id": "00ebc41e-7db4-4253-b012-dadd752f788c",
36
- "page_name_en": "index",
37
- "page_name": "首页",
38
- "page": "body/index/index",
39
- "components":[
40
- {
41
- "id": "jufubao-01",
42
- "name": "JfbBaseNumber",
43
- "attrs": {
44
- "key1": "value1"
45
- }
46
- },
47
- {
48
- "id": "jufubao-02",
49
- "name": "JfbBaseNumber",
50
- "attrs": {
51
- "key2": "value2"
52
- }
53
- }
54
- ]
55
- },
56
- {
57
- "page_id": "00ebc41e-7db4-4253-b012-dadd752f7891",
58
- "page_name_en": "type",
59
- "page_name": "产品分类",
60
- "page": "body/type/type",
61
- "components": [
62
- {
63
- "id": "jufubao-01",
64
- "name": "JfbBaseNumber",
65
- "attrs": {
66
- "key1": "value1"
67
- }
68
- },
69
- {
70
- "id": "jufubao-02",
71
- "name": "JfbBaseNumber",
72
- "attrs": {
73
- "key2": "value2"
74
- }
75
- }
76
- ]
77
- },
78
- {
79
- "page_id": "00ebc41e-7db4-4253-b012-dadd752f7887",
80
- "page_name_en": "my",
81
- "page_name": "我的",
82
- "page": "body/my/my",
83
- "components": [
84
- {
85
- "id": "jufubao-01",
86
- "name": "JfbBaseNumber",
87
- "attrs": {
88
- "key1": "value1"
89
- }
90
- },
91
- {
92
- "id": "jufubao-02",
93
- "name": "JfbBaseNumber",
94
- "attrs": {
95
- "key2": "value2"
96
- }
97
- }
98
- ]
99
- }
100
- ]
101
- }
102
- ]
103
- }