hookehuyr

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

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