adminthw лет назад: 4
Родитель
Сommit
4a06321950

Разница между файлами не показана из-за своего большого размера
+ 13 - 7
components/artical-deatil/index.vue


+ 41 - 23
main.js

@@ -1,38 +1,56 @@
-import App from './App'
+import App from "./App";
 
 // #ifndef VUE3
-import Vue from 'vue'
-import footTabs from './components/foot-tabs/footTabs.vue'
-Vue.component('footTabs',footTabs) //挂载
-Vue.config.productionTip = false
-App.mpType = 'app'
+import Vue from "vue";
+import footTabs from "./components/foot-tabs/footTabs.vue";
+Vue.component("footTabs", footTabs); //挂载
+Vue.config.productionTip = false;
+App.mpType = "app";
 const app = new Vue({
-    ...App
-})
-app.$mount()
+  ...App,
+});
+app.$mount();
 // #endif
 
 // #ifdef VUE3
-import { createSSRApp } from 'vue'
+import {createSSRApp} from "vue";
 export function createApp() {
-  const app = createSSRApp(App)
+  const app = createSSRApp(App);
   return {
-    app
-  }
+    app,
+  };
 }
 // #endif
 
-Vue.filter('globalTime',function (value) {
-  if (value) {
-    const time = new Date(value * 1000);
-    const y = time.getFullYear();
-    const m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1);
-    const d = time.getDate() < 10 ? '0' + time.getDate(): time.getDate();
+Vue.filter("globalTime", function (value) {
+  if (value) {
+    const time = new Date(value * 1000);
+    const y = time.getFullYear();
+    const m =
+      time.getMonth() + 1 < 10
+        ? "0" + (time.getMonth() + 1)
+        : time.getMonth() + 1;
+    const d = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
     // const h = time.getHours()
     // const mm = time.getMinutes();
     // const s = time.getSeconds();
-    return y + '-' + m + '-' + d
-  } else {
-    return ''
+    return y + "-" + m + "-" + d;
+  } else {
+    return "";
+  }
+});
+
+Vue.filter("globalTimeSecond", function (value) {
+  if (value) {
+    const time = new Date(value * 1000);
+    // const y = time.getFullYear();
+    // const m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1);
+    // const d = time.getDate() < 10 ? '0' + time.getDate(): time.getDate();
+    const h = time.getHours();
+    const mm = time.getMinutes();
+    const s = time.getSeconds();
+    return h + ":" + mm + ":" + s;
+  } else {
+    return "";
   }
-});
+});

+ 82 - 24
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,18 +64,23 @@
       </view>
       <view
         class="notice-content-box"
+        style="justify-content: flex-start;"
         v-for="(item, index) in noticeList"
         :key="index"
         @click="goNoticeDeatil(item.id)"
       >
         <image
-          :src="item.url"
+          :src="imgUrl[item.type - 1]"
           mode="aspectFit"
           style="width: 34px; height: 34px"
         ></image>
         <view class="notice-content display-around-column">
-          <view class="notice-content-font">{{ item.title }}</view>
-          <view class="notice-content-time">{{ item.time }}</view>
+          <view class="notice-content-font" style="margin-left:40rpx;">{{
+            titleList[item.type - 1] + item.title
+          }}</view>
+          <view class="notice-content-time" style="margin-left:40rpx;">{{
+            item.publish_time | globalTime
+          }}</view>
         </view>
       </view>
     </view>
@@ -98,7 +103,7 @@
       </view>
       <view
         class="display-flex-start"
-        style="overflow-x: scroll;overflow-y: hidden; position: relative"
+        style="overflow-x: scroll; overflow-y: hidden; position: relative"
       >
         <view
           class="park-box"
@@ -323,22 +328,29 @@ export default {
         },
       ],
       noticeList: [
-        {
-          url: "/static/navList/policy-icon.png",
-          title: "政策速览 | 小微企业、个体工商户税费...",
-          time: "2021-08-05",
-        },
-        {
-          url: "/static/navList/activity-icon.png",
-          title: "活动预告 | 想了解跨境电商?8月5日带...",
-          time: "2021-08-04",
-        },
-        {
-          url: "/static/navList/notice-icon.png",
-          title: "通知公告 | 2022年首批次重点新材料扶...",
-          time: "2021-08-03",
-        },
+        // {
+        //   url: "/static/navList/policy-icon.png",
+        //   title: "政策速览 | 小微企业、个体工商户税费...",
+        //   time: "2021-08-05",
+        // },
+        // {
+        //   url: "/static/navList/activity-icon.png",
+        //   title: "活动预告 | 想了解跨境电商?8月5日带...",
+        //   time: "2021-08-04",
+        // },
+        // {
+        //   url: "/static/navList/notice-icon.png",
+        //   title: "通知公告 | 2022年首批次重点新材料扶...",
+        //   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',
@@ -404,6 +416,7 @@ export default {
   onLoad() {
     this.getSwiperList();
     this.getPark();
+    this.getNotice()
     //   this.loginLoad();
   },
   methods: {
@@ -477,13 +490,58 @@ export default {
         data: {
           order_by: "weight desc",
           s_show: 1,
-          page:1,
-          page_size:5
+          page: 1,
+          page_size: 5,
+        },
+        success: (res) => {
+          if (res.data.code === 200) {
+            res.data.data.list.forEach((item) => {
+              if (item.park_pics.length) {
+                item.park_pics[0].pic_path =
+                  getApp().globalData.shareUrl + item.park_pics[0].pic_path;
+              }
+            });
+            this.parkList = res.data.data.list;
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    getNotice() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=notice&action=list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+  
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: {
+          // order_by: "weight desc",
+          // s_show: 1,
+          // page: 1,
+          // page_size: 5,
         },
         success: (res) => {
           if (res.data.code === 200) {
-			res.data.data.list.forEach((item)=>{if(item.park_pics.length){item.park_pics[0].pic_path = getApp().globalData.shareUrl + item.park_pics[0].pic_path}});
-			this.parkList = res.data.data.list;
+            // console.log(res.data.data.list);
+            this.noticeList = res.data.data.list.slice(0, 3);
           }
         },
         fail: () => {

+ 81 - 20
pages/notice/index.vue

@@ -2,23 +2,33 @@
   <view class="content">
     <view class="input-box">
       <image src="/static/policy/u377.png" alt="" />
-      <input type="text" placeholder="请输入政策关键词搜索" />
+      <input
+        type="text"
+        placeholder="请输入政策关键词搜索"
+        v-model="input"
+        @confirm="getNotice"
+      />
     </view>
     <view class="notices">
       <view
         class="notice-content-box"
         v-for="(item, index) in noticeList"
         :key="index"
+        confirm-type="search"
         @click="goNoticeDeatil(item.id)"
       >
         <image
-          :src="item.url"
+          :src="imgUrl[item.type - 1]"
           mode="aspectFit"
           style="width: 34px; height: 34px"
         ></image>
         <view class="notice-content display-around-column">
-          <view class="notice-content-font">{{ item.title }}</view>
-          <view class="notice-content-time">{{ item.time }}</view>
+          <view class="notice-content-font">{{
+            titleList[item.type - 1] + item.title
+          }}</view>
+          <view class="notice-content-time">{{
+            item.publish_time | globalTime
+          }}</view>
         </view>
       </view>
     </view>
@@ -26,34 +36,83 @@
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 export default {
   data() {
     return {
       noticeList: [
-        {
-          url: "/static/navList/policy-icon.png",
-          title: "政策速览 | 小微企业、个体工商户税费...",
-          time: "2021-08-05",
-        },
-        {
-          url: "/static/navList/activity-icon.png",
-          title: "活动预告 | 想了解跨境电商?8月5日带...",
-          time: "2021-08-04",
-        },
-        {
-          url: "/static/navList/notice-icon.png",
-          title: "通知公告 | 2022年首批次重点新材料扶...",
-          time: "2021-08-03",
-        },
+        // {
+        //   url: "/static/navList/policy-icon.png",
+        //   title: "政策速览 | 小微企业、个体工商户税费...",
+        //   time: "2021-08-05",
+        // },
+        // {
+        //   url: "/static/navList/activity-icon.png",
+        //   title: "活动预告 | 想了解跨境电商?8月5日带...",
+        //   time: "2021-08-04",
+        // },
+        // {
+        //   url: "/static/navList/notice-icon.png",
+        //   title: "通知公告 | 2022年首批次重点新材料扶...",
+        //   time: "2021-08-03",
+        // },
       ],
+      input: "",
+      imgUrl: [
+        "/static/navList/activity-icon.png", //活动 1
+        "/static/navList/policy-icon.png", //政策 type2
+
+        "/static/navList/notice-icon.png", //通知 3
+      ],
+      titleList: ["活动预告 | ", "政策速览 | ", "通知公告 | "],
     };
   },
+  onLoad() {
+    this.getNotice();
+  },
   methods: {
     goNoticeDeatil(id) {
       uni.navigateTo({
         url: "/pages/notice/notice_deatil?id=" + id,
       });
     },
+    getNotice() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=notice&action=list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        // s_title: this.input,
+      };
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          if (res.data.code === 200) {
+            // console.log(res.data.data.list);
+            this.noticeList = res.data.data.list;
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
   },
 };
 </script>
@@ -78,8 +137,9 @@ export default {
       box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
       border-radius: 32rpx;
       margin-top: 20rpx;
-      justify-content: space-between;
+      // justify-content: space-between;
       .notice-content-font {
+        margin-left: 40rpx;
         font-size: 26rpx;
         color: #0d1937;
         font-weight: 600;
@@ -97,6 +157,7 @@ export default {
         white-space: nowrap;
       }
       .notice-content-time {
+        margin-left: 40rpx;
         font-size: 18rpx;
         letter-spacing: 0.02em;
         color: #cfcfcf;

+ 89 - 1
pages/notice/notice_deatil.vue

@@ -1,15 +1,103 @@
 <template>
   <view>
-    <artical-deatil></artical-deatil>
+    <artical-deatil :model="model"></artical-deatil>
   </view>
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 import ArticalDeatil from "../../components/artical-deatil/index";
 export default {
+  data() {
+    return {
+      model: {},
+      id: "",
+    };
+  },
   components: {
     ArticalDeatil,
   },
+  onLoad(op) {
+    this.id = op.id;
+    // console.log(this.id);
+    this.getNotice()
+  },
+  methods: {
+    getNotice() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=notice&action=info_by_id&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        id: this.id,
+      };
+
+      //获取文章
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        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);
+            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.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: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    getRich() {
+      uni.request({
+        url: `https://kiq.xazhima.com/content/notice/${Math.floor(
+          this.id / 1000
+        )}/${this.id}.html`,
+        method: "GET",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+
+        success: (res) => {
+          console.log(res);
+          if (res.statusCode === 200) {
+            this.$set(this.model, "artical", res.data);
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+  },
 };
 </script>
 

BIN
static/policy/u388.jpg


BIN
static/policy/u575.png