<template> <!-- 自助填单页面 --> <div class="write-page flex flexc"> <Header> <div slot="title" class="title">样表展示</div> <div slot="right" class="back-home flex aic" @click="handleBackHome"> <img class="mr10" src="../../assets/img/shouye.png" /> 返回首页 </div> </Header> <div class="main flex1 flex jcc scroll3"> <div class="preview-box flex flexc aic" v-for="(v, i) in materailsList" :key="v.id" v-show="active === i" > <div class="short">{{ v.materialName }}</div> <div class="full-name">材料全称:{{ v.materiaFullName }}</div> <div class="preview-img-box flex aic jcc" :style="{ width: width * (scale / 100) + 'px', height: v.height * (scale / 100) + 'px', }" > <img :style="{ transform: `scale(${scale / 100})`, width: width + 'px', height: v.height + 'px', }" class="preview-img" :src="api + v.preViewPath" /> </div> </div> <!-- 放大,缩小 --> <div class="control-box"> <div class="control-btn" @click="handleEnlargement"> <i class="el-icon-zoom-in"></i> </div> <div class="control-btn" @click="handleShrink"> <i class="el-icon-zoom-out"></i> </div> </div> <!-- 侧边栏弹窗 --> <div class="sidebar-box" :class="{ show: !showSidebar }"> <!-- 侧边内容 --> <div class="sidebar-main"> <div class="title flex jcc aic" @click="showSidebar = false"> <span class="mr30"> 样表展示 </span> <span class="icon2"> <i class="el-icon-d-arrow-left"></i> </span> </div> <!-- 申请编号 --> <div class="apply-num tac" v-ellipsis="'340px'"> 申请编号:DX123456789 </div> <!-- 事项名称 --> <div class="matter-name tac" v-ellipsis="'340px'"> {{ matterInfo.matterName }} </div> <!-- 材料列表 --> <div class="materails-list scroll3"> <div class="materails-item pdl10" v-ellipsis="'330px'" :class="{ active: i === active }" v-for="(v, i) in materailsList" :key="v.id" @click="active = i" > {{ v.materiaFullName }} <div class="line"></div> </div> </div> </div> <!-- 侧边按钮 --> <div class="sidebar-btn flex jcc aic" v-show="!showSidebar" @click="showSidebar = true" > <div class="sidebar-btn-text flex flexc aic"> <span class="sidebar-btn-title"> 样表展示 </span> <span class="mt15 mb15"> {{ active + 1 }}/{{ materailsList.length }} </span> <span class="icon1"> <i class="el-icon-d-arrow-right"></i> </span> </div> </div> </div> </div> </div> </template> <script> import Header from "@/components/Header.vue"; import { getMaterialsList } from "@/api"; import local from "@/utils/local"; export default { components: { Header, }, data() { return { api: local.getLocal("serverUrl") + "/", matterInfo: this.$route.query, materailsList: [], active: 0, scale: 100, showSidebar: false, // 切换侧边弹窗显示 width: 800, }; }, created() { this.getMaterialsList(); // this.materailsList=this.matterInfo.matterDatumList; }, methods: { handleBackHome() { this.$router.push("/"); }, // 获取材料列表 async getMaterialsList() { let res = await getMaterialsList({ page: 1, size: -1, matterId: this.matterInfo.matterId, }); let { data } = res.data.data; data.forEach((v) => { let image = new Image(); image.src = this.api + v.preViewPath; image.onload = function () { v.height = image.height; }; }); this.materailsList = data; this.active = +this.$route.query.index; }, // 放大 handleEnlargement() { this.scale += 20; if (this.scale > 200) { this.scale = 200; } }, // 缩小 handleShrink() { if (this.scale > 100) { this.scale -= 20; } else if (this.scale <= 100) { this.scale = 100; } }, }, }; </script> <style lang="less" scoped> .write-page { width: 100%; height: 100%; background-color: #f5f5f5; .back-home { font-size: 28px; font-family: Source Han Sans CN; color: #ffffff; cursor: pointer; } } .main { width: 100%; position: relative; .sidebar-box { width: 360px; min-height: 340px; padding: 10px; background: #fff; box-shadow: 6px -1px 10px 0px rgba(0, 0, 0, 0.11); border-radius: 0px 38px 8px 0px; position: fixed; top: 230px; left: 0px; z-index: 10; transition: all 500ms; .materails-list { max-height: 600px; } .title { margin-bottom: 15px; font-size: 22px; font-family: Source Han Sans CN; color: #333333; position: relative; i { font-size: 18px; } } .icon1 { width: 26px; height: 26px; background: #52a8f6; border-radius: 50%; color: var(--main-theme-color); display: flex; align-items: center; justify-content: center; color: #fff; i { font-size: 16px; } } .icon2 { display: inline-block; width: 34px; height: 34px; background: #f2f6fe; border-radius: 16px; text-align: center; line-height: 34px; color: var(--main-theme-color); position: absolute; right: 28px; } .apply-num { margin-bottom: 20px; font-size: 18px; font-family: Source Han Sans CN; color: #666666; } .matter-name { width: 186px; height: 38px; margin-bottom: 20px; background: #f2f6fe; border-radius: 4px; line-height: 38px; color: var(--main-theme-color); } .materails-item { height: 42px; line-height: 40px; font-size: 18px; font-family: Source Han Sans CN; color: #333333; } .line { height: 1px; width: 100%; background-image: linear-gradient( to right, #fff, #ccc 10%, #ccc 80%, #fff ); } .active { color: var(--main-theme-color); .line { background-image: linear-gradient( to right, #fff, var(--main-theme-color) 10%, var(--main-theme-color) 80%, #fff ); } } .sidebar-btn { width: 84px; height: 276px; background: linear-gradient( 90deg, var(--main-theme-color), var(--main-assist-color) ); box-shadow: 6px -1px 10px 0px rgba(11, 92, 233, 0.11); border-radius: 0px 38px 8px 0px; font-size: 24px; font-family: Source Han Sans CN; color: #ffffff; cursor: pointer; position: absolute; right: -84px; top: 50px; .sidebar-btn-title { writing-mode: vertical-lr; } } } .show { left: -360px; } .preview-box { width: 600px; padding-top: 50px; position: absolute; // .preview-img-box { // margin: auto; // } } .short { font-size: 26px; font-family: Source Han Sans CN; color: var(--main-theme-color); } .full-name { margin-top: 10px; margin-bottom: 24px; font-size: 20px; font-family: Source Han Sans CN; color: #888888; } // .preview-img { // } // 放大控制 .control-box { position: fixed; right: 200px; bottom: 36px; z-index: 10; .control-btn { width: 100px; height: 100px; margin-top: 40px; background: #ffffff; box-shadow: 0px 0px 24px 3px rgba(0, 0, 0, 0.07); border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; i { font-size: 54px; color: var(--main-theme-color); } } } } </style>