hookehuyr

fix

<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-20 18:02:57
* @LastEditTime: 2023-12-20 18:20:37
* @FilePath: /meihuaApp/src/pages/myInfo/index.vue
* @Description: 我的信息页面
-->
......@@ -28,7 +28,7 @@
<nut-col span="4">电话</nut-col>
<nut-col span="20">
<view class="wrapper">
<nut-input v-model="tel" placeholder="请输入电话" :border="false" type="number" />
<nut-input v-model="tel" placeholder="请输入电话" :border="false" type="number" max-length="11" />
</view>
</nut-col>
</nut-row>
......@@ -68,13 +68,33 @@ const uploadImg = () => {
})
}
const isValidTel = (tel) => {
return /^1\d{10}$/.test(tel);
}
const save = () => {
console.warn(username.value, tel.value);
Taro.showToast({
title: '保存成功',
icon:'success',
duration: 2000
});
if (!isValidTel(tel.value) ||!username.value) {
Taro.showToast({
title: '请检查输入项',
icon: 'error',
duration: 2000
});
return;
} else {
Taro.showToast({
title: '保存成功',
icon: 'success',
duration: 1000,
success: () => {
setTimeout(() => {
Taro.reLaunch({
url: '/pages/my/index'
})
}, 1000);
}
});
}
}
</script>
......