- 上传代码时显示腾讯现网未开通
上传代码时显示腾讯现网未开通
2018-07-19 - 程序不报错但是图片出不来
绝对是bug[图片] <view class="container"> <scroll-view scroll-y="true" scroll-into-view="{{scrollIntoView}}" bindscroll="onScroll"> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> <block wx:for="{{imgUrls}}"> <swiper-item> <image src="{{item}}" class="slide-image" width="355" height="150" /> </swiper-item> </block> </swiper> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoPlay}}"> <swiper-item wx:for="{{icons}}" wx:for-item="list" wx:key="id"> <view class="icon" wx:for="{{list}}" wx:for-item="icon" wx:key="id" bindtap="toNearby"> <image src="{{icon.img}}"/> <text>{{icon.name}}</text> </view> </swiper-item> </swiper> </scroll-view> </view> var qcloud = require('../../vendor/wafer2-client-sdk/index') var config = require('../../config') var util = require('../../utils/util.js') Page({ data: { imgUrls: [ '../../imgs/index/404625.jpg', '../../imgs/index/404625.jpg', '../../imgs/index/404625.jpg' ], indicatorDots: true, autoplay: true, interval: 5000, duration: 1000, autoPlay: false, icons: [ [ { id: 1, img: '../../imgs/index/icon_1.jpg', name: '美食', url: '' }, { id: 2, img: '../../imgs/index/icon_2.jpg', name: '超市', url: '' }, { id: 3, img: '../../imgs/index/icon_3.jpg', name: '鲜果购', url: '' }, { id: 4, img: '../../imgs/index/icon_4.jpg', name: '下午茶', url: '' }, { id: 5, img: '../../imgs/index/icon_5.jpg', name: '正餐优选', url: '' }, { id: 6, img: '/imgs/index/icon_6.jpg', name: '外卖专送', url: '' }, { id: 7, img: '/imgs/index/icon_7.jpg', name: '饮品站', url: '' }, { id: 8, img: '/imgs/index/icon_8.jpg', name: '小吃馆', url: '' } ], [ { id: 9, img: '/imgs/index/icon_9.jpg', name: '新商家', url: '' }, { id: 10, img: '/imgs/index/icon_10.jpg', name: '免配送费', url: '' }, { id: 11, img: '/imgs/index/icon_11.jpg', name: '鲜花蛋糕', url: '' }, { id: 12, img: '/imgs/index/icon_12.jpg', name: '名气餐厅', url: '' }, { id: 13, img: '/imgs/index/icon_13.jpg', name: '异国料理', url: '' }, { id: 14, img: '/imgs/index/icon_14.jpg', name: '家常菜', url: '' }, { id: 15, img: '/imgs/index/icon_15.jpg', name: '能量西餐', url: '' }, { id: 16, img: '/imgs/index/icon_16.jpg', name: '无辣不欢', url: '' } ] ] }, // 用户登录示例 login: function () { if (this.data.logged) return util.showBusy('正在登录') var that = this // 调用登录接口 qcloud.login({ success(result) { if (result) { util.showSuccess('登录成功') that.setData({ userInfo: result, logged: true }) } else { // 如果不是首次登录,不会返回用户信息,请求用户信息接口获取 qcloud.request({ url: config.service.requestUrl, login: true, success(result) { util.showSuccess('登录成功') that.setData({ userInfo: result.data.data, logged: true }) }, fail(error) { util.showModel('请求失败', error) console.log('request fail', error) } }) } }, fail(error) { util.showModel('登录失败', error) console.log('登录失败', error) } }) }, // 切换是否带有登录态 switchRequestMode: function (e) { this.setData({ takeSession: e.detail.value }) this.doRequest() }, doRequest: function () { util.showBusy('请求中...') var that = this var options = { url: config.service.requestUrl, login: true, success(result) { util.showSuccess('请求成功完成') console.log('request success', result) that.setData({ requestResult: JSON.stringify(result.data) }) }, fail(error) { util.showModel('请求失败', error); console.log('request fail', error); } } if (this.data.takeSession) { // 使用 qcloud.request 带登录态登录 qcloud.request(options) } else { // 使用 wx.request 则不带登录态 wx.request(options) } }, // 上传图片接口 doUpload: function () { var that = this // 选择图片 wx.chooseImage({ count: 1, sizeType: ['compressed'], sourceType: ['album', 'camera'], success: function (res) { util.showBusy('正在上传') var filePath = res.tempFilePaths[0] // 上传图片 wx.uploadFile({ url: config.service.uploadUrl, filePath: filePath, name: 'file', success: function (res) { util.showSuccess('上传图片成功') console.log(res) res = JSON.parse(res.data) console.log(res) that.setData({ imgUrl: res.data.imgUrl }) }, fail: function (e) { util.showModel('上传图片失败') } }) }, fail: function (e) { console.error(e) } }) }, // 预览图片 previewImg: function () { wx.previewImage({ current: this.data.imgUrl, urls: [this.data.imgUrl] }) }, // 切换信道的按钮 switchChange: function (e) { var checked = e.detail.value if (checked) { this.openTunnel() } else { this.closeTunnel() } }, openTunnel: function () { util.showBusy('信道连接中...') // 创建信道,需要给定后台服务地址 var tunnel = this.tunnel = new qcloud.Tunnel(config.service.tunnelUrl) // 监听信道内置消息,包括 connect/close/reconnecting/reconnect/error tunnel.on('connect', () => { util.showSuccess('信道已连接') console.log('WebSocket 信道已连接') this.setData({ tunnelStatus: 'connected' }) }) tunnel.on('close', () => { util.showSuccess('信道已断开') console.log('WebSocket 信道已断开') this.setData({ tunnelStatus: 'closed' }) }) tunnel.on('reconnecting', () => { console.log('WebSocket 信道正在重连...') util.showBusy('正在重连') }) tunnel.on('reconnect', () => { console.log('WebSocket 信道重连成功') util.showSuccess('重连成功') }) tunnel.on('error', error => { util.showModel('信道发生错误', error) console.error('信道发生错误:', error) }) // 监听自定义消息(服务器进行推送) tunnel.on('speak', speak => { util.showModel('信道消息', speak) console.log('收到说话消息:', speak) }) // 打开信道 tunnel.open() this.setData({ tunnelStatus: 'connecting' }) }, /** * 点击「发送消息」按钮,测试使用信道发送消息 */ sendMessage() { if (!this.data.tunnelStatus || !this.data.tunnelStatus === 'connected') return // 使用 tunnel.isActive() 来检测当前信道是否处于可用状态 if (this.tunnel && this.tunnel.isActive()) { // 使用信道给服务器推送「speak」消息 this.tunnel.emit('speak', { 'word': 'I say something at ' + new Date(), }); } }, /** * 点击「关闭信道」按钮,关闭已经打开的信道 */ closeTunnel() { if (this.tunnel) { this.tunnel.close(); } util.showBusy('信道连接中...') this.setData({ tunnelStatus: 'closed' }) } })
2018-05-19 - 为什么不是图片下面是文字的效果
是代码出问题了吗???麻烦大家帮我看看原因,谢谢! <view class="container"> <view class="selection"> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> <block wx:for="{{imgUrls}}" wx:key="quite"> <swiper-item> <image src="{{item}}" class="slide-image" width="355" height="150" /> </swiper-item> </block> </swiper> </view> <view class="selection"> <view class="header"> <text>精品推荐</text> <text class="text_all">全部精品</text> </view> <view class="content"> <view class="content_item" wx:for="{{contentItem}}" wx:key="quite"> <image src='{{img}}'></image> <view class="content_item_text">这里是标题</view> </view> </view> </view> <view class="selection"> <view class="header"> <text>热门评测</text> <text class="text_all">全部评测</text> </view> <view class="list_item" wx:for="{{imageitem}}"> <view class="list_item_image" > <image src='../../../image/2.jpg'></image> </view> <view class="list_item_text"> fdgdhgdhdh </view> </view> </view> </view> swiper{ width: 100%; height: 340rpx; } swiper image{ display: block; width: 100%; height: 100%; } .header{ border-left-width: 2px; border-left-style: solid; border-left-color: green; display: flex; justify-content: space-between; align-items: center; } .text_all{ color: green; font-size: 12px; } .content{ display: flex; flex-wrap: wrap; justify-content: center; } .content_item{ width: 350rpx; height: 200rpx; background-color: blanchedalmond; margin: 5px; position: relative; } .content_item image{ width: 100%; height: 100%; } .content_item_text{ position: absolute; bottom: 0px; color: white; font-size: 15px; background: -webkit-linear-gradient(bottom,rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0)); height: 80rpx; width: 98%; display: flex; flex-direction: column; justify-content: flex-end; padding: (1%,1%,1%); } .list_item{ display: flex; height: 500rpx; width: 100%; } .list_item_image{ height: 100%; width: 100%; } .list_item_text{ height: 200rpx; width: 100%; background: brown; } Page({ /** * 页面的初始数据 */ data: { imgUrls: [ 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' ], indicatorDots: true, autoplay: true, interval: 5000, duration: 1000, img:[ '../../../image/lunbo.jpg' ], contentItem:['','','',''], imageitem: ['', '', '', '','', '', '', '' ] }, })
2018-05-14 - 程序不报错内容不显示
这段代码并不报错,但是在小程序中就是不显示内容怎么回事,求知道的朋友麻烦指导一下 <view class='pro-item' wx:for="{{proList}}"bindtap='toDetail' data-index='{{index}}' wx:key="quite"> <image class='pro-logo' src='../../imgs/index/icon_12.jpg'></image> <view class='pro-body'> <view class='pro-title'>{{item.title}}</view> <text class='pro-desc'>联系中心</text> <view class='pro-footer'> <image class='pro-dtail' src='../../imgs/index/1.jpg'></image> <image class='pro-dtail' src='../../imgs/index/3.jpg'></image> </view> </view> </view> </view> Page({ data: { imgUrls: [ '../../imgs/index/lunbo.jpg', '../../imgs/index/lunbo1.jpg', '../../imgs/index/lunbo2.jpg', ], indicatorDots: false, autoplay: true, interval: 5000, duration: 1000, }, proList:[ { title:'affefsfsdf', } ],
2018-05-07