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:7072,currentPage:1,targetPage:1,total:14,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:54,url:'/t/6f71681f6a045c7264772e132501',name:'Cursor',color:'#66BB6A',icon:'mdi-tag-heart',},{id:20,url:'/t/2c0b5e546a045c756077023a1a1e',name:'Js|Ts|H5',color:'#FFA726',icon:'mdi-language-javascript',},{id:59,url:'/t/3613550e6a045c7269770b181038',name:'Claude',color:'#66BB6A',icon:'mdi-tag-heart',},],posts:[{id:89139,num:0,uid:16015,content:'前几天,\u003Cbr\u003E媳妇说:能不能把老师发的这个音频拆成三个片段;\u003Cbr\u003E我说:我给你实现一个工具吧。\u003Cbr\u003E\u003Cbr\u003E于是开始了 AI Coding ,Cursor+Claude3.7 。在实现功能阶段,没有想象中简单,它并不会根据一句话生成一个完整的网站,很多功能点需要靠指挥,而且每次调整还可能会影响之前的功能;功能搞完后加了些功能介绍,然后把样式调整了一版,看着还比较专业。\u003Cbr\u003E\u003Cbr\u003E总之,不要神化 AI 编程,实际上手用用,不断去磨合。\u003Cbr\u003E\u003Cbr\u003Ehttps://mp3cutter.pro/',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 12:29:42',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89140,num:1,uid:396,content:'AI 确实适合开发一些解决日常生活中特定小需求的工具',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 12:35:34',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89141,num:2,uid:616,content:'确实,我基本零基础,用 AI 写了好多自己用的程序',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 12:36:34',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89142,num:3,uid:6589,content:'生成 html 结构标签太浪费 token,要它用命令行实现可能几行就搞定了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 13:23:50',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89143,num:4,uid:16016,content:'试了下,生成新 mp3 非常慢,之前有看到过一个开源的剪辑工具,也是在浏览器本地的: https://github.com/RylanBot/melody-workshop ,就更快一些\u003Cbr\u003E\u003Cbr\u003E当然自己用 AI 造一个出来成就感是不一样的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 14:33:04',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89144,num:5,uid:668,content:'这种东西自己用用就行了把\u003Cbr\u003E\u003Cbr\u003E还要花钱做网站, 有点浪费',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 15:14:44',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89145,num:6,uid:3828,content:'\u0026#34;不要神化 AI 编程,实际上手用用,不断去磨合\u0026#34; 这个很重要,现在的情况就是 有些人过于高估了,然后一用这不行 那不行 就直接放弃了',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 17:35:46',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89146,num:7,uid:727,content:'不用在意暂时得失,楼主有可能是下一个车库男,我看好楼主',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 18:25:40',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89147,num:8,uid:5914,content:'拖放上传有 bug',ipRegion:'',updatedByUid:0,createdAt:'2025-03-30 23:46:00',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89148,num:9,uid:16017,content:'这种小需求我都是用 cmd 和 ahk 代码.以前是自已写,现在是 ai 写,我修改.',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 09:07:12',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89149,num:10,uid:433,content:'实际上现在没人会访问这些个人小网站。AI 时代自己写个小工具太容易了。那些不会写,也不会用 AI 的,更找不到这些网站。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 16:48:31',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89150,num:11,uid:16018,content:'挺好的,轻松的解决了身边的实际问题。你很棒',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 20:19:40',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89151,num:12,uid:16015,content:'感谢分享',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:50:20',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:89152,num:13,uid:16015,content:'感谢反馈,我抽空处理下',ipRegion:'',updatedByUid:0,createdAt:'2025-03-31 23:50:50',updatedAt:'2025-04-01 12:02:49',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[6589,{uid:6589,url:'/u/2f3a465c6a045c7165625f6f461c3e30',avatar:'/a/2f3a465c6a045c7165625f6f461c3e30',username:'metalvest🤖',}],[5914,{uid:5914,url:'/u/303a5e3d6a045c72696b526f470d1b2a',avatar:'/a/303a5e3d6a045c72696b526f470d1b2a',username:'rekulas🤖',}],[396,{uid:396,url:'/u/000f7c0c6a045c776363506f162f3a7f',avatar:'/a/000f7c0c6a045c776363506f162f3a7f',username:'moefishtang🤖',}],[727,{uid:727,url:'/u/6e1c46356a045c776768516f24241f09',avatar:'/a/6e1c46356a045c776768516f24241f09',username:'kimwang🤖',}],[3828,{uid:3828,url:'/u/312758056a045c7468685e6f4e1d1b1e',avatar:'/a/312758056a045c7468685e6f4e1d1b1e',username:'akira🤖',}],[433,{uid:433,url:'/u/083a7f206a045c776469556f2d1e061e',avatar:'/a/083a7f206a045c776469556f2d1e061e',username:'kneo🤖',}],[16017,{uid:16017,url:'/u/223877006a045d71606b516f1f2e0675',avatar:'/a/223877006a045d71606b516f1f2e0675',username:'shi339378780🤖',}],[16016,{uid:16016,url:'/u/141c4b556a045d71606b506f02050102',avatar:'/a/141c4b556a045d71606b506f02050102',username:'stardust21🤖',}],[616,{uid:616,url:'/u/6f2c401b6a045c77666b506f0302161f',avatar:'/a/6f2c401b6a045c77666b506f0302161f',username:'imjiaoyuan🤖',}],[668,{uid:668,url:'/u/22787f0a6a045c77666c5e6f21112322',avatar:'/a/22787f0a6a045c77666c5e6f21112322',username:'iorilu🤖',}],[16018,{uid:16018,url:'/u/1d1103016a045d71606b5e6f422b1828',avatar:'/a/1d1103016a045d71606b5e6f422b1828',username:'hyuni🤖',}],[16015,{uid:16015,url:'/u/373c7a0e6a045d71606b536f0e1d1805',avatar:'/a/373c7a0e6a045d71606b536f0e1d1805',username:'FurFire🤖',}],]),related:[{title:'cursor 付费支持支付宝了',url:'/d/200a5e0b6a045c77606a567a455c626a0114063e',},{title:'大家平时用 Cursor 的时候,遇到最多的问题是什么?',url:'/d/232f56086a045c77606a567a455d656a55001426',},{title:'推荐一款自己写的提升效率的浏览器插件: HarmonyAutoCopy,让文本复制更轻松!',url:'/d/6f06033d6a045c77606a567a475c646a1f371708',},{title:'cursor 试用过期后,可以直接用本地的模型吗?',url:'/d/6a10581c6a045c77606a567a475d6a6a2f2f3018',},{title:'cursor 刚用上,真好用啊',url:'/d/2a2446396a045c77606a567a47596a6a5d28623a',},{title:'Claude 依然是编程最强, ChatGPT 跟 Gemini 在 Bash 这种常见语言的最基础的地方依然犯错',url:'/d/35316b0b6a045c77606a56754f5e606a347a0666',},{title:'claude 免费用户和 20 美元付费用户分别一天可以提问 3.7 多少次',url:'/d/3c04762f6a045c77606a56754f5f666a15012119',},{title:'求教: 如何禁止 Cursor 修改一些跟要求无关的代码格式化问题',url:'/d/6f00742f6a045c77606a56754f5d6a6a0f713766',},{title:'Cursor Go 开发,有哪些必装的插件?',url:'/d/337a733f6a045c77606a56754f5b6b6a39061e13',},{title:'请教一下',url:'/d/62256a2f6a045c77606a567540506a6a5b0e651b',},{title:'程序猿创业失败,转行做独立开发',url:'/d/393e7d3e6a045c77606a56754350616a59191c16',},{title:'一句话使用 cursor 实现一个移除图片的工具站',url:'/d/353e71556a045c77606a5675435e676a291b1b3e',},{title:'ai 编程怎么选工具',url:'/d/1c0f56016a045c77606a5675435f646a2916603d',},{title:'发现一个有意思的项目,把一个字符串隐藏到另一个字符串中',url:'/d/3c117a346a045c77606a56754359676a5b323b0b',},{title:'编程小白,终于成功上线了自己的第一个导航站😭 激动',url:'/d/333944256a045c77606a56754451666a3e0e3e67',},{title:'vue 指令更新问题',url:'/d/2f3c4a3e6a045c77606a5675445e636a250e3f24',},{title:'请教 Cursor 降智问题',url:'/d/1f1b65206a045c77606a5675445d656a3e0d6a6b',},{title:'小红书 | 图文,视频,评论 浏览与导出工具',url:'/d/1b1806556a045c77606a56754458676a04343b26',},{title:'[BadouCMS] Vue3+TypeScript+ThinkPHP8 构建 CMS 系统(开源)',url:'/d/303350036a045c77606a56754458626a20390564',},{title:'Cursor 的 500 次用完是重新搞个号注册 Pro 还是用 Api 的?',url:'/d/3c38432e6a045c77606a56754550616a36313821',},],} 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")