洛阳学员端
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.

126 lines
3.3 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
5 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="pageBg">
  3. <!-- <topNavbar title="签约合同"></topNavbar> -->
  4. <view class="page-inner">
  5. <web-view :src="webViewUrl" :webview-styles="webviewStyles" :update-title="false"></web-view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. getContractStatus,
  12. getSignContract
  13. } from '@/config/api.js'
  14. export default {
  15. data() {
  16. return {
  17. webViewUrl: '',
  18. schoolId: '',
  19. webviewStyles: {
  20. progress: {
  21. color: '#00a3ff'
  22. }
  23. }
  24. }
  25. },
  26. onReady() {
  27. // let wv;
  28. // // #ifdef APP-PLUS
  29. // let boxHeight = 0
  30. // uni.getSystemInfo({
  31. // success: res => boxHeight = res.windowHeight // 屏幕可用高度
  32. // })
  33. // var currentWebview = this.$scope.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
  34. // setTimeout(function() {
  35. // wv = currentWebview.children()[0]
  36. // wv.setStyle({top:statusBar,height: boxHeight})
  37. // }, 2000); //如果是页面初始化调用时,需要延时一下
  38. // // #endif
  39. // let statusBar = uni.getWindowInfo().statusBarHeight
  40. },
  41. onLoad(options) {
  42. this.schoolId = options.schoolId ? options.schoolId : this.vuex_userInfo.schoolId
  43. this.trainingApplyId = options.trainingApplyId ? options.trainingApplyId : ''
  44. // this.timer = setInterval(() => {
  45. // this.getContractStatusFn()
  46. // }, 3000)
  47. this.getSignContractFn()
  48. // #ifdef APP-PLUS
  49. this.shang()
  50. // #endif
  51. },
  52. methods: {
  53. shang() {
  54. let _this = this
  55. var currentWebview = this.$scope.$getAppWebview();
  56. setTimeout(() => {
  57. console.log('currentWebview')
  58. console.log(currentWebview)
  59. let wv = currentWebview.children()[0]
  60. wv.addEventListener('loaded', async function() {
  61. let webVeiwUrl = wv.getURL()
  62. console.log(webVeiwUrl)
  63. var reg = RegExp(/wait/i); //signaturecallback
  64. if (reg.test(webVeiwUrl)) {
  65. console.log('匹配成功了————————————————————————')
  66. _this.getContractStatusFn()
  67. }
  68. console.log('监听到了————————————————————')
  69. }, false);
  70. }, 500)
  71. },
  72. async getSignContractFn() {
  73. uni.showLoading({
  74. title: '正在加载合同...'
  75. })
  76. let info = this.vuex_userInfo
  77. let obj = {
  78. schoolId: this.schoolId,
  79. studentId: this.studentId,
  80. }
  81. if (this.trainingApplyId) obj.trainingApplyId = this.trainingApplyId
  82. const {
  83. data: res
  84. } = await getSignContract(obj)
  85. uni.hideLoading()
  86. this.webViewUrl = res.url
  87. console.log('===============webview地址==================')
  88. console.log(this.webViewUrl)
  89. },
  90. // 查询签约状态
  91. async getContractStatusFn() {
  92. const {
  93. data: res
  94. } = await getContractStatus({
  95. studentId: this.studentId,
  96. trainingApplyId: this.trainingApplyId
  97. })
  98. console.log(res)
  99. if (res.flowStatus == 2) {
  100. uni.navigateTo({
  101. url: '/pages/indexEntry/enroll/payment/payment?trainingApplyId='+res.trainingApplyId
  102. })
  103. if (res.flowStatus > 2) {
  104. this.$u.toast('合同已撤销或过期')
  105. }
  106. }
  107. }
  108. }
  109. }
  110. </script>
  111. <style>
  112. .pageBg {
  113. flex: 1;
  114. width: 100%;
  115. flex-direction: column;
  116. /* background-color: red; */
  117. }
  118. .page-inner {
  119. flex: 1;
  120. }
  121. </style>