riku
2024-08-14 f2a0ea849099f49a3d2a9c7e5c44d033df22468f
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
45
46
47
48
49
50
51
52
53
54
import { fetchNews } from '../../services/news/fetchNews';
import { openDoc } from '../../utils/file';
 
/**
 * 守法培训和执法动态相关信息获取逻辑
 */
export const useNews = Behavior({
  data: {
    trainingList: [],
    infoList: [],
  },
  methods: {
    // 执法动态
    _enforcementNews(page) {
      const sceneTypeId = this.data.sceneTypeValue[0];
      return fetchNews({
        page: page,
        data: { fileType: 1, sceneTypeId },
      }).then(res => {
        this.setData({
          infoList: page == 1 ? res.data : this.data.infoList.concat(res.data),
        });
        return res.head;
      });
    },
 
    // 守法培训
    _complianceTraining(page) {
      const sceneTypeId = this.data.sceneTypeValue[0];
      return fetchNews({
        per_page: 5,
        data: { fileType: 4, sceneTypeId },
      }).then(res => {
        this.setData({
          trainingList: res.data,
        });
        return res.head;
      });
    },
 
    // 跳转执法动态详情界面
    navToInfoPage(e) {
      let { url, fileType } = e.detail;
      switch (fileType) {
        // office文档
        case 1:
          openDoc(url);
          break;
        default:
          break;
      }
    },
  },
});