flow.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. };
  17. },
  18. onLoad(query) {
  19. this.query = query
  20. this.initData(query)
  21. },
  22. watch: {
  23. authtoken: {
  24. immediate: false,
  25. deep: true,
  26. handler(newVal) {
  27. this.initData(this.query)
  28. }
  29. }
  30. },
  31. methods: {
  32. initData(query) {
  33. console.log('query', query)
  34. let urlParams = ''
  35. for (let key in query) {
  36. if (key != 'authtoken') {
  37. urlParams += `&${key}=${query[key]}`
  38. }
  39. }
  40. urlParams = urlParams.replace('&', '?')
  41. this.dibootUrl = `${this.webviewServer}${urlParams}&authtoken=${this.authtoken}`
  42. console.log('工作流地址', this.dibootUrl)
  43. window.addEventListener("message", receiveMessage, false);
  44. function receiveMessage(event) {
  45. console.log('收到消息',event)
  46. uni.switchTab({
  47. url: event.data
  48. })
  49. }
  50. },
  51. getLocation() {
  52. },
  53. scanCode() {
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss"></style>