拿到数据后存到本地缓存
wx.getUserInfo换成wx.getUserProfile之后,只能使用按钮来调用了吗?原来onshow()每次都会调用wx.getUserInfo,这样如果授权过的用户就不用再点击登陆按钮而是直接到用户信息界面了。现在改版之后,难道我要用一个数据库把用户的信息都存起来自己传吗?
2021-04-08你在百度地图看的文档?,这个接口老早就停止维护了 http://wiki.lbsyun.baidu.com/index.php?title=car/api/weather
本人小白,在百度地图开放平台申请了一个天气API的ak读取天气,出现如下错误,希望有大佬能指点迷津?weather.js代码如下: var defaultcity, getweather, gettemp, getwind, getpic, getdate var ak = 'MEbwIWPQb2jiT2t4lHG6v4d70rpTGTcF' Page({ data: {}, // 初始化加载 onLoad: function(e) { // 默认城市名称 defaultcity = '北京' this.weather() }, // 动态获取input输入值 城市名称 bindKeyInput: function(e) { defaultcity = e.detail.value }, // 搜索城市 search: function(e) { this.weather() }, weather: function() { wx.showLoading({ title: '加载中', }) wx.request({ url: 'https://api.map.baidu.com/telematics/v3/weather?output=json&ak=' + ak + '&location=' + defaultcity, success: res => { console.log(res.data) if (!res.data.results) { console.log('获取天气接口失败') return } getweather = res.data.results[0].weather_data[0].weather gettemp = res.data.results[0].weather_data[0].temperature getwind = res.data.results[0].weather_data[0].wind getpic = res.data.results[0].weather_data[0].dayPictureUrl getdate = res.data.results[0].weather_data[0].date this.setData({ city: defaultcity, weather: getweather, temp: gettemp, wind: getwind, pic: getpic, date: getdate }) wx.hideLoading() } }) } }) [图片] [图片]
2021-04-08在组件中绑定value
谁知道小程序表单怎么赋初始值吗?如果是一个编辑页面,那么这个表单就已经有值了,我该怎么把初始值放到表单中显示呢,还是只能直接在组件中使用value吗?
2021-04-07[图片] 这里的arr和successNum都是同时递增,所以条件大部分情况下是成立的,把arr.length换成len试试
关于文件上传wx.uploadFile的用法?for(var i=0;i<len;i++){ var $path=$files[i].path; wx.uploadFile({ url:app.globalData.api+"&r=util.uploader.upload&file=file", filePath:$path, name:"file",//规定的key值 header: { "Content-Type": "multipart/form-data" }, success:function(res){ console.log(JSON.parse(res.data)); console.log(JSON.parse(res.data).files[0].url) console.log(JSON.parse(res.data).files[0].filename) successNum++; console.log(successNum) arr.push({ url:JSON.parse(res.data).files[0].url, filename:JSON.parse(res.data).files[0].filename }); console.log(arr.length); console.log(arr) if(arr.length==successNum){ console.log(that.data.id) o.post("member/cart/addsd",{ id:that.data.id,//会员id files:arr,//文件列表 title:that.data.id.title,//原产品详情 gid:that.data.gid,//原产品id },function(res){ console.log(res); if(res==1){ wx.switchTab({ url:"/pages/member/cart/index" }); } }) /* wx.navigateTo({ url:"/pages/member/cart/index?id="+that.data.id }) */ }else{ console.log("没有上传完成") } } }) }; d我现在要上传多个文件,但是wx.uploadFile api只能上传一个文件,于是我便用了循环上传写法,但是实际操作中,比如上传两张图片,第一张图片会自动多上传一次 咋处理
2021-04-07小程序mp后台可以暂停服务
小程序暂停服务是否有APi?通过api将小程序暂停服务或者通过微信第三方管理进行暂停或者恢复?
2021-04-07报错说的很明显了,appsecret无效,可能有人重置了appsecret
appsecret正确,但是调用获取openid接口时还是返回失败?公众号页面开发,用了secret做了获取token,没什么问题,做自定义分享什么的都没问题成功妥妥的,但是今天调 https://api.weixin.qq.com/sns/oauth2/access_token?的时候就说不对,appid:wxe705a221bbbba9ce [图片]
2021-04-06打印下fail回调看看
位置逆解析不走reverseGeocoder这个接口呢?[图片][图片] 为什么不走reverseGeocoder这个接口呢
2021-03-30下载后读取该文件 [图片]
通过downloadFile下载一个bin文件,怎么将这个文件转换成字节数组?小程序通过downloadFile下载一个bin类型的文件,怎么将这个bin文件转换成字节数组?
2021-03-19看你的数据结构,应该要写成weibo.weibo.author.avatarUrl
在WXML添加真实数据出问题?在WXML文件里添加真实数据以后,模拟器显示不出来。打印了数据,数据是存在的但是无法调用。 调试器内打印出来的数据(数据是从云数据库获取的)如下: [图片] 代码如下: <wxs src="../../utils/util.wxs" module="util" /> <view class="container"> <view class="weibo-group" wx:for="{{weibos}}" wx:for-item="weibo"> <view class="user-group"> <image class="avatar" src="{{weibo.author.avatarUrl}}"> </image> <view class="right-info"> <view class="username">{{weibo.author.nickName}}</view> <view class="detail-info"> <view class="time">{{util.timeFormat(weibo.create_time)}}</view> <view class="from">来自{{weibo.device}}</view> </view> </view> </view> <view class="weibo-content-group"> <view class="content">{{weibo.content}}</view> <bolock wx:if="{{weibo.images.length > 0}}"> <!-- 一张图片的情况 --> <view wx:if="{{weibo.images.length===1}}" class="image-list-group"> <image src="{{weibo.images}}" mode="aspectFill" style="width:100%; max-height:400rpx;"> </image> </view> <!-- 两张或四张图片情况 --> <view wx:elif="{{weibo.images.length===2||weibo.images.length===4}}" class="image-list-group"> <image wx:for="{{weibo.images}}" wx:for-item="image" src="{{image}}" mode="aspectFill" style="width:{{twoImageSize}}px;height:{{twoImageSize}}px"> </image> </view> <!-- 3、5、6、7、8、9张图片的情况 --> <view wx:else class="image-list-group"> <image wx:for="{{weibo.images}}" wx:for-item="image" src="{{image}}" mode="aspectFill" style="width:{{threeImageSize}}px;height:{{threeImageSize}}px"> </image> </view> </bolock> <!-- 上传视频的情况 --> <block wx:if="{{weibo.video}}"> <view class="image-list-group"> <video src="{{weibo.video}}"></video> </view> </block> </view> 模拟器显示: [图片]
2021-02-05你获取的是模板消息的模板ID,你发送的是订阅消息,这2个不一样
调用消息模板接口时"errmsg": "invalid template_id?模板id我是从https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=接口中获取的[图片] 获取之后调用https://api.weixin.qq.com/cgi-bin/message/subscribe/bizsend?access_token=接口发送模板消息 [图片] 但是老是提示我模板消息id无效,不知道具体原因,请各位大佬帮忙解答,谢谢!
2021-02-04