vue2 img src 无法显示问题

1、页面标签这样写

<img :src="pdf2wordUrl" alt="Image">

2、data这样定义

pdf2wordUrl: imgOff,

3、import这样写

    import imgOn from '../../assets/on.png'
    import imgOff from '../../assets/off.png'

4、转换代码

                if (type == 'pdf2word') {
                    this.convertTitle = 'pdf 转换 word'
                    this.turnOff()
                    this.pdf2wordUrl = imgOn
                }

完整代码参考

<template>
    <div class="body">
        <div class="zhanwei" v-if="zhanwei"></div>
        <div style="height: 60px"></div>
        <div class="content">
            <div class="title">
                <div @click="tabChange('pdf2word')" id="div1">
                    <img :src="pdf2wordUrl" alt="Image">
                    pdf转换Word &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
                <div @click="tabChange('pdf2excel')" id="div2">
                    <img :src="pdf2excelUrl" alt="Image">
                    pdf转换Excel &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
                <div @click="tabChange('pdf2ppt')" id="div3">
                    <img :src="pdf2pptUrl" alt="Image">
                    pdf转换PPT &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
                <div @click="tabChange('pdf2jpg')" id="div4">
                    <img :src="pdf2jpgUrl" alt="Image">
                    pdf转换图片 &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
                <div @click="tabChange('pdf2html')" id="div5">
                    <img :src="pdf2htmlUrl" alt="Image">
                    pdf转换Html &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
                <div @click="tabChange('pdf2text')" id="div6">
                    <img :src="pdf2textUrl" alt="Image">
                    pdf转换Text &nbsp;&nbsp;&nbsp;
                    <a-divider dashed/>
                </div>
            </div>
            <div class="upload">
            </div>
            <div class="text-pdf">
                {{convertTitle}}
            </div>
            <div class="text-pdf-file">
                将文件拖到此处,或点击选择文件按钮,小于100MB,请不要上传电子书等存在侵权的资源!
            </div>
            <div class="text-pdf-file">
                <input @change="handleFileUpload" class="button-add" type="file">
                <a-button :block="true" @click="pdf2word()" class="button-pro" style="text-align: center"
                          type="primary">
                    开始处理
                </a-button>
            </div>
        </div>
    </div>
</template>
<script>
    import PermissionModal from './modules/PermissionModal'
    import GlobalFooter from '@/components/page/GlobalFooter'
    import { JeecgListMixin } from '@/mixins/JeecgListMixin'
    import PermissionDataRuleList from './PermissionDataRuleList'
    import JEllipsis from '@/components/jeecg/JEllipsis'
    import http from '@api/url'
    import imgOn from '../../assets/on.png'
    import imgOff from '../../assets/off.png'
    export default {
        name: 'pdf2excel',
        mixins: [JeecgListMixin],
        components: {
            PermissionDataRuleList,
            PermissionModal,
            GlobalFooter,
            JEllipsis
        },
        data() {
            return {
                consoleText: '',
                file: null,
                timer: null,
                zhanwei: false,
                aLiModeData: {
                    'model': 'wanx-v1',
                    'input': {
                        'prompt': '一只奔跑的猫'
                    },
                    'parameters': {
                        'style': '<sketch>',
                        'size': '1024*1024',
                        'n': 1,
                        'seed': 42,
                        'strength': 0.5,
                        'ref_mode': 'repaint'
                    }
                },
                otherModeData: {
                    modelKey: '',
                    prompt: '',
                    sizeIndex: 0,
                    styleIndex: 0,
                },
                userShow: true,
                image1: 'require(\'@/assets/on.png\')',
                image2: 'require(\'@/assets/off.png\')',
                currentImage: '',
                pdf2wordUrl: imgOff,
                pdf2excelUrl: imgOff,
                pdf2pptUrl: imgOff,
                pdf2jpgUrl: imgOff,
                pdf2htmlUrl: imgOff,
                pdf2textUrl: imgOff,
                aLiModeData: {
                    'url': '',
                },
                aLiDocFind: {
                    'id': '',
                },
                flag: '0',
                convertTitle: 'pdf 转换 word'
            }
        },
        mounted() {
            // 添加滚动事件监听
            window.addEventListener('scroll', this.handleScroll)
            this.currentImage = this.image1
        },
        beforeDestroy() {
            // 移除滚动事件监听
            window.removeEventListener('scroll', this.handleScroll)
        },
        methods: {
            handleScroll() {
                // 处理滚动事件
                if (window.scrollY >= 20) {
                    this.zhanwei = true
                } else {
                    this.zhanwei = false
                }
            },
            handleFileUpload(event) {
                this.file = event.target.files[0]
            },
            submitFile() {
                if (!this.file) {
                    alert('请选择一个文件')
                    return
                }
                const formData = new FormData()
                formData.append('file', this.file)
            },
            pdf2word() {
                const formData = new FormData()
                formData.append('file', this.file)
                http.post('/upload/file', formData, {
                    headers: {
                        'Content-Type': 'multipart/form-data'
                    }
                })
                    .then((response) => {
                        console.log('pdf2word response data:', response)
                        console.log('pdf2word response data:', response.data.url)
                        // 处理响应
                        this.aLiModeData.url = response.data.url
                        this.pdf2wordByaliyunProcStepOne()
                    })
                    .catch((error) => {
                        console.log(error)
                    })
            },
            pdf2wordByaliyunProcStepOne() {
                //调用阿里云api开始处理
                http.post('/concert/pdfToWord', this.aLiModeData)
                    .then((response) => {
                        console.log('concert/pdfToWord 9999:', response)
                        this.aLiDocFind.id = response.data.data.body.Data.Id
                        this.pdf2wordByaliyunProcStep02()
                    })
                    .catch((error) => {
                        console.log(error)
                    })
            },
            pdf2wordByaliyunProcStep02() {
                //this.aLiDocFind.id = 'docmind-20240704-e0c78c564b7f4da9820774ef3e008bff'
                http.post('/getConvertResult/GetDocumentConvertResult', this.aLiDocFind)
                    .then((response) => {
                        console.log('-----------------monitor start------', response.data.data.body.Completed)
                        if (response.data.data.body.Completed.toString() == 'false') {
                            console.log('-----------------monitor start------')
                            this.monitor()
                        } else {
                            // clearInterval(this.timer); // 销毁组件前清除定时器
                            //alert("clearInterval time");
                            clearInterval(this.timer)
                            console.log('-----------------finish------', response)
                            console.log('-----------------finish------', response.data.data.body.Data[0].Url)
                            // 打开一个新窗口或新标签,并导航到指定的URL
                            //window.open(response.data.data.body.Data[0].Url, '_blank')
                        }
                    })
                    .catch((error) => {
                        console.log(error)
                    })
            },
            monitor() {
                //执行需要定时重复执行的任务
                this.timer = setInterval(() => {
                    console.log('timer start ')
                    this.pdf2wordByaliyunProcStep02()
                }, 2000) // 每2秒钟执行一次
            },
            tabChange(type) {
                if (type == 'pdf2word') {
                    this.convertTitle = 'pdf 转换 word'
                    this.turnOff()
                    this.pdf2wordUrl = imgOn
                }
                if (type == 'pdf2excel') {
                    this.convertTitle = 'pdf 转换 excel'
                    this.turnOff()
                    this.pdf2excelUrl = imgOn
                }
                if (type == 'pdf2ppt') {
                    this.convertTitle = 'pdf 转换 ppt'
                    this.turnOff()
                    this.pdf2pptUrl = imgOn
                }
                if (type == 'pdf2jpg') {
                    this.convertTitle = 'pdf 转换 jpg'
                    this.turnOff()
                    this.pdf2jpgUrl = imgOn
                }
                if (type == 'pdf2html') {
                    this.convertTitle = 'pdf 转换 html'
                    this.turnOff()
                    this.pdf2htmlUrl = imgOn
                }
                if (type == 'pdf2text') {
                    this.convertTitle = 'pdf 转换 text'
                    this.turnOff()
                    this.pdf2textUrl = imgOn
                }
            },
            turnOff() {
                this.pdf2wordUrl = imgOff
                this.pdf2excelUrl = imgOff
                this.pdf2pptUrl = imgOff
                this.pdf2jpgUrl = imgOff
                this.pdf2htmlUrl = imgOff
                this.pdf2textUrl = imgOff
            },
            turnOn() {
                this.pdf2wordUrl = imgOn
                this.pdf2excelUrl = imgOn
                this.pdf2pptUrl = imgOn
                this.pdf2jpgUrl = imgOn
                this.pdf2htmlUrl = imgOn
                this.pdf2textUrl = imgOn
            },
            // 上传图片
            handleChange(info) {
                const status = info.file.status
                if (status !== 'uploading') {
                    // console.log(info.file, info.fileList);
                }
                if (status === 'done') {
                    this.$message.success(`${info.file.name} file uploaded successfully.`)
                } else if (status === 'error') {
                    this.$message.error(`${info.file.name} file upload failed.`)
                }
            }
        }
    }
</script>
<style lang="less" scoped>
    .zhanwei {
        //background-color: #ffffff;
        width: 100%;
        height: 110px;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 8;
        background: url(../../assets/imgs/home_backCopy.png) no-repeat 100%;
        /*background-image: url("assets/imgs/home_backCopy.png");*/
        background-size: 100%;
    }
    .content {
        width: 1700px;
        border-radius: 10px;
        opacity: 1;
        background: rgba(255, 255, 255, 0.5);
        box-sizing: border-box;
        border: 1px solid #FFFFFF;
        margin: auto;
        padding: 30px;
        .title {
            font-family: 思源黑体;
            font-size: 20px;
            font-weight: 500;
            line-height: normal;
            letter-spacing: 0em;
            color: #3D3D3D;
            .titleDivider {
                margin-top: 12px;
                margin-bottom: 1px;
                width: 100%;
                height: 4.12px;
                opacity: 1;
                /* 蓝紫渐变 */
                /*background: linear-gradient(95deg, #3A78FF 0%, #813BFF 95%);*/
                background: #22e2ff;
                .titleItem {
                    display: flex;
                }
            }
        }
        #div1, #div2, #div3, #div4, #div5, #div6 {
            display: inline-block;
        }
        .upload {
            margin: 60px auto 0 auto;
            width: 300px;
            height: 300px;
            border: 2px solid red;
            background-image: url('../../assets/pdf2word.png'); /* 图片背景 */
            background-size: contain;
        }
        .text-pdf {
            margin: 60px auto 0 auto;
            font-size: 70px;
            text-align: center;
            display: block;
        }
        .text-pdf-file {
            display: block;
            margin: 60px auto 0 auto;
            font-size: 40px;
            text-align: center;
        }
        .button-add {
            width: 300px;
            height: 70px;
            border-radius: 10px;
        }
        .divider {
            border-top: 1px solid #ccc; /* 分割线的颜色和宽度 */
            margin: 5px 5px 5px 5px; /* 分割线的上下外边距 */
        }
        .button-line {
            display: flex;
            margin-top: 30px;
        }
        .button-input {
            display: flex;
            margin-top: 30px;
            text-align: center;
        }
        .flex-item {
            flex: 1 1 auto;
            width: 15px;
            margin-right: 10px;
        }
        .circle {
            flex: 1 1 auto;
            width: 15px;
            margin-right: 10px;
            border-radius: 10px;
            background: #7de3c8;
        }
        .label {
            line-height: 20px;
            display: inline-block;
            margin-left: 5px;
            margin-right: 15px;
            color: #777;
        }
        .radio_type {
            width: 20px;
            height: 20px;
            appearance: none;
            position: relative;
        }
        .radio_type:before {
            content: '';
            width: 20px;
            height: 20px;
            border: 1px solid #7d7d7d;
            display: inline-block;
            border-radius: 50%;
            vertical-align: middle;
        }
        .radio_type:checked:before {
            content: '';
            width: 20px;
            height: 20px;
            border: 1px solid #c59c5a;
            background: #c59c5a;
            display: inline-block;
            border-radius: 50%;
            vertical-align: middle;
        }
        .radio_type:checked:after {
            content: '';
            width: 10px;
            height: 5px;
            border: 2px solid white;
            border-top: transparent;
            border-right: transparent;
            text-align: center;
            display: block;
            position: absolute;
            top: 6px;
            left: 5px;
            vertical-align: middle;
            transform: rotate(-45deg);
        }
        .radio_type:checked + label {
            color: #c59c5a;
        }
        .container {
            display: flex;
        }
        .left {
            width: 70%;
        }
        .right {
            width: 100%;
            margin-right: 35px;
        }
        .button-pro {
            font-size: 40px;
            width: 200px;
            height: 70px;
            margin-left: 120px;
            border-radius: 10px;
            background: repeating-linear-gradient(to right, #3c75ff, #7f3cff);
        }
    }
    .body {
        z-index: 1;
        position: relative;
    }
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/775598.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2007年下半年软件设计师【上午题】试题及答案

文章目录 2007年下半年软件设计师上午题--试题2007年下半年软件设计师上午题--答案2007年下半年软件设计师上午题–试题

YOLOV++ 详解 | 网络结构、代码解析、YOLOV 论文阅读、初识 VID

前言 代码地址&#xff1a;https://github.com/YuHengsss/YOLOV 本文网络结构按 YOLOV SwinTiny 绘制&#xff0c;不同的模型主要差异在于 Backbone&#xff0c;VID 相关的部分基本相同。 Predict Input 代码基于 vid_demo。首先会读取视频中的所有帧&#xff08;只能用短视频…

亚马逊跟卖ERP的自动调价功能,能够简易地批量设置价格规则。

跟卖的智能调价 跟卖智能调价简单说是可以上调&#xff0c;下调就是怎么说&#xff1f;上调就是它根靠根据市场最低的价格情况进行去上调。 然后添加指定条件&#xff0c;到工具栏找到指定条件&#xff0c;点击添加指定条件。 然后选择店铺&#xff0c;比如选择店铺&#xf…

p-tuning算法介绍及其pytorch代码实现

P-tuning介绍 代码实现 import torch from transformers import BertTokenizer, BertForSequenceClassification import matplotlib.pyplot as plt import matplotlib.ticker as tickertokenizer BertTokenizer.from_pretrained(bert-base-chinese) model BertForSequenceCl…

Games101学习笔记 Lecture 15: Ray Tracing 3 (Light Transport Global Illumination)

Lecture 15: Ray Tracing 3 (Light Transport & Global Illumination 一、BRDF 双向反射分布函数定义 二、反射方程 Reflection Equation三、渲染方程1.重写反射方程2.当其他的点反射的radiance作为入射 一、BRDF 双向反射分布函数 定义 计算不同的反射方向上会分布多少能…

竹云实力入选《现代企业零信任网络建设应用指南报告》代表性厂商

2024年7月3日&#xff0c;国内网络安全媒体安全牛正式发布《现代企业零信任网络建设应用指南报告(2024版)》。竹云凭借在零信任领域创新性的产品方案和优异的市场表现&#xff0c;实力入选代表性厂商。 伴随着云计算、AI、大数据等技术的发展&#xff0c;远程办公、业务协同、…

遗漏知识点

什么是RAII&#xff1f; RAII是Resource Acquisition Is Initialization&#xff08;wiki上面翻译成 “资源获取就是初始化”&#xff09;的简称&#xff0c;是C语言的一种管理资源、避免泄漏的惯用法。利用的就是C构造的对象最终会被销毁的原则。RAII的做法是使用一个对象&am…

西门子PLC1200--与电脑S7通讯

硬件构成 PLC为西门子1211DCDCDC 电脑上位机用PYTHON编写 二者通讯用网线&#xff0c;通讯协议用S7 PLC上的数据 PLC上的数据是2个uint&#xff0c;在DB1&#xff0c;地址偏移分别是0和2 需要注意的是DB块要关闭优化的块访问&#xff0c;否则是没有偏移地址的 PLC中的数据内…

VCS+Vivado联合仿真BUG

场景&#xff1a; 在vcsvivado联合仿真过程中&#xff0c;对vivado导出的shell脚本修改&#xff0c;修改某些source文件路径&#xff0c;vcs编译时会报Permission Denied。 问题描述 对shell脚本修改如下&#xff1a; 修改仅为注释掉某一行&#xff0c;下面变为source文件新…

【雷丰阳-谷粒商城 】【分布式高级篇-微服务架构篇】【20】认证服务04—SSO单点登录

持续学习&持续更新中… 守破离 【雷丰阳-谷粒商城 】【分布式高级篇-微服务架构篇】【20】认证服务04—SSO单点登录 xxl-sso多系统-单点登录单点登录流程原理图单点登录流程简单实现参考 xxl-sso https://gitee.com/xuxueli0323/xxl-sso xxl-sso是开源的一个单点登录框架 …

交换机基本原理

文章目录 前言一、交换机的转发行为二、交换机的转发原理1.MAC地址表2.交换机初始状态3.学习MAC地址4.ARP协议5.交换机转发数据帧6.目标主机回复 三、华为交换机基本命令1.VRP视图分层2.命令行补全3.命令行帮助4.配置设备名称5.命令等级6.用户界面7.配置console认证8.配置用户界…

Ubuntu系统复制文件到共享文件夹出错

1、问题描述 Ubuntu系统复制文件到共享文件夹时&#xff0c;出现拼接文件时出错&#xff1a;输入/输出错误。 使用cp命令&#xff1a; cp -Rf XXX YYY 也是出错&#xff1a; cp: 写入 xxx 出错: 输入/输出错误 2、查看磁盘空间 查看磁盘空间&#xff0c;显示空间还有剩余…

Day05-组织架构-角色管理

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 1.组织架构-编辑部门-弹出层获取数据2.组织架构-编辑部门-编辑表单校验3.组织架构-编辑部门-确认取消4.组织架构-删除部门5.角色管理-搭建页面结构6.角色管理-获取数…

第一次的pentest show总结

第一次的pentest show总结 前言 开始之前&#xff0c;我特别感谢TryHackMe(英)、HackTheBox(美)、zero-point security(英)、offsec(美)等平台&#xff0c;使我们能够通过网络以线上的方式学习与练习&#xff0c;打破传统线下各地区教育资源差异大的限制&#xff0c;对网络教…

探索Sui的面向对象模型和Move编程语言

Sui区块链作为一种新兴的一层协议&#xff08;L1&#xff09;&#xff0c;采用先进技术来解决常见的一层协议权衡问题。Cointelegraph Research详细剖析了这一区块链新秀。 Sui使用Move编程语言&#xff0c;该语言专注于资产表示和访问控制。本文探讨了Sui的对象中心数据存储模…

Python从0到100(三十七):数据提取的概念和数据分类

1. 爬虫中数据的分类 在爬虫开发过程中,我们会遇到多种类型的数据。了解这些数据的类型对于有效地提取和解析信息至关重要。 结构化数据 结构化数据是指具有固定格式和模式的数据,常见的结构化数据格式包括JSON和XML。 处理方式:可以直接转换为Python的字典或列表等数据类…

【UML用户指南】-27-对体系结构建模-制品

目录 1、组成结构 2、制品的种类 2.1、部署制品 &#xff08;deployment artifact&#xff09; 2.2、工作产品制品 &#xff08;work product artifact&#xff09; 2.3、执行制品 &#xff08;execution artifact&#xff09; 3、标准元素 4、常用建模技术 4.1、对可执…

Redis 7.x 系列【17】四种持久化策略

有道无术&#xff0c;术尚可求&#xff0c;有术无道&#xff0c;止于术。 本系列Redis 版本 7.2.5 源码地址&#xff1a;https://gitee.com/pearl-organization/study-redis-demo 文章目录 1. 概述2. 案例演示2.1 无持久化2.2 RDB2.3 AOF2.4 混合模式2.4.1 方式一&#xff1a;…

LLM - 神经网络的组成

1. 一个神经元的结构&#xff1a;即接受多个输入X向量&#xff0c;在一个权重向量W和一个偏执标量b的作用下&#xff0c;经过激活函数后&#xff0c;产生一个输出。 2. 一层神经网络的结构&#xff1a;该层网络里的每个神经元并行计算&#xff0c;得到各自的输出;计算方式是输入…

CISAW证书考完有什么用?值得投资吗?

CISAW证书&#xff0c;在信息安全领域内被公认为具有高价值的一种职业资格认证&#xff0c;它象征着持有者在该领域的专业技能和知识水平。 因此&#xff0c;CISAW证书不仅具有实质性的价值&#xff0c;还能为持有者带来诸多益处。 首先&#xff0c;拥有CISAW证书的专业人士更…