This commit is contained in:
Zhang HaoYang 2023-12-28 22:55:04 +08:00
parent 26fec1bf40
commit 06e68e8fc9
6 changed files with 1118 additions and 173 deletions

BIN
src/assets/img/avater.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -176,7 +176,12 @@
<el-rate style="margin-top:5px" v-model="form.rating" show-text ></el-rate>
</el-form-item>
<div style="display: flex;flex-direction: row;margin-top:5px">
<img class="little-Circle" style="width:60px !important;height: 60px !important;" src="../../assets/img/beauty.jpg"/>
<el-image class="little-Circle" style="width:60px !important;height: 60px !important;" :src="userItem.avatar">
<div slot="error" class="image-slot">
<img style="width: 100%" :src="require('@/assets/img/avater.png')" alt="图标">
</div>
</el-image>
<!-- <img class="little-Circle" style="width:60px !important;height: 60px !important;" src="../../assets/img/beauty.jpg"/>-->
<el-form-item prop="content">
<el-input v-model="form.content" style="width:350px;margin-top:12px;margin-left:10px;" type="textarea" placeholder="请输入一条友善的评论~"></el-input>
</el-form-item>
@ -207,7 +212,16 @@
<div v-for="(item,index) in allcomment" :key="index" class="circleRoll" style="margin-top:50px">
<div style="width:100%;height:2px;background-color: var(--theme-color-trans)"></div>
<div style="display:flex;flex-direction: row;flex-wrap: nowrap;margin-top:40px">
<img class="little-Circle" style="width:50px !important;height:50px !important;margin-top:20px;" src="../../assets/img/beauty.jpg"/>
<!-- <el-image style="width: 50px;height:auto;margin-right: 20px" :src="">-->
<!-- <div slot="error" class="image-slot">-->
<!-- <img style="width: 100%;margin-top: 5px" :src="require('@/assets/img/NAV.png')" alt="图标">-->
<!-- </div>-->
<!-- </el-image>-->
<el-image class="little-Circle" style="width:50px !important;height:50px !important;margin-top:20px;" :src="item.user.avatar">
<div slot="error" class="image-slot">
<img style="width: 100%" :src="require('@/assets/img/avater.png')" alt="图标">
</div>
</el-image>
<div style="display: flex;flex-direction: column">
<div style="display: flex;flex-direction: row;color:var(--theme-color);margin-left:5px;">
<span style="font-family: STHupo;width:50px">用户:</span><span style="font-size:13px;margin-left:5px;width:100px">{{item.user.userLogin}}</span>
@ -233,7 +247,11 @@
</div>
<!--子评论-->
<div v-for="(item2,index2) in rootId_AllComment[item.id]" :key="index2" >
<img class="little-Circle" style="width:50px !important;height:50px !important;margin-top:40px;" src="../../assets/img/beauty.jpg"/>
<el-image class="little-Circle" style="width:50px !important;height:50px !important;margin-top:20px;" :src="item2.user.avatar">
<div slot="error" class="image-slot">
<img style="width: 100%" :src="require('@/assets/img/avater.png')" alt="图标">
</div>
</el-image>
<el-card style="border:var(--border-color) 5px solid;min-height:60px;
background-color: var(--theme-comment-color) !important;
margin-top:-70px;margin-left:70px;">
@ -329,6 +347,7 @@ export default {
data() {
return {
userId:'',
userItem:{},
//
LikeNum:{},
flag1:true,
@ -480,15 +499,20 @@ export default {
this.rootid = rootid;
},
getUser() {
let _this = this;
var _this = this;
if(localStorage.getItem("Authorization") && localStorage.getItem("userId")){
_this.userId = localStorage.getItem("userId")
} else {
Vue.prototype.$notify.error({
title: '错误',
message: "登录状态失效,请重新登录!",
offset: 0
});
axios({
method: 'get',
//
url: '/api/getUserDetailes',
// URL
params: {
id:_this.userId,
}
}).then((res)=> {
_this.userItem = res.data;
})
}
},
// 0

View File

@ -1,23 +1,456 @@
<template>
<div class="main" style="text-shadow: 0 0 20px var(--font-border);overflow: scroll">
<div class="HeadLine" style="margin-top:30px;margin-left:15px;">
<div class="HeadSquare" ></div>
<div class="TitleFont" style="color:var(--theme-color)"><i class="el-icon-s-grid"></i>Banner管理</div>
</div>
<div class="base-style" style="margin-top:20px;font-family: SimHei;font-size:18px;font-weight:600;margin-left:20px">
<el-row>
<el-col :span="24">
<el-button @click="openAddCategoryFun()" type="primary" plain size="medium" round >创建Banner</el-button>
</el-col>
<el-col :span="24" style="margin-top:20px">
<el-input
placeholder="请输入内容"
v-model="searchCate"
clearable
style="width:200px">
</el-input>
<el-button type="success" plain size="medium" round style="margin-left:10px">查询目录</el-button>
</el-col>
</el-row>
<el-table class="MyTable"
:data="List"
header-row-class-name="table_header_class"
border>
<el-table-column
align="center"
type="index"
:index="hIndex"
prop="date"
label="序号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="name"
label="分类名称"
width="180">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="分类编号"
width="150">
</el-table-column>
<el-table-column
align="center"
prop="createtime"
label="创建时间"
width="140">
</el-table-column>
<el-table-column
align="center"
prop="urlNumber"
label="包含网址数"
width="100">
</el-table-column>
<!-- <el-table-column align="center" key="status" prop="status" label="启用状态" width="90" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" key="needLogin" prop="needLogin" label="公开状态" width="90">-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.needLogin"-->
<!-- :active-value="1"-->
<!-- :inactive-value="0"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
align="center"
prop="weigh"
label="权重"
width="80">
</el-table-column>
<el-table-column prop="date" label="操作" width="160">
<template slot-scope="scope">
<div class="ButtonBlock">
<img class="MyButton" @click="handleEdit(scope.row)"
src="../../../assets/img/EditButton.svg" style="width:60px">
<img class="MyButton" @click="handleDelete(scope.row)"
src="../../../assets/img/DeleteButton.svg" style="width:60px">
</div>
</template>
</el-table-column>
</el-table>
<el-dialog :title="titlename" :visible.sync="openAddCategory" width="30%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
>
<el-form ref="form" :rules="rules" class="login_container" :model="form"
style="margin-top:-10px" status-icon label-width="100px" >
<el-form-item label="分类名" prop="name">
<el-input v-model="form.name" placeholder='分类名称' clearable></el-input>
</el-form-item>
<el-form-item label="分类权重" prop="weigh" >
<el-input v-model="form.weigh" placeholder='分类权重' clearable ></el-input>
</el-form-item>
<el-form-item label="用户id" prop="userId" style="display: none">
<el-input v-model="form.userId" placeholder='用户id' clearable ></el-input>
</el-form-item>
<el-form-item label="编号" prop="id" style="display: none">
<el-input v-model="form.id" placeholder='id' clearable ></el-input>
</el-form-item>
<!-- <el-form-item label="是否启用" prop="status">-->
<!-- <el-radio-group v-model="form.status" >-->
<!-- <el-radio :label="0">有效</el-radio>-->
<!-- <el-radio :label="1">无效</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否公开" prop="needLogin">-->
<!-- <el-radio-group v-model="form.needLogin" >-->
<!-- <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="addCategory('form',titlename)" type="primary" style=";margin-top:10px">确认</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
name: "BannerManage",
data() {
return {}
return {
//
titlename:null,
//
openAddCategory:false,
//
dialogVisible:false,
//
isEdit:true,
searchCate:'',
userId:null,
List:[],
form:{
name:'',
weigh:'',
needLogin:'',
status:'',
userId:'',
id:'',
},
//
rules: {
name: [{ required: 'true', message: '请输入分类名', trigger: 'blur' }],
weigh: [{ required: 'true', message: '请输入权重', trigger: 'blur' }],
// needLogin: [{ required: 'true', message: '', trigger: 'blur' }],
// status: [{ required: 'true', message: '', trigger: 'blur' }],
userId: [{ required: 'true', message: '登录信息有误', trigger: 'blur' }],
}
}
},
mounted() {
this.getFormatDate();
},
created() {
this.getUserInfo();
// this.GetData();
},
computed: {},
methods: {}
methods: {
//
handleDelete(index) {
var that=this;
this.$confirm('此操作将永久删除该Banner, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios({
method: 'post',
//
url: '/api/banners/delete_url',
// URL
params: {
Id: this.form.id,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "删除成功"),
type: 'success',
offset: 50
});
that.GetData();
}
});
}).catch(() => {
// :
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//
closeDialog() {
var that = this;
//
this.GetData();
//
that.form = {
name:'',
weigh:'',
needLogin:'',
status:'',
userId:'',
id:'',
}
//
this.dialogVisible = false;
this.openAddCategory=false;
that.getUserInfo();
},
// :
openAddCategoryFun(){
var _this = this;
// console.log(_this.List);
_this.titlename="新增Banner";
this.openAddCategory=true;
},
//
handleEdit(index) {
var _this = this;
this.openAddCategoryFun();
_this.titlename="编辑Banner";
//
this.form = index;
},
//
addCategory(rulelist,flag){
var _this = this;
_this.$refs[rulelist].validate((valid)=>{
if(valid){
if(flag == "新增分类"){
axios({
method: 'post',
//
url: '/api/UrlAndCate/insertCateByUser',
// URL
params: {
name: this.form.name,
weigh: this.form.weigh,
status: 0,
need_login: 0,
userId: this.form.userId,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}else if(flag == "编辑分类"){
axios({
method: 'post',
//
url: '/api/UrlAndCate/updateUrlCate',
// URL
params: {
id: this.form.id,
weigh: this.form.weigh,
status: 0,
name: this.form.name,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}
}
})
//
},
//
getFormatDate() {
var that = this;
console.log(that.List.length + "changdu");
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
console.log("date: " + Y + M + D);
that.List[i].createtime = "" + Y + M + D;
}
},
//
hIndex(index){
var linenum = parseInt( parseInt(index) + parseInt(1))
return linenum;
},
// ID
getUserInfo() {
let _this = this;
if(localStorage.getItem("Authorization") && localStorage.getItem("userId")){
_this.userId = localStorage.getItem("userId")
_this.GetData();
} else {
Vue.prototype.$notify.error({
title: '错误',
message: "登录状态失效,请重新登录!",
offset: 0
});
}
},
GetData(){
//
var that = this;
axios({
method:'post',
url:'/api/UrlAndCate/returnCateByUserId',
params:{
userId: that.userId
}
}).then(function(res){
that.List = res.data.data;
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
that.List[i].createtime = "" + Y + M + D;
}
})
// /selectAllArticleByadmin
that.form.userId = that.userId;
},
}
}
</script>
<style scoped>
.base-style{
display: flex;
flex-direction: column;
}
/**表格样式,直接复制**/
::v-deep .table_header_class th{
background-color: var(--table-bg-color)!important;
color:var(--theme-color);
text-align: center;
}
.MyTable{
margin-top:10px;
width: 100%;
background-color:var(--table-bg-color);
color:var(--theme-color);
border-radius: 5px;
}
::v-deep .el-table__body tr:hover > td {
background-color: var(--table-bg-color-hover) !important;
}
::v-deep .el-table tr,
.el-table th.el-table__cell {
background-color: var(--table-bg-color);
border: var(--table-border) solid 3px;
}
::v-deep .el-table--border{
border: var(--table-border) solid 3px;
}
.login_container {
width: 400px;
border: 1px solid #eaeaea;
margin: 100px auto;
padding: 35px 35px 15px 35px;
box-sizing: border-box;
border-radius: 15px;
background-color: #fff;
box-shadow: 0 0 25px #cac6c6;
.login_title{
color: #505458;
text-align: center;
margin-bottom: 40px;}
}
::v-deep .el-dialog__body{
background-image: url("../../../assets/img/SkyPic.jpg");
margin-top:15px;
height:300px;
}
</style>

View File

@ -40,11 +40,10 @@
width="180">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="分类编号"
width="50">
width="150">
</el-table-column>
<el-table-column
align="center"
@ -58,32 +57,32 @@
label="包含网址数"
width="100">
</el-table-column>
<el-table-column align="center" key="status" prop="status" label="启用状态" width="90" >
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="0"
:inactive-value="1"
active-color="#13ce66"
inactive-color="#ff4949"
disabled
>
</el-switch>
</template>
</el-table-column>
<el-table-column align="center" key="needLogin" prop="needLogin" label="公开状态" width="90">
<template slot-scope="scope">
<el-switch
v-model="scope.row.needLogin"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
disabled
>
</el-switch>
</template>
</el-table-column>
<!-- <el-table-column align="center" key="status" prop="status" label="启用状态" width="90" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" key="needLogin" prop="needLogin" label="公开状态" width="90">-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.needLogin"-->
<!-- :active-value="1"-->
<!-- :inactive-value="0"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
align="center"
prop="weigh"
@ -101,7 +100,7 @@
</template>
</el-table-column>
</el-table>
<el-dialog title="新增分类" :visible.sync="openAddCategory" width="30%"
<el-dialog :title="titlename" :visible.sync="openAddCategory" width="30%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
@ -117,21 +116,24 @@
<el-form-item label="用户id" prop="userId" style="display: none">
<el-input v-model="form.userId" placeholder='用户id' clearable ></el-input>
</el-form-item>
<el-form-item label="是否启用" prop="status">
<el-radio-group v-model="form.status" >
<el-radio :label="0">有效</el-radio>
<el-radio :label="1">无效</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否公开" prop="needLogin">
<el-radio-group v-model="form.needLogin" >
<el-radio :label="1">公开</el-radio>
<el-radio :label="0">私有</el-radio>
</el-radio-group>
<el-form-item label="编号" prop="id" style="display: none">
<el-input v-model="form.id" placeholder='id' clearable ></el-input>
</el-form-item>
<!-- <el-form-item label="是否启用" prop="status">-->
<!-- <el-radio-group v-model="form.status" >-->
<!-- <el-radio :label="0">有效</el-radio>-->
<!-- <el-radio :label="1">无效</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否公开" prop="needLogin">-->
<!-- <el-radio-group v-model="form.needLogin" >-->
<!-- <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="addCategory('form')" type="primary" style=";margin-top:10px">确认</el-button>
<el-button @click="addCategory('form',titlename)" type="primary" style=";margin-top:10px">确认</el-button>
</div>
</el-form-item>
</el-form>
@ -165,13 +167,14 @@ export default {
needLogin:'',
status:'',
userId:'',
id:'',
},
//
rules: {
name: [{ required: 'true', message: '请输入分类名', trigger: 'blur' }],
weigh: [{ required: 'true', message: '请输入权重', trigger: 'blur' }],
needLogin: [{ required: 'true', message: '请完善信息', trigger: 'blur' }],
status: [{ required: 'true', message: '请输入是否启用', trigger: 'blur' }],
// needLogin: [{ required: 'true', message: '', trigger: 'blur' }],
// status: [{ required: 'true', message: '', trigger: 'blur' }],
userId: [{ required: 'true', message: '登录信息有误', trigger: 'blur' }],
}
}
@ -185,6 +188,7 @@ export default {
},
computed: {},
methods: {
//
handleDelete(index) {
var that=this;
@ -239,10 +243,13 @@ export default {
weigh:'',
needLogin:'',
status:'',
userId:'',
id:'',
}
//
this.dialogVisible = false;
this.openAddCategory=false;
that.getUserInfo();
},
// :
openAddCategoryFun(){
@ -260,10 +267,11 @@ export default {
this.form = index;
},
//
addCategory(rulelist){
addCategory(rulelist,flag){
var _this = this;
_this.$refs[rulelist].validate((valid)=>{
if(valid){
if(flag == "新增分类"){
axios({
method: 'post',
//
@ -272,8 +280,8 @@ export default {
params: {
name: this.form.name,
weigh: this.form.weigh,
status: this.form.status,
need_login: this.form.need_login,
status: 0,
need_login: 0,
userId: this.form.userId,
}
}).then(function (res) {
@ -294,14 +302,40 @@ export default {
});
}
}).catch((error)=>{
// Vue.prototype.$notify.error({
// title: '',
// message: error,
// offset: 50
// });
})
}else if(flag == "编辑分类"){
axios({
method: 'post',
//
url: '/api/UrlAndCate/updateUrlCate',
// URL
params: {
id: this.form.id,
weigh: this.form.weigh,
status: 0,
name: this.form.name,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
return;
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}
}
})
@ -418,6 +452,6 @@ export default {
::v-deep .el-dialog__body{
background-image: url("../../../assets/img/SkyPic.jpg");
margin-top:15px;
height:500px;
height:300px;
}
</style>

View File

@ -1,23 +1,399 @@
<template>
<div class="main" style="text-shadow: 0 0 20px var(--font-border);overflow: scroll">
<div class="HeadLine" style="margin-top:30px;margin-left:15px;">
<div class="HeadSquare" ></div>
<div class="TitleFont" style="color:var(--theme-color)"><i class="el-icon-s-grid"></i>通知管理</div>
</div>
<div class="base-style" style="margin-top:20px;font-family: SimHei;font-size:18px;font-weight:600;margin-left:20px">
<el-row>
<el-col :span="24">
<el-button @click="openAddCategoryFun()" type="primary" plain size="medium" round >创建通知</el-button>
</el-col>
<!-- <el-col :span="24" style="margin-top:20px">-->
<!-- <el-input-->
<!-- placeholder="请输入内容"-->
<!-- v-model="searchCate"-->
<!-- clearable-->
<!-- style="width:200px">-->
<!-- </el-input>-->
<!-- <el-button type="success" plain size="medium" round style="margin-left:10px">查询</el-button>-->
<!-- </el-col>-->
</el-row>
<el-table class="MyTable"
:data="List"
header-row-class-name="table_header_class"
border>
<el-table-column
align="center"
prop="id"
label="通知编号"
width="150">
</el-table-column>
<el-table-column
align="center"
prop="title"
label="通知标题"
width="180">
</el-table-column>
<el-table-column
align="center"
prop="content"
label="通知内容"
width="160">
</el-table-column>
<el-table-column
align="center"
prop="url"
label="通知URL"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="createtime"
label="创建时间"
width="120">
</el-table-column>
<el-table-column
align="center"
prop="urlNumber"
label="包含网址数"
width="100">
</el-table-column>
<!-- <el-table-column align="center" key="status" prop="status" label="启用状态" width="90" >-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" key="needLogin" prop="needLogin" label="公开状态" width="90">-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.needLogin"-->
<!-- :active-value="1"-->
<!-- :inactive-value="0"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- disabled-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- align="center"-->
<!-- prop="weigh"-->
<!-- label="权重"-->
<!-- width="80">-->
<!-- </el-table-column>-->
<el-table-column prop="date" label="操作" width="100">
<template slot-scope="scope">
<div class="ButtonBlock">
<img class="MyButton" @click="handleDelete(scope.row)"
src="../../../assets/img/DeleteButton.svg" style="width:60px">
</div>
</template>
</el-table-column>
</el-table>
<el-dialog title="新增公告" :visible.sync="openAddCategory" width="30%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
>
<el-form ref="form" :rules="rules" class="login_container" :model="form"
style="margin-top:-10px" status-icon label-width="100px" >
<el-form-item label="公告标题" prop="title">
<el-input v-model="form.title" placeholder='公告标题' clearable></el-input>
</el-form-item>
<el-form-item label="公告内容" prop="content" >
<el-input v-model="form.content" placeholder='公告内容' clearable ></el-input>
</el-form-item>
<el-form-item label="公告链接" prop="url">
<el-input v-model="form.url" 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: space-between">
<el-button @click="addCategory('form')" type="primary" style=";margin-top:10px">确认</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</div>
</div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
name: "NoticeManage",
data() {
return {}
return {
//
titlename:null,
//
openAddCategory:false,
//
dialogVisible:false,
//
isEdit:true,
searchCate:'',
userId:null,
List:[],
form:{
title: null,
content: null,
url: null,
},
//
rules: {
title: [{ required: 'true', message: '请输入通标题', trigger: 'blur' }],
content: [{ required: 'true', message: '请输入通知内容', trigger: 'blur' }],
// needLogin: [{ required: 'true', message: '', trigger: 'blur' }],
// status: [{ required: 'true', message: '', trigger: 'blur' }],
url: [{ required: 'true', message: '请慎入跳转连接', trigger: 'blur' }],
}
}
},
mounted() {
this.getFormatDate();
},
created() {
this.getUserInfo();
// this.GetData();
},
computed: {},
methods: {}
methods: {
//
handleDelete(index) {
var that=this;
this.$confirm('此操作将永久删除该通知, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios({
method: 'get',
//
url: '/api/notice/delete',
// URL
params: {
id: index.id,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "删除成功"),
type: 'success',
offset: 50
});
that.GetData();
}
});
}).catch(() => {
// :
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//
closeDialog() {
var that = this;
//
this.GetData();
//
that.form = {
title: null,
content: null,
url: null,
}
//
this.dialogVisible = false;
this.openAddCategory=false;
that.getUserInfo();
},
// :
openAddCategoryFun(){
var _this = this;
// console.log(_this.List);
_this.titlename="新增通知";
this.openAddCategory=true;
},
//
handleEdit(index) {
var _this = this;
this.openAddCategoryFun();
_this.titlename="编辑通知";
//
this.form = index;
},
//
addCategory(rulelist){
var _this = this;
_this.$refs[rulelist].validate((valid)=>{
if(valid){
axios({
method: 'post',
//
url: '/api/notice/add',
// URL
params: {
title: this.form.title,
content: this.form.content,
url: this.form.url,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}
})
//
},
//
getFormatDate() {
var that = this;
console.log(that.List.length + "changdu");
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
console.log("date: " + Y + M + D);
that.List[i].createtime = "" + Y + M + D;
}
},
//
hIndex(index){
var linenum = parseInt( parseInt(index) + parseInt(1))
return linenum;
},
// ID
getUserInfo() {
let _this = this;
if(localStorage.getItem("Authorization") && localStorage.getItem("userId")){
_this.userId = localStorage.getItem("userId")
_this.GetData();
} else {
Vue.prototype.$notify.error({
title: '错误',
message: "登录状态失效,请重新登录!",
offset: 0
});
}
},
GetData(){
//
var that = this;
axios({
method:'get',
url:'/api/notice/select',
params:{
}
}).then(function(res){
that.List = res.data;
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
that.List[i].createtime = "" + Y + M + D;
}
})
// /selectAllArticleByadmin
that.form.userId = that.userId;
},
}
}
</script>
<style scoped>
.base-style{
display: flex;
flex-direction: column;
}
/**表格样式,直接复制**/
::v-deep .table_header_class th{
background-color: var(--table-bg-color)!important;
color:var(--theme-color);
text-align: center;
}
.MyTable{
margin-top:10px;
width: 100%;
background-color:var(--table-bg-color);
color:var(--theme-color);
border-radius: 5px;
}
::v-deep .el-table__body tr:hover > td {
background-color: var(--table-bg-color-hover) !important;
}
::v-deep .el-table tr,
.el-table th.el-table__cell {
background-color: var(--table-bg-color);
border: var(--table-border) solid 3px;
}
::v-deep .el-table--border{
border: var(--table-border) solid 3px;
}
.login_container {
width: 400px;
border: 1px solid #eaeaea;
margin: 100px auto;
padding: 35px 35px 15px 35px;
box-sizing: border-box;
border-radius: 15px;
background-color: #fff;
box-shadow: 0 0 25px #cac6c6;
.login_title{
color: #505458;
text-align: center;
margin-bottom: 40px;}
}
::v-deep .el-dialog__body{
background-image: url("../../../assets/img/SkyPic.jpg");
margin-top:15px;
height:400px;
}
</style>

View File

@ -33,6 +33,33 @@
label="序号"
width="50">
</el-table-column>
<el-table-column
style="display: none"
align="center"
prop="cate_id"
label="所属编号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="urlId"
label="网站编号"
width="100">
</el-table-column>
<el-table-column align="center" prop="url" label="网站URL" width="150">
<template slot-scope="scope">
<el-tooltip v-if="(scope.row.url) != null && (scope.row.url).length > 12" placement="top" width="150"
trigger="hover"
effect="dark" close-delay="2000">
<div class="MyPopover" slot="content">{{scope.row.url}}</div>
<div>
<span v-if="(scope.row.url) == null">暂无</span>
<span v-else-if="(scope.row.url).length < 12">{{scope.row.url}}</span>
<span v-else-if="(scope.row.url).length > 12">{{ scope.row.url.substr(0,12)}}...</span>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column align="center" key="name" prop="name" label="网站名" width="190">
<template slot-scope="scope">
<el-tooltip placement="top" width="150"
@ -58,18 +85,19 @@
label="创建时间"
width="140">
</el-table-column>
<el-table-column align="center" key="desc" prop="desc" label="描述" width="100">
<!-- <template slot-scope="scope">-->
<!-- <el-tooltip placement="top" width="150"-->
<!-- trigger="hover"-->
<!-- effect="dark" close-delay="2000">-->
<!-- <div class="MyPopover" slot="content">{{scope.row.desc}}</div>-->
<!-- <div>-->
<!-- <span>{{ scope.row.desc.substr(0,12)}}</span>-->
<!-- <span v-if="(scope.row.desc).length > 12">...</span>-->
<!-- </div>-->
<!-- </el-tooltip>-->
<!-- </template>-->
<el-table-column align="center" key="desc" prop="desc" label="描述" width="200">
<template slot-scope="scope">
<el-tooltip v-if="(scope.row.desc) != null && (scope.row.desc).length > 12" placement="top" width="150"
trigger="hover"
effect="dark" close-delay="2000">
<div class="MyPopover" slot="content">{{scope.row.desc}}</div>
<div>
<span v-if="(scope.row.desc) == null">暂无</span>
<span v-else-if="(scope.row.desc).length < 12">{{scope.row.desc}}</span>
<span v-else-if="(scope.row.desc).length > 12">{{ scope.row.desc.substr(0,12)}}...</span>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
align="center"
@ -134,7 +162,7 @@
</el-table-column>
</el-table>
<div style="width:100%;height:100px"></div>
<el-dialog title="新增分类" :visible.sync="openAddCategory" width="45%"
<el-dialog :title="titlename" :visible.sync="openAddCategory" width="45%"
append-to-body
:close-on-click-modal="false"
:before-close="closeDialog"
@ -148,12 +176,21 @@
<el-form-item label="网站名" prop="name">
<el-input v-model="form.name" placeholder='网站名' clearable ></el-input>
</el-form-item>
<el-form-item label="网站id" prop="id" style="display: none">
<el-input v-model="form.id" placeholder='网站名' clearable ></el-input>
</el-form-item>
<el-form-item label="网站图标" prop="icon">
<el-input v-model="form.icon" placeholder='网站图标' clearable ></el-input>
</el-form-item>
<el-form-item label="代理提示" prop="agentHint">
<el-input v-model="form.agentHint" placeholder='代理提示' clearable ></el-input>
</el-form-item>
<el-form-item label="网站Tag" prop="tags">
<el-input v-model="form.tags" placeholder='网站Tag' clearable ></el-input>
</el-form-item>
<el-form-item label="网站描述" prop="desc">
<el-input v-model="form.desc" placeholder='网站描述' clearable ></el-input>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="网站归类" prop="cate_id">
@ -183,7 +220,7 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12" v-if="titlename=='编辑网址'">
<el-form-item label="是否公开" prop="needLogin">
<el-radio-group v-model="form.needLogin" >
<el-radio :label="1">公开</el-radio>
@ -194,8 +231,8 @@
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="需要代理" prop="is_need_agent">
<el-radio-group v-model="form.is_need_agent" >
<el-form-item label="需要代理" prop="isNeedAgent">
<el-radio-group v-model="form.isNeedAgent" >
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
@ -205,7 +242,7 @@
<el-form-item>
<div style="display: flex;flex-direction: row;align-items: center;flex-wrap: nowrap;justify-content: space-between;width:60%">
<el-button @click="addCategory('form')" type="primary" style=";margin-top:10px">确认</el-button>
<el-button @click="addCategory('form',titlename)" type="primary" style=";margin-top:10px">确认</el-button>
<el-button @click="reset('form')" type="success" style=";margin-top:10px">重置</el-button>
</div>
</el-form-item>
@ -240,6 +277,8 @@ export default {
userId:null,
List:[],
form:{
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
@ -248,7 +287,8 @@ export default {
url:'',
tags:'',
desc:'',
is_need_agent:'',
isNeedAgent:'',
needLogin:'',
},
//
rules: {
@ -266,6 +306,7 @@ export default {
},
mounted() {
this.GetData();
},
created() {
this.getUserInfo();
@ -276,6 +317,8 @@ export default {
//
reset(){
this.form = {
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
@ -284,7 +327,8 @@ export default {
url:'',
tags:'',
desc:'',
is_need_agent:'',
isNeedAgent:'',
needLogin:'',
}
},
//
@ -351,6 +395,8 @@ export default {
//
//
that.form = {
agentHint:'',
urlId:'',
name:'',
weigh:'',
status:'',
@ -359,7 +405,8 @@ export default {
url:'',
tags:'',
desc:'',
is_need_agent:'',
isNeedAgent:'',
needLogin:'',
}
//
this.dialogVisible = false;
@ -376,15 +423,53 @@ export default {
handleEdit(index) {
var _this = this;
this.openAddCategoryFun();
_this.titlename="编辑分类";
_this.titlename="编辑网址";
//
this.form = index;
},
//
addCategory(rulelist){
addCategory(rulelist,title){
var _this = this;
_this.$refs[rulelist].validate((valid)=>{
if(valid){
if(title == "编辑网址"){
axios({
method: 'post',
//
url: '/api/admin/weblist/update',
// URL
params: {
id:this.form.id,
name: this.form.name,
weigh: this.form.weigh,
icon:this.form.icon,
cateId:this.form.cate_id,
status: this.form.status,
isNeedAgent:this.form.isNeedAgent,
url: this.form.url,
desc: this.form.desc,
needLogin:this.form.needLogin,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
_this.closeDialog();
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "更新成功!"),
type: 'success',
offset: 50
});
}
}).catch((error)=>{
})
}else if(title == "新增网址"){
axios({
method: 'post',
//
@ -396,8 +481,7 @@ export default {
icon:this.form.icon,
cateId:this.form.cate_id,
status: this.form.status,
need_login: this.form.need_login,
isNeedAgent:this.form.is_need_agent,
isNeedAgent:this.form.isNeedAgent,
url: this.form.url,
desc: this.form.desc,
}
@ -419,14 +503,8 @@ export default {
});
}
}).catch((error)=>{
// Vue.prototype.$notify.error({
// title: '',
// message: error,
// offset: 50
// });
})
}else{
return;
}
}
})
@ -486,7 +564,8 @@ export default {
tmp[i].childUC = tmp[i].childUC.map(item=>{
return{
...item,
root:rootName
root:rootName,
root_id:catenum
}
});
tmp2 = tmp2.concat(tmp[i].childUC);
@ -501,7 +580,6 @@ export default {
}
});
that.form.userId = that.userId;
},
}