diff --git a/app.json b/app.json index 12d12ad..221ebf0 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,7 @@ { "pages": [ "pages/index/index", + "pages/login/login", "pages/search/search", "pages/shopping/shopping", "pages/classify/classify", diff --git a/app.wxss b/app.wxss index 4531a14..3906c42 100644 --- a/app.wxss +++ b/app.wxss @@ -1,3 +1,5 @@ + + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ /* Document @@ -8,7 +10,7 @@ * 2. Prevent adjustments of font size after orientation changes in iOS. */ - html { +html { line-height: 1; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ } @@ -174,7 +176,8 @@ textarea { */ button, -input { /* 1 */ +input { + /* 1 */ overflow: visible; } @@ -184,7 +187,8 @@ input { /* 1 */ */ button, -select { /* 1 */ +select { + /* 1 */ text-transform: none; } @@ -347,7 +351,7 @@ template { [hidden] { display: none; } -image{ +image { background-size: cover; - background-image: url('http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg'); -} \ No newline at end of file + background-image: url("http://luyuan.tk/static/images/TIM%E5%9B%BE%E7%89%8720191214113605.jpg"); +} diff --git a/components/classify/navigation/index.js b/components/classify/navigation/index.js index 035c745..e427181 100644 --- a/components/classify/navigation/index.js +++ b/components/classify/navigation/index.js @@ -2,7 +2,14 @@ Component({ properties: { }, data: { + id:0 }, methods: { + select(a){ + // console.log(a.target.dataset.id) + this.setData({ + id:a.target.dataset.id + }) + } } }) \ No newline at end of file diff --git a/components/classify/navigation/index.wxml b/components/classify/navigation/index.wxml index c03b550..86574d6 100644 --- a/components/classify/navigation/index.wxml +++ b/components/classify/navigation/index.wxml @@ -1,10 +1,10 @@ - - 热门商品 - 美容健身 - 美容健身 - 美容健身 - 美容健身 - 美容健身 - 美容健身 - 美容健身 + + 热门商品 + 美容健身 + 美容健身 + 美容健身 + 美容健身 + 美容健身 + 美容健身 + 美容健身 \ No newline at end of file diff --git a/components/index/list/commodity/index.js b/components/index/list/commodity/index.js index 8423aa4..60d2ac3 100644 --- a/components/index/list/commodity/index.js +++ b/components/index/list/commodity/index.js @@ -1,5 +1,10 @@ Component({ - properties: {}, + properties: { + img:String, + title:String, + id:String, + price:String + }, data: {}, methods: { gotodetail() { diff --git a/components/index/list/commodity/index.scss b/components/index/list/commodity/index.scss index bcb00be..1eb6e9d 100644 --- a/components/index/list/commodity/index.scss +++ b/components/index/list/commodity/index.scss @@ -25,12 +25,22 @@ font-size: 26rpx; color: #333; margin-bottom: 22rpx; + overflow: hidden; + + text-overflow: ellipsis; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; } > view { display: flex; align-items: center; justify-content: space-between; > text:first-child { + font-size: 30rpx; color: #dec499; } diff --git a/components/index/list/commodity/index.wxml b/components/index/list/commodity/index.wxml index 635e5ff..0edd8bd 100644 --- a/components/index/list/commodity/index.wxml +++ b/components/index/list/commodity/index.wxml @@ -1,10 +1,10 @@ - + - 产品名称产品名称产品名称产品名称产品名称产品名称产品名称 + {{title}} - ¥657 + ¥{{price}} 加入购物车 diff --git a/components/index/list/commodity/index.wxss b/components/index/list/commodity/index.wxss index 8647b14..e358535 100644 --- a/components/index/list/commodity/index.wxss +++ b/components/index/list/commodity/index.wxss @@ -1 +1 @@ -.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e} +.commodity{width:623rpx;height:143rpx;margin-top:32rpx;display:flex;align-items:center}.commodity .content{width:614rpx;height:100%;display:flex;align-items:center;box-shadow:0 0 24rpx 0 rgba(227,227,227,0.4)}.commodity .content .imgthumb{width:105rpx;height:105rpx;margin-left:40rpx;background-color:#333}.commodity .content .introduce{width:410rpx;margin-left:40rpx;display:flex;flex-direction:column}.commodity .content .introduce>text{font-size:26rpx;color:#333;margin-bottom:22rpx;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.commodity .content .introduce>view{display:flex;align-items:center;justify-content:space-between}.commodity .content .introduce>view>text:first-child{font-size:30rpx;color:#dec499}.commodity .content .introduce>view>text:last-child{font-size:22rpx;color:#999}.commodity .decorate{width:9rpx;height:102rpx;background-color:#3fb66e} diff --git a/components/index/list/index.js b/components/index/list/index.js index 035c745..82a621a 100644 --- a/components/index/list/index.js +++ b/components/index/list/index.js @@ -1,5 +1,6 @@ Component({ properties: { + list:Array }, data: { }, diff --git a/components/index/list/index.wxml b/components/index/list/index.wxml index 7983d11..8f1ac02 100644 --- a/components/index/list/index.wxml +++ b/components/index/list/index.wxml @@ -1,4 +1,4 @@ 热门商品 - + \ No newline at end of file diff --git a/components/shopping/shoppingitem/shoppingitem.js b/components/shopping/shoppingitem/shoppingitem.js index 71165bf..4ab5506 100644 --- a/components/shopping/shoppingitem/shoppingitem.js +++ b/components/shopping/shoppingitem/shoppingitem.js @@ -14,13 +14,28 @@ Component({ * 组件的初始数据 */ data: { - + num: 5 }, /** * 组件的方法列表 */ methods: { + rm() { + if (this.data.num == 0) { + return + } else { + this.setData({ + num: this.data.num - 1 + }) + } + }, + add() { + + this.setData({ + num: this.data.num + 1 + }) + } } }) \ No newline at end of file diff --git a/components/shopping/shoppingitem/shoppingitem.wxml b/components/shopping/shoppingitem/shoppingitem.wxml index c1f4a39..a2fe59f 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxml +++ b/components/shopping/shoppingitem/shoppingitem.wxml @@ -9,8 +9,8 @@ ${{price}} - - 5 - + - + {{num}} + + diff --git a/components/shopping/shoppingitem/shoppingitem.wxss b/components/shopping/shoppingitem/shoppingitem.wxss index d30936f..34847bd 100644 --- a/components/shopping/shoppingitem/shoppingitem.wxss +++ b/components/shopping/shoppingitem/shoppingitem.wxss @@ -63,11 +63,13 @@ } .reverse { - width: 19rpx; - height: 3rpx; - background-color: #97DFB4; + width: 23rpx; + height: 23rpx; + /* background-color: #97DFB4; */ margin: 0 auto; - margin-top: 25rpx; + margin-top: 20rpx; + line-height: 23rpx; + font-size: 46rpx; } .num { @@ -79,7 +81,8 @@ .add { width: 23rpx; height: 23rpx; - background-color: #242424; + /* background-color: #242424; */ margin: 0 auto; margin-bottom: 17rpx; + line-height: 23rpx; } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 95bc36d..f9e3444 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,9 +1,20 @@ +import {request} from "../../utils/bin" Page({ data:{ - + list:[] }, onLoad(){ - + request({ + url:"Goods/hotGoodsList", + data:{ + page:0 + } + }).then((res)=>{ + console.log(res.data.result) + this.setData({ + list:res.data.result + }) + }) }, searchs(){ console.log(10) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 4e25615..bc7cb0c 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js new file mode 100644 index 0000000..b168ea5 --- /dev/null +++ b/pages/login/login.js @@ -0,0 +1,86 @@ +// pages/login/login.js +import {request} from "../../utils/bin" +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + login(a){ + console.log(a) + wx.login({ + success (res) { + if (res.code) { + //发起网络请求 + request({ + url:"User/getopenId", + data:{ + js_code:res.code + } + }).then((res)=>{ + console.log(res) + }) + } else { + console.log('登录失败!' + res.errMsg) + } + } + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/login/login.json b/pages/login/login.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/login/login.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml new file mode 100644 index 0000000..cd32bd7 --- /dev/null +++ b/pages/login/login.wxml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/pages/login/login.wxss b/pages/login/login.wxss new file mode 100644 index 0000000..4827a66 --- /dev/null +++ b/pages/login/login.wxss @@ -0,0 +1 @@ +/* pages/login/login.wxss */ \ No newline at end of file diff --git a/pages/personal/personal.js b/pages/personal/personal.js index acb09a3..b444df6 100644 --- a/pages/personal/personal.js +++ b/pages/personal/personal.js @@ -5,14 +5,17 @@ Page({ * 页面的初始数据 */ data: { - + openid:"", + username:"啦啦啦" }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { - + this.setData({ + openid:wx.getStorageSync("openid") + }) }, toorder() { wx.navigateTo({ diff --git a/pages/personal/personal.wxml b/pages/personal/personal.wxml index 4aba087..9142488 100644 --- a/pages/personal/personal.wxml +++ b/pages/personal/personal.wxml @@ -2,7 +2,7 @@ - 于于于宇于 + {{openid == ""?'点击登录':username}} 账户余额 diff --git a/pages/shopping/shopping.js b/pages/shopping/shopping.js index c51647f..6eeb4df 100644 --- a/pages/shopping/shopping.js +++ b/pages/shopping/shopping.js @@ -5,7 +5,7 @@ Page({ * 页面的初始数据 */ data: { - + list:[1,1,1] }, /** diff --git a/pages/shopping/shopping.wxml b/pages/shopping/shopping.wxml index c5706dc..ffaa067 100644 --- a/pages/shopping/shopping.wxml +++ b/pages/shopping/shopping.wxml @@ -1,5 +1,8 @@ - + + + + diff --git a/pages/shopping/shopping.wxss b/pages/shopping/shopping.wxss index aeaf59c..7379c93 100644 --- a/pages/shopping/shopping.wxss +++ b/pages/shopping/shopping.wxss @@ -1,4 +1,7 @@ - .item { +.shopping{ + padding-bottom: 128rpx; +} +.item { height: 186rpx; margin-left: 46rpx; margin-top: 59rpx; diff --git a/project.config.json b/project.config.json index bd2b7f8..e422e4a 100644 --- a/project.config.json +++ b/project.config.json @@ -4,19 +4,27 @@ "ignore": [] }, "setting": { - "urlCheck": true, + "urlCheck": false, "es6": true, "postcss": true, "minified": true, "newFeature": true, - "autoAudits": false, "coverView": true, + "autoAudits": false, "showShadowRootInWxmlPanel": true, - "scopeDataCheck": false + "scopeDataCheck": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } }, "compileType": "miniprogram", "libVersion": "2.9.4", - "appid": "wx5766b7aac7c938b3", + "appid": "wxb9033316008de1ce", "projectname": "deguodaigou", "debugOptions": { "hidedInDevtools": [] diff --git a/utils/bin.js b/utils/bin.js index 27bdf03..cc07017 100644 --- a/utils/bin.js +++ b/utils/bin.js @@ -2,15 +2,24 @@ let request = function (obj){ let { url, + data, method, header, dataType, responseType, complete } = obj + url="http://daigou.sdbairui.com/index.php/WXAPI/" + url + if(method == "POST" || method == "post"){ + if(header == undefined){ + header ={} + } + header['content-type'] = "application/x-www-form-urlencoded" + } return new Promise((res,rej)=>{ - Wx.request({ + wx.request({ url, + data, method, header, dataType,