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

7
pages/index/index.wxml

@ -24,7 +24,7 @@
<swiper class="swiper" autoplay="{{true}}" interval="{{5000}}" duration="{{300}}" bindchange="changeBannerIndex">
<block wx:for="{{banner}}" wx:key="*this">
<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>
</block>
</swiper>
@ -220,6 +220,11 @@
<image src="https://static.ticket.sz-trip.com/xcxImages/index/newpb5.png" mode="widthFix"></image>
<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>
</scroll-view>
<view class="scroll-line">

11
pages/info/hotelProductInfo/index.js

@ -218,6 +218,17 @@ Page({
comment: res.data.list,
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 () {

5
pages/info/hotelProductInfo/index.wxml

@ -105,12 +105,15 @@
<view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image>
<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>
<view class="comment-date">{{item.create_time}}</view>
</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 url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">查看全部点评<text class="iconfont icon-you"></text></navigator>
</view>

6
pages/info/hotelProductInfo/index.wxss

@ -550,4 +550,10 @@ page {
font-size: 31rpx;
font-weight: 500;
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,
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">
<image src="{{item.user.avatar}}" mode="aspectFill"></image>
<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>
<view class="comment-date">{{item.create_time}}</view>
</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 url="/pages/list/comments/index?productid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">
查看全部点评<text class="iconfont icon-you"></text></navigator>

6
pages/info/postProductInfo/index.wxss

@ -806,4 +806,10 @@ page {
.mask-allowance .mask-content .rule-title {
text-align: center;
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({
info: res.data
})
console.log(this.data.info);
util.pagePoint({ event: 'scene_view', param: { type: res.data.type, id: res.data.id } }, 1)
this.BroswerRecord()
})
@ -130,7 +131,17 @@ Page({
comment: res.data.list.splice(0, 3),
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 () {

5
pages/info/sceneProductInfo/index.wxml

@ -167,13 +167,16 @@
<view class="product-comment-top">
<image src="{{item.user.avatar}}" mode="aspectFill"></image>
<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>
<view class="comment-date">{{item.create_time}}</view>
</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 url="/pages/list/comments/index?sceneid={{id}}" wx:if="{{comment.length>0}}" class="more-comment-btn">
查看全部点评<text class="iconfont icon-you"></text></navigator>

9
pages/info/sceneProductInfo/index.wxss

@ -259,7 +259,7 @@ page {
}
.comment-content {
margin-left: 72rpx;
margin-left:10rpx;
margin-top: 36rpx;
font-size: 28rpx;
color: #000;
@ -272,6 +272,7 @@ page {
color: #999;
font-size: 27rpx;
font-weight: 500;
margin-bottom:60rpx ;
}
.more-comment-btn .iconfont {
@ -795,4 +796,10 @@ page {
height: 80rpx;
left: 650rpx;
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,
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">
<image src="{{item.user.avatar}}" mode="aspectFill"></image>
<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>
</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 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>

8
pages/list/comments/index.wxss

@ -37,11 +37,17 @@
margin-top: 4rpx;
}
.comment-detail {
margin-left: 87rpx;
margin-left: 10rpx;
font-size: 29rpx;
color: #000;
margin-top: 25rpx;
}
.comment-item:last-child {
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) {
console.log(e)
wx.showLoading({
title: '加载中'
})
@ -57,11 +56,9 @@ Page({
info: info,
rate:info.order_product_list[index].star
})
console.log(info);
wx.hideLoading({})
},
changeContent: function (e) {
console.log(e)
let index = e.currentTarget.dataset.index,
info = this.data.info;
info.order_product_list[index].content = e.detail.value;
@ -81,7 +78,6 @@ Page({
})
flag = false;
}
console.log(item);
ajax.push(commonApi.user_post("product/product_comment", {
product_id: item.product_id,
content: item.content,
@ -93,7 +89,6 @@ Page({
})
if (!flag) return;
Promise.all(ajax).then(res => {
console.log(res)
let flag = false;
res.map(item => {
if (item.code == 1) {
@ -109,12 +104,11 @@ Page({
//图片上传
// 上传图片
chooseImg: function (e) {
console.log(e);
var that = this;
var imgs = this.data.imgs;
if (imgs.length >= 8) {
if (imgs.length >= 9) {
wx.showToast({
title: '最多上传张图片哦..',
title: '最多上传张图片哦..',
icon: 'none'
})
return false;
@ -142,48 +136,46 @@ Page({
}
var tempFilePaths = res.tempFilePaths;
var imgs = that.data.imgs;
wx.uploadFile({
url: 'https://test.api.cloud.sz-trip.com/api/pbservice.other/upload', //这里是上传的服务器地址
filePath: tempFilePaths[0],
name: 'file',
header: {
token: wx.getStorageSync('jstrip_token'),
},
success(res) {
console.log(imgs);
wx.showLoading({
title: '上传中',
})
var res = JSON.parse(res.data);
if (res.code!=1) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
let img = res.data.url;
let arr = that.data.upImgs
arr.push(img)
that.setData({
upImgs:arr
})
console.log(that.data.upImgs);
for (var i = 0; i < tempFilePaths.length; i++) {
if (imgs.length >= 9) {
that.setData({
imgs: imgs
});
return false;
} else {
imgs.push(tempFilePaths[i]);
for (let i = 0; i < tempFilePaths.length; i++) {
wx.uploadFile({
url: 'https://test.api.cloud.sz-trip.com/api/pbservice.other/upload', //这里是上传的服务器地址
filePath: tempFilePaths[i],
name: 'file',
header: {
token: wx.getStorageSync('jstrip_token'),
},
success(res) {
wx.hideLoading()
var res = JSON.parse(res.data);
if (res.code!=1) {
wx.showToast({
title: res.msg,
icon: 'none'
})
return
}
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({
imgs: imgs
});
console.log(that.data.imgs);
const data = res.data
})
if (that.data,imgs.length+i==8) {
return
}
})
}
}
});
@ -218,7 +210,6 @@ Page({
this.setData({
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>
<view>12348</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>
<view>文化配送</view>
</view>
</view> -->
</view>
</view>
<image class="title-img" src="https://static.ticket.sz-trip.com/uploads/20211115/335a42385c9e15ece075980209b0643a.png"

Loading…
Cancel
Save