From 3166463ac4c69694cbc0b8f1e9ab808326a54afa Mon Sep 17 00:00:00 2001 From: pplokijuhyg <1162963624@qq.com> Date: Wed, 18 Dec 2019 18:10:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + app.wxss | 26 +++++-- components/index/list/commodity/index.js | 7 +- components/index/list/commodity/index.wxml | 6 +- components/index/list/index.js | 1 + components/index/list/index.wxml | 2 +- pages/index/index.js | 15 +++- pages/index/index.wxml | 2 +- pages/login/login.js | 86 ++++++++++++++++++++++ pages/login/login.json | 3 + pages/login/login.wxml | 3 + pages/login/login.wxss | 1 + pages/personal/personal.js | 7 +- pages/personal/personal.wxml | 2 +- project.config.json | 14 +++- utils/bin.js | 11 ++- 16 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 pages/login/login.js create mode 100644 pages/login/login.json create mode 100644 pages/login/login.wxml create mode 100644 pages/login/login.wxss diff --git a/app.json b/app.json index 12d12ad..0c0db63 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/login/login", "pages/index/index", "pages/search/search", "pages/shopping/shopping", diff --git a/app.wxss b/app.wxss index 4531a14..aaec663 100644 --- a/app.wxss +++ b/app.wxss @@ -1,3 +1,15 @@ +.towline { + overflow: hidden; + + text-overflow: ellipsis; + + display: -webkit-box; + + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; +} + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ /* Document @@ -8,7 +20,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 +186,8 @@ textarea { */ button, -input { /* 1 */ +input { + /* 1 */ overflow: visible; } @@ -184,7 +197,8 @@ input { /* 1 */ */ button, -select { /* 1 */ +select { + /* 1 */ text-transform: none; } @@ -347,7 +361,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/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.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/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/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/project.config.json b/project.config.json index 01cad11..e422e4a 100644 --- a/project.config.json +++ b/project.config.json @@ -4,15 +4,23 @@ "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", 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,