skip.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="skip">
  3. <view class="bg">
  4. </view>
  5. <view class="text">
  6. {{ tip }}
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. mapState,
  13. mapMutations
  14. } from "vuex";
  15. import Base64 from "../../util/base64.js"
  16. import Parse from "../../util/parse.js"
  17. export default {
  18. data() {
  19. return {
  20. tip: "跳转中,请稍后..."
  21. }
  22. },
  23. computed: {
  24. // ...mapState(["appId", "stationId", "phoneNumber", "countryCode", "purePhoneNumber", "openId", "unionId",
  25. // "userInfo"
  26. // ]),
  27. },
  28. created() {
  29. uni.showLoading({
  30. title: '跳转中...',
  31. mask: true
  32. });
  33. },
  34. async onLoad(e) {
  35. const res = decodeURIComponent(e.q)
  36. const parse = new Parse.getInstance();
  37. const info = await parse.parseCode(res).catch((e) => {
  38. uni.hideLoading()
  39. return parse.scanCode(true, {
  40. title: '( •̀ ω •́ )✧',
  41. showCancel: false,
  42. content: '亲,您扫的码不对哦~',
  43. confirmText: '重新扫码',
  44. })
  45. })
  46. this.goIndex();
  47. },
  48. methods: {
  49. ...mapMutations(["updateStationId", "updateLabelId", "updateEmployeeId"]),
  50. goIndex() {
  51. uni.hideLoading();
  52. uni.redirectTo({
  53. url: "/pages/index/index"
  54. })
  55. },
  56. goList() {
  57. uni.hideLoading();
  58. uni.redirectTo({
  59. url: "/pages/list/list"
  60. })
  61. },
  62. async parseCode(msg) {
  63. const showModalPro = await uni.showModal({
  64. title: '( •̀ ω •́ )✧',
  65. showCancel: false,
  66. content: '亲,扫码错误哦~',
  67. confirmText: '重新扫码',
  68. })
  69. const scanCodePro = await uni.scanCode({
  70. onlyFromCamera: true
  71. })
  72. // try {
  73. // const parse = new Parse.getInstance();
  74. // const info = await parse.start(res)
  75. // return Promise.resolve(info)
  76. // } catch (e) {
  77. // const showModalPro = await uni.showModal({
  78. // title: '(~ ̄▽ ̄)~',
  79. // showCancel: false,
  80. // content: '您扫的二维码错误~',
  81. // confirmText: '重新扫码',
  82. // })
  83. // const scanCodePro = await uni.scanCode({
  84. // onlyFromCamera: true
  85. // })
  86. // this.scanCode();
  87. // }
  88. },
  89. async scanCode() {
  90. const showModalPro = await uni.showModal({
  91. title: '(~ ̄▽ ̄)~',
  92. showCancel: !!this.stationId,
  93. content: msg || '此站点只能扫码进入~',
  94. cancelText: '返回',
  95. confirmText: '立刻扫码',
  96. })
  97. const parse = Parse.getInstance()
  98. if (showModalPro[1].cancel) {
  99. uni.navigateBack({
  100. delta: 1
  101. })
  102. } else if (showModalPro[1].confirm) {
  103. const parse = Parse.getInstance()
  104. return parse.scanCode().catch((err) => {
  105. return this.scanCode(err)
  106. });
  107. }
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss">
  113. page {
  114. .skip {
  115. position: relative;
  116. .bg {
  117. // background: url(../../static/icon/1_b01_down.2x.png) no-repeat 0px 0px;
  118. background: url(../../static/icon/goto.png) no-repeat 0px 0px;
  119. background-size: 100% 100%;
  120. width: 182rpx;
  121. height: 216rpx;
  122. position: absolute;
  123. top: 238rpx;
  124. left: 270rpx;
  125. }
  126. .text {
  127. font-size: 40rpx;
  128. width: 750rpx;
  129. text-align: center;
  130. font-weight: 550;
  131. color: #000000;
  132. line-height: 56rpx;
  133. position: absolute;
  134. top: 522rpx;
  135. }
  136. }
  137. }
  138. </style>