You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
4.1 KiB
117 lines
4.1 KiB
5 years ago
|
{{.Header}}
|
||
|
<div id="app" style="width:100%">
|
||
|
<template>
|
||
|
<el-container v-loading.fullscreen.lock="fullscreenLoading">
|
||
|
<el-aside>
|
||
5 years ago
|
{{.Left}}
|
||
5 years ago
|
</el-aside>
|
||
|
|
||
|
<el-main class="mainMain">
|
||
5 years ago
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
|
||
|
<el-form-item label="smtp地址" prop="smtp">
|
||
5 years ago
|
<el-input v-model="ruleForm.smtp" placeholder="SMTP服务器如smtp.sina.net:25包含端口号"></el-input>
|
||
5 years ago
|
</el-form-item>
|
||
5 years ago
|
<el-form-item label="主题" prop="subject">
|
||
|
<el-input v-model="ruleForm.subject"></el-input>
|
||
5 years ago
|
</el-form-item>
|
||
5 years ago
|
<el-form-item label="收件人" prop="to">
|
||
|
<el-input v-model="ruleForm.to"></el-input>
|
||
5 years ago
|
</el-form-item>
|
||
5 years ago
|
<el-form-item label="内容" prop="content">
|
||
|
<el-input type="textarea" v-model="ruleForm.content"></el-input>
|
||
5 years ago
|
</el-form-item>
|
||
|
<el-form-item>
|
||
5 years ago
|
<el-button type="primary" @click="submitForm('ruleForm')">立即发送</el-button>
|
||
|
<el-button @click="resetForm('ruleForm')">取消</el-button>
|
||
5 years ago
|
</el-form-item>
|
||
|
</el-form>
|
||
5 years ago
|
</el-main>
|
||
|
|
||
|
</el-container>
|
||
|
</template>
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
5 years ago
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||
5 years ago
|
<script>
|
||
|
new Vue({
|
||
|
el: '#app',
|
||
|
delimiters:["<{","}>"],
|
||
|
data: {
|
||
|
fullscreenLoading:true,
|
||
|
folders:[],
|
||
|
fid:"",
|
||
5 years ago
|
mailTotal:0,
|
||
5 years ago
|
ruleForm: {
|
||
5 years ago
|
smtp: '',
|
||
5 years ago
|
to: '',
|
||
5 years ago
|
subject: '',
|
||
|
content: '',
|
||
|
},
|
||
|
rules: {
|
||
|
smtp: [
|
||
|
{ required: true, message: 'SMTP服务器如"smtp.sina.net:25"包含端口号', trigger: 'blur' },
|
||
|
],
|
||
5 years ago
|
to: [
|
||
5 years ago
|
{ required: true, message: '邮箱地址', trigger: 'blur' },
|
||
|
],
|
||
|
subject: [
|
||
|
{ required: true, message: '主题', trigger: 'blur' },
|
||
|
],
|
||
|
content: [
|
||
|
{ required: true, message: '内容', trigger: 'blur' },
|
||
|
],
|
||
|
},
|
||
5 years ago
|
},
|
||
|
methods: {
|
||
|
//获取邮件夹
|
||
5 years ago
|
getFolders: function () {
|
||
5 years ago
|
this.fullscreenLoading=true;
|
||
|
let _this = this;
|
||
5 years ago
|
$.get('/folder_dirs', function (rs) {
|
||
5 years ago
|
_this.folders=rs.result.folders;
|
||
5 years ago
|
_this.mailTotal=rs.result.total;
|
||
5 years ago
|
_this.fid=rs.result.fid;
|
||
5 years ago
|
_this.fullscreenLoading=false;
|
||
|
}).then(()=>{
|
||
|
_this.fullscreenLoading=false;
|
||
|
});
|
||
|
},
|
||
|
//跳转
|
||
|
openUrl(url){
|
||
|
window.location.href=url;
|
||
|
},
|
||
5 years ago
|
//提交表单
|
||
|
submitForm(formName){
|
||
|
let _this=this;
|
||
|
this.$refs[formName].validate((valid) => {
|
||
5 years ago
|
console.log(valid,formName,this.$refs[formName]);
|
||
5 years ago
|
if (valid) {
|
||
5 years ago
|
let data=this.ruleForm;
|
||
|
let to=[];
|
||
|
to.push(this.ruleForm.to);
|
||
|
data.to=to;
|
||
|
axios.post('/send', data).then(function (response) {
|
||
|
console.log(response);
|
||
|
}).catch(function (error) {
|
||
|
console.log(error);
|
||
|
});
|
||
5 years ago
|
} else {
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
//重置表单
|
||
|
resetForm(formName) {
|
||
|
this.loading=false;
|
||
|
this.$refs[formName].resetFields();
|
||
|
},
|
||
5 years ago
|
},
|
||
|
created: function () {
|
||
|
this.getFolders();
|
||
|
}
|
||
|
})
|
||
|
|
||
|
</script>
|
||
|
</html>
|