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.7 KiB

{{.Header}}
<body class="text-center">
<div id="app" style="width:100%">
<template>
{{.Nav}}
<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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="smtp地址">
<el-input v-model="form.smtp"></el-input>
</el-form-item>
<el-form-item label="主题">
<el-input v-model="form.subject"></el-input>
</el-form-item>
<el-form-item label="收件人">
<el-input v-model="form.email"></el-input>
</el-form-item>
<el-form-item label="内容">
<el-input type="textarea" v-model="form.content"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">立即发送</el-button>
<el-button @click="resetForm('form')">取消</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,
form: {
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) => {
if (valid) {
} else {
return false;
}
});
},
//重置表单
resetForm(formName) {
this.loading=false;
this.$refs[formName].resetFields();
},
},
created: function () {
this.getFolders();
}
})
</script>
</html>