Blame view

src/views/examinationPaper/index.vue 13.2 KB
4c4f7640   梁保满   路由表,路由前端文件
1
2
  <template>
    <div>
d4283687   梁保满   首页布局完成,页面顶部返回组件
3
4
      <back-box>
        <template slot="title">
d4283687   梁保满   首页布局完成,页面顶部返回组件
5
6
7
          <span>备题组卷</span>
        </template>
        <template slot="btns">
aeac66d4   阿宝   飞书测试bug
8
9
10
          <el-button type="primary" size="mini" icon="el-icon-plus" plain @click="toAdd({})">
            添加答题卡</el-button
          >
d4283687   梁保满   首页布局完成,页面顶部返回组件
11
12
        </template>
      </back-box>
65f592b6   梁保满   答题卡列表页
13
14
15
  
      <div class="answer-header">
        <div class="sel-box">
ee6e7628   梁保满   备题组卷借口数据对接调整
16
17
18
19
20
          <el-select
            class="sel"
            v-model="query.classId"
            placeholder="选择班级"
            @change="changClazz"
65f592b6   梁保满   答题卡列表页
21
          >
ee6e7628   梁保满   备题组卷借口数据对接调整
22
23
24
25
26
27
28
29
            <el-option
              v-for="item in classList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
65f592b6   梁保满   答题卡列表页
30
31
          <el-select
            class="sel"
ee6e7628   梁保满   备题组卷借口数据对接调整
32
            v-model="query.subjectName"
65f592b6   梁保满   答题卡列表页
33
34
35
36
37
38
39
40
41
42
43
44
45
            placeholder="选择科目"
            @change="_QueryData()"
          >
            <el-option
              v-for="item in subjectList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <el-select
            class="sel"
ee6e7628   梁保满   备题组卷借口数据对接调整
46
            v-model="query.tagId"
65f592b6   梁保满   答题卡列表页
47
48
49
50
51
            placeholder="选择类型"
            @change="_QueryData()"
          >
            <el-option
              v-for="item in typeList"
5424ef82   梁保满   接口调整
52
              :key="item.label"
ee6e7628   梁保满   备题组卷借口数据对接调整
53
54
              :label="item.label"
              :value="item.value"
5424ef82   梁保满   接口调整
55
              >{{ item.label }}
65f592b6   梁保满   答题卡列表页
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
            </el-option>
          </el-select>
          <el-input
            placeholder="试卷名称"
            v-model="query.title"
            class="input-with-select"
            @keyup.enter.native="_QueryData(true)"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="_QueryData(true)"
            ></el-button>
          </el-input>
        </div>
d4283687   梁保满   首页布局完成,页面顶部返回组件
71
      </div>
f26ecfa4   阿宝   测试bug
72
      <p class="tips" v-show="archivedTotal">
ee6e7628   梁保满   备题组卷借口数据对接调整
73
        <span>另有{{ archivedTotal }}份已经归档的答题卡,</span>
65f592b6   梁保满   答题卡列表页
74
75
        <router-link to="/examinationPaperRecycle">点击查看&gt;&gt;</router-link>
      </p>
f26ecfa4   阿宝   测试bug
76
      <ul class="content" v-if="tableData && tableData.length">
65f592b6   梁保满   答题卡列表页
77
78
79
80
81
82
83
        <li class="item" v-for="item in tableData" :key="item.id">
          <div class="pic-box">
            <p class="i-box"><i class="fa fa-map-o"></i></p>
            <p class="ids">{{ item.id }}</p>
          </div>
          <div class="info">
            <p class="title">
f26ecfa4   阿宝   测试bug
84
85
              {{ item.title }}
              <span class="label" v-if="!!item.tag">{{ item.tag }}</span>
65f592b6   梁保满   答题卡列表页
86
87
            </p>
            <p class="num">
ee6e7628   梁保满   备题组卷借口数据对接调整
88
              总题数:{{ item.questionNum }}
65f592b6   梁保满   答题卡列表页
89
              <em class="s-line">|</em>
ee6e7628   梁保满   备题组卷借口数据对接调整
90
              预计时长:{{ item.examsDuration }}
65f592b6   梁保满   答题卡列表页
91
92
93
94
              <em class="s-line">|</em>
              授课端同步:
              <span
                class="clazz"
ee6e7628   梁保满   备题组卷借口数据对接调整
95
96
                v-for="(clazzChild, indexs) in item.classList"
                :key="clazzChild.classId"
65f592b6   梁保满   答题卡列表页
97
                >{{
5424ef82   梁保满   接口调整
98
                  `${clazzChild.className}${
f26ecfa4   阿宝   测试bug
99
                    indexs != item.classList.length - 1 ? "、" : ""
65f592b6   梁保满   答题卡列表页
100
101
                  }`
                }}
75a5cc20   阿宝   测试用逻辑删除
102
                <i v-if="clazzChild.keepStatus == 1" class="el-icon-success"></i
65f592b6   梁保满   答题卡列表页
103
104
105
              ></span>
            </p>
            <p class="person">
ee6e7628   梁保满   备题组卷借口数据对接调整
106
107
              {{ item.realName }}<em class="s-line">|</em
              ><span class="date">{{ item.modifiedTime }}</span>
65f592b6   梁保满   答题卡列表页
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
            </p>
          </div>
          <div class="btn-box">
            <el-tooltip effect="dark" content="修改答案" placement="bottom">
              <el-button
                class="edit"
                type="primary"
                size="mini"
                circle
                icon="el-icon-edit"
                @click="toEdit(item)"
              ></el-button>
            </el-tooltip>
            <el-dropdown
              trigger="click"
              @command="handleDropdownClick($event, item)"
            >
              <el-button
                type="info"
                size="mini"
                circle
                icon="el-icon-more"
              ></el-button>
              <el-dropdown-menu slot="dropdown">
8f573b82   阿宝   组卷接口联调
132
                <el-dropdown-item :command="1" v-if="userName == item.realName"
ee6e7628   梁保满   备题组卷借口数据对接调整
133
134
                  >修改分享范围</el-dropdown-item
                >
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
135
136
                <el-dropdown-item :command="2">复制</el-dropdown-item>
                <el-dropdown-item :command="3">归档</el-dropdown-item>
65f592b6   梁保满   答题卡列表页
137
138
139
140
141
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </li>
      </ul>
f26ecfa4   阿宝   测试bug
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
      <div class="pagination-box">
        <el-pagination
          small=""
          layout="total,prev, pager, next"
          :hide-on-single-page="true"
          :total="total"
          @current-change="changePage"
          :current-page="page"
          :page-size="size"
        >
        </el-pagination>
      </div>
      <el-empty
        v-if="!loading && tableData.length == 0"
        content="没有更多数据"
        :image-size="100"
      ></el-empty>
65f592b6   梁保满   答题卡列表页
159
160
      <el-dialog title="选择分享范围" :visible.sync="dialogVisible" width="400">
        <el-form :model="shareForm" :rules="shareRulesForm" label-width="160px">
65f592b6   梁保满   答题卡列表页
161
          <el-form-item prop="share" label="分享范围:">
8f573b82   阿宝   组卷接口联调
162
163
164
            <el-radio-group v-model="shareForm.sharingType">
              <el-radio :label="0">任课班级分享</el-radio>
              <el-radio :label="1">全年级分享</el-radio>
65f592b6   梁保满   答题卡列表页
165
166
167
168
169
170
171
172
            </el-radio-group>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="saveShare">确 定</el-button>
          <el-button @click="dialogVisible = false">取 消</el-button>
        </div>
      </el-dialog>
4c4f7640   梁保满   路由表,路由前端文件
173
174
175
176
177
    </div>
  </template>
  
  <script>
  export default {
d4283687   梁保满   首页布局完成,页面顶部返回组件
178
    name: "examinationPaper",
65f592b6   梁保满   答题卡列表页
179
180
    data() {
      return {
f26ecfa4   阿宝   测试bug
181
        loading: false,
8f573b82   阿宝   组卷接口联调
182
        userName: "",
65f592b6   梁保满   答题卡列表页
183
184
        dialogVisible: false,
        query: {
ee6e7628   梁保满   备题组卷借口数据对接调整
185
186
187
          classId: "",
          subjectName: "",
          tagId: "",
65f592b6   梁保满   答题卡列表页
188
189
          title: "",
        },
ee6e7628   梁保满   备题组卷借口数据对接调整
190
191
192
193
        classList: [],
        subjectList: [],
        typeList: [],
        archivedTotal: 0, //已归档答题卡数量
f26ecfa4   阿宝   测试bug
194
        tableData: null,
65f592b6   梁保满   答题卡列表页
195
196
        shareForm: {
          id: "",
f26ecfa4   阿宝   测试bug
197
          sharingType: 1, //0-任课班级/1-全年级
65f592b6   梁保满   答题卡列表页
198
199
        },
        shareRulesForm: {
f26ecfa4   阿宝   测试bug
200
201
202
          sharingType: [
            { required: true, message: "选择分享范围", trigger: "blur" },
          ],
65f592b6   梁保满   答题卡列表页
203
        },
f26ecfa4   阿宝   测试bug
204
        total: 0,
ee6e7628   梁保满   备题组卷借口数据对接调整
205
206
        page: 1,
        size: 20,
65f592b6   梁保满   答题卡列表页
207
208
      };
    },
ee6e7628   梁保满   备题组卷借口数据对接调整
209
    async created() {
8f573b82   阿宝   组卷接口联调
210
      this.userName = this.$store.getters.info.name || "";
ee6e7628   梁保满   备题组卷借口数据对接调整
211
212
213
214
215
      await this._QueryClassList();
      await this._QuerySubjectList();
      this._QueryData();
      this._QueryTypeList();
    },
65f592b6   梁保满   答题卡列表页
216
217
    methods: {
      toAdd(query) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
218
        let routerItem = {
65f592b6   梁保满   答题卡列表页
219
          path: "/examinationPaperAdd",
13b58a42   梁保满   备题组卷部分前端页面基本完成
220
221
222
        };
        query ? (routerItem["query"] = { ...query }) : "";
        this.$router.push(routerItem);
65f592b6   梁保满   答题卡列表页
223
224
225
226
227
      },
      toEdit(item) {
        this.$router.push({
          path: "/examinationPaperEdit",
          query: {
ee6e7628   梁保满   备题组卷借口数据对接调整
228
            paperId: item.id,
65f592b6   梁保满   答题卡列表页
229
230
231
          },
        });
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
232
233
      handleDropdownClick(value, item) {
        //更多
65f592b6   梁保满   答题卡列表页
234
235
236
        const that = this;
        switch (value) {
          case 1:
65f592b6   梁保满   答题卡列表页
237
238
            //修改分享范围
            that.shareForm.id = item.id;
8f573b82   阿宝   组卷接口联调
239
            that.shareForm.sharingType = item.sharingType || 1;
65f592b6   梁保满   答题卡列表页
240
241
            that.dialogVisible = true;
            break;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
242
          case 2:
65f592b6   梁保满   答题卡列表页
243
            //复制
ee6e7628   梁保满   备题组卷借口数据对接调整
244
            that.toAdd({ type: 2, paperId: item.id });
65f592b6   梁保满   答题卡列表页
245
            break;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
246
          case 3:
65f592b6   梁保满   答题卡列表页
247
            //归档
13b58a42   梁保满   备题组卷部分前端页面基本完成
248
            that.recovery(item);
65f592b6   梁保满   答题卡列表页
249
250
251
            break;
        }
      },
aeac66d4   阿宝   飞书测试bug
252
253
254
      changePage(page) {
        this.page = page;
        this._QueryData(this.query.title);
f26ecfa4   阿宝   测试bug
255
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
256
257
      async saveShare() {
        //修改分享范围
6fffbd55   阿宝   组卷接口调整
258
        const { data, status, info } = await this.$request.modifyPaper({
8f573b82   阿宝   组卷接口联调
259
260
          paperId: this.shareForm.id,
          sharingType: this.shareForm.sharingType,
ee6e7628   梁保满   备题组卷借口数据对接调整
261
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
262
263
        if (status === 0) {
          this.shareForm.id = "";
8f573b82   阿宝   组卷接口联调
264
265
          this.shareForm.sharingType = 1;
          this.dialogVisible = false;
f26ecfa4   阿宝   测试bug
266
          this.$message.success(info);
aeac66d4   阿宝   飞书测试bug
267
          this._QueryData(this.query.title == "");
ee6e7628   梁保满   备题组卷借口数据对接调整
268
        } else {
6fffbd55   阿宝   组卷接口调整
269
          this.$message.error(info);
ee6e7628   梁保满   备题组卷借口数据对接调整
270
        }
65f592b6   梁保满   答题卡列表页
271
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
272
273
      async recovery(item) {
        //归档
6fffbd55   阿宝   组卷接口调整
274
        const { data, status, info } = await this.$request.modifyPaper({
ee6e7628   梁保满   备题组卷借口数据对接调整
275
276
          paperId: item.id,
          status: 2,
13b58a42   梁保满   备题组卷部分前端页面基本完成
277
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
278
279
280
281
282
        if (status === 0) {
          let type = this.query.title ? 1 : 0;
          this.page = 1;
          this._QueryData(type);
        } else {
6fffbd55   阿宝   组卷接口调整
283
          this.$message.error(info);
ee6e7628   梁保满   备题组卷借口数据对接调整
284
        }
65f592b6   梁保满   答题卡列表页
285
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
286
287
      //切换班级
      async changClazz() {
65f592b6   梁保满   答题卡列表页
288
        await this._QuerySubjectList();
ee6e7628   梁保满   备题组卷借口数据对接调整
289
        this._QueryData(false);
65f592b6   梁保满   答题卡列表页
290
      },
65f592b6   梁保满   答题卡列表页
291
292
      // 查找答题卡类型
      async _QueryTypeList() {
6fffbd55   阿宝   组卷接口调整
293
        const { data, status, info } = await this.$request.fetchTypeNames({
5424ef82   梁保满   接口调整
294
          classId: this.query.classId,
f26ecfa4   阿宝   测试bug
295
          type: 0,
5424ef82   梁保满   接口调整
296
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
297
298
        if (status === 0) {
          this.typeList =
5424ef82   梁保满   接口调整
299
            data.list.map((item) => {
ee6e7628   梁保满   备题组卷借口数据对接调整
300
301
302
303
304
              return {
                value: item.tagId,
                label: item.tag,
              };
            }) || [];
5424ef82   梁保满   接口调整
305
          this.typeList.unshift({
ee6e7628   梁保满   备题组卷借口数据对接调整
306
            value: "",
f26ecfa4   阿宝   测试bug
307
            label: "请选择标签",
ee6e7628   梁保满   备题组卷借口数据对接调整
308
          });
65f592b6   梁保满   答题卡列表页
309
        } else {
6fffbd55   阿宝   组卷接口调整
310
          this.$message.error(info);
65f592b6   梁保满   答题卡列表页
311
312
313
314
        }
      },
      // 查找班级
      async _QueryClassList() {
f26ecfa4   阿宝   测试bug
315
        this.loading = true;
6fffbd55   阿宝   组卷接口调整
316
        const { data, status, info } = await this.$request.fetchClassList();
f26ecfa4   阿宝   测试bug
317
        console.log(status);
ee6e7628   梁保满   备题组卷借口数据对接调整
318
        if (status === 0) {
65f592b6   梁保满   答题卡列表页
319
          if (!!data.list) {
f26ecfa4   阿宝   测试bug
320
321
322
323
324
325
326
            this.classList =
              data.list?.map((item) => {
                return {
                  value: item.classId,
                  label: item.className,
                };
              }) || [];
5424ef82   梁保满   接口调整
327
            this.query.classId = this.classList[0]?.value;
65f592b6   梁保满   答题卡列表页
328
329
          }
        } else {
6fffbd55   阿宝   组卷接口调整
330
          this.$message.error(info);
65f592b6   梁保满   答题卡列表页
331
332
333
334
        }
      },
      // 查找科目
      async _QuerySubjectList() {
6fffbd55   阿宝   组卷接口调整
335
        const { data, status, info } = await this.$request.fetchSubjectList({
5424ef82   梁保满   接口调整
336
          classId: this.query.classId,
65f592b6   梁保满   答题卡列表页
337
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
338
        if (status === 0) {
f26ecfa4   阿宝   测试bug
339
340
341
342
343
344
345
          this.subjectList =
            data.subjectNames?.map((item) => {
              return {
                value: item,
                label: item,
              };
            }) || [];
5424ef82   梁保满   接口调整
346
          this.query.subjectName = this.subjectList[0]?.value;
65f592b6   梁保满   答题卡列表页
347
        } else {
6fffbd55   阿宝   组卷接口调整
348
          this.$message.error(info);
65f592b6   梁保满   答题卡列表页
349
350
        }
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
351
      async _QueryData(type) {
f26ecfa4   阿宝   测试bug
352
        this.loading = true;
13b58a42   梁保满   备题组卷部分前端页面基本完成
353
        //获取答题卡列表
65f592b6   梁保满   答题卡列表页
354
355
356
357
358
359
        let query = {};
        if (!type) {
          this.query.title = "";
          query = { ...this.query };
        } else {
          query = { title: this.query.title };
ee6e7628   梁保满   备题组卷借口数据对接调整
360
361
          this.query.tagId = "";
          this.query.subjectName = "";
65f592b6   梁保满   答题卡列表页
362
        }
5424ef82   梁保满   接口调整
363
        query.classId = this.query.classId;
65f592b6   梁保满   答题卡列表页
364
365
366
367
368
        for (let key in query) {
          if (!query[key]) {
            query[key] = null;
          }
        }
5424ef82   梁保满   接口调整
369
        if (!query.classId) {
65f592b6   梁保满   答题卡列表页
370
371
372
373
374
375
          this.total = 0;
          this.tableData = [];
          this.loading = false;
          return;
        }
        this.loading = true;
6fffbd55   阿宝   组卷接口调整
376
        const { data, status, info } = await this.$request.fetchPaperList({
65f592b6   梁保满   答题卡列表页
377
          ...query,
ee6e7628   梁保满   备题组卷借口数据对接调整
378
          status: 1,
f356590c   阿宝   即时测列表,分析页面
379
380
          page: this.page,
          size: this.size,
65f592b6   梁保满   答题卡列表页
381
382
        });
        this.loading = false;
ee6e7628   梁保满   备题组卷借口数据对接调整
383
        if (status === 0) {
f26ecfa4   阿宝   测试bug
384
          this.archivedTotal = data.archivedTotal;
65f592b6   梁保满   答题卡列表页
385
386
387
          this.total = data.total;
          this.tableData = (data.list && [...data.list]) || [];
        } else {
6fffbd55   阿宝   组卷接口调整
388
          this.$message.error(info);
65f592b6   梁保满   答题卡列表页
389
390
391
        }
      },
    },
d4283687   梁保满   首页布局完成,页面顶部返回组件
392
  };
4c4f7640   梁保满   路由表,路由前端文件
393
394
  </script>
  
d4283687   梁保满   首页布局完成,页面顶部返回组件
395
  <style scoped lang="scss">
65f592b6   梁保满   答题卡列表页
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
  .tips {
    display: flex;
    padding-left: 30px;
    line-height: 16px;
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
  }
  .content {
    margin: 0 20px;
    background: #f8f8f8;
    padding: 12px;
    border-radius: 20px;
    .item {
      display: flex;
      align-items: center;
      width: 100%;
      overflow: hidden;
      box-sizing: border-box;
      padding: 12px;
      border-radius: 20px;
      background: #fff;
      margin-bottom: 12px;
      &:last-of-type {
        margin-bottom: 0;
      }
      .pic-box {
        width: 80px;
        height: 80px;
        border-radius: 10px;
        margin-right: 10px;
        flex-shrink: 0;
        background: #667ffd;
        text-align: center;
        color: #fff;
        font-weight: 500;
        .i-box {
          padding-top: 10px;
          font-size: 32px;
          margin-bottom: 3px;
        }
      }
      .info {
75a5cc20   阿宝   测试用逻辑删除
439
        min-height: 80px;
65f592b6   梁保满   答题卡列表页
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .s-line {
          padding: 0 5px;
          color: #e2e2e2;
        }
        .title {
          font-size: 16px;
          color: #222;
          font-weight: 500;
          .label {
            display: inline-block;
            font-size: 12px;
            color: #2e9afe;
            line-height: 16px;
            padding: 0 10px;
            border: 1px solid #2e9afe;
            border-radius: 10px;
            transform: translateY(-2px);
          }
        }
        .person {
          color: #666;
        }
      }
      .clazz {
75a5cc20   阿宝   测试用逻辑删除
469
        font-size: 14px;
65f592b6   梁保满   答题卡列表页
470
471
472
        color: #667ffd;
        font-weight: 500;
        position: relative;
8f573b82   阿宝   组卷接口联调
473
        position: relative;
f26ecfa4   阿宝   测试bug
474
        &.active:after {
8f573b82   阿宝   组卷接口联调
475
476
477
          content: "\e79c";
          color: #667ffd;
        }
65f592b6   梁保满   答题卡列表页
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
        .el-icon-success {
          position: absolute;
          right: 0;
          top: -5px;
          color: #667ffd;
        }
        &:last-of-type {
          .el-icon-success {
            right: -18px;
          }
        }
      }
      .btn-box {
        flex-shrink: 0;
        .edit {
          margin-right: 12px;
        }
      }
    }
  }
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
498
499
500
501
502
503
504
505
506
507
  .answer-header {
    .sel-box {
      .sel {
        min-width: 160px;
      }
      :deep(.el-cascader__tags) {
        flex-wrap: nowrap;
      }
    }
  }
65f592b6   梁保满   答题卡列表页
508
509
510
511
512
513
514
  .dialog-footer {
    text-align: center;
    :deep(.el-button) {
      border-radius: 20px;
      padding: 8px 20px 7px;
      margin: 0 12px;
    }
d4283687   梁保满   首页布局完成,页面顶部返回组件
515
  }
4c4f7640   梁保满   路由表,路由前端文件
516
  </style>