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:8510,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:112833,num:0,uid:4947,content:'每次还信用卡花呗的时候就感觉咋花了这么多,然后就想到要不开始记个账吧。以前也记账过,个人感觉通过每一笔记录数据,稍微可以让自己节制一下,有些不该买的东西不买。但是没坚持太久,之前试过两种方式一种是消费一笔随手打开记录一下毕竟随手记么,还有就是晚上睡前花几分钟大概回忆下花了那些钱统一记录下。第二种相对没那么麻烦,但也没坚持很久。一旦一两天忘记弄了,后面就懒得弄了,还有就是记账的约束也算一种约束吧,毕竟数字时代,很多时候买东西花钱没啥概念支付宝碰一下也就是个数字的变动。\u003Cbr\u003E\u003Cbr\u003Ev2ers 有记账习惯么,对自己生活理财有啥影响不。\u003Cbr\u003E另外能推荐点好用的记账 app 么,自己以前用过随手记,现在 ios 平台的 iCost 不错,但是后面要换安卓机。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:48:57',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112834,num:1,uid:14350,content:'钱迹,支持了永久会员',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:52:36',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[67,],mentionUsers:[],likeUsers:[],},{id:112835,num:2,uid:13703,content:'每天都会记账,坚持了 3 年了吧,(工作刚 4 年哈哈)对理财还算有帮助,起码可以看到钱都花在哪了,月均消费金额等\u003Cbr\u003E\u003Cbr\u003E我现在是 iOS 的卡片记账 app (好像只有 ios 版本),使用体验还可以',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:54:53',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[3,],mentionUsers:[],likeUsers:[],},{id:112836,num:3,uid:4947,content:'#2 随手记么 还是一天下来找个时间统一记录下',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:56:35',updatedAt:'2025-04-19 23:46:16',mentionNum:2,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112837,num:4,uid:827,content:'有,用 moneythins 记账。但是并没有养成良好的消费习惯,反而花钱更多了。\u003Cbr\u003E感觉用记账 App 主要是让我清晰地了解钱都放在了哪里。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:57:04',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112838,num:5,uid:18831,content:'记账 3882 天,用来用去还是随手记。\u003Cbr\u003E原因很单纯:全平台都有客户端,有网页版,一堆只有手机端的记账软件等到要对账的时候烦得要死。\u003Cbr\u003E\u003Cbr\u003E钱迹用过很多次,都放弃了,不理解为什么支出的金额不能计入负数。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:57:32',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[68,],mentionUsers:[],likeUsers:[],},{id:112839,num:6,uid:3852,content:'个人观点,简单记一下大额就足够了。\u003Cbr\u003E记账的主要意义是,记收入的,收入笔数多,比较零碎,那么记一下,如果就工资,一个月就一次,记也意义不大。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:57:34',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112840,num:7,uid:8772,content:'短暂的记录过几个月,太麻烦放弃了,现在用鲨鱼资产管家,每个月统计下余额,简单的资产变化折线图也满足我需求了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:57:50',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112841,num:8,uid:13703,content:'每天晚上 9 点复盘,和对象一起记录,哈哈',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 09:57:59',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112842,num:9,uid:16348,content:'\u003Cimg src\u003D\"https://i.imgur.com/NIvxivj.png\"\u003E微信+支付宝+信用卡 这些不是足够了么,难道要记录到每一分钱上。。以前我天天记,坚持不了几天,太繁琐了。直接走信用卡就行。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:00:13',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112843,num:10,uid:5763,content:'+1',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:01:31',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112844,num:11,uid:6967,content:'用钱迹 每周日统一记录下',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:02:14',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112845,num:12,uid:14092,content:'为了倒逼自己省钱,写了个小 app ,每月限额 4000 ,每支出一笔,都会更新本月还能花多少,平均到每天还能花多少,今天还剩多少额度。挺有用的,以前花钱不清不楚一个月六七千,现在勉强能控制在四五千的样子',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:04:30',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[58,],mentionUsers:[],likeUsers:[],},{id:112846,num:13,uid:4956,content:'beancount+vscode',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:09:23',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112847,num:14,uid:1251,content:'设置一个每天都提醒的事项,这样就不会忘了要记账了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:10:31',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112848,num:15,uid:16716,content:'目前也是用的钱迹。从 2017 年开始记账,最开始用的网易有钱,当时感觉还不错,里面有个功能挺好,比如基金啥的,计入购买成本,每天可以直接看到涨跌情况,后面网易把这个 APP 砍了,而且要冲会员才能把数据导出来.....中途几年就是各种尝试更换,最后用了钱迹。反正最关键的,选一个可以导出数据的!!!选一个可以导出数据的!!!选一个可以导出数据的!!!',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:10:52',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112849,num:16,uid:12737,content:'百事 AA 记账 我用这还是挺不错的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:12:19',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112850,num:17,uid:6129,content:'用了十多年随手记,直到元旦的时候发现所有数据全错乱了,改投钱迹了,买了永久 vip ,虽然有些小问题,但是总体还行',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:12:37',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112851,num:18,uid:10900,content:'有像我这种抠门所以完全不需要记账软件的吗 lol',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:12:46',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:112852,num:19,uid:18832,content:'有记账,但是是自动记账,感觉没啥帮助。自动记账有点太无感了。除非自己限额,也只能是知道钱花到哪里去了而已。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-15 10:15:50',updatedAt:'2025-04-19 23:46:16',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[6967,{uid:6967,url:'/u/2e084b2f6a045c71696c516f071d0931',avatar:'/a/2e084b2f6a045c71696c516f071d0931',username:'location123🤖',}],[4956,{uid:4956,url:'/u/0b06030a6a045c73696f506f2d270312',avatar:'/a/0b06030a6a045c73696f506f2d270312',username:'TrembleBeforeMe🤖',}],[827,{uid:827,url:'/u/3e0e7a396a045c776868516f45191028',avatar:'/a/3e0e7a396a045c776868516f45191028',username:'bojackhorseman🤖',}],[6129,{uid:6129,url:'/u/18395b0b6a045c7161685f6f3338361d',avatar:'/a/18395b0b6a045c7161685f6f3338361d',username:'jy02534655🤖',}],[16716,{uid:16716,url:'/u/1d1c612e6a045d71676b506f0d5c271d',avatar:'/a/1d1c612e6a045d71676b506f0d5c271d',username:'masir🤖',}],[4947,{uid:4947,url:'/u/627148046a045c73696e516f0f040100',avatar:'/a/627148046a045c73696e516f0f040100',username:'arron2022🤖',}],[18842,{uid:18842,url:'/u/3b2a73296a045d7f686e546f36582934',avatar:'/a/3b2a73296a045d7f686e546f36582934',username:'y783366180🤖',}],[18832,{uid:18832,url:'/u/023c44006a045d7f6869546f35051433',avatar:'/a/023c44006a045d7f6869546f35051433',username:'cico98🤖',}],[14092,{uid:14092,url:'/u/381842056a045d736063546f363e3a22',avatar:'/a/381842056a045d736063546f363e3a22',username:'soar0712🤖',}],[5763,{uid:5763,url:'/u/3519431d6a045c72676c556f18062221',avatar:'/a/3519431d6a045c72676c556f18062221',username:'pweng286🤖',}],[16348,{uid:16348,url:'/u/3f7c5d5d6a045d71636e5e6f43593708',avatar:'/a/3f7c5d5d6a045d71636e5e6f43593708',username:'daohanghao🤖',}],[10900,{uid:10900,url:'/u/693a582c6a045d77696a566f2f333d20',avatar:'/a/693a582c6a045d77696a566f2f333d20',username:'Merlini🤖',}],[1251,{uid:1251,url:'/u/2b3d682e6a045c76626f576f063b3631',avatar:'/a/2b3d682e6a045c76626f576f063b3631',username:'maxwellz🤖',}],[18831,{uid:18831,url:'/u/2c2d623b6a045d7f6869576f3c513b26',avatar:'/a/2c2d623b6a045d7f6869576f3c513b26',username:'Sharuru🤖',}],[14350,{uid:14350,url:'/u/391c7b226a045d73636f566f11236b1f',avatar:'/a/391c7b226a045d73636f566f11236b1f',username:'mytoroto🤖',}],[18458,{uid:18458,url:'/u/342866276a045d7f646f5e6f3b3e1f30',avatar:'/a/342866276a045d7f646f5e6f3b3e1f30',username:'lixiaobai913🤖',}],[12737,{uid:12737,url:'/u/6e2e4a206a045d756769516f003f1030',avatar:'/a/6e2e4a206a045d756769516f003f1030',username:'chaoooooos🤖',}],[13703,{uid:13703,url:'/u/103f603a6a045d74676a556f3911163f',avatar:'/a/103f603a6a045d74676a556f3911163f',username:'dongQQ🤖',}],[8772,{uid:8772,url:'/u/2d3c53186a045c7f676d546f40230631',avatar:'/a/2d3c53186a045c7f676d546f40230631',username:'gimp🤖',}],[3852,{uid:3852,url:'/u/361a55266a045c74686f546f30000025',avatar:'/a/361a55266a045c74686f546f30000025',username:'JamesR🤖',}],]),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")