Skip to content

Commit bf854c5

Browse files
authored
fix(axios & tinymce): optimize the experience (#268)
fix #267
1 parent 43de300 commit bf854c5

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/lin/plugins/axios.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ _axios.interceptors.response.use(async (res) => {
138138
reject(res)
139139
return
140140
}
141-
console.log('msg', msg)
142141
// 本次请求添加 params 参数:showBackend 为 true, 弹出后端返回错误信息
143142
if (params && params.showBackend) {
144143
[message] = msg
@@ -157,7 +156,7 @@ _axios.interceptors.response.use(async (res) => {
157156
message,
158157
type: 'error',
159158
})
160-
resolve(res.data)
159+
reject()
161160
})
162161
}, (error) => {
163162
if (!error.response) {

src/models/book.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Book {
1212

1313
// 类中的方法可以代表一个用户行为
1414
async addBook(info) {
15-
const res = await post('v1/book', info)
15+
const res = await post('v1/book', info, { handleError: true })
1616
return res
1717
}
1818

src/plugins/custom/views/Tinymce.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="lin-container">
33
<div class="lin-title">富文本舞台页面</div>
44
<div class="lin-wrap">
5-
<tinymce @change="change" upload_url="http://dev.lin.colorful3.com/cms/file/" />
5+
<tinymce @change="change" :defaultContent="text" upload_url="http://dev.lin.colorful3.com/cms/file/" />
66
</div>
77
</div>
88
</template>
@@ -12,7 +12,11 @@
1212
import Tinymce from '@/components/base/tinymce'
1313
1414
export default {
15-
name: 'ImgsUploadStage1',
15+
data() {
16+
return {
17+
text: 'this is default content',
18+
}
19+
},
1620
components: {
1721
Tinymce,
1822
},

src/views/book/BookAdd.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default {
6868
this.resetForm(formName)
6969
}
7070
} catch (error) {
71+
this.$message.error(error.data.msg)
7172
console.log(error)
7273
}
7374
},

0 commit comments

Comments
 (0)