From e1aa0ecffbabd618c71e4ad94370fb8dffe6ee1c Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期日, 21 一月 2024 20:54:49 +0800
Subject: [PATCH] 优化
---
src/components/filePictrue/index.vue | 244 +++++++++++++++++++++++++-----------------------
1 files changed, 125 insertions(+), 119 deletions(-)
diff --git a/src/components/filePictrue/index.vue b/src/components/filePictrue/index.vue
index d2c5c55..c14fae1 100644
--- a/src/components/filePictrue/index.vue
+++ b/src/components/filePictrue/index.vue
@@ -1,147 +1,153 @@
<template>
- <div class="file-picture">
- <div class="file-tell">
- <div class="tell-title">涓婃姤</div>
- <div class="tell-show" v-for="item in imgSource" :key="item.id">
- <div v-if="item.type == '01'" style="display: flex">
- <div class="my-demo" v-for="childer in item.url">
- <img class="img" :src="childer" alt="" />
- <div class="tip">
- <div>銆愬浘鐗囩被鍨嬨�戜笂鎶�</div>
- <div>銆愪笂浼犳椂闂淬�憑{ changeTime(item.createTime) }}</div>
+ <div class="file-picture">
+ <div class="file-tell">
+ <div class="tell-title">涓婃姤</div>
+ <div class="tell-show" v-for="item in imgSource" :key="item.id">
+ <div v-if="item.type == '01'" style="display: flex">
+ <div class="my-demo" v-for="childer in item.url">
+ <img class="img" :src="childer" alt="" />
+ <div class="tip">
+ <div>銆愬浘鐗囩被鍨嬨�戜笂鎶�</div>
+ <div>
+ 銆愪笂浼犳椂闂淬�憑{ changeTime(item.createTime) }}
+ </div>
+ </div>
+ </div>
+ </div>
</div>
- </div>
</div>
- </div>
- </div>
- <div class="file-deal">
- <div class="tell-title">澶勭疆</div>
- <div class="tell-show" v-for="item in imgSource" :key="item.id">
- <div v-if="item.type == '02'" class="tell-demo">
- <div class="my-demo" v-for="childer in item.url">
- <img class="img" :src="childer" alt="" />
- <div class="tip">
- <!-- <div>銆愬浘鐗囩被鍨嬨�戝缃�</div> -->
- <div>銆愪笂浼犳椂闂淬�憑{ changeTime(item.createTime) }}</div>
+ <div class="file-deal">
+ <div class="tell-title">澶勭疆</div>
+ <div class="tell-show" v-for="item in imgSource" :key="item.id">
+ <div v-if="item.type == '02'" class="tell-demo">
+ <div class="my-demo" v-for="childer in item.url">
+ <img class="img" :src="childer" alt="" />
+ <div class="tip">
+ <!-- <div>銆愬浘鐗囩被鍨嬨�戝缃�</div> -->
+ <div>
+ 銆愪笂浼犳椂闂淬�憑{ changeTime(item.createTime) }}
+ </div>
+ </div>
+ </div>
+ </div>
</div>
- </div>
</div>
- </div>
</div>
- </div>
</template>
<script>
import { parseTime, FILE_ORIGINAL_URL } from "@/utils/index";
export default {
- data() {
- return {
- imgSource: [],
- };
- },
- props: ["filesPictureVo", "mycode"],
- created() {
- const {
- filesPictureVo: { imageResources: imgList },
- } = this;
+ data() {
+ return {
+ imgSource: [],
+ };
+ },
+ props: ["filesPictureVo", "mycode"],
+ created() {
+ const {
+ filesPictureVo: { imageResources: imgList },
+ } = this;
- let pic = this.filesPictureVo.imageResources;
- pic.forEach((item) => {
- if (item.url) {
- if (typeof item.url == "string") {
- let urls = item.url.split(",");
- item.url = [];
- urls.forEach((o) => {
- o = o.replace("[", "").replace("]", "");
- item.url.push(`${FILE_ORIGINAL_URL}sccg/API/img?fileUrl=${o}`);
- });
- }
- } else {
- item.url = [];
- }
- });
- this.imgSource = pic;
- // this.getEventInfo(this.mycode);
- },
- methods: {
- // 鑾峰彇token
- getToken() {
- const token = sessionStorage.getItem("token");
- const tokenHead = sessionStorage.getItem("tokenHead");
- if (token && tokenHead) {
- return { Authorization: tokenHead + token };
- }
- },
- changeTime(time) {
- if (time) {
- return parseTime(time);
- }
- },
- getEventInfo(mycode) {
- this.$axios({
- method: "get",
- url: `sccg/base_case/baseCaseDetail/${mycode}`,
- }).then((res) => {
- this.info = res.data;
- this.dialogView = true;
- let pic = res.data.filesPictureVo.imageResources;
+ let pic = this.filesPictureVo.imageResources;
pic.forEach((item) => {
- if (item.url) {
- if (typeof item.url == "string") {
- let urls = item.url.split(",");
- item.url = [];
- urls.forEach((o) => {
- o = o.replace("[", "").replace("]", "");
- item.url.push(`${FILE_ORIGINAL_URL}sccg/API/img?fileUrl=${o}`);
- });
+ if (item.url) {
+ if (typeof item.url == "string") {
+ let urls = item.url.split(",");
+ item.url = [];
+ urls.forEach((o) => {
+ o = o.replace("[", "").replace("]", "");
+ if (o !== '') {
+ item.url.push(`${FILE_ORIGINAL_URL}sccg/API/img?fileUrl=${o}`);
+ }
+ });
+ }
+ } else {
+ item.url = [];
}
- } else {
- item.url = [];
- }
});
this.imgSource = pic;
- });
+ // this.getEventInfo(this.mycode);
},
- },
+ methods: {
+ // 鑾峰彇token
+ getToken() {
+ const token = sessionStorage.getItem("token");
+ const tokenHead = sessionStorage.getItem("tokenHead");
+ if (token && tokenHead) {
+ return { Authorization: tokenHead + token };
+ }
+ },
+ changeTime(time) {
+ if (time) {
+ return parseTime(time);
+ }
+ },
+ getEventInfo(mycode) {
+ this.$axios({
+ method: "get",
+ url: `sccg/base_case/baseCaseDetail/${mycode}`,
+ }).then((res) => {
+ this.info = res.data;
+ this.dialogView = true;
+ let pic = res.data.filesPictureVo.imageResources;
+ pic.forEach((item) => {
+ if (item.url) {
+ if (typeof item.url == "string") {
+ let urls = item.url.split(",");
+ item.url = [];
+ urls.forEach((o) => {
+ o = o.replace("[", "").replace("]", "");
+ item.url.push(`${FILE_ORIGINAL_URL}sccg/API/img?fileUrl=${o}`);
+ });
+ }
+ } else {
+ item.url = [];
+ }
+ });
+ this.imgSource = pic;
+ });
+ },
+ },
};
</script>
<style lang="scss" scoped>
.file-picture {
- padding-top: 50px;
+ padding-top: 50px;
- .file-tell,
- .file-deal {
- .tell-title {
- line-height: 40px;
+ .file-tell,
+ .file-deal {
+ .tell-title {
+ line-height: 40px;
+ }
+
+ .tell-show {
+ .tell-demo {
+ display: flex;
+ flex-wrap: wrap;
+ width: 100%;
+ }
+ }
}
- .tell-show {
- .tell-demo {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- }
- }
- }
-
- .my-demo {
- position: relative;
- height: 159px;
- margin: 10px;
- }
-
- .tip {
- div {
- line-height: 20px;
+ .my-demo {
+ position: relative;
+ height: 159px;
+ margin: 10px;
}
- text-align: left;
- position: absolute;
- bottom: 0px;
- }
+ .tip {
+ div {
+ line-height: 20px;
+ }
- .img {
- width: 226px;
- height: 159px;
- }
+ text-align: left;
+ position: absolute;
+ bottom: 0px;
+ }
+
+ .img {
+ width: 226px;
+ height: 159px;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0