InfoGoodsReview.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!-- Goodsreview.vue -->
  2. <template>
  3. <view
  4. id="review"
  5. ref="review"
  6. class="div ui-review-wrapper ui-detail-common"
  7. @click="getGoodsEvaluation()"
  8. >
  9. <view class="div main-content"><flex-line :is-link="true" :show-border="true"><text class="span line-name">评价</text></flex-line></view>
  10. <view class="div goods-review-body">
  11. <review-list :list="reviewList"></review-list>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import { urlencode } from '@/util/common'
  17. import ReviewList from './ReviewList'
  18. import flexLine from '../../../flexLine'
  19. import { getReviewList } from '../../../../api/homegoodsdetail'
  20. import { mapState, mapMutations } from 'vuex'
  21. export default {
  22. data () {
  23. return {
  24. reviewList: []
  25. }
  26. },
  27. computed: {
  28. ...mapState({
  29. currentProductId: state => state.goodsdetail.currentProductId
  30. })
  31. },
  32. components: {
  33. flexLine,
  34. ReviewList
  35. },
  36. created () {
  37. this.getReviewList()
  38. },
  39. mounted () {
  40. setTimeout(() => {
  41. const reviewinfo = uni.createSelectorQuery().in(this)
  42. reviewinfo.select('#review').boundingClientRect(res =>{
  43. this.$emit('reviewposition',res.top - res.height);
  44. }).exec();
  45. }, 500);
  46. },
  47. methods: {
  48. ...mapMutations({
  49. changeIndex: 'changeIndex'
  50. }),
  51. getReviewList () {
  52. getReviewList(this.currentProductId,'',1).then(res => {
  53. if (res) {
  54. this.reviewList = res.result.goods_eval_list
  55. }
  56. })
  57. },
  58. /* 评论 */
  59. getGoodsEvaluation () {
  60. uni.navigateTo({ url: '/pages/home/goodsdetail/GoodsEvaluation'+'?'+urlencode( { 'goods_id': this.currentProductId } )})
  61. },
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .main-content{padding:0 $pageSpace;background-color: #fff;}
  67. .ui-review-wrapper {
  68. .goods-review-body {
  69. background: #ffffff;
  70. }
  71. }
  72. </style>