diff --git a/src/layout/feedback.vue b/src/layout/feedback.vue index e8be2c6..702c4d8 100644 --- a/src/layout/feedback.vue +++ b/src/layout/feedback.vue @@ -1,22 +1,36 @@ @@ -25,8 +39,12 @@ import SimpleDrawingBoard from 'simple-drawing-board' import html2canvas from 'html2canvas' export default { - props: ['showDialog'], - + props: { + showDialog: { + type: Boolean, + required: true + } + }, data() { return { feedback: { @@ -50,10 +68,10 @@ export default { }, methods: { - async loadLibrary () { + async loadLibrary() { if (typeof html2canvas === 'undefined') { try { - console.error('html2canvas not import', e.toString()) + console.error('html2canvas not import') } catch (e) { console.error('html2canvas.min.js is missing', e.toString()) return null @@ -71,20 +89,23 @@ export default { modals[i].setAttribute('data-html2canvas-ignore', 'true') } - html2canvas(document.body, { logging: false }) + html2canvas(document.body, { logging: false }) .then(canvas => { let screenshot = document.getElementById('screenshot') canvas.setAttribute('style', 'width:100%') screenshot.appendChild(canvas) this.dataLoading = false - window.sdb = new SimpleDrawingBoard(screenshot.getElementsByTagName('canvas')[0], { - lineColor: '#ff0000', - lineSize: 4 - }) + window.sdb = new SimpleDrawingBoard( + screenshot.getElementsByTagName('canvas')[0], + { + lineColor: '#ff0000', + lineSize: 4 + } + ) }) .catch(e => { this.dataLoading = false - util.showErrorMessageBox(e) + console.log(e.toString()) }) }) }, @@ -106,21 +127,27 @@ export default { } formData.append('feedback', this.feedback.info) } - let res = await axios.post('http://', formData, { - headers: { - 'Origin': window.location.origin, - 'Content-Type': 'multipart/form-data' - }, - changeOrigin: true - }) + // let res = await axios.post('http://', formData, { + // headers: { + // 'Origin': window.location.origin, + // 'Content-Type': 'multipart/form-data' + // }, + // changeOrigin: true + // }) this.confirmLoading = false - util.showResponseMessage(res.data.data) - if (res.data.data.status === 1) { - this.show = false - } + this.$notify({ + title: '反馈成功', + type: 'success', + duration: 2500 + }) + this.show = false } catch (e) { - util.showErrorMessageBox(e) + this.$notify({ + title: '提交失败', + type: 'error', + duration: 2500 + }) this.confirmLoading = false } } @@ -130,7 +157,8 @@ export default {