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

137 lines
3.6 KiB

10 months ago
8 months ago
8 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
7 months ago
10 months ago
5 months ago
10 months ago
8 months ago
10 months ago
8 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. console.log('===============webview地址==================')
  88. console.log(this.webViewUrl)
  89. },
  90. // 查询签约状态
  91. async getContractStatusFn() {
  92. uni.showLoading({
  93. title: '正在查询签约状态...'
  94. })
  95. const {
  96. data: res
  97. } = await getContractStatus({
  98. studentId: this.studentId,
  99. trainingApplyId: this.trainingApplyId
  100. })
  101. uni.hideLoading()
  102. console.log(res)
  103. if (res.flowStatus == 2) {
  104. uni.navigateTo({
  105. url: '/pages/indexEntry/enroll/payment/payment?trainingApplyId='+res.trainingApplyId
  106. })
  107. if (res.flowStatus > 2) {
  108. this.$u.toast('合同已撤销或过期')
  109. }
  110. }else {
  111. this.$u.toast('签约状态没返回')
  112. setTimeout(()=>{
  113. uni.navigateTo({
  114. url: '/pages/mineEntry/myForecastName/myForecastName'
  115. })
  116. }, 2000)
  117. }
  118. }
  119. }
  120. }
  121. </script>
  122. <style>
  123. .pageBg {
  124. flex: 1;
  125. width: 100%;
  126. flex-direction: column;
  127. /* background-color: red; */
  128. }
  129. .page-inner {
  130. flex: 1;
  131. }
  132. </style>