Bläddra i källkod

每日速递功能优化

songxy 1 månad sedan
förälder
incheckning
17cc584749

+ 6 - 1
client_h5/src/pages/dailyNotify/editors.vue

@@ -18,7 +18,7 @@
 </template>
 
 <script setup lang="ts">
-import { showNotify } from 'vant';
+import { showToast, showNotify } from 'vant';
 import { getStoreObject } from "@/utils/common";
 import reqest from "@/utils/request";
 
@@ -47,6 +47,10 @@ queryDetailById()
 
 const onSubmitHandle = () => {
   const urlApi = query.id ? "/admin-api/adm/noticeAndLearn/update" : "/admin-api/adm/noticeAndLearn/add"
+  if (!message.value) {
+    showToast ("发布内容不能为空");
+    return;
+  }
   const sendData = {
     type: '3',
     nickname: nickname,
@@ -60,6 +64,7 @@ const onSubmitHandle = () => {
       showNotify({
         type: 'primary',
         message: '发布成功',
+        duration: 2000,
         position: 'top',
         onClose() {
           router.back();          

+ 2 - 2
client_h5/src/pages/dailyNotify/index.vue

@@ -18,7 +18,7 @@
             <div v-for="(item,index) in noticeLists" :key="index" @click="clickHandler(item, false)" :class="{ handlecenter_card: true, handlecenter_card_0: index === 0 }">
               <img src="../../assets/images/mrsd_icon.png" />
               <div class="box">
-                <div class="title">{{(item['content']??'暂无标题').substring(0, 50)}}<span class="news"><img src="../../assets/images/news_icon.png" /></span></div>
+                <div class="title">{{(item['content']??'暂无标题').substring(0, 50)}}<span class="news" v-if="item['isToday']"><img src="../../assets/images/news_icon.png" /></span></div>
                 <div class="tip">
                   <span>{{ item['nickname'] }}</span>
                   <span>{{item['createTime']}}</span>
@@ -129,7 +129,7 @@ const queryDailyNotifyByPage = (isPull = false) => {
     finished.value = false;
   }
   const sendData = {
-    type: 2,
+    type: 3,
     readType: 2,
     ...pageData.value
   }

+ 41 - 1
client_h5/src/pages/home/index.scss

@@ -73,13 +73,53 @@
           }
           >.more {
             color: #333333;
-            font-size: 14px;
+            font-size: 12px;
             >.arrow {
               display: inline-block;
               margin-left: 3px;
             }
           }
         }
+        .swipe_content {
+          p {
+            margin: 0px;
+          }
+          >.title {
+            margin-top: 10px;
+            font-size: 15px;
+            color: #0E1F38;
+            font-weight: bold;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            overflow: hidden;
+          }
+          >.tip {
+            margin-top: 6px;
+            display: flex;
+            align-items: center;
+            >span {
+              font-size: 12px;
+              color: #607083;
+              margin-right: 5px;
+              &:last-child {
+                padding-left: 6px;
+                position: relative;
+                &::before {
+                  content: "";
+                  display: block;
+                  position: absolute;
+                  left: 0px;
+                  height: 10px;
+                  width: 1px;
+                  top: 0px;
+                  bottom: 0px;
+                  margin: auto;
+                  background-color: #C1CAD5;
+                }
+              }
+            }
+          }
+        }
       }
     }
     &.content {

+ 27 - 13
client_h5/src/pages/home/index.vue

@@ -126,24 +126,38 @@ async function queryNoticeAndLearnCount() {
 }
 queryNoticeAndLearnCount();
 /**
- * 获取通知公告角标
+ * 获取每日速递最新数据
  */
+const dailyNotifyList = ref([])
 async function queryNotifyByNewThree() {
   const urlApi = `/admin-api/adm/noticeAndLearn/query/page`;
   const sendData = {
     "pageNo": 1,
-    "pageSize": 10,
-    "type": 1,
+    "pageSize": 3,
+    "type": 3,
     "nickname": "",
-    "createTime": null,
     "title": "",
     "readType": 2
   }
   const result = await request.post(urlApi, sendData);
-  console.log("result----------------------")
-  console.log(result)
+  if (result.data) {
+    dailyNotifyList.value = result.data.list;
+  }
 }
 queryNotifyByNewThree()
+const clickHandler = (item: any) => {
+  router.push({
+    path: '/dailyNotifyDetail',
+    query: {
+      id: item['id']
+    }
+  });
+}
+const onNotifyMoreHandle = () => {
+  router.push({
+    path: '/dailyNotify'
+  });
+}
 const toPageHandle = (path: string) => {
   router.push({
     path,
@@ -197,16 +211,16 @@ const getAssetURL = (image: string) => {
       <div class="box">
         <div class="top">
           <span class="title_img"><img src="../../assets/images/notify_title.png" /></span>
-          <span class="more">更多<span class="arrow">></span></span>
+          <span class="more" @click="onNotifyMoreHandle">更多<span class="arrow">></span></span>
         </div>
         <div class="content">
           <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
-            <van-swipe-item>
-              <div class="swipe_content">
-                <p class="title">杭州自然资源规划局将在5月20日开展信息化</p>
-                <p class="info">
-                  <span>空间信息研究院—陈旭明</span>
-                  <span>5月13日 10:15</span>
+            <van-swipe-item v-for="(item, index) in dailyNotifyList" :key="index">
+              <div class="swipe_content" @click="clickHandler(item,)">
+                <p class="title">{{item['content']}}</p>
+                <p class="tip">
+                  <span>{{ item['nickname'] }}</span>
+                  <span>{{item['createTime']}}</span>
                 </p>
               </div>
             </van-swipe-item>

+ 0 - 2
client_h5/src/router/index.ts

@@ -14,8 +14,6 @@ const router = createRouter({
 })
 // 路由加载前
 router.beforeEach((to, from, next) => {
-  next()
-  return
   getUserInfoPromise(true).then((isLogin) => {
     next()
     if (!isLogin) {

+ 4 - 3
zjugis-module-adm/zjugis-module-adm-biz/src/main/java/com/zjugis/module/adm/service/noticeAndLearn/NoticeAndLearnServiceImpl.java

@@ -2,6 +2,7 @@ package com.zjugis.module.adm.service.noticeAndLearn;
 
 import com.zjugis.framework.common.pojo.PageResult;
 import com.zjugis.framework.web.core.util.WebFrameworkUtils;
+import com.zjugis.module.adm.controller.admin.noticeLearn.vo.NoticeAndLearnBaseVO;
 import com.zjugis.module.adm.controller.admin.noticeLearn.vo.NoticeAndLearnCreateReqVO;
 import com.zjugis.module.adm.controller.admin.noticeLearn.vo.NoticeAndLearnPageReqVO;
 import com.zjugis.module.adm.controller.admin.noticeLearn.vo.NoticeAndLearnRespVO;
@@ -92,15 +93,15 @@ public class NoticeAndLearnServiceImpl implements NoticeAndLearnService {
             LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
             item.setIsToday(localDate.equals(today) ? true : false);
             return !localDate.isBefore(threeDaysAgo) && !localDate.isAfter(today);
-        }).collect(Collectors.toList()));    //近三日
+        }).sorted(Comparator.comparing(NoticeAndLearnBaseVO::getCreateTime).reversed()).collect(Collectors.toList()));    //近三日
         map.put("1", lists.stream().filter(item->{
             Date date = item.getCreateTime();
             LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
             return localDate.equals(today);
-        }).collect(Collectors.toList()));    //今日
+        }).sorted(Comparator.comparing(NoticeAndLearnBaseVO::getCreateTime).reversed()).collect(Collectors.toList()));    //今日
 
         String userId = WebFrameworkUtils.getLoginUserId();
-        map.put("3", lists.stream().filter(item->item.getCreator().equals(userId)).collect(Collectors.toList()));   //我的
+        map.put("3", lists.stream().filter(item->item.getCreator().equals(userId)).sorted(Comparator.comparing(NoticeAndLearnBaseVO::getCreateTime).reversed()).collect(Collectors.toList()));   //我的
         return map;
     }