diff --git a/nsgk_entry/app.json b/nsgk_entry/app.json index efde37c..e58135a 100644 --- a/nsgk_entry/app.json +++ b/nsgk_entry/app.json @@ -1,7 +1,7 @@ { "pages": [ - "pages/show/show", "pages/index/index", + "pages/show/show", "pages/wxAuth/wxAuth", "pages/logs/logs", "component/scrollTab/scrollTab" diff --git a/nsgk_entry/pages/index/index.js b/nsgk_entry/pages/index/index.js index 7393672..b061651 100644 --- a/nsgk_entry/pages/index/index.js +++ b/nsgk_entry/pages/index/index.js @@ -1,14 +1,315 @@ -// index.js -// 获取应用实例 -import * as UTIL from '../../utils/util.js' -const app = getApp() - +import * as UTIL from '../../utils/util.js'; +import * as API from '../../utils/API.js'; Page({ + + /** + * 页面的初始数据 + */ + data: { + //底部自定义tabbar + isSHowZDYTabBar: true, + //底部弹框显示 + showDownTS: true, + //顶部胶囊按钮位置信息rect + CustomMenuButton: null, + BarMarginLeft: 0, + BarWidth: 0, + + list: [], + isIPhoneX:false + }, + /** + * 计算bar 高度 + */ + computeBarLocation() { + var that = this; + let CustomMenuButton = wx.getMenuButtonBoundingClientRect(); + let CustomMenuButton_margin_right = wx.getSystemInfoSync().windowWidth - CustomMenuButton.right; + let bar_margin_left = CustomMenuButton_margin_right + CustomMenuButton.width; + let bar_width = wx.getSystemInfoSync().windowWidth - CustomMenuButton_margin_right * 2 - CustomMenuButton.width * 2; + console.log("bar宽:" + bar_width + ";窗口宽度" + wx.getSystemInfoSync().windowWidth); + that.setData({ + CustomMenuButton: CustomMenuButton, + BarMarginLeft: bar_margin_left, + BarWidth: bar_width + }); + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let that = this; + + that.simulativeData(); + that.computeBarLocation(); + that.setData({ + isIPhoneX:UTIL.isIPhoneX() + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () {}, + + onItemClickMethod: function (e) { + var that = this; + var num = parseInt(e.currentTarget.id); + console.log(num) + switch (num) { + case 0: + //更新机制 + break; + case 1: + //网络访问 + that.httpTestMethod(); + break; + case 4: + //获取地理位置 + that.getLocationInfo(); + break; + case 5: + //全局loading + that.showLoadingIcon(); + break; + case 6: + that.showModalConentMethod(); + break; + case 7: + that.showModalAllMethod(); + break; + case 8: + that.showMoRenTab(); + break; + case 9: + that.showZDYTab(); + break; + } }, - onLoad() { + /** + * 默认tab + */ + showMoRenTab() { + console.log('11111') wx.showTabBar({ animation: false, }) + this.setData({ + isSHowZDYTabBar: true + }) + } + , + /** + * 自定义tab + */ + showZDYTab() { + wx.hideTabBar({ + animation: false, + }) + this.setData({ + isSHowZDYTabBar: false + }) + + + } + , + /** + * 获取地理位置 + */ + getLocationInfo() { + UTIL.getLocationFromWX( + { + success: (res) => { + UTIL.showToastNoneIcon("当前经纬度:" + getApp().globalData.setInfo.latitude + "," + getApp().globalData.setInfo.longitude) + + } + , + fail: (res) => { + wx.navigateTo({ + url: '/pages/wxAuth/wxAuth', + }) + + } + } + ); + + } + + , + /** + * loading小图标 + */ + showLoadingIcon() { + + UTIL.showLoadingHaveMask('数据加载中...'); + setTimeout(function () { + UTIL.hideLoadingHaveMask(); + }, 2000) + + } + , + /** + * 显示提示框 + */ + showModalConentMethod() { + UTIL.showModalNoneCancel('温馨提示', '这是一个按钮的弹框', '知道了'); + + }, + /** + * 显示完整提示框 并监听 + */ + showModalAllMethod() { + UTIL.showModalOnClick('提示', '两个按钮并回调', 'OK', 'NO', + { + confirm() { + UTIL.showToastNoneIcon('点击了OK'); + + } + , + cancel() { + UTIL.showToastNoneIcon('点击了NO'); + + } + + }); + } + , + //底部弹框允许 + okOnClick(e) { + console.log("底部弹框-允许"); + UTIL.showToastNoneIcon("底部弹框-允许"); + this.setData({ + showDownTS: true + }) + }, -}) + /** + * 底部弹框-黑色背景点击 + */ + blackOnClick() { + this.setData({ + showDownTS: true + }) + } + , + /** + * 底部弹框拒绝 + */ + refuseOnClick() { + console.log("底部弹框-拒绝"); + UTIL.showToastNoneIcon("底部弹框-拒绝"); + this.setData({ + showDownTS: true + }) + }, + bindgetUserProfile(e) { + UTIL.getUserInfoFomWX({ + success(res){ + UTIL.showToastNoneIcon("获取到昵称:"+getApp().globalData.wxUserInfo.nickName); + } + }); + } + , + /** + * 网络访问 + */ + httpTestMethod() { + let sendData = { + centerShopId: 10000, + centerWarehouseId: 10051, + channel: 220, + channelType: 22, + memberId: 24892, + rows: 40, + shopId: 10005, + token: "LWXAPP1636599316684iv6qkhyqhr4izg", + v: 3, + warehouseId: 10005 + } + UTIL.httpRequest(API.URL_ZB_RECOMMEND_LIST, sendData, + { + success: (res) => { + if (res._code == API.SUCCESS_CODE) { + UTIL.showToastNoneIcon("数据共:" + res._data.length + "条"); + } else { + UTIL.showToastNoneIcon(res._msg) + } + }, + fail: (res) => { + UTIL.showToastNoneIcon(API.MSG_FAIL_HTTP) + }, + complete: (res) => { + } + }); + } + , + + /** + * 模拟数据 + */ + simulativeData() { + let list = [ + { + title: '更新机制(已嵌入)', + },{ + title: '网络访问(点击获取)' + },{ + title: '自动申请微信地理授权(已嵌入)' + },{ + title: '获取微信OPenId(已嵌入)' + },{ + title: '获取微信地理位置(点击获取)', + tapBtn: 'getLocationInfo' + },{ + title: 'loading小图标', + tapBtn: 'showLoadingIcon' + },{ + title: 'Modal弹框仅提示', + tapBtn: 'showModalConentMethod', + },{ + title: 'Modal两个按钮并监听', + tapBtn: 'showModalAllMethod' + },{ + title: '底部导航效果(默认)', + tapBtn: 'showMoRenTab' + },{ + title: '底部导航效果(自定义)', + tapBtn: 'showZDYTab' + } + ]; + this.setData({ + list: list, + }) + } +}) \ No newline at end of file diff --git a/nsgk_entry/pages/index/index.json b/nsgk_entry/pages/index/index.json index 2406b4f..420eb26 100644 --- a/nsgk_entry/pages/index/index.json +++ b/nsgk_entry/pages/index/index.json @@ -1,6 +1,7 @@ { -"navigationBarTitleText": "String", "usingComponents": { - } - + "component-tabbar": "/component/tabbar/tabbar", + "icon-loading":"/component/iconLoading/iconLoading" + }, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/nsgk_entry/pages/index/index.wxml b/nsgk_entry/pages/index/index.wxml index a1e8699..6d010d0 100644 --- a/nsgk_entry/pages/index/index.wxml +++ b/nsgk_entry/pages/index/index.wxml @@ -1,3 +1,20 @@ - -1 - \ No newline at end of file + + + + 悦团购 + + + +设备是否有刘海屏:{{isIPhoneX}} + + + + + {{item.title}} + + + + + + + \ No newline at end of file diff --git a/nsgk_entry/pages/index/index.wxss b/nsgk_entry/pages/index/index.wxss index 5f2ba7c..9d46128 100644 --- a/nsgk_entry/pages/index/index.wxss +++ b/nsgk_entry/pages/index/index.wxss @@ -1,5 +1,196 @@ -.waterFallFlow + +@import '/template/bottomUserSQ/bottomUserSQ.wxss'; +.scroll_page { - background-color: burlywood; + height: 100vh; + +} +.page_content +{ + width: 100%; + height: auto; + display: block; + +} +.list-item +{ + height: 35px; + +} +.list-item-tv +{ + width: 80%; + height: 100%; + margin-left: 10%; + + + +} +/* .black_bj +{ + position:absolute; + bottom: 0rpx; + left: 0rpx; + width: 100vw; + height: 100vh; + +} +.dialog_sq +{ + position:absolute; + bottom: 0rpx; + left: 0rpx; + background: white; + width: 100%; + height: 500rpx; +} */ + +/**index.wxss**/ +.container +{ + width: 100vw; + +} +.title +{ + color: black; + text-align: center; + width: auto; +} +.address_top_transverse +{ + display: flex; + height: 64rpx; + background-color: white; + padding-bottom: 16rpx; + + + +} +.address_top_transverse .address_tap +{ + width: auto; + display: flex; + align-items: center; + + +} + .address_top_transverse .address_tap image +{ + width: 48rpx; + height: 48rpx; + margin-right: 16rpx; + margin-left: 16rpx; + +} +.address_top_transverse .address_tap .choice_address +{ + margin-right: 16rpx; -} \ No newline at end of file +} +.address_top_transverse .address_tap .change_view +{ + font-size: 26rpx; + width: 80rpx; + +} + +.address_top_transverse .search_container +{ + display: flex; + width: auto; + height: 100%; + + align-items: center; + border-radius: 32rpx; + min-width: 130rpx; + margin-right: 16rpx; + flex: 1; + +} +.address_top_transverse .search_container .search_img +{ + width: 34rpx; + height: 34rpx; + margin-left: 16rpx; +} +.address_top_transverse .search_container .input_search +{ + + color: #94969c; + min-width: 160rpx; + height: 64rpx; + font-size: 24rpx; + line-height: 64rpx; + padding-left: 30rpx; +} +.tab_container +{ + width: 100%; + height: 72rpx; + position: relative; + + +} + +.tab_container .right_icon_view +{ + position: absolute; + right: 0rpx; + top: 0rpx; + width: 10vw; + height: 72rpx; + line-height: 72rpx; + text-align: center; +} +.banner_container +{ + position: relative; +} +.banner_container .banner_item +{ + width: 100%; + height: 100%; + margin-top: 16rpx; +} +.banner_img_sc{ + margin-left: 2.5%; + border-radius: 16rpx; + width: 95%; + background: url(https://shgm.jjyyx.com/m/images/banner_w_bg.png) no-repeat center; + +} + +.banner_container .banner_toast +{ + position: absolute; + bottom: -17rpx; + left: 5%; + + width: 340rpx; + height: 50rpx; + z-index: 10; +} +.type_swiper +{ + margin-top: 16rpx; + display: block; +} +.todayAndHot +{ + margin-top:16rpx; + display: block; + +} +.secon_kill +{ + margin-top: 16rpx; + display: block; +} +.preSale_collage +{ + margin-top: 16rpx; + display: block; +} + + diff --git a/nsgk_entry/pages/show/show.js b/nsgk_entry/pages/show/show.js index 7b6a100..7393672 100644 --- a/nsgk_entry/pages/show/show.js +++ b/nsgk_entry/pages/show/show.js @@ -1,293 +1,14 @@ -import * as UTIL from '../../utils/util.js'; -import * as API from '../../utils/API.js'; -Page({ - - /** - * 页面的初始数据 - */ +// index.js +// 获取应用实例 +import * as UTIL from '../../utils/util.js' +const app = getApp() +Page({ data: { - //底部自定义tabbar - isSHowZDYTabBar: true, - //底部弹框显示 - showDownTS: true, - - list: [], - isIPhoneX:false - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - let that = this; - that.simulativeData(); - that.setData({ - isIPhoneX:UTIL.isIPhoneX() - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () {}, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () {}, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () {}, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () {}, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () {}, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () {}, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () {}, - - onItemClickMethod: function (e) { - var that = this; - var num = parseInt(e.currentTarget.id); - console.log(num) - switch (num) { - case 0: - //更新机制 - break; - case 1: - //网络访问 - that.httpTestMethod(); - break; - case 4: - //获取地理位置 - that.getLocationInfo(); - break; - case 5: - //全局loading - that.showLoadingIcon(); - break; - case 6: - that.showModalConentMethod(); - break; - case 7: - that.showModalAllMethod(); - break; - case 8: - that.showMoRenTab(); - break; - case 9: - that.showZDYTab(); - break; - } }, - /** - * 默认tab - */ - showMoRenTab() { - console.log('11111') + onLoad() { wx.showTabBar({ animation: false, }) - this.setData({ - isSHowZDYTabBar: true - }) - } - , - /** - * 自定义tab - */ - showZDYTab() { - wx.hideTabBar({ - animation: false, - }) - this.setData({ - isSHowZDYTabBar: false - }) - - - } - , - /** - * 获取地理位置 - */ - getLocationInfo() { - UTIL.getLocationFromWX( - { - success: (res) => { - UTIL.showToastNoneIcon("当前经纬度:" + getApp().globalData.setInfo.latitude + "," + getApp().globalData.setInfo.longitude) - - } - , - fail: (res) => { - wx.navigateTo({ - url: '/pages/wxAuth/wxAuth', - }) - - } - } - ); - - } - - , - /** - * loading小图标 - */ - showLoadingIcon() { - - UTIL.showLoadingHaveMask('数据加载中...'); - setTimeout(function () { - UTIL.hideLoadingHaveMask(); - }, 2000) - - } - , - /** - * 显示提示框 - */ - showModalConentMethod() { - UTIL.showModalNoneCancel('温馨提示', '这是一个按钮的弹框', '知道了'); - }, - /** - * 显示完整提示框 并监听 - */ - showModalAllMethod() { - UTIL.showModalOnClick('提示', '两个按钮并回调', 'OK', 'NO', - { - confirm() { - UTIL.showToastNoneIcon('点击了OK'); - - } - , - cancel() { - UTIL.showToastNoneIcon('点击了NO'); - - } - - }); - } - , - //底部弹框允许 - okOnClick(e) { - console.log("底部弹框-允许"); - UTIL.showToastNoneIcon("底部弹框-允许"); - this.setData({ - showDownTS: true - }) - - }, - /** - * 底部弹框-黑色背景点击 - */ - blackOnClick() { - this.setData({ - showDownTS: true - }) - } - , - /** - * 底部弹框拒绝 - */ - refuseOnClick() { - console.log("底部弹框-拒绝"); - UTIL.showToastNoneIcon("底部弹框-拒绝"); - this.setData({ - showDownTS: true - }) - }, - bindgetUserProfile(e) { - UTIL.getUserInfoFomWX({ - success(res){ - UTIL.showToastNoneIcon("获取到昵称:"+getApp().globalData.wxUserInfo.nickName); - } - }); - } - , - /** - * 网络访问 - */ - httpTestMethod() { - let sendData = { - centerShopId: 10000, - centerWarehouseId: 10051, - channel: 220, - channelType: 22, - memberId: 24892, - rows: 40, - shopId: 10005, - token: "LWXAPP1636599316684iv6qkhyqhr4izg", - v: 3, - warehouseId: 10005 - } - UTIL.httpRequest(API.URL_ZB_RECOMMEND_LIST, sendData, - { - success: (res) => { - if (res._code == API.SUCCESS_CODE) { - UTIL.showToastNoneIcon("数据共:" + res._data.length + "条"); - } else { - UTIL.showToastNoneIcon(res._msg) - } - }, - fail: (res) => { - UTIL.showToastNoneIcon(API.MSG_FAIL_HTTP) - }, - complete: (res) => { - } - }); - } - , - - /** - * 模拟数据 - */ - simulativeData() { - let list = [ - { - title: '更新机制(已嵌入)', - },{ - title: '网络访问(点击获取)' - },{ - title: '自动申请微信地理授权(已嵌入)' - },{ - title: '获取微信OPenId(已嵌入)' - },{ - title: '获取微信地理位置(点击获取)', - tapBtn: 'getLocationInfo' - },{ - title: 'loading小图标', - tapBtn: 'showLoadingIcon' - },{ - title: 'Modal弹框仅提示', - tapBtn: 'showModalConentMethod', - },{ - title: 'Modal两个按钮并监听', - tapBtn: 'showModalAllMethod' - },{ - title: '底部导航效果(默认)', - tapBtn: 'showMoRenTab' - },{ - title: '底部导航效果(自定义)', - tapBtn: 'showZDYTab' - } - ]; - this.setData({ - list: list, - }) - } -}) \ No newline at end of file +}) diff --git a/nsgk_entry/pages/show/show.json b/nsgk_entry/pages/show/show.json index 420eb26..2406b4f 100644 --- a/nsgk_entry/pages/show/show.json +++ b/nsgk_entry/pages/show/show.json @@ -1,7 +1,6 @@ { +"navigationBarTitleText": "String", "usingComponents": { - "component-tabbar": "/component/tabbar/tabbar", - "icon-loading":"/component/iconLoading/iconLoading" - }, - "navigationStyle": "custom" + } + } \ No newline at end of file diff --git a/nsgk_entry/pages/show/show.wxml b/nsgk_entry/pages/show/show.wxml index 6d010d0..a1e8699 100644 --- a/nsgk_entry/pages/show/show.wxml +++ b/nsgk_entry/pages/show/show.wxml @@ -1,20 +1,3 @@ - - - - 悦团购 - - - -设备是否有刘海屏:{{isIPhoneX}} - - - - - {{item.title}} - - - - - - - \ No newline at end of file + +1 + \ No newline at end of file diff --git a/nsgk_entry/pages/show/show.wxss b/nsgk_entry/pages/show/show.wxss index 9d46128..5f2ba7c 100644 --- a/nsgk_entry/pages/show/show.wxss +++ b/nsgk_entry/pages/show/show.wxss @@ -1,196 +1,5 @@ - -@import '/template/bottomUserSQ/bottomUserSQ.wxss'; -.scroll_page +.waterFallFlow { - height: 100vh; - -} -.page_content -{ - width: 100%; - height: auto; - display: block; - -} -.list-item -{ - height: 35px; - -} -.list-item-tv -{ - width: 80%; - height: 100%; - margin-left: 10%; - - - -} -/* .black_bj -{ - position:absolute; - bottom: 0rpx; - left: 0rpx; - width: 100vw; - height: 100vh; - -} -.dialog_sq -{ - position:absolute; - bottom: 0rpx; - left: 0rpx; - background: white; - width: 100%; - height: 500rpx; -} */ - -/**index.wxss**/ -.container -{ - width: 100vw; - -} -.title -{ - color: black; - text-align: center; - width: auto; -} -.address_top_transverse -{ - display: flex; - height: 64rpx; - background-color: white; - padding-bottom: 16rpx; - - - -} -.address_top_transverse .address_tap -{ - width: auto; - display: flex; - align-items: center; - - -} - .address_top_transverse .address_tap image -{ - width: 48rpx; - height: 48rpx; - margin-right: 16rpx; - margin-left: 16rpx; - -} -.address_top_transverse .address_tap .choice_address -{ - margin-right: 16rpx; + background-color: burlywood; -} -.address_top_transverse .address_tap .change_view -{ - font-size: 26rpx; - width: 80rpx; - -} - -.address_top_transverse .search_container -{ - display: flex; - width: auto; - height: 100%; - - align-items: center; - border-radius: 32rpx; - min-width: 130rpx; - margin-right: 16rpx; - flex: 1; - -} -.address_top_transverse .search_container .search_img -{ - width: 34rpx; - height: 34rpx; - margin-left: 16rpx; -} -.address_top_transverse .search_container .input_search -{ - - color: #94969c; - min-width: 160rpx; - height: 64rpx; - font-size: 24rpx; - line-height: 64rpx; - padding-left: 30rpx; -} -.tab_container -{ - width: 100%; - height: 72rpx; - position: relative; - - -} - -.tab_container .right_icon_view -{ - position: absolute; - right: 0rpx; - top: 0rpx; - width: 10vw; - height: 72rpx; - line-height: 72rpx; - text-align: center; -} -.banner_container -{ - position: relative; -} -.banner_container .banner_item -{ - width: 100%; - height: 100%; - margin-top: 16rpx; -} -.banner_img_sc{ - margin-left: 2.5%; - border-radius: 16rpx; - width: 95%; - background: url(https://shgm.jjyyx.com/m/images/banner_w_bg.png) no-repeat center; - -} - -.banner_container .banner_toast -{ - position: absolute; - bottom: -17rpx; - left: 5%; - - width: 340rpx; - height: 50rpx; - z-index: 10; -} -.type_swiper -{ - margin-top: 16rpx; - display: block; -} -.todayAndHot -{ - margin-top:16rpx; - display: block; - -} -.secon_kill -{ - margin-top: 16rpx; - display: block; -} -.preSale_collage -{ - margin-top: 16rpx; - display: block; -} - - +} \ No newline at end of file