captain-ui
Version:
有赞vue wap业务组件库
90 lines (82 loc) • 2.04 kB
JavaScript
import "vant/es/toast/style";
import _Toast from "vant/es/toast";
import ajax from '../../../common/ajax';
import PageMixin from '../mixins/page-mixin';
export default {
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
staticClass: "cap-login__form cap-login__reset-password"
}, [_c('van-cell-group', [_c('vm-form-item', {
attrs: {
"title": "新密码"
}
}, [_c('vm-password', {
attrs: {
"placeholder": "请输入新密码"
},
model: {
value: _vm.password,
callback: function callback($$v) {
_vm.password = $$v;
},
expression: "password"
}
})], 1)], 1), _c('vm-actions', [_c('template', {
slot: "button"
}, [_c('van-button', {
attrs: {
"type": "danger",
"block": ""
},
on: {
"click": _vm.handleSubmit
}
}, [_vm._v("\n 完成\n ")])], 1)], 2)], 1);
},
mixins: [PageMixin],
props: {
resetUrl: String,
phone: [String, Number]
},
data: function data() {
return {
password: ''
};
},
methods: {
handleSubmit: function handleSubmit() {
var _this = this;
this.$emit('logger', {
type: 'reset-password'
});
if (!this.password) {
_Toast('请输入新密码');
return;
}
ajax({
url: this.resetUrl,
method: 'POST',
data: {
password: this.password,
phone: this.phone,
code: this.country && this.country.code
}
}).then(function (res) {
if (+res.code === 0) {
_Toast.success({
message: '密码重置成功',
duration: 1000
});
setTimeout(function () {
_this.$emit('typeChange', 'login');
}, 1500);
}
}).catch(function () {
_Toast('网络出了点问题,请稍后重试');
});
}
}
};