| | |
| | | </div> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { onMounted,computed,ref } from 'vue' |
| | | import { ajaxGet } from '@/utils/axios' |
| | | // import { useCounterStore } from '@/stores/counter' |
| | | import { Image as VanImage,Tabbar as VanTabbar , TabbarItem as VanTabbarItem} from 'vant' |
| | | import {useRoute,useRouter} from 'vue-router' |
| | | import { onMounted,ref } from 'vue' |
| | | import { userInfoStore } from '@/stores/userInfo' |
| | | import { Image as VanImage,Tabbar as VanTabbar , TabbarItem as VanTabbarItem } from 'vant' |
| | | import {useRouter} from 'vue-router' |
| | | import meun1 from './assets/meun1.png' |
| | | import meun2 from './assets/meun2.png' |
| | | import meun3 from './assets/meun3.png' |
| | | import meun4 from './assets/meun4.png' |
| | | import List1 from './assets/row1.png' |
| | | import Black from './assets/Black.png' |
| | | const route = useRoute() |
| | | const router=useRouter() |
| | | // const counter = useCounterStore() |
| | | const userInfo = userInfoStore() |
| | | const active=ref('home') |
| | | const tabChang=(index:any)=>{ |
| | | if (index==='home'){ |
| | |
| | | console.log('sss') |
| | | router.push(url) |
| | | } |
| | | const isWechat = () => { |
| | | return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === 'micromessenger' |
| | | } |
| | | onMounted(() => { |
| | | 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('不是微信浏览器') |
| | | if (userInfo.info.openid===''){ |
| | | router.push('login') |
| | | } |
| | | |
| | | }) |
| | | </script> |
| | | <style scoped lang="css" src="./assets/index.scss" /> |