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

81 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-06-16 15:32:15 +00:00
"use strict";
const common_vendor = require("../../common/vendor.js");
2024-06-22 07:20:39 +00:00
const apis_discussion = require("../../apis/discussion.js");
require("../../utils/http.js");
require("../../utils/Auth.js");
2024-06-16 23:47:03 +00:00
if (!Array) {
2024-06-22 07:20:39 +00:00
const _easycom_DiscussionsBox2 = common_vendor.resolveComponent("DiscussionsBox");
const _easycom_InputBox2 = common_vendor.resolveComponent("InputBox");
(_easycom_DiscussionsBox2 + _easycom_InputBox2)();
2024-06-16 23:47:03 +00:00
}
2024-06-22 07:20:39 +00:00
const _easycom_DiscussionsBox = () => "../../components/DiscussionsBox/DiscussionsBox.js";
const _easycom_InputBox = () => "../../components/InputBox/InputBox.js";
2024-06-16 23:47:03 +00:00
if (!Math) {
2024-06-22 07:20:39 +00:00
(_easycom_DiscussionsBox + _easycom_InputBox)();
2024-06-16 23:47:03 +00:00
}
2024-06-16 15:32:15 +00:00
const _sfc_main = {
__name: "discuss",
setup(__props) {
2024-06-22 07:20:39 +00:00
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
2024-06-16 15:32:15 +00:00
});
2024-06-22 07:20:39 +00:00
getDiscussionListData();
inputVisible.value = false;
iskDk.value = false;
setTimeout(() => {
iskDk.value = true;
}, 4e3);
currId.value = null;
2024-06-16 15:32:15 +00:00
};
2024-06-22 07:20:39 +00:00
const blurCom = () => {
inputVisible.value = false;
2024-06-16 23:47:03 +00:00
};
2024-06-22 07:20:39 +00:00
const addComment = (id) => {
if (!iskDk.value) {
return;
2024-06-16 23:47:03 +00:00
}
2024-06-22 07:20:39 +00:00
if (id != void 0) {
currId.value = id;
}
inputVisible.value = true;
2024-06-16 23:47:03 +00:00
};
2024-06-22 07:20:39 +00:00
common_vendor.onMounted(() => {
getDiscussionListData();
});
2024-06-16 15:32:15 +00:00
return (_ctx, _cache) => {
2024-06-22 07:20:39 +00:00
return common_vendor.e({
a: common_vendor.f(list.value, (item, index, i0) => {
2024-06-16 15:32:15 +00:00
return {
2024-06-22 07:20:39 +00:00
a: common_vendor.o(addComment, index),
b: "9635802b-0-" + i0,
c: common_vendor.p({
data: item
}),
d: index
2024-06-16 15:32:15 +00:00
};
}),
2024-06-22 07:20:39 +00:00
b: inputVisible.value
}, inputVisible.value ? {
c: common_vendor.o(submitNote),
d: common_vendor.o(blurCom)
} : {}, {
e: common_vendor.o(($event) => addComment())
});
2024-06-16 15:32:15 +00:00
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9635802b"], ["__file", "D:/uniapp1/gree_leran/pages/discuss/discuss.vue"]]);
2024-06-16 15:32:15 +00:00
wx.createPage(MiniProgramPage);