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

124 lines
3.2 KiB

10 months ago
9 months ago
9 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
8 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 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. },
  88. // 查询签约状态
  89. async getContractStatusFn() {
  90. const {
  91. data: res
  92. } = await getContractStatus({
  93. studentId: this.studentId,
  94. trainingApplyId: this.trainingApplyId
  95. })
  96. console.log(res)
  97. if (res.flowStatus == 2) {
  98. uni.navigateTo({
  99. url: '/pages/indexEntry/enroll/payment/payment?trainingApplyId='+res.trainingApplyId
  100. })
  101. if (res.flowStatus > 2) {
  102. this.$u.toast('合同已撤销或过期')
  103. }
  104. }
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. .pageBg {
  111. flex: 1;
  112. width: 100%;
  113. flex-direction: column;
  114. /* background-color: red; */
  115. }
  116. .page-inner {
  117. flex: 1;
  118. }
  119. </style>