|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- 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,
- })
- }
- })
|