@conecli/cone-render 0.8.17 → 0.8.18-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -0
- package/dist/service/http/const.ts +1 -0
- package/dist/service/http/http.jd.ts +1 -0
- package/dist/service/http/http.ts +1 -0
- package/dist/service/http/httpInterceptors.jd.ts +1 -0
- package/dist/service/http/httpInterceptors.ts +1 -0
- package/dist/service/http/index.ts +1 -0
- package/package.json +1 -1
package/dist/open/api/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import * as device from './device'
|
|
1
|
+
import * as device from './device'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export enum ShopMemberCardNodeType {
|
|
2
|
|
|
1
3
|
CARD_BANNER = "shopMemberCardVenderCardBanner",
|
|
2
4
|
|
|
3
5
|
CARD_NAME = "shopMemberCardVenderCardName",
|
|
4
6
|
|
|
5
7
|
MEMBERSHIP_LEVEL = "shopMemberCardMembershipLevel",
|
|
6
8
|
|
|
7
9
|
MEMBERSHIP_RULE_ENTRANCE = "shopMemberCardMembershipRuleEntrance",
|
|
8
10
|
|
|
9
11
|
MEMBERSHIP_POINT = "shopMemberCardMembershipPoint"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const HttpStatus = {
|
|
2
|
SUCCESS: 200,
|
|
1
3
|
CREATED: 201,
|
|
2
4
|
ACCEPTED: 202,
|
|
3
5
|
CLIENT_ERROR: 400,
|
|
4
6
|
AUTHENTICATE: 401,
|
|
5
7
|
FORBIDDEN: 403,
|
|
6
8
|
NOT_FOUND: 404,
|
|
7
9
|
SERVER_ERROR: 500,
|
|
8
10
|
BAD_GATEWAY: 502,
|
|
9
11
|
SERVICE_UNAVAILABLE: 503,
|
|
10
12
|
GATEWAY_TIMEOUT: 504
|
|
11
13
|
[HttpStatus.NOT_FOUND]: "请求资源不存在",
|
|
12
14
|
[HttpStatus.BAD_GATEWAY]: "服务端异常,请稍后重试",
|
|
13
15
|
[HttpStatus.FORBIDDEN]: "没有权限访问",
|
|
14
16
|
[HttpStatus.AUTHENTICATE]: "需要鉴权",
|
|
15
17
|
[HttpStatus.SUCCESS]: "成功"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import HttpBase from './http'
|
|
2
|
constructor() {
|
|
1
3
|
super()
|
|
2
4
|
}
|
|
3
5
|
|
|
4
6
|
request({url, timeout = 7000, ...otherOptions}): any {
|
|
5
7
|
const requestTask = super.request({url, timeout, ...otherOptions})
|
|
6
8
|
const requestTimeoutPromise =
|
|
7
9
|
new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
|
|
8
10
|
setTimeout(() => {
|
|
9
11
|
resolve({
|
|
10
12
|
statusCode: 500,
|
|
11
13
|
resTimeoutState: true,
|
|
12
14
|
errMsg: 'request timeout',
|
|
13
15
|
})
|
|
14
16
|
}, timeout)
|
|
15
17
|
})
|
|
16
18
|
return Promise.race([requestTask, requestTimeoutPromise]).then(
|
|
17
19
|
(res: ServiceInterFace.RequestPromiseRes) => {
|
|
18
20
|
if (res && res.statusCode === 500 && res.resTimeoutState) {
|
|
19
21
|
console.log('request 请求超时 url:' + url)
|
|
20
22
|
requestTask.abort()
|
|
21
23
|
}
|
|
22
24
|
return res
|
|
23
25
|
}
|
|
24
26
|
)
|
|
25
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro, { RequestTask } from "@tarojs/taro";
|
|
2
|
jsonHeader = "application/json;charset=utf-8",
|
|
1
3
|
formDataHeader = "application/x-www-form-urlencoded"
|
|
2
4
|
constructor() {
|
|
3
5
|
this._init()
|
|
4
6
|
}
|
|
5
7
|
_init(): void {
|
|
6
8
|
httpInterceptors.forEach((item) => {
|
|
7
9
|
Taro.addInterceptor((chain) => item(chain))
|
|
8
10
|
})
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
get(url: string, data: any = null, otherOptions = {}): Taro.RequestTask<any> {
|
|
12
14
|
return this.request({url, data, method:"GET", ...otherOptions})
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
post(
|
|
16
18
|
url: string,
|
|
17
19
|
data: any = null,
|
|
18
20
|
otherOptions = {}
|
|
19
21
|
): Taro.RequestTask<any> {
|
|
20
22
|
return this.request({url, data, method:"POST", ...otherOptions})
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
request({url, method = "POST", timeout = 7000, ...otherOptions}): RequestTask<any> {
|
|
24
26
|
const header = {
|
|
25
27
|
"content-type": method === "POST" ? RequestHeaderContentType.formDataHeader : RequestHeaderContentType.jsonHeader
|
|
26
28
|
}
|
|
27
29
|
return Taro.request({
|
|
28
30
|
url,
|
|
29
31
|
method,
|
|
30
32
|
timeout,
|
|
31
33
|
header,
|
|
32
34
|
credentials: 'include',
|
|
33
35
|
...otherOptions,
|
|
34
36
|
})
|
|
35
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Http from './http'
|