UNPKG

quick-admin-vue3-core

Version:

以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板

122 lines (121 loc) 4.03 kB
import { defineComponent as D, inject as E, ref as j, reactive as H, watchEffect as R, resolveComponent as C, resolveDirective as U, createElementBlock as f, openBlock as h, withDirectives as T, createVNode as M, unref as F, withCtx as N, Fragment as O, renderList as q, createElementVNode as d, toDisplayString as k } from "vue"; import { a as z } from "./index-D-KS7NhM.js"; import { I as G } from "./index-C0qRtkRj.js"; import { W as J, n as K } from "./platform-DsTwHxm6.js"; import { _ as Q } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const X = { class: "search-msg f-fs-s-c" }, Y = ["onClick"], Z = { class: "f-fs-c" }, ee = { class: "nickname mr-o" }, te = { class: "time" }, se = ["innerHTML"], oe = /* @__PURE__ */ D({ __name: "SearchMsg", props: { fromUser: {}, toUser: {}, keyWord: {} }, emits: ["select"], setup(b, { emit: x }) { const I = E("closePopup"), i = b, y = x, n = j(i.keyWord), t = H({ loading: !1, list: [], hasMore: !0, params: { prevCreatedAt: 0, pageSize: 15 } }); R(() => { m(i.keyWord); })(); function L(e, s = `color:${K.colorPrimary};`) { var a; const { msgContent: r } = e, c = (a = n.value) == null ? void 0 : a.trim(); return r.Text.replaceAll(c, `<span style='${s}'>${c}</span>`); } function S(e) { m(n.value); } function _() { Object.assign(t, { list: [], prevCreatedAt: 0, hasMore: !0 }); } function V() { var s, r; const { list: e } = t; t.params.prevCreatedAt = ((r = (s = e.slice(-1)) == null ? void 0 : s[0]) == null ? void 0 : r.create_time) + 1, m(n.value); } function m(e = "") { if (e = e == null ? void 0 : e.trim(), !e) { _(); return; } const { fromUser: s, toUser: r } = i, { hasMore: c, list: a, params: u } = t, { prevCreatedAt: o } = u, l = o === 0; if (!l && !c) { J.warning("底部没有更多了"); return; } t.loading = !0, G({ fromUserId: s.id, toUserId: r.id, // queryDirection: "next", msgWord: e, isListReverse: 0, //数据列表顺序是否反转,1=是(默认),0不 ...t.params }).then((g) => { const { fromUser: B, toUser: w } = i, { list: A, hasMore: P, fromUserId: $ } = g, v = A.map((p, ne) => (p.user = $ === p.fromUserId ? B : w, p)); Object.assign(t, { list: l ? v : a.concat(v), hasMore: P }); }).finally(() => { t.loading = !1; }); } function W(e) { y("select", e, n.value, () => { I(); }); } return (e, s) => { const r = C("el-input"), c = C("BaseScroll"), a = U("debounce"), u = U("focus"); return h(), f("div", X, [ T(M(r, { class: "mb-h f-0", modelValue: n.value, "onUpdate:modelValue": s[0] || (s[0] = (o) => n.value = o), placeholder: "请输入关键词", clearable: "", onClear: _, "suffix-icon": F(z) }, null, 8, ["modelValue", "suffix-icon"]), [ [a, (o) => S(), "input"], [u] ]), M(c, { loading: t.loading, class: "list", onReachBottom: V, "max-height": "calc(100vh - 200px)" }, { default: N(() => [ (h(!0), f(O, null, q(t.list, (o, l) => (h(), f("div", { onClick: (g) => W(o), class: "item", key: l }, [ d("div", Z, [ d("b", ee, k(o.user.nickname), 1), d("time", te, k(o.createdDate), 1) ]), d("div", { class: "q-line-1", innerHTML: L(o) }, null, 8, se) ], 8, Y))), 128)) ]), _: 1 }, 8, ["loading"]) ]); }; } }), me = /* @__PURE__ */ Q(oe, [["__scopeId", "data-v-47b7e09b"]]); export { me as default };