2024-06-19 11:29:08 +00:00
|
|
|
|
"use strict";
|
|
|
|
|
const common_vendor = require("../../common/vendor.js");
|
|
|
|
|
if (!Array) {
|
|
|
|
|
const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
|
|
|
|
|
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
2024-06-20 15:36:19 +00:00
|
|
|
|
(_easycom_up_text2 + _easycom_up_icon2)();
|
2024-06-19 11:29:08 +00:00
|
|
|
|
}
|
|
|
|
|
const _easycom_up_text = () => "../../node-modules/uview-plus/components/u-text/u-text.js";
|
|
|
|
|
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
|
|
|
|
|
if (!Math) {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
(_easycom_up_text + _easycom_up_icon)();
|
2024-06-19 11:29:08 +00:00
|
|
|
|
}
|
|
|
|
|
const _sfc_main = {
|
|
|
|
|
__name: "CaseBox",
|
|
|
|
|
props: {
|
|
|
|
|
id: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ""
|
|
|
|
|
},
|
|
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "标题"
|
|
|
|
|
},
|
|
|
|
|
text: {
|
|
|
|
|
type: String,
|
2024-06-20 15:36:19 +00:00
|
|
|
|
default: "正文嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻徐"
|
2024-06-19 11:29:08 +00:00
|
|
|
|
},
|
|
|
|
|
data: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "日期"
|
|
|
|
|
},
|
|
|
|
|
cover: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "/static/image/imgerr.png"
|
|
|
|
|
},
|
|
|
|
|
userImage: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "地址"
|
|
|
|
|
},
|
|
|
|
|
userName: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: "作者"
|
|
|
|
|
},
|
|
|
|
|
userId: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ""
|
|
|
|
|
},
|
|
|
|
|
isLike: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
likeNumber: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 0
|
|
|
|
|
},
|
|
|
|
|
isComments: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
commentsNumber: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 0
|
|
|
|
|
},
|
|
|
|
|
isCollection: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
},
|
|
|
|
|
collectionNumber: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-06-20 15:36:19 +00:00
|
|
|
|
emits: ["ClickCollection", "ClickLike"],
|
|
|
|
|
setup(__props, { emit: __emit }) {
|
|
|
|
|
const emit = __emit;
|
2024-06-19 11:29:08 +00:00
|
|
|
|
const errorImg = () => {
|
|
|
|
|
info.cover = "/static/image/imgerr.png";
|
|
|
|
|
};
|
|
|
|
|
common_vendor.ref("name");
|
|
|
|
|
const props = __props;
|
|
|
|
|
const info = common_vendor.reactive({
|
|
|
|
|
id: "文章id",
|
|
|
|
|
title: "标题",
|
|
|
|
|
cover: "封面地址",
|
2024-06-20 15:36:19 +00:00
|
|
|
|
text: "正文嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻徐",
|
|
|
|
|
data: "发布于:2024-11-11",
|
2024-06-19 11:29:08 +00:00
|
|
|
|
userImage: "",
|
|
|
|
|
userName: "作者",
|
|
|
|
|
userId: "作者id",
|
|
|
|
|
isLike: false,
|
|
|
|
|
likeNumber: 0,
|
|
|
|
|
isComments: false,
|
|
|
|
|
commentsNumber: 0,
|
|
|
|
|
isCollection: false,
|
|
|
|
|
collectionNumber: 0
|
|
|
|
|
});
|
|
|
|
|
const toLike = () => {
|
|
|
|
|
info.isLike = !info.isLike;
|
|
|
|
|
if (info.isLike) {
|
|
|
|
|
info.likeNumber++;
|
|
|
|
|
} else {
|
|
|
|
|
info.likeNumber--;
|
|
|
|
|
}
|
2024-06-20 15:36:19 +00:00
|
|
|
|
console.log("点赞0");
|
|
|
|
|
emit("ClickLike", {
|
|
|
|
|
id: info.id,
|
|
|
|
|
is: info.isLike
|
|
|
|
|
});
|
|
|
|
|
console.log("点赞1");
|
2024-06-19 11:29:08 +00:00
|
|
|
|
};
|
|
|
|
|
const toCollection = () => {
|
|
|
|
|
info.isCollection = !info.isCollection;
|
|
|
|
|
if (info.isCollection) {
|
|
|
|
|
info.collectionNumber++;
|
|
|
|
|
} else {
|
|
|
|
|
info.collectionNumber--;
|
|
|
|
|
}
|
2024-06-20 15:36:19 +00:00
|
|
|
|
emit("ClickCollection", {
|
|
|
|
|
id: info.id,
|
|
|
|
|
is: info.isCollection
|
|
|
|
|
});
|
2024-06-19 11:29:08 +00:00
|
|
|
|
};
|
|
|
|
|
const ggg = () => {
|
|
|
|
|
info.id = props.id;
|
|
|
|
|
info.title = props.title;
|
|
|
|
|
info.cover = props.cover;
|
|
|
|
|
info.text = props.text;
|
2024-06-20 15:36:19 +00:00
|
|
|
|
info.data = props.data;
|
2024-06-19 11:29:08 +00:00
|
|
|
|
info.userImage = props.userImage;
|
|
|
|
|
info.userName = props.userName;
|
|
|
|
|
info.userId = props.userId;
|
|
|
|
|
info.isLike = props.isLike;
|
|
|
|
|
info.likeNumber = props.likeNumber;
|
|
|
|
|
info.isComments = props.isComments;
|
|
|
|
|
info.commentsNumber = props.commentsNumber;
|
|
|
|
|
info.isCollection = props.isCollection;
|
|
|
|
|
info.collectionNumber = props.collectionNumber;
|
|
|
|
|
};
|
|
|
|
|
common_vendor.onMounted(() => {
|
|
|
|
|
ggg();
|
|
|
|
|
});
|
|
|
|
|
return (_ctx, _cache) => {
|
|
|
|
|
return common_vendor.e({
|
|
|
|
|
a: info.cover,
|
|
|
|
|
b: common_vendor.o(errorImg),
|
|
|
|
|
c: common_vendor.p({
|
|
|
|
|
lines: 1,
|
|
|
|
|
text: info.title,
|
|
|
|
|
bold: "true",
|
|
|
|
|
size: "30rpx"
|
|
|
|
|
}),
|
|
|
|
|
d: common_vendor.p({
|
|
|
|
|
lines: 3,
|
|
|
|
|
text: info.text
|
|
|
|
|
}),
|
|
|
|
|
e: common_vendor.p({
|
|
|
|
|
lines: 1,
|
|
|
|
|
text: info.data,
|
2024-06-20 15:36:19 +00:00
|
|
|
|
color: "#bfbfbf"
|
2024-06-19 11:29:08 +00:00
|
|
|
|
}),
|
2024-06-20 15:36:19 +00:00
|
|
|
|
f: info.isLike
|
2024-06-19 11:29:08 +00:00
|
|
|
|
}, info.isLike ? {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
g: common_vendor.o(toLike),
|
|
|
|
|
h: common_vendor.p({
|
2024-06-19 11:29:08 +00:00
|
|
|
|
name: "heart-fill",
|
|
|
|
|
color: "#ff0004",
|
|
|
|
|
size: "28"
|
|
|
|
|
})
|
|
|
|
|
} : {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
i: common_vendor.o(toLike),
|
|
|
|
|
j: common_vendor.p({
|
2024-06-19 11:29:08 +00:00
|
|
|
|
name: "heart",
|
|
|
|
|
color: "#ff0004",
|
|
|
|
|
size: "28"
|
|
|
|
|
})
|
|
|
|
|
}, {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
k: info.isCollection
|
2024-06-19 11:29:08 +00:00
|
|
|
|
}, info.isCollection ? {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
l: common_vendor.o(toCollection),
|
|
|
|
|
m: common_vendor.p({
|
2024-06-19 11:29:08 +00:00
|
|
|
|
name: "star-fill",
|
|
|
|
|
color: "#ff0004",
|
|
|
|
|
size: "28"
|
|
|
|
|
})
|
|
|
|
|
} : {
|
2024-06-20 15:36:19 +00:00
|
|
|
|
n: common_vendor.o(toCollection),
|
|
|
|
|
o: common_vendor.p({
|
2024-06-19 11:29:08 +00:00
|
|
|
|
name: "star",
|
|
|
|
|
color: "#ff0004",
|
|
|
|
|
size: "28"
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-06-20 15:36:19 +00:00
|
|
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-13ba89b0"], ["__file", "D:/uniapp1/gree_leran/components/CaseBox/CaseBox.vue"]]);
|
2024-06-19 11:29:08 +00:00
|
|
|
|
wx.createComponent(Component);
|