|
@@ -10,7 +10,8 @@
|
|
|
<el-input v-model="user.nickName" maxlength="30" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="手机号码" prop="phonenumber">
|
|
|
- <el-input v-model="user.phonenumber" maxlength="11" />
|
|
|
+ <!-- <el-input v-model="user.phonenumber" @input="phoneNumChange" maxlength="11" /> -->
|
|
|
+ <el-input v-model="showPhone" @input="phoneNumChange" maxlength="11" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="邮箱" prop="email">
|
|
|
<el-input v-model="user.email" maxlength="50" />
|
|
@@ -24,7 +25,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { updateUserProfile } from "@/api/system/user";
|
|
|
+import {
|
|
|
+ ref,
|
|
|
+ computed,
|
|
|
+ reactive,
|
|
|
+ defineComponent,
|
|
|
+ watch,
|
|
|
+ toRaw,
|
|
|
+ onMounted,
|
|
|
+ onBeforeMount,
|
|
|
+ defineExpose,
|
|
|
+ onDeactivated,
|
|
|
+} from "vue";
|
|
|
+import { updateUserProfile,getUserProfile } from "@/api/system/user";
|
|
|
|
|
|
const props = defineProps({
|
|
|
user: {
|
|
@@ -39,7 +52,14 @@ const rules = ref({
|
|
|
email: [{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
|
|
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
|
|
});
|
|
|
-
|
|
|
+const showPhone = ref()
|
|
|
+function getUser() {
|
|
|
+ getUserProfile().then(response => {
|
|
|
+ showPhone.value = response.data.phonenumber;
|
|
|
+ showPhone.value = phoneNumber(showPhone.value)
|
|
|
+ });
|
|
|
+};
|
|
|
+const emit = defineEmits(["chengeUser"]);
|
|
|
/** 提交按钮 */
|
|
|
function submit() {
|
|
|
proxy.$refs.userRef.validate(valid => {
|
|
@@ -54,6 +74,41 @@ function submit() {
|
|
|
function close() {
|
|
|
proxy.$tab.closePage();
|
|
|
};
|
|
|
+const phoneNumChange = (num)=>{
|
|
|
+
|
|
|
+ const str1 = num.substr(0,3)
|
|
|
+ const str2 = num.substr(3,4)
|
|
|
+ const str3 = num.substr(7,4)
|
|
|
+ if(num.length<4){
|
|
|
+ showPhone.value = str1
|
|
|
+ }else if(num.length == 4){
|
|
|
+ showPhone.value = str1+'*'
|
|
|
+ }else if(num.length == 5){
|
|
|
+ showPhone.value = str1+'**'
|
|
|
+ }else if(num.length == 6){
|
|
|
+ showPhone.value = str1+'***'
|
|
|
+ }else if(num.length == 7){
|
|
|
+ showPhone.value = str1+'****'
|
|
|
+ }else{
|
|
|
+ showPhone.value = str1+'****'+str3
|
|
|
+ }
|
|
|
+ emit('chengeUser',num)
|
|
|
+ // console.log('num',num);
|
|
|
+}
|
|
|
+const phoneNumber = (num)=>{
|
|
|
+ if(num){
|
|
|
+ // console.log('num',num);
|
|
|
+ const str1 = num.substr(0,3)
|
|
|
+ const str2 = num.substr(3,4)
|
|
|
+ const str3 = num.substr(7,4)
|
|
|
+ // console.log(str1,str2,str3);
|
|
|
+ return str1+'****'+str3
|
|
|
+ }
|
|
|
+}
|
|
|
+getUser();
|
|
|
+onMounted(()=>{
|
|
|
+ console.log('showPhone',showPhone);
|
|
|
+})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
:deep(.el-form-item--default .el-form-item__label){
|