AbroadEvaluate.vue 4.99 KB
<template>
  <div id="abroadEvaluate">
    <div class="top">
      <div class="score">
        <span>{{ score }}.0</span>
        <div>
          <p>商家评分</p>
          <van-rate v-model="score" void-icon="star" void-color="#eee" color="#FFCC00" :size="14" />
        </div>
      </div>
      <!-- <div class="sort_btn">
        <span class="active">全部</span>
        <span>最新评价</span>
        <span>评分由高到低</span>
        <span>评分由低到高</span>
      </div> -->
    </div>
    <div class="evaluate_list">
      <div class="evaluate_item" v-for="(item, index) in list" :key="index">
        <div class="user">
          <img src="@/assets/head.png" alt="" />
          <div>
            <p>{{ item.nickName || '匿名用户' }}</p>
            <span>{{ item.intime }}</span>
          </div>
        </div>
        <div class="rate_box">
          <van-rate v-model="item.courseScore" void-icon="star" void-color="#eee" color="#FFCC00" :size="18" />
          <span class="rate">{{ item.courseScore }}.0</span>
        </div>
        <p class="evaluation"><span>评价:</span>{{ item.evaluation }}</p>
        <div class="evaluation_img_box">
          <!-- <img class="evaluation_img" src="@/assets/head.png" alt=""> -->
          <img
            class="evaluation_img"
            v-for="(imgItem, index) in item.imgList"
            :key="index"
            :src="imgItem.imgUrl"
            alt=""
            @click="previewImg(imgItem.imgUrl)"
          />
        </div>
      </div>
    </div>
    <van-popup v-model="showPreview" round get-container="body">
      <img class="preview_img" :src="previewUrl" alt="" />
    </van-popup>
  </div>
</template>
<script>
export default {
  data() {
    return {
      score: '',
      list: [],
      previewUrl: '', //图片预览
      showPreview: false,
    }
  },
  mounted() {
    const courseId = this.$route.query.courseId
    this.$toast.loading({
      message: '加载中...',
    })
    this.getEvaluationList(courseId)
  },
  methods: {
    getEvaluationList(courseId) {
      this.yxAxios.get(`${this.yanxueUrl}/api/StudiesWap/Evaluation/List?courseId=${this.courseId}`).then((res) => {
        this.$toast.clear()
        if (res.data.status == 1) {
          let list = res.data.data?.evaluationList
          for (let i in list) {
            list[i].intime = this.Moment(list[i].intime).format('YYYY.MM.DD')
          }
          this.list = list
          this.score = res.data.data?.shopScore
        }
      })
    },
    // 预览图片
    previewImg(url) {
      this.previewUrl = url
      this.showPreview = true
    },
  },
}
</script>
<style lang="scss" scoped>
#abroadEvaluate {
  .top {
    width: 100%;
    box-sizing: border-box;
    border-top: 16px solid #f6f7fa;
    border-bottom: 16px solid #f6f7fa;
    padding: 24px;
    background: #fff;
    .score {
      display: flex;
      align-items: center;
      span {
        margin-right: 24px;
        font-size: 76px;
        font-weight: bold;
      }
      p {
        margin-bottom: 6px;
        font-size: 24px;
        color: #999;
      }
    }
    .sort_btn {
      margin-top: 16px;
      span {
        display: inline-block;
        min-width: 128px;
        box-sizing: border-box;
        padding: 6px 16px;
        margin-right: 20px;
        text-align: center;
        background: #b9d0ff;
        border-radius: 8px;
        font-size: 24px;
        color: #fff;
        &.active {
          background: #3074ff;
        }
      }
    }
  }
  .evaluate_list {
    padding: 0 24px;
    .evaluate_item {
      padding: 24px 0;
      &:not(:last-of-type) {
        border-bottom: 2px solid #f2f4f9;
      }
      .user {
        display: flex;
        align-items: center;
        img {
          width: 70px;
          height: 70px;
          margin-right: 16px;
          border-radius: 50%;
          overflow: hidden;
        }
        p {
          margin-bottom: 12px;
          font-size: 30px;
        }
        span {
          font-size: 26px;
          color: #999;
        }
      }
      .rate_box {
        margin-top: 16px;
        .rate {
          color: #ffcc00;
          font-size: 30px;
          margin-left: 10px;
        }
      }
      .evaluation {
        margin-top: 30px;
        font-size: 30px;
        span {
          font-weight: bold;
        }
      }
      .evaluation_img_box {
        margin-top: 22px;
        .evaluation_img {
          width: 212px;
          height: 212px;
          margin-right: 9px;
          margin-bottom: 9px;
          &:nth-of-type(3n) {
            margin-right: 0;
          }
        }
      }
    }
  }
}
.preview_img {
  width: 100vw;
}
</style>
<style lang="scss">
.elder {
  #abroadEvaluate {
    .top .score {
      span {
        font-size: 80px;
      }
      p {
        font-size: 36px;
      }
    }
    .evaluate_list .evaluate_item {
      .user {
        p {
          font-size: 40px;
        }
        span {
          font-size: 40px;
        }
      }
      .evaluation {
        font-size: 40px;
      }
    }
  }
}
</style>