27 lines
748 B
TypeScript
27 lines
748 B
TypeScript
|
import { createUser } from '../../api';
|
||
|
import './index.less';
|
||
|
import $ from 'cash-dom';
|
||
|
import { RegUtil, ValidateUtil } from '@backset/util';
|
||
|
|
||
|
$(function () {
|
||
|
$('#signup-module').on('click', '#btn-signup', handleCreateUser);
|
||
|
|
||
|
/**
|
||
|
* 注册
|
||
|
*/
|
||
|
function handleCreateUser() {
|
||
|
const params = {
|
||
|
user_login: '' + $('#username').val(),
|
||
|
user_pass: '' + $('#password').val(),
|
||
|
user_phone: '' + $('#tel').val(),
|
||
|
};
|
||
|
if (ValidateUtil.withEmpty(params)) return;
|
||
|
// return message.error({ text: '请补全表单' });
|
||
|
if (!RegUtil.PHONE.test(params.user_phone)) return;
|
||
|
// return message.error({ text: '手机号格式错误' });
|
||
|
createUser(params).then((res) => {
|
||
|
console.log(res);
|
||
|
});
|
||
|
}
|
||
|
});
|