Blame view

src/api/community/communityApi.js 2.58 KB
0e3df9ef   wuxw   优化物业账号下切换小区功能
1
  import { setCommunitys,setCurrentCommunity,getCurrentCommunity } from "@/utils/vc"
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  import request from '@/utils/request'
  export function _loadCommunityInfo(_param) {
      return new Promise((resolve, reject) => {
          request({
              url: '/community.listMyEnteredCommunitys',
              method: 'get',
              params: {
                  page: 1,
                  row: 3
              }
          }).then(response => {
              const res = response.data
              let _communityInfos = res.communitys;
              if (_communityInfos && _communityInfos.length > 0) {
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
16
                  setCommunitys(_communityInfos);
c412a802   wuxw   优化采购申请
17
                  let _currentCommunity = JSON.parse(window.localStorage.getItem('hc_currentCommunityInfo'));
9bb8cd93   wuxw   优化采购模块
18
19
20
21
22
23
                  if(_currentCommunity){
                      resolve(res)
                      return ;
                  }
  
                  setCurrentCommunity(_communityInfos[0]);
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
                  if (_param && _param.communityId) {
                      let _communityId = _param.communityId;
                      _communityInfos.forEach(_c => {
                          if (_c.communityId == _communityId) {
                              setCurrentCommunity(_c);
                          }
                      })
                  }
              }
              // 获取验证码成功
              resolve(res)
          }).catch(error => {
              reject(error)
          })
      })
  }
  
  export function getDict(tableName,tableColumns) {
      return new Promise((resolve, reject) => {
          request({
              url: '/callComponent/core/list',
              method: 'get',
              params: {
                  name: tableName,
                  type: tableColumns,
                  page:1,
                  row:500
              }
          }).then(response => {
              const res = response.data
              // 获取验证码成功
              resolve(res)
          }).catch(error => {
              reject(error)
          })
      })
0e3df9ef   wuxw   优化物业账号下切换小区功能
60
61
62
63
64
65
  }
  
  export function getCommunityId() {
      return getCurrentCommunity().communityId
  }
  
0bf7e6a5   wuxw   加入问卷功能代码
66
67
68
69
70
71
  
  
  export function getCommunity() {
      return getCurrentCommunity()
  }
  
0e3df9ef   wuxw   优化物业账号下切换小区功能
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  
  
  export function getCommunityName() {
      return getCurrentCommunity().name
  }
  
  export function getMyEnteredCommunitys(_param) {
      return new Promise((resolve, reject) => {
          request({
              url: '/community.listMyEnteredCommunitys',
              method: 'get',
              params: {
                  ..._param
              }
          }).then(response => {
              const res = response.data
              // 获取验证码成功
              resolve(res)
          }).catch(error => {
              reject(error)
          })
      })
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
94
  }