| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <template>
- <view><!-- 授权页面 --></view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { getQueryString } from '../../util/getParams.js'
- const APPKEY = '4AA7B3944BDF3739'
- const ocode = '1015730314'
- // 线上地址
- const URL = 'https://chtech.ncjti.edu.cn/carstop/carbook/appopenid.action'
- // 本地地址
- // const URL = 'http://192.168.161.170:8088/carBook/appopenid.action'
- onLoad(() => {
- loginFilter()
- })
- // 获取用户card_number
- const loginFilter = () => {
- const card_number = uni.getStorageSync('bus_card_number')
- if (!card_number) {
- const card_number = getQueryString('card_number')
- if (!card_number) {
- getCardnumberURL()
- } else {
- uni.setStorageSync('bus_card_number', card_number)
- uni.switchTab({
- url: '/pages/home/home'
- })
- }
- } else {
- uni.switchTab({
- url: '/pages/home/home'
- })
- }
- }
- // 跳转授权页面
- const getCardnumberURL = () => {
- window.location.href = `https://open.wecard.qq.com/connect/oauth/authorize?app_key=${APPKEY}&response_type=code&scope=snsapi_base&ocode=${ocode}&redirect_uri=${URL}&state=${URL}`
- }
- </script>
|