From 23cc7c3ab99dcf7beb4f7230b4ebd64476e4c6ab Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Thu, 1 Aug 2019 18:21:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=BF=94=E5=9B=9E=E9=A6=96=E9=A1=B5][?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0]:[=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=9A=84=E6=8C=89=E9=92=AE]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 6 +++ app.json | 3 +- components/navbar/img/back.svg | 1 + components/navbar/img/home.svg | 1 + components/navbar/navbar.js | 45 +++++++++++++++++++++++ components/navbar/navbar.json | 3 ++ components/navbar/navbar.wxml | 14 +++++++ components/navbar/navbar.wxss | 55 ++++++++++++++++++++++++++++ pages/bargain/bargain.js | 2 + pages/bargain/bargain.json | 3 +- pages/bargain/bargain.wxml | 5 ++- pages/index/searchbar/index.js | 2 + pages/index/searchbar/index.json | 5 ++- pages/index/searchbar/index.wxml | 63 +++++++++++++++++--------------- pages/main/index.js | 3 ++ pages/main/index.json | 3 +- pages/main/index.wxml | 3 +- pages/user/index.js | 2 + pages/user/index.json | 4 +- pages/user/index.wxml | 4 +- 20 files changed, 187 insertions(+), 40 deletions(-) create mode 100644 components/navbar/img/back.svg create mode 100644 components/navbar/img/home.svg create mode 100644 components/navbar/navbar.js create mode 100644 components/navbar/navbar.json create mode 100644 components/navbar/navbar.wxml create mode 100644 components/navbar/navbar.wxss diff --git a/app.js b/app.js index a334726..d4cb62e 100644 --- a/app.js +++ b/app.js @@ -14,7 +14,13 @@ App({ * 用户登录 */ that.userLogin(options.scene); + wx.getSystemInfo({ + success: res => { + this.statusBarHeight = res.statusBarHeight + } + }) }, + statusBarHeight: 0, /** * 用户登录 */ diff --git a/app.json b/app.json index 26755a1..3eae759 100644 --- a/app.json +++ b/app.json @@ -111,7 +111,8 @@ "backgroundTextStyle": "dark", "navigationBarBackgroundColor": "#FFFFFF", "navigationBarTitleText": "", - "navigationBarTextStyle": "black" + "navigationBarTextStyle": "black", + "navigationStyle": "custom" }, "networkTimeout": { "request": 30000, diff --git a/components/navbar/img/back.svg b/components/navbar/img/back.svg new file mode 100644 index 0000000..614c029 --- /dev/null +++ b/components/navbar/img/back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/navbar/img/home.svg b/components/navbar/img/home.svg new file mode 100644 index 0000000..b8fe7ed --- /dev/null +++ b/components/navbar/img/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/navbar/navbar.js b/components/navbar/navbar.js new file mode 100644 index 0000000..2abdbf9 --- /dev/null +++ b/components/navbar/navbar.js @@ -0,0 +1,45 @@ +const app = getApp() + +Component({ + + properties: { + background: { + type: String, + value: '#F4F5F9' + }, + color: { + type: String, + value: '#000' + }, + text: { + type: String, + value: 'Wechat' + }, + back: { + type: Boolean, + value: false + }, + home: { + type: Boolean, + value: false + } + }, + + data: { + statusBarHeight: app.statusBarHeight + 'px', + navigationBarHeight: (app.statusBarHeight + 44) + 'px' + }, + + methods: { + backHome: function () { + wx.switchTab({ + url: '/pages/main/index', + }) + }, + back: function () { + wx.navigateBack({ + delta: 1 + }) + } + } +}) diff --git a/components/navbar/navbar.json b/components/navbar/navbar.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/navbar/navbar.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/navbar/navbar.wxml b/components/navbar/navbar.wxml new file mode 100644 index 0000000..ea5e5eb --- /dev/null +++ b/components/navbar/navbar.wxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + {{text}} + + \ No newline at end of file diff --git a/components/navbar/navbar.wxss b/components/navbar/navbar.wxss new file mode 100644 index 0000000..f37d9db --- /dev/null +++ b/components/navbar/navbar.wxss @@ -0,0 +1,55 @@ +.navbar { + width: 100vw; + background-color: #F4F5F9; + position: fixed; + z-index: 4; +} + +.title-container { + height: 44px; + display: flex; + align-items: center; + position: relative; +} + +.capsule { + margin-left: 10px; + height: 32px; + border: 2px solid #f2f2f2; + border-radius: 60px; + display: flex; + background: #fbfbfd; + align-items: center; + padding: 0 20rpx; +} + +.capsule > view { + width: 35px; + height: 60%; + position: relative; +} + +.capsule > view:nth-child(2) { + border-left: 1px solid #777; +} + +.capsule image { + width: 70%; + height: 100%; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); +} + +.title { + color: #000; + position: absolute; + left: 104px; + right: 104px; + font-size: 14px; + text-align: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} \ No newline at end of file diff --git a/pages/bargain/bargain.js b/pages/bargain/bargain.js index ec22719..7414e58 100644 --- a/pages/bargain/bargain.js +++ b/pages/bargain/bargain.js @@ -1,3 +1,4 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' var config = require("../../config/config.js"); const Http = require("../../utils/HttpBasics"); const imgurl = require("../../utils/imgurl"); @@ -6,6 +7,7 @@ Page({ * 页面的初始数据 */ data: { + navigationBarHeight, noCoupon: imgurl.noCoupon.url, orangeImg: imgurl.orange.url, blueImg: imgurl.blue.url, diff --git a/pages/bargain/bargain.json b/pages/bargain/bargain.json index 69f881e..ad27fb7 100644 --- a/pages/bargain/bargain.json +++ b/pages/bargain/bargain.json @@ -6,6 +6,7 @@ "usingComponents": { "c-banner": "../../components/spellbanner/index", "i-tab": "../../../dist/tab/index", - "i-tabs": "../../../dist/tabs/index" + "i-tabs": "../../../dist/tabs/index", + "navbar": "../../components/navbar/navbar" } } \ No newline at end of file diff --git a/pages/bargain/bargain.wxml b/pages/bargain/bargain.wxml index ce8c842..6f5708c 100644 --- a/pages/bargain/bargain.wxml +++ b/pages/bargain/bargain.wxml @@ -1,5 +1,6 @@ - - + + + - - - - - - - - {{item.title}} - + + + + + + + + + {{item.title}} + + - - - - - + + + + - - -