| | |
| | | <script> |
| | | import { apiLoginPassword } from '@/api/publicInterface.js'; |
| | | import { mapMutations } from 'vuex'; |
| | | import { setName, setToken, setRefreshToken, setUsernameKey, setCustomerId, redirectHome } from '@/utils/status.js'; |
| | | import { setName, setToken, setRefreshToken, setUsernameKey, setCustomerId, redirectHome,setUserId } from '@/utils/status.js'; |
| | | export default { |
| | | name: 'userPassword', |
| | | props: { |
| | |
| | | uni.setStorageSync("userId", res.data.userId) |
| | | uni.setStorageSync("userInfo", res.data) |
| | | setCustomerId(res.data.customerid); |
| | | setUserId(res.data.userId); |
| | | setName(res.name); |
| | | uni.hideLoading(); |
| | | if(res.data.forcePassword == 1) { //forcePassword为1强制修改密码 |
| | |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | uni.hideLoading(); |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 1000); |
| | | this.$u.toast('登录异常!'); |
| | | console.log(err); |
| | | }); |
| | | } else { |
| | | this.submitLoading = false |
| | | uni.hideLoading(); |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 1000); |
| | | this.$u.toast(res.msg); |
| | | } |
| | | } else { |
| | |
| | | if (res.code) { |
| | | uni.setStorageSync('bindcode', res.code); |
| | | } |
| | | } |
| | | }); |
| | | if (uni.getStorageSync('bindcode')) { |
| | | if (uni.getStorageSync('bindcode')) { |
| | | this.$reqPost('wxBind', { state: 'MINI', code: uni.getStorageSync('bindcode') }, |
| | | 'params').then(res => { |
| | | this.submitLoading = false; |
| | | uni.hideLoading(); |
| | | if (res.code == 0) { |
| | | this.submitLoading = false; |
| | | uni.hideLoading(); |
| | | this.$u.toast('绑定成功!即将回到登录页!'); |
| | | setTimeout(() => { |
| | | uni.navigateBack(); |
| | | }, 1000); |
| | | } else { |
| | | uni.hideLoading(); |
| | | this.$u.toast(res.msg ? res.msg : '绑定失败'); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.submitLoading = false |
| | | this.$u.toast(e); |
| | | uni.hideLoading(); |
| | | }); |
| | | } |
| | | } |