| src/api/hfiveget/index.js | ●●●●● patch | view | raw | blame | history | |
| src/router/axios.js | ●●●●● patch | view | raw | blame | history | |
| src/views/Addmessage/index.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/message/index.vue | ●●●●● patch | view | raw | blame | history |
src/api/hfiveget/index.js
@@ -132,12 +132,14 @@ // 发布留言 export const leaveWords = (data) => { export const leaveWords = (params) => { return request({ url: "/api/leave/leaveWords/submit", method: "post", apiKey: true, data data: { ...params, } }); }; src/router/axios.js
@@ -25,22 +25,27 @@ // 调用后台管理的 const service = axios.create({ timeout: 600000, // request timeout headers: { "Content-Type": "application/json;charset=gbk" }, }); // 返回其他状态码 service.defaults.validateStatus = function (status) { return status >= 200 && status <= 500; }; // 跨域请求,允许保存cookie // service.defaults.withCredentials = true // http request拦截 service.interceptors.request.use( (config) => { if (!config.data) { config.data = true // 解决请求没有参数时添加不上Content-Type问题 } config.headers['Content-type'] = 'application/json;charset=gbk' store.commit('updateoverlayshow'); if (config.apiKey) { config.headers["Authorization"] = "Basic c2FiZXI6c2FiZXJfc2VjcmV0"; config.headers["Content-Type"] = "application/json;charset=gbk"; if (getToken() != undefined) { config.headers["Blade-Auth"] = "bearer " + getToken(); } src/views/Addmessage/index.vue
@@ -92,13 +92,11 @@ if (this.messagecom == "" && this.submitlist.length == 0) { this.$toast.fail("留言内容不能为空"); } else { console.log(toData); leaveWords(toData).then(res => { console.log(res); // setTimeout(() => { // this.$router.push("/"); // }, 1000); // this.$toast.success("添加成功"); setTimeout(() => { this.$router.push("/"); }, 1000); this.$toast.success("添加成功"); }); } } src/views/message/index.vue
@@ -120,7 +120,6 @@ let kehuarray = []; if (localStorage.getItem("tokensave") == "111") { this.messageData.forEach((item, indexto) => { console.log(item.userName == "匿名用户"); if (item.userName == "匿名用户") { kehuarray.push(item); } @@ -152,8 +151,10 @@ toData.userPost = localStorage.getItem("post_name"); } leaveWords(toData).then(res => { this.$toast.success("评论成功"); this.getmessagelist(); if (res.data.code == 200) { this.$toast.success("评论成功"); this.getmessagelist(); } }); } },