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:3679,currentPage:1,targetPage:1,total:21,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:14,url:'/t/3b3b75196a045c7664770d0c113c',name:'Linux',color:'#66BB6A',icon:'mdi-linux',},],posts:[{id:42719,num:0,uid:9523,content:'\u003Cp\u003E有一兄弟 专科 35 了 给人安装宽带;经常吐槽生活不易, 他日子确实艰难. 我打算出钱给他报个班, 他肯定是不愿意 总觉得年龄大了 学也没戏; 如果没找到工作我就认了,目前 1 万内给他是舍得打水漂的.石家庄有没有好点的培训班 如何说服他 我实在是不想看他没日没夜的上班 周末节假日也没有休息时间有没有必要去北京学呢 \u003C/p\u003E\u003Cp\u003E我还是期望在石家庄 总觉得学完随便找一个 总比装宽带强点 给人装宽带没有什么出路\u003C/p\u003E\u003Cp\u003E我是学了 j**a 又学了 Linux 又去学 python 没少在这上面造钱 ;我觉得还是比较值的; 目前主要在搞 k8s 运维 待遇也不错 好多年经验了 自觉收入可以 ;\u003C/p\u003E\u003Cp\u003E要是放在以前我基本是反对的 以前有同学问我想去学 CAD,还有一些咨询想学前端的 ; 那时我感觉大部分人根本不喜欢这个行业 基本都是劝退; 后来一些联系我的朋友们 我基本都是推荐去学习的 学点东西总是好的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 16:58:56',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42720,num:1,uid:9846,content:'不能熬夜的运维能叫运维?',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 17:03:44',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42721,num:2,uid:4529,content:'专科 35 培训班学运维,洗洗睡吧,学费省下来吃点好的吧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 17:07:32',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42722,num:3,uid:9523,content:'那咋办 总不能一直这样过日子啊 总得想办法学习东西转行啊\u003Cbr\u003E\u003Cbr\u003E发版熬夜正常 第二天都能调休的 我有个同事 48 了 入职去某汽车公司搞运维去了 ,所以我感觉能力强多少能找到个工作;',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 17:17:14',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42723,num:4,uid:957,content:'可以的。举个正向例子,22 年离职跑 infosys ,旁边老哥 55 岁,一大把证书。然后我从 infosys 被双杀,出来后也巨惨,考了一堆证书,cka cks aws ccna azure vcp-nv vcp-dcv 。然后上岸了。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 17:19:18',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42724,num:5,uid:533,content:'不差 看干啥 我们这金融城的 it 年包是£80k 面试花一点 除了常见 it admin os 网络配置 fs 冗余线上工具搭建 cicd 之类 还有问扫雷怎么写 基础 short 量化公式总结',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 18:44:21',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42725,num:6,uid:635,content:'还要看他技术和学习能力,学历不行,技术又上不去很难上升,报班也用处不大',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 18:52:13',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42726,num:7,uid:959,content:'你在哪个城市 外企国企还是民企工作',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 20:33:11',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42727,num:8,uid:9847,content:'喜欢什么时候都不晚。不喜欢都白搭',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 21:38:28',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42728,num:9,uid:804,content:'35 岁,专科,还想去参加培训跟实习生抢岗位,求求你,放过他吧,让他去当保安都可以,不要让它继续受苦了。不是所有人都适合搞 IT 这行业,你叫他去学个电工、家电清洗、家政都比去培训班要强,实在不行,叫它去当销售都可以。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 21:38:46',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42729,num:10,uid:856,content:'专科。。。。先去整个自考本科不行么',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 21:44:45',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42730,num:11,uid:9848,content:'喜欢什么时候都不晚。不喜欢都白搭',ipRegion:'',updatedByUid:0,createdAt:'2025-03-14 23:20:03',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42731,num:12,uid:2917,content:'看看弱电水电工,35 搞运维真扛不住',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 03:00:49',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42732,num:13,uid:4054,content:'运维刚下班…',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 03:22:02',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42733,num:14,uid:1154,content:'8 万蛮高的了,还得是金融行业',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 08:32:08',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42734,num:15,uid:1100,content:'考个电工证,转行到物业做水电弱电,工作轻松能干到退休,专科学历也够,有 n 年装宽带经验找工作应该还是加分项。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 09:29:07',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42735,num:16,uid:6612,content:'不是很建议',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 11:47:32',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42736,num:17,uid:9849,content:'想学就学,任何时候都不晚,就怕天天意淫',ipRegion:'',updatedByUid:0,createdAt:'2025-03-15 12:41:55',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42737,num:18,uid:9523,content:'我搞了自考本 这东西根本没用 还不如一个红帽认证值钱呢',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 11:49:06',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:42738,num:19,uid:9523,content:'我感觉他还是适合的 自学了 vb 之前搞网络测试 大部分表格都是他来搞宏;后来自学了 c# 可以写简单的后端, 后来又自学数据库 简单的怎删改删可以搞 但是都到不了找工作的门槛 让他去面试又不肯;\u003Cbr\u003E我带了 2 个实习生去年 让他们学点 Linux 又不肯 实习生很多都不愿意搞运维 只想搞开发; 或者弄点简单的测试点点点 我想还是有机会的 打算清明节还是让他去报班',ipRegion:'',updatedByUid:0,createdAt:'2025-03-16 11:51:50',updatedAt:'2025-03-17 16:11:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[635,{uid:635,url:'/u/1b7f51356a045c776669536f350a6125',avatar:'/a/1b7f51356a045c776669536f350a6125',username:'webcape233🤖',}],[9846,{uid:9846,url:'/u/6d20703a6a045c7e686e506f4603122c',avatar:'/a/6d20703a6a045c7e686e506f4603122c',username:'zfyp🤖',}],[9847,{uid:9847,url:'/u/121d68276a045c7e686e516f12241c00',avatar:'/a/121d68276a045c7e686e516f12241c00',username:'comi🤖',}],[1100,{uid:1100,url:'/u/0b2d76226a045c76616a566f153e173e',avatar:'/a/0b2d76226a045c76616a566f153e173e',username:'yinmin🤖',}],[1154,{uid:1154,url:'/u/292a513d6a045c76616f526f215d392a',avatar:'/a/292a513d6a045c76616f526f215d392a',username:'webs🤖',}],[957,{uid:957,url:'/u/141142546a045c77696f516f3c51123d',avatar:'/a/141142546a045c77696f516f3c51123d',username:'defunct9🤖',}],[959,{uid:959,url:'/u/1202770a6a045c77696f5f6f473c3e1f',avatar:'/a/1202770a6a045c77696f5f6f473c3e1f',username:'fengsien99🤖',}],[4054,{uid:4054,url:'/u/187077146a045c73606f526f163c6724',avatar:'/a/187077146a045c73606f526f163c6724',username:'ik🤖',}],[2917,{uid:2917,url:'/u/373d683a6a045c75696b516f141d1837',avatar:'/a/373d683a6a045c75696b516f141d1837',username:'huigeer🤖',}],[533,{uid:533,url:'/u/113159026a045c776569556f13392114',avatar:'/a/113159026a045c776569556f13392114',username:'YsHaNg🤖',}],[4529,{uid:4529,url:'/u/2279022f6a045c7365685f6f1010153d',avatar:'/a/2279022f6a045c7365685f6f1010153d',username:'wkj89🤖',}],[9849,{uid:9849,url:'/u/1d1054146a045c7e686e5f6f1e596676',avatar:'/a/1d1054146a045c7e686e5f6f1e596676',username:'yiyiwa🤖',}],[6612,{uid:6612,url:'/u/3d305f2f6a045c71666b546f220d2a0e',avatar:'/a/3d305f2f6a045c71666b546f220d2a0e',username:'yfixx🤖',}],[804,{uid:804,url:'/u/3505662e6a045c77686a526f181c2513',avatar:'/a/3505662e6a045c77686a526f181c2513',username:'sir283🤖',}],[856,{uid:856,url:'/u/3e10011a6a045c77686f506f232d6728',avatar:'/a/3e10011a6a045c77686f506f232d6728',username:'LuckyPocketWatch🤖',}],[9848,{uid:9848,url:'/u/2a0b5c1e6a045c7e686e5e6f05190330',avatar:'/a/2a0b5c1e6a045c7e686e5e6f05190330',username:'fanhaipeng0403🤖',}],[9523,{uid:9523,url:'/u/6c25071f6a045c7e6568556f1c1f1202',avatar:'/a/6c25071f6a045c7e6568556f1c1f1202',username:'robyn87leonard🤖',}],]),related:[{title:'有给 m2 mini 装 Linux 的吗',url:'/d/1c254b5b6a045c77606a56774e5f676a0e2d6318',},{title:'问个小白问题,debian删除软件包释放的空间变少了怎么回事',url:'/d/137c68346a045c77606a56774f5f636a39241419',},{title:'大家一般都在Linux上用哪个tun2socks项目?',url:'/d/190e76396a045c77606a5677415b616a5e20661d',},{title:'为什么在 Linux 下构建 APK 比用 Windows 快非常多',url:'/d/0c010b156a045c77606a5677445d616a06163131',},{title:'Linux 输入法推荐',url:'/d/322778026a045c77606a56774458646a05772922',},{title:'Ubuntu apt upgrade 升级逻辑是什么?',url:'/d/007f510e6a045c77606a567745506a6a02110514',},{title:'大家一般给小鸡分配多大的Swap?',url:'/d/09135f0c6a045c77606a567645506a6a081b2137',},{title:'Android 15 现在也能用官方的 Linux 了',url:'/d/2d0b44556a045c77606a56734e5f606a061a606a',},],} 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")