12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <template>
- <view class="loading">
- <u-loading mode="circle" color="#01243A" size="40"></u-loading>
- </view>
- </template>
-
- <script setup lang="ts">
- import { onMounted, reactive } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import { getUrlParameters, navTo } from '@/utils/utils'
-
- const routeMap = [
- {type: '1', route: '/pages/order/channel'},
- ]
-
- // 二维码地址参数
- interface urlParams {
- inType?: string; // 跳转类型 1: 渠道订单
- }
-
- // 测试地址: https://qtzl.etcjz.cn/zhywpt-issuer/to_mini.html?inType=1&testCode=66
- onLoad((option) => {
- console.log(option)
- // 如果有q,证明是扫描二维码进入的页面
- if (option.q) {
- let codeUrl = decodeURIComponent(option.q)
- let params: urlParams = getUrlParameters(codeUrl)
- console.log(params)
- if (params && params.inType) {
- let info = routeMap.find(item => item.type == params.inType)
- if (info && info.route) {
- navTo(info.route)
- uni.reLaunch({
- url: info.route
- })
- } else {
- goHome()
- }
- } else {
- goHome()
- }
- } else {
- goHome()
- }
- })
-
- const goHome = () => {
- navTo('/pages/index/index')
- }
- </script>
-
- <style lang="scss" scoped>
- .loading{
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: #fff;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- </style>
|