优化调整

This commit is contained in:
2023-07-12 01:36:35 +08:00
parent 92d102c346
commit e6106c073f
15 changed files with 211 additions and 157 deletions

View File

@@ -70,7 +70,7 @@
</div> </div>
<div style="margin-top: 2.5vh;margin-left: 20px;display: flex;flex-direction: column;flex-wrap: nowrap;"> <div style="margin-top: 2.5vh;margin-left: 20px;display: flex;flex-direction: column;flex-wrap: nowrap;">
<el-card class="box-card" style="width: 15vw"> <el-card class="box-card" style="width: 15vw">
<el-button type="info" plain @click="openLogin" v-show="this.$cookie.get('username')==null"> </el-button> <el-button type="info" plain @click="openLogin" v-if="this.$cookie.get('username')==null"> </el-button>
<UserInfo></UserInfo> <UserInfo></UserInfo>
</el-card> </el-card>
@@ -79,11 +79,11 @@
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;justify-content: space-between"> <div style="display: flex;flex-direction: row;flex-wrap: nowrap;justify-content: space-between">
<div style="display: flex;flex-direction: column;flex-wrap: nowrap"> <div style="display: flex;flex-direction: column;flex-wrap: nowrap">
<span style="font-size: 16px;color: #9ca3af;font-weight: bold">用户总数</span> <span style="font-size: 16px;color: #9ca3af;font-weight: bold">用户总数</span>
<span style="font-size: 30px">{{userTotal}}</span> <span v-if="userTotal" style="font-size: 30px">{{userTotal}}</span>
</div> </div>
<div style="display: flex;flex-direction: column;flex-wrap: nowrap"> <div style="display: flex;flex-direction: column;flex-wrap: nowrap">
<span style="font-size: 16px;color: #9ca3af;font-weight: bold">开源项目</span> <span style="font-size: 16px;color: #9ca3af;font-weight: bold">开源项目</span>
<span style="font-size: 30px">{{projectTotal}}</span> <span v-if="projectTotal" style="font-size: 30px">{{projectTotal}}</span>
</div> </div>
</div> </div>
<!-- <el-statistic group-separator="," :precision="0" decimal-separator="." :value="userTotal" title="用户总数">--> <!-- <el-statistic group-separator="," :precision="0" decimal-separator="." :value="userTotal" title="用户总数">-->
@@ -165,11 +165,14 @@ export default {
mounted() { mounted() {
// this.account(); //获取cookie的方法 // this.account(); //获取cookie的方法
this.ProjectLists(); this.ProjectLists();
this.categoryList();
this.getUserTotal();
this.getProjectTotal();
}, },
created() { created() {
this.categoryList();
setTimeout(()=>{
this.getProjectTotal();
},1000)
this.getUserTotal();
}, },
computed: { computed: {
noMore() { noMore() {
@@ -290,9 +293,6 @@ export default {
method: 'post', method: 'post',
// 请求的地址 // 请求的地址
url: '/api/userNum', url: '/api/userNum',
// URL 中的查询参数
params: {
}
}).then((res)=>{ }).then((res)=>{
that.userTotal=res.data; that.userTotal=res.data;
}); });
@@ -304,9 +304,6 @@ export default {
// 请求的地址 // 请求的地址
url: '/api/countNum', url: '/api/countNum',
// URL 中的查询参数 // URL 中的查询参数
params: {
}
}).then((res)=>{ }).then((res)=>{
that.projectTotal=res.data; that.projectTotal=res.data;
}); });

View File

@@ -77,7 +77,7 @@
<el-form-item> <el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: flex-end"> <div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: flex-end">
<el-button @click="submit('ruleForm')" type="primary" style=";margin-top:10px">提交</el-button> <el-button @click.native.stop.once="submit('ruleForm')" type="primary" style=";margin-top:10px">提交</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@@ -15,25 +15,25 @@
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;"> <div style="display: flex;flex-direction: column;flex-wrap: nowrap;">
<el-card style="box-shadow: none;border-radius: 10px"> <el-card style="box-shadow: none;border-radius: 10px">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center"> <div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center">
<span style="font-size: 18px;color: #6b7280;font-weight: bold"> <span v-if="oneFileName" style="font-size: 18px;color: #6b7280;font-weight: bold">
{{oneFileName}} : {{oneFileName}} :
</span> </span>
<span style="font-size: 16px;color: #6b7280;font-weight: bold"> <span v-if="description" style="font-size: 16px;color: #6b7280;font-weight: bold">
{{description}} {{description}}
</span> </span>
</div> </div>
<div style="display: flex;flex-wrap: nowrap;flex-direction: row;align-items: center;justify-content: space-between"> <div style="display: flex;flex-wrap: nowrap;flex-direction: row;align-items: center;justify-content: space-between">
<div style="font-size: 15px;color: #9ca3af;margin-top: 20px;"> <div style="font-size: 15px;color: #9ca3af;margin-top: 20px;">
<span>发布于: </span> <span>发布于: </span>
<span>{{userName}}</span> <span v-if="userName">{{userName}}</span>
<span> · </span> <span> · </span>
<span> 主语言 {{language}}</span> <span v-if="language"> 主语言 {{language}}</span>
<span> · </span> <span> · </span>
<span> {{formatNumber(lookNum)}} </span> <span v-if="lookNum"> {{formatNumber(lookNum)}} </span>
<span> 次查看 </span> <span> 次查看 </span>
</div> </div>
<div style="display: flex;align-items: center;justify-content: center;margin-top: 20px;"> <div style="display: flex;align-items: center;justify-content: center;margin-top: 20px;">
<el-button plain icon="el-icon-link" size="mini" @click="goTo(url)">访问</el-button> <el-button v-if="url" v-show="url!=null" plain icon="el-icon-link" size="mini" @click="goTo(url)">访问</el-button>
<el-button plain icon="el-icon-document-copy" size="mini" @click="copyText">复制</el-button> <el-button plain icon="el-icon-document-copy" size="mini" @click="copyText">复制</el-button>
</div> </div>
</div> </div>
@@ -42,6 +42,7 @@
<el-card style="box-shadow: none;margin-top: 20px;border-radius: 10px"> <el-card style="box-shadow: none;margin-top: 20px;border-radius: 10px">
<PrismEditor <PrismEditor
class="my-editor height-300" class="my-editor height-300"
v-if="content"
v-model="content" v-model="content"
aria-disabled aria-disabled
:highlight="highlighter" :highlight="highlighter"
@@ -137,7 +138,6 @@ export default {
id:this.$route.query.id id:this.$route.query.id
} }
}).then(function (res) { }).then(function (res) {
console.log(res);
that.id=res.data.id; that.id=res.data.id;
that.language=res.data.language; that.language=res.data.language;
that.lookNum=res.data.lookNum; that.lookNum=res.data.lookNum;

View File

@@ -5,13 +5,13 @@
<br/> <br/>
<el-page-header @back="goBack" style="justify-content:left;display: flex;"> <el-page-header @back="goBack" style="justify-content:left;display: flex;">
<div slot="title" style="font-size:23px;font-weight: 600;"></div> <div slot="title" style="font-size:23px;font-weight: 600;"></div>
<div slot="content" style=";display: flex;flex-direction:row;justify-content:center;font-size:23px;font-weight: 600;"> <div v-if="ArticleContent" slot="content" style=";display: flex;flex-direction:row;justify-content:center;font-size:23px;font-weight: 600;">
{{ArticleTitle}} {{ArticleTitle}}
</div> </div>
</el-page-header> </el-page-header>
</div> </div>
<div class="PageContent" style="display: flex;flex-direction: column;flex-wrap: nowrap;align-items: center"> <div class="PageContent" style="display: flex;flex-direction: column;flex-wrap: nowrap;align-items: center">
<el-image fit="cover" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);width: 50vw; height: 35vh;margin-top: 20px" :src="articleico"> <el-image v-if="articleico" fit="cover" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);width: 50vw; height: 35vh;margin-top: 20px" :src="articleico">
<div slot="placeholder" class="image-slot"> <div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span> 加载中<span class="dot">...</span>
</div> </div>
@@ -21,7 +21,7 @@
</el-image> </el-image>
<el-card style="border: none;width: 50vw;box-shadow: none;"> <el-card style="border: none;width: 50vw;box-shadow: none;">
<el-tiptap style="margin-top: 20px;text-align: left" v-html="ArticleContent" :readonly="true" :showMenubar="false" :extensions="extensions" /> <el-tiptap v-if="ArticleContent" style="margin-top: 20px;text-align: left" v-html="ArticleContent" :readonly="true" :showMenubar="false" :extensions="extensions" />
</el-card> </el-card>
</div> </div>
</div> </div>

View File

@@ -9,17 +9,17 @@
</span> </span>
<div style="margin-top: 10px;display: flex;flex-direction: row;flex-wrap: wrap;align-items: center;font-size: 12px;color: #1f2937"> <div style="margin-top: 10px;display: flex;flex-direction: row;flex-wrap: wrap;align-items: center;font-size: 12px;color: #1f2937">
<span style="display: flex;justify-content: flex-start"> 作者: </span> <span style="display: flex;justify-content: flex-start"> 作者: </span>
<span style="margin-left: 5px"> {{articleList.username}} </span> <span v-if="articleList.username" style="margin-left: 5px"> {{articleList.username}} </span>
<span style="margin-left: 5px"></span> <span style="margin-left: 5px"></span>
<span style="margin-left: 5px">发布于 </span> <span style="margin-left: 5px">发布于 </span>
<span style="margin-left: 5px">{{articleList.publishtime}}</span> <span v-if="articleList.publishtime" style="margin-left: 5px">{{articleList.publishtime}}</span>
<span style="margin-left: 5px"></span> <span style="margin-left: 5px"></span>
<span style="margin-left: 5px">阅读: </span> <span style="margin-left: 5px">阅读: </span>
<span style="margin-left: 5px">{{ formatNumber(articleList.ReadCount) }}</span> <span v-if="articleList.ReadCount" style="margin-left: 5px">{{ formatNumber(articleList.ReadCount) }}</span>
</div> </div>
</div> </div>
<div style="width: 100px;height: 100px;margin-right: 10px"> <div style="width: 100px;height: 100px;margin-right: 10px">
<el-avatar :size="100" shape="square" :src="articleList.articleico"></el-avatar> <el-avatar v-if="articleList.articleico" :size="100" shape="square" :src="articleList.articleico"></el-avatar>
</div> </div>
</div> </div>
</template> </template>
@@ -37,7 +37,11 @@ export default {
}, },
computed:{ computed:{
brief: function() { brief: function() {
return this.articleList.ArticleContent.substr(0, 100) + '...'; if(this.articleList.ArticleContent){
return this.articleList.ArticleContent.substr(0, 100) + '...';
}else{
return false;
}
}, },
}, },
methods:{ methods:{
@@ -45,12 +49,17 @@ export default {
return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num
}, },
goArticleDetail(){ goArticleDetail(){
this.$router.push({ if(this.articleList.ArticleId){
path:'/ArticleDetail', this.$router.push({
query: { path:'/ArticleDetail',
id: this.articleList.ArticleId, query: {
refresh: true id: this.articleList.ArticleId,
}}) refresh: true
}})
}else{
return false;
}
// console.log(this.$route.query.id) // console.log(this.$route.query.id)
}, },
} }

View File

@@ -21,7 +21,7 @@
{{ briefTopName }} {{ briefTopName }}
</span> </span>
</el-link> </el-link>
<span style="text-align: left;display: flex;flex-direction:row;justify-content: flex-start;font-size: 20px;color: rgb(107 114 128);"> <span v-if="projectTitle" style="text-align: left;display: flex;flex-direction:row;justify-content: flex-start;font-size: 20px;color: rgb(107 114 128);">
{{projectTitle}} {{projectTitle}}
</span> </span>
</div> </div>
@@ -34,7 +34,7 @@
</span> </span>
<el-rate v-model="average" style="display: flex;justify-content: flex-start" disabled show-score text-color="#ff9900" <el-rate v-model="average" style="display: flex;justify-content: flex-start" disabled show-score text-color="#ff9900"
score-template="{value}"></el-rate> score-template="{value}"></el-rate>
<span style="font-size: 12px;color: #59A3A4;display: flex;justify-content: flex-start"> <span v-if="commentNum" style="font-size: 12px;color: #59A3A4;display: flex;justify-content: flex-start">
{{ commentNum }} 个评分 {{ commentNum }} 个评分
</span> </span>
</div> </div>
@@ -218,10 +218,10 @@
</div> </div>
<div style="display: flex;flex-direction: row;justify-content: space-between;margin-left: 10px;margin-top: 5px"> <div style="display: flex;flex-direction: row;justify-content: space-between;margin-left: 10px;margin-top: 5px">
<span style="font-size: 14px;color: #9ca3af">{{item.commentTime}}</span> <span v-if="item.commentTime" style="font-size: 14px;color: #9ca3af">{{item.commentTime}}</span>
<div style="display: flex;align-items: center"> <div style="display: flex;align-items: center">
<span style="margin-right: 5px;font-size: 14px; color: rgb(156, 163, 175);">{{ formatNumber(item.likeNum) }}</span> <span v-if="item.likeNum" style="margin-right: 5px;font-size: 14px; color: rgb(156, 163, 175);">{{ formatNumber(item.likeNum) }}</span>
<el-link @click="addLike(item.commentId)" icon="el-icon-star-off" :underline="false">点赞</el-link> <el-link v-if="item.commentId" @click="addLike(item.commentId)" icon="el-icon-star-off" :underline="false">点赞</el-link>
</div> </div>
</div> </div>
@@ -252,15 +252,15 @@
</div> </div>
<div style="margin-left: 10px;margin-top: 5px"> <div style="margin-left: 10px;margin-top: 5px">
<el-card style="border: none;text-align:left;"> <el-card style="border: none;text-align:left;">
<span>{{item.content}}</span> <span v-if="item.content">{{item.content}}</span>
</el-card> </el-card>
</div> </div>
<div style="display: flex;flex-direction: row;justify-content: space-between;margin-left: 10px;margin-top: 5px"> <div style="display: flex;flex-direction: row;justify-content: space-between;margin-left: 10px;margin-top: 5px">
<span style="font-size: 14px;color: #9ca3af">{{item.commentTime}}</span> <span v-if="item.commentTime" style="font-size: 14px;color: #9ca3af">{{item.commentTime}}</span>
<div style="display: flex;align-items: center"> <div style="display: flex;align-items: center">
<span style="margin-right: 5px;font-size: 14px; color: rgb(156, 163, 175);">{{ formatNumber(item.likeNum) }}</span> <span v-if="item.likeNum" style="margin-right: 5px;font-size: 14px; color: rgb(156, 163, 175);">{{ formatNumber(item.likeNum) }}</span>
<el-link @click.once="addLike(item.commentId)" icon="el-icon-star-off" :underline="false">点赞</el-link> <el-link v-if="item.commentId" @click.once="addLike(item.commentId)" icon="el-icon-star-off" :underline="false">点赞</el-link>
</div> </div>
</div> </div>
@@ -392,22 +392,32 @@ export default {
}, },
methods:{ methods:{
toUserPage() { toUserPage() {
this.$router.push({ if(this.username){
path: '/UserInfoPage', this.$router.push({
query: { path: '/UserInfoPage',
name: this.username, query: {
refresh: true name: this.username,
} refresh: true
}) }
})
}else {
return false;
}
}, },
toUserPage2(username) { toUserPage2(username) {
this.$router.push({ if(username){
path: '/UserInfoPage', this.$router.push({
query: { path: '/UserInfoPage',
name: username, query: {
refresh: true name: username,
} refresh: true
}) }
})
}else {
return false;
}
}, },
toComment(id){ toComment(id){
document.querySelector(id).scrollIntoView(true) document.querySelector(id).scrollIntoView(true)
@@ -447,9 +457,12 @@ export default {
that.username=res.data.project.username; that.username=res.data.project.username;
that.fileAddress=res.data.project.fileAddress; that.fileAddress=res.data.project.fileAddress;
// that.userUri=res.data.project.userUri; // that.userUri=res.data.project.userUri;
that.getDetailByGitHub(); if(res.data){
// that.getGithub(); that.getDetailByGitHub();
that.changeAvatarByLocal(); // that.getGithub();
that.changeAvatarByLocal();
}
}); });
}, },
reload() { reload() {
@@ -698,9 +711,6 @@ export default {
// 请求的地址 // 请求的地址
url: '/github/'+this.projectName, url: '/github/'+this.projectName,
// URL 中的查询参数 // URL 中的查询参数
params: {
}
}).then((res)=>{ }).then((res)=>{
if(res.data){ if(res.data){
that.github.starNum=res.data.stargazers_count; that.github.starNum=res.data.stargazers_count;

View File

@@ -1,11 +1,11 @@
<template> <template>
<div class="ProjectList" @click="goProjectDetail"> <div class="ProjectList" @click="goProjectDetail">
<div class="projectIco"> <div class="projectIco">
<img :src="projectLists.projectIco" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px"> <img v-if="projectLists.projectIco" :src="projectLists.projectIco" style="width: 5vw;height: 5vw;margin-left: 10px;border-radius: 10px">
</div> </div>
<div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between"> <div style="height: 12vh;margin-left: 5px;width: auto;display: flex;flex-direction: column;justify-content: space-between">
<div class="ProjectTitle" style="font-size: 16px;font-weight: bold;display: flex;flex-direction: row;align-items: center;justify-content: space-between"> <div class="ProjectTitle" style="font-size: 16px;font-weight: bold;display: flex;flex-direction: row;align-items: center;justify-content: space-between">
<span>{{projectLists.projectTitle}}</span> <span v-if="projectLists.projectTitle">{{projectLists.projectTitle}}</span>
<el-tag style="font-size: 14px;height: 20px;text-align: center;display: flex;align-items: center;border-radius: 10px" v-if="projectLists.num>0" type="success">{{projectLists.num}}</el-tag> <el-tag style="font-size: 14px;height: 20px;text-align: center;display: flex;align-items: center;border-radius: 10px" v-if="projectLists.num>0" type="success">{{projectLists.num}}</el-tag>
</div> </div>
<div class="summary"> <div class="summary">
@@ -14,18 +14,18 @@
<div class="other"> <div class="other">
<div class="otherInfo"> <div class="otherInfo">
<div class="projectName"> <div class="projectName">
<span style="color: #59A3A4">{{ projectLists.projectName }}</span><span style="color: rgb(156 163 175);"> </span> <span v-if=" projectLists.projectName" style="color: #59A3A4">{{ projectLists.projectName }}</span><span style="color: rgb(156 163 175);"> </span>
</div> </div>
<div> <div>
<div class="circle" :style="{'background-color':colorlists[Math.floor(Math.random() * colorlists.length)]}" ></div> <div class="circle" :style="{'background-color':colorlists[Math.floor(Math.random() * colorlists.length)]}" ></div>
</div> </div>
<el-tag size="mini" style="border-radius: 10px;margin-left: 5px" v-html="projectLists.categoryName"></el-tag><span style="color: rgb(156 163 175);margin-left: 5px"> </span> <el-tag v-if="projectLists.categoryName" size="mini" style="border-radius: 10px;margin-left: 5px" v-html="projectLists.categoryName"></el-tag><span style="color: rgb(156 163 175);margin-left: 5px"> </span>
<div style="margin-left: 10px"> <div style="margin-left: 10px">
<span style="color: rgb(156 163 175); ">{{ formatTime }}</span> <span v-if="projectLists.submitTime" style="color: rgb(156 163 175); ">{{ formatTime }}</span>
</div> </div>
</div> </div>
<div class="lookCount"> <div class="lookCount">
<i class="el-icon-view" style="color: rgb(156 163 175);"></i><span style="margin-left: 5px;color: rgb(156 163 175); ">{{ formatNumber(projectLists.lookCount) }}</span> <i class="el-icon-view" style="color: rgb(156 163 175);"></i><span v-if="projectLists.lookCount" style="margin-left: 5px;color: rgb(156 163 175); ">{{ formatNumber(projectLists.lookCount) }}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -39,7 +39,7 @@ export default {
name: "ProjectList", name: "ProjectList",
data(){ data(){
return{ return{
// 作答卡片颜色设置 // 颜色设置
colorlists: [ colorlists: [
'hsl(62,90%,49%)', 'hsl(62,90%,49%)',
'hsl(138,63%,59%)', 'hsl(138,63%,59%)',
@@ -63,7 +63,7 @@ export default {
computed: { computed: {
// 对时间进行格式化 // 对时间进行格式化
formatTime: function() { formatTime: function() {
if (this.projectLists) { if (this.projectLists.submitTime) {
const dt = new Date(this.projectLists.submitTime) const dt = new Date(this.projectLists.submitTime)
const year=dt.getFullYear() const year=dt.getFullYear()
const month = dt.getMonth() const month = dt.getMonth()
@@ -74,7 +74,12 @@ export default {
}, },
// 截取文章内容的前 35 个字,并加上省略号 // 截取文章内容的前 35 个字,并加上省略号
brief: function() { brief: function() {
return this.projectLists.projectDescription.substr(0, 33) + '...'; if(this.projectLists.projectDescription){
return this.projectLists.projectDescription.substr(0, 33) + '...';
}else{
return false;
}
}, },
}, },

View File

@@ -54,12 +54,12 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="评论时间"> label="评论时间">
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column-->
prop="star" <!-- prop="star"-->
show-overflow-tooltip <!-- show-overflow-tooltip-->
align="center" <!-- align="center"-->
label="项目评分"> <!-- label="项目评分">-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column <el-table-column
label="项目评分" label="项目评分"
width="200" width="200"
@@ -334,7 +334,7 @@ export default {
}, },
handleDelete(index) { handleDelete(index) {
var that=this; var that=this;
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', { this.$confirm('此操作将永久删除该评论, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'

View File

@@ -383,7 +383,7 @@ export default {
}, },
handleDelete(index) { handleDelete(index) {
var that=this; var that=this;
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', { this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'

View File

@@ -2,7 +2,7 @@
<div> <div>
<div class="HeadLine"> <div class="HeadLine">
<div class="HeadSquare"></div> <div class="HeadSquare"></div>
<div class="TitleFont">文章管理</div> <div class="TitleFont">系统管理</div>
</div> </div>
<div style="height:50px;width:100%;"></div> <div style="height:50px;width:100%;"></div>
@@ -288,7 +288,7 @@ export default {
// 删除按钮 // 删除按钮
handleDelete(index) { handleDelete(index) {
var that=this; var that=this;
this.$confirm('此操作将永久删除该用户, 是否继续?', '提示', { this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'

View File

@@ -2,10 +2,10 @@
<el-card style="border-radius: 10px;margin-top: 10px"> <el-card style="border-radius: 10px;margin-top: 10px">
<div @click="goToArticleDetail" class="UserArticle" style="display: flex;flex-direction: row;flex-wrap: nowrap;cursor: pointer"> <div @click="goToArticleDetail" class="UserArticle" style="display: flex;flex-direction: row;flex-wrap: nowrap;cursor: pointer">
<div style="width: 60px;height: 60px;display: flex;flex-direction: row;align-content: center"> <div style="width: 60px;height: 60px;display: flex;flex-direction: row;align-content: center">
<el-avatar :src="article.articleico" style="display: flex;align-items: center;justify-content: center" shape="square" :size="60"></el-avatar> <el-avatar v-if="article.articleico" :src="article.articleico" style="display: flex;align-items: center;justify-content: center" shape="square" :size="60"></el-avatar>
</div> </div>
<div style="margin-left: 10px;display: flex;flex-wrap: nowrap;flex-direction: column;"> <div style="margin-left: 10px;display: flex;flex-wrap: nowrap;flex-direction: column;">
<span style="display: flex;flex-direction: row;justify-content: flex-start;font-size: 18px;font-weight: bold;"> <span v-if="article.ArticleTitle" style="display: flex;flex-direction: row;justify-content: flex-start;font-size: 18px;font-weight: bold;">
{{article.ArticleTitle}} {{article.ArticleTitle}}
</span> </span>
<span style="font-size: 14px;color: #9ca3af;display: flex;flex-direction: row;justify-content: flex-start;flex-wrap: nowrap"> <span style="font-size: 14px;color: #9ca3af;display: flex;flex-direction: row;justify-content: flex-start;flex-wrap: nowrap">
@@ -13,15 +13,15 @@
</span> </span>
<div style="margin-top: 2.5px;display: flex;flex-direction: row;justify-content: space-between;align-content: center;align-items: center"> <div style="margin-top: 2.5px;display: flex;flex-direction: row;justify-content: space-between;align-content: center;align-items: center">
<div style="display: flex;flex-direction: row;align-content: center"> <div style="display: flex;flex-direction: row;align-content: center">
<span style="font-size: 13px;color: #9ca3af"> <span style="font-size: 13px;color: #9ca3af" v-if="article.username">
作者: {{article.username}} 作者: {{article.username}}
</span> </span>
<span style="margin-left: 10px;text-align: center;font-size: 13px;color: #9ca3af"> <span style="margin-left: 10px;text-align: center;font-size: 13px;color: #9ca3af" v-if="article.publishtime">
发布于: {{article.publishtime}} 发布于: {{article.publishtime}}
</span> </span>
</div> </div>
<div style="margin-left: 5px;align-items: center;font-size: 13px;color: #9ca3af"> <div style="margin-left: 5px;align-items: center;font-size: 13px;color: #9ca3af">
<i class="el-icon-view"></i> <span>{{formatNumber(article.ReadCount)}}</span> <i class="el-icon-view"></i> <span v-if="article.ReadCount">{{formatNumber(article.ReadCount)}}</span>
</div> </div>
</div> </div>
@@ -44,7 +44,12 @@ export default {
}, },
computed:{ computed:{
brief: function() { brief: function() {
return this.article.ArticleContent.substr(0, 48) + '...'; if (this.article.ArticleContent){
return this.article.ArticleContent.substr(0, 48) + '...';
}else{
return false;
}
}, },
}, },
methods:{ methods:{
@@ -52,12 +57,17 @@ export default {
return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num
}, },
goToArticleDetail(){ goToArticleDetail(){
this.$router.push({ if(this.article.ArticleId){
path:'/ArticleDetail', this.$router.push({
query: { path:'/ArticleDetail',
id: this.article.ArticleId, query: {
refresh: true id: this.article.ArticleId,
}}) refresh: true
}})
}else{
return false;
}
// console.log(this.$route.query.id) // console.log(this.$route.query.id)
}, },
} }

View File

@@ -2,7 +2,7 @@
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;margin-top: 10px"> <div style="display: flex;flex-direction: column;flex-wrap: nowrap;margin-top: 10px">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center;justify-content: space-between"> <div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center;justify-content: space-between">
<div> <div>
<span style="color: #4b5563;font-size: 16px"><span style="font-size: 17px;font-weight: bold">{{index+1}}</span>. {{comments.commentTime}} 发布的评论</span> <span v-if="comments.commentTime" style="color: #4b5563;font-size: 16px"><span style="font-size: 17px;font-weight: bold">{{index+1}}</span>. {{comments.commentTime}} 发布的评论</span>
</div> </div>
<div> <div>
<el-link :underline="false" style="color: red">申诉</el-link> <el-link :underline="false" style="color: red">申诉</el-link>
@@ -21,6 +21,7 @@
<span style="margin-left: 10px">评分: </span> <span style="margin-left: 10px">评分: </span>
<el-rate <el-rate
style="margin-left: 5px" style="margin-left: 5px"
v-if="comments.star"
v-model="comments.star" v-model="comments.star"
disabled disabled
score-template="{value}"> score-template="{value}">
@@ -32,7 +33,7 @@
没用过 没用过
</el-tag> </el-tag>
</div> </div>
<el-card style=";border:none;display: flex;flex-direction:row;justify-content: flex-start;margin-top: 10px"> <el-card style=";border:none;display: flex;flex-direction:row;justify-content: flex-start;margin-top: 10px" v-if="comments.content">
{{comments.content}} {{comments.content}}
</el-card> </el-card>
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;margin-top: 10px;align-items: center;justify-content: space-between"> <div style="display: flex;flex-direction: row;flex-wrap: nowrap;margin-top: 10px;align-items: center;justify-content: space-between">
@@ -46,7 +47,7 @@
<span v-if="comments.likeNum<200" style="margin-left: 8px">非热评</span> <span v-if="comments.likeNum<200" style="margin-left: 8px">非热评</span>
<span style="margin-left: 8px"></span> <span style="margin-left: 8px"></span>
<span style="margin-left: 8px">点赞</span> <span style="margin-left: 8px">点赞</span>
<span style="margin-left: 8px">{{comments.likeNum}}</span> <span v-if="comments.likeNum" style="margin-left: 8px">{{comments.likeNum}}</span>
</div> </div>
</div> </div>
</div> </div>
@@ -71,7 +72,7 @@ export default {
}, },
computed:{ computed:{
formatTime: function() { formatTime: function() {
if (this.comments) { if (this.comments.commentTime) {
const dt = new Date(this.comments.commentTime) const dt = new Date(this.comments.commentTime)
const year=dt.getFullYear() const year=dt.getFullYear()
const month = dt.getMonth() const month = dt.getMonth()
@@ -83,11 +84,16 @@ export default {
}, },
methods:{ methods:{
toCommentDeatil(){ toCommentDeatil(){
this.$router.push({ if(this.comments.projectId){
path:'/ProjectDetail', this.$router.push({
query: { path:'/ProjectDetail',
id: this.comments.projectId, refresh: true query: {
}}) id: this.comments.projectId, refresh: true
}})
}else{
return false;
}
} }
}, },
} }

View File

@@ -10,15 +10,15 @@
</div> </div>
</div> </div>
<el-switch v-model="switchValue" style=""> <!-- <el-switch v-model="switchValue" style="">-->
</el-switch> <!-- </el-switch>-->
</div> </div>
<div style="display: flex;flex-direction: row;margin-top: 10px;justify-content: space-between;align-items: center"> <div style="display: flex;flex-direction: row;margin-top: 10px;justify-content: space-between;align-items: center">
<span style="font-size: 10px;color: #9ca3af">贡献值</span> <span style="font-size: 10px;color: #9ca3af">贡献值</span>
<span style="font-weight: bold;color: #59A3A4;font-size: 20px">{{ContributionValue}}/100</span> <span v-if="ContributionValue" style="font-weight: bold;color: #59A3A4;font-size: 20px">{{ContributionValue}}/100</span>
</div> </div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<el-progress :text-inside="true" :stroke-width="15" :percentage="ContributionValue"></el-progress> <el-progress v-if="ContributionValue" :text-inside="true" :stroke-width="15" :percentage="ContributionValue"></el-progress>
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
<div style="display: flex;align-items: center;justify-content: space-between;flex-direction: row;flex-wrap: nowrap;"> <div style="display: flex;align-items: center;justify-content: space-between;flex-direction: row;flex-wrap: nowrap;">

View File

@@ -19,7 +19,7 @@
</div> </div>
<div style="display: flex;flex-direction: column;margin-left: 15px;"> <div style="display: flex;flex-direction: column;margin-left: 15px;">
<div style="display: flex;flex-direction: row;align-items: center;justify-content: flex-start;"> <div style="display: flex;flex-direction: row;align-items: center;justify-content: flex-start;">
<span style="font-size: 20px;font-weight: bold;">{{username}}</span> <span style="font-size: 20px;font-weight: bold;" v-if="username">{{username}}</span>
<span style="font-size: 15px;font-weight: bold;color: #3b82f6;margin-left: 10px">Lv.{{userLevel}}</span> <span style="font-size: 15px;font-weight: bold;color: #3b82f6;margin-left: 10px">Lv.{{userLevel}}</span>
</div> </div>
<span style="display: flex;justify-content:flex-start;margin-top: 10px;color: #6b7280;font-size: 15px">你是 HelloGitHub 社区的第<span style="font-size: 16px;color:#2b2e33;font-weight: bold "> {{userId}} </span>位用户 {{creatTime}} 加入</span> <span style="display: flex;justify-content:flex-start;margin-top: 10px;color: #6b7280;font-size: 15px">你是 HelloGitHub 社区的第<span style="font-size: 16px;color:#2b2e33;font-weight: bold "> {{userId}} </span>位用户 {{creatTime}} 加入</span>
@@ -35,7 +35,7 @@
<span v-if="contributionValue!=null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">{{contributionValue}}</span> <span v-if="contributionValue!=null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">{{contributionValue}}</span>
<span v-if="contributionValue==null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">0</span> <span v-if="contributionValue==null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">0</span>
点贡献值. 点贡献值.
<span style="font-size: 16px;color:#2b2e33;font-weight: bold "> <span style="font-size: 16px;color:#2b2e33;font-weight: bold " v-if="article">
{{Object.keys(article).length}} {{Object.keys(article).length}}
</span> </span>
篇文章 篇文章
@@ -194,42 +194,52 @@ export default {
window.history.go(-1); window.history.go(-1);
}, },
getUserInfo(){ getUserInfo(){
var that=this; if(this.$route.query.name){
axios({ var that=this;
method: 'post', axios({
// 请求的地址 method: 'post',
url: 'http://localhost:8082/helloGithub_war_exploded/retUser', // 请求的地址
// URL 中的查询参数 url: 'http://localhost:8082/helloGithub_war_exploded/retUser',
params: { // URL 中的查询参数
username:this.$route.query.name params: {
} username:this.$route.query.name
}).then(function (res) { }
that.username=res.data.userName; }).then(function (res) {
that.contributionValue=res.data.contributionValue; that.username=res.data.userName;
that.creatTime=res.data.creatTime; that.contributionValue=res.data.contributionValue;
that.projectNum=res.data.projectNum; that.creatTime=res.data.creatTime;
that.userId=res.data.userId; that.projectNum=res.data.projectNum;
// that.imageUrl=res.data.userAvatar; that.userId=res.data.userId;
that.userLevel=res.data.userLevel; // that.imageUrl=res.data.userAvatar;
}); that.userLevel=res.data.userLevel;
});
}else {
return false;
}
}, },
getUserDetail(){ getUserDetail(){
var that=this; if(this.$route.query.name){
axios({ var that=this;
method: 'post', axios({
// 请求的地址 method: 'post',
url: 'http://localhost:8082/helloGithub_war_exploded/userDetail', // 请求的地址
// URL 中的查询参数 url: 'http://localhost:8082/helloGithub_war_exploded/userDetail',
params: { // URL 中的查询参数
username:this.$route.query.name params: {
} username:this.$route.query.name
}).then(function (res) { }
// console.log(res); }).then(function (res) {
that.projectList=JSON.parse(res.data.project); // console.log(res);
that.commentList=JSON.parse(res.data.comment); that.projectList=JSON.parse(res.data.project);
that.like=JSON.parse(res.data.like) that.commentList=JSON.parse(res.data.comment);
that.article=JSON.parse(res.data.article); that.like=JSON.parse(res.data.like)
}); that.article=JSON.parse(res.data.article);
});
}else {
return false;
}
}, },
updateUserLevel(){ updateUserLevel(){
if(this.$cookie.get("username")!=null){ if(this.$cookie.get("username")!=null){
@@ -238,9 +248,6 @@ export default {
// 请求的地址 // 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/levelup', url: 'http://localhost:8082/helloGithub_war_exploded/levelup',
// URL 中的查询参数 // URL 中的查询参数
params: {
}
}); });
}else{ }else{
return; return;

View File

@@ -2,24 +2,24 @@
<el-card style="border-radius: 15px;margin-top: 10px"> <el-card style="border-radius: 15px;margin-top: 10px">
<div @click="toProjectDetail" class="userProjects" style="cursor: pointer;display: flex;flex-direction: row;flex-wrap: nowrap"> <div @click="toProjectDetail" class="userProjects" style="cursor: pointer;display: flex;flex-direction: row;flex-wrap: nowrap">
<div style="width: 80px;height: 80px;display: flex;align-items: center"> <div style="width: 80px;height: 80px;display: flex;align-items: center">
<el-avatar :size="80" :src="project.projectIco" shape="square"></el-avatar> <el-avatar :size="80" v-if="project.projectIco" :src="project.projectIco" shape="square"></el-avatar>
</div> </div>
<div style=";margin-left:10px;display: flex;flex-direction: column;flex-wrap: nowrap"> <div style=";margin-left:10px;display: flex;flex-direction: column;flex-wrap: nowrap">
<div style="margin-left: 10px;display: flex;flex-direction: row;justify-content: flex-start"> <div style="margin-left: 10px;display: flex;flex-direction: row;justify-content: flex-start">
<span style="font-size: 16px;font-weight: bold">{{project.projectName}}</span> <span v-if="project.projectName" style="font-size: 16px;font-weight: bold">{{project.projectName}}</span>
</div> </div>
<div style="margin-top: 10px;margin-left: 10px;"> <div style="margin-top: 10px;margin-left: 10px;">
<span style="display: flex;flex-direction: row;justify-content:flex-start;text-align: left;font-size: 16px;color: #9ca3af">{{brief}}</span> <span style="display: flex;flex-direction: row;justify-content:flex-start;text-align: left;font-size: 16px;color: #9ca3af">{{brief}}</span>
</div> </div>
<div style=" margin-left: 10px;;margin-top: 10px;display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center"> <div style=" margin-left: 10px;;margin-top: 10px;display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center">
<div :style="{'background-color':colorlists[Math.floor(Math.random() * colorlists.length)]}" style="width: 10px;height: 10px;background-color: #42b983;border-radius: 50px"></div> <div :style="{'background-color':colorlists[Math.floor(Math.random() * colorlists.length)]}" style="width: 10px;height: 10px;background-color: #42b983;border-radius: 50px"></div>
<el-tag size="mini" style="margin-left: 5px;border-radius: 10px"> <el-tag v-if="project.categoryName" size="mini" style="margin-left: 5px;border-radius: 10px">
{{project.categoryName}} {{project.categoryName}}
</el-tag> </el-tag>
<span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span> <span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span>
<span style="margin-left: 5px;font-size: 14px;color: #9ca3af">{{ formatNumber(project.lookCount) }}</span> <span v-if="project.lookCount" style="margin-left: 5px;font-size: 14px;color: #9ca3af">{{ formatNumber(project.lookCount) }}</span>
<span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span> <span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span>
<span style="margin-left: 5px;font-size: 14px;color: #9ca3af">{{project.submitTime}} <span v-if="project.submitTime" style="margin-left: 5px;font-size: 14px;color: #9ca3af">{{project.submitTime}}
</span><span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span> </span><span style="margin-left: 5px;font-size: 14px;color: #9ca3af"></span>
<span v-show="project.isValid===0" style="margin-left: 5px;font-size: 14px;color: #ffca00">待审核</span> <span v-show="project.isValid===0" style="margin-left: 5px;font-size: 14px;color: #ffca00">待审核</span>
<span v-show="project.isValid===1" style="margin-left: 5px;font-size: 14px;color: #48d04e">已通过</span> <span v-show="project.isValid===1" style="margin-left: 5px;font-size: 14px;color: #48d04e">已通过</span>
@@ -57,7 +57,12 @@ export default {
}, },
computed:{ computed:{
brief:function(){ brief:function(){
return this.project.projectDescription.substr(0, 38) + '...'; if(this.project.projectDescription){
return this.project.projectDescription.substr(0, 38) + '...';
}else{
return false;
}
}, },
}, },
methods:{ methods:{
@@ -65,11 +70,16 @@ export default {
return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num
}, },
toProjectDetail(){ toProjectDetail(){
this.$router.push({ if(this.project.projectId){
path:'/ProjectDetail', this.$router.push({
query: { path:'/ProjectDetail',
id: this.project.projectId, refresh: true query: {
}}) id: this.project.projectId, refresh: true
}})
}else {
return false;
}
} }
} }