xiaoe_mp_npm 1.0.22-test03 → 1.0.22-test04

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.
@@ -1,132 +1,134 @@
1
1
  const computedBehavior = require('miniprogram-computed').behavior
2
- import { rpxToVmin } from '../../common/utils/index.js'
2
+ import { rpxToVmin } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/index.js'
3
3
  Component({
4
4
  options: {
5
5
  styleIsolation: 'shared',
6
6
  },
7
7
  behaviors: [computedBehavior],
8
8
  properties: {
9
- showPopup:{
9
+ showPopup: {
10
10
  type: Boolean,
11
- value: false
11
+ value: false,
12
12
  },
13
- taskList:{
14
- type:Array,
15
- value:()=>{
13
+ taskList: {
14
+ type: Array,
15
+ value: () => {
16
16
  return []
17
- }
17
+ },
18
18
  },
19
- errorList:{
20
- type:Array,
21
- value:()=>{
19
+ errorList: {
20
+ type: Array,
21
+ value: () => {
22
22
  return []
23
- }
23
+ },
24
24
  },
25
- rewardList:{
26
- type:Array,
27
- value:()=>{
25
+ rewardList: {
26
+ type: Array,
27
+ value: () => {
28
28
  return []
29
- }
29
+ },
30
30
  },
31
- hasRewardRecord:{
32
- type:Boolean,
33
- value: false
31
+ hasRewardRecord: {
32
+ type: Boolean,
33
+ value: false,
34
34
  },
35
35
  popPosition: {
36
36
  type: String,
37
- value: 'bottom'
37
+ value: 'bottom',
38
38
  },
39
- isShowClose:{
40
- type:Boolean,
41
- value: true
39
+ isShowClose: {
40
+ type: Boolean,
41
+ value: true,
42
42
  },
43
- rewardListRefreshStatus:{
44
- type:Boolean,
45
- value: false
43
+ rewardListRefreshStatus: {
44
+ type: Boolean,
45
+ value: false,
46
46
  },
47
- taskListRefreshStatus:{
48
- type:Boolean,
49
- value: false
47
+ taskListRefreshStatus: {
48
+ type: Boolean,
49
+ value: false,
50
50
  },
51
51
  orientation: {
52
52
  type: String,
53
- value: 'hor'
53
+ value: 'hor',
54
54
  },
55
55
  isFull: {
56
- type:Boolean,
57
- value: false
56
+ type: Boolean,
57
+ value: false,
58
58
  },
59
- viewingInProgress:{
60
- type:Array,
61
- value:()=>{
59
+ viewingInProgress: {
60
+ type: Array,
61
+ value: () => {
62
62
  return []
63
- }
64
- }
63
+ },
64
+ },
65
65
  },
66
66
  data: {
67
- isShowTaskList:true
67
+ isShowTaskList: true,
68
68
  },
69
69
  lifetimes: {
70
70
  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
71
- attached: function () {
72
-
73
- },
74
- moved: function () { },
75
- detached: function () { },
71
+ attached: function () {},
72
+ moved: function () {},
73
+ detached: function () {},
76
74
  },
77
75
  computed: {
78
76
  customStyle(properties) {
79
77
  const { popPosition, orientation } = properties
80
78
  const position = `position: ${orientation === 'ver' ? 'fixed' : 'absolute'}; left: 0; bottom: 0`
81
- return popPosition === "bottom" ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});` : "height: 100%;width: 100vmin;"
82
- },
83
- popupContentBackground(data){
84
- if(data.isShowTaskList){
85
- return data.isFull ? 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltzgkkz00m0m.png)' : 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltqz384w02n9.png);'
86
- }else{
87
- return "background: #FFEFD7;"
79
+ return popPosition === 'bottom'
80
+ ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});`
81
+ : 'height: 100%;width: 100vmin;'
82
+ },
83
+ popupContentBackground(data) {
84
+ if (data.isShowTaskList) {
85
+ return data.isFull
86
+ ? 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltzgkkz00m0m.png)'
87
+ : 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltqz384w02n9.png);'
88
+ } else {
89
+ return 'background: #FFEFD7;'
88
90
  }
89
- }
91
+ },
90
92
  },
91
93
  methods: {
92
- toReward(){
93
- if(!this.properties.hasRewardRecord){
94
+ toReward() {
95
+ if (!this.properties.hasRewardRecord) {
94
96
  wx.showToast({
95
- title: "还未完成任务,加油~",
96
- icon:"none"
97
+ title: '还未完成任务,加油~',
98
+ icon: 'none',
97
99
  })
98
100
  return
99
101
  }
100
- this.triggerEvent("toReward")
102
+ this.triggerEvent('toReward')
101
103
  this.setData({
102
- isShowTaskList: false
104
+ isShowTaskList: false,
103
105
  })
104
106
  },
105
- toBack(){
107
+ toBack() {
106
108
  this.setData({
107
- isShowTaskList: true
109
+ isShowTaskList: true,
108
110
  })
109
111
  },
110
- closePop(){
111
- this.triggerEvent("closePop")
112
+ closePop() {
113
+ this.triggerEvent('closePop')
114
+ },
115
+ btnClick(e) {
116
+ this.triggerEvent('btnClick', e.detail)
112
117
  },
113
- btnClick(e){
114
- this.triggerEvent("btnClick",e.detail)
118
+ onLoad(e) {
119
+ this.triggerEvent('onLoad', e)
115
120
  },
116
- onLoad(e){
117
- this.triggerEvent("onLoad",e)
121
+ getMoreList(e) {
122
+ this.triggerEvent('getMoreList', e)
118
123
  },
119
- getMoreList(e){
120
- this.triggerEvent("getMoreList",e)
121
- }
122
124
  },
123
125
  observers: {
124
- showPopup(newVal){
125
- if(newVal){
126
+ showPopup(newVal) {
127
+ if (newVal) {
126
128
  this.setData({
127
- isShowTaskList: true
129
+ isShowTaskList: true,
128
130
  })
129
131
  }
130
- }
132
+ },
131
133
  },
132
134
  })
@@ -1,6 +1,6 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "audio-player": "../../../../components/audio_player/index"
5
- }
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "audio-player": "../../../../components/audio_player/index"
5
+ }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  const computedBehavior = require('miniprogram-computed').behavior
2
- import { rpxToVmin } from '../../common/utils/index.js'
3
- import Dialog from '@vant/weapp/dialog/dialog';
2
+ import { rpxToVmin } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/index.js'
3
+ import Dialog from '@vant/weapp/dialog/dialog'
4
4
 
5
5
  // 奖励icon配置
6
6
  const reward_config = {
@@ -32,42 +32,42 @@ Component({
32
32
  * 组件的属性列表
33
33
  */
34
34
  properties: {
35
- showPopup:{
35
+ showPopup: {
36
36
  type: Boolean,
37
- value: false
37
+ value: false,
38
38
  },
39
39
  popPosition: {
40
40
  type: String,
41
- value: 'bottom'
41
+ value: 'bottom',
42
42
  },
43
43
  orientation: {
44
44
  type: String,
45
- value: 'hor'
45
+ value: 'hor',
46
46
  },
47
47
  // 当前打开弹窗的任务
48
48
  quiz_task_item: {
49
49
  type: Object,
50
- value: {}
50
+ value: {},
51
51
  },
52
52
  // 当前任务的参与结果
53
53
  join_result: {
54
54
  type: Object,
55
- value: {}
55
+ value: {},
56
56
  },
57
57
  // 当前答题数组
58
58
  show_quiz_list: {
59
59
  type: Array,
60
- value: []
60
+ value: [],
61
61
  },
62
62
  // 当前查看解析的答题数组
63
63
  show_quiz_analysis_list: {
64
64
  type: Array,
65
- value: []
65
+ value: [],
66
66
  },
67
67
  // 整个任务列表数据
68
68
  task_list: {
69
69
  type: Array,
70
- value: []
70
+ value: [],
71
71
  },
72
72
  // 是否是结果解析
73
73
  showAnalysis: {
@@ -77,8 +77,8 @@ Component({
77
77
  // 是否全屏互动
78
78
  isFull: {
79
79
  type: Boolean,
80
- value: false
81
- }
80
+ value: false,
81
+ },
82
82
  },
83
83
 
84
84
  /**
@@ -92,7 +92,9 @@ Component({
92
92
  computed: {
93
93
  customStyle({ popPosition, orientation }) {
94
94
  const position = `position: ${orientation === 'ver' ? 'fixed' : 'absolute'}; left: 0; bottom: 0`
95
- return popPosition === "bottom" ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});` : "height: 100%;width: 100vmin;border-radius: 0;"
95
+ return popPosition === 'bottom'
96
+ ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});`
97
+ : 'height: 100%;width: 100vmin;border-radius: 0;'
96
98
  },
97
99
  // 奖励图标
98
100
  rewardIcon({ quiz_task_item }) {
@@ -116,22 +118,25 @@ Component({
116
118
  observers: {
117
119
  showPopup(val) {
118
120
  if (val) {
119
- this.setData({
120
- currentIndex: 0,
121
- total: this.data.show_quiz_list.length,
122
- quizList: this.data[this.data.showAnalysis ? 'show_quiz_analysis_list' : 'show_quiz_list'],
123
- }, ()=> {
124
- console.error('jer=========进入弹窗', this.data);
125
- })
121
+ this.setData(
122
+ {
123
+ currentIndex: 0,
124
+ total: this.data.show_quiz_list.length,
125
+ quizList: this.data[this.data.showAnalysis ? 'show_quiz_analysis_list' : 'show_quiz_list'],
126
+ },
127
+ () => {
128
+ console.error('jer=========进入弹窗', this.data)
129
+ },
130
+ )
126
131
  }
127
- }
132
+ },
128
133
  },
129
134
  /**
130
135
  * 组件的方法列表
131
136
  */
132
137
  methods: {
133
- closePop(){
134
- this.triggerEvent("closePop")
138
+ closePop() {
139
+ this.triggerEvent('closePop')
135
140
  this.setData({
136
141
  currentIndex: 0,
137
142
  total: 0,
@@ -140,15 +145,15 @@ Component({
140
145
  },
141
146
  // 答题顺序恐惧
142
147
  handleQuizOrder(e) {
143
- let currentIndex = this.data.currentIndex;
148
+ let currentIndex = this.data.currentIndex
144
149
  switch (e.currentTarget.dataset.type) {
145
- case "prev":
146
- currentIndex--;
147
- break;
148
- case "next":
149
- currentIndex++;
150
- break;
151
- case "submit":
150
+ case 'prev':
151
+ currentIndex--
152
+ break
153
+ case 'next':
154
+ currentIndex++
155
+ break
156
+ case 'submit':
152
157
  Dialog.confirm({
153
158
  context: this,
154
159
  closeOnClickOverlay: false,
@@ -159,74 +164,73 @@ Component({
159
164
  confirmButtonColor: '#1472FF',
160
165
  zIndex: 501,
161
166
  })
162
- .then(() => {
163
- // 处理获取题目id和答案id
164
- let params = this.data.quizList.map((item) => {
165
- // 获取用户选择的答案
166
- let userAnswer = [];
167
- for (let index = 0; index < item.options.length; index++) {
168
- const ele = item.options[index];
169
- if (ele.selected) {
170
- userAnswer.push(ele.op_id);
167
+ .then(() => {
168
+ // 处理获取题目id和答案id
169
+ let params = this.data.quizList.map((item) => {
170
+ // 获取用户选择的答案
171
+ let userAnswer = []
172
+ for (let index = 0; index < item.options.length; index++) {
173
+ const ele = item.options[index]
174
+ if (ele.selected) {
175
+ userAnswer.push(ele.op_id)
176
+ }
177
+ }
178
+ return {
179
+ qs_id: item.qs_id,
180
+ op_id: userAnswer,
171
181
  }
182
+ })
183
+ // 获取列表中当前任务是否结束了,兼容提交前端校验
184
+ const taskFindItem = this.data.task_list.find((item) => item.id === this.data.quiz_task_item.id) || {}
185
+ if (taskFindItem.state === 2) {
186
+ this.closePop()
187
+ wx.showToast({
188
+ title: '当前答题已结束,无法继续提交',
189
+ icon: 'none',
190
+ duration: 1000,
191
+ })
192
+ return
172
193
  }
173
- return {
174
- qs_id: item.qs_id,
175
- op_id: userAnswer,
176
- };
177
- });
178
- // 获取列表中当前任务是否结束了,兼容提交前端校验
179
- const taskFindItem =
180
- this.data.task_list.find(
181
- (item) => item.id === this.data.quiz_task_item.id
182
- ) || {};
183
- if (taskFindItem.state === 2) {
184
- this.closePop()
185
- wx.showToast({
186
- title: '当前答题已结束,无法继续提交',
187
- icon: 'none',
188
- duration: 1000,
194
+ // 存储用户答案,用于接口请求参数
195
+ // 调用完成任务接口
196
+ this.triggerEvent('commonFulfilTasks', {
197
+ user_answer: params,
198
+ ids: [this.data.quiz_task_item.id],
199
+ taskItem: this.data.quiz_task_item,
189
200
  })
190
- return;
191
- }
192
- // 存储用户答案,用于接口请求参数
193
- // 调用完成任务接口
194
- this.triggerEvent("commonFulfilTasks", {
195
- user_answer: params,
196
- ids: [this.data.quiz_task_item.id],
197
- taskItem: this.data.quiz_task_item,
198
201
  })
199
- })
200
- .catch((err) => {
201
- // 暂无操作
202
- });
203
- break;
202
+ .catch((err) => {
203
+ // 暂无操作
204
+ })
205
+ break
204
206
 
205
207
  default:
206
- break;
208
+ break
207
209
  }
208
210
  this.setData({ currentIndex })
209
211
  },
210
212
  // 点击选项进行操作答题
211
213
  clickOption(e) {
212
214
  const index = e.detail
213
- console.error('jer=============选择11111', index);
214
- const tempQuizItem =
215
- this.data.quizList[this.data.currentIndex];
215
+ console.error('jer=============选择11111', index)
216
+ const tempQuizItem = this.data.quizList[this.data.currentIndex]
216
217
  // 多选题
217
218
  if (tempQuizItem.qs_type === 1) {
218
219
  tempQuizItem.options[index].selected = !tempQuizItem.options[index].selected
219
220
  } else {
220
221
  for (let i = 0; i < tempQuizItem.options.length; i++) {
221
- tempQuizItem.options[i].selected = false;
222
+ tempQuizItem.options[i].selected = false
222
223
  }
223
- tempQuizItem.options[index].selected = true;
224
+ tempQuizItem.options[index].selected = true
224
225
  }
225
- this.setData({
226
- quizList: this.data.quizList
227
- }, ()=> {
228
- console.error('jer============更改之后的数组', this.data.quizList);
229
- })
226
+ this.setData(
227
+ {
228
+ quizList: this.data.quizList,
229
+ },
230
+ () => {
231
+ console.error('jer============更改之后的数组', this.data.quizList)
232
+ },
233
+ )
230
234
  },
231
- }
232
- })
235
+ },
236
+ })
@@ -1,54 +1,53 @@
1
- import { scatterRequest } from '../../common/utils/tool';
1
+ import { scatterRequest } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/tool.js'
2
2
  Component({
3
-
4
3
  /**
5
4
  * 组件的属性列表
6
5
  */
7
6
  properties: {
8
- showPopup:{
7
+ showPopup: {
9
8
  type: Boolean,
10
- value: false
9
+ value: false,
11
10
  },
12
11
  // 任务列表中进行中的答题任务
13
12
  quiz_task_start_list: {
14
13
  type: Object,
15
- value: {}
14
+ value: {},
16
15
  },
17
16
  // 直播间人次
18
17
  viewCount: {
19
18
  type: Number,
20
- value: 0
21
- }
19
+ value: 0,
20
+ },
22
21
  },
23
22
 
24
23
  /**
25
24
  * 组件的初始数据
26
25
  */
27
26
  data: {
28
- btnLock: false
27
+ btnLock: false,
29
28
  },
30
29
 
31
30
  /**
32
31
  * 组件的方法列表
33
32
  */
34
33
  methods: {
35
- closePop(){
36
- this.triggerEvent("closePop")
34
+ closePop() {
35
+ this.triggerEvent('closePop')
37
36
  this.setData({ btnLock: false })
38
37
  },
39
38
  quizHandle() {
40
- if (this.data.btnLock) return;
39
+ if (this.data.btnLock) return
41
40
  this.setData({ btnLock: true })
42
41
  scatterRequest(
43
42
  // 随机条件
44
43
  () => {
45
- let delay = 0;
44
+ let delay = 0
46
45
  if (this.data.viewCount > 10000) {
47
46
  // pv: 10000,则0-3秒随机打散
48
- const randomDelay = Math.random();
49
- delay = Math.ceil(randomDelay * 3000); // 转换为毫秒
47
+ const randomDelay = Math.random()
48
+ delay = Math.ceil(randomDelay * 3000) // 转换为毫秒
50
49
  }
51
- return delay;
50
+ return delay
52
51
  },
53
52
  // 打散配置
54
53
  {
@@ -58,22 +57,18 @@ Component({
58
57
  async () => {
59
58
  if (this.data.quiz_task_start_list.length === 1) {
60
59
  // 如果只有一个拉起答题
61
- this.triggerEvent("openRelatedPop",
62
- {
63
- quiz_task_item: this.data.quiz_task_start_list[0],
64
- show_quiz_popup: true,
65
- }
66
- )
60
+ this.triggerEvent('openRelatedPop', {
61
+ quiz_task_item: this.data.quiz_task_start_list[0],
62
+ show_quiz_popup: true,
63
+ })
67
64
  } else if (this.data.quiz_task_start_list.length > 1) {
68
- this.triggerEvent("openRelatedPop",
69
- {
70
- show_task_popup: true,
71
- }
72
- )
65
+ this.triggerEvent('openRelatedPop', {
66
+ show_task_popup: true,
67
+ })
73
68
  }
74
- this.closePop();
75
- }
76
- );
77
- }
78
- }
79
- })
69
+ this.closePop()
70
+ },
71
+ )
72
+ },
73
+ },
74
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaoe_mp_npm",
3
- "version": "1.0.22-test03",
3
+ "version": "1.0.22-test04",
4
4
  "description": "",
5
5
  "main": "miniprogram_dist/index.js",
6
6
  "scripts": {
@@ -1,132 +1,134 @@
1
1
  const computedBehavior = require('miniprogram-computed').behavior
2
- import { rpxToVmin } from '../../common/utils/index.js'
2
+ import { rpxToVmin } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/index.js'
3
3
  Component({
4
4
  options: {
5
5
  styleIsolation: 'shared',
6
6
  },
7
7
  behaviors: [computedBehavior],
8
8
  properties: {
9
- showPopup:{
9
+ showPopup: {
10
10
  type: Boolean,
11
- value: false
11
+ value: false,
12
12
  },
13
- taskList:{
14
- type:Array,
15
- value:()=>{
13
+ taskList: {
14
+ type: Array,
15
+ value: () => {
16
16
  return []
17
- }
17
+ },
18
18
  },
19
- errorList:{
20
- type:Array,
21
- value:()=>{
19
+ errorList: {
20
+ type: Array,
21
+ value: () => {
22
22
  return []
23
- }
23
+ },
24
24
  },
25
- rewardList:{
26
- type:Array,
27
- value:()=>{
25
+ rewardList: {
26
+ type: Array,
27
+ value: () => {
28
28
  return []
29
- }
29
+ },
30
30
  },
31
- hasRewardRecord:{
32
- type:Boolean,
33
- value: false
31
+ hasRewardRecord: {
32
+ type: Boolean,
33
+ value: false,
34
34
  },
35
35
  popPosition: {
36
36
  type: String,
37
- value: 'bottom'
37
+ value: 'bottom',
38
38
  },
39
- isShowClose:{
40
- type:Boolean,
41
- value: true
39
+ isShowClose: {
40
+ type: Boolean,
41
+ value: true,
42
42
  },
43
- rewardListRefreshStatus:{
44
- type:Boolean,
45
- value: false
43
+ rewardListRefreshStatus: {
44
+ type: Boolean,
45
+ value: false,
46
46
  },
47
- taskListRefreshStatus:{
48
- type:Boolean,
49
- value: false
47
+ taskListRefreshStatus: {
48
+ type: Boolean,
49
+ value: false,
50
50
  },
51
51
  orientation: {
52
52
  type: String,
53
- value: 'hor'
53
+ value: 'hor',
54
54
  },
55
55
  isFull: {
56
- type:Boolean,
57
- value: false
56
+ type: Boolean,
57
+ value: false,
58
58
  },
59
- viewingInProgress:{
60
- type:Array,
61
- value:()=>{
59
+ viewingInProgress: {
60
+ type: Array,
61
+ value: () => {
62
62
  return []
63
- }
64
- }
63
+ },
64
+ },
65
65
  },
66
66
  data: {
67
- isShowTaskList:true
67
+ isShowTaskList: true,
68
68
  },
69
69
  lifetimes: {
70
70
  // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
71
- attached: function () {
72
-
73
- },
74
- moved: function () { },
75
- detached: function () { },
71
+ attached: function () {},
72
+ moved: function () {},
73
+ detached: function () {},
76
74
  },
77
75
  computed: {
78
76
  customStyle(properties) {
79
77
  const { popPosition, orientation } = properties
80
78
  const position = `position: ${orientation === 'ver' ? 'fixed' : 'absolute'}; left: 0; bottom: 0`
81
- return popPosition === "bottom" ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});` : "height: 100%;width: 100vmin;"
82
- },
83
- popupContentBackground(data){
84
- if(data.isShowTaskList){
85
- return data.isFull ? 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltzgkkz00m0m.png)' : 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltqz384w02n9.png);'
86
- }else{
87
- return "background: #FFEFD7;"
79
+ return popPosition === 'bottom'
80
+ ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});`
81
+ : 'height: 100%;width: 100vmin;'
82
+ },
83
+ popupContentBackground(data) {
84
+ if (data.isShowTaskList) {
85
+ return data.isFull
86
+ ? 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltzgkkz00m0m.png)'
87
+ : 'background-image: url(https://commonresource-1252524126.cdn.xiaoeknow.com/image/ltqz384w02n9.png);'
88
+ } else {
89
+ return 'background: #FFEFD7;'
88
90
  }
89
- }
91
+ },
90
92
  },
91
93
  methods: {
92
- toReward(){
93
- if(!this.properties.hasRewardRecord){
94
+ toReward() {
95
+ if (!this.properties.hasRewardRecord) {
94
96
  wx.showToast({
95
- title: "还未完成任务,加油~",
96
- icon:"none"
97
+ title: '还未完成任务,加油~',
98
+ icon: 'none',
97
99
  })
98
100
  return
99
101
  }
100
- this.triggerEvent("toReward")
102
+ this.triggerEvent('toReward')
101
103
  this.setData({
102
- isShowTaskList: false
104
+ isShowTaskList: false,
103
105
  })
104
106
  },
105
- toBack(){
107
+ toBack() {
106
108
  this.setData({
107
- isShowTaskList: true
109
+ isShowTaskList: true,
108
110
  })
109
111
  },
110
- closePop(){
111
- this.triggerEvent("closePop")
112
+ closePop() {
113
+ this.triggerEvent('closePop')
114
+ },
115
+ btnClick(e) {
116
+ this.triggerEvent('btnClick', e.detail)
112
117
  },
113
- btnClick(e){
114
- this.triggerEvent("btnClick",e.detail)
118
+ onLoad(e) {
119
+ this.triggerEvent('onLoad', e)
115
120
  },
116
- onLoad(e){
117
- this.triggerEvent("onLoad",e)
121
+ getMoreList(e) {
122
+ this.triggerEvent('getMoreList', e)
118
123
  },
119
- getMoreList(e){
120
- this.triggerEvent("getMoreList",e)
121
- }
122
124
  },
123
125
  observers: {
124
- showPopup(newVal){
125
- if(newVal){
126
+ showPopup(newVal) {
127
+ if (newVal) {
126
128
  this.setData({
127
- isShowTaskList: true
129
+ isShowTaskList: true,
128
130
  })
129
131
  }
130
- }
132
+ },
131
133
  },
132
134
  })
@@ -1,6 +1,6 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "audio-player": "../../../../components/audio_player/index"
5
- }
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "audio-player": "../../../../components/audio_player/index"
5
+ }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  const computedBehavior = require('miniprogram-computed').behavior
2
- import { rpxToVmin } from '../../common/utils/index.js'
3
- import Dialog from '@vant/weapp/dialog/dialog';
2
+ import { rpxToVmin } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/index.js'
3
+ import Dialog from '@vant/weapp/dialog/dialog'
4
4
 
5
5
  // 奖励icon配置
6
6
  const reward_config = {
@@ -32,42 +32,42 @@ Component({
32
32
  * 组件的属性列表
33
33
  */
34
34
  properties: {
35
- showPopup:{
35
+ showPopup: {
36
36
  type: Boolean,
37
- value: false
37
+ value: false,
38
38
  },
39
39
  popPosition: {
40
40
  type: String,
41
- value: 'bottom'
41
+ value: 'bottom',
42
42
  },
43
43
  orientation: {
44
44
  type: String,
45
- value: 'hor'
45
+ value: 'hor',
46
46
  },
47
47
  // 当前打开弹窗的任务
48
48
  quiz_task_item: {
49
49
  type: Object,
50
- value: {}
50
+ value: {},
51
51
  },
52
52
  // 当前任务的参与结果
53
53
  join_result: {
54
54
  type: Object,
55
- value: {}
55
+ value: {},
56
56
  },
57
57
  // 当前答题数组
58
58
  show_quiz_list: {
59
59
  type: Array,
60
- value: []
60
+ value: [],
61
61
  },
62
62
  // 当前查看解析的答题数组
63
63
  show_quiz_analysis_list: {
64
64
  type: Array,
65
- value: []
65
+ value: [],
66
66
  },
67
67
  // 整个任务列表数据
68
68
  task_list: {
69
69
  type: Array,
70
- value: []
70
+ value: [],
71
71
  },
72
72
  // 是否是结果解析
73
73
  showAnalysis: {
@@ -77,8 +77,8 @@ Component({
77
77
  // 是否全屏互动
78
78
  isFull: {
79
79
  type: Boolean,
80
- value: false
81
- }
80
+ value: false,
81
+ },
82
82
  },
83
83
 
84
84
  /**
@@ -92,7 +92,9 @@ Component({
92
92
  computed: {
93
93
  customStyle({ popPosition, orientation }) {
94
94
  const position = `position: ${orientation === 'ver' ? 'fixed' : 'absolute'}; left: 0; bottom: 0`
95
- return popPosition === "bottom" ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});` : "height: 100%;width: 100vmin;border-radius: 0;"
95
+ return popPosition === 'bottom'
96
+ ? `${position}; width: ${orientation === 'ver' ? '100%' : ''}; height: calc(100% - ${rpxToVmin(422)});`
97
+ : 'height: 100%;width: 100vmin;border-radius: 0;'
96
98
  },
97
99
  // 奖励图标
98
100
  rewardIcon({ quiz_task_item }) {
@@ -116,22 +118,25 @@ Component({
116
118
  observers: {
117
119
  showPopup(val) {
118
120
  if (val) {
119
- this.setData({
120
- currentIndex: 0,
121
- total: this.data.show_quiz_list.length,
122
- quizList: this.data[this.data.showAnalysis ? 'show_quiz_analysis_list' : 'show_quiz_list'],
123
- }, ()=> {
124
- console.error('jer=========进入弹窗', this.data);
125
- })
121
+ this.setData(
122
+ {
123
+ currentIndex: 0,
124
+ total: this.data.show_quiz_list.length,
125
+ quizList: this.data[this.data.showAnalysis ? 'show_quiz_analysis_list' : 'show_quiz_list'],
126
+ },
127
+ () => {
128
+ console.error('jer=========进入弹窗', this.data)
129
+ },
130
+ )
126
131
  }
127
- }
132
+ },
128
133
  },
129
134
  /**
130
135
  * 组件的方法列表
131
136
  */
132
137
  methods: {
133
- closePop(){
134
- this.triggerEvent("closePop")
138
+ closePop() {
139
+ this.triggerEvent('closePop')
135
140
  this.setData({
136
141
  currentIndex: 0,
137
142
  total: 0,
@@ -140,15 +145,15 @@ Component({
140
145
  },
141
146
  // 答题顺序恐惧
142
147
  handleQuizOrder(e) {
143
- let currentIndex = this.data.currentIndex;
148
+ let currentIndex = this.data.currentIndex
144
149
  switch (e.currentTarget.dataset.type) {
145
- case "prev":
146
- currentIndex--;
147
- break;
148
- case "next":
149
- currentIndex++;
150
- break;
151
- case "submit":
150
+ case 'prev':
151
+ currentIndex--
152
+ break
153
+ case 'next':
154
+ currentIndex++
155
+ break
156
+ case 'submit':
152
157
  Dialog.confirm({
153
158
  context: this,
154
159
  closeOnClickOverlay: false,
@@ -159,74 +164,73 @@ Component({
159
164
  confirmButtonColor: '#1472FF',
160
165
  zIndex: 501,
161
166
  })
162
- .then(() => {
163
- // 处理获取题目id和答案id
164
- let params = this.data.quizList.map((item) => {
165
- // 获取用户选择的答案
166
- let userAnswer = [];
167
- for (let index = 0; index < item.options.length; index++) {
168
- const ele = item.options[index];
169
- if (ele.selected) {
170
- userAnswer.push(ele.op_id);
167
+ .then(() => {
168
+ // 处理获取题目id和答案id
169
+ let params = this.data.quizList.map((item) => {
170
+ // 获取用户选择的答案
171
+ let userAnswer = []
172
+ for (let index = 0; index < item.options.length; index++) {
173
+ const ele = item.options[index]
174
+ if (ele.selected) {
175
+ userAnswer.push(ele.op_id)
176
+ }
177
+ }
178
+ return {
179
+ qs_id: item.qs_id,
180
+ op_id: userAnswer,
171
181
  }
182
+ })
183
+ // 获取列表中当前任务是否结束了,兼容提交前端校验
184
+ const taskFindItem = this.data.task_list.find((item) => item.id === this.data.quiz_task_item.id) || {}
185
+ if (taskFindItem.state === 2) {
186
+ this.closePop()
187
+ wx.showToast({
188
+ title: '当前答题已结束,无法继续提交',
189
+ icon: 'none',
190
+ duration: 1000,
191
+ })
192
+ return
172
193
  }
173
- return {
174
- qs_id: item.qs_id,
175
- op_id: userAnswer,
176
- };
177
- });
178
- // 获取列表中当前任务是否结束了,兼容提交前端校验
179
- const taskFindItem =
180
- this.data.task_list.find(
181
- (item) => item.id === this.data.quiz_task_item.id
182
- ) || {};
183
- if (taskFindItem.state === 2) {
184
- this.closePop()
185
- wx.showToast({
186
- title: '当前答题已结束,无法继续提交',
187
- icon: 'none',
188
- duration: 1000,
194
+ // 存储用户答案,用于接口请求参数
195
+ // 调用完成任务接口
196
+ this.triggerEvent('commonFulfilTasks', {
197
+ user_answer: params,
198
+ ids: [this.data.quiz_task_item.id],
199
+ taskItem: this.data.quiz_task_item,
189
200
  })
190
- return;
191
- }
192
- // 存储用户答案,用于接口请求参数
193
- // 调用完成任务接口
194
- this.triggerEvent("commonFulfilTasks", {
195
- user_answer: params,
196
- ids: [this.data.quiz_task_item.id],
197
- taskItem: this.data.quiz_task_item,
198
201
  })
199
- })
200
- .catch((err) => {
201
- // 暂无操作
202
- });
203
- break;
202
+ .catch((err) => {
203
+ // 暂无操作
204
+ })
205
+ break
204
206
 
205
207
  default:
206
- break;
208
+ break
207
209
  }
208
210
  this.setData({ currentIndex })
209
211
  },
210
212
  // 点击选项进行操作答题
211
213
  clickOption(e) {
212
214
  const index = e.detail
213
- console.error('jer=============选择11111', index);
214
- const tempQuizItem =
215
- this.data.quizList[this.data.currentIndex];
215
+ console.error('jer=============选择11111', index)
216
+ const tempQuizItem = this.data.quizList[this.data.currentIndex]
216
217
  // 多选题
217
218
  if (tempQuizItem.qs_type === 1) {
218
219
  tempQuizItem.options[index].selected = !tempQuizItem.options[index].selected
219
220
  } else {
220
221
  for (let i = 0; i < tempQuizItem.options.length; i++) {
221
- tempQuizItem.options[i].selected = false;
222
+ tempQuizItem.options[i].selected = false
222
223
  }
223
- tempQuizItem.options[index].selected = true;
224
+ tempQuizItem.options[index].selected = true
224
225
  }
225
- this.setData({
226
- quizList: this.data.quizList
227
- }, ()=> {
228
- console.error('jer============更改之后的数组', this.data.quizList);
229
- })
226
+ this.setData(
227
+ {
228
+ quizList: this.data.quizList,
229
+ },
230
+ () => {
231
+ console.error('jer============更改之后的数组', this.data.quizList)
232
+ },
233
+ )
230
234
  },
231
- }
232
- })
235
+ },
236
+ })
@@ -1,54 +1,53 @@
1
- import { scatterRequest } from '../../common/utils/tool';
1
+ import { scatterRequest } from '../../npm-compoent/miniprogram_npm/xiaoe_mp_npm/common/utils/tool.js'
2
2
  Component({
3
-
4
3
  /**
5
4
  * 组件的属性列表
6
5
  */
7
6
  properties: {
8
- showPopup:{
7
+ showPopup: {
9
8
  type: Boolean,
10
- value: false
9
+ value: false,
11
10
  },
12
11
  // 任务列表中进行中的答题任务
13
12
  quiz_task_start_list: {
14
13
  type: Object,
15
- value: {}
14
+ value: {},
16
15
  },
17
16
  // 直播间人次
18
17
  viewCount: {
19
18
  type: Number,
20
- value: 0
21
- }
19
+ value: 0,
20
+ },
22
21
  },
23
22
 
24
23
  /**
25
24
  * 组件的初始数据
26
25
  */
27
26
  data: {
28
- btnLock: false
27
+ btnLock: false,
29
28
  },
30
29
 
31
30
  /**
32
31
  * 组件的方法列表
33
32
  */
34
33
  methods: {
35
- closePop(){
36
- this.triggerEvent("closePop")
34
+ closePop() {
35
+ this.triggerEvent('closePop')
37
36
  this.setData({ btnLock: false })
38
37
  },
39
38
  quizHandle() {
40
- if (this.data.btnLock) return;
39
+ if (this.data.btnLock) return
41
40
  this.setData({ btnLock: true })
42
41
  scatterRequest(
43
42
  // 随机条件
44
43
  () => {
45
- let delay = 0;
44
+ let delay = 0
46
45
  if (this.data.viewCount > 10000) {
47
46
  // pv: 10000,则0-3秒随机打散
48
- const randomDelay = Math.random();
49
- delay = Math.ceil(randomDelay * 3000); // 转换为毫秒
47
+ const randomDelay = Math.random()
48
+ delay = Math.ceil(randomDelay * 3000) // 转换为毫秒
50
49
  }
51
- return delay;
50
+ return delay
52
51
  },
53
52
  // 打散配置
54
53
  {
@@ -58,22 +57,18 @@ Component({
58
57
  async () => {
59
58
  if (this.data.quiz_task_start_list.length === 1) {
60
59
  // 如果只有一个拉起答题
61
- this.triggerEvent("openRelatedPop",
62
- {
63
- quiz_task_item: this.data.quiz_task_start_list[0],
64
- show_quiz_popup: true,
65
- }
66
- )
60
+ this.triggerEvent('openRelatedPop', {
61
+ quiz_task_item: this.data.quiz_task_start_list[0],
62
+ show_quiz_popup: true,
63
+ })
67
64
  } else if (this.data.quiz_task_start_list.length > 1) {
68
- this.triggerEvent("openRelatedPop",
69
- {
70
- show_task_popup: true,
71
- }
72
- )
65
+ this.triggerEvent('openRelatedPop', {
66
+ show_task_popup: true,
67
+ })
73
68
  }
74
- this.closePop();
75
- }
76
- );
77
- }
78
- }
79
- })
69
+ this.closePop()
70
+ },
71
+ )
72
+ },
73
+ },
74
+ })