一机游雄安uniapp源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

381 lines
12 KiB

<template>
<view>
<view class="an_box_3">
<!-- 评价表情 -->
<view class="dy_fx amt_30 aml_30 amr_30 pjfm_bqing">
<view class="fx_1"><image :src="commentDetail.grade == '1.0'?'../../../static/animg/star1_a.png':'../../../static/animg/star1.png'" class="at_size_1" mode="aspectFill"></image></view>
<view class="fx_1"><image :src="commentDetail.grade == '2.0'?'../../../static/animg/star2_a.png':'../../../static/animg/star2.png'" class="at_size_1" mode="aspectFill"></image></view>
<view class="fx_1"><image :src="commentDetail.grade == '3.0'?'../../../static/animg/star3_a.png':'../../../static/animg/star3.png'" class="at_size_1" mode="aspectFill"></image></view>
<view class="fx_1"><image :src="commentDetail.grade == '4.0'?'../../../static/animg/star4_a.png':'../../../static/animg/star4.png'" class="at_size_1" mode="aspectFill"></image></view>
<view class="fx_1"><image :src="commentDetail.grade == '5.0'?'../../../static/animg/star5_a.png':'../../../static/animg/star5.png'" class="at_size_1" mode="aspectFill"></image></view>
</view>
<!-- <view class="amt_30 agn_center an_t_2">先来评个分吧~</view> -->
</view>
<view class="">
<!-- 景区服务 -->
<view v-for="(item,index) in commentDetail.firstList" :key="index">
<view class="an_box_2">
<view class="dy_fx">
<view class="at_t">{{item.firstName}}</view>
<view class="fx_1 pjfm_star">
<view class="yk_star"><uni-rate :value="item.remark" :disabled="true" :size="30" :is-fill="false" active-color="#00B4A2" /></view>
<view class="jia_fen"><text class="yk_daf">{{item.remark}}分</text></view>
</view>
</view>
</view>
<!-- 隐藏标签 -->
<view class="amt_30 aml_30">
<view class="yinc_sub">
<scroll-view class="anx_scl_1" scroll-x="true" @scroll="scroll">
<view class="scl_1_ut" v-for="(items,indexs) in item.thirdList" :key="indexs">
<view class="yue_ipt cur"><view class="an_t_2">{{items.dicname}}</view></view>
</view>
<!-- <view class="scl_1_ut">
<view class="yue_ipt cur"><view class="an_t_2">景区卫生整洁</view></view>
</view>
<view class="scl_1_ut cur">
<view class="yue_ipt"><view class="an_t_2">景区卫生整洁</view></view>
</view> -->
</scroll-view>
</view>
</view>
</view>
<!-- 景区设施 -->
<!-- <view class="an_box_2">
<view class="dy_fx">
<view class="at_t">景区设施</view>
<view class="fx_1 pjfm_star">
<view class="yk_star"><uni-rate :value="4" :disabled="true" :size="30" :is-fill="false" active-color="#00B4A2" /></view>
<view class="jia_fen"><text class="yk_daf">4.5分</text></view>
</view>
</view>
</view>
<view class="amt_30 aml_30">
<view class="yinc_sub">
<scroll-view class="anx_scl_1" scroll-x="true" @scroll="scroll">
<view class="scl_1_ut">
<view class="yue_ipt cur"><view class="an_t_2">景区卫生整洁</view></view>
</view>
</scroll-view>
</view>
</view> -->
</view>
<view class="an_box">
<view class="an_t_1">评价内容</view>
<view class="amt_30 wc_cont">
<view class="at_t">
{{commentDetail.evaluate}}
</view>
</view>
</view>
<view class="an_box">
<!-- 评价图片 -->
<view class="dy_fx fx_warp_w pjfm_tu">
<view v-for="(item,index) in commentDetail.image_url" :key="index" class="w_25 an_pbl"><image :src="item" class="apj_u_nr" mode="aspectFill"></image></view>
<!-- 图片 -->
<!-- <view class="w_25 an_pbl"><image src="../../../../static/animg/p1.png" class="apj_u_nr" mode="aspectFill"></image></view> -->
</view>
</view>
<!-- 评论区 -->
<view class="an_box">
<view class="pjfm_textarea">
<view class="aml_30 amr_30">
<view class="amb_30" v-for="(item,index) in commentDetail.interactList" :key="index">
<view class="dy_fx">
<view v-if="item.types == 'REPLY'" class="at_t hfu_ren_adm">回复人:系统管理员</view>
<view v-if="item.types == 'ASSESS'" class="at_t hfu_ren_adm">回复人:{{item.user_name}}<!-- 回复人:我 --></view>
<view class="fx_1 agn_right"><view class="an_t_2">{{item.createtime}}</view></view>
</view>
<view class="amt_30">
<view class="at_t">
{{item.content}}
</view>
</view>
<view class="an_box">
<!-- 评价图片 -->
<view class="dy_fx fx_warp_w pjfm_tu">
<view v-if="items != ''" v-for="(items,indexs) in item.imageurlArr" :key="indexs" class="w_26 an_pbl"><image :src="rootPaht+items" class="apj_u_nr" mode="aspectFill"></image></view>
<!-- 图片 -->
<!-- <view class="w_25 an_pbl"><image src="../../../../static/animg/p1.png" class="apj_u_nr" mode="aspectFill"></image></view> -->
</view>
</view>
</view>
<!-- 文本域 -->
<view v-if="commentDetail.comment_state == 'OPEN' && this.type == 'user'" class="amt_30">
<view class="pjfm_textarea yue_ipt">
<textarea class="textarea_h" v-model="commentValue" placeholder-style="color:#999" placeholder="亲,点击这里可以添加评论哦~(必填) " auto-height />
</view>
</view>
<view class="amt_30 hfu_tu_1" v-if="commentDetail.comment_state == 'OPEN' && this.type == 'user'">
<view class="dy_fx fx_warp_w pjfm_tu">
<!-- 上传图片按钮 -->
<view class="w_25">
<view class="apj_u_nr">
<button @tap="beforeUpload" class="yue_fm_btn schu_an">
<view class="yue_ipt">
<image src="../../../static/animg/i_xj.png" class="ac_size_1" mode="aspectFill"></image>
<view class="an_t_2">上传图片</view>
</view>
</button>
</view>
</view>
<!-- 图片 -->
<view v-for="(item,index) in pics" :key="index" class="w_25 an_pbl">
<image :src="rootPaht + item" class="apj_u_nr" mode="aspectFill"></image>
<view @tap="delImg(index)" class="pj_btn_del"><image src="../../../static/animg/i_qx_2.png" class="ac_size_1" mode="aspectFill"></image></view>
</view>
<!--<view class="w_25 an_pbl">
<image src="../../../static/animg/p1.png" class="apj_u_nr" mode="aspectFill"></image>
图片删除按钮
<view class="pj_btn_del"><image src="../../../static/animg/i_qx_2.png" class="ac_size_1" mode="aspectFill"></image></view>
</view>
-->
</view>
</view>
</view>
</view>
</view>
<view class="an_box"></view>
<!-- 按钮 -->
<view v-if="commentDetail.comment_state == 'OPEN' && this.type == 'user'" class="amt_60" style="margin-top:150rpx">
<view class="an_box">
<view class="dy_fx " style="justify-content: center;">
<view @tap="submitComment()" class="w_35 amr_30"><button form-type="submit" class="yue_fm_btn yue_e_bun">评价</button></view>
<view @tap="backPage()" class="w_35"><button form-type="submit" class="yue_fm_btn yue_e_qx_h">取消</button></view>
</view>
</view>
</view>
</view>
</template>
<script>
import uniRate from '@/components/uni-rate/uni-rate.vue';
import aes from "@/common/aes.js";
export default {
components: {
uniRate
},
data() {
return {
guid:"",
commentDetail:{},
rootPaht: this.$config.ROOTPATH,
pics:[],
commentValue:"",
type:"",
netType:true
};
},
onLoad(options) {
var that = this;
this.$util.getNetworkType(
function(res){
if(res.networkType === 'none'){
uni.showToast({
title:that.$param.netMsg,
icon:"none",
duration:2000
})
that.netType = false;
}
},function(){
uni.showToast({
title:that.$param.netMsg,
icon:"none",
duration:2000
})
that.netType = false;
}
)
if(!that.netType){
return;
}
this.guid = options.guid;
this.type = options.type;
this.getCommentDetail(options.guid);
},
methods: {
getCommentDetail:function(guid){
var that = this;
var data = {
guid:guid,
userkey:this.$param.userkey
}
this.$Request.post(this.$config.getCommentDetail, data).then(res => {
//console.log(res);
that.commentDetail = res.data;
var imgArr = that.commentDetail.image_url;
for(var i = 0;i < imgArr.length;i++){
imgArr[i] = that.rootPaht + imgArr[i];
}
that.commentDetail.image_url = imgArr;
});
},
submitComment:function(){
var that = this;
var filePath = "";
if(that.pics.length > 0){
filePath = that.pics.join(",")
}
if(that.commentValue == ''){
uni.showToast({
title:"请填写内容",
icon:"none"
})
return;
}
var data = {
commentid:that.guid,
types:"ASSESS",
userid:aes.aesDecrypt(uni.getStorageSync("userid")),
// userid:1,
username:aes.aesDecrypt(uni.getStorageSync("nickname")),
// username:" C",
content:that.commentValue,
imageurl:filePath,
ispublish:"YES"
}
this.$Request.post(this.$config.saveCommentInteract, data).then(res => {
console.log(res);
if(res.status == 200){
uni.showModal({
title:"提示",
content:"回复成功",
showCancel:false,
success() {
that.commentValue = "";
that.pics = []
that.getCommentDetail(that.guid)
}
})
}else{
uni.showToast({
title:res.msg,
icon:"none"
})
}
});
},
beforeUpload:function(){
var that = this;
switch (uni.getSystemInfoSync().platform) {
case 'android':
//安卓
this.$util.bindGpsObj(that);
Android.gotoDetial("ImageFrom","camera");
Android.gotoDetial("SVGLINE","");
break;
case 'ios':
//ios授权
this.$util.bindGpsObj(that);
window.location.href = "https://www.baidu.com?url=svg&value=kong";
break;
}
this.uploadImg();
},
uploadImg:function(){
var that = this;
var pics = that.pics;
if(pics.length < 9){
uni.chooseImage({
count: 9, // 最多可以选择的图片张数,默认9
sizeType: ['original','compressed'], // original 原图,compressed 压缩图,默认二者都有
sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
success: function (res) {
uni.showLoading({
mask:true,
title:"上传中"
})
var imgsrc = res.tempFilePaths;
uni.uploadFile({
url: that.$config.fileUpload,
filePath: imgsrc[0],
name: 'file',
success(res) {
if(res.statusCode != 200){
uni.showToast({
title:"上传失败",
icon:"none"
})
uni.hideLoading();
}
var obj = JSON.parse(res.data);
var flag = that.$util.isSuccess(obj);
if(!flag){
return;
}
obj = obj.data;
pics = pics.concat(obj.path);
that.pics = pics;
uni.hideLoading();
},
fail(res){
uni.showToast({
title:"上传失败",
icon:"none"
})
uni.hideLoading();
}
})
}
})
}else{
uni.showToast({
title:"最多上传9张",
icon:"none"
})
}
},
delImg:function(index){
this.pics.splice(index,1);
},
receiveSuccess:function(base64){
var that = this;
var pics = that.pics;
uni.showLoading({
mask:true,
title:"上传中"
})
var data = {
file: base64,
}
that.$Request.post(that.$config.base64Upload, data).then(res => {
if(res.status != 200){
uni.showToast({
title:"上传失败",
icon:"none"
})
uni.hideLoading();
return;
}
var obj = res.data;
pics = pics.concat(obj.path);
that.pics = pics;
uni.hideLoading();
})
},
backPage:function(){
uni.navigateBack({
delta: 1
})
}
}
};
</script>
<style>
page {
background: #fff;
}
.w_26 {
margin-bottom: 10px;
width: 23.5%;
margin-right: 7%;
}
</style>