Ver código fonte

对接首页推荐的推荐标签

liguorui 7 anos atrás
pai
commit
6842dca73e

+ 1 - 0
app.json

@@ -1,6 +1,7 @@
 {
   "pages":[
     "pages/index/index",
+    "pages/test/test",
     "pages/hot/hot",
     "pages/hotdt/hotdt",
     "pages/myloan/myloan",

+ 23 - 0
components/page-scroll/page-scroll.js

@@ -0,0 +1,23 @@
+// components/page-scroll/page-scroll.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 4 - 0
components/page-scroll/page-scroll.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 8 - 0
components/page-scroll/page-scroll.wxml

@@ -0,0 +1,8 @@
+<!--components/page-scroll/page-scroll.wxml-->
+<scroll-view 
+  class="{{class||''}}"
+  style="{{style||''}}"
+  scroll-y="{{scroll-y||true}}"
+  bindscroll=""
+>
+</scroll-view>

+ 1 - 0
components/page-scroll/page-scroll.wxss

@@ -0,0 +1 @@
+/* components/page-scroll/page-scroll.wxss */

+ 7 - 7
module/search/search.js

@@ -18,20 +18,20 @@ export const searchmodule = {
   */
   inputConfirm : function(e) {
     var word = e.detail.value;
-    if (word) {
+    //if (word) {
       if(typeof this.submitsearchword=="function"){
         this.submitsearchword(word);
       }
       this.cancelSearch();
-    } else {
-      this.setData({
-        searchshow: false,
-        searchfocus: false
-      })
+    // } else {
+    //   this.setData({
+    //     searchshow: false,
+    //     searchfocus: false
+    //   })
       if (this.focusani){
         clearTimeout(this.focusani);
       }
-    }
+    //}
   },
 /*
   搜索聚焦事件

+ 1 - 1
pages/cardetail/cardetail.wxml

@@ -96,7 +96,7 @@
 				<view class="cardetail_baseinfo_n">排放标准</view>
 			</view>
 			<view class="cardetail_baseinfo_i">
-				<view class="cardetail_baseinfo_v">#######</view>
+				<view class="cardetail_baseinfo_v">{{detail.car_displacement}}</view>
 				<view class="cardetail_baseinfo_n">排量</view>
 			</view>
 			<view class="cardetail_baseinfo_i">

+ 3 - 1
pages/index/cardetail.wxml

@@ -17,7 +17,9 @@
         售价:{{car.saleprice}}万
       </view>
       <view class="car_characteristic">
-        <view class="car_characteristic_i">######</view>
+        <block wx:for="{{car.tag}}" wx:key="{{index}}">
+          <view class="car_characteristic_i">{{item}}</view>          
+        </block>
       </view>
     </view>
   </view>

+ 3 - 1
pages/index/index.js

@@ -117,7 +117,9 @@ Page({
     });
   },
   submitsearchword:function(word){
-    wx.navigateTo({ url: `../buy/buy?key=${word}`});
+    if(word){
+      wx.navigateTo({ url: `../buy/buy?keys=${word}`});
+    }
   },
   testPost:function(){
     post(pathmap.login,{

+ 1 - 0
pages/index/index.wxss

@@ -247,6 +247,7 @@
   border-radius: 6rpx;
   font-size: 18rpx;
   padding:0rpx 5rpx;
+  margin-right: 15rpx;
   background-color: rgba(255, 230, 0, 1);
   color: rgba(56, 55, 53, 1);
 }

+ 103 - 0
pages/test/test.js

@@ -0,0 +1,103 @@
+
+import { get,post } from "../../common/request.js"
+import pathmap from "../../common/pathmap"
+import stylemap from "../../common/stylemap"
+
+const app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: { 
+    windowh: app.globalData.windowh, 
+    limit:10,
+    lock:false,
+    list:[],
+    hasloadall:false,
+    offset:0
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getHots();
+    this.setData(stylemap);
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  },
+  getHots:function(){
+    var _self=this;
+    if(!this.data.lock){
+      var para = {
+        offset : this.data.offset,
+        limit : this.data.limit
+      }
+      this.setData({
+        lock:true
+      })
+      get(pathmap.goodcar, para, function (json) {
+        var list = json.data&&json.data.list;
+        var obj = {          
+          list:_self.data.list.concat(list),
+          offset:_self.data.offset+_self.data.limit,
+          lock:false
+        }
+        if(json.data.total<=_self.data.limit){
+          obj.hasloadall=true;
+        }else{
+          obj.hasloadall=false;
+        }
+        _self.setData(obj);
+      })
+    }
+  }
+})

+ 5 - 0
pages/test/test.json

@@ -0,0 +1,5 @@
+{
+	"usingComponents":{
+		"page-scroll":"../../components/page-scroll/page-scroll"
+	}
+}

+ 39 - 0
pages/test/test.wxml

@@ -0,0 +1,39 @@
+<!--pages/hot/hot.wxml-->
+
+<import src="../../module/header.wxml"/>
+<page-scroll
+  class="conent"
+  style="height:{{windowh}}rpx;"
+  scroll-y="{{selectbar==''?'true':'false'}}"
+  bindscrolltolower="{{hasloadall?'':'getHots'}}"
+>
+  <template 
+    is="header"
+    data="{{title:'好车热点',headerheight:headerheight,hasback:true}}"
+  />
+
+  <view wx:if="{{list.length>0}}" class="hot_list">
+    <block wx:for="{{list}}" wx:key="id">
+      <view class="hot_car_item">
+      	<view class="hot_car_info">
+      		<navigator class="hot_car_title" url="../hotdt/hotdt?id={{item.id}}">
+      			{{item.title}}
+      		</navigator>
+      		<view class="hot_car_detail">      			
+      			{{item.time}} 
+      			<image src="../../img/eye.png" class="hot_car_img"/>
+      			{{item.views}}
+      		</view>
+      	</view>
+      	<navigator url="../hotdt/hotdt?id={{item.id}}">
+      		<image class="hot_car_image" src="{{item.img}}"/>
+      	</navigator>
+      </view>
+    </block>
+  </view>
+  <view wx:else class="hot_empty"> 
+    <view class="hot_empty_w">还没有热点哦~</view>
+    <navigator url="../buy/buy" class="hot_empty_bt">去看看车</navigator>
+  </view> 
+  
+</page-scroll>

+ 69 - 0
pages/test/test.wxss

@@ -0,0 +1,69 @@
+/* pages/hot/hot.wxss *//* pages/hot/hot.wxss */
+
+@import "../../module/caritem/caritem.wxss"
+
+.conent{
+	background-color:#F9F9F9;
+}
+.hot_list{
+}
+.hot_empty{
+	margin-top:260rpx;
+	height: 39rpx;
+	line-height: 39rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 26rpx;
+	text-align: center;
+	font-family: NotoSansHans-DemiLight;
+}
+.hot_empty_bt{
+	margin:60rpx auto 0rpx;
+	width: 280rpx;
+	height: 68rpx;
+	line-height: 68rpx;
+	border-radius: 6rpx;
+	background: linear-gradient(270deg,#FFD800,#FFE600);
+	color: rgba(56, 55, 53, 1);
+	font-size: 26rpx;
+	text-align: center;
+	font-family: NotoSansHans-DemiLight;
+	font-weight: bold;
+}
+
+.hot_car_item{
+	height:160rpx;
+	padding: 20rpx 38rpx;
+	display: flex;
+	margin-bottom:2rpx;
+	background-color: white;
+}
+.hot_car_info{
+	flex: 1;
+	position: relative;
+}
+.hot_car_title{
+	width: 388rpx;
+	line-height: 38rpx;
+	color: rgba(56, 55, 53, 1);
+	font-size: 28rpx;
+	font-family: NotoSansHans-Medium;
+}
+.hot_car_detail{
+	position: absolute;
+	bottom: 20rpx;
+	height: 22rpx;
+	line-height: 22rpx;
+	color: rgba(104, 104, 104, 1);
+	font-size: 22rpx;
+	text-align: left;
+	font-family: NotoSansHans-DemiLight;
+}
+.hot_car_img{
+	width:22rpx;
+	height: 14rpx;
+	margin-left:30rpx;
+}
+.hot_car_image{
+	width:266rpx;
+	height: 160rpx;
+}