|
@@ -107,285 +107,285 @@ import tableTitle from './components/tableTitle.vue';
|
|
|
//引入公用样式
|
|
|
import '@/styles/global.less';
|
|
|
import { addFooterContent, getFooterContent, upFooterContent, delFooterContent } from '@/api/tabbar'
|
|
|
-// export default {
|
|
|
-// components: {
|
|
|
-// tableTitle,//表格标题-
|
|
|
-// },
|
|
|
-// data() {
|
|
|
-// const validateEmpty = (rule, value, callback) => {
|
|
|
-// if (value.length == 0) {
|
|
|
-// callback(new Error('该项不能为空!'))
|
|
|
-// } else {
|
|
|
-// callback()
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return {
|
|
|
-// tableDivTitle: "单页详情", //列表标题
|
|
|
-// dialogTableVisible: false, //编辑弹框
|
|
|
-// dialogName: '编辑', //编辑弹窗名称
|
|
|
-
|
|
|
-// tableData: [],//表格数据
|
|
|
-// tabbarId: '',//底部导航传递的id
|
|
|
-// tabbarType: 1,//底部导航传递的类型
|
|
|
-
|
|
|
-// //活动id
|
|
|
-// activeid: "",
|
|
|
-
|
|
|
-// // 分页相关
|
|
|
-// page: 1,
|
|
|
-// pageSize: 10,
|
|
|
-// total: 0,
|
|
|
-
|
|
|
-
|
|
|
-// // 搜索框相关
|
|
|
-// listTitle: '', //网站名称id
|
|
|
-// contentTitle: '', //广告位名称
|
|
|
-
|
|
|
-// //弹框相关
|
|
|
-// ruleForm: {
|
|
|
-// listTitle: '', //列表标题
|
|
|
-// contentTitle: '', //内容标题
|
|
|
-// contentDetail: '', //内容详情
|
|
|
-// },
|
|
|
-// rules: {
|
|
|
-// listTitle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
-// contentTitle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
-// contentDetail: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
-// }
|
|
|
-// }
|
|
|
-// },
|
|
|
-// methods: {
|
|
|
-// //1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
-// //1.1 开始请求列表信息方法
|
|
|
-// getData() {
|
|
|
-// getFooterContent({
|
|
|
-// fcat_id: this.tabbarId,
|
|
|
-// page: this.page,
|
|
|
-// pageSize: this.pageSize
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// this.tableData = data.data.rows
|
|
|
-// this.total = data.data.count
|
|
|
-// })
|
|
|
-// },
|
|
|
-
|
|
|
-// //1.2 删除内容
|
|
|
-// deleteRow(id) {
|
|
|
-// console.log(id);
|
|
|
-// let data = new FormData()
|
|
|
-// data.append('id', id)
|
|
|
-// this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
|
|
|
-// confirmButtonText: '确定',
|
|
|
-// cancelButtonText: '取消',
|
|
|
-// }).then(() => {
|
|
|
-// console.log("当前删除:" + id)
|
|
|
-
|
|
|
-// delFooterContent({
|
|
|
-// id: id
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// if (data.code = 200) {
|
|
|
-// this.$message({
|
|
|
-// message: '删除成功',
|
|
|
-// type: 'success'
|
|
|
-// })
|
|
|
-// this.getData()
|
|
|
-// } else if (data.code == 0) {
|
|
|
-// this.$message({
|
|
|
-// message: data.message,
|
|
|
-// type: 'error'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// })
|
|
|
-
|
|
|
-// }).catch(() => {
|
|
|
-// this.$message({
|
|
|
-// type: 'warning',
|
|
|
-// message: '已取消删除'
|
|
|
-// });
|
|
|
-// });
|
|
|
-// },
|
|
|
-
|
|
|
-// //1.3 列表内容分页
|
|
|
-// //直接跳转
|
|
|
-// handleSizeChange(val) {
|
|
|
-// this.page = val;
|
|
|
-// this.getData();
|
|
|
-// },
|
|
|
-// //1.4 点击分页
|
|
|
-// handleCurrentChange(val) {
|
|
|
-// this.page = val;
|
|
|
-// this.getData();
|
|
|
-// },
|
|
|
-// // 1.5 搜索按钮
|
|
|
-// goSearch() {
|
|
|
-// getFooterContent({
|
|
|
-// fcat_id: this.tabbarId,
|
|
|
-// page: this.page,
|
|
|
-// pageSize: this.pageSize,
|
|
|
-// list_title:this.listTitle,
|
|
|
-// con_title:this.contentTitle,
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// this.tableData = data.data.rows
|
|
|
-// this.total = data.data.count
|
|
|
-// })
|
|
|
-// },
|
|
|
-// //1.6 重置按钮
|
|
|
-// goReset() {
|
|
|
-// this.listTitle = ""
|
|
|
-// this.contentTitle = ""
|
|
|
-// this.getData()
|
|
|
-// },
|
|
|
-// //列表和分页相关 end ------------------------------------------------------------>
|
|
|
-
|
|
|
-// //1.7 编辑
|
|
|
-// goEdit(id, val) {
|
|
|
-// // console.log(id);
|
|
|
-// this.dialogName = '编辑'
|
|
|
-// this.activeid = id
|
|
|
-// this.dialogTableVisible = true
|
|
|
-// console.log(id, val);
|
|
|
-
|
|
|
-// //数据回显
|
|
|
-// this.ruleForm.listTitle = val.list_title //列表标题
|
|
|
-// this.ruleForm.contentTitle = val.con_title //内容标题
|
|
|
-// this.ruleForm.contentDetail = val.content //内容详情
|
|
|
-// },
|
|
|
-
|
|
|
-// //1.8 添加
|
|
|
-// addWebsite() {
|
|
|
-// this.dialogTableVisible = true
|
|
|
-// this.dialogName = "添加"
|
|
|
-
|
|
|
-// //添加时清空回显回来的数据
|
|
|
-// this.ruleForm.contentTitle = '' //内容标题
|
|
|
-// this.ruleForm.contentDetail = '' //内容详情
|
|
|
-// },
|
|
|
-
|
|
|
-// // 弹出层相关方法
|
|
|
-// // 1.9 提交表单
|
|
|
-// submitForm(formName) {
|
|
|
-// // 判断用户是否输入数据
|
|
|
-// this.$refs[formName].validate((valid) => {
|
|
|
-// if (valid) {
|
|
|
-// console.log('submit!');
|
|
|
-// } else {
|
|
|
-// console.log('error submit!!');
|
|
|
-// return false;
|
|
|
-// }
|
|
|
-// });
|
|
|
-// if (this.dialogName == "添加") {
|
|
|
-// if (this.tabbarType == 0) { //详情页类型
|
|
|
-// addFooterContent({
|
|
|
-// fcat_id: this.tabbarId,
|
|
|
-// type: this.tabbarType,
|
|
|
-// con_title: this.ruleForm.contentTitle,
|
|
|
-// content: this.ruleForm.contentDetail,
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// if (data.code == 200) {
|
|
|
-// this.$message({
|
|
|
-// message: '添加成功',
|
|
|
-// type: 'success'
|
|
|
-// })
|
|
|
-// this.dialogTableVisible = false
|
|
|
-// this.getData()
|
|
|
-// } else {
|
|
|
-// this.$message({
|
|
|
-// message: data.message,
|
|
|
-// type: 'error'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// })
|
|
|
-// } else if (this.tabbarType == 1) { //列表页类型
|
|
|
-// addFooterContent({
|
|
|
-// fcat_id: this.tabbarId,
|
|
|
-// type: this.tabbarType,
|
|
|
-// list_title: this.ruleForm.listTitle,
|
|
|
-// con_title: this.ruleForm.contentTitle,
|
|
|
-// content: this.ruleForm.contentDetail,
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// if (data.code == 200) {
|
|
|
-// this.$message({
|
|
|
-// message: '添加成功',
|
|
|
-// type: 'success'
|
|
|
-// })
|
|
|
-// this.dialogTableVisible = false
|
|
|
-// this.getData()
|
|
|
-// } else {
|
|
|
-// this.$message({
|
|
|
-// message: data.message,
|
|
|
-// type: 'error'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// })
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (this.dialogName == "编辑") {
|
|
|
-// if (this.tabbarType == 0) { //详情页类型
|
|
|
-// upFooterContent({
|
|
|
-// id: this.activeid, //内容id
|
|
|
-// type: this.tabbarType,
|
|
|
-// con_title: this.ruleForm.contentTitle,
|
|
|
-// content: this.ruleForm.contentDetail,
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// if (data.code == 200) {
|
|
|
-// this.$message({
|
|
|
-// message: '修改成功!',
|
|
|
-// type: 'success'
|
|
|
-// })
|
|
|
-// this.dialogTableVisible = false
|
|
|
-// this.getData()
|
|
|
-// } else {
|
|
|
-// this.$message({
|
|
|
-// message: data.message,
|
|
|
-// type: 'error'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// })
|
|
|
-// } else if (this.tabbarType == 1) { //列表页类型
|
|
|
-// upFooterContent({
|
|
|
-// id: this.activeid, //内容id
|
|
|
-// type: this.tabbarType,
|
|
|
-// list_title: this.ruleForm.listTitle,
|
|
|
-// con_title: this.ruleForm.contentTitle,
|
|
|
-// content: this.ruleForm.contentDetail,
|
|
|
-// }).then(data => {
|
|
|
-// console.log(data);
|
|
|
-// if (data.code == 200) {
|
|
|
-// this.$message({
|
|
|
-// message: '修改成功!',
|
|
|
-// type: 'success'
|
|
|
-// })
|
|
|
-// this.dialogTableVisible = false
|
|
|
-// this.getData()
|
|
|
-// } else {
|
|
|
-// this.$message({
|
|
|
-// message: data.message,
|
|
|
-// type: 'error'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// })
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// },
|
|
|
-// //取消
|
|
|
-// cancelForm() {
|
|
|
-// this.dialogTableVisible = false
|
|
|
-// },
|
|
|
-// },
|
|
|
-// mounted() {
|
|
|
-// console.log(this.$route.query.id);
|
|
|
-// this.tabbarId = this.$route.query.id
|
|
|
-// this.tabbarType = this.$route.query.type
|
|
|
-
|
|
|
-// this.getData() //获取数据
|
|
|
-// },
|
|
|
-// }
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ tableTitle,//表格标题
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ const validateEmpty = (rule, value, callback) => {
|
|
|
+ if (value.length == 0) {
|
|
|
+ callback(new Error('该项不能为空!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ tableDivTitle: "单页详情", //列表标题
|
|
|
+ dialogTableVisible: false, //编辑弹框
|
|
|
+ dialogName: '编辑', //编辑弹窗名称
|
|
|
+
|
|
|
+ tableData: [],//表格数据
|
|
|
+ tabbarId: '',//底部导航传递的id
|
|
|
+ tabbarType: 1,//底部导航传递的类型
|
|
|
+
|
|
|
+ //活动id
|
|
|
+ activeid: "",
|
|
|
+
|
|
|
+ // 分页相关
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+
|
|
|
+
|
|
|
+ // 搜索框相关
|
|
|
+ listTitle: '', //网站名称id
|
|
|
+ contentTitle: '', //广告位名称
|
|
|
+
|
|
|
+ //弹框相关
|
|
|
+ ruleForm: {
|
|
|
+ listTitle: '', //列表标题
|
|
|
+ contentTitle: '', //内容标题
|
|
|
+ contentDetail: '', //内容详情
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ listTitle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ contentTitle: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ contentDetail: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
+ //1.1 开始请求列表信息方法
|
|
|
+ getData() {
|
|
|
+ getFooterContent({
|
|
|
+ fcat_id: this.tabbarId,
|
|
|
+ page: this.page,
|
|
|
+ pageSize: this.pageSize
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ this.tableData = data.data.rows
|
|
|
+ this.total = data.data.count
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ //1.2 删除内容
|
|
|
+ deleteRow(id) {
|
|
|
+ console.log(id);
|
|
|
+ let data = new FormData()
|
|
|
+ data.append('id', id)
|
|
|
+ this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ }).then(() => {
|
|
|
+ console.log("当前删除:" + id)
|
|
|
+
|
|
|
+ delFooterContent({
|
|
|
+ id: id
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code = 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.getData()
|
|
|
+ } else if (data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ //1.3 列表内容分页
|
|
|
+ //直接跳转
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.page = val;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ //1.4 点击分页
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page = val;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ // 1.5 搜索按钮
|
|
|
+ goSearch() {
|
|
|
+ getFooterContent({
|
|
|
+ fcat_id: this.tabbarId,
|
|
|
+ page: this.page,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ list_title:this.listTitle,
|
|
|
+ con_title:this.contentTitle,
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ this.tableData = data.data.rows
|
|
|
+ this.total = data.data.count
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //1.6 重置按钮
|
|
|
+ goReset() {
|
|
|
+ this.listTitle = ""
|
|
|
+ this.contentTitle = ""
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ //列表和分页相关 end ------------------------------------------------------------>
|
|
|
+
|
|
|
+ //1.7 编辑
|
|
|
+ goEdit(id, val) {
|
|
|
+ // console.log(id);
|
|
|
+ this.dialogName = '编辑'
|
|
|
+ this.activeid = id
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ console.log(id, val);
|
|
|
+
|
|
|
+ //数据回显
|
|
|
+ this.ruleForm.listTitle = val.list_title //列表标题
|
|
|
+ this.ruleForm.contentTitle = val.con_title //内容标题
|
|
|
+ this.ruleForm.contentDetail = val.content //内容详情
|
|
|
+ },
|
|
|
+
|
|
|
+ //1.8 添加
|
|
|
+ addWebsite() {
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ this.dialogName = "添加"
|
|
|
+
|
|
|
+ //添加时清空回显回来的数据
|
|
|
+ this.ruleForm.contentTitle = '' //内容标题
|
|
|
+ this.ruleForm.contentDetail = '' //内容详情
|
|
|
+ },
|
|
|
+
|
|
|
+ // 弹出层相关方法
|
|
|
+ // 1.9 提交表单
|
|
|
+ submitForm(formName) {
|
|
|
+ // 判断用户是否输入数据
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ console.log('submit!');
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (this.dialogName == "添加") {
|
|
|
+ if (this.tabbarType == 0) { //详情页类型
|
|
|
+ addFooterContent({
|
|
|
+ fcat_id: this.tabbarId,
|
|
|
+ type: this.tabbarType,
|
|
|
+ con_title: this.ruleForm.contentTitle,
|
|
|
+ content: this.ruleForm.contentDetail,
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.tabbarType == 1) { //列表页类型
|
|
|
+ addFooterContent({
|
|
|
+ fcat_id: this.tabbarId,
|
|
|
+ type: this.tabbarType,
|
|
|
+ list_title: this.ruleForm.listTitle,
|
|
|
+ con_title: this.ruleForm.contentTitle,
|
|
|
+ content: this.ruleForm.contentDetail,
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.dialogName == "编辑") {
|
|
|
+ if (this.tabbarType == 0) { //详情页类型
|
|
|
+ upFooterContent({
|
|
|
+ id: this.activeid, //内容id
|
|
|
+ type: this.tabbarType,
|
|
|
+ con_title: this.ruleForm.contentTitle,
|
|
|
+ content: this.ruleForm.contentDetail,
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功!',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.tabbarType == 1) { //列表页类型
|
|
|
+ upFooterContent({
|
|
|
+ id: this.activeid, //内容id
|
|
|
+ type: this.tabbarType,
|
|
|
+ list_title: this.ruleForm.listTitle,
|
|
|
+ con_title: this.ruleForm.contentTitle,
|
|
|
+ content: this.ruleForm.contentDetail,
|
|
|
+ }).then(data => {
|
|
|
+ console.log(data);
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功!',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: data.message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ //取消
|
|
|
+ cancelForm() {
|
|
|
+ this.dialogTableVisible = false
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ console.log(this.$route.query.id);
|
|
|
+ this.tabbarId = this.$route.query.id
|
|
|
+ this.tabbarType = this.$route.query.type
|
|
|
+
|
|
|
+ this.getData() //获取数据
|
|
|
+ },
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|