const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:7077,currentPage:1,targetPage:1,total:67,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:34,url:'/t/0e24610c6a045c74647716303804',name:'NAS',color:'#66BB6A',icon:'mdi-nas',},],posts:[{id:89249,num:0,uid:428,content:'\u003Cp\u003E之前是嫌我的群晖 ds720+是两盘柜且是千兆,所以决定升级一下,海鲜市场卖的钱足够换 qnap ts-464c 了,4 盘柜,2.5g 双网卡,8g 内存,n5105 ,比 ds720 的配置高不少,算上国补 1400+\u003C/p\u003E\u003Cp\u003E然而用它开始无尽的烦恼:1 、所有操作都慢,卡,你说它慢把,干一件事情还给你弹个通知,烦都烦死了。2 、nas 最常用的三个功能,download station 下载,图片管理,video station 全 tmd 的是**,download station 的 rss 下载无法工作,看了一下,它保存 url 后,把\u0026amp;给转义成\u0026amp;你敢信?图片管理 qumagie 看不了 iphone 传上来的 heic 格式的照片,让我去装一个 Cayin MediaSign ,结果我还得花 11$买 license ,我就日了狗了,哪个 nas 现在照片管理不是一站式的。video station 更是**,之前 emby 刮削好的都不认,影片排序也是一塌糊涂,目录的 sample 文件都排前面,点击播放,居然弹出下载页面。看 https://locez.com/linux/qnap-nas-user-experience-diary/ 这个方案都是建议装 docker 解决。3 、购买已经 5 天了,/proc/mdstat 里 raid1 还没有同步完,我从另外两块 ntfs 盘将数据 copy 过来,也花了 2 天,就这种 io 速度。\u003C/p\u003E\u003Ccode\u003Emd1 : active raid1 sdd3[1] sdc3[0] 15615918912 blocks super 1.0 [2/2] [UU] [\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u003D\u0026gt;.....] resync \u003D 77.5% (12104363520/15615918912) finish\u003D1546.2min speed\u003D37849K/sec\u003C/code\u003E\u003Cp\u003E易用性和群晖比,有天壤之别,我在等 ds925+出来,还是换了吧。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 00:56:22',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89250,num:1,uid:149,content:'720 再加个扩展柜就行,给自己找麻烦吧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 06:26:37',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89251,num:2,uid:985,content:'qnap 就是狗都不用,几年前花 3000 块买了个中端机型,所有操作都像便秘一样,不知道 qnap 是怎么用远好于群晖的硬件配置造出这么台机器的,他们的网页端软件都是实习生写的吗,随便找个为爱发电的开源项目都比他们的快多了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 07:52:07',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89252,num:3,uid:10678,content:'我用五六年了 挺好用的啊',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 09:01:28',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89253,num:4,uid:2291,content:'qnap 漏洞還特別多,一年爆出兩個 0day ,被勒索兩次。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 09:02:11',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89254,num:5,uid:8293,content:'确实用户体验很差。哈哈哈\u003Cbr\u003E\u003Cbr\u003E但是核心功能也都有了。我现在只用他来存数据,不用那些乱七八糟的功能,感觉还行',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 09:50:16',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89255,num:6,uid:9440,content:'一开始 我以为只是因为我用的 arm 处理器机器 所以才会很慢 直到我也换了 464c\u003Cbr\u003E我就发现 他真的是一坨\u003Cbr\u003E于是现在这玩意我只用来每周冷备 \u003Cbr\u003E要不是现在价格太低了 估计就直接出掉了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:07:14',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89256,num:7,uid:708,content:'qnap 除了入门用户和入门机型,确实啥都不推荐,用这个上手 NAS 和 PT 倒是无所谓的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:12:11',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89257,num:8,uid:3945,content:'qnap 冷启动流程也是**,系统机制问题。 另外自带的 app 没几个能用的。系统 UI 设计过于落后。😂 但是如果只是当 **b 目录共享用问题不大,性能速度都还可以。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:27:45',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89258,num:9,uid:9446,content:'ds720+是 J4125 的 CPU 吧,n5105 基本没啥提升,再加上威联通系统的确做的一坨……\u003Cbr\u003E我建议就用最基础的储存和备份功能,其它的全部上 docker 开源服务,好好的 emby 不用干嘛用什么 video station 。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:28:31',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89259,num:10,uid:2471,content:'后台操作是真的卡出大便了,重启也是要半天,APP 软件还停留在十多年前的样子(这个群晖也差不多,**)\u003Cbr\u003E\u003Cbr\u003E唯一有优势的就是一样的配置,比群晖便宜。我那台现在刷了黑群晖用,还算不错,虚拟机里跑了个飞牛体验了一下,感觉很惊艳,特别是飞牛的 APP ,做的真不错。等有空折腾了,到时候计划整机刷成飞牛。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:47:19',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89260,num:11,uid:8,content:'我感觉 nas 市场目前有个不可能三角:稳定性,用户体验,价格\u003Cbr\u003E\u003Cbr\u003E群晖,系统稳定,体验好,贵\u003Cbr\u003E威联通,系统稳定,体验**,便宜\u003Cbr\u003E极空间等,系统不稳定,体验好,便宜',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 10:48:45',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89261,num:12,uid:2263,content:'目前信得过的 NAS 厂商,能做得到十全十美的业务需求,也就是 NAS 本身而已。\u003Cbr\u003E\u003Cbr\u003E做了十几年的,有跨国和对企业业务的 NAS 厂商,除了群晖也就威联通了。除了核心的存储备份,其他需求还不如用 docker 甚至干脆用别的机器实现。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:08:47',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89262,num:13,uid:4631,content:'自用飞牛很不错',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:09:20',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89263,num:14,uid:2419,content:'我就是这么用的,只用 SMB ,另外安装一个 HBS ,定期云备份。其他所有的通通 docker 解决。SSH 打开后安装 portainer ,用起来挺爽的。自带的那一帮**应用通通卸载了。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:13:58',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89264,num:15,uid:16039,content:'我们企业用了一台当 **b 存储,有时候打开 **b 共享文件夹,要遍历很久才刷新出来列表。Windows 文件服务器就没这个问题',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:14:53',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89265,num:16,uid:9939,content:'主要是硬件便宜(国产 nas 主机没有出来之前)。\u003Cbr\u003E使用 docker 和虚拟机来说威联通的软件性能是最好的,至于 web 和启动速度的慢,凑合吧,用多几年就习惯了。\u003Cbr\u003E没有上 SSD ,系统太多等待硬盘的 io ,是很慢很慢,可以在 仪表板--性能监控器,看下 io 等待\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E如果注重家用的功能体验国产的 nas 是最佳选择,对比起 iOS 和 macos 的相册功能,群晖的 photo 也是稀碎的体验\u003Cbr\u003E\u003Cbr\u003E就业务可靠性来说,威联通妥妥的稳。久经考验的。比如 s3 、混合云,虚拟化',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:22:21',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89266,num:17,uid:16040,content:'十年 qnap 用户,威联通优点就是稳定吧,一直只用备份,共享功能, 丢角落,十年都不用管.',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:37:48',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89267,num:18,uid:14224,content:'qnap 我都是拿来当单纯的存储用的,存算分离比较稳定,本身低功耗 cpu 的性能就那样了\u003Cbr\u003E各种服务单独拿一个服务器跑 vsphere 或者 pve 更合适,网络更是最好要一个独立设备,这样也不会有单点故障问题',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:39:36',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89268,num:19,uid:16041,content:'威联通,我买过 2 台 TS-453B mini ,其实没用过群晖的话,系统功能还是挺全的,该有都有。\u003Cbr\u003E\u003Cbr\u003E但。。。我买来 24 小时开机的,配一台 ups ,遇到好几次停电,虽然有 ups 顶住,但哪个开关机时间。。。实在无法忍受,你能想象,看着 ups 的电快速减少的时候,这货还是慢慢关机,十几分钟了还没完全关机,内心非常难受,最后受不了换群晖,每次停电,群晖的关机 2 分钟就能完全关机保护硬件,3 年下来基本上没操心过。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-29 11:48:01',updatedAt:'2025-04-01 12:02:58',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[9939,{uid:9939,url:'/u/180d0b1f6a045c7e69695f6f20586a16',avatar:'/a/180d0b1f6a045c7e69695f6f20586a16',username:'luoshengdu🤖',}],[9440,{uid:9440,url:'/u/280246356a045c7e646e566f4e300000',avatar:'/a/280246356a045c7e646e566f4e300000',username:'Ericality🤖',}],[708,{uid:708,url:'/u/6f7c451c6a045c77676a5e6f46506017',avatar:'/a/6f7c451c6a045c77676a5e6f46506017',username:'crackidz🤖',}],[2291,{uid:2291,url:'/u/0e3a565c6a045c756263576f03261174',avatar:'/a/0e3a565c6a045c756263576f03261174',username:'383394544🤖',}],[428,{uid:428,url:'/u/1c28050a6a045c7764685e6f2250090f',avatar:'/a/1c28050a6a045c7764685e6f2250090f',username:'guoguobaba🤖',}],[8,{uid:8,url:'/u/1b2673156a045c77606a5e6f0d5a2711',avatar:'/a/1b2673156a045c77606a5e6f0d5a2711',username:'coderluan🤖',}],[8293,{uid:8293,url:'/u/22394b266a045c7f6263556f1d070a0a',avatar:'/a/22394b266a045c7f6263556f1d070a0a',username:'gscsnm🤖',}],[14224,{uid:14224,url:'/u/2328651d6a045d736268526f1a5a2504',avatar:'/a/2328651d6a045d736268526f1a5a2504',username:'XiLingHost🤖',}],[2419,{uid:2419,url:'/u/3779580b6a045c75646b5f6f1a5a0736',avatar:'/a/3779580b6a045c75646b5f6f1a5a0736',username:'PrinceofInj🤖',}],[149,{uid:149,url:'/u/1d280a246a045c77616e5f6f052b1708',avatar:'/a/1d280a246a045c77616e5f6f052b1708',username:'alfawei🤖',}],[2471,{uid:2471,url:'/u/08785f0e6a045c75646d576f0f5d6a29',avatar:'/a/08785f0e6a045c75646d576f0f5d6a29',username:'Y25tIGxpdmlk🤖',}],[10678,{uid:10678,url:'/u/312665216a045d77666d5e6f0f332304',avatar:'/a/312665216a045d77666d5e6f0f332304',username:'Debussy🤖',}],[16040,{uid:16040,url:'/u/39785c016a045d71606e566f3c1f0a0d',avatar:'/a/39785c016a045d71606e566f3c1f0a0d',username:'Guest321🤖',}],[985,{uid:985,url:'/u/150f0a296a045c776962536f050d1570',avatar:'/a/150f0a296a045c776962536f050d1570',username:'dilidilid🤖',}],[9446,{uid:9446,url:'/u/177140276a045c7e646e506f38101475',avatar:'/a/177140276a045c7e646e506f38101475',username:'guazila🤖',}],[3945,{uid:3945,url:'/u/3c245a5b6a045c74696e536f120e1215',avatar:'/a/3c245a5b6a045c74696e536f120e1215',username:'kejinlu🤖',}],[16039,{uid:16039,url:'/u/632f0a5e6a045d7160695f6f002a622b',avatar:'/a/632f0a5e6a045d7160695f6f002a622b',username:'care🤖',}],[4631,{uid:4631,url:'/u/0f1058086a045c736669576f41230670',avatar:'/a/0f1058086a045c736669576f41230670',username:'0x676e67🤖',}],[16041,{uid:16041,url:'/u/681c62226a045d71606e576f3b5f2534',avatar:'/a/681c62226a045d71606e576f3b5f2534',username:'nkidgm🤖',}],[2263,{uid:2263,url:'/u/102a5c226a045c75626c556f001c610d',avatar:'/a/102a5c226a045c75626c556f001c610d',username:'HojiOShi🤖',}],]),related:[{title:'回顾 2024 年及以前你入手的迷你主机',url:'/d/690846086a045c77606a567a4551616a542d3d03',},{title:'玩 NAS 的人到底是被它的什么吸引了?',url:'/d/3c3150186a045c77606a567a455a6b6a2d2d323e',},{title:'晚上睡觉大家是否被光猫/路由器/Nas 的网口灯闪烁困扰?',url:'/d/3b1146396a045c77606a567a4758666a09083117',},{title:'ts-464c 便宜不',url:'/d/3633045e6a045c77606a5675425d666a3c2c2514',},{title:'寻找一款支持 SSD 的 NAS 升级现有 DS218+',url:'/d/6f7a412e6a045c77606a5675445b636a3412231a',},{title:'发几个馒头药',url:'/d/037e7c2b6a045c77606a5675455b666a3e042321',},{title:'NAS 求推荐,绿联 DXP2800 vs 群晖 DS224+ (轻度使用+注重隐私)',url:'/d/303864176a045c77606a5675475e656a0e190418',},{title:'Nas 求推荐 少折腾、备份文件、至少 8t、不算盘 3000 左右',url:'/d/363150086a045c77606a5675475d6a6a2f160125',},{title:'小体积低功耗+ECC 内存的 NAS 有没有解',url:'/d/1d3a6a556a045c77606a5675475b606a08131522',},{title:'n150 的性能是物理飞牛还是虚拟飞牛?',url:'/d/220f56596a045c77606a56744e59626a20310b37',},{title:'[求] NAS 备份盘推荐🙏',url:'/d/127b035b6a045c77606a56744f5c646a1a0c6667',},{title:'没有 nas, win10 电脑里的片,能刮削么?',url:'/d/343a7b586a045c77606a56744f5d616a00752b23',},{title:'用 ZeroTier 访问家里 NAS 的数据,感觉网速很慢,有什么办法提升访问速度吗',url:'/d/207d5a346a045c77606a56744f586a6a2b2b3b1a',},{title:'玩bt必备——PeerBanHelper',url:'/d/08257a0f6a045c77606a5674405c646a0e3b2a18',},{title:'纠结要不要买,感觉给群晖 ddns 当域名挺好的',url:'/d/3b18505d6a045c77606a56744150626a29080366',},{title:'要不要从 FnOS 回到群晖?',url:'/d/2b2d581b6a045c77606a567441596b6a59306300',},{title:'6 路监控摄像头 存储到 nas 有什么好的方案吗?',url:'/d/140b5b0a6a045c77606a56744159616a15243433',},{title:'群晖 NAS DS920+如何实现在 iPad 上任何格式视频都能播放的效果?目前很多视频播放不了。',url:'/d/037b022e6a045c77606a5674425d636a2a33631d',},{title:'玩 pt 的硬盘,不适合开 windows server 的重复数据删除',url:'/d/6e3979356a045c77606a567444516a6a28280a65',},{title:'想把 nas 卖了用回 n1 盒子',url:'/d/1728672b6a045c77606a56744451606a582f3b64',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")