Explorar el Código

fix 政策问答库修改详情页原文地址及增加部分文章可跳转对应图文中

elis hace 1 año
padre
commit
8271760434

+ 1 - 1
nngkxxdp/src/main/resources/static/zdjc/pc_sy.html

@@ -753,7 +753,7 @@
                 sessionStorage.ELK_ARTICLE = JSON.stringify(dataMap[data]);
                 sessionStorage.ELK_URL = JSON.stringify(url);
                 sessionStorage.ELK_URL_TITLE = JSON.stringify(urlTitle);
-                sessionStorage.ELK_JUNP_ID = JSON.stringify(questionId);
+                sessionStorage.ELK_JUMP_ID = JSON.stringify(questionId);
                 window.location = 'xq.html';
             } else {
                 window.open(dataMap[data].url, '_blank');

+ 70 - 15
nngkxxdp/src/main/resources/static/zdjc/pc_xq.html

@@ -75,6 +75,33 @@
             margin-top: 20px;
             padding: 0 10px;
         }
+        .jump{
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            margin-top: 20px;
+            padding: 0 10px;
+        }
+
+        .jump>.link-box>.line-left {
+            line-height: 30px;
+            color: #fff;
+            padding: 5px 5px;
+            text-align: center;
+            background: #0C67B0;
+            margin-right: 10px;
+            width: 100px;
+        }
+
+        .jump>.link-box>.line-right {
+            line-height: 40px;
+            padding: 0px 5px;
+            background: #F2F2F2;
+            width: 95%;
+            cursor: pointer;
+            overflow: hidden;
+            text-overflow: ellipsis;
+        }
 
         .link>.link-box>.line-left {
             line-height: 30px;
@@ -159,6 +186,12 @@
                             </div>
                         </div>
 
+                        <div class="jump " onclick="jumpTw()">
+                            <div class="link-box">
+                                <div class="line-left" >跳转图文</div>
+                            </div>
+                        </div>
+
                         <div style="display: flex;justify-content: space-around; width: 100%; margin-top: 30px;">
                             <div style="width: 48%; " class="info">
                                 <div class="policy" style="width: 100%;">
@@ -442,9 +475,22 @@
 
         // 初始化详情页面
         function initDetail() {
+            debugger
             var data = sessionStorage.ELK_ARTICLE;
-            var id = (window.location.search).split("=")[1];
-            if (id) {
+            var id = JSON.parse(sessionStorage.ELK_JUMP_ID);
+            if (data) {
+                    data = JSON.parse(data);
+                    var pattern = /<(a|p|img|span|div)+.*?>/g;
+                    if (pattern.test(data.content)) {
+                        // < !--如果是富文本不额外添加样式-->
+                        $('#d-content').removeClass("wz-content");
+                    }
+                    $('#d-title').text(data.title);
+                    $('#d-content').empty().append(escape2Html(data.content));
+                    $('#d-dept').text(data.departmentname);
+
+
+            } else {
                 $.ajax({
                     url: PATH + '/elk/getarticle',
                     type: 'get',
@@ -457,20 +503,11 @@
                         $('#d-title').text(data.data.title);
                         $('#d-content').html(data.data.content);
                         $('#d-dept').text(data.data.departmentname);
+                        sessionStorage.ELK_URL = data.data.policy_original_url
+                        sessionStorage.ELK_JUMP_ID = data.data.question_id
+                        sessionStorage.ELK_URL_TITLE =data.data.policy_original_title
                     },
                 });
-            } else {
-                if (data) {
-                    data = JSON.parse(data);
-                    var pattern = /<(a|p|img|span|div)+.*?>/g;
-                    if (pattern.test(data.content)) {
-                        // < !--如果是富文本不额外添加样式-->
-                        $('#d-content').removeClass("wz-content");
-                    }
-                    $('#d-title').text(data.title);
-                    $('#d-content').empty().append(escape2Html(data.content));
-                    $('#d-dept').text(data.departmentname);
-                }
             }
             $.ajax({
                 type: 'get',
@@ -734,6 +771,7 @@
         }
 
         function getUrl() {
+
             let url = JSON.parse(sessionStorage.getItem('ELK_URL'))
             console.log(url)
             if (url != "null") {
@@ -746,9 +784,26 @@
             } else {
                 $('.link').removeClass('layui-show')
                 $('.link').addClass('layui-hide')
-                
+            }
+
+            let jumpId = JSON.parse(sessionStorage.getItem('ELK_JUMP_ID'))
+            console.log(jumpId)
+            if (jumpId != "null") {
+                console.log(1)
+                $('.jump').removeClass('layui-hide')
+                $('.jump').addClass('layui-show')
+
+            } else {
+                $('.jump').removeClass('layui-show')
+                $('.jump').addClass('layui-hide')
             }
         }
+        function jumpTw(){
+            sessionStorage.ELK_ARTICLE = ""
+            // sessionStorage.ELK_JUMP_ID = ""
+            window.location = 'xq.html';
+        }
+
         getUrl()
 
         // $('.line-right').click(() => {

+ 9 - 2
nngkxxdp/src/main/resources/static/zdjc/symobile.html

@@ -548,8 +548,15 @@
 		}
 		function openWindow(data) {
 			//console.log(dataMap[data])
-			sessionStorage.ELK_ARTICLE = JSON.stringify(dataMap[data]);
-			window.open('https://www.cqna.gov.cn/data/zdjc/xq.html');
+			// sessionStorage.ELK_ARTICLE = JSON.stringify(dataMap[data]);
+			// window.open('https://www.cqna.gov.cn/data/zdjc/xq.html');
+			if (dataMap[data].content) {
+				sessionStorage.ELK_ARTICLE = JSON.stringify(dataMap[data]);
+
+				window.location = 'xq.html';
+			} else {
+				window.open(dataMap[data].url, '_blank');
+			}
 		}
 		function escape2Html(str) {
 			var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' };

+ 1 - 2
nngkxxdp/src/main/resources/static/zdjc/xq_model.html

@@ -226,8 +226,7 @@
 				$('#d-content').empty().append(escape2Html(data.content));
 				$('#d-dept').text(data.departmentname);
 			}
-			$
-					.ajax({
+			$.ajax({
 						type : 'get',
 
 						url : '/elk/deptAll',