diboot.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <web-view
  3. v-if="authtoken"
  4. :src="dibootUrl">
  5. </web-view>
  6. </template>
  7. <script>
  8. import webview from './webview'
  9. export default {
  10. mixins: [webview],
  11. data() {
  12. return {
  13. dibootUrl: '',
  14. query: {},
  15. };
  16. },
  17. onLoad(query) {
  18. this.query = query
  19. this.initData(query)
  20. },
  21. watch: {
  22. authtoken: {
  23. immediate: false,
  24. deep: true,
  25. handler(newVal) {
  26. this.initData(this.query)
  27. }
  28. }
  29. },
  30. methods: {
  31. initData(routeQuery) {
  32. let protocol = 'https:'
  33. if (document.location.protocol) {
  34. protocol = document.location.protocol
  35. }
  36. let urlParams = ''
  37. for (let key in routeQuery) {
  38. if (key != 'routes') {
  39. urlParams += `&${key}=${routeQuery[key]}`
  40. }
  41. }
  42. urlParams += `&token=${this.authtoken}`
  43. if (process.env.NODE_ENV === 'development') {
  44. this.dibootUrl = `${protocol}//tq.5000v.com:8035${routeQuery.routes}?${urlParams}`
  45. } else {
  46. this.dibootUrl = `${protocol}//${window.location.host}${routeQuery.routes}?${urlParams}`
  47. }
  48. },
  49. getLocation() {
  50. },
  51. scanCode() {
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss"></style>