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:8572,currentPage:1,targetPage:1,total:101,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:[],posts:[{id:114495,num:0,uid:18125,content:'目前买了房,贷款买的,花了 20 出头,没有车。\u003Cbr\u003E订婚时给了 10w ,结婚时要 16.8 ,不买黄金 18.8 。我不同意,准备 16.8 不买黄金,大家觉得多吗,第一次结婚,请过来人谈谈看法\u003Cbr\u003E对象家里的意思是结婚时再添点都带回来,我估计是以 16.8 的基础上加',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:00:51',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114496,num:1,uid:1153,content:'别想了,女方要多少都给,不然后边有的埋怨了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:03:29',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114497,num:2,uid:58,content:'不多,我十多年前就是 16 万了,现在农村不能低于 28 万,外加一套至少 100 多万的房子',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:09:19',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114498,num:3,uid:5595,content:'对象家里的意思是结婚时再添点都带回来,我估计是以 16.8 的基础上加\u003Cbr\u003E\u003Cbr\u003E给。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:10:17',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114499,num:4,uid:6471,content:'订婚时没说彩礼要多少吗?\u003Cbr\u003E18.8 和 16.8 就差 2 万,还是给了吧。\u003Cbr\u003E如果都能带回来,那不还是你们的钱',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:12:04',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114500,num:5,uid:17202,content:'浙江我的时代( 2010 年)一般是 20~30 万。2018 年左右是 60~上不封顶。当然没有女方会真收全部,只是表示一种美好生活的向往。然后最多收个 20%结婚。车一般女方陪嫁,现在最少也是奥迪 a4q5 奔驰 glcglee 宝马 3~5~7 ,不知道有没有消费降级。反正离谱的事情也多,看你自身情况。对于我们那时代,结婚是一件很严谨的事情,不可儿戏,有很复杂的流程及手续的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:13:46',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114501,num:6,uid:18125,content:'我订婚+结婚也快 30 了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:17:15',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114502,num:7,uid:18125,content:'我是北方人,南方还是有钱啊。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:17:41',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114503,num:8,uid:18125,content:'我们那都不提前说,订婚时谈结婚的彩礼面子上过不去。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:19:30',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114504,num:9,uid:58,content:'浙江农村排面不小,前年亲戚结婚,自己去杭州批发市场买菜请厨师烧,5000 一桌搞了 40 桌。整个婚礼消费七八十万。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:20:08',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114505,num:10,uid:6176,content:'彩礼就是补差价,你觉得你亏欠多少就补多少就是了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:20:09',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[47,100,],mentionUsers:[],likeUsers:[],},{id:114506,num:11,uid:18125,content:'但是我对象是那种进口袋的钱掏出来就难了。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:20:20',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114507,num:12,uid:18138,content:'畸形的彩礼文化该结束了,双方父母愿意给新人多少扶持结婚的时候给个红包就好了,如果你出这笔钱结婚后她在带回来有什么意义呢,方便以后离婚分财产吗',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:20:55',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114508,num:13,uid:18125,content:'卧槽,我这 500 一桌。。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:21:08',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114509,num:14,uid:1054,content:'自己问问自己,不结婚是不是会死🤣',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:21:22',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114510,num:15,uid:18125,content:'咋说呢,我感觉在女方的心理上这笔钱是个保障,而不是拿出来供小家使用的,除非遇到紧急的事',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:22:39',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[18,],mentionUsers:[],likeUsers:[],},{id:114511,num:16,uid:18125,content:'我觉得不亏欠啊,哈哈',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:23:02',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114512,num:17,uid:18125,content:'会,也不会,哈哈',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:23:34',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114513,num:18,uid:6176,content:'#15 那你的保障呢?对方卷款跑路你怎么办?还给对方辩解呢,对方体谅你吗?',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:24:38',updatedAt:'2025-04-19 23:47:22',mentionNum:15,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:114514,num:19,uid:18125,content:'我不是给对方辩解,而是说以我的了解,她认为这笔钱更多是保障,而不是为了小家',ipRegion:'',updatedByUid:0,createdAt:'2025-04-14 23:27:46',updatedAt:'2025-04-19 23:47:22',mentionNum:0,mentionedBy:[21,],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[18138,{uid:18138,url:'/u/317f61556a045d7f61695e6f4f28327e',avatar:'/a/317f61556a045d7f61695e6f4f28327e',username:'tuzexiansheng🤖',}],[5595,{uid:5595,url:'/u/1e1c702c6a045c726563536f24023e06',avatar:'/a/1e1c702c6a045c726563536f24023e06',username:'aladd🤖',}],[58,{uid:58,url:'/u/6c314b256a045c77606f5e6f032a181e',avatar:'/a/6c314b256a045c77606f5e6f032a181e',username:'sagaxu🤖',}],[1054,{uid:1054,url:'/u/6224645d6a045c76606f526f06010737',avatar:'/a/6224645d6a045c76606f526f06010737',username:'MajestySolor🤖',}],[17202,{uid:17202,url:'/u/2807405e6a045d70626a546f3859610d',avatar:'/a/2807405e6a045d70626a546f3859610d',username:'areless🤖',}],[18125,{uid:18125,url:'/u/03045e2f6a045d7f6168536f190f2b15',avatar:'/a/03045e2f6a045d7f6168536f190f2b15',username:'myTrip🤖',}],[585,{uid:585,url:'/u/021c7f256a045c776562536f300c317f',avatar:'/a/021c7f256a045c776562536f300c317f',username:'Meld🤖',}],[19008,{uid:19008,url:'/u/133b551b6a045d7e606a5e6f1526212e',avatar:'/a/133b551b6a045d7e606a5e6f1526212e',username:'cookLv🤖',}],[1153,{uid:1153,url:'/u/2271745b6a045c76616f556f461e1c32',avatar:'/a/2271745b6a045c76616f556f461e1c32',username:'gaobh🤖',}],[6176,{uid:6176,url:'/u/3f0d54266a045c71616d506f42003e04',avatar:'/a/3f0d54266a045c71616d506f42003e04',username:'sunny352787🤖',}],[6471,{uid:6471,url:'/u/6d3f421f6a045c71646d576f1c1d1f33',avatar:'/a/6d3f421f6a045c71646d576f1c1d1f33',username:'magic3584🤖',}],]),related:[],} 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")