Browse Source

更新政策模块

306132416@qq.com 4 years ago
parent
commit
6011b02213
4 changed files with 141 additions and 90 deletions
  1. 7 9
      pages/index/index.vue
  2. 16 13
      pages/policy/index.vue
  3. 117 67
      pages/policy/policy_deatil.vue
  4. 1 1
      pages/selfCenter/index.vue

+ 7 - 9
pages/index/index.vue

@@ -122,16 +122,16 @@
             "
           ></image>
           <view class="park-content-box">
-            <view class="park-title">{{ item.name }}</view>
+            <view class="park-title">{{ item.name || '-' }}</view>
             <view class="park-address display-flex-start" style="flex-direction: column;align-items: flex-start;">
               <view class="display-flex-start" style="margin-bottom: 10rpx;">
 				<image src="/static/park/park-name.png" mode="aspectFill" class="park-title-img"></image>
-				{{ item.manager }}
+				{{ item.manager || '-' }}
 			  </view>
               <view class="display-flex-start">
 				<image src="/static/park/park-time.png" mode="aspectFill"class="park-title-img"></image>
 				<!-- {{ item.addtime | globalTime }}建成 -->
-				{{ item.start_date}}建成
+				{{ item.start_date || '-' }}建成
 			  </view>
               </view>
             <view class="park-footer-box display-between" style="margin-top: 10rpx;">
@@ -142,7 +142,7 @@
                     mode="aspectFill"
                     class="park-footer-img"
                   ></image
-                  >{{ item.company_count }}</view
+                  >{{ item.company_count || '-' }}</view
                 >
                 <view class="park-footer-font">企业数量</view>
               </view>
@@ -153,8 +153,7 @@
                     mode="aspectFill"
                     class="park-footer-img"
                   ></image>
-                  {{ item.cover_area
-                  }}<text style="font-size: 14rpx">亩</text></view
+                  {{ item.cover_area || '-' }}<text style="font-size: 14rpx">亩</text></view
                 >
                 <view class="park-footer-font">占地面积</view>
               </view>
@@ -165,8 +164,7 @@
                     mode="aspectFill"
                     class="park-footer-img"
                   ></image>
-                  {{ item.building_area
-                  }}<text style="font-size: 14rpx">万㎡</text></view
+                  {{ item.building_area || '-' }}<text style="font-size: 14rpx">万㎡</text></view
                 >
                 <view class="park-footer-font">建设面积</view>
               </view>
@@ -272,7 +270,7 @@
             <view class="notice-content-time display-flex-start color-a7adba"
               v-show="!item.isOnline" style="width: 15%;">
 			  <view class="offline-box"></view>线下</view>
-            <view class="notice-content-time color-a7adba" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
+            <view class="notice-content-time color-a7adba" style="width: 80%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
 				{{item.department}}
 			</view>
 <!--            <view class="notice-content-time color-a7adba">

+ 16 - 13
pages/policy/index.vue

@@ -42,11 +42,11 @@
         </view>
       </view>
       <view class="policy-content">
-        <view class="policy-content-item"   v-for="(item, idx) in policyData" :key="idx" @click="enterPolicyDeatil(item.id)"  >
+        <view class="policy-content-item"   v-for="(item, idx) in policyData" :key="idx" @click="enterPolicyDeatil(item.id,item.level)"  >
             <p class="policy-content-item-left-title" style="height: 86rpx">
               {{ item.title }}
             </p>
-            <view class="policy-content-item-left-time">
+            <view class="policy-content-item-left-time" v-if="item.level != '5'">
               <p class="moment">{{ item.publish_time | globalTime }}</p>
               <p class="maxMony" v-if="item.project_money!=='-' && item.project_money ">{{ item.project_money }}</p>
               <p class="leftDay" v-if=" item.project_end_date && Math.floor( new Date( new Date(item.project_end_date).getTime() -new Date().getTime() ).getTime() /(1 * 24 * 60 * 60 * 1000) ) +1 >= 1">
@@ -57,6 +57,9 @@
               </p>
               <p class="leftDay" v-if="!item.project_end_date">长期可申报</p>
             </view>
+			<view class="policy-content-item-left-time" v-if="item.level == '5'">
+			  <p class="moment">{{ item.publish_time | globalTime }}</p>
+			</view>
       <!--    <view class="policy-content-item-img">
             <image :src="item.pic_url" alt="" mode="aspectFill"/>
           </view> -->
@@ -72,7 +75,7 @@ export default {
   data() {
     return {
       swiperList: [],
-      policyList: ["省级政策", "市级政策", "新区政策", "新城政策"],
+      policyList: ["市级政策", "新区政策", "新城政策","政策解读"],
       active: 0,
       searchVal: "",
       policyData: new Array(5).fill({
@@ -100,9 +103,9 @@ export default {
 	  	 url: "./search?val=" + val,
 	  })
 	},
-    enterPolicyDeatil(id) {
+    enterPolicyDeatil(id,level) {
       uni.navigateTo({
-        url: "/pages/policy/policy_deatil?id=" + id,
+        url: "/pages/policy/policy_deatil?id=" + id + '&level=' + level,
       });
     },
     changePolicyTabs(idx) {
@@ -110,16 +113,16 @@ export default {
       that.active = idx;
       switch (idx) {
         case 0:
-          that.getPolicyList("1");
+          that.getPolicyList("2");
           break;
         case 1:
-          that.getPolicyList("2");
+          that.getPolicyList("3");
           break;
         case 2:
-          that.getPolicyList("3");
+          that.getPolicyList("4");
           break;
         case 3:
-          that.getPolicyList("4");
+          that.getPolicyList("5");
           break;
       }
     },
@@ -188,14 +191,14 @@ export default {
           "content-type": "application/x-www-form-urlencoded",
         },
         data: {
-          s_level: level || "1", //1.省 2.市 3.区 4.新城
+          s_level: level || "2", //1.省 2.市 3.区 4.新城 5.解读
         },
         success: (res) => {
           console.log(res);
           if (res.data.code === 200) {
-            res.data.data.list.forEach((item) => {
-              item.pic_url = getApp().globalData.shareUrl + item.pic_url;
-            });
+            // res.data.data.list.forEach((item) => {
+            //   item.pic_url = getApp().globalData.shareUrl + item.pic_url;
+            // });
             this.policyData = res.data.data.list;
           }
         },

+ 117 - 67
pages/policy/policy_deatil.vue

@@ -16,7 +16,7 @@
       <video :src="infoObj.video_url" id="myVideo" controls="true"></video>
     </div>
     <!-- 企业研发投入补贴 -->
-    <div class="card-input-content">
+    <div class="card-input-content" v-if="infoObj.level != '5' ">
       <div class="card-input">
         <div class="card-title">{{ infoObj.project_name || '-'}}</div>
         <div class="table">
@@ -45,7 +45,7 @@
       </div>
     </div>
     <!-- 项目概况 -->
-    <div class="card-situation" v-if="infoObj.project_desc">
+    <div class="card-situation" v-if="infoObj.project_desc && infoObj.level != '5'" >
       <div class="card-title">项目概况</div>
       <p>
         {{ infoObj.project_desc || '-'}}
@@ -55,7 +55,7 @@
     <!-- 	<div class="card-group" v-for="(item, idx) in model" :key="idx">
 	  <policy-deatil-card :model="item" :isMar="idx == model.length - 1"></policy-deatil-card>
 	</div> -->
-    <div class="card-group">
+    <div class="card-group"  v-if="infoObj.level != '5' ">
       <div class="content-basic">
         <div class="card-title">基本信息</div>
         <div class="item-list">
@@ -88,7 +88,7 @@
         </div>
       </div>
     </div>
-    <div class="card-group">
+    <div class="card-group"  v-if="infoObj.level != '5' ">
       <div class="content-basic">
         <div class="card-title">支持力度</div>
         <div class="item-list">
@@ -108,7 +108,7 @@
         </div>
       </div>
     </div>
-    <div class="content-rich" :class="{ 'margin-bottom-80': false }">
+    <div class="content-rich" :class="{ 'margin-bottom-80': false }"  v-if="infoObj.level != '5' ">
       <div class="card-title">{{ textModel1.title }}</div>
       <div class="item-list">
         <div class="term">
@@ -119,7 +119,7 @@
         </div>
       </div>
     </div>
-    <div class="content-rich" :class="{ 'margin-bottom-80': false }">
+    <div class="content-rich" :class="{ 'margin-bottom-80': false }"  v-if="infoObj.level != '5' ">
       <div class="card-title">{{ textModel2.title }}</div>
       <div class="item-list">
         <div class="term">
@@ -130,7 +130,7 @@
         </div>
       </div>
     </div>
-    <div class="content-rich" :class="{ 'margin-bottom-80': false }">
+    <div class="content-rich" :class="{ 'margin-bottom-80': false }"  v-if="infoObj.level != '5' ">
       <div class="card-title">{{ textModel3.title }}</div>
       <div class="item-list">
         <div class="term">
@@ -141,7 +141,7 @@
         </div>
       </div>
     </div>
-    <div class="content-rich" :class="{ 'margin-bottom-80': false }" style="margin-bottom: 90rpx;">
+    <div class="content-rich" :class="{ 'margin-bottom-80': false }" style="margin-bottom: 90rpx;"  v-if="infoObj.level != '5' ">
       <div class="card-title">联系方式</div>
       <div class="item-list">
         <div class="term">
@@ -151,7 +151,14 @@
         </div>
       </div>
     </div>
-    <div style="width: 100%">
+   <div class="content-rich" style="margin-bottom: 90rpx;" v-if="infoObj.level == '5' ">
+       <div class="term">
+         <div class="term-value-group">
+			<u-parse :content="level5Model"/>
+         </div>
+       </div>
+   </div>
+	<div style="width: 100%">
       <footer-share
         style="width: 100%"
         :isCollection="true"
@@ -182,9 +189,11 @@ export default {
         2: "市级政策",
         3: "新区政策",
         4: "新城政策",
+		5: "政策解读"
       },
       id: "",
 	  pageId:'',
+	  pageLevel:'',
       textModel1: {
         title: "申报条件",
         text: "",
@@ -201,17 +210,20 @@ export default {
       //   title: "联系方式",
       //   text: "",
       // },
+	  level5Model:'',
       scrollTop: 0,
       infoObj: {},
     };
   },
   onLoad(option) {
     this.pageId = option.id;
+	this.pageLevel = option.level;
+	console.log(option)
    // this.getDetailInfo(id);
 	this.getUserAuth();
   },
   onShow() {
-	this.getDetailInfo(this.pageId);
+	this.getDetailInfo(this.pageId,this.pageLevel);
   },
   methods: {
 	goAuthPage(){
@@ -241,7 +253,7 @@ export default {
 			}
 		});
 	},
-    getDetailInfo(ids) {
+    getDetailInfo(ids,levels) {
       let md5Sign = md5(
         "method=" +
           "common" +
@@ -270,15 +282,20 @@ export default {
         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;
+              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);
-            this.getRich2(ids);
-            this.getRich3(ids);
-            this.getRich4(ids);
+			console.log(this.infoObj)
+			if(levels != '5'){
+				res.data.data.level = this.levelList[res.data.data.level];
+				this.getRich1(ids);
+				this.getRich2(ids);
+				this.getRich3(ids);
+				this.getRich4(ids);
+			}else {
+				this.getRich5(ids);
+			}
+             
           }
         },
         fail: () => {
@@ -376,56 +393,89 @@ export default {
         },
       });
     },
+	getRich5(ids) {
+	  uni.request({
+	    url: `https://kiq.xazhima.com/content/policy/${Math.floor(
+	      ids / 1000
+	    )}/${ids}_5.html`,
+	    method: "GET",
+	    header: {
+	      "content-type": "application/x-www-form-urlencoded",
+	    },
+	    success: (res) => {
+	      if (res.statusCode === 200) {
+	       this.level5Model = this.replaceImg(res.data);
+	      }
+	    },
+	    fail: () => {
+	      console.log("连接失败");
+	    },
+	  });
+	},
+	replaceImg(html) {
+	  let result = html.replace(
+	    /<img [^>]*src=['"]([^'"]+)[^>]*>/gi,
+	    function (match, capture) {
+	      return (
+	        "<img src=" +
+	        getApp().globalData.shareUrl +
+	        capture +
+	        ' style="max-width:100%;height:auto;display:block;margin:10px 0;"/>'
+	      );
+	    }
+	  );
+	  return result;
+	},
     collectionPage() {
-	if(!getApp().globalData.user_name){
-				this.goAuthPage();
-				return
-	   }
-      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=collect_add&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: "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",
-            });
-          }
-        },
-        fail: () => {
-          console.log("连接失败");
-        },
-      });
+		if(!getApp().globalData.user_name){
+					this.goAuthPage();
+					return
+		   }
+		  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=collect_add&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: "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",
+				});
+			  }
+			},
+			fail: () => {
+			  console.log("连接失败");
+			},
+		  });
     },
     shareRequest() {
       let md5Sign = md5(

+ 1 - 1
pages/selfCenter/index.vue

@@ -270,7 +270,7 @@ export default {
     border-radius: 0rpx 0rpx 100% 100%;
     .img-name-box {
       height: 150rpx;
-      margin-top: 110rpx;
+      margin-top: 65rpx;
       display: flex;
       align-items: center;
       .auth-btn {