riku
2026-04-02 3282e95db0207ee133d1e98d9771dec9d83b0fc4
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
55
56
57
58
59
60
/**
 * 动态配置相关数据接口
 */
 
import { get, post } from '../baseRequset';
import { parseSceneTypes, SceneTypes } from '../../common/dataSceneTypes';
const app = getApp();
 
/**
 * 获取用户可选的场景类型范围
 */
function fetchSceneTypes({ userId }) {
  return get({
    url: `/config/scene/range`,
    params: {
      userId: userId,
    },
  }).then(res => {
    if (res.data.success) {
      res.data.data = parseSceneTypes(res.data.data);
    } else {
      res.data.data = SceneTypes;
    }
    return res.data;
  });
}
 
/**
 * 获取用户的区域配置信息
 */
function fetchUserConfig({ userId }) {
  return get({
    url: `/config/user/config`,
    params: {
      userId: userId,
    },
  }).then(res => {
    if (res.data.success) {
      app.globalData.userConfig = res.data.data;
    }
  });
}
 
/**
 * 获取用户的业务属性配置信息(例如台账上报日期,自巡查是否需要承诺等)
 */
function fetchUserSetting({ userId }) {
  return get({
    url: `/config/user/setting`,
    params: {
      userId: userId,
    },
  }).then(res => {
    if (res.data.success) {
      app.globalData.userSetting = res.data.data;
    }
  });
}
 
export { fetchSceneTypes, fetchUserConfig, fetchUserSetting };