update: 登陆 忘记密码 我的
This commit is contained in:
parent
0deee4db0c
commit
00ffb5d5d7
|
@ -139,17 +139,13 @@ const startSave = () => {
|
||||||
if (model1.formData.id) {
|
if (model1.formData.id) {
|
||||||
GoodsApi.editReceiveCategory(model1.formData).then((res) => {
|
GoodsApi.editReceiveCategory(model1.formData).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.redirectTo({
|
uni.navigateBack()
|
||||||
url: "/pagesApp/receiveType", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
GoodsApi.getStockCardList(model1.formData).then((res) => {
|
GoodsApi.addReCategory(model1.formData).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.redirectTo({
|
uni.navigateBack()
|
||||||
url: "/pagesApp/receiveType", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
import { GoodsApi } from "@/services";
|
import { GoodsApi } from "@/services";
|
||||||
import PageView from "@/components/PageView/index.vue";
|
import PageView from "@/components/PageView/index.vue";
|
||||||
import SmallModal from "@/components/Modal/smallModal.vue";
|
import SmallModal from "@/components/Modal/smallModal.vue";
|
||||||
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
const isShowCancelModal = ref(false);
|
const isShowCancelModal = ref(false);
|
||||||
const deleteId = ref(0);
|
const deleteId = ref(0);
|
||||||
const handleModal = (v: boolean, id: number) => {
|
const handleModal = (v: boolean, id: number) => {
|
||||||
|
@ -132,7 +133,8 @@ const getList = (v?: boolean) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onShow(() => {
|
||||||
|
resetPageList();
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
}"
|
}"
|
||||||
@focus="handleFocus(item.modelName)"
|
@focus="handleFocus(item.modelName)"
|
||||||
@blur="handleFocus('')"
|
@blur="handleFocus('')"
|
||||||
|
@change="(e:any) => {handleInput(e, item.modelName)}"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<text v-if="item.modelName === 'code'" class="code-btn">
|
<text v-if="item.modelName === 'code'" class="code-btn">
|
||||||
|
@ -47,13 +48,14 @@
|
||||||
:placeholder="item.placeholder"
|
:placeholder="item.placeholder"
|
||||||
:shape="'circle'"
|
:shape="'circle'"
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
:type="item.isShowPwd ? 'text' : 'password'"
|
:password="!item.isShowPwd"
|
||||||
:customStyle="{
|
:customStyle="{
|
||||||
'border-color':
|
'border-color':
|
||||||
currentFocus === item.modelName ? '#00dcee !important' : '',
|
currentFocus === item.modelName ? '#00dcee !important' : '',
|
||||||
}"
|
}"
|
||||||
@focus="handleFocus(item.modelName)"
|
@focus="handleFocus(item.modelName)"
|
||||||
@blur="handleFocus('')"
|
@blur="handleFocus('')"
|
||||||
|
@change="(e:any) => {handleInput(e, item.modelName)}"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<image
|
<image
|
||||||
|
@ -92,12 +94,13 @@
|
||||||
import { ProfileApi } from "@/services/index";
|
import { ProfileApi } from "@/services/index";
|
||||||
import LoginLayout from "./components/loginLayout.vue";
|
import LoginLayout from "./components/loginLayout.vue";
|
||||||
import valid from "@/utils/validate";
|
import valid from "@/utils/validate";
|
||||||
|
import { validateRegex } from "@/utils";
|
||||||
const loginForm = ref(null);
|
const loginForm = ref(null);
|
||||||
const model1 = <any>reactive({
|
const model1 = <any>reactive({
|
||||||
userInfo: {
|
userInfo: {
|
||||||
userName: "",
|
phone: "",
|
||||||
code: "",
|
code: "",
|
||||||
passwordNew: "",
|
newPassword: "",
|
||||||
passwordConfirm: "",
|
passwordConfirm: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -107,7 +110,7 @@ const currentFocus = ref("");
|
||||||
// 表单属性清单
|
// 表单属性清单
|
||||||
const formAttrList = ref([
|
const formAttrList = ref([
|
||||||
{
|
{
|
||||||
modelName: "userName",
|
modelName: "phone",
|
||||||
type: "text",
|
type: "text",
|
||||||
placeholder: "请输入手机号",
|
placeholder: "请输入手机号",
|
||||||
},
|
},
|
||||||
|
@ -117,7 +120,7 @@ const formAttrList = ref([
|
||||||
placeholder: "请输入验证码",
|
placeholder: "请输入验证码",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
modelName: "passwordNew",
|
modelName: "newPassword",
|
||||||
type: "password",
|
type: "password",
|
||||||
placeholder: "请输入新密码",
|
placeholder: "请输入新密码",
|
||||||
isShowPwd: false, // 控制密码显示隐藏
|
isShowPwd: false, // 控制密码显示隐藏
|
||||||
|
@ -129,24 +132,51 @@ const formAttrList = ref([
|
||||||
isShowPwd: false, // 控制密码显示隐藏
|
isShowPwd: false, // 控制密码显示隐藏
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const handleInput = (e: any, key: string) => {
|
||||||
|
if (key === "phone") {
|
||||||
|
const temp = e?.replace(valid.valid_number, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === "code") {
|
||||||
|
const temp = e?.replace(valid.valid_number, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === "newPassword" || key === "passwordConfirm") {
|
||||||
|
const temp = e?.replace(valid.valid_no_cn, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 获取验证码交互
|
// 获取验证码交互
|
||||||
const seconds = ref(0);
|
const seconds = ref(0);
|
||||||
const handleCode = () => {
|
const handleCode = () => {
|
||||||
console.log(model1);
|
if (model1.userInfo === undefined || !model1.userInfo.phone) {
|
||||||
if (model1.userInfo === undefined || !model1.userInfo.userName) {
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请输入手机号",
|
title: "请输入手机号",
|
||||||
icon: "error",
|
icon: "error",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!valid.mobile.pattern.test(model1.userInfo.userName)) {
|
if (!valid.mobile.pattern.test(model1.userInfo.phone)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "手机号不合法",
|
title: "请输入正确的手机号",
|
||||||
icon: "error",
|
icon: "error",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ProfileApi.sendCommonMsg({
|
||||||
|
phone: model1.userInfo.phone,
|
||||||
|
type: "forget",
|
||||||
|
}).then((res) => {
|
||||||
seconds.value = 120;
|
seconds.value = 120;
|
||||||
let countDownTimer = setInterval(() => {
|
let countDownTimer = setInterval(() => {
|
||||||
if (seconds.value > 0) {
|
if (seconds.value > 0) {
|
||||||
|
@ -155,9 +185,10 @@ const handleCode = () => {
|
||||||
clearInterval(countDownTimer);
|
clearInterval(countDownTimer);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
"userInfo.userName": {
|
"userInfo.phone": {
|
||||||
type: "string",
|
type: "string",
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入手机号",
|
message: "请输入手机号",
|
||||||
|
@ -169,11 +200,11 @@ const rules = ref({
|
||||||
message: "请输入验证码",
|
message: "请输入验证码",
|
||||||
trigger: ["blur", "change"],
|
trigger: ["blur", "change"],
|
||||||
},
|
},
|
||||||
"userInfo.passwordNew": {
|
"userInfo.newPassword": {
|
||||||
type: "string",
|
type: "string",
|
||||||
required: true,
|
required: true,
|
||||||
message: "请输入新密码",
|
|
||||||
trigger: ["blur", "change"],
|
trigger: ["blur", "change"],
|
||||||
|
message: "请输入新密码"
|
||||||
},
|
},
|
||||||
"userInfo.passwordConfirm": {
|
"userInfo.passwordConfirm": {
|
||||||
type: "string",
|
type: "string",
|
||||||
|
@ -181,27 +212,56 @@ const rules = ref({
|
||||||
message: "请输入确认密码",
|
message: "请输入确认密码",
|
||||||
trigger: ["blur", "change"],
|
trigger: ["blur", "change"],
|
||||||
},
|
},
|
||||||
// "userInfo.sex": {
|
|
||||||
// type: "string",
|
|
||||||
// max: 1,
|
|
||||||
// required: true,
|
|
||||||
// message: "请选择男或女",
|
|
||||||
// trigger: ["blur", "change"],
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// const checkboxChange = (n: any) => {
|
|
||||||
// console.log("change", n);
|
|
||||||
// };
|
|
||||||
const handleFocus = (attr: string) => {
|
const handleFocus = (attr: string) => {
|
||||||
currentFocus.value = attr;
|
currentFocus.value = attr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
ProfileApi.loginByAccount({
|
if (model1.userInfo.phone) {
|
||||||
userName: "cs123",
|
if (!valid.mobile.pattern.test(model1.userInfo.phone)) {
|
||||||
password: "123",
|
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (model1.userInfo.newPassword || model1.userInfo.passwordConfirm) {
|
||||||
|
if (
|
||||||
|
!validateRegex(
|
||||||
|
valid.valid_password1.pattern,
|
||||||
|
model1.userInfo.newPassword
|
||||||
|
) ||
|
||||||
|
!validateRegex(
|
||||||
|
valid.valid_password1.pattern,
|
||||||
|
model1.userInfo.passwordConfirm
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: valid.valid_password.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model1.userInfo.newPassword !== model1.userInfo.passwordConfirm) {
|
||||||
|
uni.showToast({ icon: "none", title: "新密码必须和确认密码相同" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(loginForm.value as any).validate().then((res: any) => {
|
||||||
|
if (res) {
|
||||||
|
// 忘记密码登录
|
||||||
|
ProfileApi.forgetPwd({ ...model1.userInfo, type: "forget" }).then(
|
||||||
|
(res: any) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({ title: "密码更新成功" });
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
(loginForm.value as any).validate();
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
'border-color':
|
'border-color':
|
||||||
currentFocus === 'userName' ? '#00dcee !important' : '',
|
currentFocus === 'userName' ? '#00dcee !important' : '',
|
||||||
}"
|
}"
|
||||||
|
type="number"
|
||||||
@focus="handleFocus('userName')"
|
@focus="handleFocus('userName')"
|
||||||
@blur="handleFocus('')"
|
@blur="handleFocus('')"
|
||||||
|
@change="(e:any) => {handleInput(e, 'userName')}"
|
||||||
>
|
>
|
||||||
</u-input>
|
</u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
@ -28,14 +30,16 @@
|
||||||
v-model="model1.userInfo.password"
|
v-model="model1.userInfo.password"
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
:shape="'circle'"
|
:shape="'circle'"
|
||||||
:clearable="true"
|
type="text"
|
||||||
:type="isShowPwd ? 'text' : 'password'"
|
:password="!isShowPwd"
|
||||||
:customStyle="{
|
:customStyle="{
|
||||||
'border-color':
|
'border-color':
|
||||||
currentFocus === 'password' ? '#00dcee !important' : '',
|
currentFocus === 'password' ? '#00dcee !important' : '',
|
||||||
}"
|
}"
|
||||||
@focus="handleFocus('password')"
|
@focus="handleFocus('password')"
|
||||||
@blur="handleFocus('')"
|
@blur="handleFocus('')"
|
||||||
|
:clearable="true"
|
||||||
|
@change="(e:any) => {handleInput(e, 'password')}"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<image
|
<image
|
||||||
|
@ -91,8 +95,14 @@
|
||||||
></u-checkbox>
|
></u-checkbox>
|
||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
<view>
|
<view>
|
||||||
我已阅读并同意用户 <text class="agree-item">《 服务协议 》</text> 和
|
我已阅读并同意用户
|
||||||
<text class="agree-item">《 隐私政策 》</text>
|
<text class="agree-item" @click="openDoc('爱梵达用户服务协议')"
|
||||||
|
>《 服务协议 》</text
|
||||||
|
>
|
||||||
|
和
|
||||||
|
<text class="agree-item" @click="openDoc('隐私政策')"
|
||||||
|
>《 隐私政策 》</text
|
||||||
|
>
|
||||||
<view> 未开通服务站点无法登录 </view>
|
<view> 未开通服务站点无法登录 </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -104,6 +114,8 @@
|
||||||
import { ProfileApi } from "@/services/index";
|
import { ProfileApi } from "@/services/index";
|
||||||
import LoginLayout from "./components/loginLayout.vue";
|
import LoginLayout from "./components/loginLayout.vue";
|
||||||
import { useMemberStore } from "@/store/index";
|
import { useMemberStore } from "@/store/index";
|
||||||
|
import valid from "@/utils/validate";
|
||||||
|
import { validateRegex } from "@/utils";
|
||||||
const store = useMemberStore();
|
const store = useMemberStore();
|
||||||
const loginForm = ref(null);
|
const loginForm = ref(null);
|
||||||
const model1 = reactive({
|
const model1 = reactive({
|
||||||
|
@ -137,13 +149,46 @@ const rules = ref({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// const checkboxChange = (n: any) => {
|
const handleInput = (e: any, key: string) => {
|
||||||
// console.log("change", n);
|
if (key === "userName") {
|
||||||
// };
|
const temp = e?.replace(valid.valid_number, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key === "password") {
|
||||||
|
const temp = e?.replace(valid.valid_no_cn, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleFocus = (attr: string) => {
|
const handleFocus = (attr: string) => {
|
||||||
currentFocus.value = attr;
|
currentFocus.value = attr;
|
||||||
};
|
};
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
|
if (model1.userInfo.userName) {
|
||||||
|
if (!valid.mobile.pattern.test(model1.userInfo.userName)) {
|
||||||
|
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model1.userInfo.password) {
|
||||||
|
if (!validateRegex(
|
||||||
|
valid.valid_password1.pattern,
|
||||||
|
model1.userInfo.password
|
||||||
|
)) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: valid.valid_password.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(loginForm.value as any).validate().then((res: any) => {
|
(loginForm.value as any).validate().then((res: any) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
if (checkGroup.agreeCheck.length === 0) {
|
if (checkGroup.agreeCheck.length === 0) {
|
||||||
|
@ -169,6 +214,45 @@ const handleForgetPwd = () => {
|
||||||
url: "/pagesLogin/login/forgetPwd", // 要跳转到的页面路径
|
url: "/pagesLogin/login/forgetPwd", // 要跳转到的页面路径
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openDoc = (item: string) => {
|
||||||
|
//文件预览
|
||||||
|
|
||||||
|
uni.downloadFile({
|
||||||
|
url: `https://backend-common.obs.cn-east-3.myhuaweicloud.com/static/pages/login/${item}.docx`,
|
||||||
|
success: function (res) {
|
||||||
|
setTimeout(
|
||||||
|
() =>
|
||||||
|
uni.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
showMenu: false,
|
||||||
|
success: function () {
|
||||||
|
console.log("打开文档成功");
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
uni.showToast({
|
||||||
|
title: "暂不支持此类型",
|
||||||
|
duration: 2000,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
100
|
||||||
|
);
|
||||||
|
},
|
||||||
|
fail: function (res) {
|
||||||
|
console.log(res); //失败
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// uni.openDocument({
|
||||||
|
// filePath: `https://backend-common.obs.cn-east-3.myhuaweicloud.com/static/pages/login/${item}.docx`,
|
||||||
|
// showMenu: true,
|
||||||
|
// success: function (res) {
|
||||||
|
// uni.showToast({ title: "打开成功" });
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -38,12 +38,36 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<TabBar></TabBar>
|
<TabBar></TabBar>
|
||||||
|
<SmallModal
|
||||||
|
:title="'确认退出吗?'"
|
||||||
|
:content="'退出后将返回至登陆页'"
|
||||||
|
:okText="'确认退出'"
|
||||||
|
:isMain="true"
|
||||||
|
:show="isShowCancelModal"
|
||||||
|
@handleModal="(v:boolean) => {handleModal(v)}"
|
||||||
|
@handleOk="handleOk()"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ProfileApi } from "@/services/index";
|
import { ProfileApi } from "@/services/index";
|
||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
import { useMemberStore } from "@/store/index";
|
import { useMemberStore } from "@/store/index";
|
||||||
import TabBar from '@/components/TabBar/index.vue'
|
import TabBar from '@/components/TabBar/index.vue'
|
||||||
|
import SmallModal from "@/components/Modal/smallModal.vue";
|
||||||
|
const isShowCancelModal = ref(false);
|
||||||
|
|
||||||
|
const handleModal = (v: boolean) => {
|
||||||
|
isShowCancelModal.value = v;
|
||||||
|
};
|
||||||
|
const handleOk = () => {
|
||||||
|
ProfileApi.logOut().then((res: any) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pagesLogin/login/index", // 要跳转到的页面路径
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
const store = useMemberStore();
|
const store = useMemberStore();
|
||||||
const profile = store.profile.userInfo;
|
const profile = store.profile.userInfo;
|
||||||
const list = reactive([
|
const list = reactive([
|
||||||
|
@ -66,16 +90,7 @@ const list = reactive([
|
||||||
|
|
||||||
const hanldeClick = (item: any) => {
|
const hanldeClick = (item: any) => {
|
||||||
if (item.name === "退出登录") {
|
if (item.name === "退出登录") {
|
||||||
uni.navigateTo({
|
handleModal(true)
|
||||||
url: "/pagesLogin/login/index", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
ProfileApi.logOut().then((res: any) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pagesLogin/login/index", // 要跳转到的页面路径
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
:customStyle="{}"
|
:customStyle="{}"
|
||||||
:border="index === 2 ? 'none' : 'bottom'"
|
:border="index === 2 ? 'none' : 'bottom'"
|
||||||
:value="(model1.userInfo as any)[item.key]"
|
:value="(model1.userInfo as any)[item.key]"
|
||||||
:type="item.isShowPwd ? 'text' : 'password'"
|
:password="!item.isShowPwd"
|
||||||
|
@change="(e:any) => {handleInput(e, item.key)}"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<image
|
<image
|
||||||
|
@ -58,8 +59,16 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ProfileApi } from "@/services";
|
import { ProfileApi } from "@/services";
|
||||||
|
import { validateRegex } from "@/utils";
|
||||||
import valid from "@/utils/validate";
|
import valid from "@/utils/validate";
|
||||||
|
|
||||||
|
const handleInput = (e: any, key: string) => {
|
||||||
|
const temp = e?.replace(valid.valid_no_cn, "");
|
||||||
|
setTimeout(() => {
|
||||||
|
(model1.userInfo as any)[key] = temp;
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
// 表单属性清单
|
// 表单属性清单
|
||||||
const formAttrList = ref([
|
const formAttrList = ref([
|
||||||
{
|
{
|
||||||
|
@ -127,27 +136,50 @@ const check = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const startSave = () => {
|
const startSave = () => {
|
||||||
console.log( model1.userInfo)
|
console.log(model1.userInfo);
|
||||||
ProfileApi.updateUserPwd({...model1.userInfo}).then(res => {
|
ProfileApi.updateUserPwd({ ...model1.userInfo }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.showToast({ icon: "none", title: '密码修改成功'});
|
uni.showToast({ icon: "none", title: "密码修改成功" });
|
||||||
|
model1.userInfo = {};
|
||||||
|
setTimeout(() => {
|
||||||
|
ProfileApi.logOut().then((res: any) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: "/pagesLogin/login/index", // 要跳转到的页面路径
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
// if (!valid.password.pattern.test(model1.userInfo.password) || !valid.password.pattern.test(model1.userInfo.newPassword) || !valid.password.pattern.test(model1.userInfo.passwordConfirm)) {
|
if (model1.userInfo.newPassword || model1.userInfo.passwordConfirm) {
|
||||||
// uni.showToast({ icon: "none", title: valid.password.message });
|
if (
|
||||||
// return;
|
!validateRegex(
|
||||||
// }
|
valid.valid_password1.pattern,
|
||||||
|
model1.userInfo.newPassword
|
||||||
|
) ||
|
||||||
|
!validateRegex(
|
||||||
|
valid.valid_password1.pattern,
|
||||||
|
model1.userInfo.passwordConfirm
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: "none",
|
||||||
|
title: valid.valid_password.message,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (model1.userInfo.password === model1.userInfo.newPassword) {
|
if (model1.userInfo.password === model1.userInfo.newPassword) {
|
||||||
uni.showToast({ icon: "none", title: '新密码不能和旧密码相同'});
|
uni.showToast({ icon: "none", title: "新密码不能和旧密码相同" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (model1.userInfo.newPassword !== model1.userInfo.passwordConfirm) {
|
if (model1.userInfo.newPassword !== model1.userInfo.passwordConfirm) {
|
||||||
uni.showToast({ icon: "none", title: '新密码必须和确认密码相同' });
|
uni.showToast({ icon: "none", title: "新密码必须和确认密码相同" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
check().then((res) => {
|
check().then((res) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { http } from '@/utils/http'
|
import { http } from '@/utils/http'
|
||||||
|
|
||||||
// 收货分类新增
|
// 收货分类新增
|
||||||
export const getStockCardList = (data: any) => {
|
export const addReCategory = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/recategory/addReCategory',
|
url: '/api/recategory/addReCategory',
|
||||||
|
|
|
@ -40,13 +40,12 @@ export const sendMsg = (data: { phone: string }) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 修改密码
|
// 修改密码
|
||||||
export const updateUserPwd = (data: any) => {
|
export const updateUserPwd = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/user/updateUserPwd",
|
url: "/api/user/updateUserPwd",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ export const getRoleList = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/role/getRoleList",
|
url: "/api/role/getRoleList",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,7 +112,7 @@ export const getMenusRole = (data: any) => {
|
||||||
return http<[]>({
|
return http<[]>({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/role/getMenusRole",
|
url: "/api/role/getMenusRole",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -122,7 +121,7 @@ export const getMenuByPage = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/menus/getPage",
|
url: "/api/menus/getPage",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -131,7 +130,7 @@ export const addMenus = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/menus/addMenus",
|
url: "/api/menus/addMenus",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,7 +139,7 @@ export const getMenuList = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/menus/getList",
|
url: "/api/menus/getList",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -149,7 +148,7 @@ export const updateMenus = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/menus/updateMenus",
|
url: "/api/menus/updateMenus",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,7 +157,7 @@ export const getProvinceList = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/user/getChinaList",
|
url: "/api/user/getChinaList",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -167,7 +166,7 @@ export const addUser = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/user/addUser",
|
url: "/api/user/addUser",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,7 +175,7 @@ export const getUserListByPage = (data: any) => {
|
||||||
return http<User>({
|
return http<User>({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/user/getUserPage",
|
url: "/api/user/getUserPage",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,7 +192,7 @@ export const addUserRole = (data: any) => {
|
||||||
return http({
|
return http({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/user/addUserRole",
|
url: "/api/user/addUserRole",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
|
@ -212,7 +211,7 @@ export const getInventoryUserPage = (data: any) => {
|
||||||
return http<User>({
|
return http<User>({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: "/api/user/getInventoryUserPage",
|
url: "/api/user/getInventoryUserPage",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -221,7 +220,7 @@ export const updateUserByIdOffline = (data: any) => {
|
||||||
return http<User>({
|
return http<User>({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/user/updateUserByIdOffline",
|
url: "/api/user/updateUserByIdOffline",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 用户编辑
|
// 用户编辑
|
||||||
|
@ -229,8 +228,25 @@ export const updateUserById = (data: any) => {
|
||||||
return http<User>({
|
return http<User>({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/api/user/updateUserById",
|
url: "/api/user/updateUserById",
|
||||||
data
|
data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 发送验证码(通用)
|
||||||
|
|
||||||
|
export const sendCommonMsg = (data: any) => {
|
||||||
|
return http<User>({
|
||||||
|
method: "GET",
|
||||||
|
url: "/api/user/sendCommonMsg",
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 忘记密码
|
||||||
|
|
||||||
|
export const forgetPwd = (data: any) => {
|
||||||
|
return http<User>({
|
||||||
|
method: "POST",
|
||||||
|
url: "/api/user/forgetPwd",
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -102,7 +102,7 @@ export const http = <T>(options: UniApp.RequestOptions) => {
|
||||||
title: (res1 as Data<T>).message || "请求失败",
|
title: (res1 as Data<T>).message || "请求失败",
|
||||||
});
|
});
|
||||||
store.clearProfile();
|
store.clearProfile();
|
||||||
uni.navigateTo({
|
uni.reLaunch({
|
||||||
url: "/pagesLogin/login/index",
|
url: "/pagesLogin/login/index",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -205,9 +205,9 @@ export function formatMoney(
|
||||||
return (
|
return (
|
||||||
"" +
|
"" +
|
||||||
parseFloat(
|
parseFloat(
|
||||||
(Math as any)[roundtag](parseFloat((n * k).toFixed(prec * 2))).toFixed(
|
(Math as any)
|
||||||
prec * 2
|
[roundtag](parseFloat((n * k).toFixed(prec * 2)))
|
||||||
)
|
.toFixed(prec * 2)
|
||||||
) /
|
) /
|
||||||
k
|
k
|
||||||
);
|
);
|
||||||
|
@ -229,3 +229,8 @@ export function formatMoney(
|
||||||
export function countDots(str: any) {
|
export function countDots(str: any) {
|
||||||
return (str.match(/\./g) || []).length;
|
return (str.match(/\./g) || []).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function validateRegex(regexValue: string, value: string) {
|
||||||
|
const regex = new RegExp(regexValue);
|
||||||
|
return regex.test(value);
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,8 @@ const valid = {
|
||||||
carNo: {
|
carNo: {
|
||||||
// /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/
|
// /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/
|
||||||
// /^[\x{4e00}-\x{9fa5}]{1}[A-Z]{1}[A-Z0-9]{5}$/u
|
// /^[\x{4e00}-\x{9fa5}]{1}[A-Z]{1}[A-Z0-9]{5}$/u
|
||||||
pattern: /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼ABCDEFGHJK]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[ABCDEFGHJK]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-9应]{4,5}[A-Z0-9挂学警港澳领使急]{1})$/,
|
pattern:
|
||||||
|
/^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[a-zA-Z](([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼ABCDEFGHJK]((?![IO])[a-zA-Z0-9](?![IO]))[0-9]{4})|([0-9]{5}[ABCDEFGHJK]))|[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-9应]{4,5}[A-Z0-9挂学警港澳领使急]{1})$/,
|
||||||
message: "请输入正确的车牌号",
|
message: "请输入正确的车牌号",
|
||||||
},
|
},
|
||||||
valid_decimal: {
|
valid_decimal: {
|
||||||
|
@ -26,8 +27,35 @@ const valid = {
|
||||||
message: "请输入正确的数字",
|
message: "请输入正确的数字",
|
||||||
},
|
},
|
||||||
valid_id_card: {
|
valid_id_card: {
|
||||||
pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
|
pattern:
|
||||||
message: '请输入正确的身份证号码'
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
|
||||||
}
|
message: "请输入正确的身份证号码",
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 长度至少为8个字符。
|
||||||
|
|
||||||
|
包含至少一个小写字母。
|
||||||
|
|
||||||
|
包含至少一个大写字母。
|
||||||
|
|
||||||
|
包含至少一个数字。
|
||||||
|
|
||||||
|
可以包含特殊字符,但不能是唯一的特殊字符。
|
||||||
|
*/
|
||||||
|
valid_passwordTemp: {
|
||||||
|
pattern:
|
||||||
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,}$/,
|
||||||
|
message: "密码由字母、数字组成,且至少8位",
|
||||||
|
},
|
||||||
|
valid_password: {
|
||||||
|
pattern:
|
||||||
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d]{8,}$/,
|
||||||
|
message: "密码由字母、数字组成,且至少8位",
|
||||||
|
},
|
||||||
|
valid_password1: {
|
||||||
|
pattern:
|
||||||
|
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d]{8,}$",
|
||||||
|
message: "密码必须由字母、数字组成,区分大小写, 且至少8位",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export default valid;
|
export default valid;
|
||||||
|
|
Loading…
Reference in New Issue