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:8606,currentPage:1,targetPage:1,total:24,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:115241,num:0,uid:5127,content:'\u003Cp\u003E我和室友都拿驾照十多年了没开过车, 周末逛了车展次日就租车练练车(看车不买车, 打算租一阵子再说).\u003C/p\u003E\u003Cp\u003E本来计划找个僻静的地练练车感, 结果把车从停车场开到练车点发现很顺利, 于是就继续在马路上开了, 一天下来跑了 130 多公里, 围着城区周边几个景点绕了一个大圈.\u003C/p\u003E\u003Cp\u003E这周末打算去灵岩寺, 估计要走省道跟高架, 计划五一去日照(考虑要走高速, 是租车开过去还是到了再租还没定)\u003C/p\u003E\u003Cp\u003E大家怎么建议呢?\u003C/p\u003E\u003Cp\u003E另外考虑到需要装一个行车记录仪, 但看了一圈发现很多都是静电贴的, 这玩意如果反复拆装需要换静电贴也是成本, 不知道大家有没有便于拆装且清晰的行车记录仪?\u003C/p\u003E\u003Cp\u003E预算 200-300 左右吧? 如果没有合适的, 也许 500 以内也可以接受.\u003C/p\u003E\u003Cp\u003E谢谢.\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:20:57',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115242,num:1,uid:19089,content:'目前在用盯盯拍还不错',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:22:07',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[4,],mentionUsers:[],likeUsers:[],},{id:115243,num:2,uid:17913,content:'搜下“行车记录仪吸盘支架”,几块钱,注意下螺丝头的大小',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:25:09',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115244,num:3,uid:8325,content:'新手建议不要着急上高速,你感觉你自己开车很牛逼了,其实是最危险的时候,而且你这感觉来的太早了点,一般新手第一阶段都是害怕开的慢,第二阶段上路瞅谁都是撒比,第三阶段老司机风淡云清见怪不怪了',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 15:33:16',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115245,num:4,uid:11830,content:'#1 建议避坑盯盯拍,漏拍、拍车牌不清楚都是我遇到过的。这两个硬伤随便一搜就很多。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 16:24:06',updatedAt:'2025-04-19 23:47:56',mentionNum:1,mentionedBy:[11,],mentionUsers:[],likeUsers:[],},{id:115246,num:5,uid:19090,content:'哈哈哈,我现在处于第二阶段',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 16:43:28',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115247,num:6,uid:6471,content:'360 的,有带子绑后视镜上,随时取下来。\u003Cbr\u003E另,租车建议买个保险。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:15:13',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115248,num:7,uid:16748,content:'佳明好像也有记录仪,耐用性蛮好',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:22:37',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115249,num:8,uid:8021,content:'租车的话整个吸盘的或者绑带的方便拆卸。之前用的 papago 还行。\u003Cbr\u003E租车跨城市不知道你们那有没有什么要求,我记得有的平台不支持跨城市。\u003Cbr\u003E买足保险。\u003Cbr\u003E租车前用摄像头完整的将车和交接的人都拍下,车一定要拍仔细了 包括车顶 车裙 。以免后期找你事。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:27:55',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115250,num:9,uid:3708,content:'没你想象的那么可怕, 18 年拿的驾照, 21 年买的车. 买车前一个月租车练了两天, 那时人在南京, 去上海提的车, 上海提车后又全程 300 多公里走高速回南京. 对了, 整个订车、购车、提车整个流程都是我自己一个人.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:32:21',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115251,num:10,uid:19091,content:'给人提个醒就行了 有些人可能还不领情的',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:34:55',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115252,num:11,uid:5127,content:'#4 感谢提醒, 哈哈, 目前还不至于到第二阶段, 各个路段还是小心翼翼, 但会控制车速与周围速度差不多, 不怕速度快也不会刻意追求速度快.\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E#9 我就个感觉信心满满, 但又因为没经历过导致没底, 我室友倾向于非常保守的状态...\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E#10 都是好心\u003Cbr\u003E\u003Cbr\u003E# 绑带是个好主意, 我看下能买个绑的不.\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E #8 在看一些吸盘配件, 不过似乎会使体积大很多, 担心影响视线.\u003Cbr\u003E\u003Cbr\u003E保险是买足的, 租车上的保险直接拉到了最高(99 元/天), 然后又额外分别买了意外险, 写的是只保“营运车辆乘客”, 但神州的车都是营运车辆, 应该也能保的吧.',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:43:10',updatedAt:'2025-04-19 23:47:56',mentionNum:4,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115253,num:12,uid:929,content:'我是首次上路就上的高速,当时确实超紧张,但路况反而极其规范',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:47:36',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115254,num:13,uid:19092,content:'\u003Cbr\u003E有些公里数还没过 1W 的,一直没出事故,挺顺利的,会觉得其实这个事情很简单的。但凡出过一次事或差点就出事的才知道',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:47:49',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[15,],mentionUsers:[],likeUsers:[],},{id:115255,num:14,uid:1259,content:'\u0026lt;\u0026lt; 十年老司机 \u0026gt;\u0026gt;',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:48:51',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115256,num:15,uid:5127,content:'#13 好像是个必然的阶段, 不过我 车祸警示录 等车祸博主每日必看, 每天十几分钟, 希望永远不会进入二阶段.\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E#12 其实除了车速快以外, 路况其实更简单, 起码没有碰瓷小老头和乱窜的电动车.\u003Cbr\u003E\u003Cbr\u003E\u003Cbr\u003E#14 照龄 10 年也是 10 年, 你就说是不是吧🐶',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 17:53:43',updatedAt:'2025-04-19 23:47:56',mentionNum:13,mentionedBy:[18,],mentionUsers:[],likeUsers:[],},{id:115257,num:16,uid:17257,content:'一、360 行车记录仪 m 系列 pro\u003Cbr\u003E二、你这个里程数还是别上高速了,真的很危险,纯新手,很多情况你都没遇到过',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 18:10:48',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115258,num:17,uid:10030,content:'租车买啥行车记录仪啊\u003Cbr\u003E\u003Cbr\u003E简直就是扔钱。',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 18:31:37',updatedAt:'2025-04-19 23:47:56',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115259,num:18,uid:19092,content:'#15 \u003Cbr\u003E大部分人都是一样的,只有经历过后才会有敬畏之心,在此之前觉得不过如此 \u003Cimg src\u003D\"https://i.imgur.com/agAJ0Rd.png\"\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 18:42:47',updatedAt:'2025-04-19 23:47:56',mentionNum:15,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:115260,num:19,uid:19093,content:'我刚开始租车还买个手机支架带着🤣',ipRegion:'',updatedByUid:0,createdAt:'2025-04-17 20:13:17',updatedAt:'2025-04-19 23:47:57',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[10030,{uid:10030,url:'/u/10045a246a045d776069566f19236b10',avatar:'/a/10045a246a045d776069566f19236b10',username:'likooo125802023🤖',}],[17257,{uid:17257,url:'/u/197f641c6a045d70626f516f0e593704',avatar:'/a/197f641c6a045d70626f516f0e593704',username:'Elephant696🤖',}],[19089,{uid:19089,url:'/u/220347236a045d7e60625f6f1011397f',avatar:'/a/220347236a045d7e60625f6f1011397f',username:'J3ho🤖',}],[19093,{uid:19093,url:'/u/133e755c6a045d7e6063556f2f136a04',avatar:'/a/133e755c6a045d7e6063556f2f136a04',username:'acezgq🤖',}],[19091,{uid:19091,url:'/u/2a1d035d6a045d7e6063576f2f33263e',avatar:'/a/2a1d035d6a045d7e6063576f2f33263e',username:'rivercherdeeeeee🤖',}],[3708,{uid:3708,url:'/u/6d235c096a045c74676a5e6f34512016',avatar:'/a/6d235c096a045c74676a5e6f34512016',username:'zepc007🤖',}],[8021,{uid:8021,url:'/u/68016b096a045c7f6068576f1c2d1517',avatar:'/a/68016b096a045c7f6068576f1c2d1517',username:'yvyvyv🤖',}],[8325,{uid:8325,url:'/u/1e05433d6a045c7f6368536f02310973',avatar:'/a/1e05433d6a045c7f6368536f02310973',username:'timeisweapon🤖',}],[5127,{uid:5127,url:'/u/167e58396a045c726168516f240d2a0e',avatar:'/a/167e58396a045c726168516f240d2a0e',username:'InDom🤖',}],[17913,{uid:17913,url:'/u/1d1a47546a045d70696b556f223e303d',avatar:'/a/1d1a47546a045d70696b556f223e303d',username:'irever🤖',}],[19092,{uid:19092,url:'/u/0c247e016a045d7e6063546f402a6333',avatar:'/a/0c247e016a045d7e6063546f402a6333',username:'willxiang🤖',}],[19090,{uid:19090,url:'/u/032874396a045d7e6063566f132e1834',avatar:'/a/032874396a045d7e6063566f132e1834',username:'Kyren🤖',}],[929,{uid:929,url:'/u/0d0d542a6a045c7769685f6f461f3b30',avatar:'/a/0d0d542a6a045c7769685f6f461f3b30',username:'opengps🤖',}],[1259,{uid:1259,url:'/u/363f012a6a045c76626f5f6f3b5b1f2c',avatar:'/a/363f012a6a045c76626f5f6f3b5b1f2c',username:'liudewa🤖',}],[11830,{uid:11830,url:'/u/0871455b6a045d766869566f1e393c31',avatar:'/a/0871455b6a045d766869566f1e393c31',username:'ansemz🤖',}],[16748,{uid:16748,url:'/u/163d5a046a045d71676e5e6f3d022333',avatar:'/a/163d5a046a045d71676e5e6f3d022333',username:'quqiu🤖',}],[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")