Browse Source

文化配送 评论显示图片

master
caichunsheng 4 years ago
parent
commit
878221292f
  1. 11
      pages/index/index.js
  2. 7
      pages/index/index.wxml
  3. 11
      pages/info/hotelProductInfo/index.js
  4. 5
      pages/info/hotelProductInfo/index.wxml
  5. 6
      pages/info/hotelProductInfo/index.wxss
  6. 11
      pages/info/postProductInfo/index.js
  7. 5
      pages/info/postProductInfo/index.wxml
  8. 6
      pages/info/postProductInfo/index.wxss
  9. 13
      pages/info/sceneProductInfo/index.js
  10. 5
      pages/info/sceneProductInfo/index.wxml
  11. 9
      pages/info/sceneProductInfo/index.wxss
  12. 23
      pages/list/comments/index.js
  13. 6
      pages/list/comments/index.wxml
  14. 8
      pages/list/comments/index.wxss
  15. 85
      pages/order/comment/index.js
  16. 4
      pages/pbService/index.wxml

11
pages/index/index.js

@ -52,7 +52,7 @@ Page({
this.setData({ this.setData({
showTime:true showTime:true
}) })
let timer = setInterval(() => { var timer = setInterval(() => {
this.setData({ this.setData({
time: this.data.time - 1 time: this.data.time - 1
}) })
@ -61,8 +61,10 @@ Page({
this.setData({ this.setData({
showFullAdv: false showFullAdv: false
}) })
if (!this.data.alertSwipeList>0) if (this.data.alertSwipeList.length==0) {
wx.showTabBar() //倒计时结束清楚定时器显示导航栏 wx.showTabBar() //倒计时结束清楚定时器显示导航栏
}
} }
}, 1000) }, 1000)
@ -196,7 +198,7 @@ Page({
alertSwipeList: res.data || [], alertSwipeList: res.data || [],
showAdv: true showAdv: true
}) })
}else{ }else if(!this.data.showFullAdv){
wx.showTabBar({ wx.showTabBar({
animation: true, animation: true,
}) })
@ -613,6 +615,7 @@ Page({
}) })
}, },
bannerJumpNew(item) { bannerJumpNew(item) {
let that = this let that = this
item = item.currentTarget.dataset.item item = item.currentTarget.dataset.item
if (item.tdata == '') return if (item.tdata == '') return

7
pages/index/index.wxml

@ -24,7 +24,7 @@
<swiper class="swiper" autoplay="{{true}}" interval="{{5000}}" duration="{{300}}" bindchange="changeBannerIndex"> <swiper class="swiper" autoplay="{{true}}" interval="{{5000}}" duration="{{300}}" bindchange="changeBannerIndex">
<block wx:for="{{banner}}" wx:key="*this"> <block wx:for="{{banner}}" wx:key="*this">
<swiper-item bindtap="bannerClick" data-item="{{item}}"> <swiper-item bindtap="bannerClick" data-item="{{item}}">
<image src="{{item.head_img}}" mode="aspectFill"></image> <image src="{{item.head_img}}" mode="scaleToFill"></image>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
@ -220,6 +220,11 @@
<image src="https://static.ticket.sz-trip.com/xcxImages/index/newpb5.png" mode="widthFix"></image> <image src="https://static.ticket.sz-trip.com/xcxImages/index/newpb5.png" mode="widthFix"></image>
<view>书香借阅</view> <view>书香借阅</view>
</view> </view>
<view bindtap="gotoPath" data-event="book_click" data-title="书香借阅" data-path="/pages/culture/index"
class="pbservice-item">
<image src="https://static.ticket.sz-trip.com/uploads/20220818/e02af6e8bf9170060ed7295d367d72c1.png" mode="widthFix"></image>
<view>文化配送</view>
</view>
</view> </view>
</scroll-view> </scroll-view>
<view class="scroll-line"> <view class="scroll-line">

11
pages/info/hotelProductInfo/index.js

@ -218,6 +218,17 @@ Page({
comment: res.data.list, comment: res.data.list,
commentTotal: res.data.total commentTotal: res.data.total
}) })
let arr = this.data.comment
arr.map((item)=>{
if (item.img_list) {
item.img_list = item.img_list.split(',')
}else{
item.img_list=[]
}
})
this.setData({
comment:arr
})
}) })
}, },
like: function () { like: function () {

5
pages/info/hotelProductInfo/index.wxml

@ -105,12 +105,15 @@
<view class="product-comment-top"> <view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image> <image src="{{item.user.avatar}}" mode="aspectFill"></image>
<view class="comment-info"> <view class="comment-info">
<view class="nickname">{{item.user.nickname}}</view> <view class="nickname">{{item.nickname}}</view>
<view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view> <view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view>
</view> </view>
<view class="comment-date">{{item.create_time}}</view> <view class="comment-date">{{item.create_time}}</view>
</view> </view>
<view class="comment-content">{{item.content}}</view> <view class="comment-content">{{item.content}}</view>
<view wx:if="{{item.img_list}}">
<image class="imgs" wx:for="{{item.img_list}}" wx:for-item="Goods" mode="scaleToFill" data-img="{{Goods}}" data-list="{{item.img_list}}" src="{{Goods}}" bindtap="imgsc"></image>
</view>
</navigator> </navigator>
<navigator url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">查看全部点评<text class="iconfont icon-you"></text></navigator> <navigator url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">查看全部点评<text class="iconfont icon-you"></text></navigator>
</view> </view>

6
pages/info/hotelProductInfo/index.wxss

@ -550,4 +550,10 @@ page {
font-size: 31rpx; font-size: 31rpx;
font-weight: 500; font-weight: 500;
margin-top: 50rpx; margin-top: 50rpx;
}
.imgs{
width: 200rpx;
height: 200rpx;
margin: 10rpx;
border-radius: 8rpx;
} }

11
pages/info/postProductInfo/index.js

@ -92,6 +92,17 @@ Page({
comment: res.data.list, comment: res.data.list,
commentTotal: res.data.total commentTotal: res.data.total
}) })
let arr = this.data.comment
arr.map((item)=>{
if (item.img_list) {
item.img_list = item.img_list.split(',')
}else{
item.img_list=[]
}
})
this.setData({
comment:arr
})
}) })
}, },

5
pages/info/postProductInfo/index.wxml

@ -66,13 +66,16 @@
<view class="product-comment-top"> <view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image> <image src="{{item.user.avatar}}" mode="aspectFill"></image>
<view class="comment-info"> <view class="comment-info">
<view class="nickname">{{item.user.nickname}}</view> <view class="nickname">{{item.nickname}}</view>
<view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text <view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text
wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view> wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view>
</view> </view>
<view class="comment-date">{{item.create_time}}</view> <view class="comment-date">{{item.create_time}}</view>
</view> </view>
<view class="comment-content">{{item.content}}</view> <view class="comment-content">{{item.content}}</view>
<view wx:if="{{item.img_list}}">
<image class="imgs" wx:for="{{item.img_list}}" wx:for-item="Goods" mode="scaleToFill" data-img="{{Goods}}" data-list="{{item.img_list}}" src="{{Goods}}" bindtap="imgsc"></image>
</view>
</navigator> </navigator>
<navigator url="/pages/list/comments/index?productid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn"> <navigator url="/pages/list/comments/index?productid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">
查看全部点评<text class="iconfont icon-you"></text></navigator> 查看全部点评<text class="iconfont icon-you"></text></navigator>

6
pages/info/postProductInfo/index.wxss

@ -806,4 +806,10 @@ page {
.mask-allowance .mask-content .rule-title { .mask-allowance .mask-content .rule-title {
text-align: center; text-align: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
}
.imgs{
width: 200rpx;
height: 200rpx;
margin: 10rpx;
border-radius: 8rpx;
} }

13
pages/info/sceneProductInfo/index.js

@ -96,6 +96,7 @@ Page({
this.setData({ this.setData({
info: res.data info: res.data
}) })
console.log(this.data.info);
util.pagePoint({ event: 'scene_view', param: { type: res.data.type, id: res.data.id } }, 1) util.pagePoint({ event: 'scene_view', param: { type: res.data.type, id: res.data.id } }, 1)
this.BroswerRecord() this.BroswerRecord()
}) })
@ -130,7 +131,17 @@ Page({
comment: res.data.list.splice(0, 3), comment: res.data.list.splice(0, 3),
commentTotal: res.data.total commentTotal: res.data.total
}) })
console.log(res) let arr = this.data.comment
arr.map((item)=>{
if (item.img_list) {
item.img_list = item.img_list.split(',')
}else{
item.img_list=[]
}
})
this.setData({
comment:arr
})
}) })
}, },
changeAllowance: function () { changeAllowance: function () {

5
pages/info/sceneProductInfo/index.wxml

@ -167,13 +167,16 @@
<view class="product-comment-top"> <view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image> <image src="{{item.user.avatar}}" mode="aspectFill"></image>
<view class="comment-info"> <view class="comment-info">
<view class="nickname">{{item.user.nickname}}</view> <view class="nickname">{{item.nickname}}</view>
<view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text <view class="iconfont"><text wx:for="{{item.rate}}" class="icon-xingxing"></text><text
wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view> wx:for="{{5 - item.rate}}" style="color:#999" class="icon-xingxing"></text></view>
</view> </view>
<view class="comment-date">{{item.create_time}}</view> <view class="comment-date">{{item.create_time}}</view>
</view> </view>
<view class="comment-content">{{item.content}}</view> <view class="comment-content">{{item.content}}</view>
<view wx:if="{{item.img_list}}">
<image class="imgs" wx:for="{{item.img_list}}" wx:for-item="Goods" mode="scaleToFill" data-img="{{Goods}}" data-list="{{item.img_list}}" src="{{Goods}}" bindtap="imgsc"></image>
</view>
</navigator> </navigator>
<navigator url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn"> <navigator url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">
查看全部点评<text class="iconfont icon-you"></text></navigator> 查看全部点评<text class="iconfont icon-you"></text></navigator>

9
pages/info/sceneProductInfo/index.wxss

@ -259,7 +259,7 @@ page {
} }
.comment-content { .comment-content {
margin-left: 72rpx; margin-left:10rpx;
margin-top: 36rpx; margin-top: 36rpx;
font-size: 28rpx; font-size: 28rpx;
color: #000; color: #000;
@ -272,6 +272,7 @@ page {
color: #999; color: #999;
font-size: 27rpx; font-size: 27rpx;
font-weight: 500; font-weight: 500;
margin-bottom:60rpx ;
} }
.more-comment-btn .iconfont { .more-comment-btn .iconfont {
@ -795,4 +796,10 @@ page {
height: 80rpx; height: 80rpx;
left: 650rpx; left: 650rpx;
border-radius: 50%; border-radius: 50%;
}
.imgs{
width: 200rpx;
height: 200rpx;
margin: 10rpx;
border-radius: 8rpx;
} }

23
pages/list/comments/index.js

@ -45,9 +45,30 @@ Page({
total:res.data.total, total:res.data.total,
list:list.concat(res.data.list) list:list.concat(res.data.list)
}) })
let arr = this.data.list
arr.map((item)=>{
if (item.img_list) {
item.img_list = item.img_list.split(',')
}else{
item.img_list=[]
}
})
this.setData({
list:arr
})
})
},
imgsc:function(e){
console.log(e);
var src = e.currentTarget.dataset.img;//获取data-src
var imgList = e.currentTarget.dataset.list;//获取data-list
console.log(src)
//图片预览
wx.previewImage({
current: src, // 当前显示图片的http链接
urls: imgList // 需要预览的图片http链接列表
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

6
pages/list/comments/index.wxml

@ -5,11 +5,15 @@
<view class="comment-top"> <view class="comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image> <image src="{{item.user.avatar}}" mode="aspectFill"></image>
<view class="author-info"> <view class="author-info">
<view class="author-name">{{item.user.nickname}}</view> <view class="author-name">{{item.nickname}}</view>
<view class="author-time">{{item.create_time}}</view> <view class="author-time">{{item.create_time}}</view>
</view> </view>
</view> </view>
<view class="comment-detail">{{item.content}}</view> <view class="comment-detail">{{item.content}}</view>
<view wx:if="{{item.img_list}}">
<image class="imgs" wx:for="{{item.img_list}}" wx:for-item="Goods" mode="scaleToFill" data-img="{{Goods}}" data-list="{{item.img_list}}" src="{{Goods}}" bindtap="imgsc"></image>
</view>
</view> </view>
<view wx:if="{{list.length==0}}" class="common-empty" style="z-index:-1"> <view wx:if="{{list.length==0}}" class="common-empty" style="z-index:-1">
<image mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image> <image mode="widthFix" src="https://static.ticket.sz-trip.com/xcxImages/other/nodata.png"></image>

8
pages/list/comments/index.wxss

@ -37,11 +37,17 @@
margin-top: 4rpx; margin-top: 4rpx;
} }
.comment-detail { .comment-detail {
margin-left: 87rpx; margin-left: 10rpx;
font-size: 29rpx; font-size: 29rpx;
color: #000; color: #000;
margin-top: 25rpx; margin-top: 25rpx;
} }
.comment-item:last-child { .comment-item:last-child {
border-bottom: none; border-bottom: none;
}
.imgs{
width: 200rpx;
height: 200rpx;
margin: 10rpx;
border-radius: 8rpx;
} }

85
pages/order/comment/index.js

@ -45,7 +45,6 @@ Page({
}) })
}, },
changeStar: function (e) { changeStar: function (e) {
console.log(e)
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
@ -57,11 +56,9 @@ Page({
info: info, info: info,
rate:info.order_product_list[index].star rate:info.order_product_list[index].star
}) })
console.log(info);
wx.hideLoading({}) wx.hideLoading({})
}, },
changeContent: function (e) { changeContent: function (e) {
console.log(e)
let index = e.currentTarget.dataset.index, let index = e.currentTarget.dataset.index,
info = this.data.info; info = this.data.info;
info.order_product_list[index].content = e.detail.value; info.order_product_list[index].content = e.detail.value;
@ -81,7 +78,6 @@ Page({
}) })
flag = false; flag = false;
} }
console.log(item);
ajax.push(commonApi.user_post("product/product_comment", { ajax.push(commonApi.user_post("product/product_comment", {
product_id: item.product_id, product_id: item.product_id,
content: item.content, content: item.content,
@ -93,7 +89,6 @@ Page({
}) })
if (!flag) return; if (!flag) return;
Promise.all(ajax).then(res => { Promise.all(ajax).then(res => {
console.log(res)
let flag = false; let flag = false;
res.map(item => { res.map(item => {
if (item.code == 1) { if (item.code == 1) {
@ -109,12 +104,11 @@ Page({
//图片上传 //图片上传
// 上传图片 // 上传图片
chooseImg: function (e) { chooseImg: function (e) {
console.log(e);
var that = this; var that = this;
var imgs = this.data.imgs; var imgs = this.data.imgs;
if (imgs.length >= 8) { if (imgs.length >= 9) {
wx.showToast({ wx.showToast({
title: '最多上传张图片哦..', title: '最多上传张图片哦..',
icon: 'none' icon: 'none'
}) })
return false; return false;
@ -142,48 +136,46 @@ Page({
} }
var tempFilePaths = res.tempFilePaths; var tempFilePaths = res.tempFilePaths;
var imgs = that.data.imgs; var imgs = that.data.imgs;
wx.uploadFile({ console.log(imgs);
url: 'https://test.api.cloud.sz-trip.com/api/pbservice.other/upload', //这里是上传的服务器地址 wx.showLoading({
filePath: tempFilePaths[0], title: '上传中',
name: 'file', })
header: {
token: wx.getStorageSync('jstrip_token'),
},
success(res) {
var res = JSON.parse(res.data); for (let i = 0; i < tempFilePaths.length; i++) {
if (res.code!=1) { wx.uploadFile({
wx.showToast({ url: 'https://test.api.cloud.sz-trip.com/api/pbservice.other/upload', //这里是上传的服务器地址
title: res.msg, filePath: tempFilePaths[i],
icon: 'none' name: 'file',
}) header: {
return token: wx.getStorageSync('jstrip_token'),
} },
let img = res.data.url; success(res) {
let arr = that.data.upImgs wx.hideLoading()
arr.push(img) var res = JSON.parse(res.data);
that.setData({ if (res.code!=1) {
upImgs:arr wx.showToast({
}) title: res.msg,
console.log(that.data.upImgs); icon: 'none'
for (var i = 0; i < tempFilePaths.length; i++) { })
if (imgs.length >= 9) { return
that.setData({
imgs: imgs
});
return false;
} else {
imgs.push(tempFilePaths[i]);
} }
let img = res.data.url;
let arr = that.data.upImgs
arr.push(img)
that.setData({
upImgs:arr
})
imgs.push(tempFilePaths[i]);
that.setData({
imgs: imgs
});
} }
// console.log(imgs); })
that.setData({ if (that.data,imgs.length+i==8) {
imgs: imgs return
});
console.log(that.data.imgs);
const data = res.data
} }
}) }
} }
}); });
@ -218,7 +210,6 @@ Page({
this.setData({ this.setData({
checked:!this.data.checked checked:!this.data.checked
}) })
console.log(this.data.checked);
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成

4
pages/pbService/index.wxml

@ -38,10 +38,10 @@
<image src="https://static.ticket.sz-trip.com/xcxImages/index/pb4New.png" mode="widthFix"></image> <image src="https://static.ticket.sz-trip.com/xcxImages/index/pb4New.png" mode="widthFix"></image>
<view>12348</view> <view>12348</view>
</view> </view>
<view class="pb-item" data-title="文化配送" bindtap="gotoPath" data-path="/pages/culture/index"> <!-- <view class="pb-item" data-title="文化配送" bindtap="gotoPath" data-path="/pages/culture/index">
<image src="https://static.ticket.sz-trip.com/xcxImages/pbservice/pb20.png" mode="widthFix"></image> <image src="https://static.ticket.sz-trip.com/xcxImages/pbservice/pb20.png" mode="widthFix"></image>
<view>文化配送</view> <view>文化配送</view>
</view> </view> -->
</view> </view>
</view> </view>
<image class="title-img" src="https://static.ticket.sz-trip.com/uploads/20211115/335a42385c9e15ece075980209b0643a.png" <image class="title-img" src="https://static.ticket.sz-trip.com/uploads/20211115/335a42385c9e15ece075980209b0643a.png"

Loading…
Cancel
Save