diff --git a/src/components/CreateProjectDialog.vue b/src/components/CreateProjectDialog.vue index 4580da6..57509d4 100644 --- a/src/components/CreateProjectDialog.vue +++ b/src/components/CreateProjectDialog.vue @@ -47,11 +47,11 @@ - - - - - + + + + + @@ -352,39 +352,33 @@ export default { }, //提交方法 submitForm(formName) { - console.log(this.projectClasses) - let form = this.ruleForm - form.projectFinalTestTime = form.projectFinalTestTime.getTime() / 1000 - form.projectEndTime = form.projectEndTime.getTime() / 1000 - form.projectFirstTestTime = form.projectFirstTestTime.getTime() / 1000 - form.projectOnlineTime = form.projectOnlineTime.getTime() / 1000 - form.projectStartTime = form.projectStartTime.getTime() / 1000 - request({ - url: 'project/create', - method: 'post', - data: form - }).then(response => { - console.log(response) - if (response.data.code === 200) { - //console.log(response.data.data.records) - ElMessage({ - message: '成功', - type: 'success', - }) - } - }).catch(function (error) { - console.log(error) - }) //对表单进行提交验证 this.$refs[formName].validate((valid) => { if (valid) { console.log('submit') - ElMessage({ - message: 'submit', - type: 'success', + let form = this.ruleForm + form.projectFinalTestTime = form.projectFinalTestTime.getTime() / 1000 + form.projectEndTime = form.projectEndTime.getTime() / 1000 + form.projectFirstTestTime = form.projectFirstTestTime.getTime() / 1000 + form.projectOnlineTime = form.projectOnlineTime.getTime() / 1000 + form.projectStartTime = form.projectStartTime.getTime() / 1000 + request({ + url: 'project', + method: 'post', + data: form + }).then(response => { + console.log(response) + if (response.data.code === 200) { + //console.log(response.data.data.records) + ElMessage({ + message: '新增项目成功', + type: 'success', + }) + } + }).catch(function (error) { + console.log(error) }) - //请求 } else { console.log('error submit!!') diff --git a/src/store/index.js b/src/store/index.js index 1b8c5f9..c0893c0 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -10,6 +10,9 @@ const store = createStore({ setStaff(state, staff) { state.staff = staff }, + updateToken(state, Token) { + state.staff.Token = Token + }, clearStaff(state) { state.staff = null }, diff --git a/src/utils/request.js b/src/utils/request.js index 65295b0..3100588 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -22,7 +22,10 @@ request.interceptors.response.use( function (response) { // 2xx 范围内的状态码都会触发该函数。 console.log("SUCCESS") - + //let staff = store.state.staff + //staff.Token = response.config.headers.Token + //console.log(response) + store.commit('updateToken', response.config.headers.token) return response }, function (error) { console.log("ERROR")