jufubao-base 1.0.365 → 1.0.366-beta101

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.365",
3
+ "version": "1.0.366-beta101",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -17,48 +17,50 @@
17
17
  class="jfb-base-chose-company__body"
18
18
  :style="{ minHeight: layoutInfo.bodyMinHeightRpx + 'rpx' }"
19
19
  >
20
- <view :style="[contentPaddingCompStyle]">
21
- <view class="jfb-base-chose-company__body-title"
22
- >企业信息({{ companyList.length }}家)</view
23
- >
24
- <view class="jfb-base-chose-company__body-notice">{{ title }}</view>
25
- <view :style="{ '--main-color': mainColor }">
26
- <view
27
- v-for="(item, index) in companyList"
28
- :key="index"
29
- @click="handleChoseCompany(item)"
30
- :style="[listPaddingCompStyle]"
31
- :class="[
32
- 'jfb-base-chose-company__body-company',
33
- item.is_select ? 'active' : '',
34
- ]"
20
+ <template v-if="isLoading">
21
+ <view :style="[contentPaddingCompStyle]">
22
+ <view class="jfb-base-chose-company__body-title"
23
+ >企业信息({{ companyList.length }}家)</view
35
24
  >
25
+ <view class="jfb-base-chose-company__body-notice">{{ title }}</view>
26
+ <view :style="{ '--main-color': mainColor }">
36
27
  <view
37
- v-if="item.is_select"
38
- class="jfb-base-chose-company__body-company-active"
39
- :style="{
40
- background: mainColor,
41
- borderRadius: `0 ${listRadius}rpx 0 30rpx`,
42
- }"
28
+ v-for="(item, index) in companyList"
29
+ :key="index"
30
+ @click="handleChoseCompany(item)"
31
+ :style="[listPaddingCompStyle]"
32
+ :class="[
33
+ 'jfb-base-chose-company__body-company',
34
+ item.is_select ? 'active' : '',
35
+ ]"
43
36
  >
44
- <XdFontIcon
45
- size="20"
46
- icon="iconduigou-xian"
47
- color="#fff"
48
- ></XdFontIcon>
49
- </view>
50
- {{ item.company_name }}
51
- </view></view
52
- >
53
- </view>
54
- <view :style="[addCoMpStyle]" class="jfb-base-chose-company__body-add"
55
- >{{ addTitle
56
- }}<view v-if="addCompanyPath" @click="handleToAdd" :style="{color:mainColor}"
57
- >去添加<XdFontIcon
58
- size="28"
59
- icon="iconxiangyou_xian"
60
- ></XdFontIcon></view
61
- ></view>
37
+ <view
38
+ v-if="item.is_select"
39
+ class="jfb-base-chose-company__body-company-active"
40
+ :style="{
41
+ background: mainColor,
42
+ borderRadius: `0 ${listRadius}rpx 0 30rpx`,
43
+ }"
44
+ >
45
+ <XdFontIcon
46
+ size="20"
47
+ icon="iconduigou-xian"
48
+ color="#fff"
49
+ ></XdFontIcon>
50
+ </view>
51
+ {{ item.company_name }}
52
+ </view></view
53
+ >
54
+ </view>
55
+ <view :style="[addCoMpStyle]" class="jfb-base-chose-company__body-add"
56
+ >{{ addTitle
57
+ }}<view v-if="addCompanyPath" @click="handleToAdd" :style="{color:mainColor}"
58
+ >去添加<XdFontIcon
59
+ size="28"
60
+ icon="iconxiangyou_xian"
61
+ ></XdFontIcon></view
62
+ ></view>
63
+ </template>
62
64
  </view>
63
65
  </view>
64
66
  </template>
@@ -93,6 +95,8 @@ export default {
93
95
  addCompanyPath: "",
94
96
  companyList: [],
95
97
  redirect_url: "",
98
+
99
+ isLoading: false,//页面加载完成
96
100
  };
97
101
  },
98
102
  watch: {
@@ -127,25 +131,12 @@ export default {
127
131
  },
128
132
  created() {
129
133
  this.init(this.container);
130
-
131
- //todo
132
134
  },
133
135
  methods: {
134
136
  onJfbLoad(options) {
135
137
  if (options.redirect_url) {
136
138
  this.redirect_url = Base64.decode(options.redirect_url);
137
139
  }
138
- jfbRootExec("getChoseCompanyList", {
139
- vm: this,
140
- data: {},
141
- }).then((res) => {
142
- console.log(res, "resgetChoseCompanyList");
143
- //如果只有一个企业,直接选择该企业
144
- if(res.list.length === 1) {
145
- this.handleChoseCompany(res.list[0]);
146
- }
147
- this.companyList = res.list;
148
- });
149
140
 
150
141
  //判断应用是否开启了强制选择企业功能
151
142
  let isCustomer = false;
@@ -155,7 +146,6 @@ export default {
155
146
 
156
147
  //预览模式不显示强制选择企业功能提示
157
148
  if (this.$configProject['isPreview']) isCustomer = true;
158
-
159
149
  if(!isCustomer) {
160
150
  this.$xdAlert({
161
151
  title:'配置错误',
@@ -164,7 +154,26 @@ export default {
164
154
  contentColor: '#333',
165
155
  background: '#fff',
166
156
  });
157
+ return
167
158
  }
159
+
160
+ jfbRootExec("getChoseCompanyList", {
161
+ vm: this,
162
+ data: {},
163
+ }).then((res) => {
164
+ //如果只有一个企业,直接选择该企业(非预览模式)
165
+ if(res.list.length === 1) {
166
+ if(!this.$configProject["isPreview"]){
167
+ this.handleChoseCompany(res.list[0]);
168
+ return
169
+ }
170
+ }
171
+
172
+ //多个企业或者预览模式时候处理
173
+ this.isLoading = true;
174
+ this.companyList = res.list;
175
+ });
176
+
168
177
  },
169
178
  /**
170
179
  * @description 监听事件变化
@@ -267,8 +276,9 @@ export default {
267
276
  },
268
277
  handleChoseCompany(item) {
269
278
  if(this.$configProject["isPreview"]){
270
- return;
279
+ return;
271
280
  }
281
+
272
282
  jfbRootExec("switchChoseCompany", {
273
283
  vm: this,
274
284
  data: {
@@ -277,7 +287,6 @@ export default {
277
287
  company_source_from: item.company_source_from,
278
288
  },
279
289
  }).then((res) => {
280
-
281
290
  //#ifdef MP-WEIXIN
282
291
  if (this.jfbAuthorize !== null) {
283
292
  this.jfbAuthorize.setAllToken(res);//只返回用户登陆信息,无卡登陆信息
@@ -290,10 +299,12 @@ export default {
290
299
  real_index_url = jsonData['app']['frontPath'];
291
300
  } catch (error) {
292
301
  real_index_url = item.index_url;
293
- }
302
+ }
294
303
  this.$xdUniHelper.redirectTo({
295
304
  url: this.redirect_url || real_index_url || this.settings.index,
296
305
  });
306
+ }).catch(err=>{
307
+ console.error(err);
297
308
  });
298
309
  },
299
310
  handleToAdd() {
@@ -301,27 +312,6 @@ export default {
301
312
  url: this.addCompanyPath,
302
313
  });
303
314
  },
304
- onJfbScroll(options) {
305
- console.log("event.onJfbScroll", options);
306
- },
307
- onJfbReachBottom(options) {
308
- console.log("event.onJfbReachBottom", options);
309
- },
310
- onJfbShow(options) {
311
- console.log("event.onJfbShow", options);
312
- },
313
- onJfbHide(options) {
314
- console.log("event.onJfbHide", options);
315
- },
316
- onJfbBack(options) {
317
- console.log("event.onJfbBack", options);
318
- },
319
- onJfbUpdate(...data) {
320
- console.log("event.onJfbUpdate", data);
321
- },
322
- onJfbCustomEvent(options) {
323
- console.log("event.onJfbReachBottom", options);
324
- },
325
315
  },
326
316
  };
327
317
  </script>