Browse Source

Merge branch 'master' of http://121.40.40.223:3000/zizhong.wang/konggang-city-miniprogram

Jing-Jiu 4 years ago
parent
commit
d91d8f7544
3 changed files with 59 additions and 43 deletions
  1. 25 16
      pages/index/index.vue
  2. 20 12
      pages/notice/index.vue
  3. 14 15
      pages/notice/notice_deatil.vue

+ 25 - 16
pages/index/index.vue

@@ -51,7 +51,7 @@
     <view class="notice-box">
       <view class="notice-title-box">
         <view class="notice-font">通知公告</view>
-        <view class="notice-more-font" >
+        <view class="notice-more-font">
           <view style="margin-right: 8rpx; font-size: 22rpx" @click="goNotice"
             >更多</view
           >
@@ -64,21 +64,21 @@
       </view>
       <view
         class="notice-content-box"
-        style="justify-content: flex-start;"
+        style="justify-content: flex-start"
         v-for="(item, index) in noticeList"
         :key="index"
         @click="goNoticeDeatil(item.id)"
       >
         <image
-          :src="imgUrl[item.type - 1]"
+          :src="item.icon"
           mode="aspectFit"
           style="width: 34px; height: 34px"
         ></image>
         <view class="notice-content display-around-column">
-          <view class="notice-content-font" style="margin-left:40rpx;">{{
-            titleList[item.type - 1] + item.title
+          <view class="notice-content-font" style="margin-left: 40rpx">{{
+            item.title
           }}</view>
-          <view class="notice-content-time" style="margin-left:40rpx;">{{
+          <view class="notice-content-time" style="margin-left: 40rpx">{{
             item.publish_time | globalTime
           }}</view>
         </view>
@@ -344,13 +344,6 @@ export default {
         //   time: "2021-08-03",
         // },
       ],
-      imgUrl: [
-        "/static/navList/activity-icon.png", //活动 1
-        "/static/navList/policy-icon.png", //政策 type2
-
-        "/static/navList/notice-icon.png", //通知 3
-      ],
-      titleList: ["活动预告 | ", "政策速览 | ", "通知公告 | "],
       parkList: [
         // {
         // 	url:'/static/park/1.png',
@@ -416,7 +409,7 @@ export default {
   onLoad() {
     this.getSwiperList();
     this.getPark();
-    this.getNotice()
+    this.getNotice();
     //   this.loginLoad();
   },
   methods: {
@@ -525,7 +518,7 @@ export default {
         getApp().globalData.globalTimestamp +
         "&sign=" +
         md5Sign;
-  
+
       uni.request({
         url: url,
         method: "POST",
@@ -541,7 +534,23 @@ export default {
         success: (res) => {
           if (res.data.code === 200) {
             // console.log(res.data.data.list);
-            this.noticeList = res.data.data.list.slice(0, 3);
+            this.noticeList = res.data.data.list.map((item) => {
+              switch (item.type) {
+                case "1":
+                  item.icon = "/static/navList/activity-icon.png";
+                  item.title = "活动预告 | " + item.title;
+                  break;
+                case "2":
+                  item.icon = "/static/navList/policy-icon.png";
+                  item.title = "政策速览 | " + item.title;
+                  break;
+                case "3":
+                  item.icon = "/static/navList/notice-icon.png";
+                  item.title = "通知公告 | " + item.title;
+                  break;
+              }
+              return item;
+            });
           }
         },
         fail: () => {

+ 20 - 12
pages/notice/index.vue

@@ -18,14 +18,12 @@
         @click="goNoticeDeatil(item.id)"
       >
         <image
-          :src="imgUrl[item.type - 1]"
+          :src="item.icon"
           mode="aspectFit"
           style="width: 34px; height: 34px"
         ></image>
         <view class="notice-content display-around-column">
-          <view class="notice-content-font">{{
-            titleList[item.type - 1] + item.title
-          }}</view>
+          <view class="notice-content-font">{{ item.title }}</view>
           <view class="notice-content-time">{{
             item.publish_time | globalTime
           }}</view>
@@ -58,13 +56,6 @@ export default {
         // },
       ],
       input: "",
-      imgUrl: [
-        "/static/navList/activity-icon.png", //活动 1
-        "/static/navList/policy-icon.png", //政策 type2
-
-        "/static/navList/notice-icon.png", //通知 3
-      ],
-      titleList: ["活动预告 | ", "政策速览 | ", "通知公告 | "],
     };
   },
   onLoad() {
@@ -105,7 +96,24 @@ export default {
         success: (res) => {
           if (res.data.code === 200) {
             // console.log(res.data.data.list);
-            this.noticeList = res.data.data.list;
+            this.noticeList = res.data.data.list.map((item) => {
+              switch (item.type) {
+                case "1":
+                  item.icon = "/static/navList/activity-icon.png";
+                  item.title = "活动预告 | " + item.title;
+                  break;
+                case "2":
+                  item.icon = "/static/navList/policy-icon.png";
+                  item.title = "政策速览 | " + item.title;
+                  break;
+                case "3":
+                  item.icon = "/static/navList/notice-icon.png";
+                  item.title = "通知公告 | " + item.title;
+                  break;
+              }
+              return item;
+            });
+            // this.noticeList = res.data.data.list;
           }
         },
         fail: () => {

+ 14 - 15
pages/notice/notice_deatil.vue

@@ -10,7 +10,12 @@ import ArticalDeatil from "../../components/artical-deatil/index";
 export default {
   data() {
     return {
-      model: {},
+      model: {
+        title: "",
+        way: "",
+        time: "",
+        artical: "",
+      },
       id: "",
     };
   },
@@ -19,8 +24,7 @@ export default {
   },
   onLoad(op) {
     this.id = op.id;
-    // console.log(this.id);
-    this.getNotice()
+    this.getNotice();
   },
   methods: {
     getNotice() {
@@ -53,21 +57,16 @@ export default {
         success: (res) => {
           if (res.data.code === 200) {
             let data = res.data.data;
-            this.$set(this.model, "title", data.title);
-            this.$set(this.model, "way", data.title);
+            this.model.title = data.title;
+            this.model.way = data.sponsor;
+            this.model.sponsor = data.sponsor
             let time = this.$options.filters["globalTime"](data.publish_time);
             let timeSecond = this.$options.filters["globalTimeSecond"](
               data.publish_time
             );
-            this.$set(this.model, "time", time + " " + timeSecond);
+            this.model.time = time + " " + timeSecond;
             this.getRich();
-            // console.log("ddd");
-            // console.log(timeSecond);
-            // console.log(new Date(data.addtime));
-            //mode title way  time artical
-            // console.log(res.data.data.list);
-            // this.noticeList = res.data.data.list;
-            // console.log(res.data);
+ 
           }
         },
         fail: () => {
@@ -86,9 +85,9 @@ export default {
         },
 
         success: (res) => {
-          console.log(res);
+     
           if (res.statusCode === 200) {
-            this.$set(this.model, "artical", res.data);
+            this.model.artical = res.data
           }
         },
         fail: () => {