From 7f13e1c48dbb619b532ee6536f3bbc4e99eedb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BA=9A?= <14945720+ligengrose@user.noreply.gitee.com> Date: Wed, 20 Nov 2024 11:19:31 +0800 Subject: [PATCH 1/2] second commit --- yuan ma/mp-shop-server/database/mpshop.sql | 1 + yuan ma/mp-shop/app.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/yuan ma/mp-shop-server/database/mpshop.sql b/yuan ma/mp-shop-server/database/mpshop.sql index f7bbfad..a71ef5b 100644 --- a/yuan ma/mp-shop-server/database/mpshop.sql +++ b/yuan ma/mp-shop-server/database/mpshop.sql @@ -20,6 +20,7 @@ SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for banner -- ---------------------------- +--菜单栏定义实现不同功能-- DROP TABLE IF EXISTS `banner`; CREATE TABLE `banner` ( `id` int(11) NOT NULL AUTO_INCREMENT, diff --git a/yuan ma/mp-shop/app.js b/yuan ma/mp-shop/app.js index 12f79f0..c526aa4 100644 --- a/yuan ma/mp-shop/app.js +++ b/yuan ma/mp-shop/app.js @@ -1,12 +1,12 @@ // app.js App({ onLaunch() { - // 展示本地存储能力 6 + // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) - // 登录 + // 定义登录 wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId From b93050f966394308ddb490c7e9b7ecf4daf9c8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=86=9B=E4=BB=81?= <3115324624@qq.com> Date: Wed, 4 Dec 2024 10:35:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuan ma/mp-shop/pages/search/search.js | 40 +++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/yuan ma/mp-shop/pages/search/search.js b/yuan ma/mp-shop/pages/search/search.js index 5fca295..9f040fd 100644 --- a/yuan ma/mp-shop/pages/search/search.js +++ b/yuan ma/mp-shop/pages/search/search.js @@ -2,7 +2,7 @@ const { getHotSearch,getSearch } = require("../../api/index.js") Page({ /** - * 页面的初始数据 + * 页面的初始数据1 */ data: { search:"", @@ -11,52 +11,52 @@ Page({ goodsData:[] }, /** - * 生命周期函数--监听页面加载 + * 生命周期函数--监听页面加载2 */ onLoad(options) { - getHotSearch().then(res =>{ + getHotSearch().then(res =>{//获取热点搜索函数 this.setData({ - hotSearch:res.data.data.result + hotSearch:res.data.data.result//搜索数据结果 }) }) }, - // 内容改变 - onChange(e){ + // 内容改变3 + onChange(e){//内容展示函数 this.setData({ - value:e.detail + value:e.detail//获取值 }) }, /** - * 展示搜索数据,在goods页面展示 - * 1. 在搜索页面通过网络请求获取数据,传递到goods页面显示 - * 2. 在搜索页面将搜索的关键字传递到goods页面,在goods页面做网络请求 + * 展示搜索数据,在goods页面展示4 + * 1. 在搜索页面通过网络请求获取数据,传递到goods页面显示5 + * 2. 在搜索页面将搜索的关键字传递到goods页面,在goods页面做网络请求6 */ - // 实现搜索 - onSearch(){ - this.http(this.data.value) + // 实现搜索7 + onSearch(){//搜索函数 + this.http(this.data.value)//10 }, - onSearchCliclk(){ - this.http(this.data.value) + onSearchCliclk(){//搜索点击函数 + this.http(this.data.value)//11 }, /** - * 获取热门关键字 + * 获取热门关键字8 */ clickGetKeyWords(e){ - this.http(e.currentTarget.dataset.hotkey) + this.http(e.currentTarget.dataset.hotkey)//使用this }, http(search){ getSearch({search}).then(res =>{ if(!res.data.msg){ - // 序列化 + // 序列化9 let goods = JSON.stringify(res.data.data) wx.navigateTo({ - url: '/pages/goods/goods?goodsData=' + goods, + url: '/pages/goods/goods?goodsData=' + goods,//给出跳转网址 }) }else{ wx.showToast({ - title: res.data.msg, + title: res.data.msg,//获取记录搜索结果总数 }) } })