scan.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px'}">
  3. <web-view v-if="src" :src="src" @error="handleWebViewError"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data(){
  9. return {
  10. src: '',
  11. h: 0
  12. }
  13. },
  14. onLoad(options) {
  15. this.src = this.$htmlUrl('PERILL团队评估欢迎页.html')
  16. this.handleLaunchOrShow(options)
  17. },
  18. methods:{
  19. async handleLaunchOrShow(options) {
  20. if(options.q){
  21. try{
  22. const decodedUrl = decodeURIComponent(options.q);
  23. const codeMatch = decodedUrl.match(/type=([^&]+)/);
  24. const stationCode = codeMatch ? codeMatch[1] : null;
  25. if(stationCode === 'scan') {
  26. // 关闭首页的加载/渲染,避免闪烁
  27. uni.hideHomeButton();
  28. return;
  29. }
  30. uni.reLaunch({ url: '/pages/home' });
  31. }catch(e){
  32. uni.reLaunch({ url: '/pages/home' });
  33. }
  34. }
  35. },
  36. handleHome(){
  37. uni.reLaunch({
  38. url:'/pages/home'
  39. })
  40. },
  41. handleWebViewError(){
  42. uni.showToast({
  43. title: '欢迎页加载失败',
  44. icon: 'none'
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .page{
  52. box-sizing: border-box;
  53. image{
  54. width: 100%;
  55. }
  56. }
  57. </style>