This commit is contained in:
parent
1a19191097
commit
4d7db55dd9
@ -101,7 +101,7 @@ func Send(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(reqData.To) <= 0 {
|
if len(reqData.To)+len(reqData.Cc)+len(reqData.Bcc) <= 0 {
|
||||||
response.NewErrorResponse(response.ParamsError, "收件人必填", "收件人必填").FPrint(w)
|
response.NewErrorResponse(response.ParamsError, "收件人必填", "收件人必填").FPrint(w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export function usePage() {
|
|||||||
|
|
||||||
const init = function () {
|
const init = function () {
|
||||||
loadContacts()
|
loadContacts()
|
||||||
if ( Object.keys(globalStatus.userInfos)==0 || globalStatus.userInfos === null || globalStatus.userInfos == undefined ){
|
if (globalStatus.userInfos === null || globalStatus.userInfos == undefined || Object.keys(globalStatus.userInfos).length == 0){
|
||||||
globalStatus.init(()=>{
|
globalStatus.init(()=>{
|
||||||
ruleForm.sender = globalStatus.userInfos.account
|
ruleForm.sender = globalStatus.userInfos.account
|
||||||
ruleForm.domains = globalStatus.userInfos.domains
|
ruleForm.domains = globalStatus.userInfos.domains
|
||||||
@ -179,8 +179,10 @@ export function usePage() {
|
|||||||
editorRef.value = editor
|
editorRef.value = editor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isSending = ref(false)
|
||||||
|
|
||||||
const send = function (formEl) {
|
const send = function (formEl) {
|
||||||
if (!formEl) return
|
if (!formEl || isSending.value) return
|
||||||
formEl.validate((valid) => {
|
formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if(ruleForm.receivers.length === 0 && ruleForm.cc.length === 0 && ruleForm.bcc.length === 0) {
|
if(ruleForm.receivers.length === 0 && ruleForm.cc.length === 0 && ruleForm.bcc.length === 0) {
|
||||||
@ -191,7 +193,9 @@ export function usePage() {
|
|||||||
let objectCcs = ruleForm.cc.map(e => ({name: "", email: e}));
|
let objectCcs = ruleForm.cc.map(e => ({name: "", email: e}));
|
||||||
let objectBccs = ruleForm.bcc.map(e => ({name: "", email: e}));
|
let objectBccs = ruleForm.bcc.map(e => ({name: "", email: e}));
|
||||||
|
|
||||||
let text = editorRef.value.getText()
|
if (!editorRef.value) return
|
||||||
|
const text = editorRef.value.getText()
|
||||||
|
isSending.value = true
|
||||||
|
|
||||||
http.post("/api/v1/email/send", {
|
http.post("/api/v1/email/send", {
|
||||||
from: {name: ruleForm.nickName, email: ruleForm.sender + "@" + ruleForm.pick域名},
|
from: {name: ruleForm.nickName, email: ruleForm.sender + "@" + ruleForm.pick域名},
|
||||||
@ -209,8 +213,12 @@ export function usePage() {
|
|||||||
groupStore.tag = '{"type":1,"status":-1}'
|
groupStore.tag = '{"type":1,"status":-1}'
|
||||||
router.replace({name: 'list'})
|
router.replace({name: 'list'})
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.data)
|
ElMessage.error(res.errorMsg || res.data || lang.fail)
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
ElMessage.error(lang.fail)
|
||||||
|
}).finally(() => {
|
||||||
|
isSending.value = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@ -272,6 +280,7 @@ export function usePage() {
|
|||||||
ruleFormRef,
|
ruleFormRef,
|
||||||
ruleForm,
|
ruleForm,
|
||||||
fileList,
|
fileList,
|
||||||
|
isSending,
|
||||||
init,
|
init,
|
||||||
validateSender,
|
validateSender,
|
||||||
checkEmail,
|
checkEmail,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<el-button class="action-btn" @click="upload">
|
<el-button class="action-btn" @click="upload">
|
||||||
<el-icon><Paperclip /></el-icon> {{ lang.add_att }}
|
<el-icon><Paperclip /></el-icon> {{ lang.add_att }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" class="send-btn" @click="send(ruleFormRef)">
|
<el-button type="primary" class="send-btn" :loading="isSending" :disabled="isSending" @click="send(ruleFormRef)">
|
||||||
<el-icon><Position /></el-icon> {{ lang.send }}
|
<el-icon><Position /></el-icon> {{ lang.send }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<input v-show="false" ref="fileRef" type="file" @change="fileChange" multiple>
|
<input v-show="false" ref="fileRef" type="file" @change="fileChange" multiple>
|
||||||
@ -171,6 +171,7 @@ const {
|
|||||||
handleCreated,
|
handleCreated,
|
||||||
fileList,
|
fileList,
|
||||||
delFile,
|
delFile,
|
||||||
|
isSending,
|
||||||
contactOptions,
|
contactOptions,
|
||||||
deleteContact
|
deleteContact
|
||||||
} = usePage()
|
} = usePage()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user