分析下面报错
font.js:45 GET http://localhost:8080/api/font/list 422 (UNPROCESSABLE ENTITY)
dispatchXhrRequest @ xhr.js:187
xhrAdapter @ xhr.js:13
dispatchRequest @ dispatchRequest.js:53
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:85 ===== 响应拦截器捕获错误 =====
eval @ axios.js:85
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:86 请求地址: /font/list
eval @ axios.js:86
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:87 原始错误信息: Error: Request failed with status code 422
at createError (createError.js:16:15)
at settle (settle.js:17:12)
at XMLHttpRequest.onloadend (xhr.js:54:7)
eval @ axios.js:87
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:97 响应状态码: 422
eval @ axios.js:97
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:98 响应数据: {msg: 'Subject must be a string'}msg: "Subject must be a string"[[Prototype]]: Object
eval @ axios.js:98
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:99 响应头: {connection: 'close', content-length: '35', content-type: 'application/json', date: 'Mon, 04 Aug 2025 16:08:48 GMT', server: 'Werkzeug/3.1.3 Python/3.11.8', …}
eval @ axios.js:99
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:119 处理后的错误信息: {error: '请求失败 (422)', status: 422}
eval @ axios.js:119
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
axios.js:120 ====================================
eval @ axios.js:120
Promise.then
request @ Axios.js:88
Axios.<computed> @ Axios.js:129
wrap @ bind.js:9
eval @ font.js:45
fetchUserFonts @ font.js:43
wrappedActionHandler @ vuex.esm.js:862
dispatch @ vuex.esm.js:527
boundDispatch @ vuex.esm.js:417
created @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/CarvingForm.vue?vue&type=script&lang=js:49
invokeWithErrorHandling @ vue.runtime.esm.js:3083
callHook$1 @ vue.runtime.esm.js:4098
Vue._init @ vue.runtime.esm.js:5763
VueComponent @ vue.runtime.esm.js:5896
createComponentInstanceForVnode @ vue.runtime.esm.js:4613
init @ vue.runtime.esm.js:4475
merged @ vue.runtime.esm.js:4630
createComponent @ vue.runtime.esm.js:6638
createElm @ vue.runtime.esm.js:6592
updateChildren @ vue.runtime.esm.js:6887
patchVnode @ vue.runtime.esm.js:6980
patch @ vue.runtime.esm.js:7148
Vue._update @ vue.runtime.esm.js:3835
updateComponent @ vue.runtime.esm.js:3941
Watcher.get @ vue.runtime.esm.js:3512
Watcher.run @ vue.runtime.esm.js:3588
flushSchedulerQueue @ vue.runtime.esm.js:4191
eval @ vue.runtime.esm.js:3209
flushCallbacks @ vue.runtime.esm.js:3131
Promise.then
timerFunc @ vue.runtime.esm.js:3156
nextTick @ vue.runtime.esm.js:3221
queueWatcher @ vue.runtime.esm.js:4277
Watcher.update @ vue.runtime.esm.js:3579
Dep.notify @ vue.runtime.esm.js:792
reactiveSetter @ vue.runtime.esm.js:1025
proxySetter @ vue.runtime.esm.js:5425
Message @ element-ui.common.js:3379
main_Message.<computed> @ element-ui.common.js:3379
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:49
Promise.then
eval @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:48
eval @ element-ui.common.js:2686
eval @ element-ui.common.js:2740
complete @ index.js:95
eval @ index.js:231
next @ util.js:161
next @ util.js:129
cb @ index.js:179
required @ required.js:11
eval @ index.js:222
next @ util.js:127
asyncSerialArray @ util.js:133
eval @ util.js:167
asyncMap @ util.js:164
validate @ index.js:147
validate @ element-ui.common.js:2740
eval @ element-ui.common.js:2686
validate @ element-ui.common.js:2686
handleLogin @ index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/Login.vue?vue&type=script&lang=js:45
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
invokeWithErrorHandling @ vue.runtime.esm.js:3083
Vue.$emit @ vue.runtime.esm.js:3782
handleClick @ element-ui.common.js:1118
invokeWithErrorHandling @ vue.runtime.esm.js:3083
invoker @ vue.runtime.esm.js:1884
original_1._wrapper @ vue.runtime.esm.js:7547
font.js:58 字体列表请求失败: 请求失败 (422) 状态码: 422
下面是对应的代码模块
axios.js代码
import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
import store from '../store'
const service = axios.create({
baseURL: process.env.VUE_APP_API_URL,
timeout: 60000
})
service.interceptors.request.use(
config => {
// 1. 打印拦截到的请求基本信息
console.log('===== 请求拦截器捕获请求 =====');
console.log('请求地址:', config.baseURL + config.url); // 完整 URL
console.log('请求方法:', config.method.toUpperCase()); // 请求方法(GET/POST等)
console.log('超时时间:', config.timeout + 'ms');
// 2. 打印请求参数(区分 params 和 data)
if (config.method === 'get') {
console.log('请求参数 (params):', config.params || '无参数');
} else {
console.log('请求体 (data):', config.data || '无数据');
}
// 3. 打印原始请求头(处理前)
console.log('原始请求头 (处理前):', { ...config.headers });
// 4. Token 处理逻辑(原有逻辑保留)
const publicUrls = ['/auth/register', '/auth/login'];
if (store.getters.isAuthenticated && !publicUrls.includes(config.url)) {
const token = store.state.user.token;
console.log('request', token)
if (!token) {
console.error('⚠️ Token 为空,无法传递');
} else {
config.headers['Authorization'] = `Bearer ${token}`;
console.log('✅ Token 处理结果:');
console.log('传递的 Token:', token);
console.log('更新后的 Authorization 头:', config.headers['Authorization']);
}
} else {
if (publicUrls.includes(config.url)) {
console.log('ℹ️ 公开接口,无需传递 Token:', config.url);
} else {
console.log('ℹ️ 未满足 Token 传递条件(用户未登录)');
}
}
// 5. 打印处理后的完整请求配置(可选,用于调试)
console.log('===== 请求拦截器处理完成 =====', {
url: config.baseURL + config.url,
method: config.method,
finalHeaders: config.headers,
finalParams: config.params,
finalData: config.data
});
return config;
},
error => {
// 6. 打印请求拦截器中的错误(如配置错误)
console.error('===== 请求拦截器捕获错误 =====');
console.error('错误类型:', error.name);
console.error('错误信息:', error.message);
console.error('错误详情:', error);
return Promise.reject(error);
}
);
service.interceptors.response.use(
response => {
// 打印成功响应信息
console.log('===== 响应拦截器捕获成功响应 =====');
console.log('请求地址:', response.config.url);
console.log('响应状态码:', response.status);
console.log('响应状态文本:', response.statusText);
console.log('响应头:', response.headers);
console.log('响应数据:', response.data);
console.log('====================================');
return response.data;
},
error => {
console.error('===== 响应拦截器捕获错误 =====');
console.error('请求地址:', error.config?.url || '未知地址');
console.error('原始错误信息:', error);
// 强制初始化错误对象,确保 status 存在
let errorData = {
error: '未知错误',
status: error.response?.status ?? null // 关键:用 null 替代 undefined
};
if (error.response) {
// 后端有响应时,提取错误信息和状态码
console.error('响应状态码:', error.response.status);
console.error('响应数据:', error.response.data);
console.error('响应头:', error.response.headers);
errorData.error = error.response.data?.error ||
`请求失败 (${error.response.status})`;
errorData.status = error.response.status; // 确保状态码为数字
} else if (error.request) {
// 无响应(如网络错误)
console.error('错误类型: 无响应(可能是网络错误)');
console.error('请求信息:', error.request);
errorData.error = '网络错误,未收到服务器响应';
errorData.status = 0; // 用 0 标识网络错误
} else {
// 请求配置错误
console.error('错误类型: 请求配置错误');
errorData.error = error.message || '请求配置错误';
errorData.status = -1; // 用 -1 标识客户端错误
}
console.error('处理后的错误信息:', errorData);
console.error('====================================');
Message.error(errorData.error);
return Promise.reject(errorData); // 确保返回的 error 一定有 status
}
);
// 辅助函数:根据状态码返回描述文本
function getStatusText(status) {
const statusMap = {
400: '参数错误',
403: '权限不足',
404: '接口不存在',
500: '服务器内部错误',
502: '网关错误'
}
return statusMap[status] || '未知错误'
}
export default service
fonts.js代码
import axios from '../../utils/axios'
const state = {
fonts: []
}
const getters = {
userFonts: state => state.fonts
}
const mutations = {
SET_FONTS(state, fonts) {
state.fonts = fonts
}
}
const actions = {
// 上传字体文件
uploadFont({ dispatch }, file) {
const formData = new FormData()
formData.append('font_file', file)
return new Promise((resolve, reject) => {
// 不手动添加Authorization头,依赖axios拦截器自动处理
axios.post('/font/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data',
'subject': 'font_upload'
}
})
.then(data => {
dispatch('fetchUserFonts')
resolve(data)
})
.catch(error => {
reject(error)
})
})
},
// 获取用户上传的字体
fetchUserFonts({ commit }) {
return new Promise((resolve, reject) => {
// 参考user.js的写法,不手动传递token,由拦截器统一处理
axios.get('/font/list', {
headers: {
'subject': 'font_list'
}
})
.then(data => {
// 直接使用响应数据(axios响应拦截器已处理为response.data)
commit('SET_FONTS', data)
resolve(data)
})
.catch(error => {
// 错误处理与user.js保持一致
const errorMsg = error.error || error.message || '获取字体列表失败'
console.error('字体列表请求失败:', errorMsg, '状态码:', error.status)
reject({ error: errorMsg, status: error.status })
})
})
},
// 删除字体文件
deleteFont({ dispatch }, fontId) {
return new Promise((resolve, reject) => {
axios.delete(`/font/${fontId}`, {
headers: {
'subject': 'font_delete'
}
})
.then(data => {
dispatch('fetchUserFonts')
resolve(data)
})
.catch(error => {
reject(error)
})
})
}
}
export default {
state,
getters,
mutations,
actions
}
后端接口代码
@font_bp.route('/list', methods=['GET'])
@jwt_required()
def list_fonts():
"""获取用户上传的所有字体"""
user_id = get_jwt_identity()
fonts = Font.query.filter_by(user_id=user_id).order_by(Font.uploaded_at.desc()).all()
print(1)
print(fonts)
return jsonify([font.to_dict() for font in fonts]), 200
最新发布