소스 검색

添加图片跳转请求,修改详情页

elis 2 년 전
부모
커밋
0d03450709

+ 1 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/filters/LoginFilter.java

@@ -49,6 +49,7 @@ public class LoginFilter implements Filter {
                 case "/mini/queryByOpenId":
                 case "/mini/hlw/send":
                 case "/mini/hlw/info":
+                case "/mini/hlw/forward":
                     chain.doFilter(req, response);
                     break;
                 default:

+ 33 - 5
nngkxxdp/src/main/java/com/example/nngkxxdp/program/controller/HLWIntefaceController.java

@@ -12,14 +12,21 @@ import com.example.nngkxxdp.util.RedisUtil;
 import com.example.nngkxxdp.util.SendUtil;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ByteArrayResource;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.InputStream;
+import java.net.URL;
 import java.util.Map;
 
+import static jdk.nashorn.internal.objects.NativeError.getFileName;
+import static org.apache.poi.util.IOUtils.toByteArray;
+
 @RestController
 @RequestMapping("mini/hlw")
 @CrossOrigin
@@ -111,4 +118,25 @@ public class HLWIntefaceController {
         }
 
     }
+
+
+    @GetMapping("/forward")
+    public ResponseEntity<Resource> forward(@RequestParam(name = "url", required = true) String url){
+        System.out.println("Start: ------------------------->");
+
+        Resource resource = null;
+        url = "http://23.99.193.13/"+url;
+        InputStream inputStream;
+        try {
+            inputStream = new URL(url).openStream();
+
+            resource = (Resource) new ByteArrayResource(toByteArray(inputStream));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ResponseEntity.ok()
+                .contentType(MediaType.IMAGE_PNG)
+                .header(HttpHeaders.CONTENT_DISPOSITION, " filename=\"" + getFileName(url) + "\"")
+                .body(resource);
+    }
 }

+ 1 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/index-api2.js

@@ -27,7 +27,7 @@ const request = (options) => {
 export function info(channelId,docId) {
 	const params = {'channelId': channelId, 'docId': docId}
   return request({
-    url: `/mini/hlw/send`,
+    url: `/mini/hlw/info`,
 		method: 'GET',
 		data: params
   })

+ 8 - 2
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/articlDetail/articlDetail.js

@@ -13,7 +13,8 @@ Page({
 	data: {
 		imgUrl: imgUrl,
 		chnlid:"",
-		docid:""
+		docid:"",
+		data:{},
 	},
 
 	/**
@@ -24,11 +25,16 @@ Page({
 			chnlid:options.CHNLID,
 			docid:options.DOCID
 		})
-		initPage();
+		this.initPage();
 	},
 	initPage(){
 		info(this.data.chnlid,this.data.docid).then(res=>{
 			console.log(res);
+			if(res.result){
+				this.setData({
+					data:res.data
+				})
+			}
 		})
 	},
 

+ 5 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/articlDetail/articlDetail.json

@@ -1,4 +1,8 @@
 {
-	"usingComponents": {},
+	"usingComponents": {
+		"t-swiper": "tdesign-miniprogram/swiper/swiper",
+		"t-swiper-item": "tdesign-miniprogram/swiper/swiper-item",
+		"t-swiper-nav": "tdesign-miniprogram/swiper/swiper-nav"
+	  },
 	"navigationBarTitleText": "详情"
 }

+ 10 - 4
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/articlDetail/articlDetail.wxml

@@ -1,11 +1,17 @@
 <!--pages/articlDetail/articlDetail.wxml-->
 <view class="body">
-<view class="title">遏制“天价”月饼区市场监管局开展月饼包装专项检查</view>
-    <view class="source"><span>2022-09-01</span><span>来源:南岸区融媒体中心</span></view>
-    <image src="{{imgUrl}}1.png" alt=""></image>
+<view class="title">{{data.DOCTITLE}}</view>
+    <view class="source"><span>{{data.CRTIME}}</span><span>来源:{{data.CRUSER}}</span></view>
+    <!-- <image src="{{imgUrl}}1.png" alt=""></image> -->
+        
+
     <view class="content">
+        <rich-text nodes="{{data.DOCHTMLCON}}"></rich-text>
+    </view>
+
+    <!-- <view class="content">
         <text>中秋降至,区市场监管局对辖区的麦德龙、永辉、盒马、新世纪等超市销售的月饼包装情况进行专项检查,并抽取样品,送权威机构进行计量检测。 </text>
         <text>在麦德龙超市,场地中央及货架上摆满了各式各样的月饼,价格大多在100元至300元之间。区市场监管局执法人员对这些月饼逐一进行查看,重点检查月饼包装是否符合《限制商品过度包装要求食品和化妆品》国家标准第1号修改单的要求,包装层数是否超过了3层,包装材料是否使用了贵金属、红木等贵重材质,月饼是否与其他产品混装销售等。
         </text>
-</view>
+</view> -->
 </view>

+ 1 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/articlDetail/articlDetail.wxss

@@ -24,7 +24,7 @@ image {
 }
 
 .content {
-	height: 447px;
+	height: 100%;
 	background: #F4F8FF;
 	font-size: 16px;
 	font-weight: 300;