- wx.request 返回数据不是json格式?
wx.request({ 返回数据不是json格式 console.log(res.data,'控制台输出res.data'); {"ggtop":[{"id":"10","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495588800716222.jpg"},{"id":"5","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170525\/1495684434521009.jpg"},{"id":"2","name":"%E6%BB%9A%E5%8A%A8%E5%B9%BF%E5%91%8A%E5%9B%BE2","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495589027693993.jpg"}, 实际上我要的返回数据应该是 {ggtop:[{id:"10",name:"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD",photo:"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495588800716222.jpg"},{id:"5",name:"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD",photo:"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170525\/1495684434521009.jpg"} 请问,怎么办? 直接转换JSON.parse(res.data);会出错
2020-07-08 - 问题:电脑上显示正常,手机上不显示图片?
.js文件 Page({ data: { imgUrls: [], }, onLoad: function (options) { var that = this; wx.request({ url: 'https://62222.qicp.vip/index.php/Api/Index/index', method:'post', data: {}, header: { 'Content-Type': 'application/x-www-form-urlencoded' }, success: res => { console.log(res.data,'控制台输出'); let ggtop = res.data.ggtop; that.setData({ imgUrls:ggtop, }); }, .wxml文件 <view> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="true"> <block wx:for="{{imgUrls}}" wx:for-item="course" wx:key="imgUrls"> <swiper-item> <image src="{{course.photo}}" class="slide-image" width="100%" height="200" /> </swiper-item> </block> </swiper> </view> 执行结果 电脑console: {ggtop: Array(4), procat: Array(4), prolist: Array(4), brand: Array(8), course: Array(6)} brand: Array(8) 0: {id: "1", name: "小米手环", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818446765084.jpg"} 1: {id: "2", name: "小米电源", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818537250741.jpg"} 2: {id: "3", name: "小米路由", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818583379669.jpg"} 3: {id: "4", name: "小米笔记本", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818644256526.jpg" 手机console: {"ggtop":[{"id":"10","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495588800716222.jpg"},{"id":"5","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170525\/1495684434521009.jpg"},{"id":"2","name":"%E6%BB%9A%E5%8A%A8%E5%B9%BF%E5%91%8A%E5%9B%BE2","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495589027693993.jpg"}, 问题:电脑上显示正常,手机上不显示图片,<view>"{{imgUrls}}"</view>,显示发现imgUrls变成了一个整字符串,里面竟然不是对象。 <view>"{{imgUrls[3]}}"</view>,显示字符"t" 哪位大佬,帮我看看,哪里出了问题,谢谢
2020-07-06 - 问题:电脑上显示正常,手机上不显示图片?
.js文件 Page({ data: { imgUrls: [], }, onLoad: function (options) { var that = this; wx.request({ url: 'https://62222.qicp.vip/index.php/Api/Index/index', method:'post', data: {}, header: { 'Content-Type': 'application/x-www-form-urlencoded' }, success: res => { console.log(res.data,'控制台输出'); let ggtop = res.data.ggtop; that.setData({ imgUrls:ggtop, }); }, .wxml文件 <view> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="true"> <block wx:for="{{imgUrls}}" wx:for-item="course" wx:key="imgUrls"> <swiper-item> <image src="{{course.photo}}" class="slide-image" width="100%" height="200" /> </swiper-item> </block> </swiper> </view> 执行结果 电脑console: {ggtop: Array(4), procat: Array(4), prolist: Array(4), brand: Array(8), course: Array(6)} brand: Array(8) 0: {id: "1", name: "小米手环", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818446765084.jpg"} 1: {id: "2", name: "小米电源", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818537250741.jpg"} 2: {id: "3", name: "小米路由", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818583379669.jpg"} 3: {id: "4", name: "小米笔记本", photo: "https://62222.qicp.vip/Data/UploadFiles/brand/20170630/1498818644256526.jpg" 手机console: {"ggtop":[{"id":"10","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495588800716222.jpg"},{"id":"5","name":"%E9%A6%96%E9%A1%B5%E8%BD%AE%E6%92%AD","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170525\/1495684434521009.jpg"},{"id":"2","name":"%E6%BB%9A%E5%8A%A8%E5%B9%BF%E5%91%8A%E5%9B%BE2","photo":"https:\/\/62222.qicp.vip\/Data\/UploadFiles\/adv\/20170524\/1495589027693993.jpg"}, 问题:电脑上显示正常,手机上不显示图片,<view>"{{imgUrls}}"</view>,显示发现imgUrls变成了一个整字符串,里面竟然不是对象。 <view>"{{imgUrls[3]}}"</view>,显示字符"t" 哪位大佬,帮我看看,哪里出了问题,谢谢
2020-07-05 - onLoad: function (options) 调用失败?
onLoad: function (options) { var that = this; wx.request({ url: app.d.ceshiUrl + '/Api/Index/index', //url: 'https://62222.qicp.vip/index.php/Api/Index/index', method:'post', data: {}, header: { 'Content-Type': 'application/x-www-form-urlencoded' }, //success: function (res) { success: res => { var ggtop = res.data.ggtop; //var ggtop = app.d.ceshiUrl + '/Api/Index/index'; var procat = res.data.procat; //var procat = app.d.ceshiUrl + '/Api/Index/index'; var prolist = res.data.prolist; var brand = res.data.brand; var course = res.data.course; //that.initProductData(data); that.setData({ imgUrls:ggtop, proCat:procat, productData:prolist, brand: brand, course: course }); //endInitData }, fail:function(e){ wx.showToast({ title: '网络异常!', duration: 2000 }); }, }) }, 执行后出现 setting data fiel "imgurls" to undefined is invalid 无法获取到值,请问是什么原因,代码需要怎么修改?
2020-07-01 - 蓝果小镇商城源码编译后,在集成开发环境里运行正常,在手机上不显示图片,表现为除了按钮其他都不显示?
蓝果小镇商城源码编译后,在集成开发环境里运行正常,在手机上不显示图片,表现为除了按钮其他都不显示。我用的自己的机器做的服务器后端,ssl证书域名备案都符合条件,各位大哥帮帮我吧 微信小程序网站-》开发-》服务器域名 request合法域名https://62222.qicp.vipsocket合法域名wss://62222.qicp.vipuploadFile合法域名https://62222.qicp.vipdownloadFile合法域名https://62222.qicp.vipudp合法域名udp://62222.qicp.vip 小程序-》app.js App({ d: { //hostUrl: 'https://wxplus.paoyeba.com/index.php', hostUrl: 'https://62222.qicp.vip/index.php', //hostImg: 'http://img.ynjmzb.net', hostImg: 'https://62222.qicp.vip', //hostVideo: 'http://zhubaotong-file.oss-cn-beijing.aliyuncs.com', hostVideo: 'https://62222.qicp.vip', userId: 3, appId:"", appKey:"", ceshiUrl:'https://62222.qicp.vip/index.php', }, 为啥到了手机里就不显示了,真是莫名其妙。。。
2020-06-30