Skip to content

Commit 3a9f8db

Browse files
committed
Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feature/bpm
# Conflicts: # src/views/bpm/processInstance/detail/index.vue
2 parents 397c09a + a283dc8 commit 3a9f8db

File tree

6 files changed

+46
-33
lines changed

6 files changed

+46
-33
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"url": "https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues"
145145
},
146146
"homepage": "https://gitee.com/yudaocode/yudao-ui-admin-vue3",
147+
"web-types": "./web-types.json",
147148
"engines": {
148149
"node": ">= 16.0.0",
149150
"pnpm": ">=8.6.0"

src/api/login/oauth2/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const authorize = (
2727
return request.post({
2828
url: '/system/oauth2/authorize',
2929
headers: {
30-
'Content-type': 'application/x-www-form-urlencoded'
30+
'Content-Type': 'application/x-www-form-urlencoded'
3131
},
3232
params: {
3333
response_type: responseType,

src/config/axios/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ import { config } from './config'
55
const { default_headers } = config
66

77
const request = (option: any) => {
8-
const { url, method, params, data, headersType, responseType, ...config } = option
8+
const { headersType, headers, ...otherOption } = option
99
return service({
10-
url: url,
11-
method,
12-
params,
13-
data,
14-
...config,
15-
responseType: responseType,
10+
...otherOption,
1611
headers: {
17-
'Content-Type': headersType || default_headers
12+
'Content-Type': headersType || default_headers,
13+
...headers
1814
}
1915
})
2016
}

src/config/axios/service.ts

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import axios, {
2-
AxiosError,
3-
AxiosInstance,
4-
AxiosRequestHeaders,
5-
AxiosResponse,
6-
InternalAxiosRequestConfig
7-
} from 'axios'
1+
import axios, { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
82

93
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
104
import qs from 'qs'
@@ -37,7 +31,11 @@ const whiteList: string[] = ['/login', '/refresh-token']
3731
const service: AxiosInstance = axios.create({
3832
baseURL: base_url, // api 的 base_url
3933
timeout: request_timeout, // 请求超时时间
40-
withCredentials: false // 禁用 Cookie 等信息
34+
withCredentials: false, // 禁用 Cookie 等信息
35+
// 自定义参数序列化函数
36+
paramsSerializer: (params) => {
37+
return qs.stringify(params, { allowDots: true })
38+
}
4139
})
4240

4341
// request拦截器
@@ -52,28 +50,26 @@ service.interceptors.request.use(
5250
}
5351
})
5452
if (getAccessToken() && !isToken) {
55-
;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token
53+
config.headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token
5654
}
5755
// 设置租户
5856
if (tenantEnable && tenantEnable === 'true') {
5957
const tenantId = getTenantId()
60-
if (tenantId) (config as Recordable).headers['tenant-id'] = tenantId
58+
if (tenantId) config.headers['tenant-id'] = tenantId
6159
}
62-
const params = config.params || {}
63-
const data = config.data || false
64-
if (
65-
config.method?.toUpperCase() === 'POST' &&
66-
(config.headers as AxiosRequestHeaders)['Content-Type'] ===
67-
'application/x-www-form-urlencoded'
68-
) {
69-
config.data = qs.stringify(data)
60+
const method = config.method?.toUpperCase()
61+
// 防止 GET 请求缓存
62+
if (method === 'GET') {
63+
config.headers['Cache-Control'] = 'no-cache'
64+
config.headers['Pragma'] = 'no-cache'
7065
}
71-
// get参数编码
72-
if (config.method?.toUpperCase() === 'GET' && params) {
73-
config.params = {}
74-
const paramsStr = qs.stringify(params, { allowDots: true })
75-
if (paramsStr) {
76-
config.url = config.url + '?' + paramsStr
66+
// 自定义参数序列化函数
67+
else if (method === 'POST') {
68+
const contentType = config.headers['Content-Type'] || config.headers['content-type']
69+
if (contentType === 'application/x-www-form-urlencoded') {
70+
if (config.data && typeof config.data !== 'string') {
71+
config.data = qs.stringify(config.data)
72+
}
7773
}
7874
}
7975
return config

src/layout/components/Setting/src/Setting.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,6 @@ $prefix-cls: #{$namespace}-setting;
297297
298298
.#{$prefix-cls} {
299299
border-radius: 6px 0 0 6px;
300+
z-index: 1200;/*修正没有z-index会被表格层覆盖,值不要超过4000*/
300301
}
301302
</style>

web-types.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://json.schemastore.org/web-types",
3+
"framework": "vue",
4+
"name": "name written in package.json",
5+
"version": "version written in package.json",
6+
"contributions": {
7+
"html": {
8+
"types-syntax": "typescript",
9+
"attributes": [
10+
{
11+
"name": "v-hasPermi"
12+
},
13+
{
14+
"name": "v-hasRole"
15+
}
16+
]
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)