riku
2024-07-26 c827d70bd16535e103f4bcdd9f3ed53a5fd324e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true,
  },
  properties: {
    index: {
      type: Number,
      value: 0,
    },
    problemList: {
      type: Array,
    },
  },
  data: {
    showPreview: false,
    previewImageUrls: [],
    previewCurrent: 0,
    previewTitle: '',
    previewRemark: '',
  },
  methods: {
    previewImage(e) {
      const { index, type } = e.currentTarget.dataset;
      const previewImageUrls = [];
      const pro = this.data.problemList[index[0]];
      if (type == 'pro') {
        pro.proPics.forEach(p => {
          previewImageUrls.push(p);
        });
      } else {
        pro.changePics.forEach(p => {
          previewImageUrls.push(p);
        });
      }
      this.setData({
        previewImageUrls,
        previewCurrent: index[1],
        showPreview: true,
        previewTitle: pro.problemname,
      });
    },
  },
});