19
This commit is contained in:
@@ -68,6 +68,8 @@ import { checkLoginError } from "@/util/common";
|
||||
import { SmsUserFor } from "@/constant";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import util from "@/util/index.js"
|
||||
import config from "@/common/config";
|
||||
import {getDbDir,toastWithCallback} from "@/util/common.js";
|
||||
|
||||
let timer;
|
||||
|
||||
@@ -145,59 +147,48 @@ export default {
|
||||
this.loginInfo.email = "commiu@outlook.com";
|
||||
this.loginInfo.password = "qwe123";
|
||||
}
|
||||
plus.navigator.closeSplashscreen();
|
||||
},
|
||||
updateEye() {
|
||||
this.eying = !this.eying;
|
||||
},
|
||||
toRegisterOrForget(isRegister) {
|
||||
uni.$u.route("/pages/common/login/index", {
|
||||
uni.$u.route("/pages/common/registerOrForget/index", {
|
||||
isRegister,
|
||||
});
|
||||
},
|
||||
async startLogin() {
|
||||
// this.$refs.loginForm.validate().then(async (valid) => {
|
||||
this.loading = true;
|
||||
this.saveLoginInfo();
|
||||
let data = {};
|
||||
try {
|
||||
data = await businessLogin({
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os(),
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const { imToken, userID } = data;
|
||||
// #ifdef APP
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
userID,
|
||||
token: imToken,
|
||||
});
|
||||
// #endif
|
||||
this.saveLoginProfile(data);
|
||||
this.$store.commit("user/SET_AUTH_DATA", data);
|
||||
this.$store.dispatch("user/getSelfInfo");
|
||||
this.$store.dispatch("conversation/getConversationList");
|
||||
this.$store.dispatch("conversation/getUnReadCount");
|
||||
// this.$store.dispatch("contact/getFriendList");
|
||||
// this.$store.dispatch("contact/getGrouplist");
|
||||
this.$store.dispatch("contact/getBlacklist");
|
||||
this.$store.dispatch("contact/getRecvFriendApplications");
|
||||
this.$store.dispatch("contact/getSentFriendApplications");
|
||||
this.$store.dispatch("contact/getRecvGroupApplications");
|
||||
this.$store.dispatch("contact/getSentGroupApplications");
|
||||
uni.switchTab({
|
||||
url: "/pages/conversation/conversationList/index",
|
||||
});
|
||||
this.loginInfo.password = "";
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.$u.toast(checkLoginError(err));
|
||||
}
|
||||
this.loading = false;
|
||||
// });
|
||||
this.$refs.loginForm.validate().then(async (valid) => {
|
||||
this.loading = true;
|
||||
this.saveLoginInfo();
|
||||
let data = {};
|
||||
try {
|
||||
data = await businessLogin({
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os(),
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const { imToken, userID } = data;
|
||||
this.saveLoginProfile(data);
|
||||
this.$store.commit("user/SET_AUTH_DATA", data);
|
||||
this.loginInfo.password = "";
|
||||
// #ifdef APP
|
||||
// await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
// userID,
|
||||
// token: imToken,
|
||||
// });
|
||||
plus.runtime.restart();
|
||||
// #endif
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.$u.toast(checkLoginError(err));
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
saveLoginProfile(data) {
|
||||
const { imToken, token, userID } = data;
|
||||
|
||||
Reference in New Issue
Block a user