浏览代码

小程序修改样式,优化附件下载,修改政策专题跳转

wrh 2 年之前
父节点
当前提交
77daff1291

+ 2 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/fileList/fileList.json

@@ -1,3 +1,4 @@
 {
-  "usingComponents": {}
+  "usingComponents": {},
+	"navigationBarTitleText": "政策文件"
 }

+ 19 - 12
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/governmentArticlesDetail/governmentArticlesDetail.js

@@ -10,13 +10,20 @@ Page({
     data: {
         // 图片前缀
         imgUrl: imgUrl,
+        // 文章内容
         articles: '',
+        // 文本字号大小
         fontSize: '中',
+        // 是否播放语音
         isPlay: false,
+        // 是否存在文件
         isFile: true,
+        // 文件路径前缀
+        fileUrlPrefix: '',
+        // 文件列表
         fileList: [{
-            title: '政府信息公开申请表 .docx',
-            url: 'http://www.cqna.gov.cn/bm/qjw/zwgk_59968/zfxxgkzn_59969/202201/P020220110623505626774.docx'
+            APPDESC: '政府信息公开申请表 .docx',
+            APPFILE: 'P020220110623505626774.docx'
         }]
     },
 
@@ -73,17 +80,14 @@ Page({
                             res1.data.data.DOCHTMLCON = res1.data.data.DOCHTMLCON.replace(/\<span/gi, '<span class="fontSize"');
                             res1.data.data.DOCHTMLCON = res1.data.data.DOCHTMLCON.replace(/\<img src="[^"]+"/gi, '<img src="' + url + res1.data.data.THUMBFILES + '"');
                             let text = res1.data.data.DOCHTMLCON.replace(/<[^>]+>/g, "");
-                            let re = /<a[^>]*href=['"]([^"]*)['"][^>]*>(.*?)<\/a>/g;
-                            let fileTitle;
-                            let fileUrl;
-                            while (re.exec(res1.data.data.DOCHTMLCON) != null) {
-                                fileUrl = RegExp.$1.substring(RegExp.$1.lastIndexOf("/") + 1, RegExp.$1.length);
-                                fileTitle = RegExp.$2;
+                            if (options.channelId != "60010") {
+                                this.setData({
+                                    fileList: res1.data.data.DOCATTACHFILEFIELD
+                                })
                             }
-                            console.log(fileUrl);
-                            console.log(fileTitle);
                             console.log(text);
                             this.setData({
+                                fileUrlPrefix: url,
                                 articles: res1.data.data
                             })
                         }
@@ -99,7 +103,9 @@ Page({
                     res.data.data.DOCHTMLCON = res.data.data.DOCHTMLCON.replace(/\<span/gi, '<span class="fontSize"');
                     res.data.data.DOCHTMLCON = res.data.data.DOCHTMLCON.replace(/\<img src="[^"]+"/gi, '<img src="' + options.url + res.data.data.THUMBFILES + '"');
                     this.setData({
-                        articles: res.data.data
+                        fileUrlPrefix: options.url,
+                        articles: res.data.data,
+                        fileList: res.data.data.DOCATTACHFILEFIELD
                     })
                 }
             })
@@ -122,8 +128,9 @@ Page({
     },
     downloadFile(e) {
         console.log(e.currentTarget.dataset);
+        console.log(this.data.fileUrlPrefix);
         wx.downloadFile({
-            url: e.currentTarget.dataset.url,
+            url: this.data.fileUrlPrefix + e.currentTarget.dataset.url,
             success: function (res) {
                 console.log('file');
                 console.log(res);

+ 2 - 2
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/governmentArticlesDetail/governmentArticlesDetail.wxml

@@ -35,8 +35,8 @@
     <view wx:if="{{isFile}}">
         <view style="font-size: 38rpx;font-family: PingFang SC;font-weight: bold;color: #333333;border-bottom: 1px solid #C5C5C5;padding: 70rpx 0 20rpx 0;">附件下载</view>
         <view wx:for="{{fileList}}" wx:key="index" style="display: flex;justify-content: space-between;color: #333333;height: 150rpx;align-items: center;font-size: 30rpx;">
-            <view>{{index + 1}}.{{item.title}}</view>
-            <view bindtap="downloadFile" data-url="{{item.url}}" style="width: 151rpx;height: 50rpx;border: 1px solid #C5C5C5;border-radius: 4px;background: #FFFFFF;text-align: center;line-height: 50rpx;">下载</view>
+            <view>{{index + 1}}.{{item.APPDESC}}</view>
+            <view bindtap="downloadFile" data-url="{{item.APPFILE}}" style="width: 151rpx;height: 50rpx;border: 1px solid #C5C5C5;border-radius: 4px;background: #FFFFFF;text-align: center;line-height: 50rpx;">下载</view>
         </view>
     </view>
 </view>

+ 16 - 9
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/index/index.js

@@ -110,22 +110,27 @@ Page({
 		// 政务专题
 		topics: [{
 				pic: 'https://www.cqna.gov.cn/zwgk_254/zwzt/348196/images/P020220520416638485836.png',
-				title: '重大行政决策公开'
+                title: '重大行政决策公开',
+                url: '/pages/publics/government/government'
 			}, {
 				pic: 'https://www.cqna.gov.cn/zwgk_254/zwzt/348190/images/P020220520422504152985.png',
-				title: '政策问答库'
+                title: '政策问答库',
+                url: '/pages/ZCWDK/index/index'
 			},
 			{
 				pic: 'https://www.cqna.gov.cn/zwgk_254/zwzt/362900/images/P020220802602397615813.png',
-				title: '疫情防控'
+                title: '疫情防控',
+                url: ''
 			},
 			{
 				pic: 'https://www.cqna.gov.cn/zwgk_254/zwzt/348203/images/P020220520419381023376.png',
-				title: '政策文件与政策解读'
+                title: '政策文件与政策解读',
+                url: '/pages/publics/fileList/fileList'
 			},
 			{
 				pic: 'https://www.cqna.gov.cn/zwgk_254/zwzt/348195/images/P020220520416540661874.png',
-				title: '基层政务公开'
+                title: '基层政务公开',
+                url: '/pages/publics/baseAffairs/baseAffairs'
 			}
 		]
 	},
@@ -349,10 +354,12 @@ Page({
 			url: '/pages/publics/governmentArticlesDetail/governmentArticlesDetail?channelId=' + e.currentTarget.dataset.channelid + '&isFile=false'
 		})
 	},
-	gotoZXWDK() {
-		wx.navigateTo({
-			url: '/pages/ZCWDK/index/index',
-		})
+	gotoZWDetail(e) {
+        if (e.currentTarget.dataset.url) {
+            wx.navigateTo({
+                url: e.currentTarget.dataset.url,
+            })
+        }
 	},
 	gotoLeaderDetail() {
 		wx.navigateTo({

+ 1 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/index/index.wxml

@@ -174,7 +174,7 @@
 			<swiper display-multiple-items="2" autoplay="{{false}}" style="padding: 0 10px;height: 400rpx;;">
 				<block wx:for="{{topics}}" wx:key="*this">
 					<swiper-item>
-						<image src="{{item.pic}}" bindtap="gotoZXWDK" style="width: 327rpx;height: 227rpx;border-radius: 12rpx;"></image>
+						<image src="{{item.pic}}" bindtap="gotoZWDetail" data-url="{{item.url}}" style="width: 327rpx;height: 227rpx;border-radius: 12rpx;"></image>
 					</swiper-item>
 				</block>
 			</swiper>