|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <el-scrollbar class="analysis">
|
|
|
+ <el-scrollbar ref="scrollbar" class="analysis" @scroll="scroll">
|
|
|
<div class="head">
|
|
|
<div class="title">分类舆情</div>
|
|
|
<div class="searchRow">
|
|
@@ -40,7 +40,10 @@
|
|
|
<el-date-picker
|
|
|
v-model="date"
|
|
|
:disabled="searchActive.time !== -1"
|
|
|
+ @change="change"
|
|
|
type="daterange"
|
|
|
+ :clearable="false"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
range-separator="-"
|
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
@@ -50,17 +53,17 @@
|
|
|
<div class="searchRow">
|
|
|
<div class="searchCol searchTitle">搜索:</div>
|
|
|
<div class="searchCol">
|
|
|
- <el-input
|
|
|
- v-model="searchText"
|
|
|
- placeholder="搜索文章"
|
|
|
- :suffix-icon="Search"
|
|
|
- />
|
|
|
+ <el-input v-model="searchText" placeholder="搜索文章">
|
|
|
+ <template #suffix>
|
|
|
+ <el-icon @click="search"><Search /></el-icon>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="body">
|
|
|
<div class="mainTitle">
|
|
|
- <div class="mainTitleTool">
|
|
|
+ <div class="mainTitleTool" v-if="selectlist.length">
|
|
|
<el-select
|
|
|
v-model="selectValue"
|
|
|
class="m-2"
|
|
@@ -79,7 +82,12 @@
|
|
|
</div>
|
|
|
<br />
|
|
|
<div class="lists">
|
|
|
- <div class="list" v-for="item in listTable" :key="item.title">
|
|
|
+ <div
|
|
|
+ class="list"
|
|
|
+ v-for="item in listTable"
|
|
|
+ :key="item.title"
|
|
|
+ @click="() => toDetail(item)"
|
|
|
+ >
|
|
|
<div
|
|
|
class="listHead"
|
|
|
v-text="item.raw ? item.raw.title || '' : ''"
|
|
@@ -101,16 +109,45 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="hotList">
|
|
|
+ <div class="title">
|
|
|
+ <img :src="hotIcon" style="width: 18px; height: 18px" />
|
|
|
+ 热度排行
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="hotItem"
|
|
|
+ v-for="(item, index) in listHot"
|
|
|
+ :key="item.rk"
|
|
|
+ @click="() => searchHot(item.content)"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ :style="{ color: colorRanking[index] || '#999', 'font-size': '14px' }"
|
|
|
+ >{{ index + 1 }}</span
|
|
|
+ >
|
|
|
+ {{ item.content }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-icon :size="45" class="upload" v-show="showUpload" @click="upload"
|
|
|
+ ><Upload
|
|
|
+ /></el-icon>
|
|
|
</el-scrollbar>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import dayjs from 'dayjs';
|
|
|
import { ref } from 'vue';
|
|
|
-import { Search } from '@element-plus/icons-vue';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
import { hotRank, searchData } from '../../api/index';
|
|
|
|
|
|
+import hotIcon from '../../assets/img/hot.png';
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+const colorRanking = ['#FE2D46', '#F60', '#FAA90E'];
|
|
|
const nowTime = Date.now();
|
|
|
+const scrollbar = ref();
|
|
|
+const showUpload = ref(false);
|
|
|
const searchActive = ref({
|
|
|
classification: 0,
|
|
|
time: 0,
|
|
@@ -170,75 +207,151 @@ const time = [
|
|
|
];
|
|
|
const searchText = ref('');
|
|
|
const selectlist = [
|
|
|
- {
|
|
|
- label: '按发布时间降序',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '按发布时间升序',
|
|
|
- value: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '按发情感值升序',
|
|
|
- value: 2,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '按发情感值降序',
|
|
|
- value: 3,
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // label: '按发布时间降序',
|
|
|
+ // value: 0,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '按发布时间升序',
|
|
|
+ // value: 1,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '按发情感值升序',
|
|
|
+ // value: 2,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '按发情感值降序',
|
|
|
+ // value: 3,
|
|
|
+ // },
|
|
|
];
|
|
|
const selectValue = ref(0);
|
|
|
const date = ref([]);
|
|
|
|
|
|
const listTable = ref([]);
|
|
|
+const listHot = ref([]);
|
|
|
+
|
|
|
+const pageSize = 10;
|
|
|
+let page = 1;
|
|
|
+let total = -1;
|
|
|
+let T = undefined;
|
|
|
|
|
|
hotRank({}).then(res => {
|
|
|
- console.log(res);
|
|
|
+ listHot.value = res || [];
|
|
|
});
|
|
|
|
|
|
+const toDetail = item => {
|
|
|
+ router.push({
|
|
|
+ path: '/analysis_detail',
|
|
|
+ query: {
|
|
|
+ detail: JSON.stringify(item),
|
|
|
+ },
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const getList = () => {
|
|
|
- console.log(date.value);
|
|
|
const search = {
|
|
|
category:
|
|
|
classification[searchActive.value.classification].name || undefined,
|
|
|
- city: '城市',
|
|
|
- start: time[searchActive.value['time']].time,
|
|
|
- end: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- page: 1,
|
|
|
- pageSize: 10,
|
|
|
+ city: undefined,
|
|
|
+ keywords: searchText.value,
|
|
|
+ page: page++,
|
|
|
+ pageSize,
|
|
|
};
|
|
|
search.category === '全部' ? (search.category = '') : '';
|
|
|
+ // 时间区间
|
|
|
+ if (searchActive.value['time'] === -1) {
|
|
|
+ search.start = date.value[0];
|
|
|
+ search.end = date.value[1];
|
|
|
+ } else {
|
|
|
+ search.start = dayjs(time[searchActive.value['time']].time).format(
|
|
|
+ 'YYYY-MM-DD HH:mm:ss'
|
|
|
+ );
|
|
|
+ search.end = dayjs(nowTime).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ }
|
|
|
searchData({
|
|
|
data: search,
|
|
|
- }).then(res => {
|
|
|
- console.log(res.records);
|
|
|
- listTable.value = res.records || [];
|
|
|
- });
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ const li = res.records || [];
|
|
|
+ listTable.value.push(...li);
|
|
|
+ total = res.total || 0;
|
|
|
+ if (T) T = window.clearTimeout(T);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ if (T) T = window.clearTimeout(T);
|
|
|
+ });
|
|
|
};
|
|
|
-getList();
|
|
|
|
|
|
const clickSelect = (select, index) => {
|
|
|
searchActive.value[select] = index;
|
|
|
- console.log(searchActive.value, select, index);
|
|
|
- const searchDate = {
|
|
|
- start: time[index].time,
|
|
|
- end: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- }
|
|
|
- getList(searchDate);
|
|
|
+ if (index === -1) return;
|
|
|
+ page = 1;
|
|
|
+ listTable.value = [];
|
|
|
+ changeInput();
|
|
|
};
|
|
|
const changeSelect = () => {
|
|
|
// 更改排序
|
|
|
console.log(selectValue.value);
|
|
|
};
|
|
|
+
|
|
|
+const change = () => {
|
|
|
+ date.value = [date.value[0] + ' 00:00:00', date.value[1] + ' 23:59:59'];
|
|
|
+ page = 1;
|
|
|
+ listTable.value = [];
|
|
|
+ changeInput();
|
|
|
+};
|
|
|
+
|
|
|
+const changeInput = () => {
|
|
|
+ if (total === 0 || total < page * pageSize) return;
|
|
|
+ if (T) T = window.clearTimeout(T);
|
|
|
+ T = window.setTimeout(() => {
|
|
|
+ getList();
|
|
|
+ }, 200);
|
|
|
+};
|
|
|
+
|
|
|
+const search = () => {
|
|
|
+ page = 1;
|
|
|
+ listTable.value = [];
|
|
|
+ changeInput();
|
|
|
+};
|
|
|
+
|
|
|
+const searchHot = text => {
|
|
|
+ searchText.value = text;
|
|
|
+ page = 1;
|
|
|
+ listTable.value = [];
|
|
|
+ changeInput();
|
|
|
+};
|
|
|
+
|
|
|
+const scroll = e => {
|
|
|
+ const height =
|
|
|
+ document.querySelector('.analysis .head').offsetHeight +
|
|
|
+ document.querySelector('.analysis .body').offsetHeight -
|
|
|
+ document.querySelector('.analysis').offsetHeight;
|
|
|
+ const scrollNum = e.scrollTop.toFixed(2) - 0;
|
|
|
+ if (!showUpload.value && scrollNum > 180) showUpload.value = true;
|
|
|
+ else if (scrollNum <= 180) showUpload.value = false;
|
|
|
+ if (height - scrollNum > 0 || T) return;
|
|
|
+ changeInput();
|
|
|
+};
|
|
|
+
|
|
|
+const upload = () => {
|
|
|
+ scrollbar.value.setScrollTop(0)
|
|
|
+};
|
|
|
+
|
|
|
+getList();
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.analysis {
|
|
|
height: 100%;
|
|
|
+ min-width: 1305px;
|
|
|
+ position: relative;
|
|
|
}
|
|
|
.analysis .head,
|
|
|
.analysis .body {
|
|
|
margin: 0 1em;
|
|
|
+ width: calc(100% - 400px);
|
|
|
+ min-width: 855px;
|
|
|
}
|
|
|
|
|
|
.analysis .body {
|
|
@@ -246,6 +359,13 @@ const changeSelect = () => {
|
|
|
margin: 1em;
|
|
|
}
|
|
|
|
|
|
+.analysis .hotList {
|
|
|
+ position: absolute;
|
|
|
+ width: 300px;
|
|
|
+ right: 50px;
|
|
|
+ top: 100px;
|
|
|
+}
|
|
|
+
|
|
|
.title {
|
|
|
font-size: 18px;
|
|
|
font-weight: 600;
|
|
@@ -271,11 +391,13 @@ const changeSelect = () => {
|
|
|
color: rgb(64, 158, 255);
|
|
|
}
|
|
|
|
|
|
-.searchActive {
|
|
|
+.searchActive,
|
|
|
+.hotItem:hover {
|
|
|
font-weight: 600;
|
|
|
color: rgb(64, 158, 255);
|
|
|
border-radius: 5px;
|
|
|
background-color: rgba(64, 158, 255, 0.1);
|
|
|
+ border-bottom: none;
|
|
|
}
|
|
|
|
|
|
.searchRow .searchTitle {
|
|
@@ -330,4 +452,28 @@ const changeSelect = () => {
|
|
|
.source {
|
|
|
color: #22ac38;
|
|
|
}
|
|
|
+
|
|
|
+.hotItem {
|
|
|
+ line-height: 1em;
|
|
|
+ font-size: 16px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ cursor: pointer;
|
|
|
+ padding: 0.6em;
|
|
|
+}
|
|
|
+
|
|
|
+.hotItem:not(:last-child) {
|
|
|
+ border-bottom: 1px dashed #e9e9e9;
|
|
|
+}
|
|
|
+
|
|
|
+.upload {
|
|
|
+ position: absolute;
|
|
|
+ right: 25px;
|
|
|
+ bottom: 25px;
|
|
|
+ background-color: #e9e9e990;
|
|
|
+ border-radius: 50%;
|
|
|
+ padding: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
</style>
|