91 lines
2.7 KiB
JavaScript
91 lines
2.7 KiB
JavaScript
"use strict";
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
const common_vendor = require("../../../../../common/vendor.js");
|
|
const modules_mall_sheep_index = require("../../../sheep/index.js");
|
|
const modules_mall_sheep_api_product_comment = require("../../../sheep/api/product/comment.js");
|
|
if (!Array) {
|
|
const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
|
|
_easycom_s_empty2();
|
|
}
|
|
const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
|
|
if (!Math) {
|
|
(commentItem + _easycom_s_empty)();
|
|
}
|
|
const commentItem = () => "./comment-item.js";
|
|
const _sfc_main = {
|
|
__name: "detail-comment-card",
|
|
props: {
|
|
goodsId: {
|
|
type: [Number, String],
|
|
default: 0
|
|
}
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const state = common_vendor.reactive({
|
|
commentList: [],
|
|
// 评论列表,只展示最近的 3 条
|
|
total: 0
|
|
// 总评论数
|
|
});
|
|
function getComment(id) {
|
|
return __async(this, null, function* () {
|
|
const { data } = yield modules_mall_sheep_api_product_comment.CommentApi.getCommentPage(id, 1, 3, 0);
|
|
state.commentList = data.list;
|
|
state.total = data.total;
|
|
});
|
|
}
|
|
common_vendor.onBeforeMount(() => {
|
|
getComment(props.goodsId);
|
|
});
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(state.total),
|
|
b: state.commentList.length > 0
|
|
}, state.commentList.length > 0 ? {
|
|
c: common_vendor.o(($event) => common_vendor.unref(modules_mall_sheep_index.sheep).$router.go("/modules/mall/goods/comment/list", {
|
|
id: __props.goodsId
|
|
}))
|
|
} : {}, {
|
|
d: common_vendor.f(state.commentList, (item, k0, i0) => {
|
|
return {
|
|
a: "f65f53d0-0-" + i0,
|
|
b: common_vendor.p({
|
|
item
|
|
}),
|
|
c: item.id
|
|
};
|
|
}),
|
|
e: state.commentList.length === 0
|
|
}, state.commentList.length === 0 ? {
|
|
f: common_vendor.p({
|
|
paddingTop: "0",
|
|
icon: "/static/comment-empty.png",
|
|
text: "期待您的第一个评价"
|
|
})
|
|
} : {});
|
|
};
|
|
}
|
|
};
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f65f53d0"]]);
|
|
wx.createComponent(Component);
|