diff --git a/app.js b/app.js index 65bc235..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; + } + } + + } 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 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; - - }, + } + 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() { @@ -777,19 +795,21 @@ App({ if (wx.canIUse('getUpdateManager')) { //创建 UpdateManager 实例 const updateManager = wx.getUpdateManager(); - console.log('是否进入模拟更新'); + if(!updateManager) { + 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: '已经有新版本喽~', @@ -810,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 2d5da23..5d32c27 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -212,6 +212,13 @@ Page({ //------初始化加载---------- onLoad: function(t) { + + // ===> 小程序页面分享到朋友圈时使用 + if(!getApp().is_Single_page()){ + return false; + } + // <=== + self = this; this.setData({ 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/packageD/pages/AI-test-skin/fail_result/fail_result.wxml b/packageD/pages/AI-test-skin/fail_result/fail_result.wxml index 6849bab..327bb60 100644 --- a/packageD/pages/AI-test-skin/fail_result/fail_result.wxml +++ b/packageD/pages/AI-test-skin/fail_result/fail_result.wxml @@ -3,7 +3,7 @@ - + 上传图片符合要求 @@ -14,7 +14,7 @@ 失败原因: - + {{msg}} diff --git a/packageD/pages/AI-test-skin/fail_result/fail_result.wxss b/packageD/pages/AI-test-skin/fail_result/fail_result.wxss index d09a20f..b3457de 100644 --- a/packageD/pages/AI-test-skin/fail_result/fail_result.wxss +++ b/packageD/pages/AI-test-skin/fail_result/fail_result.wxss @@ -60,43 +60,10 @@ page { justify-content: center; } .ac{align-items: center} - -@font-face { - font-family: 'iconfont'; - /* project id 2125414 */ - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot'); - src: url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff2') format('woff2'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.woff') format('woff'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.ttf') format('truetype'), - url('//at.alicdn.com/t/font_2125414_o4quhtfqnbr.svg#iconfont') format('svg'); -} - -.icon-pic:before { - content: "\e620"; -} - .t_c{text-align: center} -@font-face { - font-family: "iconfont"; /* Project id 3188718 */ - src: url('iconfont.woff2?t=1645080046840') format('woff2'), - url('iconfont.woff?t=1645080046840') format('woff'), - url('iconfont.ttf?t=1645080046840') format('truetype'); -} -.icon-tupian:before { - content: "\e997"; -} - -.icon-account:before { - content: "\e6a3"; -} - -.icon-prompt-filling:before { - content: "\e68b"; -} diff --git a/packageD/pages/AI-test-skin/success_result/success_result.js b/packageD/pages/AI-test-skin/success_result/success_result.js index c673a8e..a1679d0 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.js +++ b/packageD/pages/AI-test-skin/success_result/success_result.js @@ -1,7 +1,7 @@ /* * @Author: abson * @Date: 2022-02-16 15:36:47 - * @LastEditTime: 2022-02-25 11:10:36 + * @LastEditTime: 2022-02-25 11:30:33 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\success_result\success_result.js @@ -470,6 +470,7 @@ Page({ this.setData({ question_dialog:false, yiwen_index:0, + yiwen_id:'yiwen1' }) }, diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxml b/packageD/pages/AI-test-skin/success_result/success_result.wxml index d8946b6..6220f88 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxml +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxml @@ -120,10 +120,10 @@ - - - 分享 - + + + 分享 + @@ -227,14 +227,14 @@ - + @@ -386,7 +386,7 @@ diff --git a/packageD/pages/AI-test-skin/success_result/success_result.wxss b/packageD/pages/AI-test-skin/success_result/success_result.wxss index 55f3264..8358dc7 100644 --- a/packageD/pages/AI-test-skin/success_result/success_result.wxss +++ b/packageD/pages/AI-test-skin/success_result/success_result.wxss @@ -753,16 +753,6 @@ page { color: #fff } -@font-face { - font-family: "iconfont"; - /* Project id */ - src: url('iconfont.ttf?t=1645607343376') format('truetype'); -} - -.icon-close:before { - content: "\e668"; -} - .e_tou { width: 50rpx; height: 20rpx; 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/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index da36753..aff939d 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -4,9 +4,9 @@ --> - + { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + getApp().getConfig(function (e) { ee.setData({sto_sele_name_1: e.store_name}) }) @@ -3526,6 +3545,7 @@ Page({ //---判断拼单---- if (prom_type == 6) { + console.log('判断拼单'); //-------判断活动是否抢光--------- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { 1: 1 diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index fb306f1..48e0aec 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -324,7 +324,7 @@ - + @@ -336,7 +336,7 @@ - + diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index fa3aab4..2fb8bb1 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -1,9 +1,9 @@ -var t = function(t) { +var t = function (t) { return t && t.__esModule ? t : { default: t }; }(require("../../../utils/LoadMore.js")), ut = require("../../../utils/util.js"), - a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting; + a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting; Page({ data: { @@ -18,143 +18,157 @@ Page({ requestUrl: "", //hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ] hotWords: null, - + is_no_plus:1, tabname: "sort", //排序的字段 adname: "asc", //升降的字段 - rq_data:null, - - - searchRecord: [], - keyword: '', - is_his:0, + rq_data: null, + searchRecord: [], + keyword: '', + is_his: 0, }, - - onLoad: function(t) { - this.data.rq_data=t; + + onLoad: function (t) { + this.data.rq_data = t; //接受有没有导购的参数 - var first_leader=t.first_leader; - if(first_leader){ - getApp().globalData.first_leader=first_leader; + var first_leader = t.first_leader; + if (first_leader) { + getApp().globalData.first_leader = first_leader; //调用接口判断是不是会员 - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{ - if(res.data.code==0){ - getApp().globalData.guide_id=res.data.data.id; + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; } }) } - - var th=this; - a.getConfig2(function(rs){ - var arr=new Array(),arr2=new Array(); - if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){ - var arr1 = rs.hot_keywords.split('|'); - for (var i = 0; i < arr1.length;i++){ - if(i%5==0 && i!=0){ - arr.push(arr2); - arr2=[]; - }else{ - arr2.push(arr1[i]); + var th = this; + //调用接口判断商家plus有没有过期 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } } } - if (arr2.length > 0) arr.push(arr2); - th.setData({ hotWords: arr}); - } - - - //计算等级价相关 - var swithc_list=rs.switch_list; - var sw_arr=JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ - th.setData({rank_switch:true}); - var user=getApp().globalData.userInfo; - var ti=setInterval(function(){ - if(!user) return false; - clearInterval(ti); - //---回调卡的列表--- - th.getPlusCardType(function(ob){ - th.setData({card_list:ob.card_list}); - if(user.card_field ){ - var str = user['card_expiredate'].replace(/-/g, '/'); - var end = new Date(str); - end = Date.parse(end) / 1000; - var now = ut.gettimestamp(); - - //--- 判断是等级会员,且在有效期范围内 --- - if(user.card_field && now7) card_name=card_name.substring(0,8); - th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list}); - } - } - }) - },500) - } - - - - }) - //e.init(this, "", "requestData"); - var url = this.data.baseUrl; - - //扫一扫过来,显示搜索的内容 - var s_key = t.s_key; - if (s_key){ - s_key=s_key.trim(); - this.search(s_key); this.openSearchModal(); - return; - } - - if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;} - if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;} - if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;} - if (0 != t.ladder_id && t.ladder_id != undefined) { - url += "&ladder_id=" + t.ladder_id; - this.setData({ - baseUrl:url, + }) + a.getConfig2(function (rs) { + console.log('getConfig2', rs); + var arr = new Array(), arr2 = new Array(); + if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") { + var arr1 = rs.hot_keywords.split('|'); + for (var i = 0; i < arr1.length; i++) { + if (i % 5 == 0 && i != 0) { + arr.push(arr2); + arr2 = []; + } else { + arr2.push(arr1[i]); + } + } + if (arr2.length > 0) arr.push(arr2); + th.setData({ hotWords: arr }); + } + + + //计算等级价相关 + var swithc_list = rs.switch_list; + var sw_arr = JSON.parse(swithc_list); + console.log('sw_arr', sw_arr); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ rank_switch: true }); + var user = getApp().globalData.userInfo; + var ti = setInterval(function () { + if (!user) return false; + clearInterval(ti); + //---回调卡的列表--- + th.getPlusCardType(function (ob) { + th.setData({ card_list: ob.card_list }); + if (user.card_field) { + var str = user['card_expiredate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + var now = ut.gettimestamp(); + + //--- 判断是等级会员,且在有效期范围内 --- + if (user.card_field && now < end) { + var card_name = ob.name_map.get(user.card_field); + if (card_name.length > 7) card_name = card_name.substring(0, 8); + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); + } + } + }) + }, 500) + } + + }) - } - if (url != this.data.baseUrl) return this.requestSearch(url); - this.openSearchModal(); + //e.init(this, "", "requestData"); + var url = this.data.baseUrl; + + //扫一扫过来,显示搜索的内容 + var s_key = t.s_key; + if (s_key) { + s_key = s_key.trim(); + this.search(s_key); this.openSearchModal(); + return; + } + + if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } + if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } + if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; } + if (0 != t.ladder_id && t.ladder_id != undefined) { + url += "&ladder_id=" + t.ladder_id; + this.setData({ + baseUrl: url, + + }) + } + if (url != this.data.baseUrl) return this.requestSearch(url); + this.openSearchModal(); // 获取历史搜索记录 - this.getHistorySearch(); + this.getHistorySearch(); }, - changeTab: function(t) { - var ord = t.currentTarget.dataset.href; - var ad = t.currentTarget.dataset.ad; + changeTab: function (t) { + var ord = t.currentTarget.dataset.href; + var ad = t.currentTarget.dataset.ad; - var url = this.data.requestUrl; + var url = this.data.requestUrl; - if (this.data.tabname != ord) { - this.setData({ tabname: ord, adname: "desc" }); - } else { - ad = ad == "desc" ? "asc" : "desc"; - this.setData({ adname: ad }); - } - this.resetData(), this.requestSearch(url); + if (this.data.tabname != ord) { + this.setData({ tabname: ord, adname: "desc" }); + } else { + ad = ad == "desc" ? "asc" : "desc"; + this.setData({ adname: ad }); + } + this.resetData(), this.requestSearch(url); }, //-----------真的调用地址进行搜索------------ - requestSearch: function(t) { - if(this.data.loading) return false; - this.data.loading=1; - var e = this,th=e; - if(getApp().globalData.userInfo){ - t += "&user_id=" + getApp().globalData.userInfo.user_id; - } + requestSearch: function (t) { + if (this.data.loading) return false; + this.data.loading = 1; + var e = this, th = e; + if (getApp().globalData.userInfo) { + t += "&user_id=" + getApp().globalData.userInfo.user_id; + } this.data.requestUrl = t; - var user_id=getApp().globalData.user_id; - if(!user_id) user_id=0; + var user_id = getApp().globalData.user_id; + if (!user_id) user_id = 0; - getApp().request.promiseGet(t, {data:{is_mainshow: 1, isonsale: 1, store_id: oo.stoid,orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage}}).then(async res=>{ - th.data.loading=0; - if(ut.ajax_ok(res)){ - if(!e.data.requestData) e.data.requestData=[]; - for(let i in res.data.data.pageData){ - let item=res.data.data.pageData[i]; + getApp().request.promiseGet(t, { data: { is_mainshow: 1, isonsale: 1, store_id: oo.stoid, orderField: e.data.tabname, orderType: e.data.adname, page: e.data.currentPage } }).then(async res => { + th.data.loading = 0; + if (ut.ajax_ok(res)) { + if (!e.data.requestData) e.data.requestData = []; + for (let i in res.data.data.pageData) { + let item = res.data.data.pageData[i]; item.original_img = th.data.url + item.original_img; /*-- @@ -171,48 +185,48 @@ Page({ })--*/ var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购 - var prom_id=item.prom_id; - var now=ut.gettimestamp(); + var prom_id = item.prom_id; + var now = ut.gettimestamp(); var url = ""; - switch (prom_type){ + switch (prom_type) { case 1: - url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id; + url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id; break; case 2: - url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id + url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id break; case 4: - url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id; + url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id; break; case 6: url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id; - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{ - data:{ - store_id: oo.stoid, - is_end: 0, - is_show: 1, - user_id: getApp().globalData.user_id, - pageSize:1000, + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", { + data: { + store_id: oo.stoid, + is_end: 0, + is_show: 1, + user_id: getApp().globalData.user_id, + pageSize: 1000, } - }).then(pd=>{ - let pd_list=pd.data.data.pageData; - if(res.data.code==0 && pd_list.length>0){ - var flag = pd_list.some(pd=>{ - return pd.goods_id==item.goods_id - }) - - if(!flag){ - item.prom_type=0; - item.prom_id=0; - item.prom_price=null; - } + }).then(pd => { + let pd_list = pd.data.data.pageData; + if (res.data.code == 0 && pd_list.length > 0) { + var flag = pd_list.some(pd => { + return pd.goods_id == item.goods_id + }) + + if (!flag) { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; + } } - }) + }) break; case 8: var presell_id = prom_id; var url1 = "/api/weshop/marketing/marketingPresellList/list"; - var rd= { + var rd = { store_id: oo.stoid, presell_id: presell_id, goods_id: item.goods_id @@ -224,247 +238,247 @@ Page({ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { var arr = res.data.data[0]; item.prom_price = arr.luck_goods_price; - item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0); + item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0); } }) break; default: break } - if(url!=null && url!=''){ + if (url != null && url != '') { await getApp().request.promiseGet(url, {}).then(async res => { - var prom =null; - if(res.data.code==0 && res.data.data){ - prom=res.data.data; + var prom = null; + if (res.data.code == 0 && res.data.data) { + prom = res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time now && (prom.start_time < now || (prom.show_time && prom.show_time < now))) { item.prom_price = res.data.data.price; - if(res.data.data.user_price) item.prom_price=res.data.data.user_price; - var vNum=prom.virtual_num?prom.virtual_num:0; - var vNum1=prom.virtualNum?prom.virtualNum:0; - var vNum2=prom.virtual?prom.virtual:0; - item.sales_sum=prom.buy_num+(vNum+vNum1+vNum2); - }else{ - item.prom_type=0; - item.prom_id=0; - item.prom_price=null; + if (res.data.data.user_price) item.prom_price = res.data.data.user_price; + var vNum = prom.virtual_num ? prom.virtual_num : 0; + var vNum1 = prom.virtualNum ? prom.virtualNum : 0; + var vNum2 = prom.virtual ? prom.virtual : 0; + item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2); + } else { + item.prom_type = 0; + item.prom_id = 0; + item.prom_price = null; } } }) } - if(!th.data.requestData) th.data.requestData=[]; + if (!th.data.requestData) th.data.requestData = []; th.data.requestData.push(item); - e.setData({requestData: e.data.requestData}); + e.setData({ requestData: e.data.requestData }); } } e.closeSearchModal(); }) }, - onReachBottom: function() { + onReachBottom: function () { this.data.currentPage++ this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl); }, - openFilterModal: function() { + openFilterModal: function () { this.setData({ openFilterModal: !0 }); }, - closeFilterModal: function() { + closeFilterModal: function () { this.setData({ openFilterModal: !1 }); }, - filterGoods: function(t) { + filterGoods: function (t) { this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal(); }, - resetData: function() { + resetData: function () { e.resetConfig(), this.data.requestData = null, this.data.currentPage = 1; }, //---回复最初的设置---显示全部分类-- - restoreData: function() { + restoreData: function () { this.setData({ requestData: this.data.allData, }); - this.data.currentPage=2; + this.data.currentPage = 2; }, - openSearchModal: function() { + openSearchModal: function () { this.setData({ openSearchModal: !0 }); }, - closeSearchModal: function() { + closeSearchModal: function () { this.setData({ openSearchModal: !1 }); }, - submitSearch: function(t) { - console.log(111,t); - var val=t.detail.value.word; - if(val==undefined) val=t.detail.value; - val=val?val.trim():''; - if(!val){ - a.showWarning("请输入搜索关键词"); - } + submitSearch: function (t) { + console.log(111, t); + var val = t.detail.value.word; + if (val == undefined) val = t.detail.value; + val = val ? val.trim() : ''; + if (!val) { + a.showWarning("请输入搜索关键词"); + } this.search(val); - + }, //热搜关键字 - searchHotWord: function(t) { - - var word= t.currentTarget.dataset.word; - this.historyRecord(word); - this.search(word); + searchHotWord: function (t) { + + var word = t.currentTarget.dataset.word; + this.historyRecord(word); + this.search(word); }, //-----点击搜索按钮---- - search: function(t) { + search: function (t) { if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词"); - this.data.key_str=t; - this.historyRecord(); + this.data.key_str = t; + this.historyRecord(); this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); }, //---------分享配置-------- onShareAppMessage: function (e) { - var curPage=this; + var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; } - if(this.data.key_str) { + if (this.data.key_str) { pagePath += "?s_key=" + this.data.key_str; } - if(getApp().globalData.user_id){ + if (getApp().globalData.user_id) { - if(pagePath.indexOf("?")>0){ - pagePath+="&first_leader="+getApp().globalData.user_id; - }else{ - pagePath+="?first_leader="+getApp().globalData.user_id; + if (pagePath.indexOf("?") > 0) { + pagePath += "&first_leader=" + getApp().globalData.user_id; + } else { + pagePath += "?first_leader=" + getApp().globalData.user_id; } } - console.log("11-11"+pagePath); + console.log("11-11" + pagePath); return { title: "商品搜索", - path:pagePath, + path: pagePath, } }, //---------图片失败,默认图片-------- bind_bnerr: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = this.data.url+ "/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + //--- 获取卡类列表 --- + getPlusCardType: function (func) { + var storid = oo.stoid; + var th = this; + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { + var plusCard = res.data.data; + var arr = [1219, 2089, 3031]; + var new_arr = new Array(); + var card_name_map = new Map(); + var user = getApp().globalData.userInfo; + + for (var i = 0; i < plusCard.length; i++) { + if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { + continue; + } + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + new_arr.push(plusCard[i]); + + } + + var ob = { "card_list": new_arr, "name_map": card_name_map }; + func(ob); + }) + }, + + + getInput(e) { + this.setData({ + keyword: e.detail.value + }); + }, + + historyRecord(w) { + let keyword = w; + let self = this; + if (!keyword) { + keyword = this.data.key_str.trim(); + } + let searchRecord = this.data.searchRecord; + if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || []; + + if (keyword) { + + var index = searchRecord.indexOf(keyword); + if (index > -1) { + // 已经存在该值 + searchRecord.splice(index, 1); + searchRecord.unshift(keyword); + + // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + + return; + } else { + if (searchRecord.length >= 10) { + searchRecord.pop(); // 删除最早的一条记录 + }; + searchRecord.unshift(keyword); + + // // 将历史记录添加到缓存中 + wx.setStorage({ + key: 'searchRecord', + data: searchRecord, + success: function (res) { + self.setData({ + searchRecord, + }) + } + }) + }; + }; }, - - //--- 获取卡类列表 --- - getPlusCardType: function (func) { - var storid = oo.stoid; - var th = this; - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - var plusCard = res.data.data; - var arr = [1219, 2089, 3031]; - var new_arr = new Array(); - var card_name_map=new Map(); - var user = getApp().globalData.userInfo; - - for (var i = 0; i < plusCard.length; i++) { - if ((!user || user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) { - continue; - } - var name="card"+plusCard[i].CorrPrice.toLowerCase(); - card_name_map.set(name,plusCard[i].CardName); - new_arr.push(plusCard[i]); - - } - - var ob={"card_list":new_arr,"name_map":card_name_map}; - func(ob); - }) - }, - - - getInput(e) { - this.setData({ - keyword: e.detail.value - }); - }, - - historyRecord(w) { - let keyword =w; - let self = this; - if(!keyword){ - keyword = this.data.key_str.trim(); - } - let searchRecord = this.data.searchRecord; - if(!searchRecord || searchRecord.length==0) searchRecord=wx.getStorageSync('searchRecord') || []; - - if(keyword) { - - var index=searchRecord.indexOf(keyword); - if(index > -1) { - // 已经存在该值 - searchRecord.splice(index,1); - searchRecord.unshift(keyword); - - // 将历史记录添加到缓存中 - wx.setStorage({ - key: 'searchRecord', - data: searchRecord, - success: function(res) { - self.setData({ - searchRecord, - }) - } - }) - - return; - } else { - if(searchRecord.length >= 10) { - searchRecord.pop(); // 删除最早的一条记录 - }; - searchRecord.unshift(keyword); - - // // 将历史记录添加到缓存中 - wx.setStorage({ - key: 'searchRecord', - data: searchRecord, - success: function(res) { - self.setData({ - searchRecord, - }) - } - }) - }; - }; - }, - - - - - getHistorySearch() { - this.setData({ - searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 - }); - }, - - clearSearchRecord() { - wx.clearStorageSync('searchRecord'); - this.setData({ - searchRecord: [] - }); - }, - - go_url:function (e) { - var url=e.currentTarget.dataset.url; + + + + + getHistorySearch() { + this.setData({ + searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空 + }); + }, + + clearSearchRecord() { + wx.clearStorageSync('searchRecord'); + this.setData({ + searchRecord: [] + }); + }, + + go_url: function (e) { + var url = e.currentTarget.dataset.url; getApp().goto(url); } }); \ No newline at end of file diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml index 6b27d1c..e4196f4 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -38,10 +38,10 @@ - {{item.prom_integral}}积分 - + - ¥{{item.prom_price}} - + {{item.prom_integral}}积分 + + + ¥{{item.prom_price}} + ¥{{item.market_price}} 评论{{item.comment_count}} 已售{{item.sales_sum}} @@ -49,7 +49,7 @@ - + @@ -57,9 +57,9 @@ ¥{{item[card_field]}} - - - {{card_name}} + + + {{card_name}} @@ -85,10 +85,10 @@ ¥{{g_filter.get_card_price(item,card_list,0)}} - - - {{g_filter.get_card_price(item,card_list,1)}} - + + + {{g_filter.get_card_price(item,card_list,1)}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} @@ -120,7 +120,7 @@ 没有相关的数据 - 去逛逛 + 去逛逛 - - - 历史搜索 - - - - - {{item}} - - - 暂无历史搜索记录 - + + + 历史搜索 + + + + + {{item}} + + + 暂无历史搜索记录 + \ No newline at end of file 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/Detailed/Detailed.js b/pages/user/Detailed/Detailed.js index 1033cc1..f87cb44 100644 --- a/pages/user/Detailed/Detailed.js +++ b/pages/user/Detailed/Detailed.js @@ -189,9 +189,10 @@ Page({ } this.data.is_loading=1; - wx.showLoading({ title: '生成中...',}) - - var th = this; + wx.showLoading({ title: '生成中...',}) + this.setData({ canvasHidden: false }) + + var th = this; //设置画板显示,才能开始绘图 var card_ming=th.data.bas_ming;//卡的图片 @@ -217,7 +218,7 @@ Page({ success: function (res) { th.get_head_temp(function(){ var vpath=res.path; - th.setData({ canvasHidden: false }) + //开启画布 const ctx = wx.createCanvasContext('myCanvas'); //先画背景 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"); diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml index 8406e1a..360e6bb 100644 --- a/pages/user/my_service/i_service.wxml +++ b/pages/user/my_service/i_service.wxml @@ -99,4 +99,4 @@ - \ No newline at end of file + \ No newline at end of file