baiqiu-cms-decoration-dg 0.0.14 → 0.1.0

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.
Files changed (40) hide show
  1. package/README.md +24 -18
  2. package/babel.config.js +5 -0
  3. package/dist/css/app.d43615c0.css +1 -0
  4. package/dist/css/chunk-vendors.ef1800aa.css +7 -0
  5. package/dist/favicon.ico +0 -0
  6. package/dist/index.html +1 -0
  7. package/dist/js/app.453dd14c.js +2 -0
  8. package/dist/js/app.453dd14c.js.map +1 -0
  9. package/dist/js/chunk-vendors.cfd53f93.js +37 -0
  10. package/dist/js/chunk-vendors.cfd53f93.js.map +1 -0
  11. package/package.json +61 -48
  12. package/public/favicon.ico +0 -0
  13. package/public/index.html +17 -0
  14. package/src/App.vue +594 -1007
  15. package/src/components/cms/buttonItem/buttonItem.js +1 -5
  16. package/src/components/cms/cms.js +11 -11
  17. package/src/components/cms/cms.vue +2 -2
  18. package/src/components/cms/imgNav/imgNav.js +0 -1
  19. package/src/components/cms/mixin.js +3 -8
  20. package/src/components/cms/productItem/productItem.js +5 -8
  21. package/src/components/cms/productItem/productItem.scss +2 -2
  22. package/src/components/cms/singleLayout/singleLayout.vue +6 -6
  23. package/src/components/cms/slideLayout/slideLayout.js +1 -1
  24. package/src/components/cms/tabLayout/tabLayout.js +3 -3
  25. package/src/components/cms/textItem/textItem.js +62 -69
  26. package/src/index.js +15 -18
  27. package/src/main.js +8 -7
  28. package/src/utils/http-client.js +0 -10
  29. package/webpack.config.js +1 -5
  30. package/.babelrc +0 -17
  31. package/.editorconfig +0 -9
  32. package/.prettierrc +0 -8
  33. package/dist/baiqiu-cms-decoration.min.js +0 -19
  34. package/dist/baiqiu-cms-decoration.min.js.map +0 -1
  35. package/dist/iconfont.svg +0 -1
  36. package/index.html +0 -11
  37. /package/dist/{font/iconfont.ttf → fonts/iconfont.529b3ed0.ttf} +0 -0
  38. /package/dist/{font/iconfont.eot → fonts/iconfont.580c918e.eot} +0 -0
  39. /package/dist/{font/iconfont.woff → fonts/iconfont.ea5b1aa2.woff} +0 -0
  40. /package/dist/{font/iconfont.svg → img/iconfont.654cc65b.svg} +0 -0
@@ -1,7 +1,5 @@
1
1
  import { cmsMixin } from "../mixin";
2
2
  import { dataSaveDecorationPageComponentEventFn } from '../../../utils/utils';
3
- import * as utils from '../utils'
4
- const throttle = utils.throttle
5
3
  export default {
6
4
  name:"buttonItem",
7
5
  mixins: [cmsMixin],
@@ -59,11 +57,9 @@ export default {
59
57
  paddingLeft: `${space.left}px`,
60
58
  paddingRight: `${space.right}px`
61
59
  }
62
-
63
60
  if(borderStyle.type === 1&& borderColor) {
64
61
  style.border = `1px solid ${borderColor}`
65
62
  }
66
-
67
63
  if (borderStyle.type === 2) {
68
64
  style.borderTop = borderTop ? `1px solid ${borderTop}` : 'none'
69
65
  style.borderRight = borderRight ? `1px solid ${borderRight}` : 'none'
@@ -103,7 +99,7 @@ export default {
103
99
  this.envUrl
104
100
  )
105
101
  } catch(err) {
106
-
102
+ console.log(err)
107
103
  }
108
104
  }
109
105
 
@@ -42,12 +42,12 @@ export default {
42
42
  }
43
43
  },
44
44
  watch: {
45
- cmsList: {
46
- handler(val) {
47
- console.log(val)
48
- },
49
- immediate: true
50
- }
45
+ // cmsList: {
46
+ // handler(val) {
47
+ // console.log(val)
48
+ // },
49
+ // immediate: true
50
+ // }
51
51
  },
52
52
  data() {
53
53
  return {
@@ -63,11 +63,6 @@ export default {
63
63
  }
64
64
  },
65
65
  computed: {
66
- judgeSlot() {
67
- return function(index) {
68
- return this.cmsList[index].attributeJson.componentList.some(ele=> {return ele.type == 106})
69
- }
70
- }
71
66
  },
72
67
  mounted() {
73
68
  this.$nextTick(()=>{
@@ -99,6 +94,11 @@ export default {
99
94
  let item = this.cmsList[index]
100
95
  this.$set(item, 'displayType', item.displayType ? 0 : 1)
101
96
  this.$emit('componentChange', item.sort)
97
+ },
98
+ judgeSlot(index) {
99
+ if(this.cmsList[index].attributeJson.componentList) {
100
+ return this.cmsList[index].attributeJson.componentList.some(ele=> {return ele.type == 106})
101
+ }
102
102
  }
103
103
  }
104
104
  }
@@ -31,8 +31,8 @@
31
31
  <template v-if="item.layoutType === 3" slot="customComponent" slot-scope="scope">
32
32
  <slot name="customComponent" :attributeJson="scope.attributeJson"></slot>
33
33
  </template>
34
- <template v-if="judgeSlot(index)" slot="latticeDG" slot-scope="scope">
35
- <slot name="latticeDG" :attributeJson="scope.attributeJson"></slot>
34
+ <template v-if="judgeSlot(index)" slot="dgCustomComponent">
35
+ <slot name="dgCustomComponent"></slot>
36
36
  </template>
37
37
  </component>
38
38
  </div>
@@ -3,7 +3,6 @@ import 'swiper/css/swiper.css'
3
3
  import hotspot from "../hotspot";
4
4
  import { cmsMixin } from "../mixin";
5
5
  import { dataSaveDecorationPageComponentEventFn } from '../../../utils/utils';
6
- import * as utils from '../utils.js'
7
6
 
8
7
  export default {
9
8
  name: "imgNav",
@@ -105,7 +105,7 @@ export const cmsMixin = {
105
105
  },
106
106
  // 入场动画类别
107
107
  animateSort: {
108
- handler(val) {
108
+ handler() {
109
109
  let type = this.animateInType
110
110
  if (type && type != 'slide') {
111
111
  this.entranceShow = false
@@ -142,7 +142,6 @@ export const cmsMixin = {
142
142
  border: borderStyle.borderColor ? `2px solid ${borderStyle.borderColor}` : 'none'
143
143
  }
144
144
  }
145
-
146
145
  if (borderStyle.type == 2) {
147
146
  let { borderTop, borderRight, borderBottom, borderLeft } = borderStyle
148
147
  hoverStyle = {
@@ -153,7 +152,6 @@ export const cmsMixin = {
153
152
  }
154
153
  }
155
154
  }
156
-
157
155
  // 焦点放大镜
158
156
  if (val.type === 3) {
159
157
  hoverStyle = {
@@ -161,12 +159,10 @@ export const cmsMixin = {
161
159
  transformOrigin: 'center center'
162
160
  }
163
161
  }
164
-
165
162
  // 填充
166
163
  if (val.type === 4) {
167
164
  this.hoverDirection = val.bgStyle.direction
168
165
  }
169
-
170
166
  // 换图
171
167
  if (val.type === 5) {
172
168
  let { hoverImgList } = val
@@ -225,14 +221,13 @@ export const cmsMixin = {
225
221
  // 悬停指令
226
222
  hoverAnimate: {
227
223
  inserted: function(el, binding, vnode) {
228
- el.onmouseover = function(e) {
224
+ el.onmouseover = function() {
229
225
  vnode.context.hoverStyleShow = true
230
226
  if (binding.value) {
231
227
  vnode.context[binding.value.key] = binding.value.value
232
228
  }
233
229
  }
234
-
235
- el.onmouseleave = function(e) {
230
+ el.onmouseleave = function() {
236
231
  vnode.context.hoverStyleShow = false
237
232
  if (binding.value) {
238
233
  vnode.context[binding.value.key] = -1
@@ -35,7 +35,7 @@ export default {
35
35
  deep: true
36
36
  },
37
37
  ratio: {
38
- handler(val) {
38
+ handler() {
39
39
  if (!this.isSwiper && this.productStyle.width) {
40
40
  this.productStyle.width = (this.attributeJson.baseStyle.w * this.ratio - this.attributeJson.goodsPaddingSpacing * 2 + this.goodsSpacing) / this.showNum + 'px'
41
41
  }
@@ -177,7 +177,7 @@ export default {
177
177
  },
178
178
  // 初始化轮播图
179
179
  initSwiper: function() {
180
- let { attributeJson, mode, indicatorType, styleType } = this
180
+ let { attributeJson, indicatorType, styleType } = this
181
181
  this.$nextTick(() => {
182
182
  if (this.swiper) {
183
183
  this.swiper.destroy(true, true)
@@ -189,18 +189,15 @@ export default {
189
189
  slidesPerView: this.showNum,
190
190
  spaceBetween: attributeJson.goodsSpacing
191
191
  }
192
-
193
192
  if (styleType == 2 && indicatorType == 2) {
194
193
  this.options.pagination = { el: `.swiper-pagination-${this.sortId}`, clickable: true }
195
194
  }
196
-
197
195
  if (this.hasSwiperButton) {
198
196
  this.options.navigation = {
199
197
  nextEl: `.swiper-button-next-${this.sortId}`,
200
198
  prevEl: `.swiper-button-prev-${this.sortId}`
201
199
  }
202
200
  }
203
-
204
201
  if (this.hasScrollBar) {
205
202
  this.options.scrollbar = {
206
203
  el: `.swiper-scrollbar-${this.sortId}`,
@@ -208,7 +205,6 @@ export default {
208
205
  }
209
206
  this.options.freeMode = true
210
207
  }
211
-
212
208
  this.swiper = new Swiper(`.swiper-container-${this.sortId}`, this.options)
213
209
  this.$nextTick(()=>{
214
210
  this.reportData(this.windowHeight)
@@ -224,7 +220,6 @@ export default {
224
220
  this.$nextTick(()=>{
225
221
  this.reportData(this.windowHeight)
226
222
  })
227
-
228
223
  },
229
224
  gotoPDP(code, colorCode, name, index) {
230
225
  try {
@@ -247,7 +242,9 @@ export default {
247
242
  },
248
243
  this.envUrl
249
244
  )
250
- } catch (err) {}
245
+ } catch (err) {
246
+ console.log(err)
247
+ }
251
248
  this.$emit('gotoPDP', { code, colorCode })
252
249
  },
253
250
  // 上报数据
@@ -31,8 +31,8 @@
31
31
  position: relative;
32
32
  .hover-con {
33
33
  position: absolute;
34
- width: fill-available;
35
- width: -webkit-fill-available;
34
+ width: stretch;
35
+ width: -webkit-stretch;
36
36
  }
37
37
  }
38
38
  }
@@ -6,11 +6,12 @@
6
6
  <div
7
7
  style="width: 100%; height: 100%"
8
8
  >
9
- <template v-for="(item, index) in layOutData.componentList">
10
- <template v-if="item.type == 106">
11
- <slot name="latticeDG" :attributeJson="item.attributeJson"></slot>
9
+ <div v-for="(item, index) in layOutData.componentList" :key="index">
10
+ <template v-if="item.type > 100">
11
+ {{item.sort}}
12
+ <slot :name="`dgCustomComponent${item.sort}`" :attributeJson="JSON.parse(JSON.stringify(item.attributeJson))"></slot>
12
13
  </template>
13
- <template v-else>
14
+ <template v-if="item.type <= 100">
14
15
  <component
15
16
  ref="singleComponent"
16
17
  :is="item.component"
@@ -25,8 +26,7 @@
25
26
  >
26
27
  </component>
27
28
  </template>
28
-
29
- </template>
29
+ </div>
30
30
  <!--辅助线END-->
31
31
  </div>
32
32
  </div>
@@ -147,7 +147,7 @@ export default {
147
147
  return
148
148
  }
149
149
  let { layWidth } = this
150
- this.slideList.forEach((item, i) => {
150
+ this.slideList.forEach((item) => {
151
151
  let ele = item.componentList[0]
152
152
  let slideWidth = 0
153
153
  if (ele) {
@@ -103,7 +103,7 @@ export default {
103
103
  },
104
104
  watch: {
105
105
  'layOutData.tabHeadInfo': {
106
- handler: function(val) {
106
+ handler: function() {
107
107
  this.$nextTick(() => {
108
108
  this.tabHeadTitleH = this.layOutData.tabHeadInfo.showTitle == 2 ? (this.$refs['tabHeadTitleDom'] ? this.$refs['tabHeadTitleDom'].clientHeight : 0) : 0
109
109
  this.setLayoutH()
@@ -113,9 +113,9 @@ export default {
113
113
  deep: true
114
114
  },
115
115
  'list.length': {
116
- handler: function(val) {
116
+ handler: function() {
117
117
  //当导航变化时, 判断当前选中的选项及选中的索引
118
- let ind = this.list.findIndex((item, index) => {
118
+ let ind = this.list.findIndex((item) => {
119
119
  return item.sort == this.activeSort
120
120
  })
121
121
  if (ind > -1) {
@@ -1,72 +1,65 @@
1
1
  import { cmsMixin } from "../mixin";
2
- import { dataSaveDecorationPageComponentEventFn } from '../../../utils/utils';
3
-
2
+ import { dataSaveDecorationPageComponentEventFn } from "../../../utils/utils";
4
3
  export default {
5
- name:'textItem',
6
- mixins: [cmsMixin],
7
- components: {
8
- },
9
- props: {
10
-
11
- },
12
- data() {
13
- return {}
14
- },
15
- watch: {
16
-
17
- },
18
- methods: {
19
- pageClick() {
20
- if(this.attributeJson.linkObj.jumpLinkType) {
21
- try {
22
- dataSaveDecorationPageComponentEventFn(
23
- {
24
- uniqueId: this.recordId + '_' + this.sortId, // 组件_id
25
- uniqueName: this.attributeJson.uniqueName, // 组件_名称
26
- componentType: 12,
27
- popData: {},
28
- materialId: this.recordId + '_' + this.sortId, //素材id
29
- materialName: this.attributeJson.uniqueName, //素材名称
30
- refererPagePath: this.refererPagePath,
31
- brand: this.brand,
32
- path: this.path,
33
- position: 1,
34
- event: 'bannerClick'
35
- },
36
- this.envUrl
37
- )
38
- } catch(err) {
39
-
4
+ name: "textItem",
5
+ mixins: [cmsMixin],
6
+ components: {},
7
+ props: {},
8
+ data() {
9
+ return {};
10
+ },
11
+ watch: {},
12
+ methods: {
13
+ pageClick() {
14
+ if (this.attributeJson.linkObj.jumpLinkType) {
15
+ try {
16
+ dataSaveDecorationPageComponentEventFn(
17
+ {
18
+ uniqueId: this.recordId + "_" + this.sortId, // 组件_id
19
+ uniqueName: this.attributeJson.uniqueName, // 组件_名称
20
+ componentType: 12,
21
+ popData: {},
22
+ materialId: this.recordId + "_" + this.sortId, //素材id
23
+ materialName: this.attributeJson.uniqueName, //素材名称
24
+ refererPagePath: this.refererPagePath,
25
+ brand: this.brand,
26
+ path: this.path,
27
+ position: 1,
28
+ event: "bannerClick",
29
+ },
30
+ this.envUrl
31
+ );
32
+ } catch (err) {
33
+ console.log(err)
40
34
  }
41
- }
42
-
43
- this.$emit('jumpLink', this.attributeJson.linkObj)
44
- },
45
- // 上报数据
46
- reportData(h) {
47
- if(this.isReport) return
48
- let ref = this.$refs[`text${this.attributeJson.sort}`]
49
- if(!ref || ref.style.display == 'none') return
50
- let el = ref.getBoundingClientRect()
51
- if(el.top <= h) {
52
- this.isReport = true
53
- dataSaveDecorationPageComponentEventFn(
54
- {
55
- uniqueId: this.recordId + '_' + this.sortId, // 组件_id
56
- uniqueName: this.attributeJson.uniqueName, // 组件_名称
57
- componentType: 12,
58
- popData: {},
59
- materialId: this.recordId + '_' + this.sortId, //素材id
60
- materialName: this.attributeJson.uniqueName, //素材名称
61
- refererPagePath: this.refererPagePath,
62
- brand: this.brand,
63
- path: this.path,
64
- position: 1,
65
- event: 'bannerShow'
66
- },
67
- this.envUrl
68
- )
69
- }
70
- }
71
- }
72
- }
35
+ }
36
+ this.$emit("jumpLink", this.attributeJson.linkObj);
37
+ },
38
+ // 上报数据
39
+ reportData(h) {
40
+ if (this.isReport) return;
41
+ let ref = this.$refs[`text${this.attributeJson.sort}`];
42
+ if (!ref || ref.style.display == "none") return;
43
+ let el = ref.getBoundingClientRect();
44
+ if (el.top <= h) {
45
+ this.isReport = true;
46
+ dataSaveDecorationPageComponentEventFn(
47
+ {
48
+ uniqueId: this.recordId + "_" + this.sortId, // 组件_id
49
+ uniqueName: this.attributeJson.uniqueName, // 组件_名称
50
+ componentType: 12,
51
+ popData: {},
52
+ materialId: this.recordId + "_" + this.sortId, //素材id
53
+ materialName: this.attributeJson.uniqueName, //素材名称
54
+ refererPagePath: this.refererPagePath,
55
+ brand: this.brand,
56
+ path: this.path,
57
+ position: 1,
58
+ event: "bannerShow",
59
+ },
60
+ this.envUrl
61
+ );
62
+ }
63
+ },
64
+ },
65
+ };
package/src/index.js CHANGED
@@ -1,26 +1,23 @@
1
- import Vue from 'vue'
2
1
  import cms from './components/cms/'
3
- import singleLayout from './components/cms/singleLayout/'
4
-
5
- Vue.component('singleLayout', singleLayout)
6
-
7
- const components = [
2
+ const components = {
8
3
  cms
9
- ]
10
-
11
- const install = function(Vue) {
4
+ }
5
+ const install = function (Vue) {
12
6
  // 判断是否安装
13
- if (install.installed) return;
7
+ if (install.installed) return
14
8
  // 遍历注册全局组件
15
- components.map(component => Vue.component(component.name, component));
16
- };
17
-
9
+ Object.keys(components).forEach(key => {
10
+ Vue.component(key, components[key])
11
+ })
12
+ }
13
+ if (typeof window !== 'undefined' && window.Vue) {
14
+ install(window.Vue)
15
+ }
18
16
  export default {
17
+ // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
19
18
  install
20
- // picNav
21
- // banner
22
- };
19
+ }
23
20
 
24
21
  export {
25
- cms
26
- };
22
+ cms
23
+ }
package/src/main.js CHANGED
@@ -1,7 +1,8 @@
1
- import Vue from 'vue'
2
- import App from './App.vue'
3
-
4
- new Vue({
5
- el: '#app',
6
- render: h => h(App)
7
- })
1
+ import Vue from 'vue'
2
+ import App from './App.vue'
3
+
4
+ Vue.config.productionTip = false
5
+
6
+ new Vue({
7
+ render: h => h(App),
8
+ }).$mount('#app')
@@ -1,5 +1,4 @@
1
1
  import axios from "axios";
2
-
3
2
  export const CONTENT_TYPE = {
4
3
  json: "application/json;",
5
4
  form: "application/x-www-form-urlencoded;",
@@ -13,7 +12,6 @@ export const REQ_HEADERS = {
13
12
  lang: "Accept-Language",
14
13
  contentType: "Content-Type"
15
14
  };
16
-
17
15
  function checkResponse(response) {
18
16
  if (response.status === 200) {
19
17
  let result = response.data;
@@ -23,14 +21,10 @@ function checkResponse(response) {
23
21
  return response.data;
24
22
  }
25
23
  }
26
-
27
24
  axios.interceptors.response.use(checkResponse, error => {
28
25
  // Do something with response error
29
- if (error.message === "Network Error") {
30
- }
31
26
  return Promise.reject(error);
32
27
  });
33
-
34
28
  export class HttpClient {
35
29
  static async call(
36
30
  url,
@@ -48,9 +42,7 @@ export class HttpClient {
48
42
  } else {
49
43
  params.data = body;
50
44
  }
51
-
52
45
  // console.log("params", params);
53
-
54
46
  const response = await axios(params).catch(error => {
55
47
  if (error.response) {
56
48
  // The request was made and the server responded with a status code
@@ -69,7 +61,6 @@ export class HttpClient {
69
61
  });
70
62
  return response;
71
63
  }
72
-
73
64
  static get(url, { mask = true, external = false, headers = {} } = {}) {
74
65
  return HttpClient.call(url, {
75
66
  headers,
@@ -77,7 +68,6 @@ export class HttpClient {
77
68
  mask
78
69
  });
79
70
  }
80
-
81
71
  static postBody(
82
72
  url,
83
73
  {
package/webpack.config.js CHANGED
@@ -43,9 +43,6 @@ module.exports = {
43
43
  loader: "vue-loader",
44
44
  options: {
45
45
  loaders: {
46
- // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
47
- // the "scss" and "sass" values for the lang attribute to the right configs here.
48
- // other preprocessors should work out of the box, no loader config like this necessary.
49
46
  scss: ["vue-style-loader", "css-loader", "sass-loader"],
50
47
  sass: [
51
48
  "vue-style-loader",
@@ -53,13 +50,12 @@ module.exports = {
53
50
  "sass-loader?indentedSyntax"
54
51
  ]
55
52
  }
56
- // other vue-loader options go here
57
53
  }
58
54
  },
59
55
  {
60
56
  test: /\.js$/,
61
57
  loader: "babel-loader",
62
- // exclude: /node_modules/
58
+ exclude: /node_modules/
63
59
  },
64
60
  {
65
61
  test: /\.(png|jpg|gif|svg)$/,
package/.babelrc DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "presets": [
3
- ["env", { "modules": false }],
4
- "stage-3"
5
- ],
6
- "plugins": [
7
- [
8
- "transform-runtime",
9
- {
10
- "helpers": false,
11
- "polyfill": false,
12
- "regenerator": true,
13
- "moduleName": "babel-runtime"
14
- }
15
- ]
16
- ]
17
- }
package/.editorconfig DELETED
@@ -1,9 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "printWidth": 200,
3
- "tabWidth": 2,
4
- "singleQuote": true,
5
- "jsxSingleQuote": true,
6
- "semi": false,
7
- "htmlWhitespaceSensitivity": "ignore"
8
- }