jufubao-base 1.0.169-beta7 → 1.0.169-beta9

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.169-beta7",
3
+ "version": "1.0.169-beta9",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -1071,7 +1071,7 @@ export default {
1071
1071
  this.is_border_w = getContainerPropsValue(container, "content.is_border_w", 2);
1072
1072
  this.viewStatus = getContainerPropsValue(container, "content.viewStatus", "mall");
1073
1073
  this.is_show_support_shop = getContainerPropsValue(container, "content.is_show_support_shop", "N");
1074
- this.is_show_delete_order = 'Y'//getContainerPropsValue(container, "content.is_show_delete_order", "N");
1074
+ this.is_show_delete_order = getContainerPropsValue(container, "content.is_show_delete_order", "N");
1075
1075
  },
1076
1076
  getCountDown() {
1077
1077
  this.timer = setInterval(() => {
@@ -1189,7 +1189,9 @@ export default {
1189
1189
  else if(item.action === 'delete'){
1190
1190
  this.$xdConfirm({
1191
1191
  styles: this.styles,
1192
- content: "是否要删除当前订单吗?",
1192
+ content: "订单删除后将无法找到订单<br/>您确认删除吗?",
1193
+ cancelText:'我在看看',
1194
+ isHtml: true,
1193
1195
  zIndex: 3000,
1194
1196
  success: (action) => {
1195
1197
  if (action.confirm) {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="prodcut" :class="{tow: cell === 2, one: cell === 1}">
2
+ <view class="prodcut" :class="{tow: cell === 2, one: cell === 1}" @click="handleDetail()">
3
3
  <view
4
4
  class="prodcut-image"
5
5
  :style="{
@@ -20,6 +20,7 @@
20
20
  v-if="$parentVm.productConfig !== null && type_code === 'product'"
21
21
  :product-config="$parentVm.productConfig"
22
22
  :out-spacing="$parentVm.outSpacing"
23
+ :height="outItemProduct"
23
24
  ></skeleton-product>
24
25
  <skeleton-shop v-if="type_code === 'shop'" :out-spacing="$parentVm.outSpacing"></skeleton-shop>
25
26
  <skeleton-film v-if="type_code === 'film'" :out-spacing="$parentVm.outSpacing"></skeleton-film>
@@ -85,6 +86,7 @@
85
86
  :product-config="$parentVm.productConfig"
86
87
  :out-spacing="$parentVm.outSpacing"
87
88
  :item="item"
89
+ :height="outItemProduct"
88
90
  :color="$parentVm.mainColor"
89
91
  :border-radius="$parentVm.imgRradius"
90
92
  :cell="type_other"
@@ -219,6 +221,7 @@ export default {
219
221
  $parentVm:null,
220
222
  parentStatus: false,
221
223
  skeletonCount: 6,
224
+ hasNoData: false,
222
225
 
223
226
  page_token:'1',
224
227
  page_size: 20,
@@ -321,10 +324,25 @@ export default {
321
324
 
322
325
 
323
326
  getList(){
324
- this.$xdShowLoading({});
327
+ //无关键字不搜索
328
+ if(this.keyword === '') {
329
+ return;
330
+ }
331
+ //this.$xdShowLoading({});
325
332
  this.$emit('on-list', {
326
333
  params:this.getParams,
327
334
  cb:(res)=>{
335
+
336
+ //无数据处理
337
+ if(res === null){
338
+ this.hasNoData = true;
339
+ this.dataList = [];
340
+ this.page_token = ''
341
+ this.$xdHideLoading();
342
+ return
343
+ }
344
+
345
+ //正常数据处理
328
346
  this.dataConfig = res;
329
347
 
330
348
  //整理为统一ID
@@ -351,6 +369,7 @@ export default {
351
369
  }
352
370
  this.dataList = (this.dataList||[]).concat(res.items);
353
371
  this.page_token = res.next_page_token
372
+ this.hasNoData = false;
354
373
  this.$xdHideLoading();
355
374
  }
356
375
  })
@@ -35,7 +35,7 @@
35
35
  </view>
36
36
 
37
37
  <view class="tfk-search" :style="{padding: outSpacing + 'rpx'}">
38
- <all-list v-if="!tabId"
38
+ <all-list v-if="tabId === 'all'"
39
39
  @on-parent-vm="handleParentVm"
40
40
  @on-list="handleList"
41
41
  ></all-list>
@@ -77,8 +77,8 @@
77
77
  data() {
78
78
  return {
79
79
  hideMask: true,
80
- tabId: '10@cinema@Y@1', //cinema/film/shop/product
81
- keyword: '',
80
+ tabId: '1@product@Y@2', //cinema/film/shop/product
81
+ keyword: '',
82
82
  options:{},
83
83
  menuList: [],
84
84
  //公共样式
@@ -97,7 +97,7 @@
97
97
  },
98
98
  computed: {
99
99
  showMenuList(){
100
- return [{label: "全部", value: ""}, ...this.menuList]
100
+ return [{label: "全部", value: "all"}, ...this.menuList]
101
101
  },
102
102
  menuWrapBoxStyle(){
103
103
  let padding = `${this.checkValue(this.menuMargin.top, 20)}rpx`;
@@ -171,26 +171,34 @@
171
171
  * @param cb {Function}
172
172
  */
173
173
  handleList({params, cb}){
174
+
175
+
174
176
  let data = {...params};
175
- if(this.tabId === ''){
176
- data['search_range'] = this.menuList.map(item => item.value).join(',');
177
+
178
+ if(this.tabId === 'all'){
179
+ data['search_range'] = this.menuList.map(item => {
180
+ return item.value.split('@')[0]
181
+ }).join(',');
177
182
  }
178
183
 
179
184
  jfbRootExec("getTfkSearchList", {
180
185
  vm: this,
181
186
  data: data
182
187
  }).then(res => {
183
- if(this.tabId === ''){
188
+ if(this.tabId === 'all'){
184
189
  cb(res.list)
185
190
  }else{
186
- cb(res.list[0])
191
+ let list = null
192
+ if(res.list.length > 0){
193
+ list = res.list[0];
194
+ }
195
+ cb(list)
187
196
  }
188
197
  })
189
198
  },
190
199
 
191
200
  onJfbLoad(options) {
192
201
  this.options = options;
193
-
194
202
  },
195
203
  /**
196
204
  * @description 监听事件变化
@@ -206,10 +214,7 @@
206
214
  this.menuBorderWidth = getContainerPropsValue(container, 'content.menuBorderWidth', 1);
207
215
  this.menuItemMargin = getContainerPropsValue(container, 'content.menuItemMargin', 40);
208
216
  this.searchScope = getContainerPropsValue(container, 'content.searchScope', []);
209
-
210
- if(this.$configProject['isPreview']){
211
- this.menuList = this.searchScope;
212
- }
217
+ this.menuList = this.searchScope;
213
218
  },
214
219
  handleSwitchMenu(item){
215
220
  this.tabId = item.value;
@@ -25,6 +25,28 @@
25
25
  </view>
26
26
  </template>
27
27
  <template v-if="cell===2">
28
+ <view class="image2 skeleton-item" :style="{marginBottom:outSpacing + 'rpx', height: height + 'rpx'}"></view>
29
+ <view class="content2">
30
+ <view class="top">
31
+ <view class="title skeleton-item"></view>
32
+ <view class="brand skeleton-item" v-if="productConfig.is_show_brand==='Y'"></view>
33
+ <view class="tags">
34
+ <view class="skeleton-item" v-if="productConfig.showActivityPrice==='Y'"></view>
35
+ <template v-if="productConfig.isShowTag==='Y'">
36
+ <view class="skeleton-item"></view>
37
+ <view class="skeleton-item"></view>
38
+ <view class="skeleton-item"></view>
39
+ </template>
40
+ </view>
41
+ </view>
42
+ <view class="bottom">
43
+ <view class="price skeleton-item" v-if="productConfig.isPrice==='Y'"></view>
44
+ <view class="orgPrice skeleton-item" v-if="productConfig.isPrice==='Y' && productConfig.isShowDiscount === 'Y'"></view>
45
+ <view class="cart">
46
+ <view class="skeleton-item" v-if="productConfig.isAddCart === 'Y'"></view>
47
+ </view>
48
+ </view>
49
+ </view>
28
50
  </template>
29
51
  </view>
30
52
  </template>
@@ -41,6 +63,10 @@ export default {
41
63
  type: Number|String,
42
64
  required: true
43
65
  },
66
+ height:{
67
+ type: Number|String,
68
+ default:''
69
+ },
44
70
  productConfig:{
45
71
  type:Object|null,
46
72
  default: null
@@ -65,6 +91,7 @@ export default {
65
91
  .skeleton-item(200rpx, 200rpx);
66
92
  }
67
93
 
94
+
68
95
  & .content {
69
96
  flex: 1;
70
97
  min-height: 200rpx;
@@ -133,5 +160,87 @@ export default {
133
160
  }
134
161
  }
135
162
 
163
+ & .image2 {
164
+ .skeleton-item();
165
+ }
166
+
167
+ & .content2 {
168
+ flex: 1;
169
+
170
+ .top {
171
+ min-height: 140rpx;
172
+
173
+ & .title {
174
+ .skeleton-item(100%, 60rpx);
175
+
176
+ }
177
+
178
+ & .brand {
179
+ margin-top: 10rpx;
180
+ .skeleton-item(70%, 25rpx);
181
+ }
182
+
183
+ .tags {
184
+ display: flex;
185
+ justify-content: flex-start;
186
+ align-items: center;
187
+ flex-flow: wrap;
188
+ margin-top: 10rpx;
189
+
190
+
191
+ & > view {
192
+ .skeleton-item(80rpx, 30rpx);
193
+ margin-right: 10rpx;
194
+
195
+ &:first-child {
196
+ margin-right: 0;
197
+ width: 120rpx;
198
+ }
199
+
200
+ &:nth-child(4) {
201
+ margin-top: 10rpx;
202
+ }
203
+ &:nth-child(5) {
204
+ margin-top: 10rpx;
205
+ }
206
+ &:nth-child(6) {
207
+ margin-top: 10rpx;
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ .bottom {
214
+ display: flex;
215
+ justify-content: flex-end;
216
+ align-content: center;
217
+ align-items: center;
218
+ width: 100%;
219
+ height: 40rpx;
220
+ margin-top: 20rpx;
221
+
222
+ & .price {
223
+ flex-shrink: 0;
224
+ .skeleton-item(100rpx, 35rpx);
225
+ }
226
+
227
+ & .orgPrice {
228
+ flex-shrink: 0;
229
+ margin-left: 20rpx;
230
+ .skeleton-item(100rpx, 20rpx);
231
+ }
232
+
233
+ & .cart {
234
+ flex: 1;
235
+ display: flex;
236
+ justify-content: flex-end;
237
+ align-items: center;
238
+ & > view {
239
+ .skeleton-item(40rpx, 40rpx);
240
+ }
241
+ }
242
+ }
243
+ }
244
+
136
245
  }
137
246
  </style>
@@ -139,6 +139,10 @@ export default {
139
139
 
140
140
  //商品链接事件
141
141
  handleProductDetail(item, product){
142
+ let url = this.checkUrlIsValid(product.detail_redirect_data)
143
+ if(product.detail_redirect_data) {
144
+
145
+ }
142
146
  debugger
143
147
  }
144
148
  //商品链接事件
@@ -6,12 +6,12 @@ import getServiceUrl from "@/common/getServiceUrl";
6
6
  export default {
7
7
  data() {
8
8
  return {
9
-
9
+ colorObj : {},
10
10
  }
11
11
  },
12
12
 
13
13
  created(){
14
-
14
+ this.colorObj = this.$colorConfig || getApp().globalData.$colorConfig;
15
15
  },
16
16
 
17
17
  methods: {
@@ -23,14 +23,14 @@ export default {
23
23
  }
24
24
  return result;
25
25
  },
26
- getCardThemes(name) {
27
- let colorLen = this.cardThemesColor.length;
28
- let imgLen = this.cardThemesImage.length;
26
+ getCardThemes(name , disabled='N') {
27
+ let colorLen = this.colorObj.cardThemesColor.length;
28
+ let imgLen = this.colorObj.cardThemesImage.length;
29
29
  let colorIndex = this.stringToNumber(name) % colorLen;
30
30
  let imgIndex = this.stringToNumber(name) % imgLen;
31
31
  return {
32
- color: this.cardThemesColor[colorIndex],
33
- image: this.cardThemesImage[imgIndex],
32
+ color: disabled === 'N' ? this.colorObj.cardThemesColor[colorIndex]: this.getDisabledColor(),
33
+ image: this.colorObj.cardThemesImage[imgIndex],
34
34
  }
35
35
  },
36
36
  getEntry(codes = [], allEntry = []) {
@@ -48,13 +48,75 @@ export default {
48
48
  });
49
49
  return support
50
50
  },
51
- getCardGroupItem(list, allEntry) {
51
+
52
+ filterNotSupportEntry(allEntry){
53
+ let isH5FilterEntryList = [];
54
+ let isMpFilterEntryList = [];
55
+ allEntry = allEntry.map(item=>{
56
+ try {
57
+ if(!item.redirect_data) item.redirect_data = null;
58
+ else {
59
+ item.redirect_data = JSON.parse(item.redirect_data);
60
+ item.redirect_data.appType = item.redirect_data.appType || 'h5';
61
+ }
62
+ }catch (e){
63
+ item.redirect_data = null
64
+ }
65
+ return item;
66
+ })
67
+ .filter(item=>{
68
+ //地址不存在
69
+ if(!item.redirect_data) return false
70
+
71
+ //#ifdef H5
72
+ //在H5平台应用中不可跳转到微信小程序应用
73
+ if(item.redirect_data.appType === 'wxmp'){
74
+ isH5FilterEntryList.push(item)
75
+ }
76
+ return item.redirect_data.appType !== 'wxmp';
77
+ //#endif
78
+
79
+ //#ifdef MP-WEIXIN
80
+ const dir = item['redirect_data'].dir;
81
+ const actDir = this.projectAttr['deploy_dir'];
82
+ if(item.redirect_data.appType === 'wxmp') {
83
+ if(dir !== actDir) isMpFilterEntryList.push(item)
84
+ return dir === actDir;
85
+ }
86
+ return true
87
+ //#endif
88
+
89
+ });
90
+
91
+ //#ifdef MP-WEIXIN
92
+ console.warn(`微信小程序端被过滤的入口列表:${JSON.stringify(isMpFilterEntryList.map(item=> `${item.redirect_data.appType}:${item.entry_name}:${item.redirect_data['frontPath']}`),null,2)}`)
93
+ //#endif
94
+ //#ifdef H5
95
+ console.warn(`H5端被过滤的入口列表:${JSON.stringify(isH5FilterEntryList.map(item=> `${item.redirect_data.appType}:${item.entry_name}:${item.redirect_data['frontPath']}`),null,2)}`)
96
+ //#endif
97
+ console.warn(`福利入口链接列表:${JSON.stringify(allEntry.map(item=> `${item.redirect_data.appType}:${item.redirect_data.appType === 'h5'?(item.redirect_data['site_url'] || item.redirect_data['path']) :item.redirect_data['path']}`),null,2)}`);
98
+
99
+ return allEntry
100
+ },
101
+
102
+ getCardGroupItem(list, allEntry, disabled='N') {
52
103
  list.map(item => {
53
104
  //设置卡片样式
54
- item['theme'] = this.getCardThemes(item['card_type_name']);
105
+ item['theme'] = this.getCardThemes(item['card_type_name'], disabled);
55
106
  item['entries'] = this.getEntry(item['business_codes'], allEntry)
56
107
  });
57
108
  return list
58
109
  },
110
+
111
+ getDisabledColor(){
112
+ return this.colorObj.disableColor
113
+ },
114
+ getMergBg(disabled = 'Y'){
115
+ return disabled === 'Y' ? this.colorObj['mergIcon'][1]
116
+ : this.colorObj['mergIcon'][0]
117
+ },
118
+ getNoData(){
119
+ return this.colorObj.nodata
120
+ }
59
121
  }
60
122
  }
@@ -1,6 +1,10 @@
1
1
  'use strict';
2
2
 
3
- import {getContainerFnPropsValue, getContainerPropsValue} from "@/utils/xd.base";
3
+ import {getContainerFnPropsValue, getContainerPropsValue,isWechat} from "@/utils/xd.base";
4
+ import {Base64} from 'js-base64';
5
+ import {mapActions,mapState, mapMutations} from "vuex";
6
+ import helper from "@/utils/helper";
7
+ import store from "@/store/index";
4
8
 
5
9
  export default {
6
10
  props: {
@@ -109,11 +113,55 @@ export default {
109
113
  subMainColor: '',
110
114
  infoColor: '',
111
115
  defaultColor: '',
112
- dangerColor: ''
116
+ dangerColor: '',
117
+ mainGradient: '',
118
+ subGradient: '',
119
+
120
+ //test
121
+ posterTest:{
122
+ "content_id": "KpBbUKdj4aBejwe7Fh1ki",
123
+ "position_id": "QCk3PmoyQmOWRP1SxnYR3",
124
+ "partner_id": 0,
125
+ "site_id": "",
126
+ "content_name": "测试.",
127
+ "image_url": "//dummyimage.com/200x200",
128
+ "redirect_type": "EMP",
129
+ "redirect_type_name": "无链接",
130
+ "redirect_data": "",
131
+ "sort": "",
132
+ "status": "",
133
+ "start_time": "",
134
+ "end_time": "",
135
+ "op_user_id": "",
136
+ "created_time": 0,
137
+ "updated_time": 0
138
+ }
139
+ }
140
+ },
141
+
142
+ destroyed() {
143
+ console.warn('componentsMixins.destroyed.my(timeer|timer)');
144
+ if (this.timeer && typeof this.timeer === "number") {
145
+ clearTimeout(this.timeer);
146
+ console.warn('componentsMixins.destroyed.my.timeer');
147
+ }
148
+ if (this.timer && typeof this.timer === "number") {
149
+ clearTimeout(this.timer);
150
+ console.warn('componentsMixins.destroyed.my.timer');
113
151
  }
152
+
153
+ //卸载页面
154
+ if(typeof this.onJfbUnload === "function") {
155
+ console.warn('componentsMixins.destroyed.exec.onJfbUnload');
156
+ this.onJfbUnload()
157
+ }
158
+
114
159
  },
160
+
115
161
  created(){
116
- console.warn(`init.components._uid:${this._uid},vnode.name=${this.$vnode.tag}`);
162
+ let tag = '';
163
+ if (this.$vnode && this.$vnode.tag) tag = this.$vnode.tag;
164
+ this.$xdLog.setProject('App.components.start', `App.components.vnode.name.${tag}`);
117
165
 
118
166
  //设置插件cid
119
167
  if (this.cid) {
@@ -122,9 +170,14 @@ export default {
122
170
  this.containerId = this.$xdUniHelper.randomChar(20);
123
171
  }
124
172
 
173
+ //保存到vuex
174
+ console.log('setStyleCommon',this)
175
+ this.setStyleCommon(this.styles);
176
+
125
177
  //初始化风格
126
178
  this.initThemesToData();
127
179
 
180
+
128
181
  //#ifdef H5
129
182
  //监听用户点击状态显示虚框
130
183
  XdBus.addEvent('select', ({containerId}) => {
@@ -152,35 +205,120 @@ export default {
152
205
 
153
206
  //#ifdef H5
154
207
  mounted() {
155
- if (this.$configProject.isPreview) {
156
- let that = this;
157
- function handle() {
158
- let className = `${that.cssRoot}__body-mask`;
159
- if (document.getElementsByClassName(className).length === 0) {
160
- let elx = document.getElementsByClassName(`${that.cssRoot}__body`);
208
+ let that = this;
209
+ this.autoHideMask();
210
+ if (this.$configProject.isPreview && this.selfMask !== true ) {
211
+ this.$nextTick(()=>{
212
+ function handle() {
213
+ let elx = that.$el.getElementsByClassName(`${that.cssRoot}__body`);
161
214
  if (elx.length === 0) {
162
215
  setTimeout(() => {
163
216
  handle()
164
- }, 100)
217
+ }, 50)
165
218
  } else {
166
- const mask = document.createElement("div");
167
- mask.className = 'jfb-mask';
168
- mask.style.position = 'absolute';
169
- mask.style.left = '0px';
170
- mask.style.right = '0px';
171
- mask.style.top = '0px';
172
- mask.style.bottom = '0px';
173
- mask.style.zIndex = 9999;
174
- elx.item(0).appendChild(mask);
219
+ let len = elx.length;
220
+ for (let i = 0; i < len; i++) {
221
+ if (!elx.item(i).classList.contains('isGPreview')) {
222
+ elx.item(i).classList.add("isGPreview");
223
+ }
224
+ }
175
225
  }
176
226
  }
177
- }
178
- handle()
227
+ handle();
228
+ });
229
+ }
230
+
231
+ //模式不显示虚线
232
+ if(this.$configProject.type === 'test'
233
+ && this.$configProject.NODE_ENV === 'development'
234
+ && this.$configProject.viewType === 'pack'
235
+ ){
236
+ this.isEditx = false;
179
237
  }
238
+
180
239
  },
181
240
  // #endif
182
241
 
242
+ computed:{
243
+ ...mapState({
244
+ pageNamespace: state=> state.pageBusinessCode,
245
+ })
246
+ },
247
+
248
+ watch:{
249
+ active(val){
250
+ if(this.$configProject.isPreview && val) this.autoHideMask();
251
+ },
252
+ },
253
+
183
254
  methods:{
255
+ ...mapActions(['setXNamespace','setStyleCommon']),
256
+ ...mapMutations(['setCurrentStyle']),
257
+
258
+ /**
259
+ * @description 自动生成调试模式
260
+ */
261
+ autoHideMask(){
262
+ if(this.$configProject.isPreview && this.hideMask === true){
263
+ this.$nextTick(()=>{
264
+ let className = this.$el.classList;
265
+ if(!className.contains('gHideMask')) {
266
+ className.add("gHideMask")
267
+ }
268
+ })
269
+ }
270
+ },
271
+
272
+ /**
273
+ * @description 检查是否同域名
274
+ * @param url
275
+ * @param dir {String} 部署目录
276
+ * @returns {*}
277
+ */
278
+ //#ifdef H5
279
+ getSameSiteAndDomain(url, dir) {
280
+ let regDir = new RegExp(`^/${dir}/\.*$`);
281
+ let host = window.location.host;
282
+ let pages = this.$xdUniHelper.parseURL(url);
283
+
284
+ //域名相同并且部署目录相同
285
+ if (host === pages.host && regDir.test(pages.path)) {
286
+ return pages.relative;
287
+ }
288
+ return url;
289
+ },
290
+ // #endif
291
+
292
+ setNameSpace(options){
293
+ this.xnamespace = this.xnamespace || this.pageNamespace;
294
+ if(!this.xnamespace && !this.$configProject.isPreview){
295
+ this.$xdAlert({content: '未设置业务编码',type:'error'});
296
+ throw new Error('请配置业务编码')
297
+ }
298
+ this.setXNamespace(this.xnamespace)
299
+ },
300
+
301
+ /**
302
+ * @description 自动计算列数的宽和间距 (父节点需要设置110%)不兼容微信小程序(废弃)
303
+ * @param index {number} 当前索引值
304
+ * @param cell {number} 当前索引值
305
+ * @param jfbSpacing {number}
306
+ * @returns {{marginRight: string, overflow: string, width: string, marginTop: string}}
307
+ */
308
+ itemStyle(index, cell, jfbSpacing ) {
309
+ if(this.$xdUniHelper.checkVarType(jfbSpacing) === 'string') jfbSpacing = Number(jfbSpacing);
310
+ let maxW = 100 / cell;
311
+ let padding = Math.floor(this.$rpxNum * jfbSpacing + this.$rpxNum * (jfbSpacing / cell))
312
+ return {
313
+ marginTop: jfbSpacing + 'rpx',
314
+ marginRight: (index + 1) % cell === 0 ? '0' : jfbSpacing + 'rpx',
315
+ width: `calc(${maxW}vw - ${padding}px)`,
316
+ overflow: 'hidden'
317
+ };
318
+ },
319
+
320
+
321
+
184
322
  /**
185
323
  * @description 获取吸顶样式
186
324
  * @param options {Object} 样式参数
@@ -192,15 +330,23 @@ export default {
192
330
  * @param options.height 距离底部距离(paddingBottom和height选其一即可)
193
331
  * @param options.zIndex
194
332
  * @param type {String} 吸顶类型 其值:bottom/top
333
+ * @param fixed {Boolean} 是否吸顶或者占位
195
334
  * @return {String}
196
335
  */
197
- fixedStyle(options = {}, type = 'bottom') {
336
+ fixedStyle(options = {}, type = 'bottom', fixed = true) {
198
337
  let paddingBottom = options.paddingBottom || options.height || 0;
199
338
  if (options.paddingBottom) delete options.paddingBottom;
200
339
  if (options.height) delete options.height;
201
340
  let obj = Object.assign({}, {
202
341
  top: 0, left: 0, right: 0, bottom: 0, zIndex: 100,
203
342
  }, options);
343
+ if (!fixed) {
344
+ let padding = (this.layoutInfo.bottomHeight + this.layoutInfo.footerHeight + paddingBottom) * this.$rpxNum;
345
+ let sy = `padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
346
+ sy = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
347
+ return sy;
348
+ }
349
+
204
350
  let style = 'position: fixed';
205
351
  style = `${style};left:${obj.left}rpx`;
206
352
  style = `${style};right:${obj.right}rpx`;
@@ -217,6 +363,7 @@ export default {
217
363
  return style;
218
364
  },
219
365
 
366
+
220
367
  /**
221
368
  * 检查插件是否加载成功
222
369
  */
@@ -226,10 +373,15 @@ export default {
226
373
  * @description 业务组件风格map到data中
227
374
  */
228
375
  initThemesToData() {
376
+ let current = {};
229
377
  Object.keys(this.styles).map(key => {
230
378
  let k = key.replace('$', '');
231
- if (this[k] !== undefined) this[k] = this.styles[key];
379
+ if (this[k] !== undefined){
380
+ this[k] = this.styles[key];
381
+ current[k] = this.styles[key];
382
+ }
232
383
  });
384
+ this.setCurrentStyle(helper.cloneDeep(current))
233
385
  },
234
386
 
235
387
  /**
@@ -245,6 +397,7 @@ export default {
245
397
  * @description 点击删除操作按钮
246
398
  */
247
399
  delEdit() {
400
+ if(this.isReferenceTemplate) return;
248
401
  XdBus.send('onDelPackage', {
249
402
  containerId: this.containerId,
250
403
  componentAtrr: this.componentAtrr,
@@ -300,6 +453,176 @@ export default {
300
453
  })
301
454
  //#endif
302
455
  },
456
+
457
+ checkValue(value, dValue = 0){
458
+ if(value === undefined || value === '' || value === null) return dValue;
459
+ return Number(value || 0);
460
+ },
461
+
462
+ getXdShadow(defaultObj, newObj){
463
+ if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0 0 0 rgba(0,0,0,0)`;
464
+ let width = defaultObj.width;
465
+ let color = defaultObj.color;
466
+ if(newObj.value !== null) {
467
+ if(newObj.value.width) width = newObj.value.width;
468
+ if(newObj.value.color) color = newObj.value.color
469
+ }
470
+ return `0 0 ${width}rpx ${color}`;
471
+ },
472
+
473
+ getXdBorder(defaultObj, newObj){
474
+ if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0`
475
+ let width = defaultObj.width;
476
+ let color = defaultObj.color;
477
+ if(newObj.value !== null) {
478
+ if(newObj.value.width) width = newObj.value.width
479
+ if(newObj.value.color) color = newObj.value.color
480
+ }
481
+ return `${width}rpx solid ${color}`;
482
+ },
483
+
484
+ getUrlCallback(path){
485
+ if(this.inCallbackUrlOrg) {
486
+ if(path.indexOf('?') === -1) path = `${path}?inCallback=${this.inCallbackUrlOrg}`;
487
+ else path = `${path}&inCallback=${this.inCallbackUrlOrg}`;
488
+ }
489
+ return path
490
+ },
491
+
492
+ baiduTogcj(bd_lng, bd_lat) {//坐标第转换
493
+ const x_PI = 3.14159265358979324 * 3000.0 / 180.0;
494
+ const x = bd_lng - 0.0065;
495
+ const y = bd_lat - 0.006;
496
+ const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
497
+ const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
498
+ const gg_lng = z * Math.cos(theta);
499
+ const gg_lat = z * Math.sin(theta);
500
+ return [gg_lng, gg_lat]
501
+ },
502
+
503
+
504
+ //#ifdef H5
505
+ webChatEnvOpenLocation({latitude,longitude,name, address}, cb){
506
+ store.dispatch('getH5WxAuthorize',{jsApiList: ['openLocation', 'getLocation']})
507
+ .then(({jwxSDK})=>{
508
+ let zb = this.baiduTogcj(latitude, longitude)
509
+ jwxSDK.openLocation({
510
+ latitude: zb[0],
511
+ longitude:zb[1],
512
+ name: name || '我的位置',
513
+ address: address||'',
514
+ scale: 15,
515
+ infoUrl: ''
516
+ });
517
+ })
518
+ .catch(err=>{
519
+ console.error(err)
520
+ this.$xdAlert({
521
+ content:'暂时不支持唤起APP导航功能',
522
+ time:5000,
523
+ })
524
+ })
525
+ },
526
+ //#endif
527
+
528
+ handleOpenLocation({latitude,longitude, name, address}, cb){
529
+ //latitude = latitude||39.961521814959795;
530
+ //longitude = longitude || 116.84499635227222
531
+
532
+ if(typeof latitude === 'string') latitude = Number(latitude);
533
+ if(typeof longitude === 'string') longitude = Number(longitude);
534
+
535
+ //#ifdef MP-WEIXIN
536
+ let zb = this.baiduTogcj(latitude, longitude);
537
+ uni.openLocation({
538
+ latitude: zb[0],
539
+ longitude: zb[1],
540
+ name: name || '我的位置',
541
+ scale: 15,
542
+ address: address ||'',
543
+ success: function () {
544
+ if(typeof cb === 'function') {
545
+ cb();
546
+ }
547
+ console.log('success');
548
+ }
549
+ });
550
+ //#endif
551
+ //#ifdef H5
552
+ if(isWechat()) this.webChatEnvOpenLocation({latitude,longitude, name, address}, cb);
553
+ else {
554
+ let params = '';
555
+ params = `${params}&location=${latitude},${longitude}`;
556
+ params = `${params}&title=${encodeURIComponent(name)}`;
557
+ params = `${params}&content=${encodeURIComponent(address)}&output=html&zoom=15`;
558
+ window.location.href = `http://api.map.baidu.com/marker?${params}`;
559
+ }
560
+ //#endif
561
+ },
562
+
563
+ getUrlHasSpStr(pathDir){
564
+ if(pathDir.indexOf('@site_domain@/') === 0) {
565
+ return pathDir.replace('@site_domain@/','').split('/')[0]
566
+ }
567
+ return ''
568
+ },
569
+
570
+ /**
571
+ * @description 过滤不可以用
572
+ * 当前项目未H5时,过滤所有小程序应用
573
+ * 当前项目未小程序时,过滤所有非当前小程序应用
574
+ * 站外地址直接返回
575
+ * 站内地址未选值直接返回
576
+ * 预览模式全过
577
+ * @param url {object}
578
+ */
579
+ checkUrlIsValid(url){
580
+ if(!url) return null;
581
+ try {
582
+
583
+ }catch (e){
584
+ return null;
585
+ }
586
+ // let content = list.filter(item=>{
587
+ // //预览模式
588
+ // if(this.$configProject.isPreview) return true;
589
+ //
590
+ // //非内部应用
591
+ // if(item.redirect_type !== 'INN') return true
592
+ //
593
+ // //没有配置链接
594
+ // if(!item.redirect_data) return true;
595
+ //
596
+ // //内部应用
597
+ // else {
598
+ // let redirect_data;
599
+ // try {
600
+ // redirect_data = JSON.parse(item.redirect_data);
601
+ // if(!item['app_type']) item['app_type']= 'h5';
602
+ //
603
+ // //#ifdef H5
604
+ // return item['app_type'] !== 'wxmp';
605
+ // //#endif
606
+ //
607
+ // //#ifdef MP-WEIXIN
608
+ // let actDir = this.$parent.projectAttr.deploy_dir;
609
+ // let dir = this.getPathDir(redirect_data.page);
610
+ // if(item['app_type'] === 'wxmp'){
611
+ // return actDir === dir;
612
+ // }
613
+ // else if(item['app_type'] === 'h5') return true;
614
+ // else return true
615
+ // //#endif
616
+ // }
617
+ // catch (e) {
618
+ // return true
619
+ // }
620
+ // }
621
+ // });
622
+ // console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
623
+ // return content;
624
+
625
+ },
303
626
  }
304
627
  }
305
628