diff --git a/app.js b/app.js index 437495d..37e9ea3 100644 --- a/app.js +++ b/app.js @@ -1,9 +1,11 @@ // app.js + App({ globalData: { id: 0 }, onLaunch() { + // 展示本地存储能力 /* const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) diff --git a/app.wxss b/app.wxss index bd2fa30..ce8378b 100644 --- a/app.wxss +++ b/app.wxss @@ -10,3 +10,6 @@ + + + diff --git a/assets/imgs/back@3x.png b/assets/imgs/back@3x.png new file mode 100644 index 0000000..c2b300d Binary files /dev/null and b/assets/imgs/back@3x.png differ diff --git a/assets/imgs/home_icon@3x.png b/assets/imgs/home_icon@3x.png new file mode 100644 index 0000000..bd83bfd Binary files /dev/null and b/assets/imgs/home_icon@3x.png differ diff --git a/assets/imgs/nav_logo@3x.png b/assets/imgs/nav_logo@3x.png new file mode 100644 index 0000000..ae49679 Binary files /dev/null and b/assets/imgs/nav_logo@3x.png differ diff --git a/components/navigationBar/index.js b/components/navigationBar/index.js new file mode 100644 index 0000000..987d7e7 --- /dev/null +++ b/components/navigationBar/index.js @@ -0,0 +1,103 @@ +// pages/navBar/navBar.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + background: { + type: String, + value: 'rgba(255, 255, 255, 1)' + }, + color: { + type: String, + value: 'rgba(0, 0, 0, 1)' + }, + titleText: { + type: String, + value: '导航栏' + }, + titleImg: { + type: String, + value: '' + }, + backIcon: { + type: String, + value: '' + }, + homeIcon: { + type: String, + value: '' + }, + fontSize: { + type: Number, + value: 18 + }, + iconHeight: { + type: Number, + value: 19 + }, + iconWidth: { + type:Number, + value: 58 + } + }, + attached: function(){ + var that = this; + that.setNavSize(); + that.setStyle(); + }, + data: { + + }, + methods: { + // 通过获取系统信息计算导航栏高度 + setNavSize: function() { + var that = this + , sysinfo = wx.getSystemInfoSync() + , statusHeight = sysinfo.statusBarHeight + , isiOS = sysinfo.system.indexOf('iOS') > -1 + , navHeight; + if (!isiOS) { + navHeight = 48; + } else { + navHeight = 44; + } + that.setData({ + status: statusHeight, + navHeight: navHeight + }) + }, + setStyle: function() { + var that = this + , containerStyle + , textStyle + , iconStyle; + containerStyle = [ + 'background:' + that.data.background + ].join(';'); + textStyle = [ + 'color:' + that.data.color, + 'font-size:' + that.data.fontSize + 'px' + ].join(';'); + iconStyle = [ + 'width: ' + that.data.iconWidth + 'px', + 'height: ' + that.data.iconHeight + 'px' + ].join(';'); + that.setData({ + containerStyle: containerStyle, + textStyle: textStyle, + iconStyle: iconStyle + }) + }, + // 返回事件 + back: function(){ + wx.navigateBack({ + delta: 1 + }) + this.triggerEvent('back', {back: 1}) + }, + home: function() { + this.triggerEvent('home', {}); + } + } +}) diff --git a/components/navigationBar/index.json b/components/navigationBar/index.json new file mode 100644 index 0000000..7e37c03 --- /dev/null +++ b/components/navigationBar/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/navigationBar/index.wxml b/components/navigationBar/index.wxml new file mode 100644 index 0000000..3517bf8 --- /dev/null +++ b/components/navigationBar/index.wxml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + {{titleText}} + + + \ No newline at end of file diff --git a/components/navigationBar/index.wxss b/components/navigationBar/index.wxss new file mode 100644 index 0000000..354c242 --- /dev/null +++ b/components/navigationBar/index.wxss @@ -0,0 +1,34 @@ +.navbar{ + position: relative +} +.back-icon, .home-icon{ + width: 28px; + height: 100%; + position: absolute; + transform: translateY(-50%); + top: 50%; + display: flex; +} +.back-icon{ + left: 16px; +} +.home-icon{ + left: 44px +} +.back-icon image{ + width: 28px; + height: 28px; + margin: auto; +} +.home-icon image{ + width: 20px; + height: 20px; + margin: auto; +} +.nav-title, .nav-icon{ + position: absolute; + transform: translate(-50%, -50%); + left: 50%; + top: 50%; + font-weight: bold; +} \ No newline at end of file diff --git a/pages/contactUs/contactUs.js b/pages/contactUs/contactUs.js index e8d1acf..c84a8bb 100644 --- a/pages/contactUs/contactUs.js +++ b/pages/contactUs/contactUs.js @@ -142,5 +142,13 @@ Page({ */ onShareAppMessage() { + }, + // 下拉 + onPageScroll: function(e) { + if (e.scrollTop < 0) { + wx.pageScrollTo({ + scrollTop: 0 + }) } + } }) \ No newline at end of file diff --git a/pages/contactUs/contactUs.json b/pages/contactUs/contactUs.json index e95d266..090a414 100644 --- a/pages/contactUs/contactUs.json +++ b/pages/contactUs/contactUs.json @@ -1,8 +1,9 @@ { "navigationBarTitleText": "联系我们", "usingComponents": { - "van-icon": "@vant/weapp/icon/index" - - } + "van-icon": "@vant/weapp/icon/index", + "navBar": "/components/navigationBar/index" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/contactUs/contactUs.wxml b/pages/contactUs/contactUs.wxml index 7183f7b..383d729 100644 --- a/pages/contactUs/contactUs.wxml +++ b/pages/contactUs/contactUs.wxml @@ -1,18 +1,21 @@ - + - - - 公司地址:{{address}} + + + {{phone}} 公司电话:{{tel}} - - - {{phone}} + + + 公司地址:{{address}} + + diff --git a/pages/details/details.js b/pages/details/details.js index b284489..1787791 100644 --- a/pages/details/details.js +++ b/pages/details/details.js @@ -173,5 +173,13 @@ Page({ */ onShareAppMessage: function () { + }, + // 下拉 + onPageScroll: function(e) { + if (e.scrollTop < 0) { + wx.pageScrollTo({ + scrollTop: 0 + }) } + } }) \ No newline at end of file diff --git a/pages/details/details.json b/pages/details/details.json index a246e55..dd31de3 100644 --- a/pages/details/details.json +++ b/pages/details/details.json @@ -4,8 +4,10 @@ "van-row": "@vant/weapp/row/index", "van-col": "@vant/weapp/col/index", "van-icon": "@vant/weapp/icon/index", - "van-share-sheet": "@vant/weapp/share-sheet/index" + "van-share-sheet": "@vant/weapp/share-sheet/index", + "navBar": "/components/navigationBar/index" }, - "navigationBarTitleText": "详情页" + "navigationBarTitleText": "详情页", + "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/details/details.wxml b/pages/details/details.wxml index d798a2f..34a912b 100644 --- a/pages/details/details.wxml +++ b/pages/details/details.wxml @@ -1,5 +1,8 @@ + diff --git a/pages/setDisplay/setDisplay.js b/pages/setDisplay/setDisplay.js index 5c68b01..85550bc 100644 --- a/pages/setDisplay/setDisplay.js +++ b/pages/setDisplay/setDisplay.js @@ -171,5 +171,13 @@ onChange(event) { */ onShareAppMessage() { + }, + // 下拉 + onPageScroll: function(e) { + if (e.scrollTop < 0) { + wx.pageScrollTo({ + scrollTop: 0 + }) } + } }) \ No newline at end of file diff --git a/pages/setDisplay/setDisplay.json b/pages/setDisplay/setDisplay.json index 89c4a51..22358a0 100644 --- a/pages/setDisplay/setDisplay.json +++ b/pages/setDisplay/setDisplay.json @@ -4,8 +4,10 @@ "van-sidebar": "@vant/weapp/sidebar/index", "van-sidebar-item": "@vant/weapp/sidebar-item/index", "van-notify": "@vant/weapp/notify/index", - "van-divider": "@vant/weapp/divider/index" + "van-divider": "@vant/weapp/divider/index", + "navBar": "/components/navigationBar/index" }, "enablePullDownRefresh": true, - "onReachBottomDistance":100 + "onReachBottomDistance":100, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/pages/setDisplay/setDisplay.wxml b/pages/setDisplay/setDisplay.wxml index 51ead6a..e544982 100644 --- a/pages/setDisplay/setDisplay.wxml +++ b/pages/setDisplay/setDisplay.wxml @@ -1,4 +1,8 @@ + + @@ -17,5 +21,4 @@ - - \ No newline at end of file + diff --git a/pages/setDisplay/setDisplay.wxss b/pages/setDisplay/setDisplay.wxss index 0d5c2c7..08b1dd6 100644 --- a/pages/setDisplay/setDisplay.wxss +++ b/pages/setDisplay/setDisplay.wxss @@ -8,6 +8,7 @@ width: 203rpx !important; min-height: 100vh; border-right: 1px solid #f6f6f6; + padding-top: 75rpx; } .left_side .van-sidebar-item__text { width: 203rpx !important; @@ -27,15 +28,20 @@ .left_side .van-sidebar-item__text { height: 47rpx; width: 100%; - font-size: 36rpx; + font-size: 34rpx; color: #666; } .left_side .van-sidebar-item { width: 203rpx; } +.left_side .van-sidebar-item--selected { + /* border-left: 6rpx solid #000; */ + /* color: #000; */ + background: #000; +} .left_side .van-sidebar-item--selected .van-sidebar-item__text { - border-left: 6rpx solid #000; - color: #000; + color: #fff; + font-size: 38rpx; } .right_con { @@ -48,4 +54,6 @@ height: 290rpx; border-radius: 10rpx; margin: 0 auto; -} \ No newline at end of file +} + +