12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <view class="change">
- <u-form label-width='150'>
- <u-form-item label="新密码">
- <u-input v-model="password" type="password"/>
- </u-form-item>
- <u-form-item label="确认密码">
- <u-input v-model="sure_password" type="password"/>
- </u-form-item>
- </u-form>
- <view class="submit" @click="submit">
- 确认修改
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- password: '',
- sure_password: ''
- }
- },
- methods: {
- submit() {
- if (!this.password) {
- uni.showToast({
- title: '请输入新密码',
- icon: 'none'
- })
- return
- }
- if (!this.sure_password) {
- uni.showToast({
- title: '请输入确认密码',
- icon: 'none'
- })
- return
- }
- if (this.password != this.sure_password) {
- uni.showToast({
- title: '您两次输入的密码不一致',
- icon: 'none'
- })
- return
- }
- this.$u.post('/page/update-password', {
- password: this.password
- }).then(res => {
- this.$u.vuex('vuex_token', '');
- this.$u.vuex('vuex_user', '');
- console.log(res)
- uni.showToast({
- title: '修改成功,请重新登录',
- icon: 'none'
- })
- setTimeout(function() {
- uni.reLaunch({
- url: '../login/index'
- })
- }, 2000)
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .change {
- padding: 0 20px;
- .submit {
- height: 45px;
- width: 60%;
- line-height: 45px;
- margin: 0 auto;
- margin-top: 100px;
- background-color: #7d5c43;
- text-align: center;
- color: #fff;
- border-radius: 22px;
- font-size: 16px;
- }
- }
- </style>
|