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:4355,currentPage:1,targetPage:1,total:11,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:42,url:'/t/287b5e216a045c73627752212325',name:'OVH',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:48986,num:0,uid:2003,content:'\u003Cp\u003E用的国内信用卡注册的,号是不是没了?\u003Cbr\u003E如果风控了购买机器的钱会退回来吗?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 07:59:00',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48987,num:1,uid:1646,content:'\u003Cp\u003E会的\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 07:59:35',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48988,num:2,uid:3581,content:'\u003Cp\u003E48小时说明你没机会,钱退的很慢我上次退了一个月,慢慢等\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:00:00',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48989,num:3,uid:2003,content:'\u003Cp\u003E唉,买个机器提心吊胆\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:00:21',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48990,num:4,uid:2003,content:'\u003Cp\u003E一个月这么长时间啊,那我还是去买一个号算了\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:01:01',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48991,num:5,uid:10429,content:'\u003Cp\u003E这不是正常操作吗,以前我最长还等过20多天才交付的,最怕的就是等到最后说没了直接退款。\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:02:41',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48992,num:6,uid:1985,content:'\u003Cp\u003E交付周期也太短了,楼上20天……不会是没额度了等过期的吧,有种排队的感觉 \u003Cimg src\u003D\"/z/img/xhj/015.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:11:32',updatedAt:'2025-03-18 21:18:25',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48993,num:7,uid:2003,content:'\u003Cp\u003E没额度应该不可购买才对,如果真是这样,商家太坑了\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:18:06',updatedAt:'2025-03-18 21:18:26',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48994,num:8,uid:6714,content:'\u003Cp\u003E区选错都白扯;ca 秒开 ie退款一个月 \u003Cimg src\u003D\"/z/img/yct/005.webp\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:19:00',updatedAt:'2025-03-18 21:18:26',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48995,num:9,uid:2003,content:'\u003Cp\u003Eca地址没得选,有税\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:20:36',updatedAt:'2025-03-18 21:18:26',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:48996,num:10,uid:1985,content:'\u003Cp\u003E都是为了赚钱,不寒碜\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-18 08:22:58',updatedAt:'2025-03-18 21:18:26',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[1985,{uid:1985,url:'/u/0b0b45546a045c766962536f343f0a22',avatar:'/a/0b0b45546a045c766962536f343f0a22',username:'ejin🤖',}],[3581,{uid:3581,url:'/u/0f2b7e386a045c746562576f02002913',avatar:'/a/0f2b7e386a045c746562576f02002913',username:'佛如来🤖',}],[6714,{uid:6714,url:'/u/15185e3c6a045c71676b526f4125072b',avatar:'/a/15185e3c6a045c71676b526f4125072b',username:'jiligulu🤖',}],[10429,{uid:10429,url:'/u/362f73086a045d7764685f6f253d203f',avatar:'/a/362f73086a045d7764685f6f253d203f',username:'relaybtsvu🤖',}],[1646,{uid:1646,url:'/u/1d280b396a045c76666e506f1a396a2c',avatar:'/a/1d280b396a045c76666e506f1a396a2c',username:'spark1314🤖',}],[2003,{uid:2003,url:'/u/33017d086a045c75606a556f4350120d',avatar:'/a/33017d086a045c75606a556f4350120d',username:'kevinlaw🤖',}],]),related:[{title:'ovh怎么转移,20块钱丢个KS-B ie区',url:'/d/173f03156a045c77606a567a47506b6a1e7b6317',},{title:'【收】OVH IE区 KS-LE-B 9.9一台',url:'/d/0e3178396a045c77606a56754e5b636a3b0a6024',},{title:'PUSH 出台 KS-LE-1',url:'/d/312f480b6a045c77606a56754050616a28163101',},{title:'ovhcloud哪里的vps对大陆网络好点',url:'/d/3b38481d6a045c77606a5675405f666a0b15006b',},{title:'OVH IE区出一台 KS-LE-2,2×1.92 TB,配置如下',url:'/d/0306485c6a045c77606a5675405d676a14103d05',},{title:'出 OVH KS-LE-C CA区 内存CPU中奖',url:'/d/3370773d6a045c77606a5674405c616a19083c1f',},{title:'OVH KS-B和KS-C如果定5o,7o,有几个人会买?',url:'/d/0e18745d6a045c77606a56744058656a2f302a38',},{title:'想收一台性价比比较高的OVH独服',url:'/d/030474346a045c77606a56774f5a6a6a3d052760',},{title:'OVH BFSTOR21-2 测评',url:'/d/680c5b346a045c77606a56774151676a3c293c63',},{title:'高溢价收个OVH 10G口中奖的KS2',url:'/d/093e655a6a045c77606a56774759646a3e34022a',},{title:'[出] OVH KS-2 德国 HDD 10G网络',url:'/d/0c1e7c256a045c77606a5676435c666a2d076424',},{title:'不想走弯路了 准备购买ovh9.9o的杜甫 看了一圈发现很多款 价格高低很大 然后ovh账号注册要注意啥',url:'/d/17057f556a045c77606a5676455c626a08130631',},{title:'已解决 ovh年付0.97 是只能改邮箱出吗,工单申请?',url:'/d/0a04570e6a045c77606a5671425e606a1b2e3d21',},{title:'【已出】出OVH KS- LE-1 ie区',url:'/d/3f0e531c6a045c77606a5671445c646a1d0d001d',},{title:'ovh ca区可以和ie区共用1张卡吗',url:'/d/2b3962146a045c77606a56704451656a04153008',},{title:'OVH0.97 美西改邮箱给别人是否要求对方注册过还是要求新邮箱没注册的号',url:'/d/6c27000e6a045c77606a5670465b6a6a390b266b',},{title:'已出 一台OVH的KS-LE-1',url:'/d/6f227e5f6a045c77606a56734f50656a2509311e',},{title:'已出 OVH0.97美西年付循环,',url:'/d/0d1b56236a045c77606a56734150626a0d263865',},{title:'【已出】150R低价出OVH IE区免税号',url:'/d/317e071d6a045c77606a56734659606a1c353823',},{title:'(已出)260改邮箱出个 ovh 美西 0.97',url:'/d/171877546a045c77606a56734751646a3c711527',},],} 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")