Browse Source

Merge remote-tracking branch 'origin/front2'

# Conflicts:
#	fore-end/API/appraise.js
#	fore-end/app.json
#	fore-end/pages/home/home.js
#	fore-end/pages/home/home.wxml
#	fore-end/pages/user/user.js
#	fore-end/utils/util.js
May1145 1 year ago
parent
commit
ff3d7d35b7
37 changed files with 962 additions and 158 deletions
  1. 55 6
      fore-end/API/appraise.js
  2. 18 18
      fore-end/app.js
  3. 12 3
      fore-end/app.json
  4. 24 6
      fore-end/components/commodity_card/commodity_card.js
  5. 7 11
      fore-end/components/commodity_card/commodity_card.wxml
  6. 4 0
      fore-end/components/commodity_card/commodity_card.wxss
  7. 111 3
      fore-end/pages/append/append.js
  8. 12 1
      fore-end/pages/append/append.json
  9. 52 1
      fore-end/pages/append/append.wxml
  10. 41 1
      fore-end/pages/append/append.wxss
  11. 13 10
      fore-end/pages/classify/classify.js
  12. 2 1
      fore-end/pages/classify/classify.json
  13. 1 1
      fore-end/pages/classify/classify.wxml
  14. 4 3
      fore-end/pages/classify/classify.wxss
  15. 35 4
      fore-end/pages/classify_detail/classify_detail.js
  16. 2 1
      fore-end/pages/classify_detail/classify_detail.json
  17. 4 2
      fore-end/pages/classify_detail/classify_detail.wxml
  18. 3 1
      fore-end/pages/classify_detail/classify_detail.wxss
  19. 84 0
      fore-end/pages/com_search/com_search.js
  20. 4 0
      fore-end/pages/com_search/com_search.json
  21. 22 0
      fore-end/pages/com_search/com_search.wxml
  22. 66 0
      fore-end/pages/com_search/com_search.wxss
  23. 38 4
      fore-end/pages/details/details.js
  24. 2 1
      fore-end/pages/details/details.json
  25. 6 5
      fore-end/pages/details/details.wxml
  26. 4 0
      fore-end/pages/details/details.wxss
  27. 72 18
      fore-end/pages/home/home.js
  28. 4 2
      fore-end/pages/home/home.json
  29. 32 19
      fore-end/pages/home/home.wxml
  30. 57 11
      fore-end/pages/home/home.wxss
  31. 107 3
      fore-end/pages/search/search.js
  32. 2 1
      fore-end/pages/search/search.json
  33. 21 9
      fore-end/pages/search/search.wxml
  34. 27 1
      fore-end/pages/search/search.wxss
  35. 3 4
      fore-end/project.config.json
  36. 3 3
      fore-end/project.private.config.json
  37. 8 4
      fore-end/utils/util.js

+ 55 - 6
fore-end/API/appraise.js

@@ -20,9 +20,12 @@ const API = {
 	getGoodsInfoUrl: '/goods/detail',
 	getLatestChattingRecordUrl: '/chat/latest',
 	getUserAllOrderUrl: '/order/user',
-	getUserAllGoodsUrl: '/goods/user'
-	
-    //放接口URL
+	getUserAllGoodsUrl: '/goods/user',
+	getCategoryGoodsURL: '/goods/category',
+	getAllGoodsURL: '/goods',
+    getSearchGoodsURL: '/goods/search',
+    postGoodsURL: '/goods/create',
+    getGoodsDetailURL: '/goods/detail',
 }
 
 //查询列表时传参---注意参数数据类型
@@ -100,6 +103,7 @@ function getOrder(params) {
 	)
 }
 
+// 获取分类信息
 function getCategoryAPI() {
     // return http( API.getCategoryURL, {data: data})
     return request.get(
@@ -107,12 +111,53 @@ function getCategoryAPI() {
 	)
 }
 
+// 获取分类出来的商品信息
 function getClassifyGoods(data) {
-    // return http( API.getCategoryGoods, {data: data})
     return request.get(
-		API.getCategoryGoods+`/${data.page}/${data.pageSize}`
+		API.getCategoryGoodsURL + `/${data.page}/${data.pageSize}` + '?category=' + data.id
 	)
 }
+
+//获取所有的商品
+function getAllGoods(data) {
+    return request.get(
+        API.getAllGoodsURL + `/${data.page}/${data.pageSize}`
+    )
+}
+
+//搜索获取商品
+function searchGoods(data) {
+    return request.get(
+        API.getSearchGoodsURL + `/${data.page}/${data.pageSize}` + '?keyword=' + data.inputValue
+    )
+}
+
+//获取商品详细描述
+function getGoodsDetail(data) {
+    console.log(data);
+    return request.get(
+        API.getGoodsDetailURL + `/${data.id}` + '?id=' + data.id + '&uid=' + data.uid + '&date=' + data.time
+    )
+}
+
+//上传商品
+function upLoadGoods(data) {
+    return request.post(
+        API.postGoodsURL,
+        {
+            data: {
+                "categories":  [data.gid],
+                "desc": data.desc,
+                "ownerId": 0,
+                "pic": data.fileList,
+                "place": data.address,
+                "price": data.price,
+                "state": 0,
+                "title": data.title
+            }
+        }
+    )
+}
 //获取用户好友关系
 function getUserRelation(params) {
 	return request.get(
@@ -211,6 +256,10 @@ module.exports = {
 	getLatestChattingRecord,
 	getUserAllOrder,
 	getUserAllGoods,
+	getAllGoods,
+	searchGoods,
+	upLoadGoods,
+	getGoodsDetail,
 	loginURl: API.loginURL,
-	registerURL: API.registerURL
+    registerURL: API.registerURL
 }

+ 18 - 18
fore-end/app.js

@@ -35,33 +35,33 @@ var infoOption = {
 	//检测缓存是否有token
 	// console.log(wx.getStorageSync('token'));
 	if(wx.getStorageSync('token') == ''){
-		console.log('token不存在');
+		// console.log('token不存在');
 		// 登录
 		wx.login({
 			success: (res) => {
 				//获取用户昵称和头像
 				//和微信接口服务校验
-			  console.log("code: "+res.code);
+			//   console.log("code: "+res.code);
 			  var url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + wxInfo.appid + '&secret=' + wxInfo.appSecret + '&js_code=' + res.code + '&grant_type=authorization_code'
 			  wx.request({
 				url:url,
 				success: (res) => {
-					console.log(res);
-					console.log(res.data.openid);
+					// console.log(res);
+					// console.log(res.data.openid);
 					wx.setStorageSync('vid', res.data.openid);
-					console.log(wx.getStorageSync('vid'));
+					// console.log(wx.getStorageSync('vid'));
 					loginOption.data = {
 						vid: wx.getStorageSync('vid'),
 					}
-					console.log(loginOption.data);
+					// console.log(loginOption.data);
 					login(loginOption).then(res => {
-						console.log(res);
+						// console.log(res);
 						wx.setStorageSync('token', res.data.data.token);
 						wx.setStorageSync('uid', res.data.data.user_info.uid);
 						wx.setStorageSync('avatarUrl', res.data.data.user_info.avatar);
 						wx.setStorageSync('nickName', res.data.data.user_info.name);
 					}).catch(err => {
-						console.log(err);
+						// console.log(err);
 						wx.navigateTo({
 							url: '/pages/register/register',
 						})
@@ -72,38 +72,38 @@ var infoOption = {
 		  })
 	}else{
 		getUserInfo(infoOption).then(res => {
-			console.log(res);
-			console.log('token有效');
+			// console.log(res);
+			// console.log('token有效');
 			wx.setStorageSync('uid', res.data.data.uid);
 			wx.setStorageSync('avatarUrl', res.data.data.avatar);
 			wx.setStorageSync('nickName', res.data.data.name);
 			wx.setStorageSync('personalSignatrue', res.data.data.sign);
-			console.log(wx.getStorageSync('uid'));
+			// console.log(wx.getStorageSync('uid'));
 		}).catch(err => {
-			console.log('token已失效,请重新登录');
+			// console.log('token已失效,请重新登录');
 			wx.login({
 				success: (res) => {
 					//和微信接口服务校验
-				  console.log("code: "+res.code);
+				//   console.log("code: "+res.code);
 				  var url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + wxInfo.appid + '&secret=' + wxInfo.appSecret + '&js_code=' + res.code + '&grant_type=authorization_code'
 				  wx.request({
 					url:url,
 					success: (res) => {
-						console.log(res);
-						console.log(res.data.openid);
+						// console.log(res);
+						// console.log(res.data.openid);
 						wx.setStorageSync('vid', res.data.openid);
-						console.log(wx.getStorageSync('vid'));
+						// console.log(wx.getStorageSync('vid'));
 						loginOption.data = {
 							vid: wx.getStorageSync('vid'),
 						}
 						login(loginOption).then(res => {
-							console.log(res);
+							// console.log(res);
 							wx.setStorageSync('token', res.data.data.token);
 							wx.setStorageSync('uid', res.data.data.user_info.uid);
 							wx.setStorageSync('avatarUrl', res.data.data.user_info.avatar);
 							wx.setStorageSync('nickName', res.data.data.user_info.name);
 						}).catch(err => {
-							console.log(err);
+							// console.log(err);
 							wx.navigateTo({
 								url: '/pages/register/register',
 							})

+ 12 - 3
fore-end/app.json

@@ -14,7 +14,10 @@
 		"van-card": "@vant/weapp/card/index",
 		"van-swipe-cell": "@vant/weapp/swipe-cell/index",
 		"van-search": "@vant/weapp/search/index",
-		"van-notice-bar": "@vant/weapp/notice-bar/index"
+		"van-notice-bar": "@vant/weapp/notice-bar/index",
+        "van-uploader": "@vant/weapp/uploader/index",
+        "van-picker": "@vant/weapp/picker/index",
+        "van-popup": "@vant/weapp/popup/index"
 	},
 	"pages": [
 		"pages/home/home",
@@ -28,7 +31,8 @@
 		"pages/details/details",
 		"pages/search/search",
 		"pages/classify_detail/classify_detail",
-		"pages/chat/chat"
+		"pages/chat/chat",
+        "pages/com_search/com_search"
 	],
 	"window": {
 		"backgroundTextStyle": "light",
@@ -66,5 +70,10 @@
 		],
 		"borderStyle": "white"
 	},
-	"sitemapLocation": "sitemap.json"
+	"sitemapLocation": "sitemap.json",
+    "permission": {
+        "scope.userLocation": {
+            "desc": "你的位置信息将用于小程序位置接口的效果展示"
+        }
+    }
 }

+ 24 - 6
fore-end/components/commodity_card/commodity_card.js

@@ -1,27 +1,45 @@
 // components/commodity_card/commodity_card.js
+const { getClassifyGoods, getAllGoods } = require('../../API/appraise')
+
 Component({
+    lifetimes: {
+        created: function() {
+
+        }
+    },
     /**
      * 组件的属性列表
+     * 是属性名到属性设置的映射表
      */
     properties: {
-
+        comList: {
+            type: []
+        }
     },
-
     /**
      * 组件的初始数据
      */
     data: {
-
+        imgUrl: "",
+        price: 0,
+        page: 1,
+        pageSize: 6,
+        id: 0
     },
 
     /**
      * 组件的方法列表
      */
     methods: {
-        detailTo() {
+        detailTo(e) {
+            console.log(e.currentTarget.dataset);
+            const id = e.currentTarget.dataset.id;
+            const title = e.currentTarget.dataset.title;
+            const price = e.currentTarget.dataset.price;
+            const comImg = e.currentTarget.dataset.pic;
             wx.navigateTo({
-              url: '/pages/details/details',
+              url: '/pages/details/details?id=' + id + '&title=' + title + '&price=' + price + '&img=' + comImg,
             })
-        }
+        },
     }
 })

+ 7 - 11
fore-end/components/commodity_card/commodity_card.wxml

@@ -1,15 +1,11 @@
 <!--components/commodity_card/commodity_card.wxml-->
 <view class="commodity">
-    <view class="commodity_show" bind:tap="detailTo">
-        <image src="/assets/recommend_img/recom_1.jpg" alt="" class="commodity_image"/>
-        <text class="commodity_name">产品名称</text>
-        <text class="price">¥49.9</text>
-        <avatar></avatar>
-    </view>
-    <view class="commodity_show">
-        <image src="/assets/recommend_img/recom_2.jpg" mode="" class="commodity_image"/>
-    </view>
-    <view class="commodity_show">
-        <image src="/assets/recommend_img/recom_3.jpg" mode="" class="commodity_image"/>
+    <view class="commodity_show" wx:for="{{comList}}" wx:key="index">
+        <view  bind:tap="detailTo" data-id='{{item.Id}}' data-price='{{item.Price}}' data-Title='{{item.Title}}' data-pic='{{item.Pic}}'>
+            <image src="{{item.Pic}}" alt="" class="commodity_image"/>
+            <text class="commodity_name">{{item.Title}}</text>
+            <text class="price">¥{{item.Price}}</text>
+            <avatar></avatar>
+        </view>
     </view>
 </view>

+ 4 - 0
fore-end/components/commodity_card/commodity_card.wxss

@@ -24,6 +24,10 @@
     position: absolute;
     top: 360rpx;
     left: 15rpx;
+    width: 350rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
 }
 
 .price {

+ 111 - 3
fore-end/pages/append/append.js

@@ -1,20 +1,115 @@
 // pages/append/append.js
+const { getCategoryAPI, upLoadGoods } = require('../../API/appraise')
+const { upLoad, chooseImage } = require('../../utils/util')
+const baseURL = "http://192.168.31.27:8084";
+import Toast from '@vant/weapp/toast/toast'
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        latitude: 0,
+        longtitude: 0,
+        mapName: "",
+        columns: [],
+        id: [],
+        popShow: false,
+        clssify: [],
+        valueKeyName: "",
+        index: 0,
+        fileImg: [],
+        // 页面数据们
+        title: "",
+        desc: "",
+        price: 0,
+        address: "",
+        fileList: [],
+        gid: Number,
+        maxgoodsURL: 6
+    },
+    popChange() {
+        this.setData({
+            popShow: true
+        })
+        this.getClassifyList()
+    },
+    onConfirm(e) {
+        const { value, index} = e.detail;
+        this.setData({
+            popShow: false,
+            valueKeyName: value,
+            index: index
+        })
+    },
+    onCancel() {
+        this.setData({
+            popShow: false,
+            valueKeyName: ""
+        })
+    },
+    titleInput(e) {
+        const {value, cursor, keyCode} = e.detail;
+        this.setData({
+            title: value
+        })
+    },
+    describeInput(e) {
+        const {value, cursor, keyCode} = e.detail;
+        this.setData({
+            desc: value
+        })
+    },
+    numInput(e){
+        const {value, cursor, keyCode} = e.detail;
+        this.setData({
+            price: parseInt(value)
+        })
+    },
+    adressInput(e) {
+        const { value, cursor, keyCode} = e.detail;
+        this.setData({
+            address: value
+        })
+    },
+    upData(){
+        this.setData({
+            gid: this.data.id[this.data.index]
+        })
+        upLoadGoods(this.data).then((res) => {
+            console.log(res);
+            Toast({
+                message: '发布商品成功!'
+            })
+        }).catch((err) => {
+            console.log(err); 
+        })
+        console.log(this.data);
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
 
     },
-
+    getClassifyList() {
+		getCategoryAPI(this.data)
+		.then((res) => {
+            const { code, data, mesage } = res.data;
+            const name = [];
+            const id = [];
+            for (let i = 0; i < data.length; i++) {
+                name[i] = data[i].Name;
+                id[i] = data[i].Id; 
+            }
+            console.log(id);
+            this.setData({
+                columns: name,
+                id: id
+            })
+        })
+    },  
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -62,5 +157,18 @@ Page({
      */
     onShareAppMessage() {
 
+    },
+    afterRead(e) {
+        const { file } = e.detail;
+        upLoad(file.url).then((res) => {
+            const { fileList = [], fileImg = [] } = this.data;
+            fileImg.push({ ...file, url: res.data });
+            fileList.push(file.url)
+            this.setData({
+                fileList,
+                fileImg
+            })
+            console.log(this.data.fileList);
+        })
     }
 })

+ 12 - 1
fore-end/pages/append/append.json

@@ -1,3 +1,14 @@
 {
-    "usingComponents": {}
+    "usingComponents": {
+        "van-toast": "@vant/weapp/toast/index"
+    },
+    "navigationBarTitleText": "发布商品",
+    "requiredPrivateInfos": [
+      "getLocation"
+    ],
+    "permission": {
+      "scope.userLocation": {
+        "desc": "你的位置信息将用于小程序位置接口的效果展示"
+      }
+    }
 }

+ 52 - 1
fore-end/pages/append/append.wxml

@@ -1,2 +1,53 @@
 <!--pages/append/append.wxml-->
-<text>pages/append/append.wxml</text>
+<!-- title -->
+<view class="title">
+    <!-- 标题 -->
+    <view style="float: left; font-weight: 700; font-size: 45rpx; margin-top: 10rpx;">发布商品</view>
+    <!-- 存草稿--缓存 -->
+    <!-- <view style="float: left; margin-left: 300rpx; margin-top: 20rpx;">存草稿</view> -->
+    <!-- 发布 -->
+    <view style="float: right;" bind:tap="upData">
+        <van-button round type="info">发布</van-button>
+    </view>
+    <van-toast id="van-toast"/>
+</view>
+
+<!-- 商品描述模块 -->
+<view class="discribe">
+    <view>
+        <textarea placeholder="标题" style="width: 690rpx; height: 100rpx;" bindinput="titleInput"/>
+    </view>
+    <view class="textLine">
+        <!-- <input type="text" placeholder="描述一下商品..."/> -->
+        <textarea placeholder="描述一下商品..." style="width: 690rpx;" bindinput="describeInput"/>
+    </view>
+    <!-- 选择图片 -->
+    <view class="upLoad">
+        <!-- <van-image fit="cover" width="100" height="100" src="{{goodsURL}}" bindtap="chooseImage" style="float: left;"/> -->
+        <van-uploader file-list="{{ fileImg }}" bind:after-read="afterRead" max-count="3" deletable="{{true}}"/>
+    </view>
+</view>
+
+<!-- 商品导航栏 -->
+<view class="navigation">
+    <view class="nav nav_price">
+        <text style="float: left; font-weight: 600;">价格</text>
+        <view style="float: left; margin-left: 540rpx; margin-top: -50rpx; position: relative;">
+                <input type="number" placeholder="¥0.00" bindinput="numInput"/>
+        </view>
+    </view>
+    <view class="nav">
+        <text style="float: left; font-weight: 600; margin-top: 8rpx;">交易地点</text>
+        <view style="float: left; margin-left: 310rpx; margin-top: -50rpx; margin-right: -70rpx; position: relative;">
+                <input type="text" maxlength="20" bindinput="adressInput"/>
+        </view>
+    </view>
+    <view class="nav">
+        <text style="float: left; font-weight: 600; margin-top: 8rpx;">分类选择</text>
+        <van-icon name="arrow" style="float: right; margin-top: 20rpx;"  bind:tap="popChange"/>
+        <van-popup show="{{ popShow }}" position="bottom" custom-style="height: 50%;overflow:hidden">
+            <van-picker value-key="{{valueKeyName}}" id="picker" show-toolbar title="{{label}}" columns="{{ columns }}" bind:cancel="onCancel" bind:confirm="onConfirm" />
+        </van-popup>
+        <view style="float: right; margin-top: 10rpx; margin-right: 10rpx;">{{valueKeyName}}</view>
+    </view>
+</view>

+ 41 - 1
fore-end/pages/append/append.wxss

@@ -1 +1,41 @@
-/* pages/append/append.wxss */
+/* pages/append/append.wxss */
+.title{
+    width: 100%;
+    height: 90rpx;
+}
+
+.discribe { 
+    width: 96%;
+    height: 600rpx;
+    margin-top: 20rpx;
+    padding: 15rpx;
+    background-color: #DDDEDF;
+    border-radius: 20rpx;
+}
+
+.textLine {
+    width: 95%;
+    height: 40rpx;
+    flex-wrap: wrap;
+    margin-top: 10rpx;
+}
+
+.upLoad {
+    margin-top: 280rpx;
+    width: 100%;height: 300rxp;
+    overflow: hidden;
+}
+
+.navigation {
+    width: 90%;
+    height: 240rpx;
+    margin-top: 20rpx;
+    padding: 34rpx;
+    background-color: #DDDEDF;
+    border-radius: 20rpx;
+}
+
+.nav {
+    height: 30%;
+    border-bottom: 4rpx solid rgba(0, 0, 0, 0.3);
+}

+ 13 - 10
fore-end/pages/classify/classify.js

@@ -1,9 +1,6 @@
 // pages/classify/classify.js
-const { http } = require('../../utils/util')
+const { getCategoryAPI } = require('../../API/appraise')
 
-const API = {
-    getCategoryURL: '/category'
-}
 
 Page({
 
@@ -14,6 +11,14 @@ Page({
         classifyList: []
     },
 
+    //获取点击分类的id
+    detailClassifyTo({ currentTarget }) {
+        const id = currentTarget.dataset.num;
+        const title = currentTarget.dataset.title;
+        wx.navigateTo({
+            url: '/pages/classify_detail/classify_detail?classify_id=' + id + '&title=' + title,
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
@@ -22,13 +27,11 @@ Page({
     },
 
     getClassifyList() {
-        http({url: API.getCategoryURL, data: this.data}).then((res) => {
-            wx.setStorageSync('classifyList',res);
-            let classifyList = wx.getStorageSync('classifyList')
+		getCategoryAPI(this.data)
+		.then((res) => {
+            const { code, data, mesage } = res.data;
             this.setData({
-                classifyList: [...res],
-                imgUrl: classifyList[0].Pic,
-                classifyName: classifyList[0].Name
+                classifyList: data
             })
         })
     },

+ 2 - 1
fore-end/pages/classify/classify.json

@@ -1,3 +1,4 @@
 {
-    "usingComponents": {}
+    "usingComponents": {},
+    "navigationBarTitleText": "分类"
 }

+ 1 - 1
fore-end/pages/classify/classify.wxml

@@ -5,7 +5,7 @@
     <!-- 展示分类 -->
     <view class="classify_list">
         <view class="categories" wx:for="{{classifyList}}" wx:key="Id">
-            <view class="categories_card">
+            <view class="categories_card" bind:tap="detailClassifyTo" data-num='{{item.Id}}' data-title='{{item.Name}}'>
                 <van-image width="90" height="90" fit="cover" src="{{item.Pic}}" />
             </view>
             <view class="text">{{item.Name}}</view>

+ 4 - 3
fore-end/pages/classify/classify.wxss

@@ -10,12 +10,13 @@ image {
     font-size: 80rpx;
     font-weight: 800;
     color: #808080;
-    margin: 70rpx;
+    margin-left: 40rpx;
+    margin-top: 60rpx;
+    margin-bottom: 20rpx;
     text-align: center;
 }
 
 .classify_list {
-    margin-top: 40rpx;
     margin-left: 10rpx;
     display: flex;
     padding: 30rpx;
@@ -27,5 +28,5 @@ image {
 /* 展示分类 */
 .text {
     margin-left: 42rpx;
-    margin-top: 15rpx;
+    margin-top: 5rpx;
 }

+ 35 - 4
fore-end/pages/classify_detail/classify_detail.js

@@ -10,21 +10,47 @@ Page({
     data: {
         classifyShow: [],
         page: 1,
-        pageSize: 6
+        pageSize: 6,
+        id: 3,
+        title: "",
+        //节流阀
+        isLoading: false
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
+        //setData和getGoods的顺序也非常重要
+        this.setData({
+            // 传递点击的分类id
+            id: options.classify_id,
+            //传递点击的分类名称
+            title: options.title
+        }),
+        wx.setNavigationBarTitle({
+          title: this.data.title,
+        })
         this.getGoods()
-        // console.log(options);
-        // var id = options;
     },
 
     getGoods() {
+        //加载的loading效果
+        wx.showLoading({
+          title: '数据获取中',
+        })
         getClassifyGoods(this.data).then((res) => {
+            console.log(this.data);
+            const { data } = res.data;
             console.log(res);
+            this.setData({
+                classifyShow: [...this.data.classifyShow , ...data.data],
+                isLoading: true
+            })
+            console.log(this.data.classifyShow);
+        })
+        this.setData({
+            isLoading: false
         })
     },
     /**
@@ -66,7 +92,12 @@ Page({
      * 页面上拉触底事件的处理函数
      */
     onReachBottom() {
-
+        if(this.data.isLoading) {
+            this.setData({
+                page: this.data.page + 1,
+            })
+            this.getGoods()
+        }
     },
 
     /**

+ 2 - 1
fore-end/pages/classify_detail/classify_detail.json

@@ -1,5 +1,6 @@
 {
     "usingComponents": {
         "commodity_card": "/components/commodity_card/commodity_card"
-    }
+    },
+    "onReachBottomDistance": 200
 }

+ 4 - 2
fore-end/pages/classify_detail/classify_detail.wxml

@@ -1,8 +1,10 @@
 <!--pages/classify_detail/classify_detail.wxml-->
 <view class="title">
-    <text class="text">分类一</text>
+    <text class="text">{{title}}</text>
 </view>
 <!-- 商品展示 -->
 <view class="goodsShow">
-    <commodity_card></commodity_card>
+    <commodity_card 
+        comList = '{{classifyShow}}'
+    ></commodity_card>
 </view>

+ 3 - 1
fore-end/pages/classify_detail/classify_detail.wxss

@@ -6,12 +6,14 @@
     margin-top: -20rpx;
     margin-left: -20rpx;
     z-index: 100;
+    padding-left: 30rpx;
     background-color:  var(--themeColor);
 }
 
 .text {
     line-height: 60rpx;
-    margin-left: 315rpx;
+    text-align: center;
+    /* margin-left: 315rpx; */
 }
 
 .goodsShow {

+ 84 - 0
fore-end/pages/com_search/com_search.js

@@ -0,0 +1,84 @@
+// pages/com_search/com_search.js
+Page({
+
+	/**
+	 * 页面的初始数据
+	 */
+	data: {
+        resultList: []
+	},
+    searchTo(){
+        wx.navigateTo({
+          url: '../../pages/search/search',
+        })
+    },
+	/**
+	 * 生命周期函数--监听页面加载
+	 */
+	onLoad(options) {
+        var data = JSON.parse(decodeURIComponent(options.comList))
+        console.log(data);
+        this.setData({
+            resultList: data
+        })
+	},
+    //推荐商品传递数据
+    detailTo(e) {
+        console.log(e.currentTarget.dataset);
+        const id = e.currentTarget.dataset.id;
+        const title = e.currentTarget.dataset.title;
+        const price = e.currentTarget.dataset.price;
+        const comImg = e.currentTarget.dataset.pic;
+        wx.navigateTo({
+          url: '/pages/details/details?id=' + id + '&title=' + title + '&price=' + price + '&img=' + comImg,
+        })
+    },
+	/**
+	 * 生命周期函数--监听页面初次渲染完成
+	 */
+	onReady() {
+
+    },
+
+	/**
+	 * 生命周期函数--监听页面显示
+	 */
+	onShow() {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面隐藏
+	 */
+	onHide() {
+
+	},
+
+	/**
+	 * 生命周期函数--监听页面卸载
+	 */
+	onUnload() {
+
+	},
+
+	/**
+	 * 页面相关事件处理函数--监听用户下拉动作
+	 */
+	onPullDownRefresh() {
+
+	},
+
+	/**
+	 * 页面上拉触底事件的处理函数
+	 */
+	onReachBottom() {
+
+	},
+
+	/**
+	 * 用户点击右上角分享
+	 */
+	onShareAppMessage() {
+
+	}
+})

+ 4 - 0
fore-end/pages/com_search/com_search.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "搜索结果"
+}

+ 22 - 0
fore-end/pages/com_search/com_search.wxml

@@ -0,0 +1,22 @@
+<!--pages/com_search/com_search.wxml-->
+<!-- 搜素框 -->
+<view class="search_box">
+    <view class="base_search">
+        <van-icon name="search" size="50rpx" color="#696969" style="margin-top: 15rpx; margin-left: -430rpx;"/>
+        <input type="search" name="" placeholder="搜索..." value="{{inputValue}}" class="search_text" bind:tap="searchTo"/>
+        <van-icon name="cross" style="float: right; margin-top: 24rpx; margin-right: 15rpx;"/>
+    </view>
+    <!-- 搜索按钮 -->
+    <view class="search_button" bind:tap="onClose" catch:tap="searchBegin" data-searchdata="{{inputValue}}">搜索</view>
+</view>
+
+<view class="commodity">
+    <view class="commodity_show" wx:for="{{resultList}}" wx:key="index">
+        <view  bind:tap="detailTo" data-id='{{item.Id}}' data-price='{{item.Price}}' data-Title='{{item.Title}}' data-pic='{{item.Pic}}'>
+            <image src="{{item.Pic}}" alt="" class="commodity_image"/>
+            <text class="commodity_name">{{item.Title}}</text>
+            <text class="price">¥{{item.Price}}</text>
+            <avatar></avatar>
+        </view>
+    </view>
+</view>

+ 66 - 0
fore-end/pages/com_search/com_search.wxss

@@ -0,0 +1,66 @@
+/* pages/com_search/com_search.wxss */
+/* .search_box {
+
+} */
+/* 搜索 */
+.base_search {
+    width: 80%;
+    height: 80rpx;
+    background-color: #E8E7E7;
+    border-radius: 20rpx;
+}
+
+.search_text {
+    float: left;
+    padding-left: 95rpx;
+    padding-top: 15rpx;
+}
+
+.search_button {
+    float: right;
+    margin-top: -64rpx;
+    margin-right: 20rpx;
+    font-size: 35rpx;
+    color: #494545;
+}
+/* *********************** */
+
+/* 商品展示 */
+.commodity {
+    display: flex;
+    flex-wrap: wrap; /*自动换行*/
+    margin-top: 10rpx;
+}
+
+.commodity_show {
+    display: flex;
+    position: relative;
+    width: 48%;
+    height: 500rpx;
+    padding: 7rpx;
+    justify-content: center;
+}
+
+.commodity_image {
+    width: 340rpx;
+    height: 340rpx;
+    border-radius: 20rpx;
+}
+
+.commodity_name {
+    position: absolute;
+    top: 360rpx;
+    left: 15rpx;
+    width: 350rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+
+.price {
+    position: absolute;
+    top: 400rpx;
+    left: 12rpx;
+    color: #a08016;
+    font-weight: 600;
+}

+ 38 - 4
fore-end/pages/details/details.js

@@ -1,25 +1,59 @@
 // pages/details/details.js
+const { getGoodsDetail } = require('../../API/appraise')
+const { formatTime } = require('../../utils/util')
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        id: 0,
+        title: "",
+        price: 0,
+        pic: [],
+        desc: "",
+        uid: Number,
+        time: Number
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-
+        //将传递过来的关于商品的数据渲染到页面
+        this.setData({
+            id: options.id,
+            title: options.title,
+            price: options.price,
+            pic: options.img,
+            uid: parseInt(options.uid)
+        })
+        console.log(this.data.pic);
+        //获取时间戳
+        var date = Date.parse(new Date())
+        date = date / 1000
+        this.setData({
+            time: date
+        })
+        this.GoodsDetail();
+    },
+    GoodsDetail() {
+        getGoodsDetail(this.data).then((res) => {
+            const { code, data, message} = res.data; 
+            //通过获取详细信息将商品的描述获取并渲染
+            this.setData({
+                desc: data.Desc
+            })
+        }).catch((err) => {
+            console.log(err);
+        })
     },
-
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady() {
-
+        
     },
 
     /**

+ 2 - 1
fore-end/pages/details/details.json

@@ -1,5 +1,6 @@
 {
     "usingComponents": {
         "commodity-card": "/components/commodity_card/commodity_card"
-    }
+    },
+    "navigationBarTitleText": "商品详情"
 }

+ 6 - 5
fore-end/pages/details/details.wxml

@@ -1,7 +1,8 @@
 <!--pages/details/details.wxml-->
 <!-- 商品图片展示 -->
 <view class="detail_pic">
-    <van-image width="350" height="300" fit="cover" radius="10" src="/assets/recommend_img/recom_1.jpg" />
+    <!-- <van-image width="350" height="300" fit="cover" radius="10" src="{{pic}}" /> -->
+    <image src="{{pic}}" mode="" style="width: 700rpx; height: 600rpx;"/>
 </view>
 
 <!-- 用户展示 -->
@@ -9,15 +10,15 @@
     <!-- 用户信息:头像 产品名称、价格 卖家昵称 联系卖主按钮 -->
     <view class="seller_msg">
         <van-image round width="70" height="70" fit="cover" src="/assets/home_img/head_portrait.jpg" />
-        <text class="commodity_name">产品名称</text>
-        <text class="price">¥49.9</text>
+        <text class="commodity_name">{{title}}</text>
+        <text class="price">¥{{price}}</text>
         <text class="seller_name">deter</text>
         <van-button color="#FFC300" custom-style="border-radius: 20rpx; color: #000000; font-size: 35rpx; position: absolute; top: 30rpx; right: 10rpx;">联系卖主</van-button>
     </view>
     <!-- 卖的商品信息 -->
     <view class="sell_msg">
-        <text class="sell_title">女士夏秋套装\n</text>
-        <view class="sell_detail" style="width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">女士T恤+短裤+鞋,未穿过,出售,价格可谈,女士T恤+短裤+鞋,未穿过,出售,价格可谈</view>
+        <text class="sell_title">{{title}}\n</text>
+        <view class="sell_detail" style="width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">{{desc}}</view>
     </view>
 </view>
 

+ 4 - 0
fore-end/pages/details/details.wxss

@@ -19,6 +19,10 @@
     top: 10rpx;
     left: 160rpx;
     font-weight: 600;
+    width: 300rpx;
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
 }
 
 .price {

+ 72 - 18
fore-end/pages/home/home.js

@@ -1,6 +1,11 @@
 // pages/home/home.js
-const { getCategoryAPI,getClassifyGoods} = require('../../API/appraise')
-
+const { getCategoryAPI, getAllGoods, getUserInfo} = require('../../API/appraise')
+const { formatTime } = require('../../utils/util')
+var getOrderOption = {
+	data: {
+		id: wx.getStorageSync('uid'),
+	}
+}
 
 Page({
 
@@ -12,6 +17,14 @@ Page({
         classifyList: [],
         //用于存放页面上划高度
         scrollTop: 0,
+        //存放所有商品
+        allGoods: [],
+        page: 1,
+        pageSize: 6,
+        isLoading: false,
+        time: Number,
+        id: 0,
+        uid: Number
     },
 
     userTo() {
@@ -24,6 +37,11 @@ Page({
           url: '/pages/classify/classify',
         })
     },
+    messageTo() {
+        wx.switchTab({
+          url: '/pages/message/message',
+        })
+    },
     searchTo() {
         wx.navigateTo({
           url: '/pages/search/search',
@@ -32,8 +50,9 @@ Page({
     //获取点击分类的id
     detailClassifyTo({ currentTarget }) {
         const id = currentTarget.dataset.num;
+        const title = currentTarget.dataset.title;
         wx.navigateTo({
-            url: '/pages/classify_detail/classify_detail?classify_id=' + id,
+            url: '/pages/classify_detail/classify_detail?classify_id=' + id + '&title=' + title,
         })
     },
     /**
@@ -41,6 +60,7 @@ Page({
      */
     onLoad(options) {
 		this.getClassifyList();
+        this.getGoodsList();
 		this.setData({
 			avatarUrl:wx.getStorageSync('avatarUrl'),
 			nickName:wx.getStorageSync('nickName')
@@ -49,16 +69,55 @@ Page({
 
     getClassifyList() {
 		getCategoryAPI(this.data)
-		.then((data) => {
+		.then((res) => {
+            const { code, data, mesage } = res.data;
             this.setData({
                 classifyList: data
             })
         })
     },
-
+    //获取推荐商品
     getGoodsList() {
-        getClassifyGoods(this.data).then((data) => {
-            console.log(data);
+        var time = formatTime(new Date());
+        this.setData({
+            time: time
+        })
+        //加载的loading效果
+        wx.showLoading({
+            title: '数据获取中',
+        })
+        getAllGoods(this.data).then((res) => {
+            const { code, data, message } = res.data;
+            const d = data.data;
+            this.setData({
+                allGoods: [...this.data.allGoods, ...d],
+                isLoading: true
+            })
+        })
+        this.setData({
+            isLoading: false
+        })
+    },
+    // GoodsDetail() {
+    //     getGoodsDetail(this.data).then((res) => {
+    //         console.log(res);
+    //     }).catch((err) => {
+    //         console.log(err);
+    //     })
+    // },
+    //推荐商品传递数据
+    detailTo(e) {
+        const id = e.currentTarget.dataset.id;
+        const title = e.currentTarget.dataset.title;
+        const price = e.currentTarget.dataset.price;
+        const comImg = e.currentTarget.dataset.pic;
+        this.setData({
+            uid: parseInt(getOrderOption.data.id)
+        })
+        const uid = this.data.uid;
+        // this.GoodsDetail();
+        wx.navigateTo({
+          url: '/pages/details/details?id=' + id + '&title=' + title + '&price=' + price + '&img=' + comImg + '&uid=' + uid,
         })
     },
     /**
@@ -100,7 +159,12 @@ Page({
      * 页面上拉触底事件的处理函数
      */
     onReachBottom() {
-
+        if(this.data.isLoading) {
+            this.setData({
+                page: this.data.page + 1,
+            })
+            this.getGoodsList()
+        }
     },
 
     /**
@@ -108,16 +172,6 @@ Page({
      */
     onShareAppMessage() {
 
-    },
-
-    /**
-     * 监听页面滑动
-     */
-    onPageScroll(data) {
-        // console.log(data.scrollTop);
-        this.setData({
-            scrollTop: data.scrollTop
-        })
     }
 })
 

+ 4 - 2
fore-end/pages/home/home.json

@@ -1,5 +1,7 @@
 {
     "usingComponents": {
-        "commodity_card": "/components/commodity_card/commodity_card"
-    }
+        "commodity_card": "/components/commodity_card/commodity_card",
+        "avatar": "/components/avatar/avatar"
+    },
+    "navigationBarTitleText": "主页"
 }

+ 32 - 19
fore-end/pages/home/home.wxml

@@ -1,26 +1,30 @@
 <!--pages/home/home.wxml-->
 <!-- 头部 -->
-<view class="head">
-    <view bind:tap="userTo">
-        <!-- 头像 -->
-        <view class="head-portrait-bg">
-            <van-image width="100rpx" height="100rpx" fit="cover" src="{{avatarUrl}}" radius="20rpx"></van-image>
+<view style="width: 100%; height: 20rpx; background-color: #f5f5f5; position: absolute; top: 0; left: -1rpx; position: fixed; z-index: 100;" ></view>
+
+<view class="bigBox">
+    <view class="head" style="position: fixed;">
+        <view bind:tap="userTo">
+            <!-- 头像 -->
+            <view class="head-portrait-bg">
+                <van-image width="100rpx" height="100rpx" fit="cover" src="{{avatarUrl}}" radius="20rpx"></van-image>
+            </view>
+            <!-- 昵称 -->
+            <view class="username">{{nickName}}</view>
+        </view>
+        <!-- 消息提示 -->
+        <view  bind:tap="messageTo">
+            <van-icon name="bell" custom-style="margin" class="head_bell" size="50rpx" info="9" color="var(--themeColor)"/>
         </view>
-        <!-- 昵称 -->
-        <view class="username">{{nickName}}</view>
     </view>
-    <!-- 消息提示 -->
-    <view>
-        <van-icon name="bell" custom-style="margin" class="head_bell" size="50rpx" info="9" color="var(--themeColor)"/>
+    <!-- 搜索框 -->
+    <view class="search_box" style="position: fixed; top: 129rpx">
+        <input type="search" name="" placeholder="搜索..." class="search_text" bind:tap="searchTo"/>
+        <button class="search_button" plain="true">
+            <van-icon class="search_icon" name="search" size="50rpx"/>
+         </button>
     </view>
 </view>
-<!-- 搜索框 -->
-<view class="search_box {{scrollTop > 85 ? 'addClass' : ''}}">
-    <input type="search" name="" placeholder="搜索..." class="search_text" bind:tap="searchTo"/>
-    <button class="search_button" plain="true">
-        <van-icon class="search_icon" name="search" size="50rpx"/>
-    </button>
-</view>
 
 <!-- 分类展示 -->
 <view class="categories">
@@ -36,7 +40,7 @@
  <!-- 分类推荐 -->
 <scroll-view scroll-x style='display: flex;white-space:nowrap; margin-top: 80rpx;'>
     <view class="categories_card" wx:for="{{classifyList}}" wx:for-item="item" wx:key="index">
-        <view bind:tap="detailClassifyTo" data-num='{{item.Id}}'>
+        <view bind:tap="detailClassifyTo" data-num='{{item.Id}}' data-title='{{item.Name}}'>
             <van-image width="75" height="75" radius="20rpx" src="{{item.Pic}}" />
             <view class="name_show">{{item.Name}}</view>
         </view>
@@ -50,6 +54,15 @@
 </view>
 
 <!-- 商品卡片 -->
-<commodity_card></commodity_card>
+<view class="commodity">
+    <view class="commodity_show" wx:for="{{allGoods}}" wx:key="index">
+        <view  bind:tap="detailTo" data-id='{{item.Id}}' data-price='{{item.Price}}' data-Title='{{item.Title}}' data-pic='{{item.Pic}}' data-uid='{{item.OwnerId}}'>
+            <image src="{{item.Pic}}" alt="" class="commodity_image"/>
+            <text class="commodity_name">{{item.Title}}</text>
+            <text class="price">¥{{item.Price}}</text>
+            <avatar></avatar>
+        </view>
+    </view>
+</view>
 
 <van-toast id="van-toast" />

+ 57 - 11
fore-end/pages/home/home.wxss

@@ -1,7 +1,16 @@
 /* pages/home/home.wxss */
+.bigBox {
+    position: relative;
+    height: 210rpx;
+    z-index: 100;
+}
+
 /* 头部区域 */
 .head {
     height: 130rpx;
+    background-color: #f5f5f5;
+    /* margin-top: -20rpx; */
+    /*怎么办啊啊啊*/
 }
 
 .head-portrait-bg {
@@ -17,10 +26,13 @@
     height: 100rpx;
     border-radius: 20rpx;
 }
-
+ 
 .username {
     float: left;
-    width: 100rpx;
+    width: 530rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
     margin-top: 30rpx;
     margin-left: 20rpx;
     font-size: 18px;
@@ -35,19 +47,12 @@
 
 /* 搜索栏 */
 .search_box {
-    width: 100%;
+    width: 720rpx;
     height: 80rpx;
     background-color: #E8E7E7;
     border-radius: 20rpx;
 }
 
-.addClass {
-    position: fixed;
-    top: 0rpx;
-    z-index: 100;
-    margin-right: 20rpx;
-}
-
 .search_text {
     float: left;
     padding-left: 15rpx;
@@ -57,6 +62,7 @@
 .search_icon {
     margin-bottom: 1rpx;
 }
+
 .search_button {
     float: right;
     width: 80rpx;
@@ -112,4 +118,44 @@ button[plain]{ border:0 }
     top: 32rpx
 }
 
-/* ------------------------------ */
+/* ------------------------------ */
+
+/* 商品 */
+.commodity {
+    display: flex;
+    flex-wrap: wrap; /*自动换行*/
+    margin-top: 10rpx;
+}
+
+.commodity_show {
+    display: flex;
+    position: relative;
+    width: 48%;
+    height: 500rpx;
+    padding: 7rpx;
+    justify-content: center;
+}
+
+.commodity_image {
+    width: 340rpx;
+    height: 340rpx;
+    border-radius: 20rpx;
+}
+
+.commodity_name {
+    position: absolute;
+    top: 360rpx;
+    left: 15rpx;
+    width: 350rpx;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+
+.price {
+    position: absolute;
+    top: 400rpx;
+    left: 12rpx;
+    color: #a08016;
+    font-weight: 600;
+}

+ 107 - 3
fore-end/pages/search/search.js

@@ -1,20 +1,122 @@
 // pages/search/search.js
+const { searchGoods } = require('../../API/appraise')
+
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-
+        historyStorage: [],//历史搜索
+        historyStorageShow: false,//清空历史记录
+        flag: true,//换一批推荐
+        inputValue: "",
+        replaceValue: "",
+        searchResult: [{title: "短裤"}, {title: "短裙"}, {title: "连衣裙"}, {title: "卫衣"}, {title: "外套"}],
+        search: false,
+        page: 1,
+        pageSize: 6,
+        searchTo: []
     },
 
+    //输入数据显示搜索推荐
+    showResult(){
+        this.setData({
+            show: true
+        })
+    },
+    getInputValue(e){
+        const {value, cursor, keyCode} = e.detail;
+        this.setData({
+            inputValue: value
+        })
+        // 边输入边请求获取数据
+        // if(this.data.inputValue != "") {
+        //     this.getSearchGoods()
+        // }
+    },
+    putInputValue(e){
+        this.setData({
+            inputValue: e.currentTarget.dataset.postname
+        })
+    },
+    //开始搜索
+    searchBegin(e){
+        let _this = this;
+        var data = e.currentTarget.dataset.searchdata;
+        console.log(data);
+        wx.setStorageSync(
+            'historyStorage',
+            _this.data.historyStorage.concat(_this.data.inputValue)   
+        )
+        this.getSearchGoods()
+        setTimeout(() => {
+            console.log(this.data.searchTo);
+            var new_search = JSON.stringify(this.data.searchTo)
+            let new_arr = encodeURIComponent(new_search)
+            wx.navigateTo({
+                url: '../../pages/com_search/com_search?comList=' + new_arr,
+            })
+        }, 100)
+    },
+    //删除搜索数据
+    deleteInput(){
+        this.setData({
+            inputValue: ""
+        })
+    },
+    //清空历史记录
+    remove(){
+        var _this = this
+        wx.showModal({
+            title: '提示',
+            content: '确认清除所有历史记录?',
+            success: function(res) {
+                if(res.confirm) {
+                    wx.removeStorageSync(
+                        'historyStorage'
+                    ),
+                    _this.setData({
+                        historyStorage: []
+                    })
+                } else {
+                    console.log("点击取消");
+                }
+            }
+          })
+    },
+    //点击搜索历史复制到input框
+    copyHistory(e) {
+        var his = e.currentTarget.dataset.history
+        this.setData({
+            inputValue: his
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-
+        //异步获取数据
+        var x =  wx.getStorageSync(
+            'historyStorage',    
+        )
+        //将之前的数据和现在得到的异步数据拼接渲染
+        this.setData({
+            historyStorage: [...this.data.historyStorage ,...x]
+        })
     },
 
+    getSearchGoods() {
+        searchGoods(this.data).then((res) => {
+            const {code, message, data} = res.data.data;
+            console.log(data);
+            this.setData({
+                searchTo: data
+            })
+        }).catch((err) => {
+            console.log(err);
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -26,7 +128,9 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow() {
-
+        if(this.data.inputValue != "") {
+            this.getSearchGoods()
+        }
     },
 
     /**

+ 2 - 1
fore-end/pages/search/search.json

@@ -2,5 +2,6 @@
     "usingComponents": {
         "van-search": "@vant/weapp/search/index",
         "avater": "/components/avatar/avatar"
-    }
+    },
+    "navigationBarTitleText": "搜索"
 }

+ 21 - 9
fore-end/pages/search/search.wxml

@@ -1,28 +1,40 @@
 <!--pages/search/search.wxml-->
 <!-- 搜素框 -->
-<view class="search_box">
+<view class="search_box" bind:tap="showResult">
     <view class="base_search">
         <van-icon name="search" size="50rpx" color="#696969" style="margin-top: 15rpx; margin-left: -430rpx;"/>
-        <input type="search" name="" placeholder="搜索..." class="search_text"/>
+        <input type="search" name="" placeholder="搜索..." bindinput="getInputValue" value="{{inputValue}}" class="search_text"/>
+        <van-icon name="cross" style="float: right; margin-top: 24rpx; margin-right: 15rpx;" bind:tap="deleteInput"/>
     </view>
     <!-- 搜索按钮 -->
-    <view class="search_button">搜索</view>
+    <view class="search_button" bind:tap="onClose" catch:tap="searchBegin" data-searchdata="{{inputValue}}">搜索</view>
 </view>
 
+<!-- 搜索结果展示 -->
+<!-- 当搜索框数据不为0才显示搜索结果 wx:if="{{inputValue != ''}}" -->
+<!-- <view class="searchResult" wx:if="{{inputValue != ''}}" hidden="{{show ? false : true}}"> -->
+    <!-- 单个结果 -->
+    <!-- <view class="preResult" wx:for="{{searchResult}}" wx:key="index" bind:tap="putInputValue" data-postname="{{item.title}}"> -->
+        <!-- <text class="textResult">{{item.title}}</text> -->
+        <!-- <van-icon name="arrow" style="float: right; margin-top: 10rpx;"/> -->
+    <!-- </view> -->
+<!-- </view> -->
 <!-- 搜索历史 -->
 <view class="history">
     <view class="history_title">搜索历史</view>
     <!-- 清空 -->
-    <view class="empty">
-        <van-icon name="delete-o" />\t
+    <view class="empty" catch:tap="remove">
+        <van-icon name="delete-o"/>\t
         <text>清空</text>
     </view>
     <!-- 历史记录展示 -->
-    <view class="history_show">
-        <view class="history_card">
-            <text space="nbsp">  iPhone手机  </text>
+    <scroll-view class="scroll" scroll-y="true">
+        <view class="history_show">
+            <view class="history_card" wx:for="{{historyStorage}}" wx:key="index" bind:tap="copyHistory" data-history="{{item}}">
+                <text space="nbsp">{{item}}</text>
+            </view>
         </view>
-    </view>
+    </scroll-view>
 </view>
 
 <!-- 猜你喜欢界面 -->

+ 27 - 1
fore-end/pages/search/search.wxss

@@ -20,6 +20,25 @@
     color: #494545;
 }
 
+/* 搜索结果展示 */
+.searchResult {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+    margin-right: -20rpx;
+    z-index: 100;
+}
+
+.preResult {
+    width: 95%;
+    height: 80rpx;
+    padding-top: 30rpx;
+    padding-left: 10rpx;
+    padding-right: 10rpx;
+    background-color: #F5F5F5;
+    border-bottom: 2px solid #eee;
+}
+
 /* 搜索历史 */
 .history {
     width: 100%;
@@ -37,6 +56,10 @@
     margin-left: 580rpx;
 }
 
+.scroll {
+    height: 150rpx;
+}
+
 .history_show {
     width: 100%;
     height: 100rpx;
@@ -44,8 +67,11 @@
 }
 
 .history_card {
+    display: inline-block;
     width: fit-content;
-    height: 65rpx;
+    margin-left: 20rpx;
+    margin-top: 4rpx;
+    padding: 0 10rpx;
     background-color: #E8E7E7;
     border-radius: 20rpx;
     line-height: 65rpx;

+ 3 - 4
fore-end/project.config.json

@@ -12,7 +12,7 @@
 		"enhance": true,
 		"showShadowRootInWxmlPanel": false,
 		"packNpmRelationList": [],
-		"ignoreUploadUnusedFiles": true,
+		"ignoreUploadUnusedFiles": false,
 		"setting": {
 			"packNpmManually": true,
 			"packNpmRelationList": [
@@ -30,11 +30,10 @@
 		"tabIndent": "tab",
 		"tabSize": 4
 	},
-	"appid": "wxc25f00d0fc026ae7",
-	"libVersion": "3.1.5",
+	"condition": {},
 	"packOptions": {
 		"ignore": [],
 		"include": []
 	},
-	"condition": {}
+	"appid": "wxc25f00d0fc026ae7"
 }

+ 3 - 3
fore-end/project.private.config.json

@@ -13,15 +13,15 @@
 			"list": [
 				{
 					"name": "",
-					"pathName": "pages/home/home",
+					"pathName": "pages/append/append",
 					"query": "",
 					"launchMode": "default",
 					"scene": null
 				},
 				{
 					"name": "",
-					"pathName": "pages/classify_detail/classify_detail",
-					"query": "classify_id=1",
+					"pathName": "pages/home/home",
+					"query": "",
 					"launchMode": "default",
 					"scene": null
 				}

+ 8 - 4
fore-end/utils/util.js

@@ -29,7 +29,7 @@ function http(url, option) {
         wx.request({
 		  url: baseURL + url,
 		  header:{
-			"Authorization": (url!=loginURL && url!=registerURL) ? wx.getStorageSync('token') : '' 
+            "Authorization": (url!=loginURL && url!=registerURL) ? wx.getStorageSync('token') : ''
 		  },
 		  ...option,
 
@@ -47,6 +47,10 @@ function http(url, option) {
           fail(err) {
             console.log(err);
             reject(err);
+          },
+          //数据加载完毕关闭loading
+          complete: () => {
+            wx.hideLoading()
           }
         })
     })
@@ -65,9 +69,9 @@ function ws(url , option) {
 		// 失败监控
 		wx.onSocketError((result) => {
 			console.log("websocket连接失败", result);
-			
+
 		})
-			
+
 	})
 }
 
@@ -113,7 +117,7 @@ function chooseImage(){
 }
 
 module.exports = {
-    formatTime,
+    formatTime: formatTime,
 	http,
 	ws,
 	upLoad,