| @@ -0,0 +1,31 @@ | |||
| /* | |||
| * Eslint config file | |||
| * Documentation: https://eslint.org/docs/user-guide/configuring/ | |||
| * Install the Eslint extension before using this feature. | |||
| */ | |||
| module.exports = { | |||
| env: { | |||
| es6: true, | |||
| browser: true, | |||
| node: true, | |||
| }, | |||
| ecmaFeatures: { | |||
| modules: true, | |||
| }, | |||
| parserOptions: { | |||
| ecmaVersion: 2018, | |||
| sourceType: 'module', | |||
| }, | |||
| globals: { | |||
| wx: true, | |||
| App: true, | |||
| Page: true, | |||
| getCurrentPages: true, | |||
| getApp: true, | |||
| Component: true, | |||
| requirePlugin: true, | |||
| requireMiniProgram: true, | |||
| }, | |||
| // extends: 'eslint:recommended', | |||
| rules: {}, | |||
| } | |||
| @@ -0,0 +1,136 @@ | |||
| import * as STORAGE from './utils/storage' | |||
| import * as UTIL from './utils/util' | |||
| import * as API from './utils/API' | |||
| App({ | |||
| onLaunch() { | |||
| var that = this; | |||
| //存储storage初始化globalData数据-- | |||
| //何时存储,用来判断,不用获取code | |||
| that.initGlobalData(); | |||
| //授权处理 | |||
| UTIL.initSQFromWX(); | |||
| //获取code | |||
| // UTIL.getCOdeFromWX({ | |||
| // complate: (code) => { | |||
| // console.log('app:微信code,' + code); | |||
| // //获取openId | |||
| // that.getOpenIdFromFW(code); | |||
| // } | |||
| // }); | |||
| //获取设备信息 | |||
| wx.getSystemInfo({ | |||
| success: function (res) { | |||
| that.globalData.systemType = res.system.indexOf("Android") >= 0 ? "Android" : "IOS"; | |||
| that.globalData.isIphoneX = res.model.indexOf("iPhone X") >= 0 || res.model.indexOf("iPhone 1") >= 0; | |||
| } | |||
| }); | |||
| }, | |||
| onShow() { | |||
| //更新机制 | |||
| this.wxappUpdateManager(); | |||
| }, | |||
| globalData: { | |||
| // 系统用户登录信息(用户id、token) | |||
| userInfo: { | |||
| memberId: '', | |||
| token: '' | |||
| }, | |||
| //微信用户登陆信息(昵称、头像、省、城市) | |||
| wxUserInfo: { | |||
| nickName: '', | |||
| avatarUrl: '', | |||
| province: '', | |||
| city: '' | |||
| } | |||
| , | |||
| /** | |||
| * 小程序设置 | |||
| */ | |||
| setInfo: { | |||
| //定位授权 | |||
| locationOpenIdWX: false, | |||
| //纬度 | |||
| latitude:'', | |||
| //经度 | |||
| longitude:'', | |||
| } | |||
| , | |||
| systemType:'',//设备类型 Android IOS | |||
| isIphoneX: false, // 用来标识当前手机机型是否为 iPhone X | |||
| }, | |||
| /** | |||
| * 从服务端获取openId | |||
| */ | |||
| getOpenIdFromFW(code) { | |||
| let sendData = { | |||
| code: code | |||
| } | |||
| UTIL.httpRequestNoneDetal(API.URL_GET_OPENID, sendData, "POST", { | |||
| success: (res) => { | |||
| if (res._code == API.SUCCESS_CODE) { | |||
| console.log("成功获取到openId:" + res._data.openid); | |||
| UTIL.showToastNoneIcon("openId:" + res._data.openid); | |||
| } else { | |||
| //未获取到openId | |||
| console.log("失败,获取到openId:" + res._msg); | |||
| UTIL.showToastNoneIcon("openId:失败"); | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| , | |||
| /** | |||
| * 初始化globalData | |||
| */ | |||
| initGlobalData() { | |||
| var userInfo = { | |||
| memberId: STORAGE.getMemberId(), | |||
| token: STORAGE.getToken() | |||
| } | |||
| console.log(userInfo) | |||
| this.globalData.userInfo = userInfo; | |||
| } | |||
| , | |||
| /** | |||
| * 小程序更新机制 | |||
| * 获取小程序更新机制兼容 | |||
| */ | |||
| wxappUpdateManager() { | |||
| if (wx.canIUse('getUpdateManager')) { | |||
| const updateManager = wx.getUpdateManager(); | |||
| if (!!updateManager) { | |||
| updateManager.onCheckForUpdate(function (res) { | |||
| // 请求完新版本信息的回调 | |||
| if (res.hasUpdate) { | |||
| updateManager.onUpdateReady(function () { | |||
| wx.showModal({ | |||
| title: '更新提示', | |||
| content: '新版本已经准备好,是否重启应用?', | |||
| success: function (res) { | |||
| if (res.confirm) { | |||
| // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | |||
| updateManager.applyUpdate() | |||
| } | |||
| } | |||
| }) | |||
| }) | |||
| updateManager.onUpdateFailed(function () { | |||
| // 新的版本下载失败 | |||
| wx.showModal({ | |||
| title: '已经有新版本了哟~', | |||
| content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', | |||
| }) | |||
| }) | |||
| } | |||
| }) | |||
| } | |||
| } else { | |||
| // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 | |||
| wx.showModal({ | |||
| title: '提示', | |||
| content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' | |||
| }) | |||
| } | |||
| }, | |||
| }) | |||
| @@ -0,0 +1,54 @@ | |||
| { | |||
| "pages": [ | |||
| "pages/show/show", | |||
| "pages/index/index", | |||
| "pages/wxAuth/wxAuth", | |||
| "pages/logs/logs", | |||
| "component/scrollTab/scrollTab" | |||
| ], | |||
| "window": { | |||
| "backgroundTextStyle": "light", | |||
| "navigationBarBackgroundColor": "#fff", | |||
| "navigationBarTitleText": "微信框架", | |||
| "navigationBarTextStyle": "black" | |||
| }, | |||
| "style": "v2", | |||
| "sitemapLocation": "sitemap.json", | |||
| "permission": { | |||
| "scope.userLocation": { | |||
| "desc": "你的位置信息将用于小程序位置接口的效果展示" | |||
| } | |||
| }, | |||
| "tabBar": { | |||
| "color": "#7A7E83", | |||
| "selectedColor": "#3cc51f", | |||
| "borderStyle": "black", | |||
| "backgroundColor": "#ffffff", | |||
| "list": [ | |||
| { | |||
| "pagePath": "pages/show/show", | |||
| "iconPath": "image/gwc1.png", | |||
| "selectedIconPath": "image/gwc2.png", | |||
| "text": "首页" | |||
| }, | |||
| { | |||
| "pagePath": "pages/index/index", | |||
| "iconPath": "image/gwc1.png", | |||
| "selectedIconPath": "image/gwc2.png", | |||
| "text": "分类" | |||
| }, | |||
| { | |||
| "pagePath": "pages/index/index", | |||
| "iconPath": "image/gwc1.png", | |||
| "selectedIconPath": "image/gwc2.png", | |||
| "text": "购物车" | |||
| }, | |||
| { | |||
| "pagePath": "pages/index/index", | |||
| "iconPath": "image/gwc1.png", | |||
| "selectedIconPath": "image/gwc2.png", | |||
| "text": "我的" | |||
| } | |||
| ] | |||
| } | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| /**app.wxss**/ | |||
| @import '/style/main.wxss'; | |||
| @import "/style/iconfont.wxss"; | |||
| Page { | |||
| font-size: 28rpx; | |||
| line-height: 35rpx; | |||
| background-color: #F4F4F4; | |||
| color: #444; | |||
| } | |||
| view, | |||
| scroll-view, | |||
| swiper, | |||
| movable-view, | |||
| icon, | |||
| text, | |||
| progress, | |||
| button, | |||
| checkbox, | |||
| form, | |||
| input, | |||
| label, | |||
| picker, | |||
| picker-view, | |||
| radio, | |||
| slider, | |||
| switch, | |||
| textarea, | |||
| navigator, | |||
| audio, | |||
| image, | |||
| video, | |||
| map, | |||
| canvas, | |||
| contact-button { | |||
| -webkit-box-sizing: border-box; | |||
| box-sizing: border-box; | |||
| } | |||
| .Al_shenhui_text_color { | |||
| color: #8b8686; | |||
| } | |||
| .singleLinHidenEllipsis | |||
| { | |||
| overflow: hidden; | |||
| text-overflow: ellipsis; | |||
| white-space: nowrap; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| // component/iPhoneXPatcher/iPhoneXPatcher.js | |||
| let APP = getApp(); | |||
| Component({ | |||
| /** | |||
| * 组件的属性列表 | |||
| */ | |||
| properties: { | |||
| }, | |||
| /** | |||
| * 组件的初始数据 | |||
| */ | |||
| data: { | |||
| isIphoneX: APP.globalData.isIphoneX | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| */ | |||
| methods: {} | |||
| }) | |||
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "component": true, | |||
| "usingComponents": {} | |||
| } | |||
| @@ -0,0 +1,4 @@ | |||
| <!--component/iPhoneXPatcher/iPhoneXPatcher.wxml--> | |||
| <view> | |||
| <view wx:if="{{isIphoneX}}" class="iphone-x-patcher"></view> | |||
| </view> | |||
| @@ -0,0 +1,6 @@ | |||
| /* component/iPhoneXPatcher/iPhoneXPatcher.wxss */ | |||
| .iphone-x-patcher { | |||
| width: 750rpx; | |||
| padding-bottom: 68rpx; | |||
| clear:both; /* 用于清除浮动(如: 提交订单页的底部 fixed 工具条) */ | |||
| } | |||
| @@ -0,0 +1,40 @@ | |||
| // component/iconLoading/iconLoading.js | |||
| Component({ | |||
| /** | |||
| * 组件的属性列表 | |||
| */ | |||
| properties: { | |||
| innerText: { | |||
| type: String, | |||
| value: 'default value', | |||
| } | |||
| }, | |||
| /** | |||
| * 组件的初始数据 | |||
| */ | |||
| data: { | |||
| isShowLoading: false | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| */ | |||
| methods: { | |||
| //隐藏弹框 | |||
| hideLoading() { | |||
| this.setData({ | |||
| isShowLoading: false | |||
| }) | |||
| }, | |||
| //展示弹框 | |||
| showLoading() { | |||
| this.setData({ | |||
| isShowLoading: true | |||
| }) | |||
| } | |||
| } | |||
| }) | |||
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "component": true, | |||
| "usingComponents": {} | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| <!-- 全局 弹窗loading 小图提示--> | |||
| <block wx:if="{{isShowLoading}}"> | |||
| <view class='global-loading'> | |||
| <image class="img" src='https://shgm.jjyyx.com/m/images/loadings.gif'></image> | |||
| <view > {{innerText}}</view> | |||
| </view> | |||
| </block> | |||
| @@ -0,0 +1,20 @@ | |||
| /* component/iconLoading/iconLoading.wxss */ | |||
| .global-loading { | |||
| z-index: 999999; | |||
| position: fixed; | |||
| top: 0%; | |||
| left: 0%; | |||
| width: 100%; | |||
| height: 100%; | |||
| background-color: rgba(255, 255, 255, 0.5); | |||
| } | |||
| .global-loading .img{ | |||
| position: absolute; | |||
| top: 50%; | |||
| left: 50%; | |||
| width: 180rpx; | |||
| height: 180rpx; | |||
| -webkit-transform: translate(-90rpx, -90rpx); | |||
| transform: translate(-90rpx, -90rpx); | |||
| z-index: 9999999; | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| // component/tabbar/tabbar.js | |||
| let APP = getApp(); | |||
| Component({ | |||
| /** | |||
| * 组件的属性列表 | |||
| */ | |||
| properties: { | |||
| tabs: { type: Array, value: [] }, | |||
| activeTab:{type:Number,value:0} | |||
| }, | |||
| /** | |||
| * 组件的初始数据 | |||
| */ | |||
| data: { | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| */ | |||
| methods: { | |||
| handleTabClick: function handleTabClick(e) { | |||
| let {index, item} = e.currentTarget.dataset; | |||
| this.setData({ activeTab: index }); | |||
| this.triggerEvent('tabclick', { choiceIndex: index, item:item }); | |||
| }, | |||
| } | |||
| }) | |||
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "component": true | |||
| } | |||
| @@ -0,0 +1,9 @@ | |||
| <!--可滑动的 tab标签--> | |||
| <scroll-view class="scroll_class" scroll-x="true"> | |||
| <view class="tab_container"> | |||
| <block wx:for="{{tabs}}" wx:key="id" > | |||
| <view class="tab_item Al_shenhui_text_color " bindtap="handleTabClick" data-index="{{index}}" data-item="{{item}}">{{item.name}}</view> | |||
| </block> | |||
| </view> | |||
| </scroll-view> | |||
| @@ -0,0 +1,22 @@ | |||
| .scroll_class | |||
| { | |||
| width: 90vw; | |||
| height: 100%; | |||
| } | |||
| .tab_container | |||
| { | |||
| width: auto; | |||
| height: 100%; | |||
| white-space: nowrap; | |||
| } | |||
| .tab_item | |||
| { | |||
| padding: 0rpx 20rpx; | |||
| height: 72rpx; | |||
| line-height: 72rpx; | |||
| text-align: center; | |||
| display: inline-block; | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| // component/tabbar/tabbar.js | |||
| let APP = getApp(); | |||
| Component({ | |||
| /** | |||
| * 组件的属性列表 | |||
| */ | |||
| properties: { | |||
| groupHomeCurrent:0, | |||
| groupManageCartNum:0, | |||
| isSHowZDYTabBar:true | |||
| }, | |||
| /** | |||
| * 组件的初始数据 | |||
| */ | |||
| data: { | |||
| isIphoneX: APP.globalData.isIphoneX, | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| */ | |||
| methods: { | |||
| /** | |||
| * 跳转板块 | |||
| */ | |||
| jumpToGroupPage(e){ | |||
| wx.reLaunch({ | |||
| url:'/pages/index/index', | |||
| success(){}, | |||
| fail(res){console.log(res);} | |||
| }); | |||
| } | |||
| } | |||
| }) | |||
| @@ -0,0 +1,7 @@ | |||
| { | |||
| "component": true, | |||
| "usingComponents": { | |||
| "component-iphone-x-patcher":"/component/iPhoneXPatcher/iPhoneXPatcher" | |||
| } | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| <!-- 自定义tabbar --> | |||
| <view class="footer-container {{isIphoneX ? ' iphone-x-patcher-container' : ''}}" hidden="{{isSHowZDYTabBar}}" > | |||
| <view class="footer-item-container f-home{{groupHomeCurrent == 0 ? ' active' : ''}}" catchtap="jumpToGroupPage" data-url="/pages/show/show"> | |||
| <text class="nav-msg">首页</text> | |||
| </view> | |||
| <view class="footer-item-container f-cate{{groupHomeCurrent == 1 ? ' active' : ''}}" catchtap="jumpToGroupPage" data-url="/pages/index/index"> | |||
| <text class="nav-msg">分类</text> | |||
| </view> | |||
| <view class="footer-item-container f-scan{{groupHomeCurrent == 2 ? ' active' : ''}}" catchtap="jumpToGroupPage" data-url="/pages/index/index" > | |||
| <view class="scan-jump"></view> | |||
| </view> | |||
| <view class="footer-item-container f-cart{{groupHomeCurrent == 3 ? ' active' : ''}}" catchtap="jumpToGroupPage" data-url="/pages/index/index"> | |||
| <text class="nav-msg">购物车</text> | |||
| <text class="nav-cart-num" style="display: {{groupManageCartNum <= 0 ? 'none' : ''}};">{{groupManageCartNum}}</text> | |||
| </view> | |||
| <view class="footer-item-container f-user{{groupHomeCurrent == 4 ? ' active' : ''}}" catchtap="jumpToGroupPage" data-url="/pages/index/index"> | |||
| <text class="nav-msg">我的</text> | |||
| </view> | |||
| <component-iphone-x-patcher></component-iphone-x-patcher> | |||
| </view> | |||
| @@ -0,0 +1,96 @@ | |||
| .footer-container { | |||
| position: fixed; | |||
| left: 0; | |||
| bottom: 0; | |||
| width: 100%; | |||
| background: #fff; | |||
| display: flex; | |||
| align-items: stretch; | |||
| z-index: 9999; | |||
| box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |||
| } | |||
| .footer-container .footer-item-container { | |||
| flex: 1; | |||
| height: 112rpx; | |||
| padding: 80rpx 0 0; | |||
| border-top: 1rpx solid #ededed; | |||
| display: flex; | |||
| justify-content: center; | |||
| align-items: center; | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_home.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| position: relative; | |||
| } | |||
| .footer-container .footer-item-container.f-home.active { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_home_active.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container .nav-msg { | |||
| font-size: 20rpx; | |||
| color: var(--blueLight); | |||
| line-height: 1; | |||
| } | |||
| .footer-container .footer-item-container.f-cate { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_cate.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container.f-cate.active { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_cate_active.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container.f-cart { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_cart.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container.f-cart.active { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_cart_active.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container.f-user.active { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_user_active.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container.f-user { | |||
| background: url("https://shgm.jjyyx.com/m/images/group/icon_user.png") no-repeat center 14rpx; | |||
| background-size: 48rpx; | |||
| } | |||
| .footer-container .footer-item-container .scan-jump{ | |||
| position: absolute; | |||
| top: -12rpx; | |||
| left: 50%; | |||
| transform: translateX(-50%); | |||
| width: 112rpx; | |||
| height: 112rpx; | |||
| border-radius: 50%; | |||
| background: var(--blue) url("https://shgm.jjyyx.com/m/images/group/icon_scan.png") no-repeat center center; | |||
| background-size: 64rpx 64rpx; | |||
| border: 6rpx solid var(--white); | |||
| box-sizing: border-box; | |||
| } | |||
| .nav-cart-num{ | |||
| position: absolute; | |||
| top: 8rpx; | |||
| left: 50%; | |||
| margin-left: 24rpx; | |||
| transform: translate3d(-50%, 0, 0) scale(.5); | |||
| transform-origin: center top; | |||
| min-width: 48rpx; | |||
| padding: 24rpx 16rpx; | |||
| font-size: 36rpx; | |||
| text-align: center; | |||
| line-height: 0rpx; | |||
| border: 2rpx solid #fff; | |||
| border-radius: 48rpx; | |||
| background: #FF4752; | |||
| color: #fff; | |||
| } | |||
| .footer-container.iphone-x-patcher-container { | |||
| flex-wrap: wrap; | |||
| height: auto; | |||
| } | |||
| @@ -0,0 +1,18 @@ | |||
| module.exports = { | |||
| LOCAL: { | |||
| URL_PREFIX: 'http://110.11.11.11:8080/earth-api', | |||
| }, | |||
| DEV: { | |||
| URL_PREFIX: 'http://110.11.11.11:8080/earth-api', | |||
| }, | |||
| TEST: { | |||
| URL_PREFIX: 'http://110.11.11.11:8080/earth-api', | |||
| }, | |||
| PRE: { | |||
| URL_PREFIX: 'http://110.11.11.11:8080/earth-api', | |||
| }, | |||
| PROD: { | |||
| URL_PREFIX: 'https://110.11.11.11:8080/earth-api', | |||
| } | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| // index.js | |||
| // 获取应用实例 | |||
| import * as UTIL from '../../utils/util.js' | |||
| const app = getApp() | |||
| Page({ | |||
| data: { | |||
| }, | |||
| onLoad() { | |||
| wx.showTabBar({ | |||
| animation: false, | |||
| }) | |||
| }, | |||
| }) | |||
| @@ -0,0 +1,6 @@ | |||
| { | |||
| "navigationBarTitleText": "String", | |||
| "usingComponents": { | |||
| } | |||
| } | |||
| @@ -0,0 +1,3 @@ | |||
| <view> | |||
| 1 | |||
| </view> | |||
| @@ -0,0 +1,5 @@ | |||
| .waterFallFlow | |||
| { | |||
| background-color: burlywood; | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| // logs.js | |||
| const util = require('../../utils/util.js') | |||
| Page({ | |||
| data: { | |||
| logs: [] | |||
| }, | |||
| onLoad() { | |||
| } | |||
| }) | |||
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "navigationBarTitleText": "查看启动日志", | |||
| "usingComponents": {} | |||
| } | |||
| @@ -0,0 +1,8 @@ | |||
| <import src="/template/normalTextPrompt/normalTextPrompt.wxml"></import> | |||
| <!--底部提示 已经到底啦--> | |||
| <!-- <view style="background-color:bisque;width: 100vw;height: 100vh;"> | |||
| <image mode="widthFix" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgs.design006.com%2F202007%2FDesign006_eDNxzQm7dd.jpg%3Fx-oss-process%3Dstyle%2Fprev_w_750_h_auto&refer=http%3A%2F%2Fimgs.design006.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644113858&t=c0e5ad3d3eb92aec483d26699be6b41b" style="width: 100%;"></image> | |||
| <template is="noMore" ></template> | |||
| </view> --> | |||
| <!--显示 --> | |||
| <template is="empty"></template> | |||
| @@ -0,0 +1 @@ | |||
| @import '/template/normalTextPrompt/normalTextPrompt.wxss'; | |||
| @@ -0,0 +1,293 @@ | |||
| import * as UTIL from '../../utils/util.js'; | |||
| import * as API from '../../utils/API.js'; | |||
| 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') | |||
| 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, | |||
| }) | |||
| } | |||
| }) | |||
| @@ -0,0 +1,7 @@ | |||
| { | |||
| "usingComponents": { | |||
| "component-tabbar": "/component/tabbar/tabbar", | |||
| "icon-loading":"/component/iconLoading/iconLoading" | |||
| }, | |||
| "navigationStyle": "custom" | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| <view class="container"> | |||
| <view style="background-color: white; position: sticky;top: 0; height:{{CustomMenuButton.bottom}}px;z-index: 7777;padding-top: {{CustomMenuButton.top}}px;"> | |||
| <!--自定义 顶部标题样式和位置--> | |||
| <view class="title singleLinHidenEllipsis" style="height:{{CustomMenuButton.height}}px;line-height:{{CustomMenuButton.height}}px;margin-left: {{BarMarginLeft}}px;width:{{BarWidth}}px;">悦团购</view> | |||
| </view> | |||
| <button class="ok_btn" bindtap="bindgetUserProfile">获取用户信息</button> | |||
| <view>设备是否有刘海屏:{{isIPhoneX}}</view> | |||
| <scroll-view class="scroll_page"> | |||
| <view class="page_content"> | |||
| <block wx:for-items="{{list}}" wx:key="title"> | |||
| <view class="list-item"> | |||
| <view class="list-item-tv" bindtap="onItemClickMethod" id='{{index}}'>{{item.title}}</view> | |||
| </view> | |||
| </block> | |||
| </view> | |||
| </scroll-view> | |||
| </view> | |||
| <component-tabbar groupHomeCurrent="1" groupManageCartNum="{{groupManageCartNum}}" isSHowZDYTabBar="{{isSHowZDYTabBar}}"></component-tabbar> | |||
| <icon-loading inner-text="Some text"></icon-loading> | |||
| @@ -0,0 +1,196 @@ | |||
| @import '/template/bottomUserSQ/bottomUserSQ.wxss'; | |||
| .scroll_page | |||
| { | |||
| 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; | |||
| } | |||
| .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; | |||
| } | |||
| @@ -0,0 +1,88 @@ | |||
| // pages/wxAuth/wxAuth.js | |||
| let APP = getApp(); | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onReady: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面显示 | |||
| */ | |||
| onShow: function () { | |||
| let that = this; | |||
| wx.authorize({ | |||
| scope: 'scope.userLocation', | |||
| success() { | |||
| getApp().globalData.setInfo.locationOpenIdWX=true; | |||
| wx.navigateBack({ | |||
| delta: 1 | |||
| }) | |||
| }, | |||
| fail() { | |||
| //如果之前已经拒绝过,直接返回fail 不弹窗 | |||
| getApp().globalData.setInfo=false; | |||
| } | |||
| }) | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面隐藏 | |||
| */ | |||
| onHide: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面卸载 | |||
| */ | |||
| onUnload: function () { | |||
| }, | |||
| /** | |||
| * 页面相关事件处理函数--监听用户下拉动作 | |||
| */ | |||
| onPullDownRefresh: function () { | |||
| }, | |||
| /** | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function () { | |||
| } | |||
| , | |||
| /** | |||
| * 跳转到设置页面 | |||
| */ | |||
| toSettingPage: function () { | |||
| wx.openSetting({ | |||
| success(res) { | |||
| } | |||
| }) | |||
| } | |||
| }); | |||
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "navigationBarTitleText": "定位授权" | |||
| } | |||
| @@ -0,0 +1,10 @@ | |||
| <view class="auth-box"> | |||
| <view class="icon-box"></view> | |||
| <view class="text-box">获取地理位置失败</view> | |||
| <view class="button-box"> | |||
| <button bindtap="toSettingPage">开启定位</button> | |||
| </view> | |||
| <view class="tips-box">若小程序定位已开启</view> | |||
| <view class="tips-box">请检查微信定位服务是否开启</view> | |||
| </view> | |||
| @@ -0,0 +1,45 @@ | |||
| .auth-box { | |||
| } | |||
| .auth-box .icon-box { | |||
| margin: 270rpx auto 0; | |||
| display: block; | |||
| width: 400rpx; | |||
| height: 400rpx; | |||
| background: url("https://shgm.jjyyx.com/m/images/error_img4.png?20190704") no-repeat center; | |||
| background-size: contain; | |||
| } | |||
| .auth-box .text-box { | |||
| margin-top: 60rpx; | |||
| font-size: 40rpx; | |||
| color: #999999; | |||
| text-align: center; | |||
| } | |||
| .auth-box .button-box { | |||
| margin-top: 60rpx; | |||
| margin-bottom: 60rpx; | |||
| font-size: 30rpx; | |||
| text-align: center; | |||
| } | |||
| .auth-box .button-box button { | |||
| width: 320rpx; | |||
| height: 72rpx; | |||
| border: 1px solid #FF4752; | |||
| border-radius: 36rpx; | |||
| text-align: center; | |||
| line-height: 72rpx; | |||
| background: #fff; | |||
| color: #FF4752; | |||
| padding: 0rpx; | |||
| } | |||
| .auth-box .tips-box { | |||
| font-size: 28rpx; | |||
| line-height: 40rpx; | |||
| color: #999999; | |||
| text-align: center; | |||
| } | |||
| @@ -0,0 +1,82 @@ | |||
| { | |||
| "description": "项目配置文件", | |||
| "packOptions": { | |||
| "ignore": [ | |||
| { | |||
| "type": "file", | |||
| "value": ".eslintrc.js" | |||
| } | |||
| ] | |||
| }, | |||
| "setting": { | |||
| "urlCheck": false, | |||
| "es6": true, | |||
| "enhance": true, | |||
| "postcss": true, | |||
| "preloadBackgroundData": false, | |||
| "minified": true, | |||
| "newFeature": false, | |||
| "coverView": true, | |||
| "nodeModules": false, | |||
| "autoAudits": false, | |||
| "showShadowRootInWxmlPanel": true, | |||
| "scopeDataCheck": false, | |||
| "uglifyFileName": false, | |||
| "checkInvalidKey": true, | |||
| "checkSiteMap": false, | |||
| "uploadWithSourceMap": true, | |||
| "compileHotReLoad": false, | |||
| "lazyloadPlaceholderEnable": false, | |||
| "useMultiFrameRuntime": true, | |||
| "useApiHook": true, | |||
| "useApiHostProcess": true, | |||
| "babelSetting": { | |||
| "ignore": [], | |||
| "disablePlugins": [], | |||
| "outputPath": "" | |||
| }, | |||
| "enableEngineNative": false, | |||
| "useIsolateContext": true, | |||
| "userConfirmedBundleSwitch": false, | |||
| "packNpmManually": false, | |||
| "packNpmRelationList": [], | |||
| "minifyWXSS": true, | |||
| "disableUseStrict": false, | |||
| "minifyWXML": true, | |||
| "showES6CompileOption": false, | |||
| "useCompilerPlugins": false | |||
| }, | |||
| "compileType": "miniprogram", | |||
| "libVersion": "2.21.1", | |||
| "appid": "wx90a68c6fdd650f48", | |||
| "projectname": "WXMB", | |||
| "debugOptions": { | |||
| "hidedInDevtools": [] | |||
| }, | |||
| "scripts": {}, | |||
| "staticServerOptions": { | |||
| "baseURL": "", | |||
| "servePath": "" | |||
| }, | |||
| "isGameTourist": false, | |||
| "condition": { | |||
| "search": { | |||
| "list": [] | |||
| }, | |||
| "conversation": { | |||
| "list": [] | |||
| }, | |||
| "game": { | |||
| "list": [] | |||
| }, | |||
| "plugin": { | |||
| "list": [] | |||
| }, | |||
| "gamePlugin": { | |||
| "list": [] | |||
| }, | |||
| "miniprogram": { | |||
| "list": [] | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| { | |||
| "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||
| "rules": [{ | |||
| "action": "allow", | |||
| "page": "*" | |||
| }] | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| @font-face { | |||
| font-family: "iconfont"; /* Project id 3051601 */ | |||
| src: url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.woff2?t=1640658441847') format('woff2'), | |||
| url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.woff?t=1640658441847') format('woff'), | |||
| url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.ttf?t=1640658441847') format('truetype'); | |||
| } | |||
| .iconfont { | |||
| font-family: "iconfont" !important; | |||
| font-size: 16px; | |||
| font-style: normal; | |||
| -webkit-font-smoothing: antialiased; | |||
| -moz-osx-font-smoothing: grayscale; | |||
| } | |||
| .icon-bianji:before { | |||
| content: "\e63d"; | |||
| } | |||
| .icon-caipinguanli:before { | |||
| content: "\e63f"; | |||
| } | |||
| .icon-sousuo:before { | |||
| content: "\e62b"; | |||
| } | |||
| .icon-jiantou:before { | |||
| content: "\e627"; | |||
| } | |||
| .icon-jiantouyou:before { | |||
| content: "\e628"; | |||
| } | |||
| .icon-jiantoushang:before { | |||
| content: "\e629"; | |||
| } | |||
| .icon-guanbi:before { | |||
| content: "\e62a"; | |||
| } | |||
| @@ -0,0 +1,23 @@ | |||
| page { | |||
| /* 标准色 */ | |||
| --blue: #0f3f69; | |||
| --red: #ff4752; | |||
| --orange: #ffa601; | |||
| --golden: #d4b871; | |||
| --gray: #94969c; | |||
| --black: #444444; | |||
| --white: #fff; | |||
| --pale: #e7e7e7; | |||
| /* 浅色 */ | |||
| --orangeLight: #FFFAEB; | |||
| --blueLight: #155c99; | |||
| --redLight: #FF4752; | |||
| --grayLight: #e7e7e7; | |||
| --grayWhite: #f4f4f4; | |||
| /* 背景色 */ | |||
| --bgGrayWhite: #f4f4f4; | |||
| --bgGrayWhiteLight: #f8f8f8; | |||
| /* 渐变色 */ | |||
| /* 阴影透明色 */ | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| <template name="sq_dialog" > | |||
| <view class="black_view" bindtap="blackOnClick" hidden="{{showDownTS}}"></view> | |||
| <view class="white_view" hidden="{{showDownTS}}"> | |||
| <view class="title_tv">XXXX小程序提示标题</view> | |||
| <view class="tv1">XXXX小程序提示内容</view> | |||
| <view class="tv2 Al_shenhui_text_color">XXXX小程序详细内容介绍</view> | |||
| <view class="view_button"> | |||
| <button class="no_btn" bindtap="refuseOnClick" >拒绝</button> | |||
| <button class="ok_btn" bindtap="okOnClick" >允许</button> | |||
| </view> | |||
| </view> | |||
| </template> | |||
| @@ -0,0 +1,86 @@ | |||
| .black_view | |||
| { | |||
| background-color: black; | |||
| opacity: 0.3; | |||
| width: 100vw; | |||
| height: 100vh; | |||
| position:fixed; | |||
| left: 0rpx; | |||
| top: 0rpx; | |||
| z-index: 99999; | |||
| } | |||
| .white_view | |||
| { | |||
| z-index: 99999; | |||
| position:absolute; | |||
| bottom: 0rpx; | |||
| left: 0rpx; | |||
| width: 100vw; | |||
| height: 500rpx; | |||
| display: block; | |||
| background-color:#f5f4f7; | |||
| border-top-left-radius: 15rpx; | |||
| border-top-right-radius: 15rpx; | |||
| } | |||
| .title_tv | |||
| { | |||
| font-size: 29rpx; | |||
| color: #444; | |||
| margin-top: 60rpx; | |||
| margin-left: 5%; | |||
| } | |||
| .tv1 | |||
| { | |||
| font-size: 30rpx; | |||
| color: black; | |||
| margin-top: 60rpx; | |||
| margin-left: 5%; | |||
| } | |||
| .tv2 | |||
| { | |||
| font-size: 28rpx; | |||
| margin-top: 15rpx; | |||
| margin-left: 5%; | |||
| } | |||
| .view_button | |||
| { | |||
| display: flex; | |||
| margin-left: 5%; | |||
| margin-top: 80rpx; | |||
| margin-right: 5%; | |||
| width: auto; | |||
| justify-content: space-between; | |||
| } | |||
| .no_btn | |||
| { | |||
| background-color: white; | |||
| color: mediumseagreen; | |||
| height: 80rpx; | |||
| line-height: 80rpx; | |||
| padding: 0rpx; | |||
| border-radius: 10rpx; | |||
| border-color: #e6e6e6; | |||
| border-width: 1rpx; | |||
| font-size: 28rpx; | |||
| width: auto; | |||
| } | |||
| .ok_btn | |||
| { | |||
| background-color: mediumseagreen; | |||
| color: white; | |||
| height: 80rpx; | |||
| line-height: 80rpx; | |||
| padding: 0rpx; | |||
| border-radius: 10rpx; | |||
| font-size: 28rpx; | |||
| width: auto; | |||
| margin-left: 50rpx; | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| <!-- 提示层 - 没有更多了 --> | |||
| <template name="noMore"> | |||
| <view class="noMore">{{noMoreMes||'已经到底啦~'}}</view> | |||
| </template> | |||
| <!-- 提示层 - 暂无数据 --> | |||
| <template name="empty"> | |||
| <view class="error-page-tpl"> | |||
| <image src="https://shgm.jjyyx.com/m/images/{{errorImageName||'error_img3.png'}}?20190704" mode="aspectFit"></image> | |||
| <text class="error-tpl-msg">{{emptyMsg||'暂无数据'}}</text> | |||
| </view> | |||
| </template> | |||
| @@ -0,0 +1,44 @@ | |||
| /** | |||
| * 提示层 - 没有更多了 | |||
| */ | |||
| .noMore { | |||
| width: 100%; | |||
| font-size: 24rpx; | |||
| color: #CCC; | |||
| text-align: center; | |||
| padding: 20rpx 0; | |||
| padding-bottom:calc(20rpx + constant(safe-area-inset-bottom)); | |||
| padding-bottom:calc(20rpx + env(safe-area-inset-bottom)); | |||
| } | |||
| /** | |||
| * 提示层 - 暂无数据 | |||
| */ | |||
| .error-page-tpl { | |||
| position: fixed; | |||
| left: 0; | |||
| top: 35%; | |||
| width: 100%; | |||
| transform: translate(0, -50%); | |||
| display: flex; | |||
| flex-flow: column; | |||
| justify-content: center; | |||
| align-items: center; | |||
| z-index: 2; | |||
| } | |||
| .error-page-tpl image { | |||
| width: 400rpx; | |||
| height: 400rpx; | |||
| } | |||
| .error-page-tpl .error-tpl-msg { | |||
| margin-top: -30rpx; | |||
| font-size: 24rpx; | |||
| color: #999; | |||
| word-wrap: break-word; | |||
| word-break: normal; | |||
| width: 100%; | |||
| text-align: center; | |||
| } | |||
| @@ -0,0 +1,53 @@ | |||
| let EVN_CONFIG = require('../env/env'); | |||
| // const DISTRIBUTE_ENVIROMENT = 'PROD'; | |||
| const DISTRIBUTE_ENVIROMENT = 'DEV'; | |||
| let { | |||
| URL_PREFIX, | |||
| } = EVN_CONFIG[DISTRIBUTE_ENVIROMENT]; | |||
| //用户登录页面,接口检测用户token失效,需跳转重新登录 | |||
| const USER_LOGIN_PAGE_PATH='/pages/user/wxLogin/wxLogin'; | |||
| //接口成功 | |||
| const SUCCESS_CODE = '000000'; | |||
| //微信登陆失效 | |||
| const INVALID_USER_TOKEN_CODE = '001007'; | |||
| /* 渠道来源 渠道ID:[ios-217;安卓-218;M版-219;小程序-220;线下-221] */ | |||
| const CHANNERL_220 = 220; | |||
| /****************接口提示信息start ****************/ | |||
| const MSG_FAIL_HTTP = '获取数据失败 fail'; | |||
| const MSG_ERROR_HTTP = '获取数据失败 error'; | |||
| const MSG_FALSE_HTTP = '获取数据失败 false'; | |||
| const MSG_NONE_HTTP = '暂无数据'; | |||
| const MSG_FALSE_TO = '提交失败,请重试'; | |||
| const MSG_ERROR_TO = '提交异常,请重试'; | |||
| const MSG_INVALID_USER_TOKEN='登陆信息失效,请重新登陆'; | |||
| /****************接口提示信息end**************** | |||
| /****************接口地址start****************/ | |||
| /* 定位获取附近的商店 */ | |||
| const URL_LOCATION_SHOPQUERYBYLOCATION = `${URL_PREFIX}/location/shopquerybylocation`; | |||
| /* 根据版块信息获取推荐数据 */ | |||
| const URL_ZB_RECOMMEND_LIST = `${URL_PREFIX}/recommend/list`; | |||
| //获取openId | |||
| const URL_GET_OPENID=`https://110.11.11.11:8080/wx/getXcxOpenId`; | |||
| /****************接口地址end****************/ | |||
| export { | |||
| USER_LOGIN_PAGE_PATH, | |||
| SUCCESS_CODE, | |||
| INVALID_USER_TOKEN_CODE, | |||
| CHANNERL_220, | |||
| MSG_FAIL_HTTP, | |||
| MSG_ERROR_HTTP, | |||
| MSG_FALSE_HTTP, | |||
| MSG_NONE_HTTP, | |||
| MSG_FALSE_TO, | |||
| MSG_ERROR_TO, | |||
| MSG_INVALID_USER_TOKEN, | |||
| URL_LOCATION_SHOPQUERYBYLOCATION, | |||
| URL_ZB_RECOMMEND_LIST, | |||
| URL_GET_OPENID, | |||
| } | |||
| @@ -0,0 +1,35 @@ | |||
| /** | |||
| * 获取当前登录用户的 ID | |||
| */ | |||
| function getMemberId() { | |||
| return wx.getStorageSync('memberId'); | |||
| } | |||
| /** | |||
| * 存储用户ID | |||
| * @param {用户id} memberId | |||
| */ | |||
| function setMemberId(memberId) { | |||
| wx.setStorageSync('memberId', memberId); | |||
| } | |||
| /** | |||
| * 获取当前登录用户的 token | |||
| */ | |||
| function getToken() { | |||
| return wx.getStorageSync('token'); | |||
| } | |||
| /** | |||
| * 设置用户token | |||
| * @param {用户token} token | |||
| */ | |||
| function setToken(token) { | |||
| wx.setStorageSync('token', token); | |||
| } | |||
| export { | |||
| getMemberId, | |||
| setMemberId, | |||
| getToken, | |||
| setToken, | |||
| } | |||
| @@ -0,0 +1,368 @@ | |||
| import * as API from './API'; | |||
| let APP = getApp(); | |||
| let FUNCTION_TEXT = 'function'; | |||
| /*判断是否iphonex*/ | |||
| function isIPhoneX() { | |||
| let screenHeight = wx.getSystemInfoSync().screenHeight | |||
| let bottom = wx.getSystemInfoSync().safeArea.bottom | |||
| return screenHeight !== bottom | |||
| } | |||
| /*获取当前页url*/ | |||
| function getCurrentPageUrl() { | |||
| var pages = getCurrentPages() | |||
| var currentPage = pages[pages.length - 1] | |||
| var url = currentPage.route | |||
| return url | |||
| } | |||
| /*获取当前页带参数的url*/ | |||
| function getCurrentPageUrlWithArgs() { | |||
| var pages = getCurrentPages() | |||
| var currentPage = pages[pages.length - 1] | |||
| var url = currentPage.route | |||
| var options = currentPage.options | |||
| var urlWithArgs = url + '?' | |||
| for (var key in options) { | |||
| var value = options[key] | |||
| urlWithArgs += key + '=' + value + '&' | |||
| } | |||
| urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1) | |||
| return urlWithArgs | |||
| } | |||
| /** | |||
| * 无图标,纯文本Toast提示 | |||
| */ | |||
| function showToastNoneIcon(title) { | |||
| if (title == undefined || title == '') { | |||
| title = ''; | |||
| } | |||
| return wx.showToast({ | |||
| title: title, | |||
| icon: 'none', | |||
| }); | |||
| } | |||
| /** | |||
| * 显示Modal弹框(无取消按钮,只显示) | |||
| * @param {标题} title | |||
| * @param {内容} content | |||
| * @param {按钮文字,默认确定} confirmText | |||
| */ | |||
| function showModalNoneCancel(title, content, confirmText) { | |||
| wx.showModal({ | |||
| title: title, | |||
| showCancel: false, | |||
| content: content, | |||
| confirmText: (typeof confirmText == 'undefined' || confirmText == '') ? '确定' : confirmText, | |||
| success: function (e) { | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * 显示完整的Modal弹框提示 | |||
| * @param {标题} title | |||
| * @param {内容} content | |||
| * @param {确认} confirmText | |||
| * @param {取消} cancelText | |||
| * @param {回调} param4 | |||
| */ | |||
| function showModalOnClick(title, content, confirmText, cancelText, { confirm, cancel }) { | |||
| wx.showModal({ | |||
| title: title, | |||
| content: content, | |||
| confirmText: (typeof confirmText == 'undefined' || confirmText == '') ? '确定' : confirmText, | |||
| cancelText: (typeof cancelText == 'undefined' || cancelText == '') ? '取消' : cancelText, | |||
| success: function (e) { | |||
| if (e.confirm) { | |||
| confirm(); | |||
| } else if (e.cancel) { | |||
| cancel(); | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * 有背景图层的loading | |||
| * * @param {内容} content | |||
| */ | |||
| function showLoadingHaveMask(content) { | |||
| wx.showLoading({ | |||
| title: (typeof content == "undefined" || content == '') ? '加载中...' : content, | |||
| mask: true | |||
| }) | |||
| } | |||
| /** | |||
| * 隐藏loading | |||
| */ | |||
| function hideLoadingHaveMask() { | |||
| wx.hideLoading(); | |||
| } | |||
| /** | |||
| * 全局通用网络请求方法,默认post传输 | |||
| */ | |||
| function httpRequest(url, data, { | |||
| success, | |||
| fail, | |||
| complete | |||
| }) { | |||
| wx.showNavigationBarLoading(); | |||
| let finalData = {}; | |||
| Object.assign(finalData, data); | |||
| finalData.memberId = getApp().globalData.userInfo.memberId; | |||
| finalData.token = getApp().globalData.userInfo.token; | |||
| //渠道:小程序 | |||
| finalData.channel = API.CHANNERL_220; | |||
| wx.request({ | |||
| url, | |||
| data: finalData, | |||
| method: data.method || 'POST', | |||
| timeout: 60000, | |||
| success: function (response) { | |||
| if (response.data && response.data._code == API.INVALID_USER_TOKEN_CODE) { | |||
| //微信登陆失效 | |||
| showToastNoneIcon(API.MSG_INVALID_USER_TOKEN); | |||
| wx.navigateTo({ | |||
| url: API.USER_LOGIN_PAGE_PATH, | |||
| }) | |||
| } else if (typeof success === FUNCTION_TEXT) { | |||
| success(response.data); | |||
| } | |||
| }, | |||
| fail: function (response) { | |||
| if (typeof fail === FUNCTION_TEXT) { | |||
| fail(handleFail(response)); | |||
| } else { | |||
| showToastNoneIcon(API.MSG_FAIL_HTTP); | |||
| } | |||
| }, | |||
| complete: function (response) { | |||
| if (typeof complete === FUNCTION_TEXT) { | |||
| if (response.data && response.data._code == API.SUCCESS_CODE) { | |||
| complete(response.data); | |||
| } else { | |||
| complete(handleFail(response.data)); | |||
| } | |||
| } | |||
| wx.hideNavigationBarLoading(); | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * 网络访问(无其他处理) | |||
| * @param {地址} url | |||
| * @param {参数} data | |||
| * @param {方法 get or post} method | |||
| * @param {回调} param3 | |||
| */ | |||
| function httpRequestNoneDetal(url, data, method, { | |||
| success, | |||
| fail, | |||
| complete | |||
| }) { | |||
| wx.showNavigationBarLoading(); | |||
| wx.request({ | |||
| url, | |||
| data: data, | |||
| method: method, | |||
| success: function (response) { | |||
| if (typeof success === FUNCTION_TEXT) { | |||
| success(response.data); | |||
| } | |||
| }, | |||
| fail: function (response) { | |||
| if (typeof fail === FUNCTION_TEXT) { | |||
| fail(handleFail(response)); | |||
| } else { | |||
| showToastNoneIcon(API.MSG_FAIL_HTTP); | |||
| } | |||
| }, | |||
| complete: function (response) { | |||
| if (typeof complete === FUNCTION_TEXT) { | |||
| if (response.data && response.data._code == API.SUCCESS_CODE) { | |||
| complete(response.data); | |||
| } else { | |||
| complete(handleFail(response.data)); | |||
| } | |||
| } | |||
| wx.hideNavigationBarLoading(); | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * 调用失败 | |||
| */ | |||
| function handleFail(data = '') { | |||
| let { _msg = API.MSG_FAIL_HTTP, _code = 10001, _data = '', } = data; | |||
| return { | |||
| _code, | |||
| _data, | |||
| _msg | |||
| } | |||
| } | |||
| /** | |||
| * 微信授权 获取信息 | |||
| */ | |||
| function initSQFromWX() { | |||
| let that = this; | |||
| wx.getSetting({ | |||
| success(res) { | |||
| // if (res.authSetting['scope.userInfo']) { | |||
| // console.log('个人信息:authSetting 已授权'); | |||
| // } else { | |||
| // console.log('个人信息:authSetting 未授权'); | |||
| // } | |||
| if (res.authSetting['scope.userLocation']) { | |||
| //定位已开启,暂不做功能处理 | |||
| console.log('定位:authSetting 已授权'); | |||
| getApp().globalData.setInfo.locationOpenIdWX = true; | |||
| } else { | |||
| //定位未开启,申请授权 | |||
| wx.authorize({ | |||
| scope: 'scope.userLocation', | |||
| success() { | |||
| //定位已开启,暂不做功能处理 | |||
| console.log('定位:wx.authorize success'); | |||
| getApp().globalData.setInfo.locationOpenIdWX = true; | |||
| } | |||
| , | |||
| fail() { | |||
| //如果之前已经拒绝过,直接返回fail 不弹窗 | |||
| console.log('定位:wx.authorize fail'); | |||
| getApp().globalData.setInfo.locationOpenIdWX = false; | |||
| wx.navigateTo({ | |||
| url: '/pages/wxAuth/wxAuth', | |||
| }) | |||
| } | |||
| }) | |||
| } | |||
| }, | |||
| fail(e) { | |||
| }, | |||
| complete() { | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 获取微信Code | |||
| */ | |||
| function getCOdeFromWX({ complate }) { | |||
| showLoadingHaveMask('正在检测账号..'); | |||
| wx.login({ | |||
| success: function (data) { | |||
| complate(data.code); | |||
| }, | |||
| fail: function (err) { | |||
| hideLoadingHaveMask(); | |||
| showModalNoneCancel("温馨提示", "登陆失败,建议请重新打开小程序") | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * ,获取到的微信用户信息(昵称、头像、省市 赋值给globalData.wxUserInfo) | |||
| */ | |||
| function getUserInfoFomWX({ success }) { | |||
| wx.getUserProfile({ | |||
| desc: '用于完善会员资料', | |||
| success: res => { | |||
| getApp().globalData.wxUserInfo.nickName = res.userInfo.nickName; | |||
| getApp().globalData.wxUserInfo.avatarUrl = res.userInfo.avatarUrl; | |||
| //不再返回 强制返回“” | |||
| // getApp().globalData.wxUserInfo.province = res.userInfo.province; | |||
| // getApp().globalData.wxUserInfo.city = res.userInfo.city; | |||
| console.log("获取到个人信息:" + res.userInfo.nickName); | |||
| success(res); | |||
| }, | |||
| complete: res => { | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * 获取地理位置 | |||
| * @param {回调} param0 | |||
| */ | |||
| function getLocationFromWX({ success, fail }) { | |||
| wx.getLocation({ | |||
| type: 'wgs84', | |||
| success(res) { | |||
| getApp().globalData.setInfo.latitude = res.latitude; | |||
| getApp().globalData.setInfo.longitude = res.longitude; | |||
| success(); | |||
| } | |||
| , fail(res) { | |||
| showToastNoneIcon('获取地理信息失败'); | |||
| fail(res); | |||
| } | |||
| }) | |||
| } | |||
| function convert_length(length) { | |||
| return Math.round(wx.getSystemInfoSync().windowWidth * length / 750); | |||
| } | |||
| /** | |||
| * 比较版本号(参数'1.11.0', '1.9.9',返回1) | |||
| * @param {*} v1 | |||
| * @param {*} v2 | |||
| */ | |||
| function compareVersion(v1, v2) { | |||
| v1 = v1.split('.') | |||
| v2 = v2.split('.') | |||
| const len = Math.max(v1.length, v2.length) | |||
| while (v1.length < len) { | |||
| v1.push('0') | |||
| } | |||
| while (v2.length < len) { | |||
| v2.push('0') | |||
| } | |||
| for (let i = 0; i < len; i++) { | |||
| const num1 = parseInt(v1[i]) | |||
| const num2 = parseInt(v2[i]) | |||
| if (num1 > num2) { | |||
| return 1 | |||
| } else if (num1 < num2) { | |||
| return -1 | |||
| } | |||
| } | |||
| return 0 | |||
| } | |||
| export { | |||
| getCurrentPageUrl, | |||
| getCurrentPageUrlWithArgs, | |||
| showToastNoneIcon, | |||
| showModalNoneCancel, | |||
| showModalOnClick, | |||
| showLoadingHaveMask, | |||
| hideLoadingHaveMask, | |||
| httpRequest, | |||
| httpRequestNoneDetal, | |||
| initSQFromWX, | |||
| getCOdeFromWX, | |||
| getLocationFromWX, | |||
| getUserInfoFomWX, | |||
| convert_length, | |||
| isIPhoneX | |||
| } | |||