"use strict";var t=(t,e,s)=>new Promise(((a,n)=>{var r=t=>{try{i(s.next(t))}catch(e){n(e)}},o=t=>{try{i(s.throw(t))}catch(e){n(e)}},i=t=>t.done?a(t.value):Promise.resolve(t.value).then(r,o);i((s=s.apply(t,e)).next())}));const e=require("../../common/vendor.js"),s=require("../../utils/strings.js"),a=require("../../utils/http.js"),n=require("../../utils/commUtils.js"),r=require("../../store/message.js");if(!Array){e.resolveComponent("layout-default-uni")()}Math||o();const o=()=>"../../components/EmptyState.js",i={__name:"message-list",setup(o){const i=e.ref([]),u=r.useMessageStore(),c=()=>t(this,null,(function*(){var t;try{const t=yield a.httpGet("/notifications/list");200==t.code?i.value=t.data:n.toast(t.message)}catch(e){n.toast((null==(t=e.data)?void 0:t.message)||"消息请求失败")}})),l=()=>t(this,null,(function*(){var t;try{const t=u.messages.unreadMessages.map((t=>t.id)),e=yield a.httpPost("/notifications/readList",t);200==e.code||n.toast(e.message)}catch(e){n.toast((null==(t=e.data)?void 0:t.message)||"消息阅读失败")}}));return e.onLoad((()=>t(this,null,(function*(){yield c(),yield l()})))),(t,a)=>e.e({a:e.unref(i).length>0},e.unref(i).length>0?{b:e.f(e.unref(i),((t,a,n)=>({a:e.t(t.title),b:e.t(t.createTime),c:e.t(e.unref(s.truncateString)(t.content)),d:t.id})))}:{})}},u=e._export_sfc(i,[["__scopeId","data-v-0e43d75d"]]);wx.createPage(u);