mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
调整代码
This commit is contained in:
parent
64d34deb6b
commit
cda9be878b
@ -753,24 +753,4 @@ class SystemController extends AbstractController
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/system/get/regverify 18. 获取是否开启邮箱验证
|
||||
*
|
||||
* @apiDescription 获取邮箱配置是否开启注册邮箱验证
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup system
|
||||
* @apiName get__regverify
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function get__regverify()
|
||||
{
|
||||
User::auth();
|
||||
$isRegVerify = Base::settingFind('emailSetting', 'reg_verify') === 'open';
|
||||
return Base::retSuccess('success', $isRegVerify ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -986,12 +986,12 @@ class UsersController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/users/send/email 18. 发送邮箱验证码
|
||||
* @api {get} api/users/email/send 18. 发送邮箱验证码
|
||||
*
|
||||
* @apiDescription 需要token身份
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup users
|
||||
* @apiName send__email
|
||||
* @apiName email__send
|
||||
*
|
||||
* @apiParam {Number} type 邮件类型
|
||||
* @apiParam {String} email 邮箱地址
|
||||
@ -1000,11 +1000,12 @@ class UsersController extends AbstractController
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function send__email()
|
||||
public function email__send()
|
||||
{
|
||||
$user = User::auth();
|
||||
//
|
||||
$type = Request::input('type', 2);
|
||||
$email = Request::input('email');
|
||||
$user = User::auth();
|
||||
if (!$email) {
|
||||
return Base::retError('请输入新邮箱地址');
|
||||
}
|
||||
@ -1025,7 +1026,7 @@ class UsersController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/users/edit/email 19. 修改邮箱
|
||||
* @api {get} api/users/email/edit 19. 修改邮箱
|
||||
*
|
||||
* @apiDescription 需要token身份
|
||||
* @apiVersion 1.0.0
|
||||
@ -1039,9 +1040,10 @@ class UsersController extends AbstractController
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object} data 返回数据
|
||||
*/
|
||||
public function edit__email()
|
||||
public function email__edit()
|
||||
{
|
||||
$user = User::auth();
|
||||
//
|
||||
$user->checkSystem();
|
||||
//
|
||||
$newEmail = trim(Request::input('newEmail'));
|
||||
@ -1126,8 +1128,6 @@ class UsersController extends AbstractController
|
||||
return Base::retError('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
return Base::retSuccess('success', $user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ use Guanguans\Notify\Messages\EmailMessage;
|
||||
* @property string|null $code 验证参数
|
||||
* @property string|null $email 电子邮箱
|
||||
* @property int|null $status 0-未验证,1-已验证
|
||||
* @property int|null $type 邮件类型:1-邮箱认证,2-修改邮箱
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification newModelQuery()
|
||||
@ -26,11 +27,10 @@ use Guanguans\Notify\Messages\EmailMessage;
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereUserid($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $type 邮件类型:1-邮箱认证,2-修改邮箱,3-删除账号
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserEmailVerification whereType($value)
|
||||
*/
|
||||
class UserEmailVerification extends AbstractModel
|
||||
{
|
||||
|
||||
@ -29,7 +29,11 @@
|
||||
<Radio label="open">{{ $L('开启') }}</Radio>
|
||||
<Radio label="close">{{ $L('关闭') }}</Radio>
|
||||
</RadioGroup>
|
||||
<div v-if="formData.reg_verify == 'open'" class="form-tip">{{$L('开启后帐号需验证通过才可登录')}}</div>
|
||||
<div v-if="formData.reg_verify == 'open'" class="form-tip">
|
||||
{{$L('开启后:')}}<br/>
|
||||
{{$L('① 帐号需验证通过才可登录')}}<br/>
|
||||
{{$L('② 修改邮箱和删除账号需要邮箱验证码')}}
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem :label="$L('任务提醒')" prop="notice">
|
||||
<RadioGroup v-model="formData.notice">
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
<Form ref="formDatum" :model="formDatum" :rules="ruleDatum" label-width="auto" @submit.native.prevent>
|
||||
<FormItem :label="$L('账号')" prop="email">
|
||||
<div class="setting-email">
|
||||
<Input v-if="isRegVerify == 1" v-model="formDatum.email" :class="count > 0 ? 'setting-send-input':'setting-input'" search @on-search="sendEmailCode" :enter-button="$L(sendBtnText)" :placeholder="$L('请输入邮箱')" />
|
||||
<Input v-if="isRegVerify == 1" v-model="formDatum.email"
|
||||
:class="count > 0 ? 'setting-send-input':'setting-input'" search @on-search="sendEmailCode"
|
||||
:enter-button="$L(sendBtnText)" :placeholder="$L('请输入邮箱')"/>
|
||||
<Input v-else class="setting-input" v-model="formDatum.email" :placeholder="$L('请输入邮箱账号')"/>
|
||||
</div>
|
||||
</FormItem>
|
||||
@ -14,7 +16,8 @@
|
||||
<Input v-model="formDatum.password" type="password" :placeholder="$L('请输入登录密码')"/>
|
||||
</FormItem>
|
||||
<FormItem :label="$L('删除原因')">
|
||||
<Input v-model="formDatum.reason" type="textarea" :autosize="{minRows: 4,maxRows: 8}" :placeholder="$L('请输入注销原因')"></Input>
|
||||
<Input v-model="formDatum.reason" type="textarea" :autosize="{minRows: 4,maxRows: 8}"
|
||||
:placeholder="$L('请输入注销原因')"></Input>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<div class="setting-footer">
|
||||
@ -23,9 +26,8 @@
|
||||
</div>
|
||||
<Modal
|
||||
v-model="warningShow"
|
||||
class="warning-box">
|
||||
<div slot="header">
|
||||
<h3>{{ $L('删除DooTask账号') }}</h3>
|
||||
:title="$L(`删除${appTitle}账号`)"
|
||||
class="page-setting-delete-box">
|
||||
<div class="big-text">{{ $L('账号删除后,该账号将无法正常登录且无法恢复,账号下的所有数据也将被删除。') }}</div>
|
||||
<div class="small-text">
|
||||
<div>{{ $L('注销前,请确认一下事项:') }}</div>
|
||||
@ -34,7 +36,6 @@
|
||||
<div>{{ $L('3、您将退出所有群聊,无法查到过往消息和人员。') }}</div>
|
||||
<div>{{ $L('4、请保证账号未被暂停使用。') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="button-box">
|
||||
<Button type="primary" :loading="loadIng > 0" @click="submitForm('confirm')">{{ $L('已清楚风险,确定注销') }}
|
||||
</Button>
|
||||
@ -44,6 +45,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -55,22 +58,7 @@ export default {
|
||||
reason: '',
|
||||
password: '',
|
||||
},
|
||||
ruleDatum: {},
|
||||
count: 0,
|
||||
isSendButtonShow: true,
|
||||
codeShow: false,
|
||||
isRegVerify: 0,
|
||||
warningShow: false,
|
||||
sendBtnText: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRegVerify();
|
||||
},
|
||||
methods: {
|
||||
initLanguage() {
|
||||
this.sendBtnText = this.$L('发送验证码')
|
||||
this.ruleDatum = {
|
||||
ruleDatum: {
|
||||
email: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
@ -86,18 +74,45 @@ export default {
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
count: 0,
|
||||
isSendButtonShow: true,
|
||||
codeShow: false,
|
||||
isRegVerify: 0,
|
||||
warningShow: false,
|
||||
sendBtnText: this.$L('发送验证码')
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.formDatum.email = this.userInfo.email
|
||||
this.getRegVerify();
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
|
||||
appTitle() {
|
||||
return window.systemInfo.title || "DooTask";
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
sendEmailCode() {
|
||||
if (this.count > 0) {
|
||||
return
|
||||
}
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/send/email',
|
||||
data: {type: 3, email: this.formDatum.email}
|
||||
}).then(({}) => {
|
||||
url: 'users/email/send',
|
||||
data: {
|
||||
type: 3,
|
||||
email: this.formDatum.email
|
||||
},
|
||||
spinner: true
|
||||
}).then(_ => {
|
||||
this.isSendButtonShow = false;
|
||||
this.count = 120; //赋值120秒
|
||||
this.sendBtnText = this.count + ' 秒';
|
||||
let times = setInterval(() => {
|
||||
this.count--; //递减
|
||||
this.sendBtnText = this.count + ' 秒';
|
||||
@ -110,6 +125,7 @@ export default {
|
||||
$A.messageError(msg);
|
||||
})
|
||||
},
|
||||
|
||||
submitForm(type) {
|
||||
this.$refs.formDatum.validate((valid) => {
|
||||
if (valid) {
|
||||
@ -143,10 +159,9 @@ export default {
|
||||
|
||||
getRegVerify() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'system/get/regverify',
|
||||
url: 'system/setting/email',
|
||||
}).then(({data}) => {
|
||||
this.isRegVerify = data;
|
||||
}).catch(() => {
|
||||
this.isRegVerify = data.reg_verify === 'open';
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
<Form ref="formDatum" :model="formDatum" :rules="ruleDatum" label-width="auto" @submit.native.prevent>
|
||||
<FormItem :label="$L('新邮箱地址')" prop="newEmail">
|
||||
<div class="setting-email">
|
||||
<Input v-if="isRegVerify == 1" v-model="formDatum.newEmail" :class="count > 0 ? 'setting-send-input':'setting-input'" search @on-search="sendEmailCode" :enter-button="$L(sendBtnText)" :placeholder="$L('输入新邮箱地址')" />
|
||||
<Input v-if="isRegVerify == 1" v-model="formDatum.newEmail"
|
||||
:class="count > 0 ? 'setting-send-input':'setting-input'" search @on-search="sendEmailCode"
|
||||
:enter-button="$L(sendBtnText)" :placeholder="$L('输入新邮箱地址')"/>
|
||||
<Input v-else class="setting-input" v-model="formDatum.newEmail" :placeholder="$L('输入新邮箱地址')"/>
|
||||
</div>
|
||||
</FormItem>
|
||||
@ -28,20 +30,7 @@ export default {
|
||||
newEmail: '',
|
||||
code: '',
|
||||
},
|
||||
ruleDatum: {},
|
||||
count: 0,
|
||||
isSendButtonShow: true,
|
||||
isRegVerify: 0,
|
||||
sendBtnText: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRegVerify();
|
||||
},
|
||||
methods: {
|
||||
initLanguage() {
|
||||
this.sendBtnText = this.$L('发送验证码');
|
||||
this.ruleDatum = {
|
||||
ruleDatum: {
|
||||
newEmail: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
@ -57,15 +46,31 @@ export default {
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
count: 0,
|
||||
isSendButtonShow: true,
|
||||
isRegVerify: 0,
|
||||
sendBtnText: this.$L('发送验证码')
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getRegVerify();
|
||||
},
|
||||
|
||||
methods: {
|
||||
sendEmailCode() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/send/email',
|
||||
data: {type: 2, email: this.formDatum.newEmail}
|
||||
}).then(({}) => {
|
||||
url: 'users/email/send',
|
||||
data: {
|
||||
type: 2,
|
||||
email: this.formDatum.newEmail
|
||||
},
|
||||
spinner: true
|
||||
}).then(_ => {
|
||||
this.isSendButtonShow = false;
|
||||
this.count = 120; //赋值120秒
|
||||
this.sendBtnText = this.count + ' 秒';
|
||||
let times = setInterval(() => {
|
||||
this.count--; //递减
|
||||
this.sendBtnText = this.count + ' 秒';
|
||||
@ -78,12 +83,13 @@ export default {
|
||||
$A.messageError(msg);
|
||||
})
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.$refs.formDatum.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loadIng++;
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/edit/email',
|
||||
url: 'users/email/edit',
|
||||
data: this.formDatum,
|
||||
}).then(({data}) => {
|
||||
$A.messageSuccess('修改成功');
|
||||
@ -105,10 +111,9 @@ export default {
|
||||
|
||||
getRegVerify() {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'system/get/regverify',
|
||||
url: 'system/setting/email',
|
||||
}).then(({data}) => {
|
||||
this.isRegVerify = data;
|
||||
}).catch(() => {
|
||||
this.isRegVerify = data.reg_verify === 'open';
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@ -90,12 +90,12 @@ export default {
|
||||
menu.push(...[
|
||||
{path: 'system', name: '系统设置', divided: true},
|
||||
{path: 'logout', name: '退出登录'},
|
||||
{path: 'delete', name: '删除账户'},
|
||||
{path: 'delete', name: '删除账户', divided: true},
|
||||
])
|
||||
} else {
|
||||
menu.push(...[
|
||||
{path: 'logout', name: '退出登录', divided: true},
|
||||
{path: 'delete', name: '删除账户'},
|
||||
{path: 'delete', name: '删除账户', divided: true},
|
||||
])
|
||||
}
|
||||
return menu;
|
||||
|
||||
@ -289,17 +289,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
.warning-box {
|
||||
.page-setting-delete-box {
|
||||
.big-text {
|
||||
margin-top: 10px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.small-text {
|
||||
margin-top: 15px;
|
||||
|
||||
div {
|
||||
margin-top: 10px;
|
||||
> div {
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
.button-box {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user