From 127e54895f615b6e808441a282e53222f24e7fb8 Mon Sep 17 00:00:00 2001 From: dengzeyu <2429874273@qq.com> Date: Wed, 20 Nov 2024 10:58:43 +0800 Subject: [PATCH 01/13] 123456 --- yuan ma/mp-shop/pages/buy/buy.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yuan ma/mp-shop/pages/buy/buy.js b/yuan ma/mp-shop/pages/buy/buy.js index 035ed1b..9d1a4b4 100644 --- a/yuan ma/mp-shop/pages/buy/buy.js +++ b/yuan ma/mp-shop/pages/buy/buy.js @@ -1,3 +1,8 @@ +hint: Updates were rejected because the remote contains work that you do not +hint: have locally. This is usually caused by another repository pushing to +hint: the same ref. If you want to integrate the remote changes, use +hint: 'git pull' before pushing again. +hint: See the 'Note about fast-forwards' in 'git push --help' for details. const { getBuy } = require("../../api/index.js") Page({ From 7da4a3e6532961a0d7093933542aeeef074cb6a1 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, 20 Nov 2024 11:00:31 +0800 Subject: [PATCH 02/13] 333 --- yuan ma/mp-shop/pages/buy/buy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuan ma/mp-shop/pages/buy/buy.js b/yuan ma/mp-shop/pages/buy/buy.js index 035ed1b..362fff5 100644 --- a/yuan ma/mp-shop/pages/buy/buy.js +++ b/yuan ma/mp-shop/pages/buy/buy.js @@ -1,4 +1,4 @@ -const { getBuy } = require("../../api/index.js") +const { getBuy } = require("../../api/index.js")//商品购买 Page({ data: { From 0bb767b01a5b82465329aac04e297277f9681b41 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, 20 Nov 2024 11:04:45 +0800 Subject: [PATCH 03/13] 111 --- yuan ma/mp-shop/pages/cart/cart.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yuan ma/mp-shop/pages/cart/cart.js b/yuan ma/mp-shop/pages/cart/cart.js index 42eba0a..0d63c11 100644 --- a/yuan ma/mp-shop/pages/cart/cart.js +++ b/yuan ma/mp-shop/pages/cart/cart.js @@ -1,6 +1,5 @@ const { getCart,delGoodsCart } = require("../../api/index.js") - -Page({ +//123 /** * 页面的初始数据 From 75991f356093dc3eaa6190af4d5eaa8a674128c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E8=AF=97=E9=B9=8F?= <1102686850@qq.com> Date: Wed, 20 Nov 2024 11:08:19 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuan ma/mp-shop-server/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuan ma/mp-shop-server/index.js b/yuan ma/mp-shop-server/index.js index ec02bdd..3d0278b 100644 --- a/yuan ma/mp-shop-server/index.js +++ b/yuan ma/mp-shop-server/index.js @@ -15,4 +15,4 @@ app.use("/api",router); app.listen(3001,() =>{ console.log("服务器运行在3001端口上"); -}) \ No newline at end of file +})//123 \ No newline at end of file From 9e1f9891fb1028c5916371face4653f452128cf3 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, 20 Nov 2024 11:09:18 +0800 Subject: [PATCH 05/13] 111 --- yuan ma/mp-shop/pages/cart/cart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuan ma/mp-shop/pages/cart/cart.js b/yuan ma/mp-shop/pages/cart/cart.js index 0d63c11..9b1def4 100644 --- a/yuan ma/mp-shop/pages/cart/cart.js +++ b/yuan ma/mp-shop/pages/cart/cart.js @@ -1,5 +1,5 @@ const { getCart,delGoodsCart } = require("../../api/index.js") -//123 +//111111 /** * 页面的初始数据 From 78a328ead78e6e60cae746e6f386d4440b1e4fcb Mon Sep 17 00:00:00 2001 From: dengzeyu <2429874273@qq.com> Date: Wed, 20 Nov 2024 11:12:38 +0800 Subject: [PATCH 06/13] try --- yuan ma/mp-shop/pages/user/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuan ma/mp-shop/pages/user/user.js b/yuan ma/mp-shop/pages/user/user.js index a21ecdd..404f9f6 100644 --- a/yuan ma/mp-shop/pages/user/user.js +++ b/yuan ma/mp-shop/pages/user/user.js @@ -1,5 +1,5 @@ const { getLogin } = require("../../api/index.js") - +//1231344 Page({ data: { userInfo: {}, From d3c073aeb9c90b15a488ba4ec6749ba8147d7260 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:15:19 +0800 Subject: [PATCH 07/13] first commit --- yuan ma/mp-shop/api/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuan ma/mp-shop/api/base.js b/yuan ma/mp-shop/api/base.js index 8419a49..95e7819 100644 --- a/yuan ma/mp-shop/api/base.js +++ b/yuan ma/mp-shop/api/base.js @@ -1,5 +1,5 @@ /** - * 存储接口地址 + * 定义存储接口地址 */ module.exports = { baseUrl:"http://iwenwiki.com:3001", // 公共地址 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 08/13] 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 3c1fbf22c1a9a8cacdd6aca978c7621a4062153b Mon Sep 17 00:00:00 2001 From: dengzeyu <2429874273@qq.com> Date: Wed, 4 Dec 2024 10:31:18 +0800 Subject: [PATCH 09/13] =?UTF-8?q?212206213=E9=82=93=E6=B3=BD=E7=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 +++ .idea/machine.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ yuan ma/mp-shop/components/goods-list/goods-list.js | 6 +++--- yuan ma/mp-shop/components/goods-list/goods-list.wxss | 11 +++++++---- yuan ma/mp-shop/pages/index/index.js | 4 +++- 8 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/machine.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/machine.iml b/.idea/machine.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/machine.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..36b83a7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/yuan ma/mp-shop/components/goods-list/goods-list.js b/yuan ma/mp-shop/components/goods-list/goods-list.js index 39cc5da..322def2 100644 --- a/yuan ma/mp-shop/components/goods-list/goods-list.js +++ b/yuan ma/mp-shop/components/goods-list/goods-list.js @@ -1,7 +1,7 @@ // components/goods-list/goods-list.js Component({ /** - * 组件的属性列表 + * 212206213邓泽玉组件的属性列表 */ properties: { goodsData:{ @@ -11,14 +11,14 @@ Component({ }, /** - * 组件的初始数据 + * 组件的初始数据212206213邓泽玉 */ data: { }, /** - * 组件的方法列表 + * 组件的方法列表212206213邓泽玉 */ methods: { diff --git a/yuan ma/mp-shop/components/goods-list/goods-list.wxss b/yuan ma/mp-shop/components/goods-list/goods-list.wxss index f10a949..fac587c 100644 --- a/yuan ma/mp-shop/components/goods-list/goods-list.wxss +++ b/yuan ma/mp-shop/components/goods-list/goods-list.wxss @@ -3,6 +3,9 @@ padding: 5px; box-sizing: border-box; } +/** + * 列表的样式212206213邓泽玉 +*/ .list .item { width: 48%; @@ -12,11 +15,11 @@ background: #fff; margin: 2px 1%; } - +/**列表项目的样式**/ .list .item .goods_img image { width: 100%; } - +/**货物信息名字**/ .list .item .goods_info .goods_name { font-size: 14px; text-align: left; @@ -29,7 +32,7 @@ display: -webkit-box; word-break: break-all; } - +/**货物价格**/ .list .item .goods_info .goods_price { font-style: normal; font-family: JDZH-Regular, sans-serif; @@ -38,7 +41,7 @@ line-height: 1.5rem; color: #ff4142; } - +/**新货物的信息**/ .list .item .goods_info .goods_price text{ font-size: 1rem; } \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/index/index.js b/yuan ma/mp-shop/pages/index/index.js index fd8388f..63de688 100644 --- a/yuan ma/mp-shop/pages/index/index.js +++ b/yuan ma/mp-shop/pages/index/index.js @@ -1,5 +1,7 @@ const { getBanner,getGoods } = require("../../api/index.js") - +/** +邓泽玉212206213 +**/ Page({ data: { value: "", 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 10/13] =?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,//获取记录搜索结果总数 }) } }) From f45ace8d4fecf0689ff04868dfbe6d01469fd8df 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, 4 Dec 2024 11:00:55 +0800 Subject: [PATCH 11/13] fourth commit --- yuan ma/mp-shop/pages/cart/cart.js | 21 +++++++++++++++------ yuan ma/mp-shop/pages/cart/cart.wxml | 9 ++++++++- yuan ma/mp-shop/pages/cart/cart.wxss | 7 ++++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/yuan ma/mp-shop/pages/cart/cart.js b/yuan ma/mp-shop/pages/cart/cart.js index 9b1def4..f52b193 100644 --- a/yuan ma/mp-shop/pages/cart/cart.js +++ b/yuan ma/mp-shop/pages/cart/cart.js @@ -1,5 +1,6 @@ const { getCart,delGoodsCart } = require("../../api/index.js") -//111111 + +Page({ /** * 页面的初始数据 @@ -13,8 +14,16 @@ const { getCart,delGoodsCart } = require("../../api/index.js") onShow(){ this.http() }, + + goDetail(e) { + const id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: `/pages/goodsDetails/goodsDetails?id=${id}` + }); + }, // 根源 delCartHandle(e){ + console.log("删除按钮被点击"); console.log(e.currentTarget.dataset.id); /** * 这里有两个ID @@ -25,21 +34,21 @@ const { getCart,delGoodsCart } = require("../../api/index.js") if(res.data.status === 200){ wx.showToast({ title: '删除成功', - }) + }); this.http() }else{ wx.showToast({ title: '删除失败', - }) + }); } - }) + }); }, http(){ getCart().then(res =>{ console.log(res.data.data); this.setData({ cartData:res.data.data - }) - }) + }); + }); } }) \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxml b/yuan ma/mp-shop/pages/cart/cart.wxml index 8f9ca3f..5fa94d0 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxml +++ b/yuan ma/mp-shop/pages/cart/cart.wxml @@ -1,8 +1,15 @@ - + 删除 + \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxss b/yuan ma/mp-shop/pages/cart/cart.wxss index 93e2de9..fd46999 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxss +++ b/yuan ma/mp-shop/pages/cart/cart.wxss @@ -4,10 +4,11 @@ .van-swipe-cell-right{ height: 100%; width: 60px; - background-color: #f00; + background-color: rgb(255, 7, 7); text-align: center; - color: #fff; + color: rgb(255, 255, 255); font-size: 16px; font-weight: 700; padding-top: 40px; -} \ No newline at end of file + display: block; +} From 43415cccdf489ef4c0c9e0198bdb74697c189ec0 Mon Sep 17 00:00:00 2001 From: dengzeyu <2429874273@qq.com> Date: Wed, 4 Dec 2024 11:13:41 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 --- .idea/machine.iml | 9 --------- .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 5 files changed, 32 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/machine.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 359bb53..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml diff --git a/.idea/machine.iml b/.idea/machine.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/machine.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 0548357..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 36b83a7..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From d1ae2c4c5f906588f2163b04282870894e74e83c Mon Sep 17 00:00:00 2001 From: ccl <2206612655@qq.com> Date: Wed, 4 Dec 2024 11:20:30 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuan ma/mp-shop/pages/cart/cart.js | 76 ++++++++++++++-------------- yuan ma/mp-shop/pages/cart/cart.wxml | 9 +--- yuan ma/mp-shop/pages/cart/cart.wxss | 7 ++- 3 files changed, 41 insertions(+), 51 deletions(-) diff --git a/yuan ma/mp-shop/pages/cart/cart.js b/yuan ma/mp-shop/pages/cart/cart.js index f52b193..2f20b56 100644 --- a/yuan ma/mp-shop/pages/cart/cart.js +++ b/yuan ma/mp-shop/pages/cart/cart.js @@ -1,54 +1,52 @@ -const { getCart,delGoodsCart } = require("../../api/index.js") +// 引入获取购物车和删除购物车商品的API方法 +const { getCart, delGoodsCart } = require("../../api/index.js"); +// 定义小程序页面对象 Page({ - - /** - * 页面的初始数据 - */ + // 页面数据对象,初始时cartData为空数组 data: { - cartData:[] + cartData: [] }, - /** - * 每次打开页面,都会执行 - */ - onShow(){ - this.http() + + // 页面显示时触发的方法,调用http方法获取购物车数据 + onShow() { + this.http(); }, + // 跳转到商品详情页的方法,根据传入的商品ID进行跳转 goDetail(e) { - const id = e.currentTarget.dataset.id; - wx.navigateTo({ - url: `/pages/goodsDetails/goodsDetails?id=${id}` - }); - }, - // 根源 - delCartHandle(e){ - console.log("删除按钮被点击"); - console.log(e.currentTarget.dataset.id); - /** - * 这里有两个ID - * 1. currentID:商品ID(同一个商品,加入购物车多次的时候,会一次性全删除) - * 2. id:每条数据的唯一索引(推荐)课程中选择的方式 - */ - delGoodsCart({currentID:e.currentTarget.dataset.id}).then(res =>{ - if(res.data.status === 200){ - wx.showToast({ - title: '删除成功', + const id = e.currentTarget.dataset.id; // 获取当前点击元素的数据集中的id值 + wx.navigateTo({ + url: `/pages/goodsDetails/goodsDetails?id=${id}` // 跳转到商品详情页,并传递商品ID参数 + }); + }, + + // 删除购物车商品的方法,根据传入的商品ID进行删除操作 + delCartHandle(e) { + console.log("删除按钮被点击"); // 打印日志,表示删除按钮被点击 + console.log(e.currentTarget.dataset.id); // 打印当前点击元素的数据集中的id值 + // 调用删除购物车商品的API方法,传入当前商品ID + delGoodsCart({ currentID: e.currentTarget.dataset.id }).then(res => { + if (res.data.status === 200) { // 如果API返回的状态码为200,表示删除成功 + wx.showToast({ // 显示成功提示框 + title: '删除成功', }); - this.http() - }else{ - wx.showToast({ + this.http(); // 刷新购物车数据 + } else { // 如果API返回的状态码不是200,表示删除失败 + wx.showToast({ // 显示失败提示框 title: '删除失败', - }); + }); } }); }, - http(){ - getCart().then(res =>{ - console.log(res.data.data); - this.setData({ - cartData:res.data.data + + // 获取购物车数据的方法 + http() { + getCart().then(res => { // 调用获取购物车数据的API方法 + console.log(res.data.data); // 打印API返回的购物车数据 + this.setData({ // 更新页面数据对象中的cartData属性 + cartData: res.data.data }); }); } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxml b/yuan ma/mp-shop/pages/cart/cart.wxml index 5fa94d0..8f9ca3f 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxml +++ b/yuan ma/mp-shop/pages/cart/cart.wxml @@ -1,15 +1,8 @@ - + 删除 - \ No newline at end of file diff --git a/yuan ma/mp-shop/pages/cart/cart.wxss b/yuan ma/mp-shop/pages/cart/cart.wxss index fd46999..93e2de9 100644 --- a/yuan ma/mp-shop/pages/cart/cart.wxss +++ b/yuan ma/mp-shop/pages/cart/cart.wxss @@ -4,11 +4,10 @@ .van-swipe-cell-right{ height: 100%; width: 60px; - background-color: rgb(255, 7, 7); + background-color: #f00; text-align: center; - color: rgb(255, 255, 255); + color: #fff; font-size: 16px; font-weight: 700; padding-top: 40px; - display: block; -} +} \ No newline at end of file