This commit is contained in:
2023-07-11 16:48:58 +08:00
parent 52b591a6d5
commit 492bc4894d

View File

@@ -2,10 +2,160 @@
<div>
<div class="HeadLine">
<div class="HeadSquare"></div>
<div class="TitleFont">用户管理</div>
<div class="TitleFont">oneFile管理</div>
</div>
<div style="height:50px;width:100%;"></div>
<el-card shadow="always" class="card_style">
<el-table
:header-row-style="{height:'20px'}" :cell-style="{padding:'2px'}" border
:data="List"
style="width: 100%;margin-top: 20px;cursor: pointer">
<el-table-column
prop="id"
label="ID"
sortable
align="center"
>
</el-table-column>
<el-table-column
prop="userId"
align="center"
label="用户ID"
>
</el-table-column>
<el-table-column
prop="oneFileName"
width="120"
:show-overflow-tooltip="true"
align="center"
label="文件名">
</el-table-column>
<el-table-column
prop="language"
align="center"
label="语言种类">
</el-table-column>
<el-table-column
prop="content"
width="150"
align="center"
label="内容"
:show-overflow-tooltip="true">
<template slot-scope="scope">
<el-tooltip placement="top" width="150"
trigger="hover"
effect="dark" close-delay="2000">
<div class="MyPopover" slot="content">{{scope.row.content}}</div>
<div>
<span>{{ scope.row.content.substr(0,12)}}</span>
<span v-if="(scope.row.content).length > 12">...</span>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
prop="url"
width="150"
align="center"
label="URL路径"
:show-overflow-tooltip="true"
>
</el-table-column>
<el-table-column
prop="description"
width="120"
:show-overflow-tooltip="true"
align="center"
label="描述">
</el-table-column>
<el-table-column
prop="lookNum"
align="center"
label="浏览量">
</el-table-column>
<el-table-column
prop="isValid"
align="center"
label="是否有效">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isValid"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
@change="handleChangeStatus($event,scope.row.userId)"
>
</el-switch>
</template>
</el-table-column>
<el-table-column width="150" label="操作" fixed="right" align="center">
<template slot-scope="scope">
<div class="ButtonBlock">
<img class="MyButton" @click="handleEdit(scope.row)"
src="../../../assets/svg/EditButton.svg" style="width:60px">
<img class="MyButton" @click="handleDelete(scope.row)"
src="../../../assets/svg/DeleteButton.svg" style="width:60px">
</div>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog title="编辑" :visible.sync="dialogVisible" 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="ID" prop="id">
<el-input v-model="form.id" placeholder='ID' clearable disabled></el-input>
</el-form-item>
<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-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>
<el-form-item label="文件内容" prop="content" >
<el-input v-model="form.content"
type="textarea"
rows="10"
placeholder='文章内容'
:disabled="isEdit"
clearable></el-input>
</el-form-item>
<el-form-item label="阅读量" prop="lookNum" >
<el-input v-model="form.lookNum" placeholder='阅读量' :disabled="isEdit" clearable></el-input>
</el-form-item>
<el-form-item label="语言种类" prop="articleIco" >
<el-input v-model="form.language" placeholder='语言种类' :disabled="isEdit" clearable></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="submit()" type="primary" style=";margin-top:10px">提交</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
@@ -21,13 +171,15 @@ export default {
List:[],
dialogVisible:false,
form:{
articleId:'',
userId: '',
articleContent: '',
articleTitle: '',
articleIco: '',
readCount: '',
isValid: '',
id:'',
userId:'',
lookNum:'',
oneFileName:'',
content:'',
language:'',
url:'',
isValid:'',
description:''
}
}
},
@@ -47,7 +199,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_article',
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_onefile',
// URL 中的查询参数
params: {
articleId:id,
@@ -82,7 +234,7 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_article',
url: 'http://localhost:8082/helloGithub_war_exploded/updateisValid_onefile',
// URL 中的查询参数
params: {
articleId:id,
@@ -112,11 +264,12 @@ export default {
var that = this;
axios({
method:'post',
url:'http://localhost:8082/helloGithub_war_exploded/selectAllArticleByadmin',
url:'http://localhost:8082/helloGithub_war_exploded/selectAllFileByAdmin',
params:{
}
}).then((res)=>{
that.List = res.data;
console.log(that.List);
})
// /selectAllArticleByadmin
},
@@ -151,10 +304,10 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/deleteArticleByAdmin',
url: 'http://localhost:8082/helloGithub_war_exploded/deleteFileByAdmin',
// URL 中的查询参数
params: {
articleId: index.articleId,
id: index.id,
}
}).then(function (res) {
if (res.data.code === 500) {
@@ -188,16 +341,18 @@ export default {
axios({
method: 'post',
// 请求的地址
url: 'http://localhost:8082/helloGithub_war_exploded/updateArticleByAdmin',
url: 'api/updateFileByAdmin',
// URL 中的查询参数
params: {
articleId: this.form.articleId,
id: this.form.id,
userId: this.form.userId,
articleContent: this.form.articleContent,
articleTitle: this.form.articleTitle,
articleIco: this.form.articleIco,
readCount: this.form.readCount,
lookNum: this.form.lookNum,
oneFileName: this.form.oneFileName,
Content: this.form.content,
language: this.form.language,
url: this.form.url,
isValid: this.form.isValid,
description: this.form.description,
}
}).then(function (res) {
if (res.data.code === 500) {
@@ -234,6 +389,28 @@ export default {
}
</script>
<style scoped>
<style>
.MyPopover{
max-width:200px;
max-height:100px;
overflow: auto;
}
.MyPopover::-webkit-scrollbar {
width: 10px;
background-color: #ffce9a;
border-radius: 5px;
}
.MyPopover::-webkit-scrollbar-thumb {
background-color: #676767;
border-radius: 5px;
}
</style>
<style scoped lang="scss">
.el-tooltip__popper{
effect:"light";
max-width: 250px;
//overflow: clip;
}
</style>