- 小程序可以使用websocket长连接嘛?
业务需求要使用长连接,不知道小程序能不能使用websocket长连接,我也没有写过,有大佬分享一下嘛
2023-02-02 - 小程序网络请求头token一样情况下,为啥小程序获取不到值 apipost上却能获取到值?
[图片] [图片] //网络请求 function request_WANG(url,method,params) { return new Promise(function(resolve, reject) { wx.showLoading({ title: '加载中', }) var data = {}; if(params) { data = params; } // return false var contentType = 'application/json'; //默认的网络请求为"GET" if(!method){ method = 'GET' } else{ method = method; } // console.log('===================================='); console.log(wx.getStorageSync('token')); wx.request({ url: BASE_URL_WANG + url, data: data, method: method, //添加请求头 header: { 'Content-Type': contentType , 'Authorization':'bearer '+ wx.getStorageSync('token') }, //请求成功 success: function(res) { if (res.statusCode == 200 || res.statusCode == 201 || res.statusCode == 204) { resolve(res); }else { //请求失败 reject("请求失败:" + res.statusCode) console.log(res); if(res.data.msg == 'user already exists'){ wx.showToast({ title: '用户已经存在了!', icon: 'error', duration: 2000 }) } else if(res.data.msg == 'phone already exists'){ wx.showToast({ title: '手机号已被注册!', icon: 'error', duration: 2000 }) } else if(res.data.msg == 'invalid user'){ wx.showToast({ title: '无效的用户!', icon: 'error', duration: 2000 }) } else{ wx.showToast({ title: '出错!', icon: 'error', duration: 2000 }) } // resolve(res); } }, fail: function(err) { console.log(err); reject("服务器连接异常,请检查网络再试"); }, complete: function() { wx.hideLoading(); } }) }); } //================ api.POSTgetCode(paramr) .then(res => { console.log('==1'); console.log(res); console.log(res.data.data); wx.removeStorageSync('token') wx.setStorageSync('token', res.data.data) console.log(wx.getStorageSync('token')); setTimeout(function(){ api.GETuserNormal() .then(res => { console.log('==2'); console.log(res); resolve('33') }) .catch(err => { console.log('==2'); console.log(err); }) },3000) resolve('22') }) .catch(err => { console.log(err); })
2023-02-01 - wx.getLocation接口真的能申请下来吗?
项目里需要一个路线规划的功能,需要获取用户当前的位置信息,我用了wx.getLocation,申请一天了都给拒了
2023-01-12 - 小程序可以把页面数据导出到excel,并下载嘛?
[图片] 要把上面图片中的表单数据导入excel,然后下载,用什么方法呢
2022-12-29 - wx.previewImage为啥点击没有反应?图片链接给到了呀?
[图片]
2022-12-13 - 同一个接口安卓报401,ios正常?
测试时候,发现一个问题,同一个接口,安卓报401,但是ios确实正常的,而且开发工具也没有问题
2022-12-12 - 小程序里嵌入全景,小程序能控制全景嘛?
在小程序里嵌入全景图(用web-view),小程序能控制全景里的按钮嘛,类似贝壳看房的那种,是不是直接在H5上写好了,仅仅是套了个小程序呢?因为web-view会把页面其他元素给干掉
2022-11-18 - wx.openDocument安卓手机打开的带有图片的word,图片会叠压?
wx.openDocument安卓手机打开的带有图片的word,图片会叠压?这是为啥啊,但是在ios上看着有事没有问题,是系统不兼容的问题嘛?[图片][图片]
2022-11-16 - 关于Vant Weapp的Calendar日历的formatter怎么使用?并且动态给它赋值
现在的需求是要根据用户选择的不同相隔的天数,显示不同的日历面板,例如用户选的是'单日',日历上显示的单数日期可以选择,'双日',日历上的偶数日期可以选择,还有只能选择周六或者周日或者工作日的这种
2022-11-09 - 微信小程序可以在JS里新增标签么?
现在的需求是,要点击新增一个选项,选项后面还有跟有输入框'input',我记得小程序没法操作Dom,谁帮我解答一下
2022-10-25