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:1536,currentPage:1,targetPage:1,total:57,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',},],posts:[{id:18229,num:0,uid:5871,content:'研究生选课选了 Python ,老师让 5 、6 个人一组,一起做一个小项目。组里大部分都不是科班,以前没接触过编程。现在选题还没想好,其他组做爬虫、CRUD 的管理系统的有点多,怎么做才有点新意呢?\u003Cbr\u003E\u003Cbr\u003E大家帮忙想一想,先行谢过。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:43:29',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18230,num:1,uid:2311,content:'做个图床吧:服务器后端,图像分析和数据,数据库管理,后台登录与用户逻辑,随机页和推荐系统。吹的时候,就说这是影视系统的基石,什么油管 B 站,都是这个系统的复杂版本,看起来就足够糊弄人就行了。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:51:07',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18231,num:2,uid:4615,content:'小游戏加 Ai 有没有搞头,我推荐你一本书 https://github.com/xccds/Python_AI_Game ,里面的 demo 都是可以直接运行的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:51:47',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18232,num:3,uid:5872,content:'做量化分析吧,抓取数据、分析数据、数据处理、回测等功能',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:52:56',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18233,num:4,uid:3909,content:'非科班选修课,CRUD 管理系统、简单的 scrapy 项目或者 AI 能一次写完不出 bug 的贪吃蛇之类的小游戏就是最优解,太复杂的项目给你们调试会崩溃的',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:54:22',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18234,num:5,uid:319,content:'做个 CRUD+AI 的,接一下大模型的 api ,或者自己部署。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:55:51',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18235,num:6,uid:2949,content:'CRUD ,接入 AI ,确实是不错的思路。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 10:58:52',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18236,num:7,uid:5871,content:'这个思路很有启发性,完整做下来应该比较有搞头。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:02:04',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18237,num:8,uid:5871,content:'多谢朋友,我们研究一下这本书。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:02:48',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18238,num:9,uid:5871,content:'数据分析也是一个不错的方向,就是量化之前没怎么接触过呀。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:03:26',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18239,num:10,uid:2692,content:'就做爬虫吧,照顾照顾同组组员感受,会这东西对他们还有点用,你会就你就多搞点,比如再后端接个大模型自动摘要爬过来的内容,再弄个全文检索,再套个管理端控制台,再搞个驾驶舱\u003Cbr\u003E\u003Cbr\u003E要是都做了,90 分肯定有',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:04:37',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18240,num:11,uid:5873,content:'看看你主业有没有什么 api ,sdk 之类的工具,用 Python 实现一些对主业有帮助的小工具',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:06:08',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18241,num:12,uid:5871,content:'是的,不敢太复杂。现在就想完成作业的基础上弄个稍微新颖那么一点的 哈哈',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:06:55',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18242,num:13,uid:85,content:'肯定要搞 AI 啊,接个大模型的 API ,然后做点啥',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:08:54',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18243,num:14,uid:261,content:'NES emulator',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:09:55',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18244,num:15,uid:5871,content:'确实,爬虫大家会比较有兴趣一些,以后也能用得上。建议很棒啊。\u003Cbr\u003E我们确实也想加上 AI ,听起来高大上一些。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:12:22',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18245,num:16,uid:5874,content:'可以试一下用我们的项目 https://github.com/moxin-org/mofa',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:14:29',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18246,num:17,uid:5875,content:'看一下 fly pieter 这个游戏,levelsio 用 AI 写的,感觉可以做一个类似的游戏',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:18:09',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18247,num:18,uid:5876,content:'好奇你们的主专业是什么?可以结合自身研究方向写写',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:19:38',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:18248,num:19,uid:3667,content:'github 上搜,star 多的 python 项目,clone 下来删删功能不就是自己的了。。xixi',ipRegion:'',updatedByUid:0,createdAt:'2025-03-11 11:28:47',updatedAt:'2025-03-13 14:02:40',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[3667,{uid:3667,url:'/u/3b06760e6a045c74666c516f36593921',avatar:'/a/3b06760e6a045c74666c516f36593921',username:'bluebird2🤖',}],[5874,{uid:5874,url:'/u/0d7c021f6a045c72686d526f1b2b6677',avatar:'/a/0d7c021f6a045c72686d526f1b2b6677',username:'chenzi0103🤖',}],[2949,{uid:2949,url:'/u/3e7b041a6a045c75696e5f6f31216420',avatar:'/a/3e7b041a6a045c75696e5f6f31216420',username:'sn0wdr1am🤖',}],[2311,{uid:2311,url:'/u/630a00076a045c75636b576f1f221631',avatar:'/a/630a00076a045c75636b576f1f221631',username:'imes🤖',}],[85,{uid:85,url:'/u/200b7e0c6a045c776062536f4f1f350d',avatar:'/a/200b7e0c6a045c776062536f4f1f350d',username:'loryyang🤖',}],[319,{uid:319,url:'/u/231b05276a045c77636b5f6f052e120f',avatar:'/a/231b05276a045c77636b5f6f052e120f',username:'YJi🤖',}],[3909,{uid:3909,url:'/u/2b197b266a045c74696a5f6f23333230',avatar:'/a/2b197b266a045c74696a5f6f23333230',username:'ilyyfan🤖',}],[5871,{uid:5871,url:'/u/2828403f6a045c72686d576f441e190c',avatar:'/a/2828403f6a045c72686d576f441e190c',username:'lawrencelee🤖',}],[4615,{uid:4615,url:'/u/3505462c6a045c73666b536f3d013e73',avatar:'/a/3505462c6a045c73666b536f3d013e73',username:'linxb🤖',}],[5876,{uid:5876,url:'/u/280751396a045c72686d506f1b3b2a72',avatar:'/a/280751396a045c72686d506f1b3b2a72',username:'kevinpendragon🤖',}],[261,{uid:261,url:'/u/1002703a6a045c77626c576f395e6a16',avatar:'/a/1002703a6a045c77626c576f395e6a16',username:'levelworm🤖',}],[2692,{uid:2692,url:'/u/3b08643e6a045c756663546f2d200672',avatar:'/a/3b08643e6a045c756663546f2d200672',username:'kinkin666🤖',}],[5875,{uid:5875,url:'/u/0c0b7e1a6a045c72686d536f3f2e2b03',avatar:'/a/0c0b7e1a6a045c72686d536f3f2e2b03',username:'Wien🤖',}],[5873,{uid:5873,url:'/u/6e0870556a045c72686d556f4f081e2d',avatar:'/a/6e0870556a045c72686d556f4f081e2d',username:'yyttrr🤖',}],[5872,{uid:5872,url:'/u/291361396a045c72686d546f00390420',avatar:'/a/291361396a045c72686d546f00390420',username:'picone🤖',}],]),related:[{title:'Python 开发工程师(全栈)',url:'/d/6d0454026a045c77606a5675435b636a3d293821',},{title:'技术栈选择: Java 还是 Python',url:'/d/2878683b6a045c77606a5675475d616a083a1603',},{title:'请问下 github 上有没有哪个 Python 项目使用了 langchain 对接目前市面上所有的大模型的',url:'/d/1c3e743c6a045c77606a56744e5e626a3e050927',},{title:'用 PyQt 搞了个日历笔记本',url:'/d/0d11435b6a045c77606a56744f50626a0e081434',},{title:'Typescript 如此成功,为何没有发展出所谓 “Typthon”?',url:'/d/35315c016a045c77606a5674445f626a0e730224',},{title:'为什么 Python 、Node.js 就不能学习一下 C#这种优雅的依赖管理方式?',url:'/d/0f1f5f3d6a045c77606a5674445c676a04311f60',},{title:'郑州招 Python , Node.js 开发岗',url:'/d/082c61146a045c77606a5677425e616a3d706116',},{title:'Python 的 faker 库是不是有问题',url:'/d/0d077b5f6a045c77606a5677425b626a001b1861',},{title:'Python 写了个 GUI 程序,运行久了老是闪退 咋解决',url:'/d/002f00186a045c77606a5677465e6a6a583b3c18',},{title:'今天自己写了个监测医院挂号剩余数量的python脚本',url:'/d/1d3379236a045c77606a5676455f656a1f310037',},{title:'Python自学,有没有什么推荐的学习网站,资料,项目?',url:'/d/373f57266a045c77606a5676455f626a190c1137',},{title:'[北京/上海] 百亿量化公司 C++/ Python /算法/训练/高性能/效能专家',url:'/d/113b00286a045c77606a56714059666a03323803',},{title:'如何在 jupyter notebook 里安装 binance 模块?有没有会 Python 的大神来指点下?',url:'/d/0e2c78186a045c77606a56714358646a54021634',},{title:'这是什么 jupyter 插件,感觉挺酷',url:'/d/683e7a296a045c77606a56704358626a2570262b',},{title:'帧转视频有哪些最快的方案?',url:'/d/627b665f6a045c77606a56704751636a0a311f3d',},{title:'用 AI 写爬虫,做了个爬取个人社交平台内容并分析的工具',url:'/d/1601671e6a045c77606a56724f59636a0a101739',},],} 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")