- 请问我是哪个功能违规了?图片也用的小程序图片检测接口检测的,而且有些违规图检测不出来。
[图片]
2022-12-29 - 小程序真机调试 清不掉缓存
小程序真机调试缓存清不掉,我把小程序删除了再次发起真机调式的时候 缓存依旧存在
2019-07-17 - B页面setStorageSync app.js里getStorageSyn
app.js里的代码 onLaunch: function () { that.timer = setInterval(function () { that.getCartTotalNum(that) }, 100); }, getCartTotalNum: function () { let carts = wx.getStorageSync('goods_cart');//这里的值不会改变 let cartTotalNum = 0 if (carts.stock) { let stock = carts.stock.split(','); for (var i = 0; i < stock.length; i++) { let se = stock[i].split('|'); cartTotalNum += parseInt(se[1]) } } if (carts.vendor) { let vendor = carts.vendor.split(','); for (var i = 0; i < vendor.length; i++) { let se = vendor[i].split('|'); cartTotalNum += parseInt(se[1]) } } if (carts.clear) { let clear = carts.clear.split(','); for (var i = 0; i < clear.length; i++) { let se = clear[i].split('|'); cartTotalNum += parseInt(se[1]) } } if (carts.second) { let second = carts.second.split(','); for (var i = 0; i < second.length; i++) { let se = second[i].split('|'); cartTotalNum += parseInt(se[1]) } } if (cartTotalNum > 0) { //判断购物车的数量个数,购物车如果为空就走else cartTotalNum = cartTotalNum > 99 ? '99+' : cartTotalNum; wx.setTabBarBadge({ //购物车不为空 ,给购物车的tabar右上角添加购物车数量标志 index: 2, //标志添加位置 text: "" + cartTotalNum + "" //通过编译,将购物车总数量放到这里 }) } else {//购物车为空 wx.removeTabBarBadge({ //移除指定位置的tabbar右上角的标志 index: 2, }) } }, B页面赋值 getCartList:function(){ var that = this; var ids = wx.getStorageSync('goods_cart'); if(!ids){ ids = app.globalData.cartType } let param = {}; param.openid = app.globalData.openId; param.cart_ids = JSON.stringify(ids); app.httpClient.post('api_v2/cart/all',param) .then(res=>{ wx.hideLoading(); let list = res.data.msg; that.setData({ cartList: list, //将取反后的集合setData到我们的Data isCarts: !list.goods.length && !list.vendor.length && !list.second.length && !list.clear.length?true:false, selectAllStatus: true, totalMoney: 0.00,totalNum: 0, selectGoodsStatus: true, selectVendorStatus: true, selectSecondStatus: true, selectClearStatus: true, isEdit: true, editText: '编辑商品', }); let carts = app.globalData.cartType; if(list.goods.length>0){ let st = ''; for(var i = 0 ;i<list.goods.length;i++){ st += list.goods[i].spec_id + '|' + list.goods[i].goods_num + '' + ',' } st = st.substr(0,st.length-1); carts.stock = st; } if (list.vendor.length > 0) { let ve = ''; for (var i = 0; i < list.vendor.length; i++) { ve += list.vendor[i].spec_id + '|' + list.vendor[i].goods_num + '' + ',' } ve = ve.substr(0, ve.length - 1); carts.vendor = ve; } if (list.clear.length > 0) { let cl = ''; for (var i = 0; i < list.clear.length; i++) { cl += list.clear[i].spec_id + '|' + list.clear[i].goods_num + '' + ',' } cl = cl.substr(0, cl.length - 1); carts.clear = cl; } if (list.second.length > 0) { let se = ''; for (var i = 0; i < list.second.length; i++) { se += list.second[i].spec_id + '|' + list.second[i].goods_num + '' + ',' } se = se.substr(0, se.length - 1); carts.second = se; } wx.setStorageSync('goods_cart', carts); that.getTotalMoney(); }) .catch(res=>{}) }
2019-06-15 - 用Promise 封装了请求,所有的请求都是GET
app.js里的代码 //全局对象httpClient httpClient: { request: function (method, url, data) { //返回一个promise实例 return new Promise((resolve, reject) => { wx.request({ url: bascUrl+url, data: data, mehtod: method, success: function (res) { console.log(res)//输出的"POST" resolve(res) }, fail: function (res) { reject(res); } }) }) }, //get方法:用来获取数据 get: function (url) { console.log(1) return this.request('GET', url); }, //post方法:用来更新数据 post: function (url, data) { console.log(2) // 进入POST return this.request('POST', url, data); }, //put方法 put: function (url, data) { return this.request(‘PUT’, url, data); }, //delete方法 delete: function (url, data) { return this.request(‘DELETE’, url, data); } }, 调用代码 formSubmit(e) { var param = e.detail.value; param.openid = app.globalData.openId let cObject = utils.mergeObject(param, app.globalData.userInfo) app.httpClient.post(‘login/saveWx’, cObject)// 调用 .then(res=>{ console.log(‘form发生了submit事件,携带数据为:’) }) .catch(res=>{}) }, 请求结果: [图片]
2019-05-21