Commit 68c655ed authored by zhengke's avatar zhengke

新增

parent d52c2179
......@@ -184,7 +184,9 @@
<li class="menu_item" :class="{'Fchecked':isChecked=='/bdactiveType'}" @click="isChecked='/bdactiveType',CommonJump('bdactiveType')">
<i class="el-icon-menu"></i><span>活动类型管理</span>
</li>
<li class="menu_item" :class="{'Fchecked':isChecked=='/topicList'}" @click="isChecked='/topicList',CommonJump('topicList')">
<i class="el-icon-menu"></i><span>话题列表</span>
</li>
</ul>
</div>
</div>
......
<template>
<div v-loading="loading" class="editTopic">
<div class="head-title">
<span @click="CommonJump('topicList')" class="blue point">话题列表</span> / 编辑话题
</div>
<div class="content">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="150px" style="width:50%">
<el-form-item label="话题名称" prop="Content" class="is-required" size="small">
<el-input v-model="addMsg.Content" placeholder="请输入话题名称" class="w400" />
</el-form-item>
<el-form-item label="图片" prop="CoverPhoto">
<el-button @click="openChangeDig()" size="small">选择文件</el-button>
<div class="app-gallery-item" style="position: relative;width: 100px;margin-top: 10px;border:none;">
<img v-if="!addMsg.CoverPhoto || addMsg.CoverPhoto==''" src="../../assets/img/default.png"
style="width:80px;height:80px" alt="">
<img v-else style="width:80px;height:80px" :src="addMsg.CoverPhoto" alt="">
</div>
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="addMsg.IsOpen" :label="1"></el-radio>
<el-radio v-model="addMsg.IsOpen" :label="2"></el-radio>
</el-form-item>
</el-form>
</div>
<div style="margin-top:20px">
<el-button size="small" type="primary" @click="Save('addMsg')">保存</el-button>
</div>
<!-- 选择文件 -->
<el-dialog title="选择文件" :visible.sync="changeState" width="1240px">
<ChooseImg @SelectId="SelectId"></ChooseImg>
</el-dialog>
</div>
</template>
<script>
import ChooseImg from "@/components/global/ChooseImg.vue";
export default {
components: {
ChooseImg
},
data() {
return {
addMsg: {
Id: 0,
IsOpen: 1, //是否显示1-是,2-否
Content: '',
CoverPhoto: '',
},
rules: {
Content: [{
required: true,
message: '请输入商品名称',
trigger: 'blur'
}]
},
loading: false,
changeState: false,
};
},
created() {
if (this.$route.query.Id) {
// this.addMsg.Id = this.$route.query.Id;
this.getData(this.$route.query.Id);
}
},
methods: {
Save(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.apipost("/api/Education/GetSetEducationTalk", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.CommonJump('topicList');
this.Success(res.data.message);
} else {
this.Error(res.data.message);
}
})
} else {
return false;
}
});
},
getData(Id) {
this.loading = true;
this.apipost("/api/Education/GetEducationTalkDetails", {
Id: Id
}, res => {
this.loading = false;
if (res.data.resultCode == 1) {
var temp = res.data.data;
this.addMsg.Id = temp.Id;
this.addMsg.IsOpen = temp.IsOpen;
this.addMsg.Content = temp.Content;
this.addMsg.CoverPhoto = temp.CoverPhoto;
}
})
},
openChangeDig(num) {
this.changeState = true;
},
SelectId(msg) {
let url = this.getIconLink(msg.url)
this.addMsg.CoverPhoto = url
this.changeState = false;
},
},
mounted() {}
};
</script>
<style>
.editTopic .content {
background: #fff;
margin-top: 10px;
padding: 20px;
box-sizing: border-box;
}
</style>
<template>
<div class="topicList">
<div class="el-card__header">
<span>话题列表</span>
<div style="display: flex;flex-direction: row;align-items: center">
<el-button type="primary" class="el-button--small" @click="addTopic">新增</el-button>
</div>
</div>
<div class="content">
<div style="display: flex;flex-direction: row;align-items: center">
<div class="block">
<span>是否显示</span>
<el-select class="w100" @change="getList()" style="margin-left: 10px;" v-model="msg.IsOpen" size="small"
placeholder="请选择">
<el-option label="不限" :value="0"></el-option>
<el-option label="是" :value="1"></el-option>
<el-option label="否" :value="2"></el-option>
</el-select>
</div>
</div>
</div>
<div style="padding: 20px;background: #fff;">
<el-table :data="dataList" header-cell-class-name="headClass" style="width: 100%" border>
<el-table-column prop="Id" label="ID" width="100">
<template slot-scope="scope">
<span @click="goRecruit(scope.row.Id)">{{scope.row.Id}}</span>
</template>
</el-table-column>
<el-table-column prop="Content" label="话题">
</el-table-column>
<el-table-column prop="CoverPhoto" label="图片">
<template slot-scope="scope">
<img v-if="scope.row.CoverPhoto" :src="scope.row.CoverPhoto" style="width:40px;height:40px;" alt="" />
</template>
</el-table-column>
<el-table-column prop="IsOpen" label="是否显示">
<template slot-scope="scope">
<el-switch @change="changeSwitch(scope.row)" v-model="scope.row.IsOpen" active-color="#409EFF"
:active-value="1" :inactive-value="2">
</el-switch>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="180">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
<img src="../../assets/img/setup/edit.png" alt="" class="imgstyle" @click="Edit(scope.row)">
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<img src="../../assets/img/setup/del.png" alt="" class="imgstyle" @click="delete_b(scope.row)">
</el-tooltip>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align:right" background @current-change="handleCurrentChange" :page-size="msg.pageSize"
layout="prev, pager, next" :current-page.sync="msg.pageIndex" :total="pageCount">
</el-pagination>
</div>
</div>
</template>
<script>
export default {
name: "topicList",
data() {
return {
msg: {
pageIndex: 1,
pageSize: 20,
IsOpen: 0,
},
dataList: [],
pageCount: 0,
loading: false
}
},
created() {
this.getList();
},
methods: {
getList() {
this.apipost(
"/api/Education/GetEducationTalkPageList", this.msg,
res => {
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.pageCount = res.data.data.pageCount;
} else {
this.Error(res.data.message);
}
},
);
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.getList();
},
//新增话题
addTopic() {
this.$router.push('/editTopic');
},
//删除话题
delete_b(row) {
let that = this;
that.Confirm("是否删除?", function () {
that.apipost(
"/api/Education/DelEducationTalk", {
Id: row.Id
},
res => {
if (res.data.resultCode == 1) {
that.Success(res.data.message);
that.getList();
} else {
that.Error(res.data.message);
}
},
);
});
},
//编辑数据
Edit(row) {
this.$router.push({
name: 'editTopic',
query: {
Id: row.Id,
blank: "y"
}
});
},
//切换
changeSwitch(item) {
let msg = {
Id: item.Id,
IsOpen: item.IsOpen
}
this.apipost("/api/Education/UpdateEducationTalkShow", msg, res => {
if (res.data.resultCode == 1) {
this.Success(res.data.message);
this.getList();
}
})
}
},
}
</script>
<style>
.topicList .el-card__header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background: #fff;
}
.topicList .content {
background: #fff;
margin-top: 10px;
padding: 15px;
box-sizing: border-box;
}
</style>
......@@ -310,6 +310,14 @@ export default new Router({
path: '/bdactiveType', //相亲活动类型管理
name: 'bdactiveType',
component: resolve => require(['@/components/blindDate/bdactiveType'], resolve),
},{
path: '/topicList', //相亲活动话题列表
name: 'topicList',
component: resolve => require(['@/components/blindDate/topicList'], resolve),
},{
path: '/editTopic', //相亲活动话题编辑
name: 'editTopic',
component: resolve => require(['@/components/blindDate/editTopic'], resolve),
}]
},
{
......
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