diff --git a/src/api/index.js b/src/api/index.js index 0504505..d7392f7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -87,5 +87,6 @@ export default { findFloating: `/iasf/SysFloatingColumnSchemeService/SysFloatingColumnScheme/findById`, listFloating: `/iasf/SysFloatingColumnSchemeService/SysFloatingColumnScheme/floatingBarList`, saveFloating: `/iasf/SysFloatingColumnSchemeService/SysFloatingColumnScheme/saveOrUpdate`, + checkEnableOrDisable: `/iasf/SysFloatingColumnSchemeService/SysFloatingColumnScheme/checkEnableOrDisable`, enableOrDisableScheme: `/iasf/SysFloatingColumnSchemeService/SysFloatingColumnScheme/enableOrDisableScheme`, } \ No newline at end of file diff --git a/src/pages/floatingFrame/index.vue b/src/pages/floatingFrame/index.vue index 6dfbe0b..b6e7118 100644 --- a/src/pages/floatingFrame/index.vue +++ b/src/pages/floatingFrame/index.vue @@ -29,7 +29,7 @@ 删除 + @change="switchOff(scope.row)"> @@ -62,16 +62,16 @@ - + @@ -168,7 +168,47 @@ export default { schemeName: '', floatingBarStyle: '1', siteId: this.$store.state.content.site.id, - floatingColumnSchemeModules: [], + floatingColumnSchemeModules: [ + { + pictureAddress: 'https://huorantech.com/images/index/wechat.png', + schemeTitle: '微信扫码添加职站售前咨询', + isDisable: 0, + schemeContentJson: ` +
+

提供付费咨询及解决方案

+ +
+ ` + }, + { + pictureAddress: 'https://huorantech.com/images/index/tel.png', + schemeTitle: '', + isDisable: 0, + schemeContentJson: ` +
+
+
+ +
+
+

售前咨询

+

金老师

+

15218726836

+
+
+
+
+ +
+
+ 咨询,建议与反馈 +

您的每一条建议声音,我们都认真对待

+
+
+
+ ` + } + ], floatingColumnSchemeScopeOfApplications: [], }, originModules: { @@ -192,9 +232,9 @@ export default { pictureAddress: [ { required: true, message: '请上传图片', trigger: 'change' } ], - schemeTitle: [ - { required: true, message: '请输入标题', trigger: 'blur' } - ], + // schemeTitle: [ + // { required: true, message: '请输入标题', trigger: 'blur' } + // ], schemeContentJson: [ { required: true, message: '请输入内容', trigger: 'blur' } ], @@ -202,7 +242,7 @@ export default { cropperModel: false, isUpload: false, - fixedNumber: [1.76, 1], + fixedNumber: [1, 1], file: {}, // 当前被选择的图片文件 }; }, @@ -433,8 +473,23 @@ export default { }).catch(() => { }) }, // 禁用启用 - async switchOff (val, row) { - await this.$post(`${this.api.enableOrDisableScheme}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + async switchOff (row) { + try { + const { code, msg } = await this.$post(`${this.api.checkEnableOrDisable}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + // debugger + if (code === 300) { + // 悬浮栏管理里的禁用启用返回300要弹询问框选择是否继续 + this.$confirm(msg, '提示', { + type: "warning" + }).then(async () => { + await this.$post(`${this.api.enableOrDisableScheme}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + }).catch(() => { + row.isDisable = row.isDisable ? 0 : 1 + }) + } else { + await this.$post(`${this.api.enableOrDisableScheme}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + } + } catch (e) { } }, // 批量删除 batchDel () { diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index a40d432..ee9f49c 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -18,10 +18,10 @@ service.interceptors.request.use(config => { return config; }, err => { Util.errorMsg({ - message: "退出登陆", - onClose: function() { - store.dispatch('user/logout') - } + message: "退出登陆", + onClose: function () { + store.dispatch('user/logout') + } }); return Promise.reject(err); }); @@ -32,13 +32,16 @@ service.interceptors.response.use( const res = response.data const { code } = res if (code == 200) { - return Promise.resolve(res).catch(e => {}); + return Promise.resolve(res).catch(e => { }); } else if (code === 401) { Util.errorMsg(res.msg) setTimeout(() => { store.dispatch('user/logout') }, 1000) return Promise.reject(res) + } else if (code == 300) { + // 悬浮栏管理里的禁用启用返回300要弹询问框选择是否继续 + return Promise.resolve(res).catch(e => { }); } else { Util.errorMsg(res.msg); return Promise.reject(res) @@ -46,72 +49,72 @@ service.interceptors.response.use( }, // 服务器状态码不是200的情况 error => { - if (error.response.status) { - const { msg, code } = error.response.data - switch (code) { - // 401: 未登录 - case 401: - Util.errorMsg("登录过期,请重新登录"); - setTimeout(() => { - store.dispatch('user/logout') - }, 1000); - break; - // 403 token过期 - case 403: - Util.errorMsg("登录过期,请重新登录"); - setTimeout(() => { - store.dispatch('user/logout') - }, 1000); - break; - // 其他错误,直接抛出错误提示 - default: - Util.errorMsg(msg); - Promise.reject(error.response.data); - } - return Promise.reject(error.response); + if (error.response.status) { + const { msg, code } = error.response.data + switch (code) { + // 401: 未登录 + case 401: + Util.errorMsg("登录过期,请重新登录"); + setTimeout(() => { + store.dispatch('user/logout') + }, 1000); + break; + // 403 token过期 + case 403: + Util.errorMsg("登录过期,请重新登录"); + setTimeout(() => { + store.dispatch('user/logout') + }, 1000); + break; + // 其他错误,直接抛出错误提示 + default: + Util.errorMsg(msg); + Promise.reject(error.response.data); } + return Promise.reject(error.response); + } } ); -function get(url, params) { +function get (url, params) { return new Promise((resolve, reject) => { - service.get(url, { params: params }).then(res => { - resolve(res); - }).catch(err => { - reject(err); - }); + service.get(url, { params: params }).then(res => { + resolve(res); + }).catch(err => { + reject(err); + }); }); } -function post(url, params) { +function post (url, params) { return new Promise((resolve, reject) => { - service.post(url, params).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); + service.post(url, params).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); }); } -function del(url, params) { +function del (url, params) { return new Promise((resolve, reject) => { - service.delete(url, { - data: params - }).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); + service.delete(url, { + data: params + }).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); }); } -function put(url, params) { +function put (url, params) { return new Promise((resolve, reject) => { - service.put(url, params).then(res => { - resolve(res); - }).catch(err => { - reject(err.data); - }); + service.put(url, params).then(res => { + resolve(res); + }).catch(err => { + reject(err.data); + }); }); }