null != res.data.body 改为 null !== res.data.body
onShow() 中setData不生效,求教~求教论坛大神,小弟刚接触小程序项目,还请不吝赐教 - 当前 Bug 的表现 父页面,在onshow()中调用接口查询数量,代码如下: [图片] 页面初始化时,返回count为1,显示正常,对应控制台日志如下: [图片] 在子页面操作返回后,再次进入父页面,接口返回count为0,setData失败,日志如下: [图片] 备注:count为当前page.data中参数 求教各位大神,多谢
2018-11-19冷启动小程序会自动使用新版的,热启动要等小程序销毁或者 在小程序代码中配置一下调用更新 https://developers.weixin.qq.com/miniprogram/dev/api/update/wx.getUpdateManager.html
今早小程序发布的版本更改了服务器域名今早小程序发布的版本更改了服务器域名,是全量发布的。但是到目前为止,有些手机进入的是新版,能够正常使用,有些手机还是旧版,因为域名更改问题,无法正常使用了。求助该如何处理,不能使用的手机也退出微信,关机等。
2018-11-19https://developers.weixin.qq.com/miniprogram/dev/component/web-view.html 这里的相关接口2 getNetworkType 这里提供了 JSSDK 的调用方法
window.navigator.onLine无法获取正确的网络状态- 当前 Bug 的表现(可附上截图) 安卓端小程序的web-view中, 无法使用 window.navigator.onLine 获取正确的网络状态. iOS网络检测有效: https://github.com/CntChen/wechat-miniapp-web-online-test/blob/master/%E5%B0%8F%E7%A8%8B%E5%BA%8Fios%E7%BD%91%E7%BB%9C%E6%A3%80%E6%B5%8B%E6%9C%89%E6%95%88.MP4 Android网络检测无效: https://github.com/CntChen/wechat-miniapp-web-online-test/blob/master/%E5%B0%8F%E7%A8%8B%E5%BA%8Fandroid%E7%BD%91%E7%BB%9C%E6%A3%80%E6%B5%8B%E6%97%A0%E6%95%88.MP4 - 预期表现 在webview中可以用 window.navigator.onLine 检测页面网络状态. - 复现路径 - 提供一个最简复现 Demo Demo: https://github.com/CntChen/wechat-miniapp-web-online-test
2018-11-19你可能找的是企业付款接口,但和支付接口不是同一个账户,具体可以看看文档 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_1
关于微信小程序微信支付的问题请问各位大佬,在微信小程序中除了用户向对公账户中汇款,能否实现自动从对公账户中往指定用户的账户中汇款呢,意思就是汇款能否双向进行,谢谢
2018-11-19navigateBack 应该不需要添加 A 的
小程序跳小程序问题[代码]"navigateToMiniProgramAppIdList": [ [代码] [代码] "wxe5f52902cf4de896"[代码] [代码]][代码]A 小程序配置已添加白名单小程序B, A 跳到 B , B 小程序 用 wx.navigateBackMiniProgran 返回 A小程序, 是否要在 B 小程序配置文件中添加 A 小程序
2018-11-19要复制的参数变量名不要和 wx 相同,会局部覆盖掉的
wx.setClipboardData is not a function使用wx.setClipboardData时,报wx.setClipboardData is not a function 图:[图片] 代码如下: [图片]
2018-11-19https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html 小程序必须使用 HTTPS/WSS 发起网络请求。请求时系统会对服务器域名使用的 HTTPS 证书进行校验,如果校验失败,则请求不能成功发起。
使用 WebSocket实现聊天报错使用WebSocket写实时聊天,报错:sendSocketMessage:fail WebSocket is not connected,怎么处理呀 [图片] [图片] [图片] 大神们,帮忙看看
2018-11-19关掉会断开连接比较正常,WebSocket 需要手动处理一下重连的问题
fail websocket is not connectedsendSocketMessage:fail websocket is not connected小程序刚打开链接成功,关了,过段时间进来就会这样
2018-11-19交出分页的代码片段分析一下..
微信小程序做了分页,在第二页读取的数据不能覆盖上页数据情况下,上页数据会保留。[图片] [图片] 第二页JSON返回只有两条数据 WXML: <view class="container"> <view class="arrow"> <view class="arrow-left" bindtap='Lclickimg'> <image src='../images/arrow-left.png' style='width:30px;height:16px;margin-left:40%;' ></image> </view> <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}" > <view class="picker" > 第 {{array[index]}} 页 </view> </picker> <view class="arrow-right" bindtap='Rclickimg'> <image src='../images/arrow-right.png' style='width:30px;height:16px;margin-left:44%;' ></image> </view> </view> <navigator class='nav' url='/pages/upload/upload?tname={{item.tname}}&tcontent={{item.tcontent}}&tid={{item.tid}}&price={{item.price}}&place={{item.place}}' wx:for="{{items}}" wx:key> <view class='item'> <view class='item-title'>{{item.tname}}</view> <view class='item-content'>{{item.tcontent}}</view> <view class='item-bottom'> <view>{{item.tm}}</view> <view>{{item.place}} </view> <view>{{item.tid}}</view> </view> <view class='item-price'> <view class='price'> {{item.price/100}}元/票 </view> </view> </view> </navigator> </view> JS: onShow: function() { var that = this; var index=that.data.index; wx.request({ url: 'http://localhost:8080/VoteSystemServer/User/CountRow', data:{ flag:1 }, method: 'GET', dataType: 'json', responseType: 'text', success:function(res){ var arr=res.data; var array = new Array(); for (let i = 0; i < arr.pageCount;i++){ array[i]=i+1; } that.setData({ array:array }) } }); //待审核页,传入 that.data.index wx.request({ url: 'http://localhost:8080/VoteSystemServer/User/doFindAll', data: { Type: 'status', SearchName: '审核通过', sign: '=', Page: parseInt(index) + parseInt(1) }, method: 'GET', dataType: 'json', responseType: 'text', success: function(res) { var arr = res.data; for (let i = 0; i < arr.length ; i++) { var tid = arr[i].tid; var tname = arr[i].tname; var tcontent = arr[i].tcontent; var tnumber = arr[i].tnumber; var name = arr[i].name; var phone = arr[i].phone; var wxname = arr[i].wxname; var tm = arr[i].tm; var status = arr[i].status; var price = arr[i].price; var url = arr[i].url; var province = arr[i].province; var city = arr[i].city; var region = arr[i].region; var place = province + city + region; var tid_data = "items[" + i + "].tid" var tname_data = "items[" + i + "].tname" var tcontent_data = "items[" + i + "].tcontent" var tnumber_data = "items[" + i + "].tnumber" var name_data = "items[" + i + "].name" var phone_data = "items[" + i + "].phone" var wxname_data = "items[" + i + "].wxname" var tm_data = "items[" + i + "].tm" var status_data = "items[" + i + "].status" var price_data = "items[" + i + "].price" var url_data = "items[" + i + "].url" var province_data = "items[" + i + "].province" var city_data = "items[" + i + "].city" var region_data = "items[" + i + "].region" var place_data = "items[" + i + "].place" that.setData({ id: i, [tid_data]: tid, [tname_data]: tname, [tcontent_data]: tcontent, [tm_data]: tm, [price_data]: price, [tid_data]: tid, [place_data]: place, [city_data]: city, [province_data]: province, [region_data]: region }) } }, fail: function(res) {}, complete: function(res) {}, }) } bindPickerChange: function (e) { console.log('picker发送选择改变,携带值为', e.detail.value); this.setData({ index: e.detail.value }); wx.startPullDownRefresh(); }, Lclickimg: function (e) { var that = this; var index = that.data.index; if (index > 0) { that.setData({ index: parseInt(index) - parseInt(1) }) console.log("索引:" + that.data.index); wx.startPullDownRefresh(); } }, Rclickimg: function (e) { var that = this; var len = that.data.array.length var index = that.data.index; if (index < len - 1) { that.setData({ index: parseInt(index) + parseInt(1) }) console.log("索引:" + that.data.index); wx.startPullDownRefresh(); } }, onPullDownRefresh: function () { this.onLoad(); var that = this; var index = that.data.index; wx.request({ url: 'http://localhost:8080/VoteSystemServer/User/CountRow', data: { flag: 1 }, method: 'GET', dataType: 'json', responseType: 'text', success: function (res) { var arr = res.data; var array = new Array(); for (let i = 0; i < arr.pageCount; i++) { array[i] = i + 1; } that.setData({ array: array }) } }); //待审核页,传入 that.data.index wx.request({ url: 'http://localhost:8080/VoteSystemServer/User/doFindAll', data: { Type: 'status', SearchName: '审核通过', sign: '=', Page: parseInt(index) + parseInt(1) }, method: 'GET', dataType: 'json', responseType: 'text', success: function (res) { var arr = res.data; for (let i = 0; i < arr.length; i++) { var tid = arr[i].tid; var tname = arr[i].tname; var tcontent = arr[i].tcontent; var tnumber = arr[i].tnumber; var name = arr[i].name; var phone = arr[i].phone; var wxname = arr[i].wxname; var tm = arr[i].tm; var status = arr[i].status; var price = arr[i].price; var url = arr[i].url; var province = arr[i].province; var city = arr[i].city; var region = arr[i].region; var place = province + city + region; var tid_data = "items[" + i + "].tid" var tname_data = "items[" + i + "].tname" var tcontent_data = "items[" + i + "].tcontent" var tnumber_data = "items[" + i + "].tnumber" var name_data = "items[" + i + "].name" var phone_data = "items[" + i + "].phone" var wxname_data = "items[" + i + "].wxname" var tm_data = "items[" + i + "].tm" var status_data = "items[" + i + "].status" var price_data = "items[" + i + "].price" var url_data = "items[" + i + "].url" var province_data = "items[" + i + "].province" var city_data = "items[" + i + "].city" var region_data = "items[" + i + "].region" var place_data = "items[" + i + "].place" that.setData({ id: i, [tid_data]: tid, [tname_data]: tname, [tcontent_data]: tcontent, [tm_data]: tm, [price_data]: price, [tid_data]: tid, icon: '', [place_data]: place, [city_data]: city, [province_data]: province, [region_data]: region }) } }, fail: function (res) { }, complete: function (res) {wx.stopPullDownRefresh() }, }) }, JSON返回值:第一页 [ { "city": "长沙市", "id": 24, "price": 30, "province": "湖南省", "region": "芙蓉区", "status": "审核通过", "tcontent": "帮忙投5号,每用户可投3票", "tid": "SGB2018111900001", "tm": "2018-11-19 08:27:36", "tname": "测试1901", "tnumber": 2, "url": "http://931248395.ax.nofollow.51wtp.com/index.php/toupiao/h5/detail?id=1910056&vid=931248395&from=timeline", "wxname": "oRPyJ5TTK7RR8XmwxJkVMuyg5WFA" }, { "city": "武汉市", "id": 23, "price": 10, "province": "湖北省", "region": "黄陂区", "status": "审核通过", "tcontent": "测试", "tid": "SGB2018111700005", "tm": "2018-11-17 21:54:31", "tname": "测试1703", "tnumber": 1, "url": "https://mp.weixin.qq.com/s/N7hU912MFI7AoQsqnn0QHA", "wxname": "oRPyJ5dnkYwOs_4Wn1DwipZ108Fk" }, { "city": "武汉市", "id": 22, "price": 15, "province": "湖北省", "region": "新洲区", "status": "审核通过", "tcontent": "投37", "tid": "SGB2018111700004", "tm": "2018-11-17 21:49:58", "tname": "测试1702", "tnumber": 2, "url": "http://chm.dachuw.com/aixin/plugin.php?id=tom_weixin_vote&mod=phb&vid=4&nav=1&from=timeline&isappinstalled=0", "wxname": "oRPyJ5TTK7RR8XmwxJkVMuyg5WFA" }, { "city": "武汉市", "id": 21, "price": 30, "province": "湖北省", "region": "武昌区", "status": "审核通过", "tcontent": "帮忙投第四,你奋斗的样子,真美!", "tid": "SGB2018111700003", "tm": "2018-11-17 21:19:10", "tname": "17测试", "tnumber": 3, "url": "https://mp.weixin.qq.com/s/7BEFvIjN9licgQJ85sbUbA", "wxname": "oRPyJ5dnkYwOs_4Wn1DwipZ108Fk" }, { "city": "武汉市", "id": 20, "price": 30, "province": "湖北省", "region": "江夏区", "status": "审核通过", "tcontent": "4", "tid": "SGB2018111700002", "tm": "2018-11-17 09:00:06", "tname": "4", "tnumber": 1, "url": "http://wx5443.vshangtong.com/?ac=votemb&tid=8377&id=3512&mbid=511975&from=groupmessage", "wxname": "oRPyJ5U-XHjNC0etLJpjcpg2L96g" }, { "city": "武汉市", "id": 19, "price": 30, "province": "湖北省", "region": "江夏区", "status": "审核通过", "tcontent": "3", "tid": "SGB2018111700001", "tm": "2018-11-17 00:01:34", "tname": "3", "tnumber": 1, "url": "http://wx5443.vshangtong.com/?ac=votemb&tid=8377&id=3512&mbid=511975&from=groupmessage", "wxname": "oRPyJ5U-XHjNC0etLJpjcpg2L96g" }, { "city": "武汉市", "id": 18, "price": 30, "province": "湖北省", "region": "江夏区", "status": "审核通过", "tcontent": "2", "tid": "SGB2018111600004", "tm": "2018-11-16 23:46:34", "tname": "2", "tnumber": 3, "url": "http://wx5443.vshangtong.com/?ac=votemb&tid=8377&id=3512&mbid=511975&from=groupmessage", "wxname": "oRPyJ5U-XHjNC0etLJpjcpg2L96g" }, { "city": "武汉市", "id": 17, "price": 30, "province": "湖北省", "region": "江夏区", "status": "审核通过", "tcontent": "1", "tid": "SGB2018111600003", "tm": "2018-11-16 22:26:52", "tname": "1", "tnumber": 1, "url": "http://wx5443.vshangtong.com/?ac=votemb&tid=8377&id=3512&mbid=511975&from=groupmessage", "wxname": "oRPyJ5U-XHjNC0etLJpjcpg2L96g" }, { "city": "undefined", "id": 13, "price": 30, "province": "undefined", "region": "undefined", "status": "审核通过", "tcontent": "测试", "tid": "SGB2018111600002", "tm": "2018-11-16 20:25:24", "tname": "测试", "tnumber": 1, "url": "http://wx5443.vshangtong.com/", "wxname": "undefined" }, { "city": "undefined", "id": 12, "price": 30, "province": "undefined", "region": "undefined", "status": "审核通过", "tcontent": "123456", "tid": "SGB2018111600001", "tm": "2018-11-16 19:55:04", "tname": "特别的", "tnumber": 3, "url": "http://wx5443.vshangtong.com/index.php", "wxname": "undefined" } ] JSON返回值:第二页 [ { "city": "武汉市", "id": 9, "price": 30, "province": "湖北省", "region": "黄陂区", "status": "审核通过", "tcontent": "测试", "tid": "SGB2018110800001", "tm": "2018-11-08 14:46:17", "tname": "测试", "tnumber": 5, "url": "https://www.baidu.com", "wxname": "oRPyJ5dnkYwOs_4Wn1DwipZ108Fk" }, { "city": "武汉市", "id": 7, "price": 30, "province": "湖北省", "region": "江夏区", "status": "审核通过", "tcontent": "测试1内容", "tid": "SGB2018110600001", "tm": "2018-11-06 16:33:58", "tname": "测试1", "tnumber": 1, "url": "1", "wxname": "oRPyJ5U-XHjNC0etLJpjcpg2L96g" } ]
2018-11-19