hookehuyr

🎈 perf: 授权API参数变量名修改

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-28 10:17:40 3 * @Date: 2022-05-28 10:17:40
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2022-06-07 11:01:22 5 + * @LastEditTime: 2022-06-09 01:02:38
6 * @FilePath: /tswj/src/utils/axios.js 6 * @FilePath: /tswj/src/utils/axios.js
7 * @Description: 7 * @Description:
8 */ 8 */
...@@ -54,7 +54,7 @@ axios.interceptors.response.use( ...@@ -54,7 +54,7 @@ axios.interceptors.response.use(
54 // 默认显示错误提示 54 // 默认显示错误提示
55 response.data.show = true; 55 response.data.show = true;
56 // C/B 授权拼接头特殊标识,openid_x 56 // C/B 授权拼接头特殊标识,openid_x
57 - let userType = router && router.currentRoute.value.href?.indexOf('business') > 0 ? 'b' : 'c'; 57 + let prefixAPI = router && router.currentRoute.value.href?.indexOf('business') > 0 ? 'b' : 'c';
58 if (response.data.code === 401) { 58 if (response.data.code === 401) {
59 // 特殊标识-带此标识报错不显示 59 // 特殊标识-带此标识报错不显示
60 response.data.show = false; 60 response.data.show = false;
...@@ -65,7 +65,7 @@ axios.interceptors.response.use( ...@@ -65,7 +65,7 @@ axios.interceptors.response.use(
65 query: { 65 query: {
66 // href: router.currentRoute.value.href, 66 // href: router.currentRoute.value.href,
67 href: location.hash, 67 href: location.hash,
68 - userType 68 + prefixAPI
69 } 69 }
70 }); 70 });
71 } 71 }
......
1 +<!--
2 + * @Author: hookehuyr hookehuyr@gmail.com
3 + * @Date: 2022-05-14 22:27:32
4 + * @LastEditors: hookehuyr hookehuyr@gmail.com
5 + * @LastEditTime: 2022-06-09 00:59:41
6 + * @FilePath: /tswj/src/views/auth.vue
7 + * @Description:
8 +-->
1 <template> 9 <template>
2 </template> 10 </template>
3 11
...@@ -16,7 +24,7 @@ onMounted(() => { ...@@ -16,7 +24,7 @@ onMounted(() => {
16 */ 24 */
17 let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址 25 let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
18 // TAG: 开发环境测试数据 26 // TAG: 开发环境测试数据
19 - const short_url = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${raw_url}`; 27 + const short_url = `/srv/?f=voice&a=openid_${$route.query.prefixAPI}&res=${raw_url}`;
20 location.href = import.meta.env.DEV 28 location.href = import.meta.env.DEV
21 ? `${short_url}&input_openid=${import.meta.env.VITE_OPENID}` 29 ? `${short_url}&input_openid=${import.meta.env.VITE_OPENID}`
22 : `${short_url}`; 30 : `${short_url}`;
......
...@@ -37,7 +37,7 @@ addPages(); ...@@ -37,7 +37,7 @@ addPages();
37 onMounted(() => { 37 onMounted(() => {
38 // 判断微信授权状态,进入页面时未授权需要授权跳转 38 // 判断微信授权状态,进入页面时未授权需要授权跳转
39 if (!Cookies.get('PHPSESSID')) { 39 if (!Cookies.get('PHPSESSID')) {
40 - replace('/auth', { href: location.hash, userType: 'c' }) 40 + replace('/auth', { href: location.hash, prefixAPI: 'c' })
41 } 41 }
42 // 进入项目自动打开导航栏 微信浏览器 避免样式错位 42 // 进入项目自动打开导航栏 微信浏览器 避免样式错位
43 window.history.pushState({}, "title", "#") 43 window.history.pushState({}, "title", "#")
......