这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
2020-2021:teams:namespace:小型代码管理系统的实现方式 [2020/07/28 21:15] great_designer 创建 |
2020-2021:teams:namespace:小型代码管理系统的实现方式 [2020/08/12 16:59] (当前版本) great_designer |
||
---|---|---|---|
行 1: | 行 1: | ||
======小型代码管理系统的实现方式====== | ======小型代码管理系统的实现方式====== | ||
+ | |||
+ | 这个玩意超好用!尤其是小学期的时候疯狂代码开发之后呢! | ||
灵感来源于多校第五场的K题。同样是大作业一样的题目,与之前不同的是,本次的题目有标程。 | 灵感来源于多校第五场的K题。同样是大作业一样的题目,与之前不同的是,本次的题目有标程。 | ||
=====题目===== | =====题目===== | ||
+ | |||
+ | 题意:合并一些代码,使代码长度最短,输出方案。 | ||
与其他人一起编写代码有时意味着浪费时间——至少你会花很多时间来合并不同的分支并测试它们是否存在潜在的bug。有时,git标记的区别只是不同的编码风格! | 与其他人一起编写代码有时意味着浪费时间——至少你会花很多时间来合并不同的分支并测试它们是否存在潜在的bug。有时,git标记的区别只是不同的编码风格! | ||
行 206: | 行 210: | ||
请注意,如果在Windows上运行测试,则在使用getline()时必须注意到“\r”问题。测试数据将不包含任何'\r'。 | 请注意,如果在Windows上运行测试,则在使用getline()时必须注意到“\r”问题。测试数据将不包含任何'\r'。 | ||
+ | =====做法===== | ||
+ | 大模拟。 | ||
+ | 先预处理出两个文件,然后 dp[i][j][0/1/2] 表示第一个文件第 i 行,第二个文件第 j 行,在公用/ifdef 1/ifdef 2 内,切换有代价 1,dp n m 0 是答案。dp 可以存在 short 里。 | ||
+ | |||
+ | =====通关代码===== | ||
+ | |||
+ | 只使用了C语言。 | ||
+ | |||
+ | <hidden> | ||
+ | <code C> | ||
+ | |||
+ | #include<stdio.h> | ||
+ | #include<string.h> | ||
+ | |||
+ | const char op1[]="<<<<<<< branch1"; | ||
+ | const char op2[]="======="; | ||
+ | const char op3[]=">>>>>>> branch2"; | ||
+ | |||
+ | struct pp | ||
+ | { | ||
+ | int first; | ||
+ | int second; | ||
+ | }; | ||
+ | |||
+ | struct pp makepp(int a,int b) | ||
+ | { | ||
+ | struct pp temp; | ||
+ | temp.first=a; | ||
+ | temp.second=b; | ||
+ | return temp; | ||
+ | } | ||
+ | |||
+ | struct pp op1hash,op2hash,op3hash; | ||
+ | |||
+ | char s1[4007][267],s2[4007][267]; | ||
+ | int len1[4007],len2[4007]; | ||
+ | char s[267]; | ||
+ | int n1=0,n2=0; | ||
+ | |||
+ | struct pp hash1[4007],hash2[4007]; | ||
+ | |||
+ | short f[4007][4007][3],g[4007][4007][3]; | ||
+ | |||
+ | struct qq | ||
+ | { | ||
+ | struct pp first; | ||
+ | int second; | ||
+ | }; | ||
+ | |||
+ | struct qq makeqq(struct pp a,int b) | ||
+ | { | ||
+ | struct qq temp; | ||
+ | temp.first=a; | ||
+ | temp.second=b; | ||
+ | return temp; | ||
+ | } | ||
+ | |||
+ | struct qq que[4007]; | ||
+ | |||
+ | int cnt=0; | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | op1hash=makepp(0,0); | ||
+ | int i; | ||
+ | for(i=0;i<strlen(op1);i++) | ||
+ | { | ||
+ | op1hash.first=(1LL*307*op1hash.first+op1[i]+1)%998244353; | ||
+ | op1hash.second=(1LL*307*op1hash.second+op1[i]+1)%100000007; | ||
+ | } | ||
+ | op2hash=makepp(0,0); | ||
+ | for(i=0;i<strlen(op2);i++) | ||
+ | { | ||
+ | op2hash.first=(1LL*307*op2hash.first+op2[i]+1)%998244353; | ||
+ | op2hash.second=(1LL*307*op2hash.second+op2[i]+1)%100000007; | ||
+ | } | ||
+ | op3hash=makepp(0,0); | ||
+ | for(i=0;i<strlen(op3);i++) | ||
+ | { | ||
+ | op3hash.first=(1LL*307*op3hash.first+op3[i]+1)%998244353; | ||
+ | op3hash.second=(1LL*307*op3hash.second+op3[i]+1)%100000007; | ||
+ | } | ||
+ | int curstatus=0; | ||
+ | char ch=getchar(); | ||
+ | while(ch!=EOF) | ||
+ | { | ||
+ | int len=0; | ||
+ | while(ch!='\n'&&ch!=EOF) | ||
+ | { | ||
+ | s[len++]=ch; | ||
+ | ch=getchar(); | ||
+ | } | ||
+ | struct pp h=makepp(0,0); | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | h.first=(1LL*307*h.first+s[i]+1)%998244353; | ||
+ | h.second=(1LL*307*h.second+s[i]+1)%100000007; | ||
+ | } | ||
+ | if(h.first==op1hash.first&&h.second==op1hash.second) | ||
+ | { | ||
+ | curstatus=1; | ||
+ | } | ||
+ | else if(h.first==op2hash.first&&h.second==op2hash.second) | ||
+ | { | ||
+ | curstatus=2; | ||
+ | } | ||
+ | else if(h.first==op3hash.first&&h.second==op3hash.second) | ||
+ | { | ||
+ | curstatus=0; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(curstatus!=1) | ||
+ | { | ||
+ | len2[++n2]=len; | ||
+ | hash2[n2]=h; | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | s2[n2][i]=s[i]; | ||
+ | } | ||
+ | } | ||
+ | if(curstatus!=2) | ||
+ | { | ||
+ | len1[++n1]=len; | ||
+ | hash1[n1]=h; | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | s1[n1][i]=s[i]; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if(ch!=EOF) | ||
+ | { | ||
+ | ch=getchar(); | ||
+ | } | ||
+ | } | ||
+ | for(i=0;i<=n1;i++) | ||
+ | { | ||
+ | int j; | ||
+ | for(j=0;j<=n2;j++) | ||
+ | { | ||
+ | int k; | ||
+ | for(k=0;k<3;k++) | ||
+ | { | ||
+ | f[i][j][k]=10007; | ||
+ | g[i][j][k]=0; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | f[0][0][0]=0; | ||
+ | f[0][0][1]=1; | ||
+ | g[0][0][1]=0; | ||
+ | f[0][0][2]=1; | ||
+ | g[0][0][2]=0; | ||
+ | for(i=0;i<=n1;i++) | ||
+ | { | ||
+ | int j; | ||
+ | for(j=0;j<=n2;j++) | ||
+ | { | ||
+ | if(i==0&&j==0) | ||
+ | { | ||
+ | continue; | ||
+ | } | ||
+ | if(i>0) | ||
+ | { | ||
+ | if(f[i][j][1]>f[i-1][j][1]+1) | ||
+ | { | ||
+ | f[i][j][1]=f[i-1][j][1]+1; | ||
+ | g[i][j][1]=-1; | ||
+ | } | ||
+ | } | ||
+ | if(j>0) | ||
+ | { | ||
+ | if(f[i][j][2]>f[i][j-1][2]+1) | ||
+ | { | ||
+ | f[i][j][2]=f[i][j-1][2]+1; | ||
+ | g[i][j][2]=-1; | ||
+ | } | ||
+ | } | ||
+ | if(i>0&&j>0&&hash1[i].first==hash2[j].first&&hash1[i].second==hash2[j].second) | ||
+ | { | ||
+ | if(f[i][j][0]>f[i-1][j-1][0]+1) | ||
+ | { | ||
+ | f[i][j][0]=f[i-1][j-1][0]+1; | ||
+ | g[i][j][0]=-1; | ||
+ | } | ||
+ | } | ||
+ | int k1; | ||
+ | for(k1=0;k1<3;k1++) | ||
+ | { | ||
+ | int k2; | ||
+ | for(k2=0;k2<3;k2++) | ||
+ | { | ||
+ | if(f[i][j][k1]>f[i][j][k2]+1) | ||
+ | { | ||
+ | f[i][j][k1]=f[i][j][k2]+1; | ||
+ | g[i][j][k1]=k2; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | que[++cnt]=makeqq(makepp(n1,n2),0); | ||
+ | while(que[cnt].first.first!=0||que[cnt].first.second!=0||que[cnt].second!=0) | ||
+ | { | ||
+ | int x=que[cnt].first.first; | ||
+ | int y=que[cnt].first.second; | ||
+ | int k=que[cnt].second; | ||
+ | if(g[x][y][k]!=-1) | ||
+ | { | ||
+ | k=g[x][y][k]; | ||
+ | } | ||
+ | else if(k==0) | ||
+ | { | ||
+ | --x,--y; | ||
+ | } | ||
+ | else if(k==1) | ||
+ | { | ||
+ | --x; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | --y; | ||
+ | } | ||
+ | que[++cnt]=makeqq(makepp(x,y),k); | ||
+ | } | ||
+ | for(i=cnt-1;i;i--) | ||
+ | { | ||
+ | int x=que[i].first.first; | ||
+ | int y=que[i].first.second; | ||
+ | int k=que[i].second; | ||
+ | if(g[x][y][k]!=-1) | ||
+ | { | ||
+ | if(g[x][y][k]==0) | ||
+ | { | ||
+ | if(k==1) | ||
+ | { | ||
+ | printf("#ifdef branch1\n"); | ||
+ | } | ||
+ | else if(k==2) | ||
+ | { | ||
+ | printf("#ifdef branch2\n"); | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(k==0) | ||
+ | { | ||
+ | printf("#endif\n"); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | printf("#else\n"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(k==1) | ||
+ | { | ||
+ | int ii; | ||
+ | for(ii=0;ii<len1[x];ii++) | ||
+ | { | ||
+ | printf("%c",s1[x][ii]); | ||
+ | } | ||
+ | printf("\n"); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | int ii; | ||
+ | for(ii=0;ii<len2[y];ii++) | ||
+ | { | ||
+ | printf("%c",s2[y][ii]); | ||
+ | } | ||
+ | printf("\n"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </code> | ||
+ | </hidden> | ||
+ | |||
+ | =====文件处理时的代码===== | ||
+ | |||
+ | 以Home.vue文件为例: | ||
+ | |||
+ | <hidden> | ||
+ | <code C> | ||
+ | |||
+ | #include<stdio.h> | ||
+ | #include<string.h> | ||
+ | |||
+ | const char op1[]="<<<<<<< branch1"; | ||
+ | const char op2[]="======="; | ||
+ | const char op3[]=">>>>>>> branch2"; | ||
+ | |||
+ | struct pp | ||
+ | { | ||
+ | int first; | ||
+ | int second; | ||
+ | }; | ||
+ | |||
+ | struct pp makepp(int a,int b) | ||
+ | { | ||
+ | struct pp temp; | ||
+ | temp.first=a; | ||
+ | temp.second=b; | ||
+ | return temp; | ||
+ | } | ||
+ | |||
+ | struct pp op1hash,op2hash,op3hash; | ||
+ | |||
+ | char s1[4007][267],s2[4007][267]; | ||
+ | int len1[4007],len2[4007]; | ||
+ | char s[267]; | ||
+ | int n1=0,n2=0; | ||
+ | |||
+ | struct pp hash1[4007],hash2[4007]; | ||
+ | |||
+ | short f[4007][4007][3],g[4007][4007][3]; | ||
+ | |||
+ | struct qq | ||
+ | { | ||
+ | struct pp first; | ||
+ | int second; | ||
+ | }; | ||
+ | |||
+ | struct qq makeqq(struct pp a,int b) | ||
+ | { | ||
+ | struct qq temp; | ||
+ | temp.first=a; | ||
+ | temp.second=b; | ||
+ | return temp; | ||
+ | } | ||
+ | |||
+ | struct qq que[4007]; | ||
+ | |||
+ | int cnt=0; | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | FILE* f1; | ||
+ | FILE* f2; | ||
+ | f1=fopen("Home.vue","r"); | ||
+ | f2=fopen("out.txt","w"); | ||
+ | op1hash=makepp(0,0); | ||
+ | int i; | ||
+ | for(i=0;i<strlen(op1);i++) | ||
+ | { | ||
+ | op1hash.first=(1LL*307*op1hash.first+op1[i]+1)%998244353; | ||
+ | op1hash.second=(1LL*307*op1hash.second+op1[i]+1)%100000007; | ||
+ | } | ||
+ | op2hash=makepp(0,0); | ||
+ | for(i=0;i<strlen(op2);i++) | ||
+ | { | ||
+ | op2hash.first=(1LL*307*op2hash.first+op2[i]+1)%998244353; | ||
+ | op2hash.second=(1LL*307*op2hash.second+op2[i]+1)%100000007; | ||
+ | } | ||
+ | op3hash=makepp(0,0); | ||
+ | for(i=0;i<strlen(op3);i++) | ||
+ | { | ||
+ | op3hash.first=(1LL*307*op3hash.first+op3[i]+1)%998244353; | ||
+ | op3hash.second=(1LL*307*op3hash.second+op3[i]+1)%100000007; | ||
+ | } | ||
+ | int curstatus=0; | ||
+ | char ch=fgetc(f1); | ||
+ | while(ch!=EOF) | ||
+ | { | ||
+ | int len=0; | ||
+ | while(ch!='\n'&&ch!=EOF) | ||
+ | { | ||
+ | s[len++]=ch; | ||
+ | ch=fgetc(f1); | ||
+ | } | ||
+ | struct pp h=makepp(0,0); | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | h.first=(1LL*307*h.first+s[i]+1)%998244353; | ||
+ | h.second=(1LL*307*h.second+s[i]+1)%100000007; | ||
+ | } | ||
+ | if(h.first==op1hash.first&&h.second==op1hash.second) | ||
+ | { | ||
+ | curstatus=1; | ||
+ | } | ||
+ | else if(h.first==op2hash.first&&h.second==op2hash.second) | ||
+ | { | ||
+ | curstatus=2; | ||
+ | } | ||
+ | else if(h.first==op3hash.first&&h.second==op3hash.second) | ||
+ | { | ||
+ | curstatus=0; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(curstatus!=1) | ||
+ | { | ||
+ | len2[++n2]=len; | ||
+ | hash2[n2]=h; | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | s2[n2][i]=s[i]; | ||
+ | } | ||
+ | } | ||
+ | if(curstatus!=2) | ||
+ | { | ||
+ | len1[++n1]=len; | ||
+ | hash1[n1]=h; | ||
+ | for(i=0;i<len;i++) | ||
+ | { | ||
+ | s1[n1][i]=s[i]; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if(ch!=EOF) | ||
+ | { | ||
+ | ch=fgetc(f1); | ||
+ | } | ||
+ | } | ||
+ | for(i=0;i<=n1;i++) | ||
+ | { | ||
+ | int j; | ||
+ | for(j=0;j<=n2;j++) | ||
+ | { | ||
+ | int k; | ||
+ | for(k=0;k<3;k++) | ||
+ | { | ||
+ | f[i][j][k]=10007; | ||
+ | g[i][j][k]=0; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | f[0][0][0]=0; | ||
+ | f[0][0][1]=1; | ||
+ | g[0][0][1]=0; | ||
+ | f[0][0][2]=1; | ||
+ | g[0][0][2]=0; | ||
+ | for(i=0;i<=n1;i++) | ||
+ | { | ||
+ | int j; | ||
+ | for(j=0;j<=n2;j++) | ||
+ | { | ||
+ | if(i==0&&j==0) | ||
+ | { | ||
+ | continue; | ||
+ | } | ||
+ | if(i>0) | ||
+ | { | ||
+ | if(f[i][j][1]>f[i-1][j][1]+1) | ||
+ | { | ||
+ | f[i][j][1]=f[i-1][j][1]+1; | ||
+ | g[i][j][1]=-1; | ||
+ | } | ||
+ | } | ||
+ | if(j>0) | ||
+ | { | ||
+ | if(f[i][j][2]>f[i][j-1][2]+1) | ||
+ | { | ||
+ | f[i][j][2]=f[i][j-1][2]+1; | ||
+ | g[i][j][2]=-1; | ||
+ | } | ||
+ | } | ||
+ | if(i>0&&j>0&&hash1[i].first==hash2[j].first&&hash1[i].second==hash2[j].second) | ||
+ | { | ||
+ | if(f[i][j][0]>f[i-1][j-1][0]+1) | ||
+ | { | ||
+ | f[i][j][0]=f[i-1][j-1][0]+1; | ||
+ | g[i][j][0]=-1; | ||
+ | } | ||
+ | } | ||
+ | int k1; | ||
+ | for(k1=0;k1<3;k1++) | ||
+ | { | ||
+ | int k2; | ||
+ | for(k2=0;k2<3;k2++) | ||
+ | { | ||
+ | if(f[i][j][k1]>f[i][j][k2]+1) | ||
+ | { | ||
+ | f[i][j][k1]=f[i][j][k2]+1; | ||
+ | g[i][j][k1]=k2; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | que[++cnt]=makeqq(makepp(n1,n2),0); | ||
+ | while(que[cnt].first.first!=0||que[cnt].first.second!=0||que[cnt].second!=0) | ||
+ | { | ||
+ | int x=que[cnt].first.first; | ||
+ | int y=que[cnt].first.second; | ||
+ | int k=que[cnt].second; | ||
+ | if(g[x][y][k]!=-1) | ||
+ | { | ||
+ | k=g[x][y][k]; | ||
+ | } | ||
+ | else if(k==0) | ||
+ | { | ||
+ | --x,--y; | ||
+ | } | ||
+ | else if(k==1) | ||
+ | { | ||
+ | --x; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | --y; | ||
+ | } | ||
+ | que[++cnt]=makeqq(makepp(x,y),k); | ||
+ | } | ||
+ | for(i=cnt-1;i;i--) | ||
+ | { | ||
+ | int x=que[i].first.first; | ||
+ | int y=que[i].first.second; | ||
+ | int k=que[i].second; | ||
+ | if(g[x][y][k]!=-1) | ||
+ | { | ||
+ | if(g[x][y][k]==0) | ||
+ | { | ||
+ | if(k==1) | ||
+ | { | ||
+ | fprintf(f2,"#ifdef branch1\n"); | ||
+ | } | ||
+ | else if(k==2) | ||
+ | { | ||
+ | fprintf(f2,"#ifdef branch2\n"); | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(k==0) | ||
+ | { | ||
+ | fprintf(f2,"#endif\n"); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | fprintf(f2,"#else\n"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | if(k==1) | ||
+ | { | ||
+ | int ii; | ||
+ | for(ii=0;ii<len1[x];ii++) | ||
+ | { | ||
+ | fprintf(f2,"%c",s1[x][ii]); | ||
+ | } | ||
+ | fprintf(f2,"\n"); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | int ii; | ||
+ | for(ii=0;ii<len2[y];ii++) | ||
+ | { | ||
+ | fprintf(f2,"%c",s2[y][ii]); | ||
+ | } | ||
+ | fprintf(f2,"\n"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | fclose(f1); | ||
+ | fclose(f2); | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </code> | ||
+ | </hidden> | ||
+ | |||
+ | 处理前: | ||
+ | |||
+ | <hidden> | ||
+ | <code C> | ||
+ | |||
+ | <<<<<<< branch1 | ||
+ | <template> | ||
+ | <div class="home"> | ||
+ | <Navigator return="home" /> | ||
+ | <el-row :span="10"> | ||
+ | <!-- 左侧导航栏 --> | ||
+ | <el-col :span="5"> | ||
+ | <el-menu | ||
+ | default-active="1" | ||
+ | class="el-menu-vertical-demo"> | ||
+ | |||
+ | <el-menu-item index="1" @click="pageflag=1"> | ||
+ | <i class="el-icon-menu"></i> | ||
+ | <span slot="title" v-bind:disabled="isteamspace">工作台</span> | ||
+ | </el-menu-item> | ||
+ | | ||
+ | <el-menu-item index="2" @click="pageflag=2"> | ||
+ | <i class="el-icon-message"></i> | ||
+ | <span slot="title" >收件箱</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-menu-item index="3" @click="pageflag=3"> | ||
+ | <i class="el-icon-delete"></i> | ||
+ | <span slot="title" >回收站</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-submenu index="4"> | ||
+ | <template slot="title"> | ||
+ | <i class="el-icon-s-custom"></i> | ||
+ | <span>团队空间</span> | ||
+ | </template> | ||
+ | <el-menu-item-group> | ||
+ | <el-menu-item @click="toggleModalCreate"> | ||
+ | <template slot="title" > | ||
+ | <i class="el-icon-plus"></i> | ||
+ | <span slot="title" >新建团队</span> | ||
+ | </template> | ||
+ | </el-menu-item> | ||
+ | <el-menu-item @click="toggleModalJoin"> | ||
+ | <i class="el-icon-zoom-in"></i> | ||
+ | <span slot="title" >加入团队</span> | ||
+ | </el-menu-item> | ||
+ | <el-menu-item v-for="item in allteams.data" :key="item.id"> | ||
+ | </el-menu-item> | ||
+ | </el-menu-item-group> | ||
+ | </el-submenu> | ||
+ | |||
+ | </el-menu> | ||
+ | </el-col> | ||
+ | <!-- 右侧内容 --> | ||
+ | <el-col :span="19"> | ||
+ | <!-- 工作台页面 --> | ||
+ | | ||
+ | <div v-if="pageflag==1"> | ||
+ | <!-- 上方分类 --> | ||
+ | <el-row> | ||
+ | <el-menu default-active="1" mode="horizontal"> | ||
+ | <el-menu-item index="1" @click="changesearchkind(1)">最近使用</el-menu-item> | ||
+ | <el-menu-item index="2" @click="changesearchkind(2)">我创建的</el-menu-item> | ||
+ | <el-menu-item index="3" @click="changesearchkind(3)">我的收藏</el-menu-item> | ||
+ | <el-menu-item index="4" style="float:right">新建文档</el-menu-item> | ||
+ | <el-menu-item index="5" style="float:right">按模版新建</el-menu-item> | ||
+ | </el-menu> | ||
+ | </el-row> | ||
+ | <!-- 下方内容 --> | ||
+ | <el-row> | ||
+ | <div class="files" v-for="item in allfiles.data" :key="item.id"> | ||
+ | <div class="afile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | | ||
+ | </el-row> | ||
+ | |||
+ | </div> | ||
+ | <!-- 收件箱页面 --> | ||
+ | <div v-if="pageflag==2"> | ||
+ | hi2 | ||
+ | </div> | ||
+ | <!-- 回收站页面 --> | ||
+ | <div v-if="pageflag==3"> | ||
+ | <el-row> | ||
+ | <div class="deletefiles" v-for="item in alldeleted.data" :key="item.id"> | ||
+ | <div class="deletefile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | </el-row> | ||
+ | </div> | ||
+ | </el-col> | ||
+ | </el-row> | ||
+ | |||
+ | <div v-if="showCreateModal" v-on:closeme="closeme"> | ||
+ | <div class="modal-backdrop"> | ||
+ | <div class="modal" :style="mainStyles"> | ||
+ | <div class="modal-header"> | ||
+ | <h3>新建团队</h3> | ||
+ | </div> | ||
+ | <div class="modal-body"> | ||
+ | <el-form ref="createTeam_form" :model="createTeam_form" :rules="rules" label-width="80px" > | ||
+ | <el-form-item label="团队名称" prop="team_name"> | ||
+ | <el-input | ||
+ | placeholder="team name" | ||
+ | v-model="createTeam_form.team_name" | ||
+ | class="input-with-select" | ||
+ | ></el-input> | ||
+ | </el-form-item> | ||
+ | </el-form> | ||
+ | </div> | ||
+ | <div class="modal-footer"> | ||
+ | <button type="button" class="btn-confirm" @click="submitForm('createTeam_form')">确认</button> | ||
+ | <button type="button" class="btn-close" @click="closemeCreate">关闭</button> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | <div v-if="showJoinModal" v-on:closeme="closeme"> | ||
+ | <div class="modal-backdrop"> | ||
+ | <div class="modal" :style="mainStyles"> | ||
+ | <div class="modal-header"> | ||
+ | <h3>加入团队</h3> | ||
+ | </div> | ||
+ | <div class="modal-body"> | ||
+ | <el-form ref="createTeam_form" :model="createTeam_form" :rules="rules" label-width="80px" > | ||
+ | <el-form-item label="团队名称" prop="team_name"> | ||
+ | <el-input | ||
+ | placeholder="team name" | ||
+ | v-model="createTeam_form.team_name" | ||
+ | class="input-with-select" | ||
+ | ></el-input> | ||
+ | </el-form-item> | ||
+ | </el-form> | ||
+ | </div> | ||
+ | <div class="modal-footer"> | ||
+ | <button type="button" class="btn-confirm" @click="submitForm('createTeam_form')">确认</button> | ||
+ | <button type="button" class="btn-close" @click="closemeJoin">关闭</button> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | </template> | ||
+ | |||
+ | <script> | ||
+ | // @ is an alias to /src | ||
+ | import Navigator from "@/components/Navigator.vue"; | ||
+ | import global from "@/components/global.vue"; | ||
+ | import axios from "axios"; | ||
+ | |||
+ | export default { | ||
+ | name: "Home", | ||
+ | components: { | ||
+ | Navigator, | ||
+ | }, | ||
+ | data() { | ||
+ | return { | ||
+ | userid:0, | ||
+ | searchkind:1, | ||
+ | pageflag:1, | ||
+ | allfiles:{}, | ||
+ | alldeleted:{}, | ||
+ | allteams:{}, | ||
+ | showCreateModal:false, | ||
+ | showJoinModal:false, | ||
+ | createTeam_form:{ | ||
+ | email: "", | ||
+ | team_name:"" | ||
+ | }, | ||
+ | rules:{ | ||
+ | team_name:[ | ||
+ | { required: true, message: '请输入团队名称', trigger: 'blur' }, | ||
+ | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } | ||
+ | ], | ||
+ | }, | ||
+ | }; | ||
+ | }, | ||
+ | created() | ||
+ | { | ||
+ | this.userid=global.userid | ||
+ | this.search() | ||
+ | }, | ||
+ | methods: { | ||
+ | changesearchkind(aint) | ||
+ | { | ||
+ | this.searchkind=aint, | ||
+ | this.search() | ||
+ | }, | ||
+ | search() { | ||
+ | var that = this; | ||
+ | axios | ||
+ | .post("http://127.0.0.1:8080/home", {//175.24.53.216:8080 127.0.0.1:8080 | ||
+ | id: that.userid, | ||
+ | kind: that.searchkind | ||
+ | }) | ||
+ | .then(function(response) { | ||
+ | alert("搜索完成(测试)"); | ||
+ | alert(response.data.msg); | ||
+ | }) | ||
+ | .catch(function(error) { | ||
+ | alert(error); | ||
+ | }); | ||
+ | }, | ||
+ | | ||
+ | submitForm(formName) { | ||
+ | this.$refs[formName].validate((valid) => { | ||
+ | if (valid) { | ||
+ | var that = this; | ||
+ | that.createTeam_form.email=global.userEmail; | ||
+ | axios | ||
+ | .post("http://127.0.0.1:8080/buildteam", that.createTeam_form)//175.24.53.216:8080 127.0.0.1:8080 | ||
+ | .then(function(response) { | ||
+ | alert(response.data.msg); | ||
+ | }) | ||
+ | .catch(function(error) { | ||
+ | alert(error); | ||
+ | console.log(error); | ||
+ | }); | ||
+ | } else { | ||
+ | console.log('error submit!!'); | ||
+ | return false; | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | toggleModalCreate:function(){ | ||
+ | this.showCreateModal = !this.showCreateModal; | ||
+ | }, | ||
+ | closemeCreate:function(){ | ||
+ | this.showCreateModal = !this.showCreateModal; | ||
+ | }, | ||
+ | toggleModalJoin:function(){ | ||
+ | this.showJoinModal = !this.showJoinModal; | ||
+ | }, | ||
+ | closemeJoin:function(){ | ||
+ | this.showJoinModal = !this.showJoinModal; | ||
+ | } | ||
+ | } | ||
+ | }; | ||
+ | </script> | ||
+ | |||
+ | <style scoped> | ||
+ | .each { | ||
+ | width: 30%; | ||
+ | border: 1px solid black; | ||
+ | margin: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .el-dropdown-link { | ||
+ | cursor: pointer; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .el-icon-arrow-down { | ||
+ | font-size: 12px; | ||
+ | } | ||
+ | .box { | ||
+ | border: 1px solid #DCDFE6; | ||
+ | margin: 10px auto; | ||
+ | padding: 10px 35px 15px 35px; | ||
+ | border-radius: 5px; | ||
+ | -webkit-border-radius: 5px; | ||
+ | -moz-border-radius: 5px; | ||
+ | box-shadow: 0 0 5px #909399; | ||
+ | opacity: 1 | ||
+ | } | ||
+ | .art-more { | ||
+ | height: 40px; | ||
+ | display: flex; | ||
+ | justify-content: flex-end; | ||
+ | align-items: flex-end; | ||
+ | } | ||
+ | .art-more .view { | ||
+ | color: #aaa; | ||
+ | } | ||
+ | h5{ | ||
+ | font-size: 18px; | ||
+ | } | ||
+ | .pagination { | ||
+ | background-color: #F9F9F9; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | } | ||
+ | .art-time { | ||
+ | margin-right: 20px; | ||
+ | } | ||
+ | .art-title { | ||
+ | border-left: 3px solid #409EFF; | ||
+ | padding-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | |||
+ | .art-title:hover { | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .name:hover{ | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | </style> | ||
+ | |||
+ | <style> | ||
+ | .modal-backdrop { | ||
+ | position: fixed; | ||
+ | top: 0; | ||
+ | right: 0; | ||
+ | bottom: 0; | ||
+ | left: 0; | ||
+ | background-color: rgba(0,0,0,.3); | ||
+ | display: flex; | ||
+ | justify-content: center; | ||
+ | align-items: center; | ||
+ | } | ||
+ | .modal { | ||
+ | background-color: #fff; | ||
+ | box-shadow: 2px 2px 20px 1px; | ||
+ | overflow-x:auto; | ||
+ | display: flex; | ||
+ | flex-direction: column; | ||
+ | border-radius: 16px; | ||
+ | width: 700px; | ||
+ | } | ||
+ | .modal-header { | ||
+ | border-bottom: 1px solid #eee; | ||
+ | color: #313131; | ||
+ | justify-content: space-between; | ||
+ | padding: 15px; | ||
+ | display: flex; | ||
+ | } | ||
+ | .modal-footer { | ||
+ | border-top: 1px solid #eee; | ||
+ | justify-content: flex-end; | ||
+ | padding: 15px; | ||
+ | display: flex; | ||
+ | } | ||
+ | .modal-body { | ||
+ | position: relative; | ||
+ | padding: 20px 10px; | ||
+ | } | ||
+ | .btn-close, .btn-confirm { | ||
+ | border-radius: 8px; | ||
+ | margin-left:16px; | ||
+ | width:56px; | ||
+ | height: 36px; | ||
+ | border:none; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .btn-close { | ||
+ | color: #313131; | ||
+ | background-color:transparent; | ||
+ | } | ||
+ | .btn-confirm { | ||
+ | color: #fff; | ||
+ | background-color: #2d8cf0; | ||
+ | } | ||
+ | .login-box { | ||
+ | border: 1px solid #DCDFE6; | ||
+ | width: 350px; | ||
+ | margin: 180px auto; | ||
+ | padding: 35px 35px 15px 0px; | ||
+ | border-radius: 5px; | ||
+ | -webkit-border-radius: 5px; | ||
+ | -moz-border-radius: 5px; | ||
+ | box-shadow: 0 0 25px #909399; | ||
+ | } | ||
+ | |||
+ | .login-title { | ||
+ | text-align: center; | ||
+ | margin: 0 auto 40px auto; | ||
+ | padding: 0px 0px 0px 10px; | ||
+ | color: #303133; | ||
+ | } | ||
+ | |||
+ | .submitBtn { | ||
+ | display:block; | ||
+ | text-align: center; | ||
+ | margin: 0px auto; | ||
+ | background-color: transparent; | ||
+ | color: #39f; | ||
+ | width: 200px; | ||
+ | } | ||
+ | |||
+ | ======= | ||
+ | <template> | ||
+ | <div class="home"> | ||
+ | <Navigator return="home" /> | ||
+ | <el-row :span="10"> | ||
+ | <!-- 左侧导航栏 --> | ||
+ | <el-col :span="5"> | ||
+ | <el-menu | ||
+ | default-active="1" | ||
+ | class="el-menu-vertical-demo"> | ||
+ | |||
+ | <el-menu-item index="1" @click="pageflag=1"> | ||
+ | <i class="el-icon-menu"></i> | ||
+ | <span slot="title" >工作台</span> | ||
+ | </el-menu-item> | ||
+ | | ||
+ | <el-menu-item index="2" @click="pageflag=2"> | ||
+ | <i class="el-icon-message"></i> | ||
+ | <span slot="title" >收件箱</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-menu-item index="3" @click="pageflag=3"> | ||
+ | <i class="el-icon-delete"></i> | ||
+ | <span slot="title" >回收站</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-submenu index="4"> | ||
+ | <template slot="title"> | ||
+ | <i class="el-icon-s-custom"></i> | ||
+ | <span>团队空间</span> | ||
+ | </template> | ||
+ | <el-menu-item-group> | ||
+ | <el-menu-item v-for="item in allteams.data" :key="item.id"> | ||
+ | |||
+ | </el-menu-item> | ||
+ | </el-menu-item-group> | ||
+ | </el-submenu> | ||
+ | |||
+ | </el-menu> | ||
+ | </el-col> | ||
+ | <!-- 右侧内容 --> | ||
+ | <el-col :span="19"> | ||
+ | <!-- 工作台页面 --> | ||
+ | | ||
+ | <div v-if="pageflag==1"> | ||
+ | <!-- 上方分类 --> | ||
+ | <el-row> | ||
+ | <el-menu default-active="1" class="el-menu-demo" mode="horizontal"> | ||
+ | <el-menu-item index="1" @click="changesearchkind(1)">最近使用</el-menu-item> | ||
+ | <el-menu-item index="2" @click="changesearchkind(2)">我创建的</el-menu-item> | ||
+ | <el-menu-item index="3" @click="changesearchkind(3)">我的收藏</el-menu-item> | ||
+ | <el-menu-item index="4" style="float:right" @click="createdoc()">新建文档</el-menu-item> | ||
+ | <el-menu-item index="5" style="float:right">按模版新建</el-menu-item> | ||
+ | </el-menu> | ||
+ | </el-row> | ||
+ | <!-- 下方内容 --> | ||
+ | <el-row> | ||
+ | <div class="files" v-for="item in allfiles.data" :key="item.id"> | ||
+ | <div class="afile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | | ||
+ | </el-row> | ||
+ | |||
+ | </div> | ||
+ | <!-- 收件箱页面 --> | ||
+ | <div v-if="pageflag==2"> | ||
+ | hi2 | ||
+ | </div> | ||
+ | <!-- 回收站页面 --> | ||
+ | <div v-if="pageflag==3"> | ||
+ | <el-row> | ||
+ | <div class="deletefiles" v-for="item in alldeleted.data" :key="item.id"> | ||
+ | <div class="deletefile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | </el-row> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </el-col> | ||
+ | |||
+ | |||
+ | </el-row> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | | ||
+ | </template> | ||
+ | |||
+ | <script> | ||
+ | // @ is an alias to /src | ||
+ | import Navigator from "@/components/Navigator.vue"; | ||
+ | import global from "@/components/global.vue"; | ||
+ | import axios from "axios"; | ||
+ | |||
+ | export default { | ||
+ | name: "Home", | ||
+ | components: { | ||
+ | Navigator | ||
+ | }, | ||
+ | data() { | ||
+ | return { | ||
+ | userid:0, | ||
+ | searchkind:1, | ||
+ | pageflag:1, | ||
+ | allfiles:{}, | ||
+ | alldeleted:{}, | ||
+ | allteams:{} | ||
+ | }; | ||
+ | }, | ||
+ | created() | ||
+ | { | ||
+ | this.userid=global.userid | ||
+ | this.search() | ||
+ | }, | ||
+ | methods: { | ||
+ | createdoc() | ||
+ | { | ||
+ | this.$router.push({ | ||
+ | name: "Viewdoc", | ||
+ | params: { | ||
+ | kind: 1 | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | changesearchkind(aint) | ||
+ | { | ||
+ | this.searchkind=aint, | ||
+ | this.search() | ||
+ | }, | ||
+ | search() { | ||
+ | var that = this; | ||
+ | axios | ||
+ | .post("http://127.0.0.1:8080/home", { | ||
+ | id: that.userid, | ||
+ | kind: that.searchkind | ||
+ | }) | ||
+ | .then(function(response) { | ||
+ | alert("搜索完成(测试)"); | ||
+ | alert(response.data.msg); | ||
+ | }) | ||
+ | .catch(function(error) { | ||
+ | alert(error); | ||
+ | }); | ||
+ | }, | ||
+ | } | ||
+ | }; | ||
+ | </script> | ||
+ | |||
+ | <style scoped> | ||
+ | .each { | ||
+ | width: 30%; | ||
+ | border: 1px solid black; | ||
+ | margin: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .el-dropdown-link { | ||
+ | cursor: pointer; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .el-icon-arrow-down { | ||
+ | font-size: 12px; | ||
+ | } | ||
+ | .searchBox{ | ||
+ | | ||
+ | } | ||
+ | .searchInput{ | ||
+ | | ||
+ | } | ||
+ | .searchButton{ | ||
+ | | ||
+ | } | ||
+ | .box { | ||
+ | border: 1px solid #DCDFE6; | ||
+ | margin: 10px auto; | ||
+ | padding: 10px 35px 15px 35px; | ||
+ | border-radius: 5px; | ||
+ | -webkit-border-radius: 5px; | ||
+ | -moz-border-radius: 5px; | ||
+ | box-shadow: 0 0 5px #909399; | ||
+ | opacity: 1 | ||
+ | } | ||
+ | .art-more { | ||
+ | height: 40px; | ||
+ | display: flex; | ||
+ | justify-content: flex-end; | ||
+ | align-items: flex-end; | ||
+ | } | ||
+ | .art-more .view { | ||
+ | color: #aaa; | ||
+ | } | ||
+ | h5{ | ||
+ | font-size: 18px; | ||
+ | } | ||
+ | .pagination { | ||
+ | background-color: #F9F9F9; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | } | ||
+ | .art-time { | ||
+ | margin-right: 20px; | ||
+ | } | ||
+ | .art-title { | ||
+ | border-left: 3px solid #409EFF; | ||
+ | padding-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | |||
+ | .art-title:hover { | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .name:hover{ | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | >>>>>>> branch2 | ||
+ | </style> | ||
+ | |||
+ | </code> | ||
+ | </hidden> | ||
+ | |||
+ | 处理后: | ||
+ | |||
+ | <hidden> | ||
+ | <code C> | ||
+ | |||
+ | <template> | ||
+ | <div class="home"> | ||
+ | <Navigator return="home" /> | ||
+ | <el-row :span="10"> | ||
+ | <!-- 左侧导航栏 --> | ||
+ | <el-col :span="5"> | ||
+ | <el-menu | ||
+ | default-active="1" | ||
+ | class="el-menu-vertical-demo"> | ||
+ | |||
+ | <el-menu-item index="1" @click="pageflag=1"> | ||
+ | <i class="el-icon-menu"></i> | ||
+ | #ifdef branch2 | ||
+ | <span slot="title" >工作台</span> | ||
+ | #else | ||
+ | <span slot="title" v-bind:disabled="isteamspace">工作台</span> | ||
+ | #endif | ||
+ | </el-menu-item> | ||
+ | | ||
+ | <el-menu-item index="2" @click="pageflag=2"> | ||
+ | <i class="el-icon-message"></i> | ||
+ | <span slot="title" >收件箱</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-menu-item index="3" @click="pageflag=3"> | ||
+ | <i class="el-icon-delete"></i> | ||
+ | <span slot="title" >回收站</span> | ||
+ | </el-menu-item> | ||
+ | |||
+ | <el-submenu index="4"> | ||
+ | <template slot="title"> | ||
+ | <i class="el-icon-s-custom"></i> | ||
+ | <span>团队空间</span> | ||
+ | </template> | ||
+ | <el-menu-item-group> | ||
+ | #ifdef branch2 | ||
+ | <el-menu-item v-for="item in allteams.data" :key="item.id"> | ||
+ | |||
+ | #else | ||
+ | <el-menu-item @click="toggleModalCreate"> | ||
+ | <template slot="title" > | ||
+ | <i class="el-icon-plus"></i> | ||
+ | <span slot="title" >新建团队</span> | ||
+ | </template> | ||
+ | </el-menu-item> | ||
+ | <el-menu-item @click="toggleModalJoin"> | ||
+ | <i class="el-icon-zoom-in"></i> | ||
+ | <span slot="title" >加入团队</span> | ||
+ | </el-menu-item> | ||
+ | <el-menu-item v-for="item in allteams.data" :key="item.id"> | ||
+ | #endif | ||
+ | </el-menu-item> | ||
+ | </el-menu-item-group> | ||
+ | </el-submenu> | ||
+ | |||
+ | </el-menu> | ||
+ | </el-col> | ||
+ | <!-- 右侧内容 --> | ||
+ | <el-col :span="19"> | ||
+ | <!-- 工作台页面 --> | ||
+ | | ||
+ | <div v-if="pageflag==1"> | ||
+ | <!-- 上方分类 --> | ||
+ | <el-row> | ||
+ | #ifdef branch2 | ||
+ | <el-menu default-active="1" class="el-menu-demo" mode="horizontal"> | ||
+ | <el-menu-item index="1" @click="changesearchkind(1)">最近使用</el-menu-item> | ||
+ | <el-menu-item index="2" @click="changesearchkind(2)">我创建的</el-menu-item> | ||
+ | <el-menu-item index="3" @click="changesearchkind(3)">我的收藏</el-menu-item> | ||
+ | <el-menu-item index="4" style="float:right" @click="createdoc()">新建文档</el-menu-item> | ||
+ | #else | ||
+ | <el-menu default-active="1" mode="horizontal"> | ||
+ | <el-menu-item index="1" @click="changesearchkind(1)">最近使用</el-menu-item> | ||
+ | <el-menu-item index="2" @click="changesearchkind(2)">我创建的</el-menu-item> | ||
+ | <el-menu-item index="3" @click="changesearchkind(3)">我的收藏</el-menu-item> | ||
+ | <el-menu-item index="4" style="float:right">新建文档</el-menu-item> | ||
+ | #endif | ||
+ | <el-menu-item index="5" style="float:right">按模版新建</el-menu-item> | ||
+ | </el-menu> | ||
+ | </el-row> | ||
+ | <!-- 下方内容 --> | ||
+ | <el-row> | ||
+ | <div class="files" v-for="item in allfiles.data" :key="item.id"> | ||
+ | <div class="afile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | | ||
+ | </el-row> | ||
+ | |||
+ | </div> | ||
+ | <!-- 收件箱页面 --> | ||
+ | <div v-if="pageflag==2"> | ||
+ | hi2 | ||
+ | </div> | ||
+ | <!-- 回收站页面 --> | ||
+ | <div v-if="pageflag==3"> | ||
+ | <el-row> | ||
+ | <div class="deletefiles" v-for="item in alldeleted.data" :key="item.id"> | ||
+ | <div class="deletefile"> | ||
+ | | ||
+ | </div> | ||
+ | </div> | ||
+ | </el-row> | ||
+ | </div> | ||
+ | #ifdef branch2 | ||
+ | |||
+ | |||
+ | </el-col> | ||
+ | |||
+ | |||
+ | </el-row> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | | ||
+ | #else | ||
+ | </el-col> | ||
+ | </el-row> | ||
+ | |||
+ | <div v-if="showCreateModal" v-on:closeme="closeme"> | ||
+ | <div class="modal-backdrop"> | ||
+ | <div class="modal" :style="mainStyles"> | ||
+ | <div class="modal-header"> | ||
+ | <h3>新建团队</h3> | ||
+ | </div> | ||
+ | <div class="modal-body"> | ||
+ | <el-form ref="createTeam_form" :model="createTeam_form" :rules="rules" label-width="80px" > | ||
+ | <el-form-item label="团队名称" prop="team_name"> | ||
+ | <el-input | ||
+ | placeholder="team name" | ||
+ | v-model="createTeam_form.team_name" | ||
+ | class="input-with-select" | ||
+ | ></el-input> | ||
+ | </el-form-item> | ||
+ | </el-form> | ||
+ | </div> | ||
+ | <div class="modal-footer"> | ||
+ | <button type="button" class="btn-confirm" @click="submitForm('createTeam_form')">确认</button> | ||
+ | <button type="button" class="btn-close" @click="closemeCreate">关闭</button> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | <div v-if="showJoinModal" v-on:closeme="closeme"> | ||
+ | <div class="modal-backdrop"> | ||
+ | <div class="modal" :style="mainStyles"> | ||
+ | <div class="modal-header"> | ||
+ | <h3>加入团队</h3> | ||
+ | </div> | ||
+ | <div class="modal-body"> | ||
+ | <el-form ref="createTeam_form" :model="createTeam_form" :rules="rules" label-width="80px" > | ||
+ | <el-form-item label="团队名称" prop="team_name"> | ||
+ | <el-input | ||
+ | placeholder="team name" | ||
+ | v-model="createTeam_form.team_name" | ||
+ | class="input-with-select" | ||
+ | ></el-input> | ||
+ | </el-form-item> | ||
+ | </el-form> | ||
+ | </div> | ||
+ | <div class="modal-footer"> | ||
+ | <button type="button" class="btn-confirm" @click="submitForm('createTeam_form')">确认</button> | ||
+ | <button type="button" class="btn-close" @click="closemeJoin">关闭</button> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | #endif | ||
+ | </template> | ||
+ | |||
+ | <script> | ||
+ | // @ is an alias to /src | ||
+ | import Navigator from "@/components/Navigator.vue"; | ||
+ | import global from "@/components/global.vue"; | ||
+ | import axios from "axios"; | ||
+ | |||
+ | export default { | ||
+ | name: "Home", | ||
+ | components: { | ||
+ | #ifdef branch2 | ||
+ | Navigator | ||
+ | #else | ||
+ | Navigator, | ||
+ | #endif | ||
+ | }, | ||
+ | data() { | ||
+ | return { | ||
+ | userid:0, | ||
+ | searchkind:1, | ||
+ | pageflag:1, | ||
+ | allfiles:{}, | ||
+ | alldeleted:{}, | ||
+ | #ifdef branch2 | ||
+ | allteams:{} | ||
+ | #else | ||
+ | allteams:{}, | ||
+ | showCreateModal:false, | ||
+ | showJoinModal:false, | ||
+ | createTeam_form:{ | ||
+ | email: "", | ||
+ | team_name:"" | ||
+ | }, | ||
+ | rules:{ | ||
+ | team_name:[ | ||
+ | { required: true, message: '请输入团队名称', trigger: 'blur' }, | ||
+ | { min: 5, max: 15, message: '长度在 5 到 15 个字符', trigger: 'blur' } | ||
+ | ], | ||
+ | }, | ||
+ | #endif | ||
+ | }; | ||
+ | }, | ||
+ | created() | ||
+ | { | ||
+ | this.userid=global.userid | ||
+ | this.search() | ||
+ | }, | ||
+ | methods: { | ||
+ | #ifdef branch2 | ||
+ | createdoc() | ||
+ | { | ||
+ | this.$router.push({ | ||
+ | name: "Viewdoc", | ||
+ | params: { | ||
+ | kind: 1 | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | changesearchkind(aint) | ||
+ | #else | ||
+ | changesearchkind(aint) | ||
+ | #endif | ||
+ | { | ||
+ | this.searchkind=aint, | ||
+ | this.search() | ||
+ | }, | ||
+ | search() { | ||
+ | var that = this; | ||
+ | axios | ||
+ | #ifdef branch2 | ||
+ | .post("http://127.0.0.1:8080/home", { | ||
+ | #else | ||
+ | .post("http://127.0.0.1:8080/home", {//175.24.53.216:8080 127.0.0.1:8080 | ||
+ | #endif | ||
+ | id: that.userid, | ||
+ | kind: that.searchkind | ||
+ | }) | ||
+ | .then(function(response) { | ||
+ | alert("搜索完成(测试)"); | ||
+ | alert(response.data.msg); | ||
+ | }) | ||
+ | .catch(function(error) { | ||
+ | alert(error); | ||
+ | }); | ||
+ | #ifdef branch2 | ||
+ | }, | ||
+ | #else | ||
+ | }, | ||
+ | | ||
+ | submitForm(formName) { | ||
+ | this.$refs[formName].validate((valid) => { | ||
+ | if (valid) { | ||
+ | var that = this; | ||
+ | that.createTeam_form.email=global.userEmail; | ||
+ | axios | ||
+ | .post("http://127.0.0.1:8080/buildteam", that.createTeam_form)//175.24.53.216:8080 127.0.0.1:8080 | ||
+ | .then(function(response) { | ||
+ | alert(response.data.msg); | ||
+ | }) | ||
+ | .catch(function(error) { | ||
+ | alert(error); | ||
+ | console.log(error); | ||
+ | }); | ||
+ | } else { | ||
+ | console.log('error submit!!'); | ||
+ | return false; | ||
+ | } | ||
+ | }); | ||
+ | }, | ||
+ | |||
+ | toggleModalCreate:function(){ | ||
+ | this.showCreateModal = !this.showCreateModal; | ||
+ | }, | ||
+ | closemeCreate:function(){ | ||
+ | this.showCreateModal = !this.showCreateModal; | ||
+ | }, | ||
+ | toggleModalJoin:function(){ | ||
+ | this.showJoinModal = !this.showJoinModal; | ||
+ | }, | ||
+ | closemeJoin:function(){ | ||
+ | this.showJoinModal = !this.showJoinModal; | ||
+ | } | ||
+ | #endif | ||
+ | } | ||
+ | }; | ||
+ | </script> | ||
+ | |||
+ | <style scoped> | ||
+ | .each { | ||
+ | width: 30%; | ||
+ | border: 1px solid black; | ||
+ | margin: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .el-dropdown-link { | ||
+ | cursor: pointer; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .el-icon-arrow-down { | ||
+ | font-size: 12px; | ||
+ | } | ||
+ | #ifdef branch2 | ||
+ | .searchBox{ | ||
+ | | ||
+ | } | ||
+ | .searchInput{ | ||
+ | | ||
+ | } | ||
+ | .searchButton{ | ||
+ | | ||
+ | } | ||
+ | #endif | ||
+ | .box { | ||
+ | border: 1px solid #DCDFE6; | ||
+ | margin: 10px auto; | ||
+ | padding: 10px 35px 15px 35px; | ||
+ | border-radius: 5px; | ||
+ | -webkit-border-radius: 5px; | ||
+ | -moz-border-radius: 5px; | ||
+ | box-shadow: 0 0 5px #909399; | ||
+ | opacity: 1 | ||
+ | } | ||
+ | .art-more { | ||
+ | height: 40px; | ||
+ | display: flex; | ||
+ | justify-content: flex-end; | ||
+ | align-items: flex-end; | ||
+ | } | ||
+ | .art-more .view { | ||
+ | color: #aaa; | ||
+ | } | ||
+ | h5{ | ||
+ | font-size: 18px; | ||
+ | } | ||
+ | .pagination { | ||
+ | background-color: #F9F9F9; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | } | ||
+ | .art-time { | ||
+ | margin-right: 20px; | ||
+ | } | ||
+ | .art-title { | ||
+ | border-left: 3px solid #409EFF; | ||
+ | padding-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | |||
+ | .art-title:hover { | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | .name{ | ||
+ | margin-top:10px ; | ||
+ | margin-left: 5px; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .name:hover{ | ||
+ | padding-left: 10px; | ||
+ | color: #409EFF; | ||
+ | } | ||
+ | #ifdef branch1 | ||
+ | </style> | ||
+ | |||
+ | <style> | ||
+ | .modal-backdrop { | ||
+ | position: fixed; | ||
+ | top: 0; | ||
+ | right: 0; | ||
+ | bottom: 0; | ||
+ | left: 0; | ||
+ | background-color: rgba(0,0,0,.3); | ||
+ | display: flex; | ||
+ | justify-content: center; | ||
+ | align-items: center; | ||
+ | } | ||
+ | .modal { | ||
+ | background-color: #fff; | ||
+ | box-shadow: 2px 2px 20px 1px; | ||
+ | overflow-x:auto; | ||
+ | display: flex; | ||
+ | flex-direction: column; | ||
+ | border-radius: 16px; | ||
+ | width: 700px; | ||
+ | } | ||
+ | .modal-header { | ||
+ | border-bottom: 1px solid #eee; | ||
+ | color: #313131; | ||
+ | justify-content: space-between; | ||
+ | padding: 15px; | ||
+ | display: flex; | ||
+ | } | ||
+ | .modal-footer { | ||
+ | border-top: 1px solid #eee; | ||
+ | justify-content: flex-end; | ||
+ | padding: 15px; | ||
+ | display: flex; | ||
+ | } | ||
+ | .modal-body { | ||
+ | position: relative; | ||
+ | padding: 20px 10px; | ||
+ | } | ||
+ | .btn-close, .btn-confirm { | ||
+ | border-radius: 8px; | ||
+ | margin-left:16px; | ||
+ | width:56px; | ||
+ | height: 36px; | ||
+ | border:none; | ||
+ | cursor: pointer; | ||
+ | } | ||
+ | .btn-close { | ||
+ | color: #313131; | ||
+ | background-color:transparent; | ||
+ | } | ||
+ | .btn-confirm { | ||
+ | color: #fff; | ||
+ | background-color: #2d8cf0; | ||
+ | } | ||
+ | .login-box { | ||
+ | border: 1px solid #DCDFE6; | ||
+ | width: 350px; | ||
+ | margin: 180px auto; | ||
+ | padding: 35px 35px 15px 0px; | ||
+ | border-radius: 5px; | ||
+ | -webkit-border-radius: 5px; | ||
+ | -moz-border-radius: 5px; | ||
+ | box-shadow: 0 0 25px #909399; | ||
+ | } | ||
+ | |||
+ | .login-title { | ||
+ | text-align: center; | ||
+ | margin: 0 auto 40px auto; | ||
+ | padding: 0px 0px 0px 10px; | ||
+ | color: #303133; | ||
+ | } | ||
+ | |||
+ | .submitBtn { | ||
+ | display:block; | ||
+ | text-align: center; | ||
+ | margin: 0px auto; | ||
+ | background-color: transparent; | ||
+ | color: #39f; | ||
+ | width: 200px; | ||
+ | } | ||
+ | |||
+ | #endif | ||
+ | </style> | ||
+ | |||
+ | |||
+ | </code> | ||
+ | </hidden> | ||
+ | 超好用啊有木有!感谢假期能打如此实用的比赛! | ||