lx 5 vuotta sitten
vanhempi
commit
79264d0c23

+ 6 - 4
api/request.js

@@ -25,7 +25,8 @@ const service = {
         method: 'post',
         url: url,
         data: data,
-        header: {"content-type": "application/x-www-form-urlencoded"},
+        header: {"content-type": "application/json"},
+        // header: {"content-type": "application/x-www-form-urlencoded"},
         success: (res) =>{
           // 调用接口成功
           resolve(res)
@@ -46,9 +47,10 @@ module.exports = {
     })
   },
   // 获取新闻详情
-  getCateList: (data) => {
+  getDetails: (data) => {
+
     return new Promise((resolve,reject)=> {
-      resolve(service.get(urls.cateList,data))
+      resolve(service.post(urls.detail,data))
     })
   },
   //搜索
@@ -60,7 +62,7 @@ module.exports = {
   //热门搜索
   hotSearch: (data) =>{
     return new Promise((resolve,reject) =>{
-      resolve(service.post(urls.hotSearch,data))
+      resolve(service.get(urls.hotSearch,data))
     })
   }
 

+ 5 - 4
api/urls.js

@@ -1,8 +1,9 @@
-const host = 'http://192.168.1.60:6900';
+const host = 'http://192.168.1.73:28002';
 
 const urls ={
-    newsList:host + '/news/list',
-    search: host + '/search',
-    hotSearch: host + '/search/hot'
+    newsList:host + '/api/news/news/list',
+    detail:host +'/api/news/news/details',
+    search: host + '/api/news/search',
+    hotSearch: host + '/api/news/search/hot'
 }
 module.exports = urls;

+ 11 - 12
pages/index/index.js

@@ -300,16 +300,16 @@ Page({
       },
     ],
   },
-      //获取新闻列表
-      getNewsList:function(){
-        apiServer.getNewsList().then((res)=>{
-          if(res.statusCode == 200){
-            this.setData({
-              aa:res.data.data
-            })    
-          }
-        })
-      },
+  //获取新闻列表
+  getNewsList:function(){
+    apiServer.getNewsList().then((res)=>{
+      if(res.statusCode == 200){
+        this.setData({
+          aa:res.data.data
+        })    
+      }
+    })
+  },
   //事件处理函数
   bindViewTap: function() {
     wx.navigateTo({
@@ -403,9 +403,8 @@ Page({
     this.computeScrollViewHeight();
    },
   onFold:function(e){
-    console.log( e.currentTarget.dataset.id);
     wx.navigateTo({
-      url:"../news/news"
+      url:'../news/news?newsId='+e.currentTarget.dataset.id
       });
   },
   choose:function(e){

+ 5 - 5
pages/index/index.wxml

@@ -72,11 +72,11 @@
     <!-- <scroll-view scroll-y style='height:500rpx' class="tab"> -->
     <scroll-view scroll-y="true"  style='height: {{scrollHeight}}rpx' class="tab">
             <block wx:for-index="idx" wx:for='{{aa}}' wx:key="key" >
-            <view class='content-item' bindtap="onFold" data-id="{{item.NID}}" >
-              <text class='from' >{{item.From}}</text>
-              <text class='name'>{{item.Title}}</text>
-              <text class='wawa'>{{item.MiniContent}}</text>
-              <text class='time'>{{item.Date}}</text>
+            <view class='content-item' bindtap="onFold" data-id="{{item.newsId}}" >
+              <text class='from' >{{item.newsFrom}}</text>
+              <text class='name'>{{item.newsTitle}}</text>
+              <text class='wawa'>{{item.newsMiniContent}}</text>
+              <text class='time'>{{item.newsDate}}</text>
             </view>
           </block> 
     </scroll-view>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 0
pages/news/news.js


+ 4 - 4
pages/news/news.wxml

@@ -1,13 +1,13 @@
 <!--pages/news/news.wxml-->
 <view class="news-detail-container">
-   <text class="title">{{ currentNews.title }}</text>
+   <text class="title">{{ currentNews.newsTitle }}</text>
    <view class="author-time">
     <!-- <image class="author-avatar" src="../{{currentNews.icon}}"></image> -->
     <text class="author-name">{{ currentNews.author }}</text>
     <text class="const-text">发表于</text>
-    <text class="time">{{ currentNews.time }}</text>
+    <text class="time">{{ currentNews.newsDate }}</text>
   </view>
-  <image class="head-img" src="../{{ currentNews.image }}"></image>
+  <image class="head-img" src="{{ currentNews.newsUrl[0] }}"></image>
   <!-- <view class="horizon"></view> -->
   <view class="tool">
     <!-- <view class="circle-img">
@@ -15,7 +15,7 @@
       <image src="../../../image/sc.png" ></image> 
       <image class="share-img" src="../../../image/fx.png"></image>
     </view> -->
-    <text class="detail">{{ currentNews.desc }}</text>
+    <text class="detail">{{ currentNews.newsContent }}</text>
   </view>
 </view>
 

+ 9 - 2
pages/search/search.js

@@ -49,12 +49,12 @@ Page({
   },
   search:function(){
     let data ={
-      search:this.data.inputValue
+      searchParam:this.data.inputValue
     };
     apiServer.getSearch(data).then((res) =>{
       if(res.statusCode == 200){
         this.setData({
-          resultList:res.data.value
+          resultList:res.data.data
          }
         )
       }else{
@@ -94,6 +94,13 @@ Page({
     })
     this.search();
   },
+  hotName:function(e){
+    console.log(e);
+    this.setData({
+      inputValue: e.currentTarget.dataset.value.plateName
+    })
+    this.search();
+  },
   remove: function () {
     var _this = this;
     wx.showModal({

+ 6 - 5
pages/search/search.wxml

@@ -3,7 +3,7 @@
 <view class='container2'>
   <view  class='search_input'>
     <icon type="search" size="15" class='search_icon' />
-    <input placeholder='请输入板块代码' placeholder-class="search_placeholder" value="{{inputValue}}" bindinput="blur"></input>
+    <input placeholder='请输入板块代码或板块名称' placeholder-class="search_placeholder" value="{{inputValue}}" bindinput="blur"></input>
     <!-- <image src='../images/del.png' class='cancle_btn' wx:if="{{inputValue}}" bindtap='clean'></image> -->
     <image src='./images/del.png' class='cancle_btn'  wx:if="{{inputValue}}" bindtap='clean'></image>
   </view>
@@ -23,12 +23,13 @@
    <view  class='search_result' wx:if="{{inputValue}}">
        <view wx:for="{{resultList}}" class="swiper-box-view" wx:key="key" bindtap='detail' data-row='{{item}}'>
           <view class="swiper-box-left">
-          <view>{{item.Name}}</view>
+          <view>{{item.industryName}}</view>
           <!-- <view class="swiper-box-subtitle">{{item.Name}}</view> -->
         </view>
         <view class="swiper-box-right">
           <view class="swiper-box-button">
-            <button  class="mini-btn" type="warn" size="mini" >+{{commom.Intercept(item.Value)}}%</button>
+            <button  size="mini" wx:if="{{item.industryTag==true}}">+{{commom.Intercept(item.industryValue)}}%</button>
+            <button  style="background: #07c160;" size="mini" wx:if="{{item.industryTag==false}}">-{{commom.Intercept(item.industryValue)}}%</button>
           </view>
         </view>
        </view>
@@ -39,8 +40,8 @@
         热门搜索
      </view>
   </view>
-  <view class='list' wx:for="{{hotList}}" wx:key="key" bindtap='searchName' data-index="{{index}}">  
-      <view class="key">{{item.Name}}</view>
+  <view class='list' wx:for="{{hotList}}" wx:key="key" bindtap='hotName' data-value="{{item}}">  
+      <view class="key">{{item.plateName}}</view>
   </view>
 </view>
   

+ 1 - 1
project.config.json

@@ -25,7 +25,7 @@
 			"disablePlugins": [],
 			"outputPath": ""
 		},
-		"useCompilerModule": true,
+		"useCompilerModule": false,
 		"userConfirmedUseCompilerModuleSwitch": false,
 		"compileHotReLoad": false,
 		"useIsolateContext": true

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä