Ver código fonte

招商接口对接

adminthw 4 anos atrás
pai
commit
556a5c7c01

Diferenças do arquivo suprimidas por serem muito extensas
+ 51 - 10
components/artical-deatil/index.vue


+ 87 - 1
pages/attract/attract_deatil.vue

@@ -1,15 +1,101 @@
 <template>
   <view>
-    <artical-deatil></artical-deatil>
+    <artical-deatil :model="model" :field="'business'"></artical-deatil>
   </view>
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 import ArticalDeatil from "../../components/artical-deatil/index";
 export default {
   components: {
     ArticalDeatil,
   },
+  data() {
+    return {
+      model: {
+        title: "",
+        time: "",
+        artical: "",
+        id: "",
+      },
+    };
+  },
+  onLoad(op) {
+    this.model.id = op.id;
+    // this.model.id = 1;
+    this.getAttractDeatil();
+  },
+  methods: {
+    getAttractDeatil() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=business&action=info_by_id&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        id: this.model.id,
+      };
+      //获取文章
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          // console.log(res);
+          if (res.data.code === 200) {
+            let data = res.data.data;
+            this.model.title = data.title;
+            let time = this.$options.filters["globalTime"](data.time);
+            let timeSecond = this.$options.filters["globalTimeSecond"](
+              data.time
+            );
+            this.model.time = time + " " + timeSecond;
+            this.getRich();
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    getRich() {
+      uni.request({
+        url:
+          getApp().globalData.shareUrl +
+          `content/business/${Math.floor(this.model.id / 1000)}/${
+            this.model.id
+          }.html`,
+        method: "GET",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+
+        success: (res) => {
+          console.log(res);
+          if (res.statusCode === 200) {
+            this.model.artical = res.data;
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+  },
 };
 </script>
 

+ 72 - 12
pages/attract/index.vue

@@ -30,31 +30,91 @@
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 export default {
   data() {
     return {
       attractList: [
-        {
-          url: "/static/attract/1.png",
-          title: "工业互联网",
-          subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
-          time: "2021-09-05",
-        },
-        {
-          url: "/static/attract/2.png",
-          title: "生产性服务业",
-          subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
-          time: "2021-09-05",
-        },
+        // {
+        //   url: "/static/attract/1.png",
+        //   title: "工业互联网",
+        //   subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
+        //   time: "2021-09-05",
+        // },
+        // {
+        //   url: "/static/attract/2.png",
+        //   title: "生产性服务业",
+        //   subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
+        //   time: "2021-09-05",
+        // },
       ],
     };
   },
+  onLoad() {
+    this.getAttract();
+  },
   methods: {
     goAttractDeatil(id) {
       uni.navigateTo({
         url: "/pages/attract/attract_deatil?id=" + id,
       });
     },
+    getAttract() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=business&action=list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        page: 1,
+        page_size: 5,
+      };
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          console.log(res);
+          if (res.data.code === 200) {
+            let list = res.data.data.list;
+            this.attractList = list.map((item) => {
+              /*
+                  title: "生产性服务业",
+                  subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
+                  time: "2021-09-05",
+             */
+              let ob = {
+                url: "",
+                subtitle: "",
+                id: "",
+                title: "",
+              };
+              ob.url = item.pic_url;
+              ob.subtitle = item.desc;
+              ob.id = item.id;
+              ob.title = item.title;
+              return ob;
+            });
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
   },
 };
 </script>

+ 77 - 20
pages/index/index.vue

@@ -74,7 +74,7 @@
           mode="aspectFit"
           style="width: 34px; height: 34px"
         ></image>
-        <view class="notice-content display-around-column" style="width: 88%;">
+        <view class="notice-content display-around-column" style="width: 88%">
           <view class="notice-content-font" style="margin-left: 40rpx">{{
             item.title
           }}</view>
@@ -272,17 +272,17 @@
         </view>
       </view>
     </view>
-    <foot-tabs :selectedIndex='0'></foot-tabs>
+    <foot-tabs :selectedIndex="0"></foot-tabs>
   </view>
 </template>
 
 <script>
 import md5 from "@/common/md5.js";
-import footTabs from '@/components/foot-tabs/footTabs.vue';
+import footTabs from "@/components/foot-tabs/footTabs.vue";
 export default {
-	components: {
-		'foot-tabs': footTabs
-	},
+  components: {
+    "foot-tabs": footTabs,
+  },
   data() {
     return {
       swiperList: [
@@ -375,18 +375,18 @@ export default {
         // },
       ],
       attractList: [
-        {
-          url: "/static/attract/1.png",
-          title: "工业互联网",
-          subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
-          time: "2021-09-05",
-        },
-        {
-          url: "/static/attract/2.png",
-          title: "生产性服务业",
-          subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
-          time: "2021-09-05",
-        },
+        // {
+        //   url: "/static/attract/1.png",
+        //   title: "工业互联网",
+        //   subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
+        //   time: "2021-09-05",
+        // },
+        // {
+        //   url: "/static/attract/2.png",
+        //   title: "生产性服务业",
+        //   subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
+        //   time: "2021-09-05",
+        // },
       ],
       activityList: [
         {
@@ -411,16 +411,17 @@ export default {
     };
   },
   onShow() {
-	  uni.hideTabBar({})
+    uni.hideTabBar({});
   },
   onLoad() {
     this.getSwiperList();
     this.getPark();
     this.getNotice();
+    this.getAttract();
     //   this.loginLoad();
   },
   onShareAppMessage() {
-  	url:'/pages/index/index'
+    url: "/pages/index/index";
   },
   methods: {
     swiperChange(e) {
@@ -568,6 +569,62 @@ export default {
         },
       });
     },
+    getAttract() {
+      let md5Sign = md5(
+        "method=" +
+          "common" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=common&source=business&action=list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        page: 1,
+        page_size: 5,
+      };
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          console.log(res);
+          if (res.data.code === 200) {
+            let list = res.data.data.list;
+            this.attractList = list.map((item) => {
+              /*
+                  title: "生产性服务业",
+                  subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
+                  time: "2021-09-05",
+             */
+              let ob = {
+                url: "",
+                subtitle: "",
+                id: "",
+                title: "",
+              };
+              ob.url = item.pic_url;
+              ob.subtitle = item.desc;
+              ob.id = item.id;
+              ob.title = item.title;
+              return ob;
+            });
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
     goParkDetailFn(id) {
       uni.navigateTo({
         url: "/pages/park/park_deatil?id=" + id,

+ 12 - 3
pages/notice/index.vue

@@ -84,8 +84,11 @@ export default {
         "&sign=" +
         md5Sign;
       let postData = {
-        // s_title: this.input,
+        s_title: this.input,
       };
+      if (!this.input) {
+        postData = {};
+      }
       uni.request({
         url: url,
         method: "POST",
@@ -95,7 +98,7 @@ export default {
         data: postData,
         success: (res) => {
           if (res.data.code === 200) {
-            // console.log(res.data.data.list);
+            console.log(res.data.data.list);
             this.noticeList = res.data.data.list.map((item) => {
               switch (item.type) {
                 case "1":
@@ -137,6 +140,7 @@ export default {
     // justify-content: center;
     align-items: center;
     flex-direction: column;
+    width: 83%;
     .notice-content-box {
       width: 100%;
       display: flex;
@@ -146,6 +150,10 @@ export default {
       border-radius: 32rpx;
       margin-top: 20rpx;
       // justify-content: space-between;
+      image {
+        width: 34px;
+        height: 34px;
+      }
       .notice-content-font {
         margin-left: 40rpx;
         font-size: 26rpx;
@@ -155,7 +163,8 @@ export default {
         text-overflow: ellipsis;
         white-space: nowrap;
       }
-      .attract-content {
+      .notice-content {
+        // flex: 1;
         color: #697594;
         font-weight: 600;
         font-size: 20rpx;

+ 4 - 5
pages/notice/notice_deatil.vue

@@ -15,15 +15,15 @@ export default {
         way: "",
         time: "",
         artical: "",
+        id: "",
       },
-      id: "",
     };
   },
   components: {
     ArticalDeatil,
   },
   onLoad(op) {
-    this.id = op.id;
+    this.model.id = op.id;
     this.getNotice();
   },
   methods: {
@@ -44,7 +44,7 @@ export default {
         "&sign=" +
         md5Sign;
       let postData = {
-        id: this.id,
+        id: this.model.id,
       };
       //获取文章
       uni.request({
@@ -59,7 +59,6 @@ export default {
             let data = res.data.data;
             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
@@ -77,7 +76,7 @@ export default {
       uni.request({
         url:
           getApp().globalData.shareUrl +
-          `content/notice/${Math.floor(this.id / 1000)}/${this.id}.html`,
+          `content/notice/${Math.floor(this.model.id / 1000)}/${this.model.id}.html`,
         method: "GET",
         header: {
           "content-type": "application/x-www-form-urlencoded",

+ 79 - 67
pages/policy/policy_deatil.vue

@@ -13,11 +13,7 @@
       </div>
     </div>
     <div class="video-box" v-if="infoObj.video_url">
-      <video
-        :src="infoObj.video_url"
-        id="myVideo"
-        controls="true"
-      ></video>
+      <video :src="infoObj.video_url" id="myVideo" controls="true"></video>
     </div>
     <!-- 企业研发投入补贴 -->
     <div class="card-input-content">
@@ -37,7 +33,18 @@
           </p>
           <p class="table-item">
             <span>申报状态:</span>
-            <span>剩5天</span>
+            <span
+              >剩
+              {{
+                new Date(
+                  new Date(infoObj.project_end_date).getTime() -
+                    new Date(infoObj.project_start_date).getTime()
+                ).getTime() /
+                  (1 * 24 * 60 * 60 * 1000) +
+                1
+              }}
+              天</span
+            >
           </p>
         </div>
       </div>
@@ -140,7 +147,7 @@
       <div class="item-list">
         <div class="term">
           <div class="term-value-group">
-            <p class="term-value-item">{{infoObj.contact}}</p>
+            <p class="term-value-item">{{ infoObj.contact }}</p>
           </div>
         </div>
       </div>
@@ -149,7 +156,7 @@
       <footer-share
         style="width: 100%"
         :isCollection="true"
-		:isCollectedIcon="infoObj.if_collect"
+        :isCollectedIcon="infoObj.if_collect"
         @collectionPages="collectionPage"
         @sharePages="sharePage"
       ></footer-share>
@@ -225,11 +232,14 @@ export default {
         },
         data: {
           id: ids,
-		  openId:getApp().globalData.open_id
+          openId: getApp().globalData.open_id,
         },
         success: (res) => {
           if (res.data.code === 200) {
-			if(res.data.data.video_url){ res.data.data.video_url = getApp().globalData.shareUrl + res.data.data.video_url;}
+            if (res.data.data.video_url) {
+              res.data.data.video_url =
+                getApp().globalData.shareUrl + res.data.data.video_url;
+            }
             res.data.data.level = this.levelList[res.data.data.level];
             this.infoObj = res.data.data;
             this.getRich1(ids);
@@ -342,21 +352,60 @@ export default {
           "content-type": "application/x-www-form-urlencoded",
         },
         data: {
-			 openId :getApp().globalData.open_id,
-			 source :'policy',
-			 source_name :'政策',
-			 source_id :this.infoObj.id,
-			 source_title :this.infoObj.title
+          openId: getApp().globalData.open_id,
+          source: "policy",
+          source_name: "政策",
+          source_id: this.infoObj.id,
+          source_title: this.infoObj.title,
         },
         success: (res) => {
           if (res.data.code === 200) {
-			  res.data.data ? this.infoObj.if_collect = true : this.infoObj.if_collect = false;
-			  this.$forceUpdate();
-			  uni.showToast({
-			  	duration:3000,
-				title:res.data.msg,
-				icon:'none'
-			  })
+            res.data.data
+              ? (this.infoObj.if_collect = true)
+              : (this.infoObj.if_collect = false);
+            this.$forceUpdate();
+            uni.showToast({
+              duration: 3000,
+              title: res.data.msg,
+              icon: "none",
+            });
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    shareRequest() {
+      let md5Sign = md5(
+        "method=" +
+          "user" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=user&source=policy&action=repost&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: {
+          openId: getApp().globalData.open_id,
+          source_id: this.infoObj.id,
+          source: "policy",
+        },
+        success: (res) => {
+          if (res.data.code === 200) {
+            console.log(res);
           }
         },
         fail: () => {
@@ -364,52 +413,15 @@ export default {
         },
       });
     },
-	shareRequest(){
-		let md5Sign = md5(
-		  "method=" +
-		    "user" +
-		    "&timestamp=" +
-		    getApp().globalData.globalTimestamp +
-		    "&secret=" +
-		    getApp().globalData.secret
-		);
-		let url =
-		  getApp().globalData.shareUrl +
-		  "api/api.php" +
-		  "?method=user&source=policy&action=repost&timestamp=" +
-		  getApp().globalData.globalTimestamp +
-		  "&sign=" +
-		  md5Sign;
-		uni.request({
-		  url: url,
-		  method: "POST",
-		  header: {
-		    "content-type": "application/x-www-form-urlencoded",
-		  },
-		  data: {
-				 openId :getApp().globalData.open_id,
-				 source_id :this.infoObj.id,
-				 source :'policy',
-		  },
-		  success: (res) => {
-		    if (res.data.code === 200) {
-				console.log(res)
-		    }
-		  },
-		  fail: () => {
-		    console.log("连接失败");
-		  },
-		});
-	},
     sharePage() {
-		let that = this;
-		  uni.showShareMenu({
-			title: that.infoObj.title,
-			path: "pages/policy/policy_detail?id="+that.infoObj.id,
-			success(res) {
-			  that.shareRequest();
-			},
-		});
+      let that = this;
+      uni.showShareMenu({
+        title: that.infoObj.title,
+        path: "pages/policy/policy_detail?id=" + that.infoObj.id,
+        success(res) {
+          that.shareRequest();
+        },
+      });
     },
     changeScroll(height) {
       //点的时候触发这个函数 height 是之前的高度

+ 42 - 1
pages/selfCenter/collection.vue

@@ -77,6 +77,7 @@
 </template>
 
 <script>
+import md5 from "@/common/md5.js";
 export default {
   data() {
     return {
@@ -102,7 +103,9 @@ export default {
       }),
     };
   },
-  onLoad() {},
+  onLoad() {
+    // this.getCollection();
+  },
   methods: {
     toDetail(index) {
       uni.navigateTo({
@@ -114,6 +117,44 @@ export default {
         url: "/pages/policy/policy_deatil?id=" + id,
       });
     },
+  /*   getCollection() {
+      let md5Sign = md5(
+        "method=" +
+          "user" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=user&action=collect_list&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      let postData = {
+        page: 1,
+        page_size: 5,
+        openId: getApp().globalData.open_id,
+      };
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: postData,
+        success: (res) => {
+          console.log(res);
+          if (res.data.code === 200) {
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    }, */
   },
 };
 </script>