Blame view

src/api/oa/addNoticeViewApi.js 997 Bytes
ec9ec2ce   wuxw   开发完成物业公告问题
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
  import request from '@/utils/request'
  import { getCommunityId } from '@/api/community/communityApi'
  
  // 保存公告信息
  export function saveNotice(data) {
    return new Promise((resolve, reject) => {
      // 确保communityId存在
      if (!data.communityId) {
        data.communityId = getCommunityId()
      }
      
      request({
        url: '/notice.saveNotice',
        method: 'post',
        data
      }).then(response => {
        resolve(response.data)
      }).catch(error => {
        reject(error)
      })
    })
  }
  
  // 上传图片
  export function uploadImage(file) {
    const formData = new FormData()
    formData.append('uploadFile', file)
    formData.append('communityId', getCommunityId())
  
    return new Promise((resolve, reject) => {
      request({
        url: '/uploadImage',
        method: 'post',
        data: formData,
        headers: {
          'Content-Type': 'multipart/form-data'
        }
      }).then(response => {
        resolve(response.data)
      }).catch(error => {
        reject(error)
      })
    })
  }