@zykjcommon/questions 0.0.50 → 0.0.52

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": "@zykjcommon/questions",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "main": "src/components/questions/entry.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/readme CHANGED
@@ -5,4 +5,6 @@ watch(() => props.questionList, (nv) => {
5
5
  }
6
6
  },{immediate:true,deep:true})
7
7
 
8
+ 如果源是cnpm需要cnpm sync手动同步
9
+
8
10
 
Binary file
@@ -512,6 +512,7 @@ $greenItemFontSize:0.13em;
512
512
  }
513
513
  }
514
514
  .list-item{
515
+ position: relative;
515
516
  /*background: url("../../img/classify-green-item.png") no-repeat center;*/
516
517
  background-repeat: no-repeat;
517
518
  background-position: center;
@@ -624,6 +625,7 @@ $greenItemFontSize:0.13em;
624
625
  img{
625
626
  width: 100%;
626
627
  height: 100%;
628
+ display: block;
627
629
  }
628
630
  &:hover {
629
631
  background: rgba(0, 0, 0, 0.2);
@@ -659,4 +661,16 @@ $greenItemFontSize:0.13em;
659
661
  &:hover {
660
662
  background-color: #fff;
661
663
  }
664
+ }
665
+
666
+ .look-big-img-btn{
667
+ z-index:2;
668
+ cursor: pointer;
669
+ width: 0.16em;
670
+ height: 0.16em;
671
+ background: url("../../img/lookBigImgBtn.png") no-repeat center;
672
+ background-size: 100% 100%;
673
+ position: absolute;
674
+ right:0;
675
+ top:0;
662
676
  }
@@ -4,8 +4,8 @@
4
4
  <div class="close" @click="cancel">
5
5
  <img src="../../assets/img/big-close.png" alt="" />
6
6
  </div>
7
- <div class="prev" @click="prev"></div>
8
- <div class="next" @click="next"></div>
7
+ <div class="prev" @click="prev" v-if="mediaLookerList.length > 1"></div>
8
+ <div class="next" @click="next" v-if="mediaLookerList.length > 1"></div>
9
9
  <!-- <button style="position: fixed;z-index: 9999;top:0;left:0" @click="fn">click</button>-->
10
10
  <div class="imgLooker" v-if="curMediaObj.mediaType == 1"
11
11
  @click="enlarge"
@@ -56,11 +56,7 @@ export default {
56
56
  mediaLookerList:{
57
57
  handler(nv,ov){
58
58
  if(nv && nv.length){
59
- if(nv && nv.length){
60
- // console.log(nv,3333);
61
- this.getCurMedia(this.mediaCount)
62
- // console.log(props.mediaCount,11113);
63
- }
59
+ this.getCurMedia(this.mediaCount)
64
60
  }
65
61
  },
66
62
  immediate:true,
@@ -29,15 +29,24 @@
29
29
  v-for="(item,index) in optionList"
30
30
  :key="index">
31
31
  <div class="list-item-text" v-show="item.content_type!=2">{{item.content}}</div>
32
+ <div class="look-big-img-btn" v-if="isNeedLookBigImgBtn"></div>
32
33
  </div>
33
34
  </div>
34
35
  </div>
35
36
  </div>
37
+
38
+ <MediaLooker :visible.sync="visible"
39
+ v-model:visible="visible"
40
+ v-if="visible"
41
+ :mediaCount="curMediaCount"
42
+ :mediaLookerList="mediaLookerList"></MediaLooker>
36
43
  </div>
37
44
  </template>
38
45
  <script>
39
46
  import fun from "../../assets/js/fun";
40
47
  import {setRemFixedHeight} from "../../assets/js/rem";
48
+ import {commonData} from './mixin'
49
+ import MediaLooker from '../common/MediaLooker.vue'
41
50
  let env = fun.getDeviceEnv()
42
51
  export default {
43
52
  name: 'Question_Classify',
@@ -92,6 +101,7 @@ export default {
92
101
  },
93
102
  data() {
94
103
  return {
104
+ isNeedLookBigImgBtn:false,
95
105
  animationing:false,
96
106
  analyCorrectAnswer:'',
97
107
  classify_question_info:{},
@@ -114,7 +124,8 @@ export default {
114
124
  flag : false,
115
125
  scrollDistance : 3000,//设置一个死的滚动距离,保证能滚到底,目前够用
116
126
  lazyDragTimer:null,
117
- dragingStart:false
127
+ dragingStart:false,
128
+ ...JSON.parse(commonData)
118
129
  };
119
130
  },
120
131
  watch: {
@@ -182,6 +193,17 @@ export default {
182
193
  let correct = this.questionInfo.answerMap.is_correct === '1' ? true : false
183
194
  return correct
184
195
  },
196
+ getIsNeedLookBigImgBtn(exam_options_data){
197
+ //如果每个item的file_url地址都是同一个就说明是默认背景不需要看大图
198
+ let arr = []
199
+ exam_options_data.forEach((item)=>{
200
+ let objItem = item.data
201
+ if(arr.indexOf(objItem.file_url) <= -1){
202
+ arr.push(objItem.file_url)
203
+ }
204
+ })
205
+ return arr.length > 1 ? true : false
206
+ },
185
207
  parseLists(nv){
186
208
  this.classify_question_info = nv.classify_question_info
187
209
  let exam_options_data = nv.exam_options_data
@@ -202,6 +224,7 @@ export default {
202
224
  idx:item.index
203
225
  })
204
226
  })
227
+ this.isNeedLookBigImgBtn = this.getIsNeedLookBigImgBtn(exam_options_data)
205
228
  this.optionList = optionList
206
229
  this.listItemBgCss = !optionList[0]?'':optionList[0].bgUrlCss
207
230
 
@@ -272,6 +295,21 @@ export default {
272
295
  })
273
296
  return specArr
274
297
  },
298
+ lookBigImg(e){
299
+ let self = this
300
+ let bgStr = $(e.target).parent('.list-item').css('background-image')
301
+ let bgStrReg = /url\(["'](.+)["']\)/
302
+ let matchArr = bgStr.match(bgStrReg)
303
+ if(matchArr && matchArr.length > 1){
304
+ let bgUrl = matchArr[1].replace(/^\s+/ig,'').replace(/\s+$/ig,'')
305
+ self.mediaLookerList = []
306
+ self.mediaLookerList.push({
307
+ url:bgUrl,
308
+ mediaType:1
309
+ })
310
+ self.visible = true
311
+ }
312
+ },
275
313
  //移动端为了解决拖动事件和原生滚动条事件冲突,设置延迟100毫秒拖动(PC端不变)
276
314
  bindDragDomEvent(appendItem,way){
277
315
  let self = this
@@ -313,6 +351,13 @@ export default {
313
351
  }
314
352
  appendItem.off(this.mousedown)
315
353
  appendItem.on(this.mousedown,function(e){
354
+ e.stopPropagation()
355
+ let curClassName = e.target.className
356
+ if(curClassName.indexOf('look-big-img-btn') > -1){
357
+ self.lookBigImg(e)
358
+ return
359
+ }
360
+ console.log(123);
316
361
  if(env === 'mobile'){
317
362
  self.lazyDragTimer = setTimeout(()=>{
318
363
  dragDomEventFn(e,this)
@@ -329,7 +374,8 @@ export default {
329
374
  let itemBgCss = `${self.moveDiv.get(0).style.backgroundImage}`
330
375
  let itemColorCss = `${self.moveDiv.get(0).style.color}`
331
376
  let textDisplayCss = self.moveDiv.find('.list-item-text').get(0).style.display
332
- let appendItem = $(`<div class="${options.appendItemClassName}" idx="${idx}"><div class="list-item-text" style="${textDisplayCss?'display:'+textDisplayCss:''}">${self.moveDiv.find('.list-item-text').text()}</div></div>`)
377
+ let lookBigImgBtnStr = options.appendItemClassName === 'list-item' ? '<div class="look-big-img-btn"></div>' : ''
378
+ let appendItem = $(`<div class="${options.appendItemClassName}" idx="${idx}"><div class="list-item-text" style="${textDisplayCss?'display:'+textDisplayCss:''}">${self.moveDiv.find('.list-item-text').text()}</div>${lookBigImgBtnStr}</div>`)
333
379
  appendItem.css({opacity:0,backgroundImage:itemBgCss,color:itemColorCss})
334
380
  options.targetList.append(appendItem)
335
381
  options.targetList[options.scrollDirection](self.scrollDistance)
@@ -381,6 +427,7 @@ export default {
381
427
  return
382
428
  }
383
429
  // e.preventDefault()
430
+ console.log(self.dragWay,7788);
384
431
  if(self.dragWay === 'go'){
385
432
  $(document).off(self.mousemove)
386
433
  self.listItem && self.listItem.removeClass('drag')
@@ -520,7 +567,7 @@ export default {
520
567
  }
521
568
  },
522
569
  components:{
523
-
570
+ MediaLooker
524
571
  }
525
572
  };
526
573
  </script>