|
@@ -11,7 +11,7 @@
|
|
|
class="ad-item-container"
|
|
|
v-for="(item, index) in adList"
|
|
|
:key="index">
|
|
|
- <a :href="item.s_link" target="_blank">
|
|
|
+ <a :href="item.s_link" target="_blank" :id="routerName + '-' + index">
|
|
|
<img :src="item.s_pic" />
|
|
|
</a>
|
|
|
</div>
|
|
@@ -24,6 +24,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { getAdList } from '@/api/modules/'
|
|
|
+import { getRandomString } from '@/utils/'
|
|
|
export default {
|
|
|
name: 'content-layout',
|
|
|
props: {
|
|
@@ -52,12 +53,13 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ routerName: '',
|
|
|
adCodeMap: {
|
|
|
projectInfo: 'jy-pc-bigmember-project-content-right', // 项目详情页右侧广告位code
|
|
|
- entportrait: 'jy-pc-bigmember-entportrait-content-right', // 企业情报详情页右侧广告位code
|
|
|
+ entportrayal: 'jy-pc-bigmember-entportrayal-content-right', // 企业情报详情页右侧广告位code
|
|
|
unitportrayal: 'jy-pc-bigmember-unitportrayal-content-right', // 采购单位全景分析详情页右侧广告位code
|
|
|
- month: 'jy-pc-bigmember-month-content-right',
|
|
|
- week: 'jy-pc-bigmember-week-content-right'
|
|
|
+ month: 'jy-pc-bigmember-month-content-right', // 数据月报右侧
|
|
|
+ week: 'jy-pc-bigmember-week-content-right' // 数据周报右侧
|
|
|
},
|
|
|
adList: [
|
|
|
// {
|
|
@@ -68,22 +70,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
+ this.routerName = this.$route.name
|
|
|
if (this.needAd) {
|
|
|
this.getAdvertisementList()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getRandomString,
|
|
|
async getAdvertisementList () {
|
|
|
const params = {
|
|
|
code: this.adCode
|
|
|
}
|
|
|
|
|
|
- if (!params.code) {
|
|
|
- const routeName = this.$route.name
|
|
|
+ if (!params.code) { // 先从props中取出参数,如果没取到,就从map中取
|
|
|
+ const routeName = this.routerName
|
|
|
params.code = this.adCodeMap[routeName]
|
|
|
}
|
|
|
|
|
|
- if (!params.code) return
|
|
|
+ if (!params.code) return console.warn('请传入adCode参数')
|
|
|
|
|
|
const { data } = await getAdList(params)
|
|
|
|