Showing
1 changed file
with
27 additions
and
7 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-12-20 18:02:57 | 4 | + * @LastEditTime: 2023-12-20 18:20:37 |
| 5 | * @FilePath: /meihuaApp/src/pages/myInfo/index.vue | 5 | * @FilePath: /meihuaApp/src/pages/myInfo/index.vue |
| 6 | * @Description: 我的信息页面 | 6 | * @Description: 我的信息页面 |
| 7 | --> | 7 | --> |
| ... | @@ -28,7 +28,7 @@ | ... | @@ -28,7 +28,7 @@ |
| 28 | <nut-col span="4">电话</nut-col> | 28 | <nut-col span="4">电话</nut-col> |
| 29 | <nut-col span="20"> | 29 | <nut-col span="20"> |
| 30 | <view class="wrapper"> | 30 | <view class="wrapper"> |
| 31 | - <nut-input v-model="tel" placeholder="请输入电话" :border="false" type="number" /> | 31 | + <nut-input v-model="tel" placeholder="请输入电话" :border="false" type="number" max-length="11" /> |
| 32 | </view> | 32 | </view> |
| 33 | </nut-col> | 33 | </nut-col> |
| 34 | </nut-row> | 34 | </nut-row> |
| ... | @@ -68,13 +68,33 @@ const uploadImg = () => { | ... | @@ -68,13 +68,33 @@ const uploadImg = () => { |
| 68 | }) | 68 | }) |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | +const isValidTel = (tel) => { | ||
| 72 | + return /^1\d{10}$/.test(tel); | ||
| 73 | +} | ||
| 74 | + | ||
| 71 | const save = () => { | 75 | const save = () => { |
| 72 | console.warn(username.value, tel.value); | 76 | console.warn(username.value, tel.value); |
| 73 | - Taro.showToast({ | 77 | + if (!isValidTel(tel.value) ||!username.value) { |
| 74 | - title: '保存成功', | 78 | + Taro.showToast({ |
| 75 | - icon:'success', | 79 | + title: '请检查输入项', |
| 76 | - duration: 2000 | 80 | + icon: 'error', |
| 77 | - }); | 81 | + duration: 2000 |
| 82 | + }); | ||
| 83 | + return; | ||
| 84 | + } else { | ||
| 85 | + Taro.showToast({ | ||
| 86 | + title: '保存成功', | ||
| 87 | + icon: 'success', | ||
| 88 | + duration: 1000, | ||
| 89 | + success: () => { | ||
| 90 | + setTimeout(() => { | ||
| 91 | + Taro.reLaunch({ | ||
| 92 | + url: '/pages/my/index' | ||
| 93 | + }) | ||
| 94 | + }, 1000); | ||
| 95 | + } | ||
| 96 | + }); | ||
| 97 | + } | ||
| 78 | } | 98 | } |
| 79 | </script> | 99 | </script> |
| 80 | 100 | ... | ... |
-
Please register or login to post a comment