学员端小程序
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.

88 lines
2.3 KiB

10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
  1. <template>
  2. <view>
  3. <topNavbar title="学员报名"></topNavbar>
  4. <!-- <web-view :webview-styles="webviewStyles" src="http://192.168.1.44:92/question/?uniItem=%7B%22phone%22%3A%2218267103167%22%2C%22cityCode%22%3A%223311%22%2C%22isUni%22%3A1%7D"></web-view> -->
  5. <web-view :webview-styles="webviewStyles" class="custom-webview" :src="link" :update-title="true"></web-view>
  6. <!-- <iframe src="https://your-h5-url.com" frameborder="0"></iframe> -->
  7. </view>
  8. </template>
  9. <script>
  10. import { getApplyStep } from "@/config/api.js"
  11. export default {
  12. data() {
  13. return {
  14. webviewStyles: {
  15. progress: {
  16. color: '#3877ff'
  17. },
  18. width: '100vw', // 设置 WebView 宽度为100%,占满整个屏幕宽度
  19. height: '100vh', // 设置 WebView 高度为100vh,占满整个屏幕高度
  20. },
  21. link: '',
  22. ok: false,
  23. getApplyStepApi: null
  24. }
  25. },
  26. onLoad() {
  27. this.link = this.$store.state.webViewUrl
  28. console.log('噜噜哇'+ this.$store.state.webViewUrl)
  29. // http://192.168.1.44:92/question/?uniItem=%7B%22phone%22%3A%2218267103167%22%2C%22cityCode%22%3A%223311%22%2C%22isUni%22%3A1%7D
  30. // uni.hideNavigationBarLoading()
  31. },
  32. beforeDestroy() {
  33. clearInterval(this.timer)
  34. this.timer = null
  35. },
  36. onHide() {
  37. clearInterval(this.timer)
  38. this.timer = null
  39. },
  40. onShow() {
  41. this.pollingFn()
  42. },
  43. methods: {
  44. async pollingFn() {
  45. this.timer = setInterval(async () => {
  46. const res = await this.getApplyStepFn()
  47. console.log(res)
  48. if(res==2) {
  49. clearInterval(this.timer)
  50. this.timer = null
  51. let redirectUrl = '/pages/indexEntry/enroll/registInfo/registInfo'
  52. if(this.$store.state.user.NonPlatformStudent) {
  53. redirectUrl = '/pages/indexEntry/NonPlatformStudent/NonPlatformStudent'
  54. }
  55. this.$goPage(redirectUrl)
  56. }
  57. }, 2000)
  58. },
  59. getApplyStepFn() {
  60. let _this = this
  61. if(this.ok) return this.getApplyStepApi
  62. this.ok =true
  63. return new Promise((reslove,reject)=>{
  64. _this.getApplyStepApi = getApplyStep({userId: this.userId}).then((res)=>{
  65. _this.ok = false
  66. // console.log(res)
  67. reslove(res.data)
  68. }).catch(()=>{
  69. _this.ok = false
  70. reject(0)
  71. })
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. .custom-webview::after {
  79. content: none !important; /* 隐藏返回按钮 */
  80. }
  81. .iframe {
  82. display: block;
  83. width: 100vw;
  84. height: 100vh;
  85. }
  86. </style>