工行这里学车报名流程h5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
3.7 KiB

  1. <template>
  2. <view class="page-web">
  3. <!-- <uni-nav-bar left-icon="back" title="签署" left-text="返回" @clickLeft="navigateBack" statusBar="true"></uni-nav-bar> -->
  4. <view class="page-inner">
  5. <web-view :src="$store.state.webViewUrl" @message="message" @onPostMessage="handlePostMessage"></web-view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. title: '加载中...',
  14. trainingApplyId: ''
  15. }
  16. },
  17. onLoad(options) {
  18. this.trainingApplyId = options.id
  19. let _this = this
  20. // const currentWebview = _this.$mp.page.$getAppWebview();
  21. this.shang()
  22. },
  23. mounted() {
  24. },
  25. methods: {
  26. shang() {
  27. let _this = this
  28. var currentWebview = this.$scope.$getAppWebview();
  29. setTimeout(()=>{
  30. console.log('currentWebview')
  31. console.log(currentWebview)
  32. let wv = currentWebview.children()[0]
  33. wv.addEventListener('loaded',function() {
  34. let webVeiwUrl = wv.getURL()
  35. console.log(webVeiwUrl)
  36. var reg = RegExp(/wait/i);
  37. if(reg.test(webVeiwUrl)){
  38. console.log('匹配成功了')
  39. uni.navigateTo({
  40. url: '/pages/learnDriveStep/payMoney/payMoney?trainingOrderId='+_this.trainingApplyId
  41. })
  42. }
  43. console.log('监听到了————————————————————')
  44. console.log(wv.getURL()) //获取url
  45. console.log(wv.getTitle()) //获取标题
  46. }, false);
  47. },500)
  48. },
  49. // 监听title是安卓原生事件
  50. shang1() { // 上传
  51. let _this = this
  52. // 获取所有的webview对象
  53. const currentWebview = _this.$mp.page.$getAppWebview();
  54. setTimeout(function() {
  55. // 获取当前页面的webview对象
  56. var web = currentWebview.children()[0];
  57. // 监听当前页面webview对象的title
  58. web.addEventListener('titleUpdate', (e) => {
  59. console.log('titleUpdate监听的什么呀', )
  60. let webVeiwUrl = web.getURL()
  61. console.log(webVeiwUrl)
  62. var reg = RegExp(/signaturecallback/i);
  63. if(reg.test(webVeiwUrl)){
  64. uni.redirectTo({
  65. url: '/pages/learnDriveStep/learnDriveStep?id='+_this.trainingApplyId
  66. })
  67. }
  68. }, false)
  69. web.addEventListener('loaded', (e) => {
  70. console.log('loaded监听的什么呀', )
  71. let webVeiwUrl = web.getURL()
  72. console.log(webVeiwUrl)
  73. var reg = RegExp(/signaturecallback/i);
  74. if(reg.test(webVeiwUrl)){
  75. uni.redirectTo({
  76. url: '/pages/learnDriveStep/learnDriveStep?id='+_this.trainingApplyId
  77. })
  78. }
  79. }, false)
  80. }, 200)
  81. },
  82. navigateBack() {
  83. uni.navigateBack()
  84. },
  85. onPullStateChange(e) {
  86. console.log('onPullStateChange 事件' + e)
  87. },
  88. onOverride() {
  89. console.log('onOverride 事件' + e)
  90. },
  91. message(e) {
  92. console.log('消息' + e)
  93. },
  94. handlePostMessage(e) {
  95. console.log('好消息' + e)
  96. }
  97. },
  98. onReady() {
  99. // #ifdef APP-PLUS
  100. var wv;
  101. var height = 0;
  102. uni.getSystemInfo({
  103. //成功获取的回调函数,返回值为系统信息
  104. success: (sysinfo) => {
  105. height = sysinfo.windowHeight; //自行修改,自己需要的高度 此处如底部有其他内容,可以直接---(-50)这种
  106. },
  107. complete: () => {}
  108. });
  109. var currentWebview = this.$scope
  110. .$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
  111. console.log(height)
  112. setTimeout(function() {
  113. wv = currentWebview.children()[0]
  114. wv.setStyle({
  115. top: 70,
  116. height: height
  117. })
  118. }, 1000); //如果是页面初始化调用时,需要延时一下
  119. // #endif
  120. }
  121. }
  122. </script>
  123. <style>
  124. .page-web {
  125. flex: 1;
  126. width: 100%;
  127. flex-direction: column;
  128. }
  129. .page-inner {
  130. flex: 1;
  131. }
  132. </style>