@@ -54,22 +54,23 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
mapGetters,
|
||||
mapMutations
|
||||
} from 'vuex'
|
||||
export default {
|
||||
name: "ywxAuthModel",
|
||||
computed: {
|
||||
...mapGetters({
|
||||
// 把 `this.doneCount` 映射为 `this.$store.getters.doneTodosCount`
|
||||
sessionKey: 'getSessionKey'
|
||||
sessionKey: 'getSessionKey',
|
||||
openId: 'getOpenId'
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 表单数据
|
||||
formData: {
|
||||
account: 'LiMing',
|
||||
password: 'dcloud@email.com'
|
||||
account: 'xiaoxiao',
|
||||
password: '20mylove'
|
||||
},
|
||||
formDataReg: {
|
||||
nickname: '',
|
||||
@@ -99,9 +100,9 @@
|
||||
}]
|
||||
}
|
||||
},
|
||||
openid: "",
|
||||
|
||||
loginstate: "0",
|
||||
openid: "",
|
||||
|
||||
userEntity: null,
|
||||
terminal: "",
|
||||
osVersion: "",
|
||||
@@ -112,6 +113,7 @@
|
||||
},
|
||||
onLoad: function() {},
|
||||
methods: {
|
||||
...mapMutations(["updateUserInfo", "saveUserInfoToStorge"]),
|
||||
onChooseAvatar(e) {
|
||||
console.log(e)
|
||||
const {
|
||||
@@ -122,16 +124,20 @@
|
||||
},
|
||||
submitLogin(loginform) {
|
||||
let self = this;
|
||||
// #ifdef MP-WEIXIN
|
||||
this.formData.openId = this.openId
|
||||
// #endif
|
||||
this.$refs.loginform.validate().then(res => {
|
||||
console.log('表单数据信息:', res);
|
||||
self.$ajax.post("User/login", self.formData)
|
||||
.then(e => {
|
||||
if(e.code == 0)
|
||||
uni.reLaunch({
|
||||
url: "/pages/tabbar/home/home"
|
||||
})
|
||||
|
||||
});
|
||||
.then(e => {
|
||||
if (e.code == 0) {
|
||||
self.updateUserInfo(e.data.userinfo);
|
||||
uni.reLaunch({
|
||||
url: "/pages/tabbar/home/home"
|
||||
})
|
||||
}
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log('表单错误信息:', err);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user