routerView.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <view class="blacklog-container">
  3. <web-view v-if="isShow" :src="webViewUrl"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. import {
  8. getParentIdListByDeptId
  9. } from '@/api/common.js'
  10. export default{
  11. data(){
  12. return{
  13. isShow:false,
  14. webViewUrl:''
  15. }
  16. },
  17. async onLoad(option = {}) {
  18. let headers = {};
  19. const value = uni.getStorageSync("token"); //取存本地的token
  20. const apiInfo = uni.getStorageSync("apiInfo"); //取存本地的token
  21. headers = {
  22. "content-type": "application/json",
  23. "zoomwin-token": value,
  24. Authorization: value,
  25. "zoomwin-sid": uni.getStorageSync("userInfo").sessionId,
  26. serverInfo : apiInfo.protocal? apiInfo.protocal+ apiInfo.hostname+':'+apiInfo.port+'/api' :'',
  27. };
  28. //http://192.168.1.105:18086
  29. const params = JSON.parse(option.params)
  30. params.userInfo = uni.getStorageSync("userInfo")
  31. let html = params.type =='add'? 'a.html':'c.html'
  32. try{
  33. params.userInfo.groupIdList = await getParentIdListByDeptId(params.userInfo.groupId)
  34. }catch{
  35. params.userInfo.groupIdList = []
  36. }
  37. console.log(params.userInfo.groupIdList)
  38. setTimeout(()=>{
  39. this.webViewUrl = `/hybrid/html/${html}?params=${JSON.stringify(params)}&headers=${JSON.stringify(headers)}`
  40. this.isShow = true
  41. })
  42. },
  43. }
  44. </script>
  45. <style>
  46. </style>