|
@@ -53,7 +53,7 @@ import { HomeFilled, UserFilled, Lock, Iphone, Tickets } from '@element-plus/ico
|
|
|
import { ElNotification, ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
|
|
import { isValueEmpty } from "@/utils/tools";
|
|
|
import { post } from "@/utils/request";
|
|
|
-import { SENDVCODE } from "./api";
|
|
|
+import { REGISTER, SENDVCODE } from "./api";
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
const ruleFormRef = ref<FormInstance>();
|
|
@@ -118,19 +118,19 @@ const sendVcode = () => {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- // post(SENDVCODE, {
|
|
|
- // mobile: ruleForm.value.phone
|
|
|
- // }).then(res => {
|
|
|
- // if (res.code == "ok") {
|
|
|
- // ElMessage.success({
|
|
|
- // message: "发送成功",
|
|
|
- // type: "success",
|
|
|
- // duration: 2000,
|
|
|
- // })
|
|
|
- // showTimer.value = true;
|
|
|
- // countDown();
|
|
|
- // }
|
|
|
- // })
|
|
|
+ post(SENDVCODE, {
|
|
|
+ mobile: ruleForm.value.phone
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ ElMessage.success({
|
|
|
+ message: "发送成功",
|
|
|
+ type: "success",
|
|
|
+ duration: 2000,
|
|
|
+ })
|
|
|
+ showTimer.value = true;
|
|
|
+ countDown();
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
const register = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) {
|
|
@@ -145,27 +145,45 @@ const register = (formEl: FormInstance | undefined) => {
|
|
|
let params = {
|
|
|
...ruleForm.value,
|
|
|
}
|
|
|
+ /* 如果地址栏有参数,就带上 */
|
|
|
if (!isValueEmpty(route.query)) {
|
|
|
params = {
|
|
|
...params,
|
|
|
...route.query
|
|
|
}
|
|
|
}
|
|
|
- console.log(params);
|
|
|
- // if (res.code == "ok") {
|
|
|
- // ElNotification.success({
|
|
|
- // title: "注册成功",
|
|
|
- // message: "注册成功",
|
|
|
- // type: "success",
|
|
|
- // duration: 1000,
|
|
|
- // onClose: () => {
|
|
|
- // router.push('/login')
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
-
|
|
|
+ // console.log(params);
|
|
|
+ post(REGISTER, params).then(res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ ElNotification.success({
|
|
|
+ title: "提示",
|
|
|
+ message: "注册成功",
|
|
|
+ type: "success",
|
|
|
+ duration:3000,
|
|
|
+ onClose: () => {
|
|
|
+ registerLoading.value = false;
|
|
|
+ router.back()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ElNotification.error({
|
|
|
+ title: "提示",
|
|
|
+ message: res.message || res.msg,
|
|
|
+ type: "success",
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ registerLoading.value = false;
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ ElNotification.error({
|
|
|
+ title: "提示",
|
|
|
+ message: err.message || err.msg,
|
|
|
+ type: "success",
|
|
|
+ duration: 3000,
|
|
|
+ })
|
|
|
+ registerLoading.value = false;
|
|
|
+ })
|
|
|
|
|
|
- registerLoading.value = false;
|
|
|
})
|
|
|
|
|
|
};
|