123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 邮件服务配置
- </h2>
- <!-- <h3 class="infoTitle">优惠券信息</h3>
- <el-divider></el-divider> -->
- <div class="m-core">
- <el-form :model="form" ref="form" class="form">
- <el-row :gutter="20">
- <el-col style="width: 395px">
- <el-form-item
- label="服务器主机名"
- prop="hostName"
- :rules="[{ required: true, message: '请输入服务器主机名' }]"
- >
- <el-input
- style="width: 355px !important"
- v-model="form.hostName"
- placeholder="请输服务器主机名"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col style="width: 395px">
- <el-form-item
- label="服务器端口号"
- prop="smtpPort"
- :rules="[{ required: true, message: '请输入服务器端口号' }]"
- >
- <el-input
- style="width: 355px !important"
- v-model="form.smtpPort"
- placeholder="请输入服务器端口号"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col style="width: 395px">
- <el-form-item
- label="服务器用户名"
- prop="userName"
- :rules="[{ required: true, message: '请输入服务器用户名' }]"
- >
- <el-input
- style="width: 355px !important"
- v-model="form.userName"
- placeholder="请输入服务器用户名"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col style="width: 395px">
- <el-form-item
- label="服务器密码"
- prop="password"
- :rules="[{ required: true, message: '请输入服务器密码' }]"
- >
- <el-input
- show-password
- style="width: 355px !important"
- v-model="form.password"
- placeholder="请输入服务器密码"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col style="width: 395px">
- <el-form-item
- label="邮箱"
- prop="from"
- :rules="[{ required: true, message: '请输入邮箱' }]"
- >
- <el-input
- style="width: 355px !important"
- v-model="form.from"
- placeholder="请输入邮箱"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col style="width: 395px">
- <el-form-item
- label="落款名称"
- prop="fromName"
- :rules="[{ required: true, message: '请输入落款名称' }]"
- >
- <el-input
- style="width: 355px !important"
- v-model="form.fromName"
- placeholder="请输入落款名称"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <!-- -->
- <el-form-item>
- <el-button type="primary" v-permission="'sysEmail/update'" @click="setEmil">保存</el-button>
- <!-- <el-button type="primary" v-else @click="addCoupon">提交</el-button> -->
- <el-button type="danger" @click="resetForm">重置</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- import { getEmail,resetEmail } from "./api.js";
- import { couponTypeList, coupontypeDetailList } from "@/utils/searchArray";
- import { getTimes } from "@/utils";
- export default {
- data() {
- return {
- couponTypeList,
- coupontypeDetail: coupontypeDetailList,
- form: {
- id:1,
- hostName: null,
- smtpPort: null,
- userName: null,
- password: null,
- from: null,
- fromName: null,
- tenantId:-1
- },
- };
- },
- mounted() {
- this.getList()
- },
- methods: {
- async getList() {
- try{
- const res = await getEmail({tenantId:-1})
- if(res.data){
- this.form = {...res.data}
- this.activeRow = {...res.data}
- }
- }catch(e){
- console.log(e)
- }
- },
- resetForm() {
- this.$refs.form.resetFields();
- if (this.activeRow) {
- this.form = { ...this.activeRow };
- }
- },
- async setEmil() {
- this.$refs.form.validate(async (some) => {
- if (some) {
- this.$confirm("是否保存邮件配置?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- try {
- const res = await resetEmail({...this.form,tenantId:-1});
- this.$message.success("保存成功");
- this.getList()
- } catch (e) {
- console.log(e);
- }
- })
- .catch(() => {});
- }
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .form {
- margin-top: 30px;
- }
- .infoTitle {
- font-weight: 400;
- margin-top: 30px;
- font-size: 18px;
- }
- /deep/label {
- font-weight: 400;
- }
- </style>
|