update
This commit is contained in:
parent
77373c2129
commit
8d3c8259e8
@ -9,22 +9,12 @@
|
||||
<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"
|
||||
@ -35,14 +25,30 @@
|
||||
<el-table-column
|
||||
|
||||
align="center"
|
||||
prop="name"
|
||||
label="分类名称"
|
||||
prop="id"
|
||||
label="id"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
||||
align="center"
|
||||
prop="imgUrl"
|
||||
label="图片链接"
|
||||
width="180">
|
||||
<template slot-scope="scope">
|
||||
<div class="ButtonBlock">
|
||||
<el-image :src="scope.row.imgUrl">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="分类编号"
|
||||
prop="url"
|
||||
label="跳转链接"
|
||||
width="150">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -53,8 +59,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="urlNumber"
|
||||
label="包含网址数"
|
||||
prop="weigh"
|
||||
label="权重"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" key="status" prop="status" label="启用状态" width="90" >-->
|
||||
@ -83,18 +89,11 @@
|
||||
<!-- </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)"
|
||||
<img class="MyButton" @click="handleDelete(scope.row.id)"
|
||||
src="../../../assets/img/DeleteButton.svg" style="width:60px">
|
||||
</div>
|
||||
</template>
|
||||
@ -107,33 +106,22 @@
|
||||
>
|
||||
<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 label="图片链接" prop="imgUrl">
|
||||
<el-input v-model="form.imgUrl" 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 label="权重" prop="weigh" >
|
||||
<el-input v-model="form.weigh" placeholder='权重(填0即可)' 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 label="跳转链接" prop="url">
|
||||
<el-input v-model="form.url" placeholder='跳转链接' 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 label="状态" prop="bannerStatus">
|
||||
<el-input v-model="form.bannerStatus" placeholder='状态(填0即可)' 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>
|
||||
<el-button @click="addCategory('form')" type="primary" style=";margin-top:10px">确认</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -154,43 +142,34 @@ export default {
|
||||
titlename:null,
|
||||
// 新增目录页面:
|
||||
openAddCategory:false,
|
||||
// 对话框显示:
|
||||
dialogVisible:false,
|
||||
// 允许对话框修改:
|
||||
isEdit:true,
|
||||
searchCate:'',
|
||||
userId:null,
|
||||
List:[],
|
||||
form:{
|
||||
name:'',
|
||||
weigh:'',
|
||||
needLogin:'',
|
||||
status:'',
|
||||
userId:'',
|
||||
id:'',
|
||||
imgUrl:null,
|
||||
url:null,
|
||||
weigh:null,
|
||||
bannerStatus:null,
|
||||
},
|
||||
// 校验规则
|
||||
rules: {
|
||||
name: [{ required: 'true', message: '请输入分类名', trigger: 'blur' }],
|
||||
imgUrl: [{ required: 'true', message: '请输入图片链接', trigger: 'blur' }],
|
||||
url: [{ 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' }],
|
||||
bannerStatus: [{ required: 'true', message: '请输入状态', trigger: 'blur' }],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getFormatDate();
|
||||
this.GetBannerData();
|
||||
},
|
||||
created() {
|
||||
this.getUserInfo();
|
||||
// this.GetData();
|
||||
|
||||
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
|
||||
// 删除网址:
|
||||
handleDelete(index) {
|
||||
handleDelete(id) {
|
||||
var that=this;
|
||||
this.$confirm('此操作将永久删除该Banner, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@ -198,18 +177,18 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios({
|
||||
method: 'post',
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: '/api/banners/delete_url',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
Id: this.form.id,
|
||||
id: id,
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res.data.code === 500) {
|
||||
if (res.data.code !== 200) {
|
||||
Vue.prototype.$notify.error({
|
||||
title: '错误',
|
||||
message: res.data.msg,
|
||||
message: "删除失败",
|
||||
offset: 50
|
||||
});
|
||||
} else {
|
||||
@ -219,7 +198,7 @@ export default {
|
||||
type: 'success',
|
||||
offset: 50
|
||||
});
|
||||
that.GetData();
|
||||
that.GetBannerData();
|
||||
}
|
||||
|
||||
});
|
||||
@ -235,20 +214,7 @@ export default {
|
||||
closeDialog() {
|
||||
var that = this;
|
||||
// 先重置
|
||||
this.GetData();
|
||||
//表单重置
|
||||
that.form = {
|
||||
name:'',
|
||||
weigh:'',
|
||||
needLogin:'',
|
||||
status:'',
|
||||
userId:'',
|
||||
id:'',
|
||||
}
|
||||
// 后关闭
|
||||
this.dialogVisible = false;
|
||||
this.openAddCategory=false;
|
||||
that.getUserInfo();
|
||||
},
|
||||
// 新增按钮:
|
||||
openAddCategoryFun(){
|
||||
@ -257,84 +223,38 @@ export default {
|
||||
_this.titlename="新增Banner";
|
||||
this.openAddCategory=true;
|
||||
},
|
||||
// 编辑按钮:
|
||||
handleEdit(index) {
|
||||
var _this = this;
|
||||
this.openAddCategoryFun();
|
||||
_this.titlename="编辑Banner";
|
||||
// 深拷贝
|
||||
this.form = index;
|
||||
},
|
||||
|
||||
// 提交新增:
|
||||
addCategory(rulelist,flag){
|
||||
addCategory(rulelist){
|
||||
var _this = this;
|
||||
_this.$refs[rulelist].validate((valid)=>{
|
||||
if(valid){
|
||||
if(flag == "新增分类"){
|
||||
axios({
|
||||
method: 'post',
|
||||
// 请求的地址
|
||||
url: '/api/UrlAndCate/insertCateByUser',
|
||||
url: '/api/banners/add_banner',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
name: this.form.name,
|
||||
weigh: this.form.weigh,
|
||||
status: 0,
|
||||
need_login: 0,
|
||||
userId: this.form.userId,
|
||||
}
|
||||
params: this.form,
|
||||
}).then(function (res) {
|
||||
if (res.data.code === 500) {
|
||||
if (res.data.code !== 200) {
|
||||
Vue.prototype.$notify.error({
|
||||
title: '错误',
|
||||
message: res.data.msg,
|
||||
message: "添加失败",
|
||||
offset: 50
|
||||
});
|
||||
|
||||
} else {
|
||||
_this.closeDialog();
|
||||
_this.GetBannerData();
|
||||
Vue.prototype.$notify({
|
||||
title: '成功',
|
||||
message: ('i', {style: 'color: teal'}, "更新成功!"),
|
||||
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)=>{
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -342,58 +262,26 @@ export default {
|
||||
|
||||
},
|
||||
// 时间转换:
|
||||
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位需*1000,时间戳为13位的话不需乘1000
|
||||
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(){
|
||||
|
||||
GetBannerData(){
|
||||
// 获取数据
|
||||
var that = this;
|
||||
axios({
|
||||
method:'post',
|
||||
url:'/api/UrlAndCate/returnCateByUserId',
|
||||
params:{
|
||||
userId: that.userId
|
||||
}
|
||||
method:'get',
|
||||
url:'/api/banners/view_banner',
|
||||
}).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位需*1000,时间戳为13位的话不需乘1000
|
||||
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;
|
||||
}
|
||||
that.List = res.data;
|
||||
|
||||
}).catch((error)=>{
|
||||
|
||||
})
|
||||
// /selectAllArticleByadmin
|
||||
that.form.userId = that.userId;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
@ -125,8 +125,6 @@
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -1,23 +1,180 @@
|
||||
<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-table class="MyTable"
|
||||
:data="list"
|
||||
header-row-class-name="table_header_class"
|
||||
border>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="用户id"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userLogin"
|
||||
label="登录用户名"
|
||||
width="150">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userPassword"
|
||||
label="密码"
|
||||
width="160">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="phone"
|
||||
label="电话"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="avatar"
|
||||
label="头像"
|
||||
width="120">
|
||||
<template slot-scope="scope">
|
||||
<div class="ButtonBlock">
|
||||
<el-image :src="scope.row.avatar">
|
||||
<div slot="error" class="image-slot">
|
||||
<el-avatar icon="el-icon-user-solid"></el-avatar>
|
||||
</div>
|
||||
</el-image>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="nickname"
|
||||
label="昵称"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userEmail"
|
||||
label="邮箱"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userStatus"
|
||||
label="状态"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userRegistered"
|
||||
label="注册时间"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="roleId"
|
||||
label="角色"
|
||||
width="100">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.roleId===1">普通用户</span>
|
||||
<span v-if="scope.row.roleId===0">管理员</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "UserManage",
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
list:[],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.getUserData();
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
computed: {},
|
||||
methods: {}
|
||||
methods: {
|
||||
getUserData(){
|
||||
// 获取数据
|
||||
var that = this;
|
||||
axios({
|
||||
method:'get',
|
||||
url:'/api//getAllUsers',
|
||||
|
||||
}).then(function(res){
|
||||
that.list = res.data;
|
||||
|
||||
}).catch((error)=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</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>
|
@ -389,10 +389,10 @@ export default {
|
||||
urlId:index.urlId,
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res.data.code === 500) {
|
||||
if (res.data.code !== 500) {
|
||||
Vue.prototype.$notify.error({
|
||||
title: '错误',
|
||||
message: res.data.msg,
|
||||
message: "删除失败",
|
||||
offset: 50
|
||||
});
|
||||
} else {
|
||||
|
@ -28,7 +28,7 @@
|
||||
</keep-alive>
|
||||
<div class="overlay-app"></div>
|
||||
</div>
|
||||
<div v-if="icp_info!==''" style="z-index: 9999;display: flex;flex-direction: row;margin-bottom: -30px">
|
||||
<div v-if="icp_info!==''" style="display: flex;flex-direction: row;margin-bottom: -30px">
|
||||
<el-link style="color: var(--theme-color);" :underline="false" href="https://beian.miit.gov.cn/" target="_blank">备案号: </el-link>
|
||||
<el-link style="color: var(--theme-color);" :underline="false" href="https://beian.miit.gov.cn/" target="_blank"> {{icp_info}}</el-link>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user