This commit is contained in:
2023-07-11 19:47:37 +08:00
parent 492bc4894d
commit 0600bc4a0d
13 changed files with 665 additions and 214 deletions

32
package-lock.json generated
View File

@@ -17,8 +17,10 @@
"form-data": "^4.0.0",
"fs": "^0.0.1-security",
"json-server": "^0.17.3",
"prismjs": "^1.29.0",
"vue": "^2.6.14",
"vue-cookie": "^1.1.4",
"vue-prism-editor": "^1.3.0",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"vxe-table": "^3.6.13"
@@ -11540,6 +11542,14 @@
"renderkid": "^3.0.0"
}
},
"node_modules/prismjs": {
"version": "1.29.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
"engines": {
"node": ">=6"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -14455,6 +14465,17 @@
"node": ">=8"
}
},
"node_modules/vue-prism-editor": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/vue-prism-editor/-/vue-prism-editor-1.3.0.tgz",
"integrity": "sha512-54RfgtMGRMNr9484zKMOZs1wyLDR6EfFylzE2QrMCD9alCvXyYYcS0vX8oUHh+6pMUu6ts59uSN9cHglpU2NRQ==",
"engines": {
"node": ">=10"
},
"peerDependencies": {
"vue": "^2.6.11"
}
},
"node_modules/vue-property-decorator": {
"version": "8.5.1",
"resolved": "https://registry.npmmirror.com/vue-property-decorator/-/vue-property-decorator-8.5.1.tgz",
@@ -24155,6 +24176,11 @@
"renderkid": "^3.0.0"
}
},
"prismjs": {
"version": "1.29.0",
"resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz",
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q=="
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -26420,6 +26446,12 @@
}
}
},
"vue-prism-editor": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/vue-prism-editor/-/vue-prism-editor-1.3.0.tgz",
"integrity": "sha512-54RfgtMGRMNr9484zKMOZs1wyLDR6EfFylzE2QrMCD9alCvXyYYcS0vX8oUHh+6pMUu6ts59uSN9cHglpU2NRQ==",
"requires": {}
},
"vue-property-decorator": {
"version": "8.5.1",
"resolved": "https://registry.npmmirror.com/vue-property-decorator/-/vue-property-decorator-8.5.1.tgz",

View File

@@ -17,8 +17,10 @@
"form-data": "^4.0.0",
"fs": "^0.0.1-security",
"json-server": "^0.17.3",
"prismjs": "^1.29.0",
"vue": "^2.6.14",
"vue-cookie": "^1.1.4",
"vue-prism-editor": "^1.3.0",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"vxe-table": "^3.6.13"

View File

@@ -126,8 +126,8 @@
<el-checkbox style="margin-top: 20px" v-for="(tag,index) in tags" :key="index" v-html="tag.category" border size="medium"></el-checkbox>
</el-checkbox-group>
</el-card>
<el-card class="box-card">
总共:
<el-card class="box-card" style="margin-top: 10px">
总共: {{tags.length}}
</el-card>
</el-dialog>
<el-backtop target=".main" :visibility-height="20" :right="10" :bottom="10"></el-backtop>
@@ -159,7 +159,7 @@ export default {
loading: false,
loginDialogVisible: false,
manageCategoryVisible:false,
tags:null,
tags:[],
};
},
mounted() {
@@ -202,7 +202,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectLastByCate',
url: '/api/selectLastByCate',
// URL 中的查询参数
params: {
num: "0",
@@ -216,7 +216,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectMostStar',
url: '/api/selectMostStar',
// URL 中的查询参数
params: {
num: index,
@@ -248,7 +248,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectLastByCate',
url: '/api/selectLastByCate',
// URL 中的查询参数
params: {
num: index,
@@ -274,7 +274,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/retLabel',
url: '/api/retLabel',
// URL 中的查询参数
params: {
}
@@ -289,7 +289,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/userNum',
url: '/api/userNum',
// URL 中的查询参数
params: {
}
@@ -302,7 +302,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/countNum',
url: '/api/countNum',
// URL 中的查询参数
params: {

View File

@@ -239,11 +239,11 @@ export default {
// this.$refs.NextBtn.style.display = "none"
// }
},
test(){
console.log(this.MonType);
console.log(this.MonTypePro);
console.log(this.MonList);
},
// test(){
// console.log(this.MonType);
// console.log(this.MonTypePro);
// console.log(this.MonList);
// },
// 月刊总数:
getMonely(){
var that = this;
@@ -273,7 +273,7 @@ export default {
Object.keys(that.MonList).forEach(key=>{
that.MonTypePro.push(that.MonList[key]);
})
console.log(that.MonList);
// console.log(that.MonTypePro);
})
},
// 月刊详情页面跳转

View File

@@ -19,9 +19,10 @@
<div style="margin-top: 20px">
<template>
<el-table
@row-click="toDetailPage"
border
:data="tableData"
style="width: 100%;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);border-radius: 10px;border: none">
style="cursor: pointer;width: 100%;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);border-radius: 10px;border: none">
<el-table-column
prop="name"
label="名称"
@@ -30,7 +31,7 @@
<el-table-column
prop="language"
label="语言"
width="130">
width="100">
</el-table-column>
<el-table-column
prop="description"
@@ -41,12 +42,46 @@
</div>
<el-card style="border: none;margin-top: 20px">
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;justify-content: flex-start;text-align: left">
<b>OneFile:</b><span>一个开源项目在这里你可以找到有趣运行简单的程序同时它也是一个编程挑战你也可以提交一个文件接受挑战<el-link><b>点击加入</b></el-link> OneFile 编程挑战一个文件而已就写点有趣的代码吧</span>
<b>OneFile:</b><span>一个开源项目在这里你可以找到有趣运行简单的程序同时它也是一个编程挑战你也可以提交一个文件接受挑战快点加入OneFile 编程挑战一个文件而已就写点有趣的代码吧</span>
</div>
<div style="display: flex;flex-direction: row;justify-content: flex-end">
<el-button plain size="small" @click="openSubmit">提交</el-button>
</div>
</el-card>
</el-card>
<el-dialog title="提交" :visible.sync="dialogVisible" width="46%"
append-to-body
:close-on-click-modal="false"
>
<el-form ref="ruleForm" class="login_container" :model="form" :rules="rules" status-icon label-width="60px">
<el-form-item label="名称" prop="oneFileName">
<el-input v-model="form.oneFileName" placeholder='取个名字吧'></el-input>
</el-form-item>
<el-form-item label="地址" prop="url">
<el-input v-model="form.url" placeholder='地址url'></el-input>
</el-form-item>
<el-form-item label="描述" prop="description" >
<el-input v-model="form.description" placeholder='一句话描述一下' clearable></el-input>
</el-form-item>
<el-form-item label="内容" prop="Content" >
<el-input v-model="form.Content"
type="textarea"
rows="10"
placeholder='代码内容'
clearable></el-input>
</el-form-item>
<el-form-item label="语言" prop="language" >
<el-input v-model="form.language" placeholder='语言种类' clearable></el-input>
</el-form-item>
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: flex-end">
<el-button @click="submit()" type="primary" style=";margin-top:10px">提交</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</div>
<RightTools></RightTools>
@@ -55,36 +90,91 @@
<script>
import RightTools from "@/components/Home/RightTools.vue";
import axios from "axios";
import Vue from "vue";
export default {
name: "OneFile",
components: {RightTools},
data(){
return{
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}]
tableData: [],
dialogVisible:false,
form:{
oneFileName:'',
language:'',
description:'',
url:'',
Content:'',
},
rules: {
oneFileName: [
// required规则o失去焦点触发
{required: true, message: "请输入名称", trigger: "blur"},
],
language: [{required: true, message: "请输入语言", trigger: "blur"}],
description: [{required: true, message: "请输入描述", trigger: "blur"}],
Content: [{required: true, message: "请输入内容", trigger: "blur"}],
},
}
},
methods:{
openSubmit(){
this.dialogVisible=true;
},
submit(){
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/insertFileByAdmin',
// URL 中的查询参数
params: this.form,
}).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: res.data.msg,
offset: 50
});
}
})
},
goBack() {
window.history.go(-1);
},
}
toDetailPage(row){
this.$router.push({
path:'/OneFileDetail',
query: {
id: row.id,
refresh: true
}})
},
getOneFile(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectFile',
// URL 中的查询参数
params: {
}
}).then(function (res) {
that.tableData=res.data;
})
}
},
mounted() {
this.getOneFile();
},
}
</script>

View File

@@ -13,11 +13,43 @@
<div class="PageContent" style="display: flex;flex-direction: column;flex-wrap: nowrap">
<el-card style="border: none">
<div style="display: flex;flex-direction: column;flex-wrap: nowrap;">
<el-card style="box-shadow: none;border-radius: 5px">
<el-card style="box-shadow: none;border-radius: 10px">
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center">
<span style="font-size: 18px;color: #6b7280;font-weight: bold">
{{oneFileName}} :
</span>
<span style="font-size: 16px;color: #6b7280;font-weight: bold">
{{description}}
</span>
</div>
<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;">
<span>发布于: </span>
<span>{{userName}}</span>
<span> · </span>
<span> 主语言 {{language}}</span>
<span> · </span>
<span> {{formatNumber(lookNum)}} </span>
<span> 次查看 </span>
</div>
<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 plain icon="el-icon-document-copy" size="mini" @click="copyText">复制</el-button>
</div>
</div>
</el-card>
<el-card style="box-shadow: none;margin-top: 20px;border-radius: 5px">
<el-card style="box-shadow: none;margin-top: 20px;border-radius: 10px">
<PrismEditor
class="my-editor height-300"
v-model="content"
aria-disabled
:highlight="highlighter"
line-numbers
:readonly="true"
autoStyleLineNumbers
:tabSize="4"
></PrismEditor>
</el-card>
</div>
@@ -30,20 +62,112 @@
<script>
import RightTools from "@/components/Home/RightTools.vue";
import axios from "axios";
import { PrismEditor } from "vue-prism-editor";
import "vue-prism-editor/dist/prismeditor.min.css";
import { highlight, languages } from "prismjs/components/prism-core";
import "prismjs/components/prism-clike";
import "prismjs/components/prism-javascript";
import "prismjs/themes/prism-tomorrow.css";
import Vue from "vue";
export default {
name: "OneFileDetail",
components: {RightTools},
components: {RightTools,PrismEditor},
data(){
return{
id:'',
oneFileName:'',
language:'',
description:'',
userId:'',
url:'',
lookNum:'',
content:'',
isValid:'',
userName:'',
}
},
methods:{
copyText() {
let text = this.content;
let inputElement = document.createElement('input')
inputElement.value = text;
document.body.appendChild(inputElement);
inputElement .select(); //选中文本
document.execCommand("copy"); //执行浏览器复制命令
inputElement.remove();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "复制成功"),
type: 'success',
offset: 50
});
},
highlighter(code) {
return highlight(code, languages.js); //returns html
},
formatNumber(num) {
return num >= 1e3 && num < 1e4 ? (num / 1e3).toFixed(1) + 'k' : num >= 1e4 ? (num / 1e4).toFixed(1) + 'w' : num
},
goBack() {
window.history.go(-1);
},
}
addLookCount(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/addFileLookCount',
// URL 中的查询参数
params: {
id:this.$route.query.id
}
});
},
getOneFileDetail(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/selectFileById',
// URL 中的查询参数
params: {
id:this.$route.query.id
}
}).then(function (res) {
console.log(res);
that.id=res.data.id;
that.language=res.data.language;
that.lookNum=res.data.lookNum;
that.oneFileName=res.data.oneFileName;
that.url=res.data.url;
that.userId=res.data.userId;
that.description=res.data.description;
that.content=res.data.content;
that.userName=res.data.userName;
})
},
goTo(url){
window.open(url);
},
},
mounted() {
this.getOneFileDetail();
},
created() {
this.addLookCount();
},
watch: {
$route () {
if(this.$route.query.refresh){
this.getOneFileDetail() //重新调用http请求实现页面的重新渲染
}
}
},
}
</script>
@@ -60,4 +184,19 @@ export default {
border-right: none;
}
}
/* required class */
::v-deep .my-editor {
background: transparent;
color: #ccc;
font-family: Fira code, Fira Mono, Consolas, Menlo, Courier, monospace;
font-size: 14px;
line-height: 1.5;
padding: 5px;
}
/* optional */
::v-deep .prism-editor__textarea:focus {
outline: none;
}
</style>

View File

@@ -174,7 +174,7 @@
<el-rate
style="margin-left: 10px"
v-model="startValue"
show-text>
>
</el-rate>
</div>
<el-button type="primary" plain @click="publishComment">发布</el-button>
@@ -724,7 +724,11 @@ export default {
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();
if(that.$route.query.id){
that.saveGithubInfo();
}else{
return false;
}
return true;
}else{
return false;

View File

@@ -26,7 +26,7 @@
</div>
<div style="margin-top: 20px">
<el-card class="box-card" style="border: none">
<div ref="echart1" style="width:300px;height:300px">
<div id="echart1" ref="echart1" style="width:350px;height:300px;">
</div>
</el-card>
@@ -156,17 +156,10 @@
</div>
<!-- eChart -->
<div style="margin-top: 23px;margin-left: 40px;">
<el-card style="border: none;height:450px">
<!-- <el-tabs v-model="activeName" @tab-click="handleClick">-->
<!-- <el-tab-pane label="日期统计" name="first">日期统计</el-tab-pane>-->
<!-- <el-tab-pane label="月度统计" name="second">月度统计</el-tab-pane>-->
<!-- <el-tab-pane label="年度统计" name="third">年度统计</el-tab-pane>-->
<!-- </el-tabs>-->
<div ref="echart2" style="width: 20vw;height: 30vh">
<el-card style="border: none;">
<div id="echart2" ref="echart2" style="width: 800px;height: 300px;">
</div>
</el-card>
<el-button @click="test()"></el-button>
</div>
</div>
</div>
@@ -183,10 +176,7 @@ Vue.prototype.$echarts = echarts;
export default {
data() {
return {
Myechart1:'',
Myechart2:'',
Myoption1:{},
Myoption2:{},
activeName: 'first',
userTotal:null,
projectTotal:null,
loginTime:'',
@@ -194,33 +184,20 @@ export default {
CategoryTotal:'',
CommentTotal:'',
AdminTotal:'',
// 日期目录:
datecate:[],
// 月份目录:
Moncate:[],
// 年份目录:
Yearcate:[],
// 日期折线单元:
dateLine:[],
// 月份折线单元:
monLine:[],
// 年份折线单元:
yearLine:[],
date:[],
dateNum:[],
Month:[],
MonthNum:[],
Year:[],
YearNum:[],
categoryArray:[],
}
},
methods: {
initEchart(){
// var that = this;
// that.Myechart1 = that.$echarts.init(that.$refs.echart1);
// that.Myechart2 = that.$echarts.init(that.$refs.echart2);
},
test(){
this.getProjectByTime();
},
getAdminLoginTime(){
var that=this;
axios({
@@ -240,7 +217,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/userNum',
url: '/api/userNum',
// URL 中的查询参数
params: {
}
@@ -259,7 +236,6 @@ export default {
}
}).then((res)=>{
that.projectTotal=res.data;
console.log(that.projectTotal);
});
},
getArticleTotal(){
@@ -320,121 +296,261 @@ export default {
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/retProjectByTime',
// URL 中的查询参数
params: {
}
}).then((res)=>{
console.log(res);
that.date=res.data.Date;
that.Month=res.data.Month;
that.Year=res.data.Year;
console.log(that.date);
for(let i=0;i<that.date.length;i++){
that.datecate.push(that.date[i]['date']);
let num = parseInt(that.date[i]['num']);
let datefac = {"value":num,"date":that.date[i]['date'],"type":"line"};
that.dateLine.push(datefac);
}
console.log(that.dateLine);
console.log(that.datecate);
setTimeout(()=>{
that.eChart2(that.date,'echart2');
},1000);
});
},
eChartPic1(){
// 按日期折线图
var that = this;
that.Myoption1 = {
//dataZoom-inside 内置型数据区域缩放组件 所谓内置 1平移在坐标系中滑动拖拽进行数据区域平移2缩放PC端鼠标在坐标系范围内滚轮滚动MAC触控板类同;移动端在移动端触屏上支持两指滑动缩放
dataZoom: [{
type: 'inside', //1平移 缩放
throttle: '50', //设置触发视图刷新的频率单位为毫秒ms
minValueSpan: 6, //用于限制窗口大小的最小值,在类目轴上可以设置为 5 表示 5 个类目
start: 1, //数据窗口范围的起始百分比 范围是0 ~ 100表示 0% ~ 100%
end: 50, //数据窗口范围的结束百分比范围是0 ~ 100
zoomLock: true, //如果设置为 true 则锁定选择区域的大小也就是说只能平移不能缩放
}],
// 主要用来控制图表四周留白
grid: {
left: '15%',
top: '10%',
},
// 提示框组件
eChart2(Date,id){
var myChart = echarts.init(document.getElementById(id));
var xData=[],yData=[];
Date.map(function (a) {
xData.push(a.date);
yData.push(a.num);
});
var option = {
tooltip: {
trigger: 'axis', //坐标轴触发主要在柱状图折线图等会使用类目轴的图表中使用
backgroundColor: '#377CFF', //提示框浮层的背景颜色
axisPointer: { //去掉移动的指示线
type: 'none'
},
// 自定义提示框内容
formatter: function (params) {
var text = params[0].data.date + ': ' + params[0].data.value
return text;
}
trigger: 'axis'
},
//直角坐标系 grid 中的 x
xAxis: {
type: 'category', //'category' 类目轴适用于离散的类目数据为该类型时必须通过 data 设置类目数据
// 坐标轴轴线相关设置
xAxis: [{
type: 'category',
data: xData,
axisLine: {
lineStyle: {
color: '#E5E5E5', // 坐标轴线线的颜色
color: "#999"
}
}
}],
yAxis: [{
type: 'value',
splitNumber: 4,
splitLine: {
lineStyle: {
type: 'dashed',
color: '#DDD'
}
},
// 坐标轴刻度标签(类目,简单说就是x轴上的内容)的相关设置
axisLabel: {
// 是否显示坐标刻度标签(这了指是否显示x轴上的月份)
show: true,
// 标签文字的颜色
color: '#999'
},
//x轴刻度线设置
axisTick: {
"show": false
},
// 类目数据在类目轴type: 'category'中有效
data: that.datecate,
},
//直角坐标系 grid 中的 y
yAxis: {
type: 'value', //'value' 数值轴适用于连续数据
// 坐标轴轴线相关设置
axisLine: {
show: false //y轴线消失
show: false,
lineStyle: {
color: "#333"
},
},
// 坐标轴刻度标签(类目,简单说就是x轴上的内容)的相关设置
axisLabel: {
show: true,
// 标签文字的颜色
color: '#999'
nameTextStyle: {
color: "#999"
},
//y轴刻度线设置
axisTick: {
"show": false
},
splitNumber: 5, //坐标轴的分割段数需要注意的是这个分割段数只是个预估值最后实际显示的段数会在这个基础上根据分割后坐标轴刻度显示的易读程度作调整.在类目轴中无效
},
series: that.dateLine,
};
that.Myechart1.setOption(that.Myoption1,true);
// 图表大小变动从新渲染动态自适应
},
eChartPic2(){
splitArea: {
show: false
}
}],
series: [{
name: '提交项目数量',
type: 'line',
data: yData,
lineStyle: {
normal: {
width: 8,
color: {
type: 'linear',
colorStops: [{
offset: 0,
color: '#A9F387' // 0% 处的颜色
}, {
offset: 1,
color: '#48D8BF' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 10,
shadowOffsetY: 20
}
},
itemStyle: {
normal: {
color: '#fff',
borderWidth: 10,
/*shadowColor: 'rgba(72,216,191, 0.3)',
shadowBlur: 100,*/
borderColor: "#A9F387"
}
},
smooth: true
}]
};
myChart.setOption(option);
//图表大小变动从新渲染,动态自适应
window.addEventListener("resize", function () {
myChart.resize();
});
myChart.resize({
width: 900,
height: 300
});
},
getCategoryByProject(){
var that=this;
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/retProjectNumByCategory',
}).then((res)=>{
that.categoryArray=res.data;
var xData=[],yData=[];
that.categoryArray.map(function (a) {
xData.push(a.categoryName);
yData.push(a.num);
});
setTimeout(()=>{
that.echart_Pie(xData,yData,'echart1');
},1000)
});
},
echart_Pie(xData, yData, id) {
var chartDom = document.getElementById(id);
var myChart = echarts.init(chartDom);
var dataName = xData;
var dataName2 = xData;
var value = yData
var dataarr = []
var max = value[0];
var dataarr2 = []
value.forEach(function (ele, index) {
if (ele > max) {
max = ele;
}
dataarr.push({
value: ele,
name: dataName[index]
})
dataarr2.push({
value: ele,
name: dataName2[index]
})
})
var option = {
// backgroundColor: '#424956',
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)",
},
legend: {
orient: 'vertical',
x: 'right',
y: 'middle',
itemWidth: 20,
itemGap: 10,
itemHeight: 14,
align: 'left',
data: dataName,
textStyle: {
color: '#00000',
fontSize: 12
}
},
series: [{
name: '统计',
type: 'pie',
radius: ['25%', '65%'],
center: ['50%', '50%'],
color: [
'#2CEDED',
'#7049F0',
'#B347FF',
'#E70E65',
'#FF714A',
'#F6B768',
'#B0DF5D',
'#FC7DBC',
'#0A9FFD'
],
labelLine: {
normal: {
show: true,
length: 10,
length2: 24
}
},
data: dataarr
}, {
name: '统计',
type: 'pie',
radius: ['25%', '65%'],
center: ['50%', '50%'],
color: [
'transparent',
'transparent',
'transparent',
'transparent',
'transparent',
'transparent',
'transparent',
'rgba(252,125,188,0.5)',
'transparent'
],
label: {
normal: {
show: false
},
},
labelLine: {
normal: {
show: false,
}
},
data: dataarr2,
zlevel: 2
}]
};
myChart.clear();
option && myChart.setOption(option);
//图表大小变动从新渲染,动态自适应
window.addEventListener("resize", function () {
myChart.resize();
});
// myChart.resize({
// width: 449,
// height: 265
// });
},
}
},
// 初始化Echart
mounted() {
this.getUserTotal();
this.getProjectTotal();
this.getAdminLoginTime();
this.getArticleTotal();
this.getCommentTotal();
this.getAdminTotal();
this.getCategoryTotal();
this.getProjectByTime();
this.Myechart1 = this.$echarts.init(this.$refs.echart1);
this.Myechart2 = this.$echarts.init(this.$refs.echart2);
this.eChartPic1();
this.getUserTotal();
this.getProjectTotal();
this.getAdminLoginTime();
this.getArticleTotal();
this.getCommentTotal();
this.getAdminTotal();
this.getCategoryTotal();
this.getProjectByTime();
this.getCategoryByProject();
}
}
</script>

View File

@@ -65,10 +65,10 @@ export default {
this.imageUrl = "http://localhost:8082/helloGithub_war_exploded/VerifycodeServlet?" + new Date().getTime();
},
submit(formName){
console.log(this.login);
var _this=this;
this.$refs[formName].validate((valid) => {
if (valid) {
//调用方法提交
axios({
method: 'post',
@@ -81,6 +81,7 @@ export default {
code: this.login.code,
}
}).then(function (res) {
console.log(res);
if (res.data.code === 200) {
Vue.prototype.$notify({
title: '成功',
@@ -89,9 +90,12 @@ export default {
offset: 50
});
_this.$cookie.set('adminName',_this.login.username);
_this.$router.push({
path:'/systemIndex',
})
setTimeout(()=>{
_this.$router.push({
path:'/systemIndex',
})
},1000);
} else {
Vue.prototype.$notify.error({
title: '错误',

View File

@@ -5,6 +5,9 @@
<div class="TitleFont">标签管理</div>
</div>
<div style="height:50px;width:100%;"></div>
<div style="display: flex;flex-direction: row;justify-content: flex-start">
<el-button type="primary" icon="el-icon-plus" @click="openAddCategoryFun">新增</el-button>
</div>
<el-card style="width:1000px;margin-left:200px;" shadow="always" class="card_style">
<div style="width:900px;margin-left:30px;">
@@ -72,10 +75,39 @@
</el-form>
</el-dialog>
<el-dialog title="添加标签" :visible.sync="openAddCategory" width="26%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
>
<el-form ref="ruleForm" class="login_container" :model="form" status-icon label-width="100px">
<el-form-item label="标签名" prop="categoryName">
<el-input v-model="form.categoryName" placeholder='标签名' :disabled="isEdit" clearable></el-input>
</el-form-item>
<el-form-item label="标签图标" prop="category" >
<el-input v-model="form.category" placeholder='标签图标' clearable :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="isValid">
<el-radio-group v-model="form.isValid" :disabled="isEdit">
<el-radio :label="1">有效</el-radio>
<el-radio :label="0">无效</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between">
<el-button @click="editForm()">编辑</el-button>
<el-button @click="addCategory()" type="primary" style=";margin-top:10px">添加</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</el-card>
@@ -92,16 +124,14 @@ export default {
data(){
return{
isEdit:true,
openAddCategory:false,
List:[],
dialogVisible:false,
form:{
articleId:'',
userId: '',
articleContent: '',
articleTitle: '',
articleIco: '',
readCount: '',
isValid: '',
categoryId:'',
category:'',
categoryName:'',
isValid:'',
}
}
},
@@ -109,6 +139,9 @@ export default {
this.GetData();
},
methods:{
openAddCategoryFun(){
this.openAddCategory=true;
},
handleChangeStatus($event, id){
if ($event === 1) { // 这里判断一下
// 启用
@@ -199,6 +232,7 @@ export default {
this.GetData();
// 后关闭
this.dialogVisible = false;
this.openAddCategory=false;
this.isEdit=true;
},
editForm(){
@@ -291,6 +325,40 @@ export default {
}
});
},
addCategory(){
var _this = this;
//调用方法提交
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/insertCategory',
// URL 中的查询参数
params: {
url: this.form.category,
isValid: this.form.isValid,
name: this.form.categoryName,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.isEdit=true;
_this.dialogVisible = false;
_this.GetData();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
});
},
}
}

View File

@@ -8,6 +8,7 @@
<el-card shadow="always" class="card_style">
<el-table
@row-dblclick="toDetailPage"
:header-row-style="{height:'20px'}" :cell-style="{padding:'2px'}" border
:data="List"
style="width: 100%;margin-top: 20px;cursor: pointer">
@@ -86,7 +87,7 @@
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
@change="handleChangeStatus($event,scope.row.userId)"
@change="handleChangeStatus($event,scope.row.id)"
>
</el-switch>
</template>
@@ -105,7 +106,7 @@
</el-table>
</el-card>
<el-dialog title="编辑" :visible.sync="dialogVisible" width="26%"
<el-dialog title="编辑" :visible.sync="dialogVisible" width="46%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
@@ -117,21 +118,22 @@
<el-form-item label="发布用户ID" prop="userId">
<el-input v-model="form.userId" disabled></el-input>
</el-form-item>
<el-form-item label="文件名" prop="oneFileName">
<el-form-item label="名" prop="oneFileName">
<el-input v-model="form.oneFileName" :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="URL" prop="url">
<el-input v-model="form.url" :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="文件描述" prop="description" >
<el-input v-model="form.description" placeholder='文件描述' clearable :disabled="isEdit"></el-input>
<el-form-item label="描述" prop="description" >
<el-input v-model="form.description" placeholder='描述' clearable :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="文件内容" prop="content" >
<el-form-item label="内容" prop="content" >
<el-input v-model="form.content"
type="textarea"
rows="10"
placeholder='文章内容'
:disabled="isEdit"
placeholder='内容'
disabled
clearable></el-input>
</el-form-item>
<el-form-item label="阅读量" prop="lookNum" >
@@ -171,9 +173,9 @@ export default {
List:[],
dialogVisible:false,
form:{
id:'',
userId:'',
lookNum:'',
id:null,
userId:null,
lookNum:null,
oneFileName:'',
content:'',
language:'',
@@ -202,7 +204,7 @@ export default {
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_onefile',
// URL 中的查询参数
params: {
articleId:id,
id:id,
isValid:$event
}
}).then(function (res) {
@@ -237,7 +239,7 @@ export default {
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_onefile',
// URL 中的查询参数
params: {
articleId:id,
id:id,
isValid:$event
}
}).then(function (res) {
@@ -269,7 +271,6 @@ export default {
}
}).then((res)=>{
that.List = res.data;
console.log(that.List);
})
// /selectAllArticleByadmin
},
@@ -341,14 +342,14 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'api/updateFileByAdmin',
url: 'http://localhost:8082/helloGithub_war_exploded/updateFileByAdmin',
// URL 中的查询参数
params: {
id: this.form.id,
userId: this.form.userId,
lookNum: this.form.lookNum,
oneFileName: this.form.oneFileName,
Content: this.form.content,
// Content: '',
language: this.form.language,
url: this.form.url,
isValid: this.form.isValid,
@@ -377,9 +378,9 @@ export default {
},
toDetailPage(row){
this.$router.push({
path:'/ArticleDetail',
path:'/oneFileDetail',
query: {
id: row.articleId,
id: row.id,
refresh: true
}})
}

View File

@@ -25,8 +25,8 @@
<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">
分享
<span v-if="projectNum!=null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">{{projectNum}}</span>
<span v-if="projectNum==null" style="font-size: 16px;color:#2b2e33;font-weight: bold ">0</span>
<span v-if="projectList.length!==0" style="font-size: 16px;color:#2b2e33;font-weight: bold ">{{projectList.length}}</span>
<span v-if="projectList.length===0" style="font-size: 16px;color:#2b2e33;font-weight: bold ">0</span>
个开源项目,
<span v-if="Object.keys(commentList).length!==0" style="font-size: 16px;color:#2b2e33;font-weight: bold ">{{Object.keys(commentList).length}}</span>
<span v-if="Object.keys(commentList).length===0" style="font-size: 16px;color:#2b2e33;font-weight: bold ">0</span>

View File

@@ -28,11 +28,6 @@ Vue.prototype.$cookie = cookie;
Vue.config.productionTip = false
Vue.use(Element);
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
Vue.use(VXETable)
Vue.prototype.$VXETable = VXETable
new Vue({
router,