diff --git a/src/components/setting/banner/BannerManage.vue b/src/components/setting/banner/BannerManage.vue index 5c59907..0d4fddc 100644 --- a/src/components/setting/banner/BannerManage.vue +++ b/src/components/setting/banner/BannerManage.vue @@ -9,22 +9,12 @@ 创建Banner - - - - 查询目录 - + + + @@ -83,18 +89,11 @@ - - + @@ -107,33 +106,22 @@ > @@ -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; + }, diff --git a/src/components/setting/notice/NoticeManage.vue b/src/components/setting/notice/NoticeManage.vue index c25e0df..3845897 100644 --- a/src/components/setting/notice/NoticeManage.vue +++ b/src/components/setting/notice/NoticeManage.vue @@ -125,8 +125,6 @@ - - \ No newline at end of file diff --git a/src/components/setting/website/websiteManage.vue b/src/components/setting/website/websiteManage.vue index 897597f..3f408ce 100644 --- a/src/components/setting/website/websiteManage.vue +++ b/src/components/setting/website/websiteManage.vue @@ -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 { diff --git a/src/views/Index.vue b/src/views/Index.vue index e6e41dd..53ee08e 100644 --- a/src/views/Index.vue +++ b/src/views/Index.vue @@ -28,7 +28,7 @@
-
+
备案号: {{icp_info}}