123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view class="container-chart-item global_card_content" @click="goDetail(list)">
- <view class="global_title">
- <mp-html :content="richTextClamp(2) + list.Title + '</div>'" />
- </view>
- <view class="item-content-img">
- <image :src="list.BodyHtml" mode=""></image>
- </view>
- <view class="chart-tag">
- <text class="tag-item" v-if="list.PtagName">{{ list.PtagName }}</text>
- <text class="tag-item" v-if="list.CtagName">{{ list.CtagName }}</text>
- </view>
- <view class="chart-collect" v-if="isMyChartCollection">
- <text class="cancel" @click.stop="myChartIsTop(list.ChartId)">{{ list.IsTop ? "取消置顶" : "置顶" }}</text>
- <text class="remove" @click.stop="myChartCollect(list.ChartId)">移除</text>
- </view>
- <view class="my-chart-collect" v-if="isMyChartCollection && list.IsTop"></view>
- </view>
- </template>
- <script>
- export default {
- name: "",
- components: {},
- props: {
- list: {
- type: Object,
- default: {},
- required: true,
- },
- isMyChartCollection: {
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {};
- },
- computed: {},
- watch: {},
- created() {},
- mounted() {},
- methods: {
- goDetail(item) {
- if (item.HomeType !== 1) {
- /* 无需授权且已绑定 检验是或否有权限 */
- uni.navigateTo({ url: "/pageMy/chartPage/chartPage?id=" + item.ChartId });
- }
- },
- myChartIsTop(id) {
- this.$emit("myChartIsTop", id);
- },
- myChartCollect(id) {
- this.$emit("myChartCollect", id);
- },
- richTextClamp(val) {
- return `<div style="${
- val == 7 ? "min-height: 50px;" : ""
- }line-clamp: ${val};-webkit-line-clamp: ${val};text-overflow: -o-ellipsis-lastline;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;word-wrap: break-word;word-break: break-all;">`;
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .container-chart-item {
- position: relative;
- width: 100%;
- padding: 20rpx 20rpx 0;
- background: #ffffff;
- box-shadow: 0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16);
- border-radius: 8rpx;
- margin-bottom: 20rpx;
- overflow: hidden;
- .chart-title {
- height: 90rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #333333;
- line-height: 42rpx;
- border-bottom: 1rpx solid #dcdfe6;
- }
- .item-content-img {
- margin-top: 20rpx;
- width: 100%;
- height: 228rpx;
- padding: 10rpx 20rpx;
- background-color: #f0f1f3;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .chart-collect {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-bottom: 20rpx;
- .cancel {
- background: $uni-color-new;
- margin-right: 20rpx;
- color: #ffffff;
- }
- .remove {
- border: 1px solid $uni-color-new;
- color: $uni-color-new;
- }
- text {
- width: 150rpx;
- height: 46rpx;
- line-height: 46rpx;
- text-align: center;
- font-size: 24rpx;
- border-radius: 8rpx;
- }
- }
- .my-chart-collect {
- position: absolute;
- top: -2rpx;
- left: 0;
- width: 0;
- height: 0;
- border-top: 30rpx solid $uni-color-new;
- border-right: 30rpx solid transparent;
- }
- .chart-tag {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 78rpx;
- .tag-item {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 150rpx;
- height: 44rpx;
- border-radius: 150rpx;
- color: $uni-color-new;
- font-size: 24rpx;
- background-color: #e5efff;
- }
- }
- }
- </style>
|