actions.js
5.63 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import * as Types from './types';
export default {
async fetchEshops({commit}) {
commit(Types.FETCH_ESHOPS_REQUEST);
const result = await this.$api.get('/getAuthAppList', {
page: 1,
limit: 100
});
if (result && result.code === 200) {
commit(Types.FETCH_ESHOPS_SUCCESS, result);
} else {
commit(Types.FETCH_ESHOPS_FAILD, { message: result && result.message });
}
},
async fetchAuthUrl() {
return await this.$api.get('/getAuthUrl?appId=123&type=1');
},
async fetchToken() {
const result = await this.$api.get('/getComponentAccessToken');
if (result && result.code === 200) {
return result.data;
}
},
async fetchShopToken(action, {appid}) {
const result = await this.$api.get('/getAuthorizerAccessToken', {
authAppId: appid
});
if (result && result.code === 200) {
return result.data;
}
},
async fetchWxGetDraftList({dispatch}) {
const token = await dispatch('fetchToken');
return await this.$nodeApi.post('/wx', {
url: `/wxa/gettemplatedraftlist?access_token=${token}`
});
},
async fetchWxAddToTemplate({dispatch}, {draft_id}) {
const token = await dispatch('fetchToken');
return await this.$nodeApi.post('/wx', {
url: `/wxa/addtotemplate?access_token=${token}`,
method: 'post',
params: {
draft_id
}
});
},
async fetchWxCommit({dispatch}, payload) {
const token = await dispatch('fetchShopToken', {appid: payload.authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/commit?access_token=${token}`,
method: 'post',
params: {
template_id: payload.template,
ext_json: JSON.stringify({
extAppid: payload.authAppId,
ext: {
extAppid: payload.authAppId,
miniappType: payload.miniappType,
miniappName: payload.authAppName
}
}),
user_version: payload.version,
user_desc: payload.desc,
}
});
},
async fetchWxSend({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/get_category?access_token=${token}`
});
},
async fetchWxAuditStatus({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/get_latest_auditstatus?access_token=${token}`
});
},
async fetchWxGetVersion({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
method: 'post',
url: `/cgi-bin/wxopen/getweappsupportversion?access_token=${token}`,
params: {}
});
},
async fetchWxGetCategory({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/get_category?access_token=${token}`
});
},
async fetchWxGetQrcode({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/get_qrcode?access_token=${token}`
}, {
responseType: 'blob'
});
},
async fetchWxGetPage({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/get_page?access_token=${token}`
});
},
async fetchWxGetTemplateList({dispatch}) {
const token = await dispatch('fetchToken');
return await this.$nodeApi.post('/wx', {
url: `/wxa/gettemplatelist?access_token=${token}`
});
},
async fetchWxBindTester({dispatch}, {authAppId, wechatid}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/bind_tester?access_token=${token}`,
method: 'post',
params: {
wechatid
}
});
},
async fetchWxSubmitAudit({dispatch}, {authAppId, item}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/submit_audit?access_token=${token}`,
method: 'post',
params: {
item_list: [item]
}
});
},
async modifyDomains({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/modify_domain?access_token=${token}`,
method: 'post',
params: {
action: 'set',
requestdomain: [
'https://api.yoho.cn',
'https://analysis.yohobuy.com'
],
downloaddomain: [
'https://api.yoho.cn',
'https://cdn.yoho.cn',
'https://www.fapiao.com'
]
}
});
},
async setWebviewDomains({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/setwebviewdomain?access_token=${token}`,
method: 'post',
params: {
action: 'set',
webviewdomain: [
'https://m.yohobuy.com',
'https://union.yoho.cn',
'https://ad.yoho.cn',
'https://activity.yoho.cn',
'https://action.yoho.cn',
'https://feature.yoho.cn'
]
}
});
},
async fetchWxRelease({dispatch}, {authAppId}) {
const token = await dispatch('fetchShopToken', {appid: authAppId});
return await this.$nodeApi.post('/wx', {
url: `/wxa/release?access_token=${token}`,
method: 'post',
params: {}
});
}
};