链接图片查询

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
@@ -57,7 +57,7 @@
label="链接图标">
<template slot-scope="scope">
<img v-if="scope.row.icon !== ''" style="height: 50px;width: 50px" :src="scope.row.icon">
<span v-else>{{'-'}}</span>
<span v-else>{{ '-' }}</span>
</template>
</el-table-column>
<el-table-column
@@ -154,7 +154,7 @@
<script>
import Sortable from 'sortablejs'
import { getImg } from '@/api/linkApi.js'
import {getImg} from '@/api/linkApi.js'
export default {
name: "firstLink",
@@ -415,11 +415,12 @@ export default {
this.sarStandardsInfoEO.url = row.url
this.sarStandardsInfoEO.sortId = row.sortId
this.sarStandardsInfoEO.icon = row.icon
if (row.id !== '') {
if (row.icon !== '') {
let imgId = {
id: row.id
}
getImg(imgId).then(res=>{
// 图片转base64
getImg(imgId).then(res => {
if (res.ok) {
const src =
"data:image/png;base64," +
@@ -445,26 +446,25 @@ export default {
loading: 'Loading'
}, res => {
this.linkList = res.data
res.data.forEach(item=>{
res.data.forEach(item => {
if (item.type === 1) {
this.linkListFirst.push(item)
}
})
this.linkListFirst.forEach(item=>{
if (item.id !== '') {
this.linkListFirst.forEach(item => {
if (item.icon !== '') {
let imgId = {
id: item.id
}
getImg(imgId).then(res=>{
if (res.ok) {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
}
// 图片转base64
getImg(imgId).then(res => {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
})
}
})
@@ -526,13 +526,16 @@ export default {
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
margin-top: 10px;
border-color: #409EFF;
}
.avatar-uploader {
margin-top: 10px;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
@@ -541,15 +544,18 @@ export default {
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
.filter-tree {
height: calc(~'100% - 50px')
}
/deep/.el-input.is-disabled .el-input__inner {
/deep/ .el-input.is-disabled .el-input__inner {
background-color: #fff;
}
}
@@ -56,7 +56,8 @@
prop="icon"
label="链接图标">
<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>
</el-table-column>
<el-table-column
@@ -131,7 +132,6 @@
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="链接" prop="url" label-width="150px" class="add-form-item">
@@ -153,8 +153,9 @@
<script>
import Sortable from 'sortablejs'
import { getImg } from '@/api/linkApi.js'
import {getImg} from '@/api/linkApi.js'
import listOfCost from "../../../../regulatoryRepository/dataStatis/page/listOfCost";
export default {
name: "secondLink",
data() {
@@ -414,20 +415,19 @@ export default {
this.sarStandardsInfoEO.url = row.url
this.sarStandardsInfoEO.sortId = row.sortId
this.sarStandardsInfoEO.icon = row.icon
if (row.id !== '') {
if (row.icon !== '') {
let imgId = {
id: row.id
}
getImg(imgId).then(res=>{
if (res.ok) {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
}
// 图片转base64
getImg(imgId).then(res => {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
this.imageUrl = src
})
}
this.dialogTitle = '修改链接'
@@ -444,17 +444,18 @@ export default {
loading: 'Loading'
}, res => {
this.linkList = res.data
res.data.forEach(item=>{
res.data.forEach(item => {
if (item.type === 2) {
this.linkListSecond.push(item)
}
})
this.linkListSecond.forEach(item=>{
if (item.id !== '') {
this.linkListSecond.forEach(item => {
if (item.icon !== '') {
let imgId = {
id: item.id
}
getImg(imgId).then(res=>{
// 图片转base64
getImg(imgId).then(res => {
if (res.ok) {
const src =
"data:image/png;base64," +
@@ -525,13 +526,16 @@ export default {
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
margin-top: 10px;
border-color: #409EFF;
}
.avatar-uploader {
margin-top: 10px;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
@@ -540,15 +544,18 @@ export default {
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
.filter-tree {
height: calc(~'100% - 50px')
}
/deep/.el-input.is-disabled .el-input__inner {
/deep/ .el-input.is-disabled .el-input__inner {
background-color: #fff;
}
}
+36 -52
View File
@@ -57,7 +57,8 @@
</template>
<script>
import { getImg } from '@/api/linkApi.js'
import {getImg} from '@/api/linkApi.js'
export default {
name: 'Empennage',
components: {},
@@ -105,78 +106,61 @@ export default {
_this: this,
loading: 'Loading'
}, res => {
/* let b = 0
let c = 0
for (let a = 0; a < res.data.length; a++) {
b += res.data[a].name.length * 14 + 100
if (b > width) {
c = a - 1
} else {
c = a
}
}*/
/* let b = 0
let c = 0
for (let a = 0; a < res.data.length; a++) {
b += res.data[a].name.length * 14 + 100
if (b > width) {
c = a - 1
} else {
c = a
}
}*/
/*let list
list = res.data*/
res.data.forEach(item=>{
res.data.forEach(item => {
if (item.type === 1) {
this.linkListFirst.push(item)
} else if(item.type === 2) {
} else if (item.type === 2) {
this.linkListSecond.push(item)
}
})
this.linkListFirst.forEach(item=>{
if (item.id !== '') {
this.linkListFirst.forEach(item => {
if (item.icon !== '') {
let imgId = {
id: item.id
}
getImg(imgId).then(res=>{
if (res.ok) {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
}
// 图片转base64
getImg(imgId).then(res => {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
})
}
})
this.linkListSecond.forEach(item=>{
if (item.id !== '') {
this.linkListSecond.forEach(item => {
if (item.icon !== '') {
let imgId = {
id: item.id
}
getImg(imgId).then(res=>{
if (res.ok) {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
item.icon = src
}
// 图片转base64
getImg(imgId).then(res => {
const src =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte), "")
)
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;
})
}
},
}