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

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