|
@@ -2,30 +2,58 @@
|
|
|
<el-card class="box-card" :body-style="{ paddingTop: '0px' }">
|
|
<el-card class="box-card" :body-style="{ paddingTop: '0px' }">
|
|
|
<div slot="header" class="clearfix">
|
|
<div slot="header" class="clearfix">
|
|
|
<img src="@/assets/img/icon/like.png" alt="" class="recommand-icon">
|
|
<img src="@/assets/img/icon/like.png" alt="" class="recommand-icon">
|
|
|
- <span>热搜排行</span>
|
|
|
|
|
|
|
+ <span>{{ cardProp.title }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div
|
|
|
|
|
- v-for="(search, index) in dataList"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- :title="search.keyword"
|
|
|
|
|
- class="item"
|
|
|
|
|
- >
|
|
|
|
|
- <div :class="rank(index + 1)">{{ index + 1 }}</div>
|
|
|
|
|
- <router-link target="_blank" :to="`/search?keyword=${search.keyword}&pageNumber=1`">
|
|
|
|
|
- {{ search.keyword }}
|
|
|
|
|
- </router-link>
|
|
|
|
|
|
|
+ <div v-if="cardProp.type === 'hotSearch'">
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="(search, index) in cardProp.dataList"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :title="search.keyword"
|
|
|
|
|
+ class="item"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div :class="rank(index + 1)">{{ index + 1 }}</div>
|
|
|
|
|
+ <router-link target="_blank" :to="`/search?keyword=${search.keyword}&pageNumber=1`">
|
|
|
|
|
+ {{ search.keyword }}
|
|
|
|
|
+ </router-link>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="cardProp.type === 'hotWatch'">
|
|
|
|
|
+ <div
|
|
|
|
|
+ v-for="(video, index) in cardProp.dataList"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :title="video.title"
|
|
|
|
|
+ class="item"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div :class="rank(index + 1)">{{ index + 1 }}</div>
|
|
|
|
|
+ <router-link target="_blank" :to="`/video/${video.videoId}`">
|
|
|
|
|
+ <span style="left: 0;margin-bottom: 0px;color: blue;">{{ video.title | ellipsis }}</span>
|
|
|
|
|
+ </router-link>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { hotKeyword } from '@/api/search'
|
|
|
|
|
-
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'HotSearch',
|
|
name: 'HotSearch',
|
|
|
|
|
+ filters: {
|
|
|
|
|
+ ellipsis(value) {
|
|
|
|
|
+ if (!value) return ''
|
|
|
|
|
+ const max = 15
|
|
|
|
|
+ if (value.length > max) {
|
|
|
|
|
+ return value.slice(0, max) + '...'
|
|
|
|
|
+ }
|
|
|
|
|
+ return value
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ props: {
|
|
|
|
|
+ cardProp: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default: null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- dataList: []
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -35,26 +63,25 @@ export default {
|
|
|
// console.log(index)
|
|
// console.log(index)
|
|
|
if (index === 1) {
|
|
if (index === 1) {
|
|
|
return 'first'
|
|
return 'first'
|
|
|
- }
|
|
|
|
|
- if (index === 2) {
|
|
|
|
|
|
|
+ } else if (index === 2) {
|
|
|
return 'second'
|
|
return 'second'
|
|
|
- }
|
|
|
|
|
- if (index === 3) {
|
|
|
|
|
|
|
+ } else if (index === 3) {
|
|
|
return 'third'
|
|
return 'third'
|
|
|
- }
|
|
|
|
|
- if (index > 3) {
|
|
|
|
|
|
|
+ } else if (index === 4) {
|
|
|
|
|
+ return 'fourth'
|
|
|
|
|
+ } else if (index === 5) {
|
|
|
|
|
+ return 'fifth'
|
|
|
|
|
+ } else if (index === 6) {
|
|
|
|
|
+ return 'sixth'
|
|
|
|
|
+ } else if (index === 7) {
|
|
|
|
|
+ return 'seventh'
|
|
|
|
|
+ } else {
|
|
|
return 'other'
|
|
return 'other'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- hotKeyword().then(res => {
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- this.dataList = res.data
|
|
|
|
|
- } else {
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
},
|
|
},
|
|
|
methods: {}
|
|
methods: {}
|
|
|
}
|
|
}
|
|
@@ -129,7 +156,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
.first {
|
|
.first {
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
- background-color: rgb(255, 74, 74);
|
|
|
|
|
|
|
+ background-color: rgb(255, 0, 0);
|
|
|
width: 22px;
|
|
width: 22px;
|
|
|
height: 22px;
|
|
height: 22px;
|
|
|
line-height: 20px;
|
|
line-height: 20px;
|
|
@@ -140,7 +167,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
.second {
|
|
.second {
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
- background-color: rgb(255, 119, 1);
|
|
|
|
|
|
|
+ background-color: rgb(255, 128, 0);
|
|
|
width: 22px;
|
|
width: 22px;
|
|
|
height: 22px;
|
|
height: 22px;
|
|
|
line-height: 20px;
|
|
line-height: 20px;
|
|
@@ -151,7 +178,51 @@ export default {
|
|
|
}
|
|
}
|
|
|
.third {
|
|
.third {
|
|
|
display: inline-block;
|
|
display: inline-block;
|
|
|
- background-color: rgb(255, 180, 0);
|
|
|
|
|
|
|
+ background-color: rgb(255, 215, 0);
|
|
|
|
|
+ width: 22px;
|
|
|
|
|
+ height: 22px;
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #ffffff;
|
|
|
|
|
+ font-size: 15px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+.fourth {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ background-color: rgb(0, 255, 0);
|
|
|
|
|
+ width: 22px;
|
|
|
|
|
+ height: 22px;
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #ffffff;
|
|
|
|
|
+ font-size: 15px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+.fifth {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ background-color: rgb(0, 255, 255);
|
|
|
|
|
+ width: 22px;
|
|
|
|
|
+ height: 22px;
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #ffffff;
|
|
|
|
|
+ font-size: 15px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+.sixth {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ background-color: rgb(0, 0, 255);
|
|
|
|
|
+ width: 22px;
|
|
|
|
|
+ height: 22px;
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #ffffff;
|
|
|
|
|
+ font-size: 15px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+}
|
|
|
|
|
+.seventh {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ background-color: rgb(128, 0, 255);
|
|
|
width: 22px;
|
|
width: 22px;
|
|
|
height: 22px;
|
|
height: 22px;
|
|
|
line-height: 20px;
|
|
line-height: 20px;
|