From 2c3f251e3fb8dc3a7832d01ae8f92f76df4e2b6a Mon Sep 17 00:00:00 2001 From: memo <1942223609@qq.com> Date: Sat, 20 Mar 2021 15:49:54 +0800 Subject: [PATCH] 123 --- src/components/suggest/Suggest.vue | 57 ++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/src/components/suggest/Suggest.vue b/src/components/suggest/Suggest.vue index e9366eb..94cf09a 100644 --- a/src/components/suggest/Suggest.vue +++ b/src/components/suggest/Suggest.vue @@ -16,11 +16,13 @@ import topTitle from './SugTopTitle' import sugBody from './SugBody' import appFooter from '../AppFooter' import axios from 'axios' +// import axios from './api.config' +import qs from 'qs' export default { data(){ return{ sugcontshow:false, - contShow:false + contShow:false, } }, components:{ @@ -57,7 +59,7 @@ export default { }); } - if(flag){ + /*if(flag){ let loading = this.$loading({lock:true,text:'玩命加载中...'}); axios.post(`/admin/submitSuggest`,sugForm).then(response=>{ let res = response.data; @@ -75,10 +77,59 @@ export default { console.log(err); }) + }*/ + if (flag){ + + let data + data = { + name:sugForm.userName, + phone:sugForm.phoneNum, + content:sugForm.suggestText, + } + console.log(data) + // const baseUrl = 'http://localhost:8083/api/' + const baseUrl = 'http://api.tomey.live/api/' + axios({ + method: 'post', + url: baseUrl + 'addcomplaint', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' + }, + data: qs.stringify(data, { arrayFormat: 'brackets' }) + }).then(res => { + console.log(res) + console.log("0000") + if (res.data.code==1){ + this.$notify({ + title: '提交成功', + duration: 2000, + message:res.msg, + type: 'success' + }) + }else { + this.$notify({ + title: '提交失败', + duration: 2000, + // message:'管理员请前往admin登录', + type: 'error' + }) + } + + }) + + } else { + this.$notify({ + title: '提交失败', + // message: data.msg, + duration: 2000, + type: 'error' + }) + } + } } - } + }