gree_leran/unpackage/dist/dev/mp-weixin/pages/discuss/discuss.js

81 lines
2.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const apis_discussion = require("../../apis/discussion.js");
require("../../utils/http.js");
require("../../utils/Auth.js");
if (!Array) {
const _easycom_DiscussionsBox2 = common_vendor.resolveComponent("DiscussionsBox");
const _easycom_InputBox2 = common_vendor.resolveComponent("InputBox");
(_easycom_DiscussionsBox2 + _easycom_InputBox2)();
}
const _easycom_DiscussionsBox = () => "../../components/DiscussionsBox/DiscussionsBox.js";
const _easycom_InputBox = () => "../../components/InputBox/InputBox.js";
if (!Math) {
(_easycom_DiscussionsBox + _easycom_InputBox)();
}
const _sfc_main = {
__name: "discuss",
setup(__props) {
const list = common_vendor.ref([]);
const inputVisible = common_vendor.ref(false);
const iskDk = common_vendor.ref(true);
const currId = common_vendor.ref(null);
const getDiscussionListData = async () => {
let res = await apis_discussion.getDiscussionList();
if (res.code == 200) {
list.value = res.data;
}
};
const submitNote = async (val) => {
await apis_discussion.addDiscussion({
parentId: currId.value,
content: val
});
getDiscussionListData();
inputVisible.value = false;
iskDk.value = false;
setTimeout(() => {
iskDk.value = true;
}, 4e3);
currId.value = null;
};
const blurCom = () => {
inputVisible.value = false;
};
const addComment = (id) => {
if (!iskDk.value) {
return;
}
if (id != void 0) {
currId.value = id;
}
inputVisible.value = true;
};
common_vendor.onMounted(() => {
getDiscussionListData();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(list.value, (item, index, i0) => {
return {
a: common_vendor.o(addComment, index),
b: "9635802b-0-" + i0,
c: common_vendor.p({
data: item
}),
d: index
};
}),
b: inputVisible.value
}, inputVisible.value ? {
c: common_vendor.o(submitNote),
d: common_vendor.o(blurCom)
} : {}, {
e: common_vendor.o(($event) => addComment())
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9635802b"], ["__file", "D:/uniapp1/gree_leran/pages/discuss/discuss.vue"]]);
wx.createPage(MiniProgramPage);