From 97836fd44abb0d0374f1b0124b57ad70476593f7 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 20 十月 2022 15:35:55 +0800
Subject: [PATCH] longin

---
 src/views/home/index.vue |   72 +++++++++++++----------------------
 1 files changed, 27 insertions(+), 45 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index cba1bf2..c9fa6b1 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -136,43 +136,6 @@
     const route = useRoute()
     const router=useRouter()
     // const counter = useCounterStore()
-    const  loopData0= [
-        {
-            lanhuBg2:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng10c918ad8f5eb3b228828f57732dad7ecd28335754916c4012147796e36591d6) 0px 0px no-repeat',
-            lanhutext0: '健康趋势',
-            lanhutext1: 'Health&nbsp;trends'
-        },
-        {
-            lanhuBg2:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng9dd5bfd8bce302227d8c0ccb89144c1b70b47c2b07da1fcbb144c9347d69e72a) 0px 0px no-repeat',
-            lanhutext0: '健康宣教',
-            lanhutext1: 'Health&nbsp;Education'
-        }
-    ]
-
-    const loopData1= [
-        {
-            lanhuBg1:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng042226982f8d895d90cdcfefb4ea4846696567d8a40a8e0a1dd0073e7f899480) 100% no-repeat',
-            lanhutext0: '检验报告'
-        },
-        {
-            lanhuBg1:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng43a5d2681858b5057217f32705ac557e7fac69348980e05950c034793715775c) 100% no-repeat',
-            lanhutext0: '透析排班'
-        },
-        {
-            lanhuBg1:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng5658c304c4e0841738fddace6a4bbb55d801d98a5e769632b0b71ffe48d56937) 100% no-repeat',
-            lanhutext0: '透析医嘱'
-        },
-        {
-            lanhuBg1:
-                'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngd56bf49c9455a5e530aa3cb0e45df98f9ee00edae6eb83220b2a0d76f6e9b487) 100% no-repeat',
-            lanhutext0: '透析记录'
-        }
-    ]
     const active=ref('home')
     const tabChang=(index:any)=>{
         if (index==='home'){
@@ -185,16 +148,35 @@
         console.log('sss')
         router.push(url)
     }
+    const isWechat = () => {
+        return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === 'micromessenger'
+    }
     onMounted(() => {
-        console.log('初始化',route)
-        const queryInfo=route.query
-        const {code}=queryInfo
-        console.log(code)
-        if (code){
-            ajaxGet('wechat/code',{code}).then((re:any)=>{
-                console.log(re)
-            })
+        if (isWechat()){
+            console.log('初始化',route)
+            const queryInfo=route.query
+            const {code}=queryInfo
+            console.log(code)
+            if (code){
+                ajaxGet('wechat/code',{code}).then((re:any)=>{
+                    console.log(re)
+                })
+            }
+            else {
+                const appid = 'wx790bd67db6206070' // 微信APPid
+                const local = window.location.href
+                window.location.href =
+                    'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
+                    appid +
+                    '&redirect_uri=' +
+                    encodeURIComponent(local) +
+                    '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
+
+            }
+        } else {
+            console.log('不是微信浏览器')
         }
+
     })
   </script>
   <style scoped lang="css" src="./assets/index.scss" />
\ No newline at end of file

--
Gitblit v1.8.0