ImageModal.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <a-modal
  3. title="流程图"
  4. :width="1200"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. >
  9. <div>
  10. <img style="width: 90%" :src="image1" v-show="!showFlag" />
  11. <img style="width: 90%" :src="image2" v-show="showFlag"/>
  12. </div>
  13. <template slot="footer">
  14. <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">关闭</a-button>
  15. </template>
  16. </a-modal>
  17. </template>
  18. <script>
  19. import { getShineProImage } from '@/api/activiti/activiti'
  20. export default {
  21. name: 'ActImageModal',
  22. data () {
  23. return {
  24. confirmLoading: false,
  25. showFlag: true,
  26. image1: '',
  27. timer: '',
  28. visible: false,
  29. countNum: 0,
  30. image2: ''
  31. }
  32. },
  33. mounted () {
  34. this.timer = setInterval(this.showImage, 1000)
  35. },
  36. methods: {
  37. base (id) {
  38. this.visible = true
  39. this.confirmLoading = true
  40. getShineProImage({ processInstanceId: id })
  41. .then((res) => {
  42. const images = res.data.images
  43. this.image1 = 'data:image/png;base64,' + images[0]
  44. this.image2 = 'data:image/png;base64,' + images[1]
  45. // this.timer = setInterval(this.showImage(), 1000)
  46. }).catch(() => {
  47. this.confirmLoading = false
  48. })
  49. },
  50. showImage () {
  51. if (this.countNum === 0) {
  52. this.showFlag = false
  53. } else {
  54. this.showFlag = true
  55. }
  56. this.countNum++
  57. if (this.countNum === 2) {
  58. this.countNum = 0
  59. }
  60. },
  61. handleCancel () {
  62. this.visible = false
  63. this.confirmLoading = false
  64. clearInterval(this.timer)
  65. }
  66. }
  67. }
  68. </script>