style:cas配置
Showing
3 changed files
with
32 additions
and
30 deletions
... | @@ -18,6 +18,9 @@ | ... | @@ -18,6 +18,9 @@ |
18 | </title> | 18 | </title> |
19 | </head> | 19 | </head> |
20 | <script> | 20 | <script> |
21 | window.baseUrl = location.origin || location.protocol + '//' + location.host | ||
22 | window.timeout = 5000 | ||
23 | const authorization = "bearer AT-4-MxSrO29Coe7VTazx8uuixtqqgO-hvCB6" | ||
21 | fetch('<%= BASE_URL %>config.json') | 24 | fetch('<%= BASE_URL %>config.json') |
22 | .then(response => response.json()) | 25 | .then(response => response.json()) |
23 | .then(config => { | 26 | .then(config => { |
... | @@ -30,8 +33,3 @@ | ... | @@ -30,8 +33,3 @@ |
30 | </body> | 33 | </body> |
31 | 34 | ||
32 | </html> | 35 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file |
33 | <script> | ||
34 | window.baseUrl = location.origin || location.protocol + '//' + location.host | ||
35 | window.timeout = 5000 | ||
36 | window.authorization = "bearer AT-4-MxSrO29Coe7VTazx8uuixtqqgO-hvCB6" | ||
37 | </script> | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | /* | 1 | /* |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-04-11 14:48:18 | 4 | * @LastEditTime: 2023-05-16 09:17:28 |
5 | */ | 5 | */ |
6 | /** | 6 | /** |
7 | * 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 | 7 | * 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 |
... | @@ -12,11 +12,13 @@ import { endLoadingSubCount } from './requestLoading' | ... | @@ -12,11 +12,13 @@ import { endLoadingSubCount } from './requestLoading' |
12 | 12 | ||
13 | // create an axios instance | 13 | // create an axios instance |
14 | const service = axios.create({ | 14 | const service = axios.create({ |
15 | baseURL: process.env.VUE_APP_BASE_API, | 15 | baseURL: |
16 | process.env.NODE_ENV == "development" | ||
17 | ? process.env.VUE_APP_BASE_API | ||
18 | : window.baseUrl + "/", | ||
16 | withCredentials: true, //是否允许跨域 | 19 | withCredentials: true, //是否允许跨域 |
17 | headers: { | 20 | headers: { |
18 | 'Content-Type': 'application/json; charset=utf-8', | 21 | 'Content-Type': 'application/json; charset=utf-8' |
19 | 'Authorization': 'bearer AT-4-MxSrO29Coe7VTazx8uuixtqqgO-hvCB6' | ||
20 | }, | 22 | }, |
21 | timeout: 15000 | 23 | timeout: 15000 |
22 | }) | 24 | }) |
... | @@ -24,14 +26,18 @@ const service = axios.create({ | ... | @@ -24,14 +26,18 @@ const service = axios.create({ |
24 | // request interceptor | 26 | // request interceptor |
25 | service.interceptors.request.use( | 27 | service.interceptors.request.use( |
26 | config => { | 28 | config => { |
27 | config.headers.Authorization = | 29 | // do something before request is sent |
28 | 'bearer AT-4-MxSrO29Coe7VTazx8uuixtqqgO-hvCB6' | 30 | if (process.env.NODE_ENV === "production") { |
29 | config.headers.Accept = 'application/json' | 31 | return config; |
30 | return config | 32 | } else { |
33 | config.headers.Authorization = authorization; | ||
34 | return config; | ||
35 | } | ||
31 | }, | 36 | }, |
32 | error => { | 37 | error => { |
33 | Message.error('请求超时!'); | 38 | // do something with request error |
34 | return Promise.reject(error) | 39 | console.log(error); // for debug |
40 | return Promise.reject(error); | ||
35 | } | 41 | } |
36 | ) | 42 | ) |
37 | 43 | ||
... | @@ -44,13 +50,6 @@ service.interceptors.response.use( | ... | @@ -44,13 +50,6 @@ service.interceptors.response.use( |
44 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) | 50 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) |
45 | */ | 51 | */ |
46 | if (response.status == 200) { | 52 | if (response.status == 200) { |
47 | // if (response.data.code == 500) { | ||
48 | // Message({ | ||
49 | // message: response.data.message, | ||
50 | // type: 'error', | ||
51 | // duration: 5 * 1000 | ||
52 | // }) | ||
53 | // } | ||
54 | return response.data; | 53 | return response.data; |
55 | } else { | 54 | } else { |
56 | handleErrorData(response.data); | 55 | handleErrorData(response.data); | ... | ... |
... | @@ -182,10 +182,10 @@ | ... | @@ -182,10 +182,10 @@ |
182 | </div> | 182 | </div> |
183 | </template> | 183 | </template> |
184 | <script> | 184 | <script> |
185 | import { mapGetters } from "vuex"; | 185 | import { mapGetters } from "vuex"; |
186 | import qlrCommonTable from "@/views/workflow/components/qlrCommonTable"; | 186 | import qlrCommonTable from "@/views/workflow/components/qlrCommonTable"; |
187 | import { Init, saveData } from "@/api/workflow/jsydsyqFlow.js"; | 187 | import { Init, saveData } from "@/api/workflow/jsydsyqFlow.js"; |
188 | export default { | 188 | export default { |
189 | mounted () { | 189 | mounted () { |
190 | this.propsParam = this.$attrs; | 190 | this.propsParam = this.$attrs; |
191 | var formdata = new FormData(); | 191 | var formdata = new FormData(); |
... | @@ -207,7 +207,12 @@ export default { | ... | @@ -207,7 +207,12 @@ export default { |
207 | return { | 207 | return { |
208 | disabled: true, | 208 | disabled: true, |
209 | czrOptions: [], | 209 | czrOptions: [], |
210 | ruleForm: {}, | 210 | ruleForm: { |
211 | slywxx: {}, | ||
212 | qlxx: {}, | ||
213 | zdjbxx: {}, | ||
214 | jsydsyq: {} | ||
215 | }, | ||
211 | //传递参数 | 216 | //传递参数 |
212 | propsParam: {}, | 217 | propsParam: {}, |
213 | rules: {}, | 218 | rules: {}, |
... | @@ -255,9 +260,9 @@ export default { | ... | @@ -255,9 +260,9 @@ export default { |
255 | } | 260 | } |
256 | }, | 261 | }, |
257 | 262 | ||
258 | }; | 263 | }; |
259 | </script> | 264 | </script> |
260 | <style scoped lang='scss'> | 265 | <style scoped lang='scss'> |
261 | @import "~@/styles/public.scss"; | 266 | @import "~@/styles/public.scss"; |
262 | @import "~@/styles/slxx/slxx.scss"; | 267 | @import "~@/styles/slxx/slxx.scss"; |
263 | </style> | 268 | </style> | ... | ... |
-
Please register or sign in to post a comment