链接图片查询

This commit is contained in:
shenyanpei
2021-12-02 10:36:01 +08:00
parent 9dd767c50d
commit ec2091875f
3 changed files with 86 additions and 89 deletions
@@ -415,10 +415,11 @@ export default {
this.sarStandardsInfoEO.url = row.url this.sarStandardsInfoEO.url = row.url
this.sarStandardsInfoEO.sortId = row.sortId this.sarStandardsInfoEO.sortId = row.sortId
this.sarStandardsInfoEO.icon = row.icon this.sarStandardsInfoEO.icon = row.icon
if (row.id !== '') { if (row.icon !== '') {
let imgId = { let imgId = {
id: row.id id: row.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) { if (res.ok) {
const src = const src =
@@ -451,12 +452,12 @@ export default {
} }
}) })
this.linkListFirst.forEach(item => { this.linkListFirst.forEach(item => {
if (item.id !== '') { if (item.icon !== '') {
let imgId = { let imgId = {
id: item.id id: item.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) {
const src = const src =
"data:image/png;base64," + "data:image/png;base64," +
btoa( btoa(
@@ -464,7 +465,6 @@ export default {
(data, byte) => data + String.fromCharCode(byte), "") (data, byte) => data + String.fromCharCode(byte), "")
) )
item.icon = src item.icon = src
}
}) })
} }
}) })
@@ -526,13 +526,16 @@ export default {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.avatar-uploader .el-upload:hover { .avatar-uploader .el-upload:hover {
margin-top: 10px; margin-top: 10px;
border-color: #409EFF; border-color: #409EFF;
} }
.avatar-uploader { .avatar-uploader {
margin-top: 10px; margin-top: 10px;
} }
.avatar-uploader-icon { .avatar-uploader-icon {
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
@@ -541,14 +544,17 @@ export default {
line-height: 100px; line-height: 100px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 100px; width: 100px;
height: 100px; height: 100px;
display: block; display: block;
} }
.filter-tree { .filter-tree {
height: calc(~'100% - 50px') height: calc(~'100% - 50px')
} }
/deep/ .el-input.is-disabled .el-input__inner { /deep/ .el-input.is-disabled .el-input__inner {
background-color: #fff; background-color: #fff;
} }
@@ -56,7 +56,8 @@
prop="icon" prop="icon"
label="链接图标"> label="链接图标">
<template slot-scope="scope"> <template slot-scope="scope">
<img style="height: 50px;width: 50px" :src="scope.row.icon"> <img v-if="scope.row.icon !== ''" style="height: 50px;width: 50px" :src="scope.row.icon">
<span v-else>{{ '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -131,7 +132,6 @@
:before-upload="beforeAvatarUpload"> :before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar"> <img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i> <i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="链接" prop="url" label-width="150px" class="add-form-item"> <el-form-item label="链接" prop="url" label-width="150px" class="add-form-item">
@@ -155,6 +155,7 @@
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import {getImg} from '@/api/linkApi.js' import {getImg} from '@/api/linkApi.js'
import listOfCost from "../../../../regulatoryRepository/dataStatis/page/listOfCost"; import listOfCost from "../../../../regulatoryRepository/dataStatis/page/listOfCost";
export default { export default {
name: "secondLink", name: "secondLink",
data() { data() {
@@ -414,20 +415,19 @@ export default {
this.sarStandardsInfoEO.url = row.url this.sarStandardsInfoEO.url = row.url
this.sarStandardsInfoEO.sortId = row.sortId this.sarStandardsInfoEO.sortId = row.sortId
this.sarStandardsInfoEO.icon = row.icon this.sarStandardsInfoEO.icon = row.icon
if (row.id !== '') { if (row.icon !== '') {
let imgId = { let imgId = {
id: row.id id: row.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) {
const src = const src =
"data:image/png;base64," + "data:image/png;base64," +
btoa( btoa(
new Uint8Array(res).reduce( new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "") (data, byte) => data + String.fromCharCode(byte), "")
) )
item.icon = src this.imageUrl = src
}
}) })
} }
this.dialogTitle = '修改链接' this.dialogTitle = '修改链接'
@@ -450,10 +450,11 @@ export default {
} }
}) })
this.linkListSecond.forEach(item => { this.linkListSecond.forEach(item => {
if (item.id !== '') { if (item.icon !== '') {
let imgId = { let imgId = {
id: item.id id: item.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) { if (res.ok) {
const src = const src =
@@ -525,13 +526,16 @@ export default {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.avatar-uploader .el-upload:hover { .avatar-uploader .el-upload:hover {
margin-top: 10px; margin-top: 10px;
border-color: #409EFF; border-color: #409EFF;
} }
.avatar-uploader { .avatar-uploader {
margin-top: 10px; margin-top: 10px;
} }
.avatar-uploader-icon { .avatar-uploader-icon {
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
@@ -540,14 +544,17 @@ export default {
line-height: 100px; line-height: 100px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 100px; width: 100px;
height: 100px; height: 100px;
display: block; display: block;
} }
.filter-tree { .filter-tree {
height: calc(~'100% - 50px') height: calc(~'100% - 50px')
} }
/deep/ .el-input.is-disabled .el-input__inner { /deep/ .el-input.is-disabled .el-input__inner {
background-color: #fff; background-color: #fff;
} }
+5 -21
View File
@@ -58,6 +58,7 @@
<script> <script>
import {getImg} from '@/api/linkApi.js' import {getImg} from '@/api/linkApi.js'
export default { export default {
name: 'Empennage', name: 'Empennage',
components: {}, components: {},
@@ -125,12 +126,12 @@ export default {
} }
}) })
this.linkListFirst.forEach(item => { this.linkListFirst.forEach(item => {
if (item.id !== '') { if (item.icon !== '') {
let imgId = { let imgId = {
id: item.id id: item.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) {
const src = const src =
"data:image/png;base64," + "data:image/png;base64," +
btoa( btoa(
@@ -138,17 +139,16 @@ export default {
(data, byte) => data + String.fromCharCode(byte), "") (data, byte) => data + String.fromCharCode(byte), "")
) )
item.icon = src item.icon = src
}
}) })
} }
}) })
this.linkListSecond.forEach(item => { this.linkListSecond.forEach(item => {
if (item.id !== '') { if (item.icon !== '') {
let imgId = { let imgId = {
id: item.id id: item.id
} }
// 图片转base64
getImg(imgId).then(res => { getImg(imgId).then(res => {
if (res.ok) {
const src = const src =
"data:image/png;base64," + "data:image/png;base64," +
btoa( btoa(
@@ -156,27 +156,11 @@ export default {
(data, byte) => data + String.fromCharCode(byte), "") (data, byte) => data + String.fromCharCode(byte), "")
) )
item.icon = src item.icon = src
}
}) })
} }
}) })
}) })
}, },
getImgLink(row) {
let imgId = {
id: row.icon
}
getImg(imgId).then(res=>{
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
this.verifyImg = src;
})
}
}, },
} }