链接新增编辑
This commit is contained in:
@@ -1,202 +1,234 @@
|
||||
<!-- 尾部链接 -->
|
||||
<template>
|
||||
<div class="link" id="link">
|
||||
<!-- 此部分暂时这样写,到后面做修改 -->
|
||||
<div style="display: inline-block;width: 15%;">
|
||||
<span class="title borderRight">友情链接</span>
|
||||
</div>
|
||||
<div style="display: inline-block;width: 80%;text-align: center">
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="http://www.sac.gov.cn/" target="_blank">国标委</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="http://www.catarc.org.cn/" target="_blank">汽标委</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="http://openstd.samr.gov.cn/bzgk/gb/index" target="_blank">国标全文公开</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="http://std.samr.gov.cn/" target="_blank">全国标准信息公共服务</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="http://jtst.mot.gov.cn/" target="_blank">交通部标准信息</a>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="https://www.un.org/zh/aboutun/structure/unece/" target="_blank">欧洲经济委员会</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="https://eur-lex.europa.eu" target="_blank">欧盟</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="https://www.interregs.com/" target="_blank">InterRegs </a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="https://tbt.sist.org.cn/cslm/wtotbttb/" target="_blank">WTO/TBT通报</a>
|
||||
</el-col>
|
||||
<el-col :span="1">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<a style="color: #0068B7;" href="https://www.iso.org/home.html" target="_blank">ISO</a>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: inline-block;width: 15%;">
|
||||
<span class="borderLeft"></span>
|
||||
<span class="myLi1" @click="$router.push('linkManage')">更多链接 ⋙</span></div>
|
||||
|
||||
|
||||
<!-- <div>
|
||||
<span class="myLi1 borderRight" v-for="(link, index) in linkList" :key="index" @click="openLinkUrl(link.url)" :title="link.name" >
|
||||
{{ link.name }}
|
||||
</span>
|
||||
<span class="myLi1" @click="$router.push('linkManage')">更多链接 ⋙</span>
|
||||
</div>
|
||||
<div v-show="false">
|
||||
<span class="myLi1 borderRight" v-for="(link, index) in linkList" :key="index" @click="openLinkUrl(link.url)" :title="link.name" >
|
||||
{{ link.name }}
|
||||
</span>
|
||||
<span class="myLi1" @click="$router.push('linkManage')">更多链接 ⋙</span>
|
||||
</div>-->
|
||||
<div class="link" id="link">
|
||||
<!-- 此部分暂时这样写,到后面做修改 -->
|
||||
<div style="display: inline-block;width: 15%;">
|
||||
<span class="title borderRight">友情链接</span>
|
||||
</div>
|
||||
<div style="display: inline-block;width: 80%;text-align: center">
|
||||
<div>
|
||||
<el-row>
|
||||
<span v-for="(item, index) in linkListFirst" :key="index">
|
||||
<el-col :span="4">
|
||||
<img
|
||||
style="height: 10px;width: 10px;margin-bottom: 3px"
|
||||
:src="item.icon"
|
||||
v-if="index < 5">
|
||||
<a v-if="index < 5" style="color: #0068B7;" @click="openLinkUrl(item.url)" target="_blank">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
</el-col>
|
||||
<el-col :span="1" v-if="index < 4" v-show="true">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="1" v-else v-show="false">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
</span>
|
||||
</el-row>
|
||||
</div>
|
||||
<div>
|
||||
<el-row>
|
||||
<span v-for="(item, index) in linkListSecond" :key="index">
|
||||
<el-col :span="4">
|
||||
<img
|
||||
style="height: 10px;width: 10px;margin-bottom: 3px"
|
||||
:src="item.icon"
|
||||
v-if="index < 5">
|
||||
<a v-if="index < 5" style="color: #0068B7;" @click="openLinkUrl(item.url)" target="_blank">
|
||||
{{ item.name }}
|
||||
</a>
|
||||
</el-col>
|
||||
<el-col :span="1" v-if="index < 4" v-show="true">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
<el-col :span="1" v-else v-show="false">
|
||||
<span class="borderMiddle"></span>
|
||||
</el-col>
|
||||
</span>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: inline-block;width: 15%;">
|
||||
<span class="borderLeft"></span>
|
||||
<span class="myLi1" @click="$router.push('linkManage')">更多链接 ⋙</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Empennage',
|
||||
components: {},
|
||||
mixins: [],
|
||||
data() {
|
||||
return {
|
||||
linkList: [],
|
||||
width: ''
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
width(val) {
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getLink();
|
||||
this.width = document.getElementById("link").offsetWidth
|
||||
let self = this
|
||||
this.screenWidth = document.body.clientWidth
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
console.log(document.body.clientWidth);
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 跳转链接
|
||||
openLinkUrl (linkUri) {
|
||||
let getHttp = linkUri.substring(0, 7)
|
||||
let getHttps = linkUri.substring(0, 8)
|
||||
if (getHttp === 'http://' || getHttps === 'https://') {
|
||||
window.open(linkUri)
|
||||
} else {
|
||||
window.open('https://' + linkUri)
|
||||
}
|
||||
},
|
||||
// 获取链接数据
|
||||
getLink () {
|
||||
var width = document.getElementById("link").offsetWidth
|
||||
this.$http.get('sarUrl/tsUrl', {
|
||||
}, {
|
||||
_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 list
|
||||
list = res.data.slice(0, c)
|
||||
this.linkList = list
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
import { getImg } from '@/api/linkApi.js'
|
||||
export default {
|
||||
name: 'Empennage',
|
||||
components: {},
|
||||
mixins: [],
|
||||
data() {
|
||||
return {
|
||||
linkListFirst: [],
|
||||
linkListSecond: [],
|
||||
width: '',
|
||||
verifyImg: '',
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
width(val) {
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getLink();
|
||||
/*this.width = document.getElementById("link").offsetWidth
|
||||
let self = this
|
||||
this.screenWidth = document.body.clientWidth
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
console.log(document.body.clientWidth);
|
||||
})
|
||||
}*/
|
||||
},
|
||||
methods: {
|
||||
// 跳转链接
|
||||
openLinkUrl(linkUri) {
|
||||
let getHttp = linkUri.substring(0, 7)
|
||||
let getHttps = linkUri.substring(0, 8)
|
||||
if (getHttp === 'http://' || getHttps === 'https://') {
|
||||
window.open(linkUri)
|
||||
} else {
|
||||
window.open('https://' + linkUri)
|
||||
}
|
||||
},
|
||||
// 获取链接数据
|
||||
getLink() {
|
||||
// var width = document.getElementById("link").offsetWidth
|
||||
this.$http.get('sarUrl/tsUrl', {}, {
|
||||
_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 list
|
||||
list = res.data*/
|
||||
res.data.forEach(item=>{
|
||||
if (item.type === 1) {
|
||||
this.linkListFirst.push(item)
|
||||
} else if(item.type === 2) {
|
||||
this.linkListSecond.push(item)
|
||||
}
|
||||
})
|
||||
this.linkListFirst.forEach(item=>{
|
||||
if (item.id !== '') {
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
this.linkListSecond.forEach(item=>{
|
||||
if (item.id !== '') {
|
||||
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
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
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;
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.link {
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
border-radius: 3px;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
box-shadow: 1px 1px 10px rgba(0,0,0,0.1);
|
||||
.borderRight {
|
||||
//padding-right: 50px;
|
||||
//margin-right: 50px;
|
||||
border-right: 2px dotted #aaa;
|
||||
}
|
||||
.borderLeft {
|
||||
margin-right: 50px;
|
||||
//padding-left: 50px;
|
||||
//margin-left: 50px;
|
||||
border-left: 2px dotted #aaa;
|
||||
}
|
||||
.borderMiddle {
|
||||
border-left: 2px dotted #aaa;
|
||||
}
|
||||
.title {
|
||||
padding-right: 40px;
|
||||
font-weight: bold;
|
||||
padding-left: 40px;
|
||||
width: 80px;
|
||||
}
|
||||
.myLi1 {
|
||||
cursor: pointer;
|
||||
color: #0068B7;
|
||||
}
|
||||
.el-col-4 {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
line-height: normal;
|
||||
margin-top: 10px;
|
||||
font-size: 5px;
|
||||
}
|
||||
}
|
||||
.link {
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
border-radius: 3px;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.borderRight {
|
||||
//padding-right: 50px;
|
||||
//margin-right: 50px;
|
||||
border-right: 2px dotted #aaa;
|
||||
}
|
||||
|
||||
.borderLeft {
|
||||
margin-right: 50px;
|
||||
//padding-left: 50px;
|
||||
//margin-left: 50px;
|
||||
border-left: 2px dotted #aaa;
|
||||
}
|
||||
|
||||
.borderMiddle {
|
||||
border-left: 2px dotted #aaa;
|
||||
}
|
||||
|
||||
.title {
|
||||
padding-right: 40px;
|
||||
font-weight: bold;
|
||||
padding-left: 40px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.myLi1 {
|
||||
cursor: pointer;
|
||||
color: #0068B7;
|
||||
}
|
||||
|
||||
.el-col-4 {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
line-height: normal;
|
||||
margin-top: 10px;
|
||||
font-size: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user