import { defineComponent, getCurrentInstance, reactive, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, Fragment, renderList, withDirectives, createBlock, toDisplayString, unref, vShow, createCommentVNode, createTextVNode } from 'vue';
import '../../../../../api/index.mjs';
import commonFunction from '../../../../../hooks/commonFunction.mjs';
import { useBaseApi } from '../../../../../api/base/index.mjs';

const _hoisted_1 = { class: "user-news-container" };
const _hoisted_2 = { style: { "margin-left": "5px" } };
const _hoisted_3 = { class: "notice-box" };
const _hoisted_4 = ["onClick"];
const _hoisted_5 = { class: "notice-item-icon" };
const _hoisted_6 = { class: "notice-title" };
const _hoisted_7 = { class: "notice-content" };
const _hoisted_8 = { class: "notice-time" };
const _hoisted_9 = { style: { "margin-left": "5px" } };
const _hoisted_10 = {
  class: "notice-box",
  style: { "height": "435px" }
};
const _hoisted_11 = { style: { "color": "#fff" } };
const _hoisted_12 = { class: "w-e-text-container" };
const _hoisted_13 = ["innerHTML"];
const _hoisted_14 = { class: "dialog-footer" };
var _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "userNews",
  props: {
    noticeList: Array
  },
  setup(__props) {
    const { proxy } = getCurrentInstance();
    const { removeHtmlSub } = commonFunction();
    const state = reactive({
      dialogVisible: false,
      content: ""
    });
    const goToNotice = () => {
      const router = proxy.$mycurRouter;
      router.push("/dashboard/notice");
    };
    const viewNoticeDetail = async (notice) => {
      state.content = notice.content;
      state.dialogVisible = true;
      notice.readStatus = 1;
      await useBaseApi("sysNotice").post({ id: notice.id }, "setRead");
    };
    return (_ctx, _cache) => {
      const _component_ele_Bell = resolveComponent("ele-Bell");
      const _component_el_icon = resolveComponent("el-icon");
      const _component_ele_Notification = resolveComponent("ele-Notification");
      const _component_ele_Message = resolveComponent("ele-Message");
      const _component_el_empty = resolveComponent("el-empty");
      const _component_el_tab_pane = resolveComponent("el-tab-pane");
      const _component_ele_Position = resolveComponent("ele-Position");
      const _component_el_tabs = resolveComponent("el-tabs");
      const _component_el_button = resolveComponent("el-button");
      const _component_el_dialog = resolveComponent("el-dialog");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createVNode(_component_el_tabs, {
          stretch: "",
          class: "content-box"
        }, {
          default: withCtx(() => [
            createVNode(_component_el_tab_pane, {
              label: _ctx.$t("message.list.messageInbox")
            }, {
              label: withCtx(() => [
                createVNode(_component_el_icon, null, {
                  default: withCtx(() => [
                    createVNode(_component_ele_Bell)
                  ]),
                  _: 1
                  /* STABLE */
                }),
                createElementVNode(
                  "span",
                  _hoisted_2,
                  toDisplayString(_ctx.$t("message.list.messageInbox")),
                  1
                  /* TEXT */
                )
              ]),
              default: withCtx(() => [
                createElementVNode("div", _hoisted_3, [
                  __props.noticeList.length > 0 ? (openBlock(true), createElementBlock(
                    Fragment,
                    { key: 0 },
                    renderList(__props.noticeList, (v, k) => {
                      return withDirectives((openBlock(), createElementBlock("div", {
                        class: "notice-item",
                        key: k,
                        onClick: ($event) => viewNoticeDetail(v)
                      }, [
                        createElementVNode("div", _hoisted_5, [
                          createVNode(
                            _component_el_icon,
                            {
                              size: "24",
                              color: "var(--el-color-primary)"
                            },
                            {
                              default: withCtx(() => [
                                v.type == 1 ? (openBlock(), createBlock(_component_ele_Notification, { key: 0 })) : (openBlock(), createBlock(_component_ele_Message, { key: 1 }))
                              ]),
                              _: 2
                              /* DYNAMIC */
                            },
                            1024
                            /* DYNAMIC_SLOTS */
                          )
                        ]),
                        createElementVNode("div", null, [
                          createElementVNode(
                            "div",
                            _hoisted_6,
                            toDisplayString(v.title),
                            1
                            /* TEXT */
                          ),
                          createElementVNode(
                            "div",
                            _hoisted_7,
                            toDisplayString(unref(removeHtmlSub)(v.content)),
                            1
                            /* TEXT */
                          ),
                          createElementVNode(
                            "div",
                            _hoisted_8,
                            toDisplayString(v.publicTime),
                            1
                            /* TEXT */
                          )
                        ])
                      ], 8, _hoisted_4)), [
                        [vShow, v.readStatus == 1 ? false : true]
                      ]);
                    }),
                    128
                    /* KEYED_FRAGMENT */
                  )) : (openBlock(), createBlock(_component_el_empty, {
                    key: 1,
                    description: _ctx.$t("message.list.empty"),
                    style: { "height": "85%" }
                  }, null, 8, ["description"]))
                ]),
                __props.noticeList.length > 0 ? (openBlock(), createElementBlock(
                  "div",
                  {
                    key: 0,
                    class: "notice-foot",
                    onClick: goToNotice
                  },
                  toDisplayString(_ctx.$t("message.list.goToNotice")),
                  1
                  /* TEXT */
                )) : createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"]),
            createVNode(_component_el_tab_pane, {
              label: _ctx.$t("message.list.my")
            }, {
              label: withCtx(() => [
                createVNode(_component_el_icon, null, {
                  default: withCtx(() => [
                    createVNode(_component_ele_Position)
                  ]),
                  _: 1
                  /* STABLE */
                }),
                createElementVNode(
                  "span",
                  _hoisted_9,
                  toDisplayString(_ctx.$t("message.list.my")),
                  1
                  /* TEXT */
                )
              ]),
              default: withCtx(() => [
                createElementVNode("div", _hoisted_10, [
                  createVNode(_component_el_empty, {
                    description: _ctx.$t("message.list.empty"),
                    style: { "height": "85%" }
                  }, null, 8, ["description"])
                ])
              ]),
              _: 1
              /* STABLE */
            }, 8, ["label"])
          ]),
          _: 1
          /* STABLE */
        }),
        createVNode(_component_el_dialog, {
          modelValue: state.dialogVisible,
          "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => state.dialogVisible = $event),
          draggable: "",
          width: "769px"
        }, {
          header: withCtx(() => [
            createElementVNode("div", _hoisted_11, [
              createVNode(_component_el_icon, {
                size: "16",
                style: { "margin-right": "3px", "display": "inline", "vertical-align": "middle" }
              }, {
                default: withCtx(() => [
                  createVNode(_component_ele_Bell)
                ]),
                _: 1
                /* STABLE */
              }),
              createElementVNode(
                "span",
                null,
                toDisplayString(_ctx.$t("message.list.messageDetail")),
                1
                /* TEXT */
              )
            ])
          ]),
          footer: withCtx(() => [
            createElementVNode("span", _hoisted_14, [
              createVNode(_component_el_button, {
                type: "primary",
                onClick: _cache[0] || (_cache[0] = ($event) => state.dialogVisible = false)
              }, {
                default: withCtx(() => [
                  createTextVNode(
                    toDisplayString(_ctx.$t("message.list.confirm")),
                    1
                    /* TEXT */
                  )
                ]),
                _: 1
                /* STABLE */
              })
            ])
          ]),
          default: withCtx(() => [
            createElementVNode("div", _hoisted_12, [
              createElementVNode("div", {
                innerHTML: state.content,
                "data-slate-editor": ""
              }, null, 8, _hoisted_13)
            ])
          ]),
          _: 1
          /* STABLE */
        }, 8, ["modelValue"])
      ]);
    };
  }
});

export { _sfc_main as default };
