|
@@ -30,7 +30,7 @@ export default class NetService extends Service {
|
|
|
* @param params 接口参数
|
|
* @param params 接口参数
|
|
|
*/
|
|
*/
|
|
|
upload(url: string, params: Any, timeout = 0): Promise<NetResult> {
|
|
upload(url: string, params: Any, timeout = 0): Promise<NetResult> {
|
|
|
- return this.fetch('/api' + url, { method: 'POST', headers: { Authorization: this.tokenService.token }, body: params }, timeout)
|
|
|
|
|
|
|
+ return this.fetch('/api' + url, { method: 'POST', body: params }, timeout)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -58,42 +58,6 @@ export default class NetService extends Service {
|
|
|
return this.fetch('/api' + url, { method: 'put', body: JSON.stringify(params) }, timeout)
|
|
return this.fetch('/api' + url, { method: 'put', body: JSON.stringify(params) }, timeout)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取唯一序列ID
|
|
|
|
|
- * @param type 类型
|
|
|
|
|
- */
|
|
|
|
|
- async fetchId(type: IDTypes) {
|
|
|
|
|
- // const { success, data } = await this.get('/form/v3/source/id/' + type)
|
|
|
|
|
- const { success, data } = await this.get('/form/v3/source/table/id/' + type)
|
|
|
|
|
- if (success && data) {
|
|
|
|
|
- return data as string
|
|
|
|
|
- }
|
|
|
|
|
- return null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /** token 续期 */
|
|
|
|
|
- async refresh() {
|
|
|
|
|
- this.put('/upms/v3/auth/check_token').catch(e => { })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 表单api接口
|
|
|
|
|
- * @param url 接口地址
|
|
|
|
|
- */
|
|
|
|
|
- dataForm(options: { method: string, url: string, headers: { [key: string]: Any }, params: { [key: string]: Any } }, timeout = 6000): Promise<NetResult> {
|
|
|
|
|
- if (!options.url.startsWith('/api')) {
|
|
|
|
|
- options.url = '/api' + options.url
|
|
|
|
|
- }
|
|
|
|
|
- return this.fetch(options.url + '?' + (options.params ? Object.keys(options.params).map((obj: string) => `${obj}=${options.params[obj]}`).join('&') : ''), {
|
|
|
|
|
- method: options.method,
|
|
|
|
|
- headers: {
|
|
|
|
|
- ...options.headers,
|
|
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
|
- Authorization: this.tokenService.token
|
|
|
|
|
- },
|
|
|
|
|
- body: options.method == 'GET' ? undefined : JSON.stringify(options.params)
|
|
|
|
|
- }, timeout)
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* fetch
|
|
* fetch
|