Commit c268895f authored by 黄奎's avatar 黄奎

新增页面

parent ba148fcf
<template>
<div class="projectClass">
<template v-if="projectClassIsShowAdd">
<div class="head-title">
门店管理
<el-button @click="projectClassIsShowAdd=false" style="float:right;margin-top: -5px;" size="small"
type="primary">
添加门店
</el-button>
</div>
<div class="content">
<div>
<div class="searchInput">
<el-input style="display:inline-block;width:225px;height:30px" placeholder="请输入搜索内容"
v-model="msg.TopicName" size="small" clearable @keyup.enter.native="msg.pageIndex=1,getList()">
</el-input>
<span class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"
@click="msg.pageIndex=1,getList()"> </span>
</div>
</div>
<el-table :data="dataList" v-loading="loading" border style="width: 100%;margin:20px 0">
<el-table-column prop="Id" label="ID" width="150">
</el-table-column>
<el-table-column prop="TopicName" label="分类名称" width="829">
</el-table-column>
<el-table-column prop="SortNum" label="排序" width="250">
</el-table-column>
<el-table-column prop="IsDisable" label="状态" width="150">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsDisable" active-color="#409EFF" :active-value="1" :inactive-value="0"
@change="updateIsDisable(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<img @click="EditprojectClass(scope.row)" class="operatImg" src="../../assets/img/userman/edit.png"
alt="">
<img @click="RemoveprojectClass(scope.row)" class="operatImg" src="../../assets/img/userman/del.png"
alt="">
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
:page-size="msg.pageSize" layout="prev, pager, next" :total="total">
</el-pagination>
</div>
</template>
<template v-else>
<div class="head-title">
<span @click="projectClassIsShowAdd=true" style="color:rgb(64, 158, 255);cursor:pointer;">文章</span><span
style="margin:0 9px;color:#C0C4CC">/</span><span>文章编辑</span>
</div>
<div class="content">
<div class="projectClass_condiv">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" style="padding:0 20px;">
<el-form-item label="专题分类名称" prop="title">
<el-input v-model="addMsg.TopicName" size="small" placeholder="请输入名称" maxlength="20" />
</el-form-item>
<el-form-item label="排序">
<el-input type="text" v-model="addMsg.SortNum" size="small" @keyup.native="checkInteger(addMsg,'SortNum')"
placeholder="请输入排序" maxlength="4" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="addMsg.IsDisable" active-color="#409EFF" :active-value="1" :inactive-value="0">
</el-switch>
</el-form-item>
</el-form>
</div>
</div>
<el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存
</el-button>
</template>
</div>
</template>
<script>
export default {
data() {
return {
//是否线下链接弹窗
loading: false,
dataList: [],
msg: {
pageIndex: 1,
pageSize: 15,
TopicName: ""
},
total: 0,
projectClassIsShowAdd: true,
addMsg: {
Id: 0, //编号
TopicName: '', //专题分类名称
SortNum: 0, //排序
IsDisable: 0, //状态
},
rules: {
TopicName: [{
required: true,
message: '专题分类名称',
trigger: 'change'
}],
},
};
},
created() {
},
methods: {
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
getList() {
this.apipost("/api/MContent/GetTopicTypePageList", this.msg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
submitform(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.saveMsg();
} else {
return false;
}
});
},
//保存
saveMsg() {
this.apipost("/api/MContent/SetTopicType", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.projectClassIsShowAdd = true;
this.getList();
this.Success(res.data.message);
} else {
this.Info(res.data.message);
}
})
},
//修改
EditprojectClass(item) {
this.apipost("/api/MContent/GetTopicType", {
Id: item.Id
}, res => {
if (res.data.resultCode == 1) {
this.projectClassIsShowAdd = false;
var jsonData = res.data.data;
this.addMsg.Id = jsonData.Id;
this.addMsg.TopicName = jsonData.TopicName;
this.addMsg.SortNum = jsonData.SortNum;
this.addMsg.IsDisable = jsonData.IsDisable;
} else {
this.Info(res.data.message);
}
})
},
//删除
RemoveprojectClass(item) {
var that = this;
that.Confirm("是否要删除?", function () {
that.apipost("/api/MContent/RemoveTopicType", {
Id: item.Id
}, res => {
if (res.data.resultCode == 1) {
that.getList();
} else {
that.Info(res.data.message);
}
})
})
},
//更新状态
updateIsDisable(item) {
this.apipost("/api/MContent/UpdateTopicTypeStatus", {
Id: item.Id,
IsDisable: item.IsDisable
}, res => {
if (res.data.resultCode == 1) {
this.ArticleIsShowAdd = true;
this.getList();
this.Success(res.data.message);
} else {
this.Info(res.data.message);
}
})
},
input(obj) {
this.addMsg.content = obj
},
},
mounted() {
this.getList();
}
};
</script>
<style>
.projectClass .content .searchInput {
border: 1px solid #DCDFE6;
border-radius: 4px;
}
.projectClass .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px;
line-height: 30px;
}
.projectClass .content .searchInput {
line-height: normal;
display: inline-table;
width: 100%;
border-collapse: separate;
border-spacing: 0;
width: 250px;
margin-right: 20px;
}
.projectClass .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
.projectClass .operatImg {
width: 32px;
height: 32px;
margin: 0 10px
}
.projectClass .projectClass_condiv {
padding: 20px 0;
background-color: #fff;
margin-bottom: 20px;
padding-right: 50%;
}
</style>
<template>
<div class="projectClass">
<template v-if="projectClassIsShowAdd">
<div class="head-title">
视频管理
<el-button @click="projectClassIsShowAdd=false" style="float:right;margin-top: -5px;" size="small"
type="primary">
添加视频
</el-button>
</div>
<div class="content">
<div>
<div class="searchInput">
<el-input style="display:inline-block;width:225px;height:30px" placeholder="请输入搜索内容"
v-model="msg.TopicName" size="small" clearable @keyup.enter.native="msg.pageIndex=1,getList()">
</el-input>
<span class="el-icon-search" style="color:#979dad;font-size:14px;position:relative;top:1px"
@click="msg.pageIndex=1,getList()"> </span>
</div>
</div>
<el-table :data="dataList" v-loading="loading" border style="width: 100%;margin:20px 0">
<el-table-column prop="Id" label="ID" width="150">
</el-table-column>
<el-table-column prop="TopicName" label="分类名称" width="829">
</el-table-column>
<el-table-column prop="SortNum" label="排序" width="250">
</el-table-column>
<el-table-column prop="IsDisable" label="状态" width="150">
<template slot-scope="scope">
<el-switch v-model="scope.row.IsDisable" active-color="#409EFF" :active-value="1" :inactive-value="0"
@change="updateIsDisable(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<img @click="EditprojectClass(scope.row)" class="operatImg" src="../../assets/img/userman/edit.png"
alt="">
<img @click="RemoveprojectClass(scope.row)" class="operatImg" src="../../assets/img/userman/del.png"
alt="">
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange"
:page-size="msg.pageSize" layout="prev, pager, next" :total="total">
</el-pagination>
</div>
</template>
<template v-else>
<div class="head-title">
<span @click="projectClassIsShowAdd=true" style="color:rgb(64, 158, 255);cursor:pointer;">文章</span><span
style="margin:0 9px;color:#C0C4CC">/</span><span>文章编辑</span>
</div>
<div class="content">
<div class="projectClass_condiv">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" style="padding:0 20px;">
<el-form-item label="专题分类名称" prop="title">
<el-input v-model="addMsg.TopicName" size="small" placeholder="请输入名称" maxlength="20" />
</el-form-item>
<el-form-item label="排序">
<el-input type="text" v-model="addMsg.SortNum" size="small" @keyup.native="checkInteger(addMsg,'SortNum')"
placeholder="请输入排序" maxlength="4" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="addMsg.IsDisable" active-color="#409EFF" :active-value="1" :inactive-value="0">
</el-switch>
</el-form-item>
</el-form>
</div>
</div>
<el-button size="small" style="margin-top:20px;padding:9px 25px;" type="primary" @click="submitform('addMsg')">保存
</el-button>
</template>
</div>
</template>
<script>
export default {
data() {
return {
//是否线下链接弹窗
loading: false,
dataList: [],
msg: {
pageIndex: 1,
pageSize: 15,
TopicName: ""
},
total: 0,
projectClassIsShowAdd: true,
addMsg: {
Id: 0, //编号
TopicName: '', //专题分类名称
SortNum: 0, //排序
IsDisable: 0, //状态
},
rules: {
TopicName: [{
required: true,
message: '专题分类名称',
trigger: 'change'
}],
},
};
},
created() {
},
methods: {
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
getList() {
this.apipost("/api/MContent/GetTopicTypePageList", this.msg, res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.total = res.data.data.count;
} else {
this.Info(res.data.message);
}
})
},
submitform(addMsg) {
//提交创建、修改表单
this.$refs[addMsg].validate(valid => {
if (valid) {
this.saveMsg();
} else {
return false;
}
});
},
//保存
saveMsg() {
this.apipost("/api/MContent/SetTopicType", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.projectClassIsShowAdd = true;
this.getList();
this.Success(res.data.message);
} else {
this.Info(res.data.message);
}
})
},
//修改
EditprojectClass(item) {
this.apipost("/api/MContent/GetTopicType", {
Id: item.Id
}, res => {
if (res.data.resultCode == 1) {
this.projectClassIsShowAdd = false;
var jsonData = res.data.data;
this.addMsg.Id = jsonData.Id;
this.addMsg.TopicName = jsonData.TopicName;
this.addMsg.SortNum = jsonData.SortNum;
this.addMsg.IsDisable = jsonData.IsDisable;
} else {
this.Info(res.data.message);
}
})
},
//删除
RemoveprojectClass(item) {
var that = this;
that.Confirm("是否要删除?", function () {
that.apipost("/api/MContent/RemoveTopicType", {
Id: item.Id
}, res => {
if (res.data.resultCode == 1) {
that.getList();
} else {
that.Info(res.data.message);
}
})
})
},
//更新状态
updateIsDisable(item) {
this.apipost("/api/MContent/UpdateTopicTypeStatus", {
Id: item.Id,
IsDisable: item.IsDisable
}, res => {
if (res.data.resultCode == 1) {
this.ArticleIsShowAdd = true;
this.getList();
this.Success(res.data.message);
} else {
this.Info(res.data.message);
}
})
},
input(obj) {
this.addMsg.content = obj
},
},
mounted() {
this.getList();
}
};
</script>
<style>
.projectClass .content .searchInput {
border: 1px solid #DCDFE6;
border-radius: 4px;
}
.projectClass .content .searchInput .el-input__inner {
border: none;
outline: none;
height: 30px;
line-height: 30px;
}
.projectClass .content .searchInput {
line-height: normal;
display: inline-table;
width: 100%;
border-collapse: separate;
border-spacing: 0;
width: 250px;
margin-right: 20px;
}
.projectClass .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
.projectClass .operatImg {
width: 32px;
height: 32px;
margin: 0 10px
}
.projectClass .projectClass_condiv {
padding: 20px 0;
background-color: #fff;
margin-bottom: 20px;
padding-right: 50%;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment