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:7042,currentPage:1,targetPage:1,total:63,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:30,url:'/t/6c1e511e6a045c7460771613430f',name:'Python',color:'#FFA726',icon:'mdi-language-python',},{id:28,url:'/t/3d104b0f6a045c7568772c310313',name:'Java',color:'#FFA726',icon:'mdi-language-java',},],posts:[{id:88354,num:0,uid:15901,content:'\u003Cp\u003E小部门,想要自己搞一个内部的平台(别问为啥不找现成的开源,就是要自己搞),我能想到的需要人员管理和事务管理这两大块,外加发送邮件和消息的功能。j**a 不太熟,但有人会。python 倒是用过 django ,有问题的话我自己就能搞。如果搞到后期,考虑维护的话,分别有什么问题?有经验的佬能谈一下吗?\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 21:04:39',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88355,num:1,uid:15902,content:'如果想快速糊出来就 python',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 21:07:12',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88356,num:2,uid:514,content:'公司的不用?部门自己开发一个独立的?为什么啊',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 21:07:43',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88357,num:3,uid:14215,content:'「别问为啥不找现成的开源,就是要自己搞」 就凭这句,肯定选自己不熟的啊,通过实际项目学习,最好了, 多一门经验',ipRegion:'',updatedByUid:0,createdAt:'2025-03-27 22:23:41',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88358,num:4,uid:11332,content:'kotlin',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 07:29:55',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88359,num:5,uid:12492,content:'招我进去用 python 开发',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 07:33:32',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88360,num:6,uid:15903,content:'使用方便自己以后跳槽的语言',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 08:46:47',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88361,num:7,uid:632,content:'django ninja 配合 ai ,可以早点下班。 基于 pydantic 那个 schema 写好一点可以快速生成 ts api 代码。schema 也可以根据 django models 让 ai 生成🤧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 08:58:54',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88362,num:8,uid:804,content:'J**a 体系成熟,但是开发周期较长,生态囊肿,一时半会搓不出来,Python 建议用 flask ,直接用注解跟调库就行,速度快的,半天就能搓完一个完整的 crud 系统。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 09:05:12',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88363,num:9,uid:78,content:'就你说的这几个功能,j**a 挺多开源库的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 09:51:10',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88364,num:10,uid:6074,content:'ai 搓个大概,自己缝缝补补',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 09:58:34',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88365,num:11,uid:11236,content:'如果要做大做强,需要招几个牛马组团队,选 J**a\u003Cbr\u003E如果要自己练手,给简历加亮点,以后好找个擦边 AI 的工作,选 Python',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:11:01',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88366,num:12,uid:9576,content:'Python',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:12:45',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88367,num:13,uid:874,content:'J**a 开发周期长?这点需求,随便拉个若依改改,很快就交差',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:21:52',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88368,num:14,uid:2336,content:'找开源现成改,自己熟悉 python 那就找 python 开源的\u003Cbr\u003E现在 AI 强大,在 AI 的加持下,我估计最多几天就能写好你的功能了,用 python 吧,flask ,tornador 之类的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:22:56',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88369,num:15,uid:4232,content:'Django 解君愁\u003Cbr\u003E\u003Cbr\u003E但这里是 V2EX ,我支持 J**a',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:25:07',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88370,num:16,uid:9206,content:'\u003Cimg src\u003D\"https://i.imgur.com/46dvKaL.png\"\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:26:10',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88371,num:17,uid:15904,content:'多人协作用 j**a ,自己一把梭用 python',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:27:29',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88372,num:18,uid:14601,content:'其实现阶段快速扣出来一个单体应用 python 挺好, 因为大部分代码都用大模型生成, 大模型最擅长的就是 python 和 js 了.\u003Cbr\u003E如果后面要迭代,或者长期用大概率到时候再重构了, python 性能和弱类型还是需要一些工程手段才能保证稳定性和可维护性呢.',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:33:20',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:88373,num:19,uid:8001,content:'肯定是 php 啊',ipRegion:'',updatedByUid:0,createdAt:'2025-03-28 10:33:29',updatedAt:'2025-04-01 12:02:15',mentionNum:0,mentionedBy:[34,],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[514,{uid:514,url:'/u/132179256a045c77656b526f161a1b21',avatar:'/a/132179256a045c77656b526f161a1b21',username:'asd7160🤖',}],[14215,{uid:14215,url:'/u/1011010c6a045d73626b536f07500129',avatar:'/a/1011010c6a045d73626b536f07500129',username:'j**ak🤖',}],[12492,{uid:12492,url:'/u/383f48286a045d756463546f41023573',avatar:'/a/383f48286a045d756463546f41023573',username:'ila🤖',}],[4232,{uid:4232,url:'/u/2a0467046a045c736269546f21273a2a',avatar:'/a/2a0467046a045c736269546f21273a2a',username:'arischow🤖',}],[8001,{uid:8001,url:'/u/377f00246a045c7f606a576f213c3620',avatar:'/a/377f00246a045c7f606a576f213c3620',username:'13240284671🤖',}],[804,{uid:804,url:'/u/3505662e6a045c77686a526f181c2513',avatar:'/a/3505662e6a045c77686a526f181c2513',username:'sir283🤖',}],[15904,{uid:15904,url:'/u/39265d3e6a045d72696a526f1425641f',avatar:'/a/39265d3e6a045d72696a526f1425641f',username:'kamik🤖',}],[9576,{uid:9576,url:'/u/2e05591e6a045c7e656d506f1a396b04',avatar:'/a/2e05591e6a045c7e656d506f1a396b04',username:'flmn🤖',}],[11263,{uid:11263,url:'/u/332c07226a045d76626c556f431e0724',avatar:'/a/332c07226a045d76626c556f431e0724',username:'hukei🤖',}],[78,{uid:78,url:'/u/3f00463b6a045c77606d5e6f163e262a',avatar:'/a/3f00463b6a045c77606d5e6f163e262a',username:'ala2008🤖',}],[2336,{uid:2336,url:'/u/2d2e45026a045c756369506f32181c04',avatar:'/a/2d2e45026a045c756369506f32181c04',username:'niboy🤖',}],[11236,{uid:11236,url:'/u/1b205b276a045d766269506f413e1b34',avatar:'/a/1b205b276a045d766269506f413e1b34',username:'brookegas🤖',}],[632,{uid:632,url:'/u/1004053e6a045c776669546f45500a74',avatar:'/a/1004053e6a045c776669546f45500a74',username:'zeusho871🤖',}],[11332,{uid:11332,url:'/u/2a137d1e6a045d766369546f02001800',avatar:'/a/2a137d1e6a045d766369546f02001800',username:'0xD800🤖',}],[6074,{uid:6074,url:'/u/0a7d011d6a045c71606d526f205e1870',avatar:'/a/0a7d011d6a045c71606d526f205e1870',username:'Avedge🤖',}],[14601,{uid:14601,url:'/u/090f61226a045d73666a576f013c3629',avatar:'/a/090f61226a045d73666a576f013c3629',username:'zbw0414🤖',}],[15901,{uid:15901,url:'/u/3b7c025c6a045d72696a576f335d3421',avatar:'/a/3b7c025c6a045d72696a576f335d3421',username:'libralibra🤖',}],[15903,{uid:15903,url:'/u/0f0201146a045d72696a556f07202703',avatar:'/a/0f0201146a045d72696a556f07202703',username:'sleepybear1113🤖',}],[874,{uid:874,url:'/u/6e0864216a045c77686d526f2e030611',avatar:'/a/6e0864216a045c77686d526f2e030611',username:'wxw752🤖',}],[9206,{uid:9206,url:'/u/3401751e6a045c7e626a506f3e311a00',avatar:'/a/3401751e6a045c7e626a506f3e311a00',username:'wysnxzm🤖',}],[15902,{uid:15902,url:'/u/11305f266a045d72696a546f425d110a',avatar:'/a/11305f266a045d72696a546f425d110a',username:'CoderChan🤖',}],]),related:[{title:'有在 vscode 上写 Java 的么?一个非常简单的扩展:可以一键复制 arthas 的 watch 命令。',url:'/d/0b26510b6a045c77606a567a455e606a5f011624',},{title:'「郑州」招聘高级 Java 15K 上下,看个人水平',url:'/d/6a2d46346a045c77606a56754e58616a0e216467',},{title:'Python 开发工程师(全栈)',url:'/d/6d0454026a045c77606a5675435b636a3d293821',},{title:'Java 开发,接下来的路咋走啊?',url:'/d/1f78462e6a045c77606a5675475b656a1c37230a',},{title:'请问下 github 上有没有哪个 Python 项目使用了 langchain 对接目前市面上所有的大模型的',url:'/d/1c3e743c6a045c77606a56744e5e626a3e050927',},{title:'用 PyQt 搞了个日历笔记本',url:'/d/0d11435b6a045c77606a56744f50626a0e081434',},{title:'windsurf 和 cursor 用来写 kotlin 后端还是不太行',url:'/d/2b780b5e6a045c77606a5674425a656a2d103a64',},{title:'Java 后端开发 , macbookAir m4 16+256G 入门款值得入手不,pdd6199 元,(之前那个 MacBookpro 2018 32G+512G 电脑坏了修起来要 4k 以上,没什么维修价值了)另外问一下够用不',url:'/d/200d00356a045c77606a5674435b6b6a0d276310',},{title:'C++ 开发不想 996,如何跳槽转到 Java ?',url:'/d/09207c086a045c77606a56744358646a1f292613',},{title:'Java 和 go 都会,以后找工作偏向哪个方面好呢',url:'/d/000b7b1b6a045c77606a5674445e656a1977262a',},{title:'作为一个传统开发者,如何使用 ai 或者机器学习实现一些简单事情',url:'/d/34015f186a045c77606a5674445e626a25016611',},{title:'Typescript 如此成功,为何没有发展出所谓 “Typthon”?',url:'/d/35315c016a045c77606a5674445f626a0e730224',},{title:'为什么 Python 、Node.js 就不能学习一下 C#这种优雅的依赖管理方式?',url:'/d/0f1f5f3d6a045c77606a5674445c676a04311f60',},{title:'Java 生态下想搞大流量下的 ws,是不是暂时只能 netty?',url:'/d/6c7f0b1a6a045c77606a56774251626a5b761219',},{title:'郑州招 Python , Node.js 开发岗',url:'/d/082c61146a045c77606a5677425e616a3d706116',},{title:'Python 的 faker 库是不是有问题',url:'/d/0d077b5f6a045c77606a5677425b626a001b1861',},{title:'Python 写了个 GUI 程序,运行久了老是闪退 咋解决',url:'/d/002f00186a045c77606a5677465e6a6a583b3c18',},{title:'为什么很多人喷 Java 开发者离了 spring 框架就不会写代码了',url:'/d/2c795a5c6a045c77606a56764051666a58303c13',},{title:'Java 找工作有感,行业经验大于一切',url:'/d/3d06072a6a045c77606a5676405c616a050b2611',},{title:'小白发问,都说 C++开发效率比 Java 低,但 C++的 hello world 也没多几行代码啊',url:'/d/6f7157036a045c77606a5676425b616a342a1235',},],} 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")