Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

loading.vue 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="loading">
  3. <u-loading mode="circle" color="#01243A" size="40"></u-loading>
  4. </view>
  5. </template>
  6. <script setup lang="ts">
  7. import { onMounted, reactive } from 'vue'
  8. import { onLoad } from '@dcloudio/uni-app'
  9. import { getUrlParameters, navTo } from '@/utils/utils'
  10. const routeMap = [
  11. {type: '1', route: '/pages/order/channel'},
  12. ]
  13. // 二维码地址参数
  14. interface urlParams {
  15. inType?: string; // 跳转类型 1: 渠道订单
  16. }
  17. // 测试地址: https://qtzl.etcjz.cn/zhywpt-issuer/to_mini.html?inType=1&testCode=66
  18. onLoad((option) => {
  19. console.log(option)
  20. // 如果有q,证明是扫描二维码进入的页面
  21. if (option.q) {
  22. let codeUrl = decodeURIComponent(option.q)
  23. let params: urlParams = getUrlParameters(codeUrl)
  24. console.log(params)
  25. if (params && params.inType) {
  26. let info = routeMap.find(item => item.type == params.inType)
  27. if (info && info.route) {
  28. navTo(info.route)
  29. uni.reLaunch({
  30. url: info.route
  31. })
  32. } else {
  33. goHome()
  34. }
  35. } else {
  36. goHome()
  37. }
  38. } else {
  39. goHome()
  40. }
  41. })
  42. const goHome = () => {
  43. navTo('/pages/index/index')
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .loading{
  48. position: fixed;
  49. top: 0;
  50. left: 0;
  51. width: 100%;
  52. height: 100%;
  53. background-color: #fff;
  54. display: flex;
  55. justify-content: center;
  56. align-items: center;
  57. }
  58. </style>