flowPc.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <web-view
  3. v-if="authtoken"
  4. :src="dibootUrl">
  5. </web-view>
  6. <!-- 测试地址 http://localhost:8080/mobile/pages/flow/flow?redirect=/pages/workflowTask/webviewPages/dealTask&id=cb864164-d638-11ee-b785-00ff0b7e144b&definitionId=system_flow_veh%3A46%3A40240578-d634-11ee-8076-00ff0b7e144b&instId=a7551e2f-d638-11ee-b785-00ff0b7e144b&category=todo&allowDeal=true-->
  7. </template>
  8. <script>
  9. import webview from './webview'
  10. export default {
  11. mixins: [webview],
  12. data() {
  13. return {
  14. dibootUrl: '',
  15. query: {},
  16. fetched: false,
  17. };
  18. },
  19. onLoad(query) {
  20. this.query = query
  21. // console.log(query,'queryqueryquery')
  22. if(this.authtoken) this.initData(query)
  23. },
  24. watch: {
  25. authtoken: {
  26. immediate: true,
  27. deep: true,
  28. handler(newVal) {
  29. // console.log(newVal,'newValnewValnewVal')
  30. this.initData(this.query)
  31. }
  32. }
  33. },
  34. methods: {
  35. initData(query) {
  36. console.log('query', query)
  37. let urlParams = ''
  38. let redirect = ''
  39. for (let key in query) {
  40. if (key != 'authtoken') {
  41. urlParams += `&${key}=${query[key]}`
  42. }
  43. if (key == 'redirect') {
  44. redirect = query[key]
  45. }
  46. }
  47. if(!redirect) return
  48. urlParams = urlParams.replace('&', '?')
  49. this.dibootUrl = `${this.webviewServer}${redirect}${urlParams}&authtoken=${this.authtoken}`
  50. console.log('工作流地址', this.dibootUrl)
  51. window.addEventListener("message", receiveMessage, false);
  52. function receiveMessage(event) {
  53. console.log('收到消息',event)
  54. uni.switchTab({
  55. url: event.data
  56. })
  57. }
  58. },
  59. getLocation() {
  60. },
  61. scanCode() {
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss"></style>