first commit
This commit is contained in:
commit
494940afc9
87 files changed
+9589
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<script setup>
|
||||
import { RouterView } from 'vue-router'
|
||||
import HomeHeader from '@/components/HomeHeader.vue'
|
||||
import HomeAside from '@/components/HomeAside.vue';
|
||||
import { watch,ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
const route = useRoute()
|
||||
|
||||
const pageName = ref(route.name)
|
||||
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
(n, o) => {
|
||||
pageName.value = route.name
|
||||
}
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="main">
|
||||
<HomeHeader />
|
||||
<div id="content">
|
||||
<div id="aside" v-if="pageName != 'login'">
|
||||
<HomeAside />
|
||||
</div>
|
||||
<div id="body">
|
||||
<RouterView />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#aside {
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
|
||||
#body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#content {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#main {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,78 @@
|
||||
/* color palette from <https://github.com/vuejs/theme> */
|
||||
:root {
|
||||
--vt-c-white: #ffffff;
|
||||
--vt-c-white-soft: #f8f8f8;
|
||||
--vt-c-white-mute: #f2f2f2;
|
||||
|
||||
--vt-c-black: #181818;
|
||||
--vt-c-black-soft: #222222;
|
||||
--vt-c-black-mute: #282828;
|
||||
|
||||
--vt-c-indigo: #2c3e50;
|
||||
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
||||
|
||||
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
||||
--vt-c-text-dark-1: var(--vt-c-white);
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
||||
}
|
||||
|
||||
/* semantic color variables for this project */
|
||||
:root {
|
||||
--color-background: var(--vt-c-white);
|
||||
--color-background-soft: var(--vt-c-white-soft);
|
||||
--color-background-mute: var(--vt-c-white-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-light-2);
|
||||
--color-border-hover: var(--vt-c-divider-light-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-light-1);
|
||||
--color-text: var(--vt-c-text-light-1);
|
||||
|
||||
--section-gap: 160px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: var(--vt-c-black);
|
||||
--color-background-soft: var(--vt-c-black-soft);
|
||||
--color-background-mute: var(--vt-c-black-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-dark-2);
|
||||
--color-border-hover: var(--vt-c-divider-dark-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-dark-1);
|
||||
--color-text: var(--vt-c-text-dark-2);
|
||||
}
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
html{
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition: color 0.5s, background-color 0.5s;
|
||||
line-height: 1.6;
|
||||
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
||||
|
After Width: | Height: | Size: 276 B |
@@ -0,0 +1,13 @@
|
||||
@import './base.css';
|
||||
|
||||
#app {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
font-weight: normal;
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<input id="search" :placeholder="lang.search">
|
||||
<el-tree :data="data" :props="defaultProps" :defaultExpandAll="true" @node-click="handleNodeClick" :class="node" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
import $http from "../http/http";
|
||||
import { reactive, ref } from 'vue'
|
||||
import useGroupStore from '../stores/group'
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
const groupStore = useGroupStore()
|
||||
const router = useRouter()
|
||||
|
||||
|
||||
const data = ref([])
|
||||
|
||||
$http.get('/api/group').then(res => {
|
||||
data.value = res.data
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
const handleNodeClick = function (data) {
|
||||
if (data.tag != null) {
|
||||
groupStore.name = data.label
|
||||
groupStore.tag = data.tag
|
||||
router.push({
|
||||
name: "list",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
width: 243px;
|
||||
background-color: #F1F1F1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#search {
|
||||
background-color: #D6E7F7;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding-left: 10px;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
background-color: #F1F1F1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div id="header_main">
|
||||
<div id="logo">
|
||||
<span style="padding-left: 20px;">PMail</span>
|
||||
</div>
|
||||
<div id="settings" @click="settings">
|
||||
<el-icon style="font-size: 25px;">
|
||||
<Setting style="color:#FFFFFF" />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-drawer v-model="openSettings" :title="lang.settings">
|
||||
<el-tabs tab-position="left" >
|
||||
<el-tab-pane :label="lang.security">
|
||||
<SecuritySettings/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-drawer>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Setting } from '@element-plus/icons-vue';
|
||||
import { ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import SecuritySettings from '@/components/SecuritySettings.vue'
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
|
||||
const openSettings = ref(false)
|
||||
const settings = function () {
|
||||
openSettings.value = true;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#header_main {
|
||||
height: 50px;
|
||||
background-color: #000;
|
||||
display: flex;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#logo {
|
||||
height: 3rem;
|
||||
line-height: 3rem;
|
||||
font-size: 2.3rem;
|
||||
flex-grow: 1;
|
||||
width: 200px;
|
||||
color: #FFF;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#search {
|
||||
height: 3rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#settings {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-right: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<el-form :model="ruleForm" :rules="rules" status-icon>
|
||||
<el-form-item :label="lang.modify_pwd" prop="new_pwd">
|
||||
<el-input type="password" v-model="ruleForm.new_pwd" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="lang.enter_again" prop="new_pwd2">
|
||||
<el-input type="password" v-model="ruleForm.new_pwd2" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">
|
||||
{{ lang.submit }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import $http from "../http/http";
|
||||
import lang from '../i18n/i18n';
|
||||
const ruleForm = reactive({
|
||||
new_pwd: "",
|
||||
new_pwd2: ""
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
new_pwd: [{ required: true, message: lang.err_required_pwd, trigger: 'blur' },],
|
||||
new_pwd2: [{ required: true, message: lang.err_required_pwd, trigger: 'blur' },],
|
||||
|
||||
})
|
||||
|
||||
const submit = function () {
|
||||
if (ruleForm.new_pwd != ruleForm.new_pwd2) {
|
||||
ElNotification({
|
||||
title: 'Error',
|
||||
message: lang.err_pwd_diff,
|
||||
type: 'error',
|
||||
})
|
||||
return
|
||||
}
|
||||
$http.post("/api/settings/modify_password", { password: ruleForm.new_pwd }).then(res => {
|
||||
ElNotification({
|
||||
title: res.errorNo == 0 ? lang.succ : lang.fail,
|
||||
message: res.data,
|
||||
type: res.errorNo == 0 ? 'success' : 'error',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,92 @@
|
||||
// http/index.js
|
||||
import axios from 'axios'
|
||||
import router from "@/router"; //根路由对象
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
//创建axios的一个实例
|
||||
var $http = axios.create({
|
||||
baseURL: import.meta.env.VITE_APP_URL, //接口统一域名
|
||||
timeout: 6000, //设置超时
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8;',
|
||||
'Lang':lang.lang
|
||||
}
|
||||
})
|
||||
|
||||
//请求拦截器
|
||||
$http.interceptors.request.use((config) => {
|
||||
//若请求方式为post,则将data参数转为JSON字符串
|
||||
if (config.method === 'POST') {
|
||||
config.data = JSON.stringify(config.data);
|
||||
}
|
||||
return config;
|
||||
}, (error) =>
|
||||
// 对请求错误做些什么
|
||||
Promise.reject(error));
|
||||
|
||||
//响应拦截器
|
||||
$http.interceptors.response.use((response) => {
|
||||
//响应成功
|
||||
if(response.data.errorNo == 403){
|
||||
router.replace({
|
||||
path: '/login',
|
||||
query: {
|
||||
redirect: router.currentRoute.fullPath
|
||||
}
|
||||
})
|
||||
}
|
||||
return response.data;
|
||||
}, (error) => {
|
||||
//响应错误
|
||||
if (error.response && error.response.status) {
|
||||
const status = error.response.status
|
||||
let message = ""
|
||||
switch (status) {
|
||||
case 400:
|
||||
message = '请求错误';
|
||||
break;
|
||||
case 401:
|
||||
message = '请求错误';
|
||||
break;
|
||||
case 403:
|
||||
router.replace({
|
||||
path: '/login',
|
||||
query: {
|
||||
redirect: router.currentRoute.fullPath
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 404:
|
||||
message = '请求地址出错';
|
||||
break;
|
||||
case 408:
|
||||
message = '请求超时';
|
||||
break;
|
||||
case 500:
|
||||
message = '服务器内部错误!';
|
||||
break;
|
||||
case 501:
|
||||
message = '服务未实现!';
|
||||
break;
|
||||
case 502:
|
||||
message = '网关错误!';
|
||||
break;
|
||||
case 503:
|
||||
message = '服务不可用!';
|
||||
break;
|
||||
case 504:
|
||||
message = '网关超时!';
|
||||
break;
|
||||
case 505:
|
||||
message = 'HTTP版本不受支持';
|
||||
break;
|
||||
default:
|
||||
message = '请求失败'
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
|
||||
export default $http;
|
||||
@@ -0,0 +1,90 @@
|
||||
var lang = {
|
||||
"lang": "en",
|
||||
"submit": "submit",
|
||||
"compose": "compose",
|
||||
"new": "new",
|
||||
"account": "Account",
|
||||
"password": "Password",
|
||||
"login": "login",
|
||||
"search": "Search Email",
|
||||
"inbox": "Inbox",
|
||||
"sender": "Sender",
|
||||
"title": "Title",
|
||||
"date": "Date",
|
||||
"to": "To:",
|
||||
"cc": "Cc:",
|
||||
"sender_desc": "Only the email prefix is required",
|
||||
"to_desc": "Recipient's e-mail address",
|
||||
"cc_desc": "Cc's e-mail address",
|
||||
"send": "send",
|
||||
"add_att": "Add Attachment",
|
||||
"attachment":"Attachment",
|
||||
"err_sender_must": "Sender's email prefix is required!",
|
||||
"only_prefix": "Only the email prefix is required!",
|
||||
"err_email_format": "Incorrect e-mail address, please check the e-mail format!",
|
||||
"err_title_must": "Title is required!",
|
||||
"succ_send": "Send Success!",
|
||||
"outbox": "outbox",
|
||||
"modify_pwd": "modify password",
|
||||
"enter_again": "enter again",
|
||||
"err_required_pwd": "Please Input Password!",
|
||||
"succ": "Success!",
|
||||
"err_pwd_diff": "The passwords entered twice do not match!",
|
||||
"fail": "Fail!",
|
||||
"settings":"Settings",
|
||||
"security":"Security"
|
||||
};
|
||||
|
||||
|
||||
|
||||
var zhCN = {
|
||||
"lang": "zhCn",
|
||||
"submit": "提交",
|
||||
"compose": "发件",
|
||||
"new": "新",
|
||||
"account": "用户名",
|
||||
"password": "密码",
|
||||
"login": "登录",
|
||||
"search": "搜索邮件",
|
||||
"inbox": "收件箱",
|
||||
"sender": "发件人",
|
||||
"title": "主题",
|
||||
"date": "时间",
|
||||
"to": "收件人:",
|
||||
"cc": "抄送:",
|
||||
"sender_desc": "只需要邮箱前缀",
|
||||
"to_desc": "接收人邮件地址",
|
||||
"cc_desc": "抄送人邮箱地址",
|
||||
"send": "发送",
|
||||
"add_att": "添加附件",
|
||||
"attachment":"附件",
|
||||
"err_sender_must": "发件人邮箱前缀必填",
|
||||
"only_prefix": "只需要邮箱前缀",
|
||||
"err_email_format": "邮箱地址错误,请检查邮箱格式!",
|
||||
"err_title_must": "标题必填!",
|
||||
"succ_send": "发送成功!",
|
||||
"outbox": "发件箱",
|
||||
"modify_pwd": "修改密码",
|
||||
"enter_again": "确认密码",
|
||||
"err_required_pwd": "请输入密码!",
|
||||
"succ": "成功!",
|
||||
"err_pwd_diff": "两次输入的密码不一致!",
|
||||
"fail": "失败",
|
||||
"settings":"设置",
|
||||
"security":"安全"
|
||||
}
|
||||
|
||||
switch (navigator.language) {
|
||||
case "zh":
|
||||
lang = zhCN
|
||||
break
|
||||
case "zh-CN":
|
||||
lang = zhCN
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
|
||||
export default lang;
|
||||
@@ -0,0 +1,16 @@
|
||||
import './assets/main.css'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import ListView from '../views/ListView.vue'
|
||||
import EditerView from '../views/EditerView.vue'
|
||||
import LoginView from '../views/LoginView.vue'
|
||||
import EmailDetailView from '../views/EmailDetailView.vue'
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: ListView
|
||||
},
|
||||
{
|
||||
path: '/list',
|
||||
name: 'list',
|
||||
component: ListView
|
||||
},
|
||||
{
|
||||
path: '/editer',
|
||||
name: "editer",
|
||||
component: EditerView
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: "login",
|
||||
component: LoginView
|
||||
},
|
||||
{
|
||||
path: '/detail/:id',
|
||||
name: "detail",
|
||||
component: EmailDetailView
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
const useGroupStore = defineStore('group', () => {
|
||||
const tag = ref("")
|
||||
const name = ref(lang.inbox)
|
||||
return { tag, name }
|
||||
})
|
||||
|
||||
export default useGroupStore
|
||||
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<el-form label-width="100px" :rules="rules" ref="ruleFormRef" :model="ruleForm" status-icon>
|
||||
<el-form-item :label="lang.sender" prop="sender">
|
||||
<el-input v-model="ruleForm.sender" :placeholder="lang.sender_desc"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item :label="lang.to" prop="receivers">
|
||||
<el-select v-model="ruleForm.receivers" style="width: 100%;" multiple filterable allow-create
|
||||
:reserve-keyword="false" :placeholder="lang.to_desc"></el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item :label="lang.cc" prop="cc">
|
||||
<el-select v-model="ruleForm.cc" style="width: 100%;" multiple filterable allow-create
|
||||
:reserve-keyword="false" :placeholder="lang.cc_desc"></el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item :label="lang.title" prop="subject">
|
||||
<el-input v-model="ruleForm.subject" :placeholder="lang.title"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<div id="editor">
|
||||
<div style="border: 1px solid #ccc">
|
||||
<Toolbar style="border-bottom: 1px solid #ccc" :editor="editorRef" :defaultConfig="toolbarConfig"
|
||||
:mode="mode" />
|
||||
<Editor style="height: 300px;" v-model="valueHtml" :defaultConfig="editorConfig" :mode="mode"
|
||||
@onCreated="handleCreated" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="fileList">
|
||||
<ol>
|
||||
<li v-for="(item, index) in fileList">{{ item.name }} <el-icon @click="delFile(index)">
|
||||
<Close />
|
||||
</el-icon> </li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div id="sendButton">
|
||||
<el-button type="primary" @click="send(ruleFormRef)">{{ lang.send }}</el-button>
|
||||
<!-- <el-button>定时发送</el-button> -->
|
||||
|
||||
<div style="margin-left: 15px">
|
||||
<el-button @click="upload">{{ lang.add_att }}</el-button>
|
||||
<input v-show="false" ref="fileRef" type="file" @change="fileChange">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
text-align: left;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
#editor {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
#sendButton {
|
||||
padding-left: 25px;
|
||||
padding-top: 5px;
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script setup>
|
||||
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onBeforeUnmount, ref, shallowRef, reactive, onMounted } from 'vue'
|
||||
import { Close } from '@element-plus/icons-vue';
|
||||
import lang from '../i18n/i18n';
|
||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||
import { i18nChangeLanguage } from '@wangeditor/editor'
|
||||
import $http from '../http/http';
|
||||
import router from "@/router"; //根路由对象
|
||||
import useGroupStore from '../stores/group'
|
||||
const groupStore = useGroupStore()
|
||||
|
||||
|
||||
if (lang.lang == "zhCn"){
|
||||
i18nChangeLanguage('zh-CN')
|
||||
}else{
|
||||
i18nChangeLanguage('en')
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 内容 HTML
|
||||
const valueHtml = ref('<p>hello</p>')
|
||||
|
||||
const toolbarConfig = {}
|
||||
const editorConfig = {
|
||||
MENU_CONF: {},
|
||||
placeholder: ''
|
||||
}
|
||||
|
||||
|
||||
editorConfig.MENU_CONF['uploadImage'] = {
|
||||
base64LimitSize: 100 * 1024 * 1024 * 1024, // 100G以下的文件都base64传
|
||||
}
|
||||
const mode = ref()
|
||||
const fileRef = ref();
|
||||
const pickFile = ref();
|
||||
const ruleFormRef = ref()
|
||||
const ruleForm = reactive({
|
||||
sender: '',
|
||||
receivers: '',
|
||||
cc: '',
|
||||
subject: '',
|
||||
})
|
||||
const fileList = reactive([]);
|
||||
|
||||
|
||||
const validateSender = function (rule, value, callback) {
|
||||
if (typeof ruleForm.sender === "undefined" || ruleForm.sender === null || ruleForm.sender.trim() === "") {
|
||||
callback(new Error(lang.err_sender_must))
|
||||
} else if (ruleForm.sender.includes("@")) {
|
||||
callback(new Error(lang.only_prefix))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
const checkEmail = function (str) {
|
||||
var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/
|
||||
if (re.test(str)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const validateReceivers = function (rule, value, callback) {
|
||||
for (let index = 0; index < ruleForm.receivers.length; index++) {
|
||||
let element = ruleForm.receivers[index];
|
||||
if (!checkEmail(element)) {
|
||||
callback(new Error(lang.err_email_format))
|
||||
return
|
||||
}
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
const validateCc = function (rule, value, callback) {
|
||||
for (let index = 0; index < ruleForm.cc.length; index++) {
|
||||
let element = ruleForm.cc[index];
|
||||
if (!checkEmail(element)) {
|
||||
callback(new Error(err_email_format))
|
||||
return
|
||||
}
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
const rules = reactive({
|
||||
sender: [
|
||||
{ validator: validateSender, trigger: 'change' }
|
||||
],
|
||||
receivers: [
|
||||
{ validator: validateReceivers, trigger: 'change' }
|
||||
],
|
||||
cc: [
|
||||
{ validator: validateCc, trigger: 'change' }
|
||||
],
|
||||
subject: [
|
||||
{ required: true, message: lang.err_title_must, trigger: 'change' },
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
// 编辑器实例,必须用 shallowRef
|
||||
const editorRef = shallowRef()
|
||||
// 组件销毁时,也及时销毁编辑器
|
||||
onBeforeUnmount(() => {
|
||||
const editor = editorRef.value
|
||||
if (editor == null) return
|
||||
editor.destroy()
|
||||
})
|
||||
|
||||
const handleCreated = (editor) => {
|
||||
editorRef.value = editor // 记录 editor 实例,重要!
|
||||
}
|
||||
|
||||
const send = function (formEl) {
|
||||
if (!formEl) return
|
||||
formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
let objectTos = []
|
||||
for (let index = 0; index < ruleForm.receivers.length; index++) {
|
||||
let element = ruleForm.receivers[index];
|
||||
objectTos.push({
|
||||
name: "",
|
||||
email: element
|
||||
})
|
||||
}
|
||||
|
||||
let objectCcs = []
|
||||
for (let index = 0; index < ruleForm.cc.length; index++) {
|
||||
let element = ruleForm.cc[index];
|
||||
objectCcs.push({
|
||||
name: "",
|
||||
email: element
|
||||
})
|
||||
}
|
||||
|
||||
let text = editorRef.value.getText()
|
||||
|
||||
$http.post("/api/email/send", {
|
||||
from: { name: ruleForm.sender, email: "" },
|
||||
to: objectTos,
|
||||
cc: objectCcs,
|
||||
subject: ruleForm.subject,
|
||||
text: text,
|
||||
html: valueHtml.value,
|
||||
attrs: fileList
|
||||
}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
ElMessage({
|
||||
message: lang.succ_send,
|
||||
type: 'success',
|
||||
})
|
||||
groupStore.name = lang.outbox
|
||||
groupStore.tag = '{"type":1,"status":-1}'
|
||||
router.replace({
|
||||
name: 'list',
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res.data)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const upload = function () {
|
||||
fileRef.value.dispatchEvent(new MouseEvent('click'))
|
||||
}
|
||||
|
||||
const fileChange = function (e) {
|
||||
let files = e.target.files || e.dataTransfer.files;
|
||||
if (!files.length)
|
||||
return;
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function fileReadCompleted() {
|
||||
fileList.push({
|
||||
name: files[i].name,
|
||||
data: this.result
|
||||
})
|
||||
};
|
||||
reader.readAsDataURL(files[i]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const delFile = function (index) {
|
||||
fileList.splice(index, 1);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<div id="title">{{ detailData.subject }}</div>
|
||||
<el-divider />
|
||||
|
||||
<div>
|
||||
<span>{{ lang.to }}:
|
||||
<span class="userItem" v-for="to in tos">{{ to.Name }} {{ to.EmailAddress }} ;</span>
|
||||
</span>
|
||||
|
||||
<span v-if="showCC">{{ lang.cc }}:
|
||||
<span class="userItem" v-for="ccs in cc">{{ cc.Name }} {{ cc.EmailAddress }} ;</span>
|
||||
</span>
|
||||
</div>
|
||||
<el-divider />
|
||||
<div class="content" id="text" v-if="detailData.html == ''">
|
||||
{{ detailData.text }}
|
||||
</div>
|
||||
|
||||
<div class="content" id="html" v-else v-html="detailData.html">
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="detailData.attachments.length > 0" style="">
|
||||
<el-divider />
|
||||
{{ lang.attachment }}:
|
||||
<a class="att" v-for="item in detailData.attachments"
|
||||
:href="'/attachments/download/' + detailData.id + '/' + item.Index"> <el-icon>
|
||||
<Document />
|
||||
</el-icon> {{ item.Filename }} </a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { RouterLink } from 'vue-router'
|
||||
import $http from "../http/http";
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import router from "@/router"; //根路由对象
|
||||
import { Document } from '@element-plus/icons-vue';
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
const route = useRoute()
|
||||
const detailData = ref({
|
||||
attachments:[]
|
||||
})
|
||||
|
||||
const tos = ref()
|
||||
const ccs = ref()
|
||||
const showCC = ref(false)
|
||||
|
||||
$http.post("/api/email/detail", { id: parseInt(route.params.id) }).then(res => {
|
||||
detailData.value = res.data
|
||||
if (res.data.to != "" && res.data.to != null) {
|
||||
tos.value = JSON.parse(res.data.to)
|
||||
}
|
||||
if (res.data.cc != "" && res.data.cc != null) {
|
||||
ccs.value = JSON.parse(res.data.cc)
|
||||
|
||||
}
|
||||
|
||||
if (ccs.value != null && ccs.value != undefined){
|
||||
showCC.value = ccs.value.length > 0
|
||||
}else{
|
||||
showCC.value = false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
display: flex;
|
||||
padding-left: 20px;
|
||||
padding-right: 80px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#title {
|
||||
font-size: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#userItem {}
|
||||
|
||||
.content {
|
||||
/* background-color: aliceblue; */
|
||||
}
|
||||
|
||||
a,a:link,a:visited,a:hover,a:active{
|
||||
text-decoration: none;
|
||||
color:inherit;
|
||||
}
|
||||
|
||||
.att{
|
||||
display:block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<div id="operation">
|
||||
<div id="action">
|
||||
<RouterLink to="/editer">+{{ lang.compose }}</RouterLink>
|
||||
</div>
|
||||
<!-- <div id="action">全部标记为已读</div> -->
|
||||
</div>
|
||||
<div id="title">{{ groupStore.name }}</div>
|
||||
<div id="table">
|
||||
<el-table :data="data" :show-header="true" :border="false" @row-click="rowClick" :row-style="rowStyle">
|
||||
<el-table-column type="selection" width="30" />
|
||||
<el-table-column prop="title" label="" width="50">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<span v-if="!scope.row.is_read">
|
||||
{{ lang.new }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="title" :label="lang.sender" width="150">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.is_read">
|
||||
<div v-if="scope.row.sender.Name != ''">{{ scope.row.sender.Name }}</div>
|
||||
{{ scope.row.sender.EmailAddress }}
|
||||
</span>
|
||||
<span v-else style="font-weight:bolder;">
|
||||
<div v-if="scope.row.sender.Name != ''">{{ scope.row.sender.Name }}</div>
|
||||
{{ scope.row.sender.EmailAddress }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="desc" :label="lang.title">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.is_read">{{ scope.row.title }}</div>
|
||||
<div v-else style="font-weight:bolder;">{{ scope.row.title }}</div>
|
||||
|
||||
<div style="font-size: 12px;height: 24px;">{{ scope.row.desc }}</div>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="datetime" :label="lang.date" width="180">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.is_read">{{ scope.row.datetime }}</span>
|
||||
<span v-else style="font-weight:bolder;">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div id="pagination">
|
||||
<el-pagination background layout="prev, pager, next" :page-count="totalPage" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script setup>
|
||||
import { RouterLink } from 'vue-router'
|
||||
import $http from "../http/http";
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import router from "@/router"; //根路由对象
|
||||
import useGroupStore from '../stores/group'
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
const groupStore = useGroupStore()
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
|
||||
|
||||
let tag = groupStore.tag;
|
||||
|
||||
if (tag == "") {
|
||||
tag = '{"type":0,"status":-1}'
|
||||
}
|
||||
|
||||
|
||||
watch(groupStore, async (newV, oldV) => {
|
||||
tag = newV.tag;
|
||||
if (tag == "") {
|
||||
tag = '{"type":0,"status":-1}'
|
||||
}
|
||||
data.value = []
|
||||
$http.post("/api/email/list", { tag: tag, page_size: 10 }).then(res => {
|
||||
data.value = res.data.list
|
||||
totalPage.value = res.data.total_page
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
const data = ref([])
|
||||
const totalPage = ref(0)
|
||||
|
||||
$http.post("/api/email/list", { tag: tag, page_size: 10 }).then(res => {
|
||||
data.value = res.data.list
|
||||
totalPage.value = res.data.total_page
|
||||
})
|
||||
|
||||
const rowClick = function (row, column, event) {
|
||||
router.push("/detail/" + row.id)
|
||||
}
|
||||
|
||||
const rowStyle = function ({ row, rowIndwx }) {
|
||||
return { 'cursor': 'pointer' }
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#action {
|
||||
text-align: left;
|
||||
font-size: 20px;
|
||||
line-height: 40px;
|
||||
padding-left: 10px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
#action a,
|
||||
a:visited {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#operation {
|
||||
display: flex;
|
||||
height: 40px;
|
||||
background-color: rgb(236, 244, 251);
|
||||
}
|
||||
|
||||
#title {
|
||||
margin-top: 10px;
|
||||
font-size: 23px;
|
||||
text-align: left;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#table {
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#pagination {
|
||||
padding-top: 30px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
/* 水平居中 */
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<div id="form">
|
||||
<el-form :model="form" label-width="120px">
|
||||
<el-form-item :label="lang.account">
|
||||
<el-input v-model="form.account" placeholder="User Name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="lang.password">
|
||||
<el-input v-model="form.password" placeholder="Password" type="password" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">{{ lang.login }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import { reactive } from 'vue'
|
||||
import $http from "../http/http";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import router from "@/router"; //根路由对象
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
|
||||
const form = reactive({
|
||||
account: '',
|
||||
password: '',
|
||||
})
|
||||
|
||||
const onSubmit = () => {
|
||||
$http.post("/api/login", form).then(res => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
router.replace({
|
||||
path: '/',
|
||||
query: {
|
||||
redirect: router.currentRoute.fullPath
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f1f1f1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
/* 水平居中 */
|
||||
align-items: center;
|
||||
/* 垂直居中 */
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user