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.
go-fly/static/html/write.html

113 lines
3.9 KiB

{{.Header}}
<body class="text-center">
<div id="app" style="width:100%">
<template>
<el-container v-loading.fullscreen.lock="fullscreenLoading">
<el-aside>
<el-menu
:default-active="fid">
<el-menu-item :index="v" v-for="(f,v) in folders" v-bind:key="v" v-on:click="openUrl('/list?fid='+v)">
<i class="el-icon-menu"></i>
<span slot="title"><{v}></span>
</el-menu-item>
</el-menu>
</el-aside>
<el-main class="mainMain">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
<el-form-item label="smtp地址" prop="smtp">
<el-input v-model="ruleForm.smtp" placeholder="smtp地址"></el-input>
</el-form-item>
<el-form-item label="主题" prop="subject">
<el-input v-model="ruleForm.subject"></el-input>
</el-form-item>
<el-form-item label="收件人" prop="email">
<el-input v-model="ruleForm.email"></el-input>
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input type="textarea" v-model="ruleForm.content"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">立即发送</el-button>
<el-button @click="resetForm('ruleForm')">取消</el-button>
</el-form-item>
</el-form>
</el-main>
</el-container>
</template>
</div>
</body>
<script>
new Vue({
el: '#app',
delimiters:["<{","}>"],
data: {
fullscreenLoading:true,
folders:[],
fid:"",
mailTotal:0,
ruleForm: {
smtp: '',
email: '',
subject: '',
content: '',
},
rules: {
smtp: [
{ required: true, message: 'SMTP服务器如"smtp.sina.net:25"包含端口号', trigger: 'blur' },
],
email: [
{ required: true, message: '邮箱地址', trigger: 'blur' },
],
subject: [
{ required: true, message: '主题', trigger: 'blur' },
],
content: [
{ required: true, message: '内容', trigger: 'blur' },
],
},
},
methods: {
//获取邮件夹
getFolders: function () {
this.fullscreenLoading=true;
let _this = this;
$.get('/folders', function (rs) {
_this.folders=rs.result.folders;
_this.mailTotal=rs.result.total;
_this.fullscreenLoading=false;
}).then(()=>{
_this.fullscreenLoading=false;
});
},
//跳转
openUrl(url){
window.location.href=url;
},
//提交表单
submitForm(formName){
let _this=this;
this.$refs[formName].validate((valid) => {
console.log(valid,formName,this.$refs[formName]);
if (valid) {
} else {
return false;
}
});
},
//重置表单
resetForm(formName) {
this.loading=false;
this.$refs[formName].resetFields();
},
},
created: function () {
this.getFolders();
}
})
</script>
</html>