- 当前 Bug 的表现(可附上截图)
- 预期表现
产品轮播图正常显示
问题说明:
小程序体验版本,在IOS真机上部分网络图片不显示,安卓系统和开发模拟器上正常,从未出现过该问题。
两个不同的IPhone手机,图片在另一个IOS手机上正常显示,但又会丢失其他图片,丢失图片完全是随机的(图片格式是jpg和png),在图片上绑定了预览图片方法,执行wx.previewImage方法传入不显示的图片地址,可正常预览
和swiper标签没有任何关系,在page中直接一个image标签也会随机图片不显示。
在后台查看nginx日志发现 访问图片的时候会在 jpg或者png后面加上/ 导致404,
日志详情:
2018/11/06 17:33:16 [error] 4776#5532: *417 "E:/card/shop/tab6_icon.png/index.html" is not found (3: The system cannot find the path specified), client: 115.60.16.122, server: www.m.baidu.com, request: "GET /card/shop/tab6_icon.png/ HTTP/1.1", host: "www.m.baidu.com", referrer: "https://servicewechat.com/wx9fcadf2030746bd2/0/page-frame.html"
2018/11/06 17:33:16 [error] 4776#5532: *422 "E:/card/shop/product/show/liaoyiliao_icon.png/index.html" is not found (3: The system cannot find the path specified), client: 115.60.16.122, server: www.m.baidu.com, request: "GET /card/shop/product/show/liaoyiliao_icon.png/ HTTP/1.1", host: "www.m.baidu.com", referrer: "https://servicewechat.com/wx9fcadf2030746bd2/0/page-frame.html"
2018/11/06 17:33:16 [error] 4776#5532: *420 "E:/card/shop/product/show/fenxiang.png/index.html" is not found (3: The system cannot find the path specified), client: 115.60.16.122, server: www.m.baidu.com, request: "GET /card/shop/product/show/fenxiang.png/ HTTP/1.1", host: "www.m.baidu.com", referrer: "https://servicewechat.com/wx9fcadf2030746bd2/0/page-frame.html"
2018/11/06 17:33:16 [error] 4776#5532: *424 "E:/card/shop/product/show/shoucang.png/index.html" is not found (3: The system cannot find the path specified), client: 115.60.16.122, server: www.m.baidu.com, request: "GET /card/shop/product/show/shoucang.png/ HTTP/1.1", host: "www.m.baidu.com", referrer: "https://servicewechat.com/wx9fcadf2030746bd2/0/page-frame.html"
2018/11/06 17:33:16 [error] 4776#5532: *424 "E:/files/20181017/0a73f4e7-14b8-4ea6-8a67-ad71f6fd83ba.jpg/index.html" is not found (3: The system cannot find the path specified), client: 115.60.16.122, server: www.m.baidu.com, request: "GET /files/20181017/0a73f4e7-14b8-4ea6-8a67-ad71f6fd83ba.jpg/ HTTP/1.1", host: "www.m.baidu.com", referrer: "https://servicewechat.com/wx9fcadf2030746bd2/0/page-frame.html"
4. nginx配置
listen 443 ssl; server_name www.baidu.com baidu.com; if ($http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)"){ return 301 https://www.m.baidu.com$request_uri; } |
日志和nginx配置信息中我个域名替换成baidu.com,能说明问题就行,在配置中判断如果是手机端访问,则return 301
配置二
listen 443 ssl; server_name www.m.baidu.com m.baidu.com; location ~/weixin/(card|files|wxxiaochengxuimgs) { root E:\images; } |
微信小程序访问图片服务器,从baidu.com 301到m.baidu.com,然后直接读取硬盘图片资源
< swiper class = 'swiper' circular bindchange = '_swiperbindchange' > < block wx:for = '{{imagesList}}' wx:key = "*this" wx:for-index = 'idx' > < swiper-item > < view class = 'productmasterimage' > < image src = '{{item}}' mode = 'aspectFill' style = 'width:100%;height:750rpx;' bindtap = 'showmasterimage' data-index = '{{idx}}' /> < image class = 'videoplay' wx:if = '{{videocheck&&idx==0}}' src = '{{video_big}}' style = 'width:116rpx;height:116rpx;' bindtap = '_videoshow' /> </ view > </ swiper-item > </ block > </ swiper > |
循环imagesList数组,image标签直接指向网络图片地址,网络协议是https,
- 复现路径
疑问:
- IOS部分网络图片随机不显示,是服务器并发到最到拒绝?但我nginx设置的是
worker_rlimit_nofile 65535; events { worker_connections 65535; } |
- nginx配置问题
但安卓和模拟器可以正常访问到图片
- 404?
真机调试,console栏里什么都没输出,没任何错误
- 图片路径在IOS上没赋值成功
打开Wxml查看好好的啊
已经查阅N多资料,折腾了两周,问题还没解决,或许就差那一点点,大神们和腾讯官方给协助一下,谢谢~~
我也遇到过, 但是我的是在安卓机, 小米mix2s上, 在调试工具中是能正常显示的 一个 http://img , 但在安卓机上就显示不出来, 监控的error 也触发了, 错误信息是 404, 但是实际上是有这张图片的, 且在浏览器上也能正常范围。 这是什么原因