init
This commit is contained in:
1 parent
8f7fbd4fee
commit
c0f12558b5
54 files changed
+1273
-132
No files matched your search
+3
-3
@@ -2,11 +2,11 @@
|
||||
import { RouterView } from 'vue-router'
|
||||
import HomeHeader from '@/components/HomeHeader.vue'
|
||||
import HomeAside from '@/components/HomeAside.vue';
|
||||
import { watch,ref } from 'vue'
|
||||
import { watch, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
const route = useRoute()
|
||||
|
||||
const pageName = ref(route.name)
|
||||
const pageName = ref(route.name)
|
||||
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
@@ -21,7 +21,7 @@ watch(
|
||||
<div id="main">
|
||||
<HomeHeader />
|
||||
<div id="content">
|
||||
<div id="aside" v-if="pageName != 'login'">
|
||||
<div id="aside" v-if="pageName != 'login' && pageName != 'setup'">
|
||||
<HomeAside />
|
||||
</div>
|
||||
<div id="body">
|
||||
|
||||
+11
-2
@@ -9,7 +9,7 @@ var $http = axios.create({
|
||||
timeout: 6000, //设置超时
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8;',
|
||||
'Lang':lang.lang
|
||||
'Lang': lang.lang
|
||||
}
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ $http.interceptors.request.use((config) => {
|
||||
//响应拦截器
|
||||
$http.interceptors.response.use((response) => {
|
||||
//响应成功
|
||||
if(response.data.errorNo == 403){
|
||||
if (response.data.errorNo == 403) {
|
||||
router.replace({
|
||||
path: '/login',
|
||||
query: {
|
||||
@@ -35,6 +35,15 @@ $http.interceptors.response.use((response) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
//响应成功
|
||||
if (response.data.errorNo == 402) {
|
||||
router.replace({
|
||||
path: '/setup',
|
||||
query: {
|
||||
redirect: router.currentRoute.fullPath
|
||||
}
|
||||
})
|
||||
}
|
||||
return response.data;
|
||||
}, (error) => {
|
||||
//响应错误
|
||||
|
||||
+45
-6
@@ -18,7 +18,7 @@ var lang = {
|
||||
"cc_desc": "Cc's e-mail address",
|
||||
"send": "send",
|
||||
"add_att": "Add Attachment",
|
||||
"attachment":"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!",
|
||||
@@ -31,8 +31,28 @@ var lang = {
|
||||
"succ": "Success!",
|
||||
"err_pwd_diff": "The passwords entered twice do not match!",
|
||||
"fail": "Fail!",
|
||||
"settings":"Settings",
|
||||
"security":"Security"
|
||||
"settings": "Settings",
|
||||
"security": "Security",
|
||||
"SetDomail": "Set Domain",
|
||||
"setDNS": "Set DNS",
|
||||
"setSSL": "Set SSL",
|
||||
"setDatabase": "Set Database",
|
||||
"setOther": "Other",
|
||||
"welcome": "Welcome",
|
||||
"next": "Next",
|
||||
"tks_pmail": "Thanks for using Pmail",
|
||||
"guid_desc": "Next, you will be guided to perform initial configuration. If you have already configured, please use your configuration file to overwrite the config folder of the running directory. If you have not configured it, please follow this guide.",
|
||||
"select_db": "select database",
|
||||
"db_desc": "PMail currently supports MySQL and SQLite3 databases, you can choose according to your needs.",
|
||||
"type": "Type",
|
||||
"db_select_ph": "please select your database",
|
||||
"mysql_dsn": "MySQL DSN",
|
||||
"sqlite_db_path": "Data File Path",
|
||||
"domain_desc": "Set your domain infomation.",
|
||||
"smtp_domain": "SMTP Domain",
|
||||
"web_domain": "Web Domain",
|
||||
"dns_desc": "Please add the following information to your DNS records",
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +77,7 @@ var zhCN = {
|
||||
"cc_desc": "抄送人邮箱地址",
|
||||
"send": "发送",
|
||||
"add_att": "添加附件",
|
||||
"attachment":"附件",
|
||||
"attachment": "附件",
|
||||
"err_sender_must": "发件人邮箱前缀必填",
|
||||
"only_prefix": "只需要邮箱前缀",
|
||||
"err_email_format": "邮箱地址错误,请检查邮箱格式!",
|
||||
@@ -70,8 +90,27 @@ var zhCN = {
|
||||
"succ": "成功!",
|
||||
"err_pwd_diff": "两次输入的密码不一致!",
|
||||
"fail": "失败",
|
||||
"settings":"设置",
|
||||
"security":"安全"
|
||||
"settings": "设置",
|
||||
"security": "安全",
|
||||
"SetDomail": "域名设置",
|
||||
"setDNS": "DNS设置",
|
||||
"setSSL": "SSL设置",
|
||||
"setDatabase": "数据库设置",
|
||||
"setOther": "其他设置",
|
||||
"welcome": "欢迎",
|
||||
"next": "下一步",
|
||||
"tks_pmail": "感谢使用PMail",
|
||||
"guid_desc": "接下来将会指引你进行初始化配置,如果你已有配置,请使用你的配置文件覆盖运行目录的config文件夹。如果你没有配置过,请按照该指引操作。",
|
||||
"select_db": "数据库选择",
|
||||
"db_desc": "PMail目前支持MySQL和SQLite3两种数据库,你可根据需要选择。",
|
||||
"type": "类型",
|
||||
"db_select_ph": "请选择你的数据库",
|
||||
"mysql_dsn": "MySQL DSN",
|
||||
"sqlite_db_path": "存储位置",
|
||||
"domain_desc": "设置你的域名信息。",
|
||||
"smtp_domain": "SMTP域名地址",
|
||||
"web_domain": "Web域名地址",
|
||||
"dns_desc": "请将以下信息添加到DNS记录中"
|
||||
}
|
||||
|
||||
switch (navigator.language) {
|
||||
|
||||
@@ -3,6 +3,9 @@ import ListView from '../views/ListView.vue'
|
||||
import EditerView from '../views/EditerView.vue'
|
||||
import LoginView from '../views/LoginView.vue'
|
||||
import EmailDetailView from '../views/EmailDetailView.vue'
|
||||
import SetupView from '../views/SetupView.vue'
|
||||
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
@@ -26,6 +29,11 @@ const router = createRouter({
|
||||
name: "login",
|
||||
component: LoginView
|
||||
},
|
||||
{
|
||||
path: '/setup',
|
||||
name: "setup",
|
||||
component: SetupView
|
||||
},
|
||||
{
|
||||
path: '/detail/:id',
|
||||
name: "detail",
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import $http from '../http/http';
|
||||
|
||||
import '@wangeditor/editor/dist/css/style.css' // 引入 css
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onBeforeUnmount, ref, shallowRef, reactive, onMounted } from 'vue'
|
||||
@@ -83,7 +85,6 @@ 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()
|
||||
|
||||
@@ -35,8 +35,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { RouterLink } from 'vue-router'
|
||||
import $http from "../http/http";
|
||||
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import router from "@/router"; //根路由对象
|
||||
|
||||
@@ -57,8 +57,9 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { RouterLink } from 'vue-router'
|
||||
import $http from "../http/http";
|
||||
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import router from "@/router"; //根路由对象
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<el-steps :active="active" align-center finish-status="success" id="status">
|
||||
<el-step :title="lang.welcome" />
|
||||
<el-step :title="lang.setDatabase" />
|
||||
<el-step :title="lang.SetDomail" />
|
||||
<el-step :title="lang.setDNS" />
|
||||
<el-step :title="lang.setSSL" />
|
||||
<el-step :title="lang.setOther" />
|
||||
</el-steps>
|
||||
|
||||
|
||||
<div v-if="active == 0" class="ctn">
|
||||
<div class="desc">
|
||||
<h2>{{ lang.tks_pmail }}</h2>
|
||||
<div style="margin-top: 10px;">{{ lang.guid_desc }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div v-if="active == 1" class="ctn">
|
||||
<div class="desc">
|
||||
<h2>{{ lang.select_db }}</h2>
|
||||
<div style="margin-top: 10px;">{{ lang.db_desc }}</div>
|
||||
</div>
|
||||
<div class="form" style="width: 400px;">
|
||||
<el-form label-width="120px">
|
||||
<el-form-item :label="lang.type">
|
||||
<el-select :placeholder="lang.db_select_ph" v-model="dbSettings.type">
|
||||
<el-option label="MySQL" value="mysql" />
|
||||
<el-option label="SQLite3" value="sqlite" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="lang.mysql_dsn" v-if="dbSettings.type == 'mysql'">
|
||||
<el-input :rows="2" type="textarea" v-model="dbSettings.dsn"
|
||||
placeholder="root:12345@tcp(127.0.0.1:3306)/pmail?parseTime=True&loc=Local"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="lang.sqlite_db_path" v-if="dbSettings.type == 'sqlite'">
|
||||
<el-input v-model="dbSettings.dsn" placeholder="./pmail.db"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div v-if="active == 2" class="ctn">
|
||||
<div class="desc">
|
||||
<h2>{{ lang.SetDomail }}</h2>
|
||||
<!-- <div style="margin-top: 10px;">{{ lang.domain_desc }}</div> -->
|
||||
</div>
|
||||
<div class="form" style="width: 400px;">
|
||||
<el-form label-width="120px">
|
||||
|
||||
<el-form-item :label="lang.smtp_domain">
|
||||
<el-input placeholder="domaim.com" v-model="domainSettings.smtp_domain">
|
||||
<template #prepend>smtp.</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="lang.web_domain">
|
||||
<el-input placeholder="pmail.domain.com" v-model="domainSettings.web_domain"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div v-if="active == 3" class="ctn_s">
|
||||
<div class="desc">
|
||||
<h2>{{ lang.setDNS }}</h2>
|
||||
<div style="margin-top: 10px;">{{ lang.dns_desc }}</div>
|
||||
</div>
|
||||
<div class="form" width="600px">
|
||||
<el-table :data="dnsInfos" border style="width: 100%">
|
||||
<el-table-column prop="host" label="HOSTNAME" width="110px" />
|
||||
<el-table-column prop="type" label="TYPE" width="110px" />
|
||||
<el-table-column prop="value" label="VALUE">
|
||||
<template #default="scope">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-tooltip :content="scope.row.tips" placement="top" v-if="scope.row.tips != ''">
|
||||
{{ scope.row.value }}
|
||||
</el-tooltip>
|
||||
<span v-else>{{ scope.row.value }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="ttl" label="TTL" width="110px" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<el-button id="next" style="margin-top: 12px" @click="next">{{ lang.next }}</el-button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import $http from "../http/http";
|
||||
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import router from "@/router"; //根路由对象
|
||||
import lang from '../i18n/i18n';
|
||||
|
||||
|
||||
const dbSettings = reactive({
|
||||
"type": "",
|
||||
"dsn": "",
|
||||
"lable": ""
|
||||
})
|
||||
|
||||
const domainSettings = reactive({
|
||||
"web_domain": "",
|
||||
"smtp_domain": ""
|
||||
})
|
||||
|
||||
const active = ref(0)
|
||||
|
||||
const dnsInfos = ref([
|
||||
{ "host": "smtp", "type": "A", "value": "YouServerIp", "prid": "NA", "ttl": "3600" }
|
||||
])
|
||||
|
||||
const getDbConfig = () => {
|
||||
$http.post("/api/setup", { "action": "get", "step": "database" }).then((res) => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
dbSettings.type = res.data.db_type;
|
||||
dbSettings.dsn = res.data.db_dsn;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getDomainConfig = () => {
|
||||
$http.post("/api/setup", { "action": "get", "step": "domain" }).then((res) => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
domainSettings.web_domain = res.data.web_domain;
|
||||
domainSettings.smtp_domain = res.data.smtp_domain;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const setDbConfig = () => {
|
||||
$http.post("/api/setup", { "action": "set", "step": "database", "db_type": dbSettings.type, "db_dsn": dbSettings.dsn }).then((res) => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
active.value++;
|
||||
getDomainConfig();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getDNSConfig = () => {
|
||||
$http.post("/api/setup", { "action": "get", "step": "dns" }).then((res) => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
dnsInfos.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const setDomainConfig = () => {
|
||||
$http.post("/api/setup", { "action": "set", "step": "domain", "web_domain": domainSettings.web_domain, "smtp_domain": domainSettings.smtp_domain }).then((res) => {
|
||||
if (res.errorNo != 0) {
|
||||
ElMessage.error(res.errorMsg)
|
||||
} else {
|
||||
active.value++;
|
||||
getDNSConfig();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const next = () => {
|
||||
switch (active.value) {
|
||||
case 0:
|
||||
active.value++
|
||||
getDbConfig();
|
||||
break
|
||||
case 1:
|
||||
setDbConfig();
|
||||
break;
|
||||
case 2:
|
||||
setDomainConfig();
|
||||
break;
|
||||
case 3:
|
||||
active.value++
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f1f1f1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.desc {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
#status {}
|
||||
|
||||
.ctn {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ctn_s {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
|
||||
#next {}
|
||||
</style>
|
||||
Reference in new issue
Block a user