|
|
@@ -0,0 +1,206 @@
|
|
|
+<template>
|
|
|
+ <div class="page">
|
|
|
+ <img class="banner" src="@assets/png-searchAll-bg.png" alt="" />
|
|
|
+ <div class="search-box">
|
|
|
+ <van-field
|
|
|
+ class="search"
|
|
|
+ type="text"
|
|
|
+ enterkeyhint="search"
|
|
|
+ v-model="search"
|
|
|
+ placeholder="绿洲宇宙全域搜索,请输入"
|
|
|
+ >
|
|
|
+ <template #right-icon>
|
|
|
+ <img class="search-right" src="@assets/search_sosuo.png" alt="" />
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="hot-content" v-if="historys.length > 0">
|
|
|
+ <div class="title">
|
|
|
+ <span>最近搜索</span>
|
|
|
+ <img src="@assets/icon-delete.png" @click="clear" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="hot-list">
|
|
|
+ <span v-for="(item, index) in historys" :key="index" @click="getSearch(item)">{{ item }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="news-content">
|
|
|
+ <div class="title">绿洲宇宙全域公告</div>
|
|
|
+ <div class="news-list">
|
|
|
+ <div class="news" v-for="(item, index) in news" :key="index">
|
|
|
+ <div class="news-info">
|
|
|
+ <div class="text1" :class="[item.obj.subtitle ? 'van-ellipsis' : 'van-multi-ellipsis--l2']">
|
|
|
+ {{ item.obj.title }}
|
|
|
+ </div>
|
|
|
+ <div class="text2 van-ellipsis">{{ item.obj.subtitle }}</div>
|
|
|
+ <div class="flex1"></div>
|
|
|
+ <div class="time">{{ getTime(item.obj.createdAt) }}</div>
|
|
|
+ </div>
|
|
|
+ <van-image width="160" height="70" radius="8" :src="item.obj.pic" fit="cover" />
|
|
|
+ <img src="@assets/search-all-newsBg.png" class="news-bg" alt="" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import search from '../../mixins/search';
|
|
|
+export default {
|
|
|
+ mixins: [search],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ search: '',
|
|
|
+ news: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getNews();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getNews() {
|
|
|
+ return this.$http.get('/collection/recommend').then(res => {
|
|
|
+ this.news = res
|
|
|
+ .filter(item => {
|
|
|
+ return item.type === 'news';
|
|
|
+ })
|
|
|
+ .slice(0, 3);
|
|
|
+ return Promise.resolve();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getTime(time) {
|
|
|
+ return this.dayjs(time).format('MM月DD hh:mm');
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.page {
|
|
|
+ background-color: #000;
|
|
|
+ min-height: var(--app-height) !important;
|
|
|
+ position: relative;
|
|
|
+ padding-top: 45.3vw;
|
|
|
+}
|
|
|
+
|
|
|
+.banner {
|
|
|
+ width: 100%;
|
|
|
+ display: block;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.search-box {
|
|
|
+ padding: 0 20px;
|
|
|
+ .search-right {
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin-top: 1px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .search {
|
|
|
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
|
|
|
+ border-radius: 20px;
|
|
|
+ border: 1px solid #ffffff;
|
|
|
+ backdrop-filter: blur(4px);
|
|
|
+ --van-field-input-text-color: #fff;
|
|
|
+ --van-field-placeholder-text-color: #fff;
|
|
|
+ font-family: AlimamaShuHeiTi;
|
|
|
+ --van-cell-vertical-padding: 7px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.hot-content {
|
|
|
+ padding: 24px 20px;
|
|
|
+ .title {
|
|
|
+ .flex();
|
|
|
+ font-size: 16px;
|
|
|
+ font-family: AlimamaShuHeiTi;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 24px;
|
|
|
+ img {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ margin-left: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .hot-list {
|
|
|
+ span {
|
|
|
+ background: rgba(255, 255, 255, 0.1);
|
|
|
+ border-radius: 4px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #6f6f70;
|
|
|
+ line-height: 22px;
|
|
|
+ padding: 0 10px;
|
|
|
+ margin: 12px 12px 0 0;
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.news-content {
|
|
|
+ padding: 0 20px;
|
|
|
+
|
|
|
+ .news {
|
|
|
+ .flex();
|
|
|
+ align-items: stretch;
|
|
|
+ position: relative;
|
|
|
+ padding: 18px;
|
|
|
+ .van-image {
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .news + .news {
|
|
|
+ margin-top: 8px;
|
|
|
+ }
|
|
|
+ .title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-family: AlimamaShuHeiTi;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .news-list {
|
|
|
+ padding: 16px 0 50px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .news-info {
|
|
|
+ flex-grow: 1;
|
|
|
+ .flex-col();
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .text1 {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ .text2 {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #6f6f70;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ .flex1 {
|
|
|
+ flex-grow: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .time {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #6f6f70;
|
|
|
+ line-height: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .news-bg {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|