| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="password"> |
| | | <view class="password_tip"> |
| | | <image src="@/static/password_ic_tip@2x.png" alt="" /> |
| | | <text>å¯ç ç±6-20ä¸ªè±æåæ¯ãæ°åæç¬¦å·ç»æ</text> |
| | | </view> |
| | | <view class="password_list"> |
| | | <view class="password_list_item"> |
| | | <text>åå¯ç </text> |
| | | <view class="password_list_item_box"> |
| | | <input type="password" v-model="form.originalPassword" maxlength="20" placeholder="请è¾å
¥åå¯ç "> |
| | | </view> |
| | | </view> |
| | | <view class="password_list_item"> |
| | | <text>æ°å¯ç </text> |
| | | <view class="password_list_item_box"> |
| | | <input type="password" v-model="form.newPassword" maxlength="20" placeholder="请è¾å
¥æ°å¯ç "> |
| | | </view> |
| | | </view> |
| | | <view class="password_list_item"> |
| | | <text>确认å¯ç </text> |
| | | <view class="password_list_item_box"> |
| | | <input type="password" v-model="form.confirmPassword" maxlength="20" placeholder="忬¡è¾å
¥æ°å¯ç "> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="password_footer"> |
| | | <button class="password_footer_submit" @click="submit"> |
| | | <text>宿</text> |
| | | </button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { updatePwd } from '@/util/api/PersonalAPI' |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: { |
| | | originalPassword: '', |
| | | newPassword: '', |
| | | confirmPassword: '' |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | // å¿è®°å¯ç |
| | | forgotPassword() { |
| | | |
| | | }, |
| | | // æäº¤ä¿®æ¹ |
| | | submit() { |
| | | if (!this.form.originalPassword) { |
| | | uni.showToast({ title: 'åå¯ç ä¸è½ä¸ºç©º', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.newPassword) { |
| | | uni.showToast({ title: 'æ°å¯ç ä¸è½ä¸ºç©º', icon: 'none', duration: 2000 }); |
| | | } else if (!/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{6,}$/.test(this.form.newPassword)) { |
| | | uni.showToast({ title: 'å¯ç æ ¼å¼ä¸æ£ç¡®', icon: 'none', duration: 2000 }); |
| | | } else if (!this.form.confirmPassword) { |
| | | uni.showToast({ title: '确认å¯ç ä¸è½ä¸ºç©º', icon: 'none', duration: 2000 }); |
| | | } else if (this.form.newPassword !== this.form.confirmPassword) { |
| | | uni.showToast({ title: '两次è¾å
¥çå¯ç ä¸ä¸è´', icon: 'none', duration: 2000 }); |
| | | } else { |
| | | updatePwd({ |
| | | newPwd: this.form.newPassword, |
| | | oldPwd: this.form.originalPassword |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | uni.showToast({ title: 'ä¿®æ¹æå', icon: 'success', duration: 2000, mask: true }); |
| | | setTimeout(() => { |
| | | uni.navigateBack({ delta: 1 }); |
| | | }, 2000) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .password { |
| | | position: absolute; |
| | | width: 100%; |
| | | height: 100%; |
| | | background: white; |
| | | .password_tip { |
| | | height: 72rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | background: #F7F7F7; |
| | | padding: 0 30rpx; |
| | | image { |
| | | width: 24rpx; |
| | | height: 24rpx; |
| | | margin-right: 10rpx; |
| | | } |
| | | text { |
| | | font-size: 24rpx; |
| | | font-weight: 400; |
| | | color: #666666; |
| | | } |
| | | } |
| | | .password_list { |
| | | padding: 0 30rpx; |
| | | .password_list_item { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 90rpx; |
| | | border-bottom: 1rpx solid #E5E5E5; |
| | | text { |
| | | width: 150rpx; |
| | | flex-shrink: 0; |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #222222; |
| | | } |
| | | .password_list_item_box { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | flex: 1; |
| | | input { |
| | | border: none; |
| | | font-size: 30rpx; |
| | | } |
| | | input::-webkit-input-placeholder { |
| | | font-size: 28rpx; |
| | | font-weight: 400; |
| | | color: #B2B2B2; |
| | | } |
| | | p { |
| | | font-size: 26rpx; |
| | | font-weight: 400; |
| | | color: #4275FC; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .password_footer { |
| | | margin-top: 80rpx; |
| | | padding: 0 30rpx; |
| | | .password_footer_submit { |
| | | width: 100%; |
| | | height: 88rpx; |
| | | border: none; |
| | | background: #4275FC; |
| | | box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.08); |
| | | border-radius: 8rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | text { |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #FFFFFF; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |