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

84 lines
2.2 KiB

12 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. // 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
  29. // uni.hideNavigationBarLoading()
  30. },
  31. beforeDestroy() {
  32. clearInterval(this.timer)
  33. this.timer = null
  34. },
  35. onHide() {
  36. clearInterval(this.timer)
  37. this.timer = null
  38. },
  39. onShow() {
  40. this.timer = setInterval(async () => {
  41. const res = await this.getApplyStepFn()
  42. console.log(res)
  43. if(res==2) {
  44. clearInterval(this.timer)
  45. this.timer = null
  46. let redirectUrl = '/pages/indexEntry/enroll/registInfo/registInfo'
  47. if(this.$store.state.user.NonPlatformStudent) {
  48. redirectUrl = '/pages/indexEntry/NonPlatformStudent/NonPlatformStudent'
  49. }
  50. this.$goPage(redirectUrl)
  51. }
  52. }, 2000)
  53. },
  54. methods: {
  55. getApplyStepFn() {
  56. let _this = this
  57. if(this.ok) return this.getApplyStepApi
  58. this.ok =true
  59. return new Promise((reslove,reject)=>{
  60. _this.getApplyStepApi = getApplyStep({userId: this.userId}).then((res)=>{
  61. _this.ok = false
  62. // console.log(res)
  63. reslove(res.data)
  64. }).catch(()=>{
  65. _this.ok = false
  66. reject(0)
  67. })
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style>
  74. .custom-webview::after {
  75. content: none !important; /* 隐藏返回按钮 */
  76. }
  77. .iframe {
  78. display: block;
  79. width: 100vw;
  80. height: 100vh;
  81. }
  82. </style>