common.js
985 Bytes
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
import Service from './service'
import { API_HOST} from '../../../libs/config';
// import Promise from '../../../vendors/es6-promise';
class CommonService extends Service {
constructor() {
super();
}
addWechatFormId(data) {
return this._get(API_HOST, Object.assign({
method: 'wechat.formId.add'
}, data))
}
getResourceCode(content_code) {
let param = {
content_code
}
let self = this;
return new Promise(function(resolve,reject) {
self._get(API_HOST + '/operations/api/v5/resource/get', param)
.then(json => {
if (json && json.code == 200 && json.data && json.data[0] && json.data[0].data && json.data[0].data.list && json.data[0].data.list[0] && json.data[0].data.list[0].src ) {
resolve(json.data[0].data.list[0])
} else {
reject(json)
}
})
.catch(error => {
reject(error)
})
})
}
}
export default CommonService;