kongdeqiang
2023-09-12 eadd5784244d98dca21e5788440004432af8e803
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
  <el-dialog
    title="预览"
    :visible.sync="dialogVisible"
    class="dialogStyle"
    v-dialogDrag>
    <div ref="word"></div>
  </el-dialog>
</template>
 
<script>
import {viewD, viewWithImg,urlToBase64} from '../../../../libs/word'
    export default {
        name: "index",
        data() {
            return {
                dialogVisible: false,
               imgSize:{
                 shouQianMing:[60,60]
               }
 
            }
        },
        methods: {
          initMore3(obj,url,arry,imgSize) {  //页面有多张签名照片的且一处可有多张图片
            if(arry.length > 0) {
              if(obj) {
                for(let j = 0;j<arry.length;j++) {
                  if(Array.isArray(arry[j])){
                    let img = obj[arry[j]].split(',')
                    let imgList = []
                    for (let i=0; i< img.length; i++) {
                      urlToBase64(img[i],function(baseStr) {
                        img[i] = baseStr;
                        imgList.push({
                          img: img[i]
                        })
                        // imgList.push({
                        //     src:img[i]
                        // })
                      })
                      this.$set(obj,`${arry[j]}List`,imgList)
                    }
                  }else {
                    console.log(obj[arry[j]],'imgiiiiiii===')
                    urlToBase64(obj[arry[j]], function(baseStr) {
                      alert(22)
                      console.log(baseStr,'baseStr=======')
                      obj[arry[j]] = baseStr
                      //that.$set(obj,arry[i],obj[arry[i]])
                    })
                  }
                }
 
              }
 
              setTimeout(() => {
                viewWithImg(obj,url,this.$refs.word,imgSize);
              },3000)
            }
 
 
          },
            initWord(data,url) {
                this.dialogVisible = true
              setTimeout(() => {
                viewWithImg(data,url,this.$refs.word,this.imgSize);
              },1000)
            }
        }
    }
</script>
 
<style lang="scss">
  .dialogStyle{
    .el-dialog{
      width: clamp(860px,47%,960px) !important;
    }
    .docx-wrapper{
      background:#fff!important;
    }
  }
 
</style>
<style lang="scss" scoped>
  ::v-deep{
 
  }
</style>