Pārlūkot izejas kodu

反馈页面提交

tangning 1 gadu atpakaļ
vecāks
revīzija
331c60976d
1 mainītis faili ar 12 papildinājumiem un 8 dzēšanām
  1. 12 8
      src/router/index.ts

+ 12 - 8
src/router/index.ts

@@ -8,7 +8,12 @@ const router: Router = createRouter({
 
 router.beforeEach(async (_to, _from, next) => {
   console.log('_to', _to);
-  let wxOpenId = useCookies().get('wxOpenId');
+  const wxOpenId = useCookies().get('wxOpenId');
+  if (_to.name == 'feedback' || _to.name == 'feedbacksuccess') {
+    document.title = t('feedback.title');
+  } else {
+    document.title = '四维时代售后';
+  }
   if (wxOpenId || _to.name == 'feedback' || _to.name == 'feedbacksuccess' || getUrlKey('code')) {
     next();
   } else {
@@ -19,19 +24,18 @@ router.beforeEach(async (_to, _from, next) => {
 function getUrlKey(name) {
   //获取url 参数
   return (
-    decodeURIComponent(
-      (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20'),
-    ) || null
+    decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) ||
+    null
   );
 }
 
 function getCodeApi(state) {
   //获取code
   console.log('getCodeApi');
-  let urlNow = encodeURIComponent(window.location.href);
-  let scope = 'snsapi_base'; //snsapi_userinfo   //静默授权 用户无感知
-  let appid = 'wxac3d59ea82d9b82a';
-  let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${urlNow}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`;
+  const urlNow = encodeURIComponent(window.location.href);
+  const scope = 'snsapi_base'; //snsapi_userinfo   //静默授权 用户无感知
+  const appid = 'wxac3d59ea82d9b82a';
+  const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${urlNow}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`;
   window.location.replace(url);
 }
 export default router;