From 52c84b320c53c838e44be7641392f5382c745203 Mon Sep 17 00:00:00 2001 From: abson Date: Sat, 26 Feb 2022 16:40:29 +0800 Subject: [PATCH] 分享朋友圈单页面优化 --- app.js | 1050 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ app.json | 11 +++++++++-- packageA/pages/goodsInfo/goodsInfo.js | 4 +++- packageA/pages/jfbuy/jfbuy.js | 3 +++ packageA/pages/liveStream/liveStream.js | 3 +++ packageB/pages/zuhegou/index/index.js | 3 +++ packageB/pages/zuhegou/preindex/index.js | 3 +++ packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js | 4 +++- packageC/pages/presell/goodsInfo/goodsInfo.js | 3 +++ packageC/pages/presell/pregoodsInfo/goodsInfo.js | 3 +++ packageD/pages/AI-test-skin/analyse/analyse.js | 606 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ pages/activity/pind_list/pind_list.js | 3 +++ pages/activity/seckill_list/seckill_list.js | 3 +++ pages/giftpack/buygiftpack/giftpackbuy.js | 3 +++ pages/giftpack/giftpacklist/giftpacklist.js | 18 +++++++++++++----- pages/giftpack/mygiftpack/mygiftpack.js | 3 +++ pages/goods/categoryList/categoryList.js | 3 +++ pages/goods/goodsInfo/goodsInfo.js | 3 +++ pages/index/index/index.js | 4 +++- pages/template/index.js | 3 +++ pages/user/assistance/assistance.js | 4 +++- 21 files changed, 991 insertions(+), 749 deletions(-) diff --git a/app.js b/app.js index 8fdd2c1..dae9f42 100644 --- a/app.js +++ b/app.js @@ -1,82 +1,86 @@ var t = require("setting.js"), o = require("./utils/auth.js"), a = require("./utils/request.js"), e = require("./utils/common.js"), ut = require("./utils/util.js"); -var os=t; +var os = t; var regeneratorRuntime = require('./utils/runtime.js'); var api = require("./api/api.js") - +// import { pluginGD } from './utils/ai_config/config' //公共方法和变量 App({ - def_list:[ - { - "weappurl": "pages/index/index/index", - "nav_name": "首页", - "src": t.imghost+"/miniapp/images/bar/index.png", - "src_sele": t.imghost+"/miniapp/images/bar/index_on.png", - }, - { - "weappurl": "pages/goods/categoryList/categoryList", - "nav_name": "分类", - "src": t.imghost+"/miniapp/images/bar/fl.png", - "src_sele": t.imghost+"/miniapp/images/bar/fl_on.png" - }, - { - "weappurl": "pages/distribution/distribution", - "nav_name": "分销", - "src": t.imghost+"/miniapp/images/bar/fx.png", - "src_sele": t.imghost+"/miniapp/images/bar/fx_on.png" - }, - { - "weappurl": "pages/cart/cart/cart", - "nav_name": "购物车", - "src": t.imghost+"/miniapp/images/bar/car.png", - "src_sele": t.imghost+"/miniapp/images/bar/car_on.png" - }, - { - "weappurl": "pages/user/index/index", - "nav_name": "我的", - "src": t.imghost+"/miniapp/images/bar/user.png", - "src_sele": t.imghost+"/miniapp/images/bar/user_on.png" - } - ], - - globalData: { - cartGoodsNum:0, //购物车总数量 - isTabBar :false, - isIpx: false, //适配IPhoneX - url:"", - setting: t, - wechatUser: null, - userInfo: null, - config: null, //门店参数 - config2: null, //门店配置 - code: null, - user_id:null,//1564704,// 10153869,// 6453964,//5682094, - buy_now:null, - picklist:null, //门店列表 - wuliuprice: null, //物流价格表 - wuliu: null, //物流公司 - baddr:null, - mobile: null, //记录手机 - getu:null, //记录会员信息 - sessionKey: null,//记录会员信息 - openid: null, //记录会员信息 - - to_group:null, //参团传递的数据 - wxapp_buy_obj:null, //微信小程序购买的Object - pk_store:null, //选择的门店 - first_leader:null, //分享会员ID - guide_id:null, //分享导购ID - - windowWidth:0, //整个窗体的宽度 - - room_id:null, //直播间分享的房间ID - room_goods_id:null, //直播间分享的商品ID - - }, + def_list: [ + { + "weappurl": "pages/index/index/index", + "nav_name": "首页", + "src": t.imghost + "/miniapp/images/bar/index.png", + "src_sele": t.imghost + "/miniapp/images/bar/index_on.png", + }, + { + "weappurl": "pages/goods/categoryList/categoryList", + "nav_name": "分类", + "src": t.imghost + "/miniapp/images/bar/fl.png", + "src_sele": t.imghost + "/miniapp/images/bar/fl_on.png" + }, + { + "weappurl": "pages/distribution/distribution", + "nav_name": "分销", + "src": t.imghost + "/miniapp/images/bar/fx.png", + "src_sele": t.imghost + "/miniapp/images/bar/fx_on.png" + }, + { + "weappurl": "pages/cart/cart/cart", + "nav_name": "购物车", + "src": t.imghost + "/miniapp/images/bar/car.png", + "src_sele": t.imghost + "/miniapp/images/bar/car_on.png" + }, + { + "weappurl": "pages/user/index/index", + "nav_name": "我的", + "src": t.imghost + "/miniapp/images/bar/user.png", + "src_sele": t.imghost + "/miniapp/images/bar/user_on.png" + } + ], + + + globalData: { + cartGoodsNum: 0, //购物车总数量 + isTabBar: false, + isIpx: false, //适配IPhoneX + url: "", + setting: t, + wechatUser: null, + userInfo: null, + config: null, //门店参数 + config2: null, //门店配置 + code: null, + user_id: 5682094,//1564704,// 10153869,// 6453964,//5682094,6520044,6520119 qa 4687 6519901 + buy_now: null, + picklist: null, //门店列表 + wuliuprice: null, //物流价格表 + wuliu: null, //物流公司 + baddr: null, + mobile: null, //记录手机 + getu: null, //记录会员信息 + sessionKey: null,//记录会员信息 + openid: null, //记录会员信息 + + to_group: null, //参团传递的数据 + wxapp_buy_obj: null, //微信小程序购买的Object + pk_store: null, //选择的门店 + first_leader: null, //分享会员ID + guide_id: null, //分享导购ID + windowWidth: 0, //整个窗体的宽度 + room_id: null, //直播间分享的房间ID + room_goods_id: null, //直播间分享的商品ID + + }, auth: o, request: a, - onLaunch: function() { - wx.hideTabBar(); + onLaunch: function () { + //初始化美图测肤插件 + // var plugin = requirePlugin('mtSkinSdk'); + // params.login_id = wx.getStorageSync('login_id') || '' // 可将登录id缓存下来,方便下次进入小程序直接获取 + // plugin.setConfig(pluginGD) + + wx.hideTabBar(); this.initExt(); //检查更新 @@ -88,52 +92,52 @@ App({ var clientWidth = wx.getSystemInfoSync().windowWidth; var rpxR = 750 / clientWidth; var calc = wx.getSystemInfoSync().windowHeight * rpxR; - this.globalData.heigth=calc; - this.globalData.windowWidth=clientWidth; + this.globalData.heigth = calc; + this.globalData.windowWidth = clientWidth; - var app=this; - if(!app.globalData.userInfo){ + var app = this; + if (!app.globalData.userInfo) { var user = wx.getStorageSync("userinfo"); - if (user && user.user_id){ - //--生成会员 -- - app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id,{}).then(res=>{ - if(res.data.code==0){ - user=res.data.data; - //-- 小程序会员被解绑了,就要清空会员 -- - if(user['is_weappuser']==0){ - user=null; - app.globalData.userInfo=null; - app.globalData.user_id= 0; - }else{ - app.globalData.userInfo=user; - app.globalData.user_id= user.user_id; - } - wx.setStorageSync("userinfo",user); - }else{ - user=null; - app.globalData.userInfo=null; - app.globalData.user_id= 0; - wx.setStorageSync("userinfo",null); - } - }) + if (user && user.user_id) { + //--生成会员 -- + app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => { + if (res.data.code == 0) { + user = res.data.data; + //-- 小程序会员被解绑了,就要清空会员 -- + if (user['is_weappuser'] == 0) { + user = null; + app.globalData.userInfo = null; + app.globalData.user_id = 0; + } else { + app.globalData.userInfo = user; + app.globalData.user_id = user.user_id; + } + wx.setStorageSync("userinfo", user); + } else { + user = null; + app.globalData.userInfo = null; + app.globalData.user_id = 0; + wx.setStorageSync("userinfo", null); + } + }) } } wx.getSystemInfo({ - success: (res) => { - // console.log(res) - let modelmes = res?res.model:null; //手机品牌 - console.log('手机品牌', modelmes) - if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 - this.globalData.isIpx = true - } - }, + success: (res) => { + // console.log(res) + let modelmes = res ? res.model : null; //手机品牌 + console.log('手机品牌', modelmes) + if (modelmes && modelmes.indexOf('iPhone X') != -1) {  //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 + this.globalData.isIpx = true + } + }, }) - var th=this; + var th = this; var pages = getCurrentPages(); //获取加载的页面 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 - if(!th.globalData.wxapp_buy_obj) { + if (!th.globalData.wxapp_buy_obj) { var turl = "/api/weshop/storeconfig/get/" + th.globalData.setting.stoid; th.promiseGet(turl, {}).then(res => { var o = res; @@ -176,7 +180,7 @@ App({ }) } - else{ + else { var tt = th.globalData.wxapp_buy_obj; if (tt && tt.isout == 1) { th.promiseGet('/api/weshop/store/get/' + t.stoid, {}).then(res => { @@ -202,394 +206,408 @@ App({ }, //---初始化第三方---- - initExt: function() { - var tt=t; + initExt: function () { + var tt = t; console.log("initExt"); console.log(11); var t = wx.getExtConfigSync(), o = this.globalData.setting; console.log(t); - t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; + t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt = 1; }, //首页的第一次登录 - getUserFir(t){ - var s = this; - if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { - if (!o.isAuth()) return o.wxLogin_fir(t); - if (null == s.globalData.userInfo) { - return o.wxLogin_fir(t); + getUserFir(t) { + var s = this; + if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { + if (!o.isAuth()) return o.wxLogin_fir(t); + if (null == s.globalData.userInfo) { + return o.wxLogin_fir(t); + } } - } }, - getUserInfo: function(t, n, i) { + getUserInfo: function (t, n, i) { var s = this; if (o.isAuth()) "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); else { - if (!o.isAuth()) return o.auth(t); - if (null == s.globalData.userInfo){ - return o.auth(t); - } - /*--- - a.get("/api/user/userInfo", { - isShowLoading: void 0 === i || i, - success: function(o) { - s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic), - "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); - } - });--*/ + if (!o.isAuth()) return o.auth(t); + if (null == s.globalData.userInfo) { + return o.auth(t); + } + /*--- + a.get("/api/user/userInfo", { + isShowLoading: void 0 === i || i, + success: function(o) { + s.globalData.userInfo = o.data.result, s.globalData.userInfo.head_pic = e.getFullUrl(s.globalData.userInfo.head_pic), + "function" == typeof t && t(s.globalData.userInfo, s.globalData.wechatUser); + } + });--*/ } }, //----------------获取配置参数-------------------- - getConfig: function(t, o) { - var e = this; - if(!e.globalData.setting.stoid){ - t(null); - return false; - } - if(this.globalData.config==undefined) this.globalData.config=null; - this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, { - success: function(o) { - console.log('getConfig'); - if(o.data.code==0){ + getConfig: function (t, o) { + var e = this; + if (!e.globalData.setting.stoid) { + t(null); + return false; + } + if (this.globalData.config == undefined) this.globalData.config = null; + this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.requestGet("/api/weshop/store/get/" + e.globalData.setting.stoid, { + success: function (o) { + console.log('getConfig', o); + if (o.data.code == 0) { e.globalData.config = o.data.data, "function" == typeof t && t(e.globalData.config); } } }); }, //----------------获取配置参数-------------------- - getConfig2: function (t, o) { - var e = this; - if(!e.globalData.setting.stoid) { - t(null); - return false; - } - this.globalData.config2 && !o ? - "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { - success: function (o) { - console.log('getConfig2'); - if (o.data.code == 0) { - e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); - } - } - }); - }, - - //----------------获取商家开启的物流-------------------- - getwuliu: function (t, o){ - this.globalData.wuliu=null; - var th = this, st = this.globalData.setting; - //获取物流不缓存 - a.get("/api/weshop/storeshipping/list", { - data: { store_id: st.stoid, status: 1, pageSize:2000 }, - success: function (o) { - console.log('getwuliu'); - console.log(o); - if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length>0) { - var arr = o.data.data.pageData; - console.log(arr); - arr.forEach(function(item,index){ - arr[index].code = item.shipping_code; arr[index].name = item.shipping_name; - }) - th.globalData.wuliu = arr, "function" == typeof t && t(arr); - } - } - }); - }, - - //----------------获取物流价格表-------------------- - getwuliuprice: function (t, o) { - var e = this,th=e, st = this.globalData.setting; - //获取物流不缓存 - a.get("/api/weshop/shippingarea/list",{ - data: { store_id: st.stoid,pageSize: 2000 }, - success: function (o) { - console.log('getwuliuprice'); - console.log(o); - if (o.data.code == 0) { - var arr=o.data.data.pageData; - console.log(arr); - if (arr.length>0){ - for (var i = 0; i < arr.length;i++){ - arr[i].code = arr[i].shipping_code; - if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null ) - arr[i].config = JSON.parse(arr[i].json_config); - } - } - th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice); - } + getConfig2: function (t, o) { + var e = this; + if (!e.globalData.setting.stoid) { + t(null); + return false; } - }); - }, + this.globalData.config2 && !o ? + "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { + success: function (o) { + console.log('getConfig2'); + if (o.data.code == 0) { + e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); + } + } + }); + }, + + //----------------获取商家开启的物流-------------------- + getwuliu: function (t, o) { + this.globalData.wuliu = null; + var th = this, st = this.globalData.setting; + //获取物流不缓存 + a.get("/api/weshop/storeshipping/list", { + data: { store_id: st.stoid, status: 1, pageSize: 2000 }, + success: function (o) { + console.log('getwuliu'); + console.log(o); + if (o.data.code == 0 && o.data.data && o.data.data.pageData && o.data.data.pageData.length > 0) { + var arr = o.data.data.pageData; + console.log(arr); + arr.forEach(function (item, index) { + arr[index].code = item.shipping_code; arr[index].name = item.shipping_name; + }) + th.globalData.wuliu = arr, "function" == typeof t && t(arr); + } + } + }); + }, + + //----------------获取物流价格表-------------------- + getwuliuprice: function (t, o) { + var e = this, th = e, st = this.globalData.setting; + //获取物流不缓存 + a.get("/api/weshop/shippingarea/list", { + data: { store_id: st.stoid, pageSize: 2000 }, + success: function (o) { + console.log('getwuliuprice'); + console.log(o); + if (o.data.code == 0) { + var arr = o.data.data.pageData; + console.log(arr); + if (arr.length > 0) { + for (var i = 0; i < arr.length; i++) { + arr[i].code = arr[i].shipping_code; + if (arr[i].json_config != "" && arr[i].json_config != undefined && arr[i].json_config != null) + arr[i].config = JSON.parse(arr[i].json_config); + } + } + th.globalData.wuliuprice = o.data.data, "function" == typeof t && t(e.globalData.wuliuprice); + } + } + }); + }, //----------------设置立即购买数组-------------------- - set_b_now: function (d) { this.globalData.buy_now=d;}, - get_b_now: function () {return this.globalData.buy_now}, + set_b_now: function (d) { this.globalData.buy_now = d; }, + get_b_now: function () { return this.globalData.buy_now }, - getPrevPageData: function(t) { + getPrevPageData: function (t) { void 0 === t && (t = 1); var o = getCurrentPages(); return o[o.length - t - 1].data; }, - showLoading: function(t, o) { + showLoading: function (t, o) { void 0 === o && (o = 1500), wx.showToast({ title: "加载中", icon: "loading", duration: o, mask: !0, - complete: function() { + complete: function () { "function" == typeof t && setTimeout(t, o); } }); }, - showSuccess: function(t, o, a) { + showSuccess: function (t, o, a) { void 0 === a && (a = 1e3), wx.showToast({ title: t, icon: "success", duration: a, mask: !0, - complete: function() { + complete: function () { "function" == typeof o && setTimeout(o, a); } }); }, - showWarning: function(t, o, a, e) { + showWarning: function (t, o, a, e) { //var imghost=this.globalData.setting.imghost; !a && (a = 1500), void 0 === e && (e = !0), wx.showToast({ title: t, mask: e, duration: a, - image:"/images/gt.png", - complete: function() { + image: "/images/gt.png", + complete: function () { "function" == typeof o && setTimeout(o, a); } }); }, - confirmBox: function(t, o) { + confirmBox: function (t, o) { wx.showModal({ title: t, showCancel: !1, - complete: function() { + complete: function () { "function" == typeof o && o(); } }); }, //----------获取所有的门店------------ - get_allsto(func){ - var th=this; - if (this.globalData.picklist!=null){ - "function" == typeof func && func(th.globalData.picklist); - }else{ - th.request.get("/api/weshop/pickup/page", { - data: { store_id: th.globalData.setting.stoid, pageSize: 600 }, - success: function (da) { - //设置门店 - //th.setData({ allsto: da.data.data.pageData }); - th.globalData.picklist = da.data.data.pageData; - "function" == typeof func && func(th.globalData.picklist); - } - }) + get_allsto(func) { + var th = this; + if (this.globalData.picklist != null) { + "function" == typeof func && func(th.globalData.picklist); + } else { + th.request.get("/api/weshop/pickup/page", { + data: { store_id: th.globalData.setting.stoid, pageSize: 600 }, + success: function (da) { + //设置门店 + //th.setData({ allsto: da.data.data.pageData }); + th.globalData.picklist = da.data.data.pageData; + "function" == typeof func && func(th.globalData.picklist); + } + }) } }, //同步化,在调用的时候要await - async get_isbuy(func) { - var th=this - var stoid=os.stoid; - - await this.promiseGet("/store/storemoduleendtime/page?store_id=" +stoid + "&type=5",{}).then(res=>{ - var o=res; - if (o.data.code == 0) { - var ob = { isout: 0, isbuy: 1 }; - var arr = o.data.data.pageData; - var isbuy = 0; - //----如果数组不为空---- - if (arr.length > 0) { - arr.forEach(function (val, ind) { - if (val.is_sy == 0 && val.type == 5) { - isbuy = 1; - var now = ut.gettimestamp(); - if (now > val.end_time) ob.isout = 1; - return false; - } + async get_isbuy(func) { + var th = this + var stoid = os.stoid; + + await this.promiseGet("/store/storemoduleendtime/page?store_id=" + stoid + "&type=5", {}).then(res => { + var o = res; + if (o.data.code == 0) { + var ob = { isout: 0, isbuy: 1 }; + var arr = o.data.data.pageData; + var isbuy = 0; + //----如果数组不为空---- + if (arr.length > 0) { + arr.forEach(function (val, ind) { + if (val.is_sy == 0 && val.type == 5) { + isbuy = 1; + var now = ut.gettimestamp(); + if (now > val.end_time) ob.isout = 1; + return false; + } + }) + } + ob.isbuy = isbuy; + th.globalData.wxapp_buy_obj = ob; + if (func) { + func(); + } + } + }) + }, + //获取场景值 判断是否是单页面 + is_Single_page() { + let scene = wx.getLaunchOptionsSync().scene; + //--先判断会员状态-- + if (scene == 1154) { + wx.showToast({ + title: '请前往小程序', + icon: "error", + duration: 3000, }) - } - ob.isbuy = isbuy; - th.globalData.wxapp_buy_obj=ob; - if(func){ - func(); - } + return false } - }) + return true; }, + //--同步化,在调用的时候要await,获取商家config-- - async getConfig_ays(){ - if(this.globalData.config!=null) return false; - var th=this; - await api.get_config(this.globalData.setting.stoid).then(res=>{ - var o=res; - if(o.data.code==0){ - th.globalData.config = o.data.data; - } - }) + async getConfig_ays() { + if (this.globalData.config != null) return false; + var th = this; + await api.get_config(this.globalData.setting.stoid).then(res => { + var o = res; + if (o.data.code == 0) { + th.globalData.config = o.data.data; + } + }) }, //----智能跳转,判断 非tabBar,tabBar页面的跳转---- - goto:function (url) { - var arr=getCurrentPages(); - if(arr.length>8){ - arr.splice(0, 2); - } - var arr_tabbar=["/pages/index/index/index", - "/pages/goods/categoryList/categoryList", - "/pages/goods/categoryList/categoryList?type=2", - "/pages/goods/categoryList/categoryList?type=1", - "/pages/cart/cart/cart","/pages/user/index/index", - "/pages/distribution/distribution"]; - if(arr_tabbar.indexOf(url)!=-1){ - if(url.indexOf("categoryList?type=1")!=-1) this.globalData.cat_type=1; - if(url.indexOf("categoryList?type=2")!=-1) this.globalData.cat_type=2; - wx.switchTab({url: url,}) //跳到tabbar页 - - }else{ + goto: function (url) { + var arr = getCurrentPages(); + if (arr.length > 8) { + arr.splice(0, 2); + } + var arr_tabbar = ["/pages/index/index/index", + "/pages/goods/categoryList/categoryList", + "/pages/goods/categoryList/categoryList?type=2", + "/pages/goods/categoryList/categoryList?type=1", + "/pages/cart/cart/cart", "/pages/user/index/index", + "/pages/distribution/distribution"]; + if (arr_tabbar.indexOf(url) != -1) { + if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1; + if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2; + wx.switchTab({ url: url, }) //跳到tabbar页 + + } else { if (getCurrentPages().length > 9) { - wx.redirectTo({url: url,}) //跳到非tabbar页 - }else{ - wx.navigateTo({url: url,}) //跳到tabbar页 + wx.redirectTo({ url: url, }) //跳到非tabbar页 + } else { + wx.navigateTo({ url: url, }) //跳到tabbar页 } } //wx.navigateTo({ url: url, }) //跳到非tabbar页 }, //显示提示,word提示内容,type 0失败,提示 1成功 - my_warnning(word,type,that,width){ + my_warnning(word, type, that, width) { var warn = that.selectComponent("#warn"); //组件的id - warn.open(word,type,width); + warn.open(word, type, width); return 1; }, //获取会员门店 - get_user_store:function (func) - { - var th=this; + get_user_store: function (func) { + var th = this; this.getConfig2(function (conf) { //---空会员的情况--- - if(!th.globalData.userInfo){ + if (!th.globalData.userInfo) { return func(null); } - if(!th.globalData.pk_store){ - var pick_id=0; + if (!th.globalData.pk_store) { + var pick_id = 0; //先找一个会员是否有设置默认的地址 - if(th.globalData.userInfo.def_pickup_id){ - pick_id= th.globalData.userInfo.def_pickup_id + if (th.globalData.userInfo.def_pickup_id) { + pick_id = th.globalData.userInfo.def_pickup_id } //查找会员的注册的地址 - else if(th.globalData.userInfo.pickup_id){ + else if (th.globalData.userInfo.pickup_id) { //--购买门店是否默认登记门店-- - if(conf.switch_list){ - var t_swi=JSON.parse(conf.switch_list); - if(t_swi.is_regstores){ - pick_id= th.globalData.userInfo.pickup_id + if (conf.switch_list) { + var t_swi = JSON.parse(conf.switch_list); + if (t_swi.is_regstores) { + pick_id = th.globalData.userInfo.pickup_id } } } //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- - if(pick_id==0) return func(null); - - //返回门店的数量 - th.get_pk_num(function(num){ - //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 - th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ - data:{}, - success:function (res) { - th.globalData.pk_store=null; - if(res.data.code==0 && res.data.data && res.data.data.isstop==0 && res.data.data.is_pos==1){ - - //--门店的数量大于10个才要关心门店的分类有没有关闭-- - if(res.data.data.category_id && num>10){ - th.request.get( "/api/weshop/storagecategory/get/"+os.stoid+"/"+res.data.data.category_id, { - data: {}, - success: function (ee) { - if(ee.data.code==0 && ee.data.data ){ - if(ee.data.data.is_show==1){ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - }else{ - //看一下有没有显示的门店分类 - getApp().request.get("/api/weshop/storagecategory/page", { - data: { - store_id: os.stoid, - is_show: 1, - pageSize: 1, - }, - success: function (ee) { - if(ee.data.code==0){ - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ - func(null); - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - } - }) - } - }else{ + if (pick_id == 0) return func(null); + + //返回门店的数量 + th.get_pk_num(function (num) { + //获取用户注册时候的门店,这个门店不能关闭,同时这个门店的分类不能关闭 + th.request.get("/api/weshop/pickup/get/" + os.stoid + "/" + pick_id, { + data: {}, + success: function (res) { + th.globalData.pk_store = null; + if (res.data.code == 0 && res.data.data && res.data.data.isstop == 0 && res.data.data.is_pos == 1) { + + //--门店的数量大于10个才要关心门店的分类有没有关闭-- + if (res.data.data.category_id && num > 10) { + th.request.get("/api/weshop/storagecategory/get/" + os.stoid + "/" + res.data.data.category_id, { + data: {}, + success: function (ee) { + if (ee.data.code == 0 && ee.data.data) { + if (ee.data.data.is_show == 1) { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } else { + //看一下有没有显示的门店分类 + getApp().request.get("/api/weshop/storagecategory/page", { + data: { + store_id: os.stoid, + is_show: 1, + pageSize: 1, + }, + success: function (ee) { + if (ee.data.code == 0) { + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { + func(null); + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } + }) + } + } else { func(null); - } - } - }) - }else{ - th.globalData.pk_store = res.data.data; - func(th.globalData.pk_store); - } - }else{ - func(null); - } - } - }) - - }) - - }else{ + } + } + }) + } else { + th.globalData.pk_store = res.data.data; + func(th.globalData.pk_store); + } + } else { + func(null); + } + } + }) + + }) + + } else { func(th.globalData.pk_store); } }) }, - - //-- 获取门店的数量 -- - get_pk_num:function(func){ - this.request.get("/api/weshop/pickup/page",{ - data:{page:1,pageSize:1,isstop:0,store_id:os.stoid}, - success:function (res) { - if(res.data.code==0){ - func(res.data.data.total); //门店数量 - } - } - }); - }, + + //-- 获取门店的数量 -- + get_pk_num: function (func) { + this.request.get("/api/weshop/pickup/page", { + data: { page: 1, pageSize: 1, isstop: 0, store_id: os.stoid }, + success: function (res) { + if (res.data.code == 0) { + func(res.data.data.total); //门店数量 + } + } + }); + }, //-------获取购物车数量---------- - requestCardNum: function(th) { - if(!this.globalData.user_id) return false; - var that=this; + requestCardNum: function (th) { + if (!this.globalData.user_id) return false; + var that = this; this.request.get("/api/weshop/cart/page", { - isShoeLoading:false, + isShoeLoading: false, data: { store_id: this.globalData.setting.stoid, user_id: this.globalData.user_id, - state:0, - is_gift:0, - pageSize:300 + state: 0, + is_gift: 0, + pageSize: 300 }, - success: function(e) { + success: function (e) { var num = 0; - if(e.data.data && e.data.data.pageData) { + if (e.data.data && e.data.data.pageData) { for (var i = 0; i < e.data.data.pageData.length; i++) { num += e.data.data.pageData[i].goods_num; } @@ -600,131 +618,131 @@ App({ text: '' + num //显示的内容 });--*/ //-- 读取服务卡的数量 -- - that.promiseGet("/api/weshop/cartService/page",{ - data:{ + that.promiseGet("/api/weshop/cartService/page", { + data: { store_id: that.globalData.setting.stoid, user_id: that.globalData.user_id, } - }).then(res=>{ + }).then(res => { for (var i = 0; i < res.data.data.pageData.length; i++) { num += res.data.data.pageData[i].goods_num; } - that.globalData.cartGoodsNum=num; + that.globalData.cartGoodsNum = num; th.data.up_dating = 0 - th.getTabBar().setData({cartGoodsNum:num}); + th.getTabBar().setData({ cartGoodsNum: num }); }) } }); }, - - //------定时等待某个值,有值才进行运算-------- - waitfor:function(page,key,pop_value,func){ - var n=0; - if(!page.data[key]){ - page.data[key]=setInterval(function(){ - console.log(page.data[key]);n++; - if(pop_value) { - clearInterval(page.data[key]); - func(); - } - if(n>15) clearInterval(page.data[key]); - },1000); - } - }, - - //------定时等待某个值,有值才进行运算-------- - waitfor2:function(page,key,pop_value_key,func){ - var n=0; - if(!page.data[key]){ - page.data[key]=setInterval(function(){ - console.log(page.data[key]);n++; - if(page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length>0) { - clearInterval(page.data[key]); - func(); - } - if(n>15){ + + //------定时等待某个值,有值才进行运算-------- + waitfor: function (page, key, pop_value, func) { + var n = 0; + if (!page.data[key]) { + page.data[key] = setInterval(function () { + console.log(page.data[key]); n++; + if (pop_value) { clearInterval(page.data[key]); func(); } - },1000); - } - }, + if (n > 15) clearInterval(page.data[key]); + }, 1000); + } + }, + + //------定时等待某个值,有值才进行运算-------- + waitfor2: function (page, key, pop_value_key, func) { + var n = 0; + if (!page.data[key]) { + page.data[key] = setInterval(function () { + console.log(page.data[key]); n++; + if (page.data[pop_value_key] && Object.keys(page.data[pop_value_key]).length > 0) { + clearInterval(page.data[key]); + func(); + } + if (n > 15) { + clearInterval(page.data[key]); + func(); + } + }, 1000); + } + }, //清空登录时候缓存的值 - onHide:function () { - this.globalData.is_test=0; - this.globalData.guide_id=null; //导购清空 - this.globalData.first_leader=null; //分享的会员清空 - this.globalData.wuliu=null; //关闭要把物流清空 - this.globalData.room_id=null; //关闭要把房间号关闭 - this.globalData.room_goods_id=null; //关闭要把物流清空 - this.globalData.config2=null; //清除config2的缓存 - this.globalData.config=null; //清除config的缓存 - this.globalData.gr_index=0; //商品分组的序列 - this.globalData.pk_store=null; - this.globalData.wxapp_buy_obj=null; - this.globalData.dis_buy_obj=null; //等级卡的购买记录 - this.globalData.storeFooter=null; //底部的导航 - this.globalData.full_screen=null; //全屏 - - }, - - clear_word:function (word) { - - var str=word; - let reg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n])|(\s)/g , - indexArr = reg.exec(str); - if(str.match(reg)) { - str = str.replace(reg, ''); + onHide: function () { + this.globalData.is_test = 0; + this.globalData.guide_id = null; //导购清空 + this.globalData.first_leader = null; //分享的会员清空 + this.globalData.wuliu = null; //关闭要把物流清空 + this.globalData.room_id = null; //关闭要把房间号关闭 + this.globalData.room_goods_id = null; //关闭要把物流清空 + this.globalData.config2 = null; //清除config2的缓存 + this.globalData.config = null; //清除config的缓存 + this.globalData.gr_index = 0; //商品分组的序列 + this.globalData.pk_store = null; + this.globalData.wxapp_buy_obj = null; + this.globalData.dis_buy_obj = null; //等级卡的购买记录 + this.globalData.storeFooter = null; //底部的导航 + this.globalData.full_screen = null; //全屏 + + }, + + clear_word: function (word) { + + var str = word; + let reg = /([^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n])|(\s)/g, + indexArr = reg.exec(str); + if (str.match(reg)) { + str = str.replace(reg, ''); + } + return str; + }, + + getPageIndex: function (curPage) { + + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + + var index = 0; + + if (this.globalData.custum_data) { + var itemList = this.globalData.custum_data.data; + itemList = JSON.parse(itemList); + for (var i in itemList) { + var item = itemList[i] + if (pagePath.indexOf(item.weappurl) != -1) { + index = i; break; + } } - return str; - }, - - getPageIndex:function(curPage){ - - var pagePath = curPage.route; //当前页面url - if (pagePath.indexOf('/') != 0) { - pagePath = '/' + pagePath; - } - - var index=0; - - if(this.globalData.custum_data){ - var itemList = this.globalData.custum_data.data; - itemList = JSON.parse(itemList); - for(var i in itemList){ - var item=itemList[i] - if(pagePath.indexOf(item.weappurl)!=-1){ - index=i;break; - } - } - - }else{ - var itemList=this.def_list; - for(var i in itemList){ - var item=itemList[i] - if(pagePath.indexOf(item.weappurl)!=-1){ - index=i;break; - } - } - } - return index; - - }, + + } else { + var itemList = this.def_list; + for (var i in itemList) { + var item = itemList[i] + if (pagePath.indexOf(item.weappurl) != -1) { + index = i; break; + } + } + } + return index; + + }, //---promise的使用get---- - promiseGet:function(url,data){ - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; + promiseGet: function (url, data) { + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url; return new Promise((resolve, reject) => { data.isShowLoading && wx.showLoading(); wx.request({ url, method: 'GET', - header: {"content-type": "application/x-www-form-urlencoded" }, - data:data.data, + header: { "content-type": "application/x-www-form-urlencoded" }, + data: data.data, success(res) { data.isShowLoading && wx.hideLoading(); resolve(res); @@ -736,40 +754,40 @@ App({ //---promise的使用get---- - requestGet:function(url,data){ - if(url.indexOf("http")==-1) url=this.globalData.setting.url +url; - data.isShowLoading && wx.showLoading(); - wx.request({ - url, - method: 'GET', - header: {"content-type": "application/x-www-form-urlencoded" }, - data:data.data, - success(res) { - data.isShowLoading && wx.hideLoading(); - data.success(res); - }, - fail(err) { - data.isShowLoading && wx.hideLoading(); - if(data.fail) data.fail(err); - } - }) + requestGet: function (url, data) { + if (url.indexOf("http") == -1) url = this.globalData.setting.url + url; + data.isShowLoading && wx.showLoading(); + wx.request({ + url, + method: 'GET', + header: { "content-type": "application/x-www-form-urlencoded" }, + data: data.data, + success(res) { + data.isShowLoading && wx.hideLoading(); + data.success(res); + }, + fail(err) { + data.isShowLoading && wx.hideLoading(); + if (data.fail) data.fail(err); + } + }) + }, + + + // 判断是否登录 + isLogin() { + return new Promise(function (resolve, reject) { + let user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + } else { + resolve(user_info); + }; + }); }, - - - // 判断是否登录 - isLogin() { - return new Promise(function(resolve, reject) { - let user_info = getApp().globalData.userInfo; - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - wx.navigateTo({ - url: '/pages/togoin/togoin', - }) - return false; - } else { - resolve(user_info); - }; - }); - }, checkUpdateVersion() { @@ -781,17 +799,17 @@ App({ return false; } //检测版本更新 - updateManager.onCheckForUpdate(function(res) { + updateManager.onCheckForUpdate(function (res) { console.log('是否获取版本'); // 请求完新版本信息的回调 if (res.hasUpdate) { //监听小程序有版本更新事件 - updateManager.onUpdateReady(function() { + updateManager.onUpdateReady(function () { //TODO 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 ( 此处进行了自动更新操作) updateManager.applyUpdate(); }) - updateManager.onUpdateFailed(function() { + updateManager.onUpdateFailed(function () { // 新版本下载失败 wx.showModal({ title: '已经有新版本喽~', @@ -812,6 +830,6 @@ App({ - + }); diff --git a/app.json b/app.json index 15d90df..09d21a7 100644 --- a/app.json +++ b/app.json @@ -155,7 +155,6 @@ "pages/video/index", "pages/boxes-list/boxes-list", "pages/boxes-details/boxes-details" - ] }, { @@ -193,8 +192,15 @@ "pages/AI-test-skin/fail_result/fail_result", "pages/AI-test-skin/success_result/success_result", "pages/AI-test-skin/analyse/analyse" - ] + ], + "plugins": { + "mtSkinSdk": { + "version": "1.4.2", + "provider": "wx3636b350f8484f20" + } + } } + ], "permission": { "scope.userLocation": { @@ -256,4 +262,5 @@ "useExtendedLib": { "weui": true } + } \ No newline at end of file diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 495e6ba..b747798 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -209,7 +209,9 @@ Page({ //------初始化加载---------- onLoad: function(t) { - + if(!getApp().is_Single_page()){ + return false; + } self = this; this.data.options = t; // { goods_id: ...} diff --git a/packageA/pages/jfbuy/jfbuy.js b/packageA/pages/jfbuy/jfbuy.js index 1e5edd9..de31b5b 100644 --- a/packageA/pages/jfbuy/jfbuy.js +++ b/packageA/pages/jfbuy/jfbuy.js @@ -65,6 +65,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } var th=this; this.data.requestData={ store_id:oo.stoid, diff --git a/packageA/pages/liveStream/liveStream.js b/packageA/pages/liveStream/liveStream.js index 4027ba0..637bd7f 100644 --- a/packageA/pages/liveStream/liveStream.js +++ b/packageA/pages/liveStream/liveStream.js @@ -208,6 +208,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } self = this; // console.log('ppppp',this.pageTotal(4, 10)); diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index 47df26f..babfe12 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -123,6 +123,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } console.log(options, 111); self = this; var the_id = options.id; diff --git a/packageB/pages/zuhegou/preindex/index.js b/packageB/pages/zuhegou/preindex/index.js index 3ec6801..b875711 100644 --- a/packageB/pages/zuhegou/preindex/index.js +++ b/packageB/pages/zuhegou/preindex/index.js @@ -123,6 +123,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } console.log(options, 111); self = this; var the_id = options.id; diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 64ce889..b03a1a9 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -285,7 +285,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { - + if(!getApp().is_Single_page()){ + return false; + } // console.log('onload'); if(t && t.group_id) { this.data.group_id = t.group_id; diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 284314f..753d4eb 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -252,6 +252,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } var ee = this, that = ee, th = ee, pre_id = t.pre_id, gid = t.goods_id, diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js index ac5fbb2..412d4c7 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js @@ -252,6 +252,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } var ee = this, that = ee, th = ee, pre_id = t.pre_id, gid = t.goods_id, diff --git a/packageD/pages/AI-test-skin/analyse/analyse.js b/packageD/pages/AI-test-skin/analyse/analyse.js index 1fe48f0..b820186 100644 --- a/packageD/pages/AI-test-skin/analyse/analyse.js +++ b/packageD/pages/AI-test-skin/analyse/analyse.js @@ -4,6 +4,7 @@ const request = app.request; const os = app.globalData; const setting = os.setting; const ut = require('../../../../utils/util'); +import { pluginGD } from '../../../ai_config/config' Page({ /** @@ -11,171 +12,174 @@ Page({ */ data: { iurl: setting.imghost, - per:0, - timer:0, - img:null, - sourceimg:null, - err_map:null, + per: 0, + timer: 0, + img: null, + sourceimg: null, + err_map: null, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var th=this; - //设置错误码分析 - this.set_err_map(); - //进度条加载 - this.timer(); - //接口开始分析 - setTimeout(function () { - //th.analysis_img(); - //先检验一下图片 - th.img_check(function () { - - }); - },800) + //初始化美图测肤插件 + var plugin = requirePlugin('mtSkinSdk') + plugin.setConfig(pluginGD) + var th = this; + //设置错误码分析 + this.set_err_map(); + //进度条加载 + this.timer(); + //接口开始分析 + setTimeout(function () { + //th.analysis_img(); + //先检验一下图片 + th.mt_check(function () { + + }); + }, 800) }, //定时器 - timer:function (func) { - var per=this.data.per+5; - var th=this; - if(per<96){ - th.setData({per:per}); - setTimeout(function () { - th.timer(); - },400) - } + timer: function (func) { + var per = this.data.per + 5; + var th = this; + if (per < 96) { + th.setData({ per: per }); + setTimeout(function () { + th.timer(); + }, 400) + } }, //错误码表 - set_err_map:function () { - var map={ - "2":"服务暂不可用", - "4":"集群超限额", - "6":"没有接口权限", - "17":"每天流量超限额", - "18":"QPS超限额", - "19":"请求总量超限额", - "100":"无效的access_token参数", - "110":"Access Token失效", - "111":" Access token过期", - "222001":"必要参数未传入", - "222002":"参数格式错误", - "222003":"参数格式错误", - "222004":"参数格式错误", - "222005":"参数格式错误", - "222006":"参数格式错误", - "222007":"参数格式错误", - "222008":"参数格式错误", - "222009":"参数格式错误", - "222010":"参数格式错误", - "222011":"参数格式错误", - "222012":"参数格式错误", - "222013":"参数格式错误", - "222014":"参数格式错误", - "222015":"参数格式错误", - "222016":"参数格式错误", - "222017":"参数格式错误", - "222018":"参数格式错误", - "222019":"参数格式错误", - "222020":"参数格式错误", - "222021":"参数格式错误", - "222022":"身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。", - "222023":"参数格式错误", - "222024":"参数格式错误", - "222025":"参数格式错误", - "222026":"参数格式错误", - "222027":"验证码长度错误(最小值大于最大值)", - "222028":"参数格式错误", - "222029":"参数格式错误", - "222030":"参数格式错误", - "222039":"参数格式错误", - "222200":"该接口需使用application/json的格式进行请求", - "222201":"服务端请求失败", - "222202":"图片中没有人脸", - "222203":"无法解析人脸", - "222204":"从图片的url下载图片失败", - "222205":"服务端请求失败", - "222206":"服务端请求失败", - "222207":"未找到匹配的用户", - "222208":"图片的数量错误", - "222209":"face token不存在", - "222210":"人脸库中用户下的人脸数目超过限制", - "222300":"人脸图片添加失败", - "222301":"获取人脸图片失败", - "222302":"服务端请求失败", - "222303":"获取人脸图片失败", - "222152":"人脸属性编辑,target参数错误", - "222514":"人脸属性编辑v2调用服务失败,请重试", - "223100":"操作的用户组不存在", - "223101":"该用户组已存在", - "223102":"找不到该用户", - "223103":"找不到该用户", - "223104":"group_list包含组数量过多", - "223105":"该人脸已存在", - "223106":"该人脸不存在", - "223107":"人脸库中人脸复制时源组与目标组的scene_type不同", - "223110":"uid_list包含数量过多", - "223111":"目标用户组不存在", - "223112":"quality_conf格式不正确", - "223113":"人脸有被遮挡", - "223114":"人脸模糊", - "223115":"人脸光照不好", - "223116":"人脸不完整", - "223117":"app_list包含app数量过多", - "223118":"质量控制项错误", - "223119":"活体控制项错误", - "223120":"活体检测未通过", - "223121":"质量检测未通过 左眼遮挡程度过高", - "223122":"质量检测未通过 右眼遮挡程度过高", - "223123":"质量检测未通过 左脸遮挡程度过高", - "223124":"质量检测未通过 右脸遮挡程度过高", - "223125":"质量检测未通过 下巴遮挡程度过高", - "223126":"质量检测未通过 鼻子遮挡程度过高", - "223127":"质量检测未通过 嘴巴遮挡程度过高", - "222901":"参数校验初始化失败", - "222902":"参数校验初始化失败", - "222903":"参数校验初始化失败", - "222904":"参数校验初始化失败", - "222905":"接口初始化失败", - "222906":"接口初始化失败", - "222907":"缓存处理失败", - "222908":"缓存处理失败", - "222909":"缓存处理失败", - "222910":"数据存储处理失败", - "222911":"数据存储处理失败", - "222912":"数据存储处理失败", - "222913":"接口初始化失败", - "222914":"接口初始化失败", - "222915":"后端服务连接失败", - "222916":"后端服务连接失败", - "222304":"图片尺寸太大", - "222305":"当前版本不支持图片存储", - "223128":"正在清理该用户组的数据", - "223136":"该组内存在关联图片,无法新建相同名称组", - "222361":"公安服务连接失败", - "222046":"参数格式错误", - "222101":"参数格式错误", - "222102":"参数格式错误", - "222307":"图片非法 鉴黄未通过", - "222308":"图片非法 含有政治敏感人物", - "222211":"人脸融合失败 模板图质量不合格", - "222212":"人脸融合失败", - "223129":"人脸未面向正前方(人脸的角度信息大于30度)", - "223130":"spoofing_control参数格式错误", - "223131":"合成图检测未通过", - "223201":"请求参数scene_type 格式错误", - "223202":"识别时请求的scene_type与group设置的scene_type不匹配", - } - this.setData({err_map:map}); + set_err_map: function () { + var map = { + "2": "服务暂不可用", + "4": "集群超限额", + "6": "没有接口权限", + "17": "每天流量超限额", + "18": "QPS超限额", + "19": "请求总量超限额", + "100": "无效的access_token参数", + "110": "Access Token失效", + "111": " Access token过期", + "222001": "必要参数未传入", + "222002": "参数格式错误", + "222003": "参数格式错误", + "222004": "参数格式错误", + "222005": "参数格式错误", + "222006": "参数格式错误", + "222007": "参数格式错误", + "222008": "参数格式错误", + "222009": "参数格式错误", + "222010": "参数格式错误", + "222011": "参数格式错误", + "222012": "参数格式错误", + "222013": "参数格式错误", + "222014": "参数格式错误", + "222015": "参数格式错误", + "222016": "参数格式错误", + "222017": "参数格式错误", + "222018": "参数格式错误", + "222019": "参数格式错误", + "222020": "参数格式错误", + "222021": "参数格式错误", + "222022": "身份证号不符合要求,备注:中国大陆身份证号的每一位数字都有其生成规则,不可随意填写。", + "222023": "参数格式错误", + "222024": "参数格式错误", + "222025": "参数格式错误", + "222026": "参数格式错误", + "222027": "验证码长度错误(最小值大于最大值)", + "222028": "参数格式错误", + "222029": "参数格式错误", + "222030": "参数格式错误", + "222039": "参数格式错误", + "222200": "该接口需使用application/json的格式进行请求", + "222201": "服务端请求失败", + "222202": "图片中没有人脸", + "222203": "无法解析人脸", + "222204": "从图片的url下载图片失败", + "222205": "服务端请求失败", + "222206": "服务端请求失败", + "222207": "未找到匹配的用户", + "222208": "图片的数量错误", + "222209": "face token不存在", + "222210": "人脸库中用户下的人脸数目超过限制", + "222300": "人脸图片添加失败", + "222301": "获取人脸图片失败", + "222302": "服务端请求失败", + "222303": "获取人脸图片失败", + "222152": "人脸属性编辑,target参数错误", + "222514": "人脸属性编辑v2调用服务失败,请重试", + "223100": "操作的用户组不存在", + "223101": "该用户组已存在", + "223102": "找不到该用户", + "223103": "找不到该用户", + "223104": "group_list包含组数量过多", + "223105": "该人脸已存在", + "223106": "该人脸不存在", + "223107": "人脸库中人脸复制时源组与目标组的scene_type不同", + "223110": "uid_list包含数量过多", + "223111": "目标用户组不存在", + "223112": "quality_conf格式不正确", + "223113": "人脸有被遮挡", + "223114": "人脸模糊", + "223115": "人脸光照不好", + "223116": "人脸不完整", + "223117": "app_list包含app数量过多", + "223118": "质量控制项错误", + "223119": "活体控制项错误", + "223120": "活体检测未通过", + "223121": "质量检测未通过 左眼遮挡程度过高", + "223122": "质量检测未通过 右眼遮挡程度过高", + "223123": "质量检测未通过 左脸遮挡程度过高", + "223124": "质量检测未通过 右脸遮挡程度过高", + "223125": "质量检测未通过 下巴遮挡程度过高", + "223126": "质量检测未通过 鼻子遮挡程度过高", + "223127": "质量检测未通过 嘴巴遮挡程度过高", + "222901": "参数校验初始化失败", + "222902": "参数校验初始化失败", + "222903": "参数校验初始化失败", + "222904": "参数校验初始化失败", + "222905": "接口初始化失败", + "222906": "接口初始化失败", + "222907": "缓存处理失败", + "222908": "缓存处理失败", + "222909": "缓存处理失败", + "222910": "数据存储处理失败", + "222911": "数据存储处理失败", + "222912": "数据存储处理失败", + "222913": "接口初始化失败", + "222914": "接口初始化失败", + "222915": "后端服务连接失败", + "222916": "后端服务连接失败", + "222304": "图片尺寸太大", + "222305": "当前版本不支持图片存储", + "223128": "正在清理该用户组的数据", + "223136": "该组内存在关联图片,无法新建相同名称组", + "222361": "公安服务连接失败", + "222046": "参数格式错误", + "222101": "参数格式错误", + "222102": "参数格式错误", + "222307": "图片非法 鉴黄未通过", + "222308": "图片非法 含有政治敏感人物", + "222211": "人脸融合失败 模板图质量不合格", + "222212": "人脸融合失败", + "223129": "人脸未面向正前方(人脸的角度信息大于30度)", + "223130": "spoofing_control参数格式错误", + "223131": "合成图检测未通过", + "223201": "请求参数scene_type 格式错误", + "223202": "识别时请求的scene_type与group设置的scene_type不匹配", + } + this.setData({ err_map: map }); }, /** * 生命周期函数--监听页面显示 */ - onShow: function (){ }, + onShow: function () { }, /** * 生命周期函数--监听页面隐藏 @@ -199,159 +203,317 @@ Page({ }, + mt_check() { + let img_info = getApp().globalData.skin_img_info; + var plugin = requirePlugin('mtSkinSdk'); + let th = this; + plugin.facePoseCorrect({ + path: img_info['path'], + size: img_info['size'], + success(res) { + console.log('=========姿态校正 成功==========') + console.log('姿态校正结果', res) + let analyse_info = res.data; + //检查闭眼情况 + if (analyse_info.analyse_info) { + //检查睁眼闭眼 + let { left, right } = analyse_info.analyse_info; + if (left !== 2 || right !== 2) { + var msg = "未闭眼拍照"; + th.go_error(msg); + return false; + } + } + //检查佩戴情况 + if (analyse_info.faceGlasses) { + let { none, normal, sunglasses } = analyse_info.faceGlasses; + if (normal > 0.8 || sunglasses > 0.8 || none < 0.1) { + var msg = "有佩戴眼镜"; + th.go_error(msg); + return false; + } + } + //检查框里情况 + if (analyse_info.faceOutDetect.outBound == 1) { + var msg = "未在取景框内"; + th.go_error(msg); + return false; + } + // if (analyse_info.facePoseEuler) { + // let { pitch, roll, yaw } = analyse_info.facePoseEuler; + // if (normal > 0.8 || sunglasses > 0.8 || none < 0.1) { + // var msg = "有佩戴眼镜"; + // th.go_error(msg); + // return false; + // } + // } + //检查环境情况 + if (analyse_info.faceQuality) { + let { bright, blur, compression } = analyse_info.faceQuality; + if (bright > 80) { + var msg = "亮度过亮"; + th.go_error(msg); + return false; + } + if (bright < 20 || blur < 20) { + var msg = "亮度过暗或图片过于模糊"; + th.go_error(msg); + return false; + } + } + //检查距离 + if (analyse_info.faceRatio < 0.2) { + var msg = "距离过远"; + th.go_error(msg); + return false; + } + if (analyse_info.faceRatio > 0.8) { + var msg = "距离过近"; + th.go_error(msg); + return false; + } + //检查遮挡物 + if (analyse_info.faceVisibility) { + var msg = ""; + let fail = Object.keys(analyse_info.faceVisibility).filter(key => { + return analyse_info.faceVisibility[key] <= 80; + }) + console.log('fail', fail); + switch (fail[0]) { + case "jaw": + msg = "下巴有遮挡"; + break; + case "leftcheek": + msg = "左脸有遮挡"; + break; + case "lefteye": + msg = "左眼有遮挡"; + break; + case "lefteyebrow": + msg = "左眉毛有遮挡"; + break; + case "mouse": + msg = "嘴巴有遮挡"; + break; + case "nose": + msg = "鼻子有遮挡"; + break; + case "rightcheek": + msg = "右脸有遮挡"; + break; + case "righteye": + msg = "右眼有遮挡"; + break; + case "rightyebrow": + msg = "右眉毛有遮挡"; + break; + } + if (msg) { + th.go_error(msg); + return false; + } + } + th.analyse_by_mtapi(img_info); + }, + fail(err) { + th.go_error('识别有误,请重试'); + return false; + } + }) + + }, + + analyse_by_mtapi(img_info) { + // let img_info = getApp().globalData.skin_img_info; + let th = this; + var plugin = requirePlugin('mtSkinSdk') + plugin.detectImage({ + path: img_info['path'], + size: img_info['size'], + success(res) { + console.log('=========用户传图片链接获取检测结果 成功==========') + console.log('检测结果', res); + let req_data = { + store_id: setting.stoid, + user_id: getApp().globalData.user_id, + img: getApp().globalData.face_img, + sourceimg: getApp().globalData.face_SourceImg, + addtime: ut.gettimestamp(), + resultjson: JSON.stringify(res.data.data), + detectjson: JSON.stringify(th.data.check_data) + } + //要保存一下分析的结果 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { + if (res.data.code == 0) { + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页 + wx.redirectTo({ + url: url + }) + } else { + getApp().showWarning("保存失败"); + } + }) + }, + fail(err) { + console.error('=========用户传图片链接获取检测结果 失败==========') + console.log('error', err) + } + }) + }, + //检查图片有没有OK - img_check:function (func) { - var th=this; - var data={ + img_check: function (func) { + var th = this; + var data = { "appid": "25521854", "image": getApp().globalData.face_SourceImg, "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing", "image_type": "URL" } //开始调用接口,进行对图片进行判断是否符合标准 - this.json_post("/api/weshop/baidubce/face/skindetect",data,function (res) { - if(res.data.code==0){ + this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) { + if (res.data.code == 0) { //检查的字段存储 - var check_data=th.data.check_data=res.data.data; - check_data=check_data.face_list[0]; + var check_data = th.data.check_data = res.data.data; + check_data = check_data.face_list[0]; console.log(check_data); //检查睁眼闭眼 - var eye_status=check_data.eye_status; - if(eye_status.left_eye>0.1 || eye_status.right_eye>0.1) { - var msg="未闭眼拍照"; + var eye_status = check_data.eye_status; + if (eye_status.left_eye > 0.1 || eye_status.right_eye > 0.1) { + var msg = "未闭眼拍照"; th.go_error(msg); return false; } //检查是不是有带眼镜 - if(check_data.glasses.type!='none'){ - var msg="有佩戴眼镜"; + if (check_data.glasses.type != 'none') { + var msg = "有佩戴眼镜"; th.go_error(msg); return false; } //检查头部的角度 - var angle=check_data.angle; - if(Math.abs(angle.Pitch)>20) { - var msg="头部的俯仰角度过大"; + var angle = check_data.angle; + if (Math.abs(angle.Pitch) > 20) { + var msg = "头部的俯仰角度过大"; th.go_error(msg); return false; } - if(Math.abs(angle.Roll)>20) { - var msg="头部的平面角度过大"; + if (Math.abs(angle.Roll) > 20) { + var msg = "头部的平面角度过大"; th.go_error(msg); return false; } - if(Math.abs(angle.Yaw)>20) { - var msg="头部的左右角度过大"; + if (Math.abs(angle.Yaw) > 20) { + var msg = "头部的左右角度过大"; th.go_error(msg); return false; } - var quality=check_data.quality; - if(quality.blur>0.7){ - var msg="图片模糊"; + var quality = check_data.quality; + if (quality.blur > 0.7) { + var msg = "图片模糊"; th.go_error(msg); return false; } //开始检查遮挡 - var occlusion=check_data.quality.occlusion; - if(occlusion.left_eye >0.6){ - var msg="左眼被遮挡"; + var occlusion = check_data.quality.occlusion; + if (occlusion.left_eye > 0.6) { + var msg = "左眼被遮挡"; th.go_error(msg); return false; } - if(occlusion.right_eye>0.6){ - var msg="右眼被遮挡"; + if (occlusion.right_eye > 0.6) { + var msg = "右眼被遮挡"; th.go_error(msg); return false; } - if(occlusion.nose>0.7){ - var msg="鼻子被遮挡"; + if (occlusion.nose > 0.7) { + var msg = "鼻子被遮挡"; th.go_error(msg); return false; } - if(occlusion.mouth>0.7){ - var msg="嘴巴被遮挡"; + if (occlusion.mouth > 0.7) { + var msg = "嘴巴被遮挡"; th.go_error(msg); return false; } - if(occlusion.left_cheek >0.8){ - var msg="左脸颊被遮挡"; + if (occlusion.left_cheek > 0.8) { + var msg = "左脸颊被遮挡"; th.go_error(msg); return false; } - if(occlusion.right_cheek >0.8){ - var msg="右脸颊被遮挡"; + if (occlusion.right_cheek > 0.8) { + var msg = "右脸颊被遮挡"; th.go_error(msg); return false; } - if(occlusion.chin_contour >0.6){ - var msg="下巴颊被遮挡"; + if (occlusion.chin_contour > 0.6) { + var msg = "下巴颊被遮挡"; th.go_error(msg); return false; } - if(quality.illumination<40){ - var msg="图像光照不足"; + if (quality.illumination < 40) { + var msg = "图像光照不足"; th.go_error(msg); return false; } - if(quality.completeness=0){ - var msg="人脸未显示完整"; + if (quality.completeness = 0) { + var msg = "人脸未显示完整"; th.go_error(msg); return false; } //-- 开始调用分析的接口 -- - var face_token=check_data.face_token; - var data={ + var face_token = check_data.face_token; + var data = { "image": face_token, "face_field": "color,smooth,acnespotmole,wrinkle,eyesattr,blackheadpore,skinface,skinquality", "image_type": "FACE_TOKEN" } th.analysis_img(data); - }else{ - var msg=th.data.err_map[res.data.code+""]; + } else { + var msg = th.data.err_map[res.data.code + ""]; th.go_error(msg); } }) }, - + //跳转到错误页面 - go_error:function (msg) { - let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 + go_error: function (msg) { + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 wx.redirectTo({ url: url }); }, - analysis_img:function (data) { - var th=this; + analysis_img: function (data) { + var th = this; //开始调用接口,进行分析 - this.json_post("/api/weshop/baidubce/face/skinAnalyze",data,function (res) { - if(res.data.code==0){ - getApp().globalData.face_result=res.data.data; - var req_data={ - store_id:setting.stoid, - user_id:getApp().globalData.user_id, - img:getApp().globalData.face_img, - sourceimg:getApp().globalData.face_SourceImg, - addtime:ut.gettimestamp(), - resultjson:JSON.stringify(res.data.data), - detectjson:JSON.stringify(th.data.check_data) + this.json_post("/api/weshop/baidubce/face/skinAnalyze", data, function (res) { + if (res.data.code == 0) { + getApp().globalData.face_result = res.data.data; + var req_data = { + store_id: setting.stoid, + user_id: getApp().globalData.user_id, + img: getApp().globalData.face_img, + sourceimg: getApp().globalData.face_SourceImg, + addtime: ut.gettimestamp(), + resultjson: JSON.stringify(res.data.data), + detectjson: JSON.stringify(th.data.check_data) } //要保存一下分析的结果 - th.json_post("/api/weshop/face/storeSkinface/save",req_data,function (res) { - if(res.data.code==0){ - let url = "/packageD/pages/AI-test-skin/success_result/success_result?id="+res.data.data.id; //跳到分析页 + th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { + if (res.data.code == 0) { + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页 wx.redirectTo({ url: url }) - }else{ + } else { getApp().showWarning("保存失败"); } }) - }else{ - var msg=th.data.err_map[res.data.code+""]; - let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 + } else { + var msg = th.data.err_map[res.data.code + ""]; + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 wx.redirectTo({ - url: url + url: url }) } }) @@ -363,10 +525,10 @@ Page({ * @param {Object} succ //成功的回调 * @param {Object} fail //失败的回调 */ - json_post:function(url,data,succ,fail,mathod){ - var Mathod="POST"; + json_post: function (url, data, succ, fail, mathod) { + var Mathod = "POST"; if (mathod) Mathod = mathod; - if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url; var str = JSON.stringify(data); wx.request({ url: url, @@ -375,8 +537,8 @@ Page({ header: { 'content-type': 'application/json' },// 设置请求的 header - success: function (res) {succ(res); }, - fail:function(res){fail(res);} + success: function (res) { succ(res); }, + fail: function (res) { fail(res); } }) }, diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index e6c1775..af4770e 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -22,6 +22,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } wx.setNavigationBarTitle({ title: "天天拼单", }) diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index 0c27e38..c732c09 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -21,6 +21,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } wx.setNavigationBarTitle({ title: "商品秒杀", }) diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 34c9d82..6d890ba 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -29,6 +29,9 @@ Page({ first_leader: e.globalData.first_leader || 0, // 推荐人ID }, onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } var th = this; var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open_cancel(0); diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 06a7141..61d9712 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -32,6 +32,9 @@ Page({ first_leader: e.globalData.first_leader || 0, // 推荐人ID }, onLoad: function (options) { + if(!getApp().is_Single_page()){ + return false; + } var th = this; th.setData({ isBuy: options.isBuy, @@ -40,7 +43,7 @@ Page({ getUserID: d.user_id, }) - if(options.lbId) th.data.lbId=options.lbId; + if (options.lbId) th.data.lbId = options.lbId; //-- 获取分享人的ID -- var first_leader = options.first_leader || getApp().globalData.first_leader; if (first_leader) { @@ -62,6 +65,10 @@ Page({ onShow: function () { //--先判断会员状态-- var user_info = getApp().globalData.userInfo; + + if(!getApp().is_Single_page()){ + return false; + } if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { getApp().goto('/pages/togoin/togoin'); return false; @@ -415,13 +422,13 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader="+ this.data.getUserID; + pagePath += "?isBuy=1" + "&lbId=" + this.data.getGiftID + "&first_leader=" + this.data.getUserID; // if (this.data.isBuy == 0) { // pagePath += "&orderSn=" + this.data.orderSn; // } else { // pagePath += "&lbId=" + this.data.getGiftID; // } - // console.log('pagePath', pagePath); + // console.log('pagePath', pagePath); return { title: "礼包详情", path: pagePath, @@ -437,12 +444,13 @@ Page({ if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader="+ this.data.getUserID; + pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID; // if (this.data.isBuy == 0) { // pagePath += "&orderSn=" + this.data.orderSn; // } else { // pagePath += "&lbId=" + this.data.getGiftID; // } + console.log('pagePath', pagePath); return { title: "礼包详情", path: pagePath, @@ -496,7 +504,7 @@ Page({ getApp().my_warnning(res.data.msg, 0, th); } }, - function (res) {} + function (res) { } ) }) diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 0fb7f7d..0f38239 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -30,6 +30,9 @@ Page({ }, onLoad: function(options) { + if(!getApp().is_Single_page()){ + return false; + } var th = this; th.setData({ getStorageID: a.stoid, diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index e3d1305..d37023c 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -93,6 +93,9 @@ Page({ onLoad: function(tt) { + if(!getApp().is_Single_page()){ + return false; + } var that = this; var first_leader=tt.first_leader; if(first_leader){ diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index b71267e..e2b4a41 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -255,6 +255,9 @@ Page({ //------初始化加载---------- onLoad: function (t) { + if(!getApp().is_Single_page()){ + return false; + } var ee = this, that = ee, th = ee, diff --git a/pages/index/index/index.js b/pages/index/index/index.js index ef632a6..26e62c9 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -88,7 +88,9 @@ Page({ }, onLoad: async function (tt) { - + if(!getApp().is_Single_page()){ + return false; + } var th = this; var first_leader = tt.first_leader; if (!first_leader && tt.scene) { diff --git a/pages/template/index.js b/pages/template/index.js index 8a3e50c..9a9a9d8 100644 --- a/pages/template/index.js +++ b/pages/template/index.js @@ -15,6 +15,9 @@ Page({ }, onLoad: function(e) { + if(!getApp().is_Single_page()){ + return false; + } var th = this; this.data.temp_id=e.scene; if(!this.data.temp_id) diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index a4190df..b5541a8 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -39,7 +39,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - + if(!getApp().is_Single_page()){ + return false; + } var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.set_name("助力", "/pages/user/assistance/assistance"); -- libgit2 0.21.4