liyongli 2 jaren geleden
bovenliggende
commit
b0a47c436f
4 gewijzigde bestanden met toevoegingen van 101 en 30 verwijderingen
  1. 37 0
      src/api/index.js
  2. BIN
      src/assets/img/logo.png
  3. 63 30
      src/view/allMedia/analysis.vue
  4. 1 0
      src/view/allMedia/main.vue

+ 37 - 0
src/api/index.js

@@ -13,6 +13,11 @@ export function login(ori) {
     })
 }
 
+/**
+ * 文案校对
+ * @param {object} ori 
+ * @returns 
+ */
 export function check(ori) {
     return ajax({
         api: "/api/check",
@@ -23,3 +28,35 @@ export function check(ori) {
         }
     })
 }
+
+/**
+ * 热门话题
+ * @param {object} ori 
+ * @returns 
+ */
+export function hotRank(ori){
+    return ajax({
+        api: "/news/hotRank/list",
+        data: ori.data,
+        method: 'POST',
+        headers: {
+            Authorization: localStorage.getItem("token")
+        }
+    })
+}
+
+/**
+ * 
+ * @param {object} ori 
+ * @returns 
+ */
+export function searchData(ori){
+    return ajax({
+        api: "/news/data/search",
+        data: ori.data,
+        method: 'POST',
+        headers: {
+            Authorization: localStorage.getItem("token")
+        }
+    })
+}

BIN
src/assets/img/logo.png


+ 63 - 30
src/view/allMedia/analysis.vue

@@ -61,7 +61,6 @@
     <div class="body">
       <div class="mainTitle">
         <div class="mainTitleTool">
-          <el-checkbox v-model="removal" label="去重" @change="changeBox" />
           <el-select
             v-model="selectValue"
             class="m-2"
@@ -80,21 +79,23 @@
       </div>
       <br />
       <div class="lists">
-        <div class="list">
-          <div class="listHead">
-            #唐嫣何广智说脱口秀# 《我们的客栈》唐嫣何广智说脱口...
-          </div>
-          <div class="listSubtitle">
-            #唐嫣何广智说脱口秀# 《我们的客栈》唐嫣何广智说脱口秀好期待!
-          </div>
+        <div class="list" v-for="item in listTable" :key="item.title">
+          <div
+            class="listHead"
+            v-text="item.raw ? item.raw.title || '' : ''"
+          ></div>
+          <div
+            class="listSubtitle"
+            v-html="item.raw ? item.raw.summary || '' : ''"
+          ></div>
           <el-row>
-            <el-col :span="12" style="color: #9aa8c4;">
-              <el-icon><Clock /></el-icon> 2023-02-16 16:11:49
-              <img src="../../assets/img/hart.png" style="width: 1em;margin-left: 1em;" /> 10
+            <el-col :span="12" style="color: #9aa8c4">
+              <el-icon><Clock /></el-icon>
+              <span v-text="item.publishTime"></span>
             </el-col>
-            <el-col :span="12" style="text-align: right"> 
-                来源:
-                <span class="source">农民日报</span>
+            <el-col :span="12" style="text-align: right">
+              来源:
+              <span class="source" v-text="item.sourceWebsite"></span>
             </el-col>
           </el-row>
         </div>
@@ -104,8 +105,12 @@
 </template>
 
 <script setup>
+import dayjs from 'dayjs';
 import { ref } from 'vue';
 import { Search } from '@element-plus/icons-vue';
+import { hotRank, searchData } from '../../api/index';
+
+const nowTime = Date.now();
 const searchActive = ref({
   classification: 0,
   time: 0,
@@ -140,32 +145,30 @@ const classification = [
 const time = [
   {
     type: 'option',
-    name: '全部',
-    id: 0,
-  },
-  {
-    type: 'option',
+    time: nowTime - 86400000,
     name: '24小时',
     id: 1,
   },
   {
     type: 'option',
+    time: nowTime - 172800000,
     name: '48小时',
     id: 2,
   },
   {
     type: 'option',
+    time: nowTime - 604800000,
     name: '近7天',
     id: 3,
   },
   {
     type: 'option',
+    time: nowTime - 2592000000,
     name: '近30天',
     id: 4,
   },
 ];
 const searchText = ref('');
-const removal = ref(false);
 const selectlist = [
   {
     label: '按发布时间降序',
@@ -187,19 +190,46 @@ const selectlist = [
 const selectValue = ref(0);
 const date = ref([]);
 
+const listTable = ref([]);
+
+hotRank({}).then(res => {
+  console.log(res);
+});
+
+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,
+  };
+  search.category === '全部' ? (search.category = '') : '';
+  searchData({
+    data: search,
+  }).then(res => {
+    console.log(res.records);
+    listTable.value = res.records || [];
+  });
+};
+getList();
+
 const clickSelect = (select, index) => {
   searchActive.value[select] = index;
-  console.log(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);
 };
-
 const changeSelect = () => {
-    // 更改排序
+  // 更改排序
   console.log(selectValue.value);
 };
-const changeBox = () => {
-    // 去重
-  console.log(removal.value);
-};
 </script>
 
 <style scoped>
@@ -272,7 +302,6 @@ const changeBox = () => {
 .listHead,
 .listSubtitle {
   overflow: hidden;
-  white-space: nowrap;
   text-overflow: ellipsis;
 }
 
@@ -290,11 +319,15 @@ const changeBox = () => {
 .list:hover {
   background-color: rgba(64, 158, 255, 0.1);
 }
+.list:not(:last-child) {
+  border-bottom: 1px dashed #b9c0d3;
+}
+
 .listSubtitle {
   color: #b9c0d3;
 }
 
-.source{
-    color: #22ac38;
+.source {
+  color: #22ac38;
 }
 </style>

+ 1 - 0
src/view/allMedia/main.vue

@@ -2,6 +2,7 @@
   <el-scrollbar>
     <div class="main">
       <el-scrollbar class="menu">
+        <img src="../../assets/img/logo.png" style="width: 100%" alt="">
         <div
           @click="() => selectMenuFunc(item)"
           v-for="(item, index) in menu"