chartItem.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="container-chart-item" @click="goDetail(list)">
  3. <text class="chart-title text_twoLine">{{ list.Title }}</text>
  4. <view class="item-content-img">
  5. <image :src="list.BodyHtml" mode=""></image>
  6. </view>
  7. <view class="chart-tag">
  8. <text class="tag-item" v-if="list.PtagName">{{ list.PtagName }}</text>
  9. <text class="tag-item" v-if="list.CtagName">{{ list.CtagName }}</text>
  10. </view>
  11. <view class="chart-collect" v-if="isMyChartCollection">
  12. <text class="cancel" @click.stop="myChartIsTop(list.ChartId)">{{ list.IsTop ? "取消置顶" : "置顶" }}</text>
  13. <text class="remove" @click.stop="myChartCollect(list.ChartId)">移除</text>
  14. </view>
  15. <view class="my-chart-collect" v-if="isMyChartCollection && list.IsTop"></view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: "",
  21. components: {},
  22. props: {
  23. list: {
  24. type: Object,
  25. default: {},
  26. required: true,
  27. },
  28. isMyChartCollection: {
  29. type: Boolean,
  30. default: false,
  31. },
  32. },
  33. data() {
  34. return {};
  35. },
  36. computed: {},
  37. watch: {},
  38. created() {},
  39. mounted() {},
  40. methods: {
  41. goDetail(item) {
  42. if (item.HomeType !== 1) {
  43. /* 无需授权且已绑定 检验是或否有权限 */
  44. this.$store.dispatch("checkHandle", "/pageMy/chartPage/chartPage?id=" + item.ChartId);
  45. }
  46. },
  47. myChartIsTop(id){
  48. console.log('子组件');
  49. this.$emit("myChartIsTop", id)
  50. },
  51. myChartCollect(id){
  52. this.$emit("myChartCollect", id)
  53. }
  54. },
  55. };
  56. </script>
  57. <style scoped lang="scss">
  58. .container-chart-item {
  59. position: relative;
  60. width: 100%;
  61. padding: 20rpx 20rpx 0;
  62. background: #ffffff;
  63. box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16);
  64. border-radius: 8rpx;
  65. margin-bottom: 20rpx;
  66. .chart-title {
  67. height: 90rpx;
  68. font-size: 32rpx;
  69. font-weight: 500;
  70. color: #333333;
  71. line-height: 42rpx;
  72. border-bottom: 1rpx solid #dcdfe6;
  73. }
  74. .item-content-img {
  75. width: 330rpx;
  76. height: 286rpx;
  77. image {
  78. width: 100%;
  79. height: 100%;
  80. }
  81. }
  82. .chart-collect {
  83. display: flex;
  84. align-items: center;
  85. justify-content: space-between;
  86. padding-bottom: 20rpx;
  87. .cancel {
  88. background: #3385ff;
  89. margin-right: 20rpx;
  90. color: #ffffff;
  91. }
  92. .remove {
  93. border: 1px solid #3385ff;
  94. color: #3385ff;
  95. }
  96. text {
  97. width: 150rpx;
  98. height: 46rpx;
  99. line-height: 46rpx;
  100. border-radius: 4rpx;
  101. text-align: center;
  102. font-size: 24rpx;
  103. }
  104. }
  105. .my-chart-collect {
  106. position: absolute;
  107. top: 0;
  108. left: 0;
  109. width: 0;
  110. height: 0;
  111. border-top: 60rpx solid #3385ff;
  112. border-right: 60rpx solid transparent;
  113. }
  114. .chart-tag {
  115. display: flex;
  116. align-items: center;
  117. justify-content: space-between;
  118. height: 78rpx;
  119. border-top: 1rpx solid #dcdfe6;
  120. .tag-item {
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. width: 150rpx;
  125. height: 38rpx;
  126. border-radius: 28rpx;
  127. border: 2rpx solid #3189ff;
  128. color: #3385ff;
  129. font-size: 24rpx;
  130. }
  131. }
  132. }
  133. </style>