web-backset.cn/apps/server/view/page/signup/index.ts

27 lines
751 B
TypeScript
Raw Normal View History

2023-02-11 13:21:06 +08:00
import { createUser } from '../../api';
import './index.less';
import $ from 'cash-dom';
2023-02-17 17:59:41 +08:00
const { RegUtil, ValidateUtil } = require('@backset/util');
2023-02-11 13:21:06 +08:00
$(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: '手机号格式错误' });
2023-02-17 17:59:41 +08:00
createUser(params).then(res => {
2023-02-11 13:21:06 +08:00
console.log(res);
});
}
});