@@ -369,17 +365,19 @@ export default {
license:null,
name:'',
default_branch:null,
+ avatar_url:null,
},
totalStar:3.7,
Content:'',
imageUrl:'',
+ fileAddress:null,
}
},
mounted() {
this.getProjectDetail();
this.getLastComment();
this.isStart();
- this.getUserInfo();
+ // this.getUserInfo();
},
watch: {
@@ -399,6 +397,15 @@ export default {
}
})
},
+ toUserPage2(username) {
+ this.$router.push({
+ path: '/UserInfoPage',
+ query: {
+ name: username,
+ refresh: true
+ }
+ })
+ },
toComment(id){
document.querySelector(id).scrollIntoView(true)
var auchor=this.$el.querySelector(id)
@@ -422,7 +429,6 @@ export default {
id:this.$route.query.id
}
}).then(function (res) {
- // console.log(res);
that.CategoryName=res.data.CategoryName;
that.projectName=res.data.project.projectName;
that.projectTitle=res.data.project.projectTitle;
@@ -436,9 +442,10 @@ export default {
that.num=res.data.project.num;
that.average=res.data.project.average;
that.username=res.data.project.username;
- that.userUri=res.data.project.userUri;
-
+ that.fileAddress=res.data.project.fileAddress;
+ // that.userUri=res.data.project.userUri;
that.getDetailByGitHub();
+ that.changeAvatarByLocal();
});
},
reload() {
@@ -526,27 +533,25 @@ export default {
formatNumber(num) {
return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num
},
- getUserInfo() {
- var that = this;
- if(this.$cookie.get("username")!=null){
- axios({
- method: 'post',
- // 请求的地址
- url: 'http://localhost:8082/helloGithub_war_exploded/retUser',
- // URL 中的查询参数
- params: {
- username: this.$cookie.get("username")
- }
- }).then(function (res) {
- that.imageUrl = res.data.userAvatar;
- // console.log(res);
- });
- }else{
- return;
- }
-
-
- },
+ // getUserInfo() {
+ // var that = this;
+ // if(this.$cookie.get("username")!=null){
+ // axios({
+ // method: 'post',
+ // // 请求的地址
+ // url: 'http://localhost:8082/helloGithub_war_exploded/retUser',
+ // // URL 中的查询参数
+ // params: {
+ // username: this.$cookie.get("username")
+ // }
+ // }).then(function (res) {
+ // that.imageUrl = res.data.userAvatar;
+ // // console.log(res);
+ // });
+ // }else{
+ // return;
+ // }
+ // },
addLike(id){
var that=this;
@@ -704,6 +709,8 @@ export default {
that.github.license=res.data.license.spdx_id;
that.github.name=res.data.name;
that.github.default_branch=res.data.default_branch;
+ that.github.avatar_url=res.data.owner.avatar_url;
+ that.saveGithubInfo();
});
},
@@ -723,6 +730,67 @@ export default {
});
},
+ saveGithubInfo(){
+ axios({
+ method: 'post',
+ // 请求的地址
+ url: 'http://localhost:8082/helloGithub_war_exploded/insertGithubInfo',
+ // URL 中的查询参数
+ params: {
+ projectId:this.$route.query.id,
+ avatar:this.github.avatar_url,
+ name:this.github.name,
+ starImgUrl:'https://starchart.cc/'+this.projectName+'.svg',
+ starCount:this.github.starNum,
+ mainLanguage:this.github.language,
+ isActive:this.github.allow_forking,
+ subscriber:this.github.subscribers_count,
+ issues:this.github.open_issues_count,
+ isOrganization:this.github.organization,
+ defaultBranch:this.github.default_branch,
+ forks:this.github.forks_count,
+ protocol:this.github.license,
+ version:'0',
+ }
+ })
+ },
+
+ changeAvatarByLocal(){
+ var that=this;
+ axios({
+ method: 'post',
+ // 请求的地址
+ url: '/api/retUserAv',
+ // URL 中的查询参数
+ params:{
+ username:this.username,
+ },
+ responseType:'blob'
+ }).then((res)=>{
+ that.imageUrl = window.URL.createObjectURL(res.data)//这里也是关键,调用window的这个方法URL方法
+ })
+
+ },
+ Download(){
+ window.open('http://localhost:8082/helloGithub_war_exploded/DownLoad?id='+this.$route.query.id);
+ // axios({
+ // method: 'post',
+ // // 请求的地址
+ // url: '/api/DownLoad',
+ // // URL 中的查询参数
+ // params:{
+ // id:this.$route.query.id,
+ // },
+ // responseType: 'blob'
+ // }).then(()=>{
+ // Vue.prototype.$notify({
+ // title: '提示',
+ // message: "请等待下载执行",
+ // offset: 50,
+ // type:"success"
+ // });
+ // })
+ }
},
diff --git a/src/components/Project/ProjectPublish.vue b/src/components/Project/ProjectPublish.vue
deleted file mode 100644
index d38b419..0000000
--- a/src/components/Project/ProjectPublish.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/System/AdminLogin.vue b/src/components/System/AdminLogin.vue
new file mode 100644
index 0000000..f2c133f
--- /dev/null
+++ b/src/components/System/AdminLogin.vue
@@ -0,0 +1,24 @@
+
+
+ 666
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/User/UserComments.vue b/src/components/User/UserComments.vue
index 55642d5..2b566e7 100644
--- a/src/components/User/UserComments.vue
+++ b/src/components/User/UserComments.vue
@@ -13,7 +13,7 @@
- {{ this.$cookie.get('username') }}
+ {{ this.$cookie.get('username') }}
@@ -61,7 +61,8 @@ export default {
name: "UserComments",
props:{
comments:Object,
- index:Number
+ index:Number,
+
},
data(){
return{
diff --git a/src/components/User/UserInfo.vue b/src/components/User/UserInfo.vue
index e6ed346..72a5f1f 100644
--- a/src/components/User/UserInfo.vue
+++ b/src/components/User/UserInfo.vue
@@ -3,7 +3,7 @@
-
{{this.$cookie.get('username')}}
+
{{this.$cookie.get('username')}}
{{this.$cookie.get('username')}}
Lv.{{userLevel}}
@@ -156,6 +156,21 @@ export default {
return;
}
},
+ // changeAvatarByLocal(){
+ // var that=this;
+ // axios({
+ // method: 'post',
+ // // 请求的地址
+ // url: '/api/retUserAv',
+ // // URL 中的查询参数
+ // params:{
+ // username:this.$cookie.get('username'),
+ // },
+ // responseType:'blob'
+ // }).then((res)=>{
+ // that.imageUrl = window.URL.createObjectURL(res.data)//这里也是关键,调用window的这个方法URL方法
+ // })
+ // },
}
}
diff --git a/src/components/User/UserInfoPage.vue b/src/components/User/UserInfoPage.vue
index 109fc5a..38957ae 100644
--- a/src/components/User/UserInfoPage.vue
+++ b/src/components/User/UserInfoPage.vue
@@ -15,7 +15,7 @@
-
+
@@ -104,13 +104,13 @@
append-to-body
:close-on-click-modal="false"
>
-
选择一种方式即可!
-
-
- url:
-
- 上传
-
+
+
+
+
+
+
+
将文件拖到此处,或点击上传
只能上传jpg/png文件。
-
-
-
-
+
@@ -158,8 +155,8 @@ export default {
like:[],
article:[],
openChangeAvatar:false,
- AvatarUrl:'',
- imageUrl:'http://localhost:8082/helloGithub_war_exploded/retUserAv',
+ // AvatarUrl:'',
+ // imageUrl:'',
userLevel:null,
}
},
@@ -253,49 +250,49 @@ export default {
}
},
changeAvatar(){
- if(this.$route.query.name!==this.$cookie.get('username')){
+ if(this.$route.query.name!==this.$cookie.get('username')||this.$cookie.get('username')===null){
return;
}else{
this.openChangeAvatar=true;
}
},
- changeAvatarByUrl(){
- if(this.AvatarUrl!==''){
- axios({
- method: 'post',
- // 请求的地址
- url: 'http://localhost:8082/helloGithub_war_exploded/userAvatar',
- // URL 中的查询参数
- params: {
- url: this.AvatarUrl
- }
- }).then(function (res) {
- if(res.data.code===200){
- Vue.prototype.$notify({
- title: '上传成功',
- message: ('i', {style: 'color: teal'}, res.data.msg),
- type: 'success',
- offset: 50
- });
- }else{
- Vue.prototype.$notify.error({
- title: '错误',
- message: "上传失败",
- offset: 50
- });
- }
-
- });
- }else{
- Vue.prototype.$notify.error({
- title: '错误',
- message: "请先填写图片链接",
- offset: 50
- });
- }
-
- },
+ // changeAvatarByUrl(){
+ // if(this.AvatarUrl!==''){
+ // axios({
+ // method: 'post',
+ // // 请求的地址
+ // url: 'http://localhost:8082/helloGithub_war_exploded/userAvatar',
+ // // URL 中的查询参数
+ // params: {
+ // url: this.AvatarUrl
+ // }
+ // }).then(function (res) {
+ // if(res.data.code===200){
+ // Vue.prototype.$notify({
+ // title: '上传成功',
+ // message: ('i', {style: 'color: teal'}, res.data.msg),
+ // type: 'success',
+ // offset: 50
+ // });
+ // }else{
+ // Vue.prototype.$notify.error({
+ // title: '错误',
+ // message: "上传失败",
+ // offset: 50
+ // });
+ // }
+ //
+ // });
+ // }else{
+ // Vue.prototype.$notify.error({
+ // title: '错误',
+ // message: "请先填写图片链接",
+ // offset: 50
+ // });
+ // }
+ //
+ // },
upload(params){
var that=this;
@@ -326,24 +323,30 @@ export default {
offset: 50
});
that.openChangeAvatar=false;
+ setTimeout(()=>{
+ window.location.reload();
+ },500)
+
}
})
},
- changeAvatarByLocal(){
- var that=this;
- axios({
- method: 'post',
- // 请求的地址
- url: '/api/retUserAv',
- // URL 中的查询参数
- responseType: 'blob',
-
- }).then((res)=>{
-
- })
-
- },
+ // changeAvatarByLocal(){
+ // var that=this;
+ // axios({
+ // method: 'post',
+ // // 请求的地址
+ // url: '/api/retUserAv',
+ // // URL 中的查询参数
+ // params:{
+ // username:this.username,
+ // },
+ // responseType:'blob'
+ // }).then((res)=>{
+ // that.imageUrl = window.URL.createObjectURL(res.data)//这里也是关键,调用window的这个方法URL方法
+ // })
+ //
+ // },
}
diff --git a/src/router/index.js b/src/router/index.js
index 7ba281d..b18b00c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -10,6 +10,7 @@ import MonthlyByTags from "@/components/Monthly/MonthlyByTags.vue";
import UserInfoPage from "@/components/User/UserInfoPage.vue";
import ProjectDetail from "@/components/Project/ProjectDetail.vue";
import ArticleDetail from "@/components/Paper/ArticleDetail.vue";
+import adminLogin from "@/components/System/AdminLogin.vue";
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
@@ -73,11 +74,19 @@ const routes = [
component: ArticleDetail
},
]
+ },
+ {
+ path: '/adminLogin',
+ name: 'adminLogin',
+ component: adminLogin
}
+
+
]
const router = new VueRouter({
+ mode:'history',
routes
})
diff --git a/vue.config.js b/vue.config.js
index e7aa9ef..be33294 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -56,6 +56,22 @@ module.exports = {
'^/api': ''
}
},
+ '/image': {
+ //后端接口的baseurl
+ target: 'https://tucdn.wpon.cn/api/',
+ //是否允许跨域
+ changeOrigin: true,
+ // ws: true, //是否代理 websockets
+ // secure: true,
+ // 'secure': true,
+ headers:{
+ Connection:"kepp-alive"
+ },
+ pathRewrite: {
+ //这里的作用是使用去掉api
+ '^/image': ''
+ }
+ },
}
}
}