2
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
"updateSentGroupApplition",
|
||||
]),
|
||||
setGlobalIMlistener() {
|
||||
this.$store.dispatch("system/getConfig");
|
||||
console.log("setGlobalIMlistener");
|
||||
// init
|
||||
const kickHander = (message) => {
|
||||
|
||||
+11
-9
@@ -1,18 +1,20 @@
|
||||
// 登录
|
||||
export const businessConfig = (params) =>
|
||||
uni.$u?.http.post("/common/init", JSON.stringify(params));
|
||||
export const businessLogin = (params) =>
|
||||
uni.$u?.http.post("/account/login", JSON.stringify(params));
|
||||
uni.$u?.http.post("/common/login", JSON.stringify(params));
|
||||
export const businessSendSms = (params) =>
|
||||
uni.$u?.http.post("/account/code/send", JSON.stringify(params));
|
||||
uni.$u?.http.post("/common/captcha", JSON.stringify(params));
|
||||
export const businessVerifyCode = (params) =>
|
||||
uni.$u?.http.post("/account/code/verify", JSON.stringify(params));
|
||||
uni.$u?.http.post("/common/verify_captcha", JSON.stringify(params));
|
||||
export const businessRegister = (params) =>
|
||||
uni.$u?.http.post("/account/register", JSON.stringify(params));
|
||||
uni.$u?.http.post("/common/register", JSON.stringify(params));
|
||||
export const businessReset = (params) =>
|
||||
uni.$u?.http.post("/account/password/reset", JSON.stringify(params));
|
||||
uni.$u?.http.post("/common/resetpwd", JSON.stringify(params));
|
||||
|
||||
export const businessModify = (params) =>
|
||||
uni.$u?.http.post(
|
||||
"/account/password/change",
|
||||
"/user/change_password",
|
||||
JSON.stringify({
|
||||
...params,
|
||||
}), {
|
||||
@@ -25,7 +27,7 @@ export const businessModify = (params) =>
|
||||
// 用户信息
|
||||
export const businessInfoUpdate = (params) =>
|
||||
uni.$u?.http.post(
|
||||
"/user/update",
|
||||
"/user/profile",
|
||||
JSON.stringify({
|
||||
...params,
|
||||
}), {
|
||||
@@ -36,7 +38,7 @@ export const businessInfoUpdate = (params) =>
|
||||
);
|
||||
export const businessGetUserInfo = (userID) =>
|
||||
uni.$u?.http.post(
|
||||
"/user/find/full",
|
||||
"/user/find",
|
||||
JSON.stringify({
|
||||
userIDs: [userID],
|
||||
}), {
|
||||
@@ -48,7 +50,7 @@ export const businessGetUserInfo = (userID) =>
|
||||
|
||||
export const businessSearchUserInfo = (keyword) =>
|
||||
uni.$u?.http.post(
|
||||
"/user/search/full",
|
||||
"/user/search",
|
||||
JSON.stringify({
|
||||
keyword,
|
||||
pagination: {
|
||||
|
||||
+5
-5
@@ -3,15 +3,15 @@
|
||||
// const API_URL = `http://${BASE_HOST}:10002`
|
||||
// const WS_URL = `ws://${BASE_HOST}:10001`
|
||||
|
||||
const BASE_DOMAIN = '156.238.245.175'
|
||||
const BASE_DOMAIN = 'www.axzc.xyz'
|
||||
// const CHAT_URL = `https://${BASE_DOMAIN}/chat`
|
||||
// const API_URL = `https://${BASE_DOMAIN}/api`
|
||||
// const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway`
|
||||
const CHAT_URL = `http://${BASE_DOMAIN}:10008`
|
||||
const API_URL = `http://${BASE_DOMAIN}:10002`
|
||||
const WS_URL = `ws://${BASE_DOMAIN}:10001`
|
||||
const CHAT_URL = `http://${BASE_DOMAIN}:8585/api`
|
||||
const API_URL = `http://${BASE_DOMAIN}/imapi`
|
||||
const WS_URL = `ws://${BASE_DOMAIN}/ws`
|
||||
|
||||
const version = 'Uniapp-Demo'
|
||||
const version = '2.0.6'
|
||||
|
||||
const getRegisterUrl = () => uni.getStorageSync("IMRegisteUrl") || CHAT_URL;
|
||||
const getApiUrl = () => uni.getStorageSync("IMApiUrl") || API_URL;
|
||||
|
||||
Generated
+4959
File diff suppressed because it is too large
Load Diff
+56
-81
@@ -3,72 +3,35 @@
|
||||
<view class="login">
|
||||
<view class="logo">
|
||||
<img src="static/images/logo.png" alt="" />
|
||||
<view class="title">欢迎使用OpenCorp</view>
|
||||
<view class="title">欢迎使用{{config.name}}</view>
|
||||
</view>
|
||||
<u-tabs :list="list" @click="click"></u-tabs>
|
||||
<u-form
|
||||
class="loginForm"
|
||||
labelPosition="top"
|
||||
:model="loginInfo"
|
||||
:labelStyle="{
|
||||
<u-tabs :list="list" :current="active" @click="click"></u-tabs>
|
||||
<u-form class="loginForm" labelPosition="top" :model="loginInfo" :labelStyle="{
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
width: 'max-content',
|
||||
}"
|
||||
ref="loginForm"
|
||||
>
|
||||
}" ref="loginForm">
|
||||
<u-form-item v-if="active === 0" label="" prop="phoneNumber">
|
||||
<u-input
|
||||
v-model="loginInfo.phoneNumber"
|
||||
border="surround"
|
||||
placeholder="请输入手机号码"
|
||||
clearable
|
||||
>
|
||||
<view
|
||||
slot="prefix"
|
||||
class="phoneNumber_areacode"
|
||||
@click="showPicker"
|
||||
>
|
||||
<u-input v-model="loginInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
|
||||
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
|
||||
<text class="areacode_content">+{{ loginInfo.areaCode }}</text>
|
||||
<u-icon class="arrow_down" name="arrow-down"></u-icon>
|
||||
</view>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<u-form-item v-if="active === 1" label="" prop="email">
|
||||
<u-input
|
||||
v-model="loginInfo.email"
|
||||
border="surround"
|
||||
placeholder="请输入您的邮箱"
|
||||
clearable
|
||||
>
|
||||
<u-input v-model="loginInfo.email" border="surround" placeholder="请输入您的邮箱" clearable>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<u-form-item v-if="active > 1 || isPwdLogin" label="" prop="password">
|
||||
<u-input
|
||||
v-model="loginInfo.password"
|
||||
border="surround"
|
||||
placeholder="请输入密码"
|
||||
:password="!eying"
|
||||
clearable
|
||||
>
|
||||
<u-icon
|
||||
@click="updateEye"
|
||||
slot="suffix"
|
||||
:name="eying ? 'eye-off' : 'eye'"
|
||||
>
|
||||
<u-input v-model="loginInfo.password" border="surround" placeholder="请输入密码" :password="!eying"
|
||||
clearable>
|
||||
<u-icon @click="updateEye" slot="suffix" :name="eying ? 'eye-off' : 'eye'">
|
||||
</u-icon>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<u-form-item
|
||||
v-if="active <= 1 && !isPwdLogin"
|
||||
label=""
|
||||
prop="verificationCode"
|
||||
>
|
||||
<u-input
|
||||
v-model="loginInfo.verificationCode"
|
||||
border="surround"
|
||||
placeholder="请输入验证码"
|
||||
>
|
||||
<u-form-item v-if="active <= 1 && !isPwdLogin" label="" prop="verificationCode">
|
||||
<u-input v-model="loginInfo.verificationCode" border="surround" placeholder="请输入验证码">
|
||||
<view class="code_btn" slot="suffix" @click="getCode">
|
||||
{{ count !== 0 ? `${count} s` : "获取验证码" }}
|
||||
</view>
|
||||
@@ -80,12 +43,7 @@
|
||||
<text class="forget" @click="toggleLoginMethod">{{ isPwdLogin ? "验证码登录" : "密码登录" }}</text>
|
||||
</view>
|
||||
<view class="login-btn">
|
||||
<u-button
|
||||
:loading="loading"
|
||||
type="primary"
|
||||
@click="startLogin"
|
||||
:disabled="!canLogin"
|
||||
>
|
||||
<u-button :loading="loading" type="primary" @click="startLogin" :disabled="!canLogin">
|
||||
登录
|
||||
</u-button>
|
||||
</view>
|
||||
@@ -101,18 +59,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import md5 from "md5";
|
||||
import { version } from '@/common/config'
|
||||
import { businessLogin, businessSendSms } from "@/api/login";
|
||||
import AreaPicker from "@/components/AreaPicker";
|
||||
import { checkLoginError } from "@/util/common";
|
||||
import { SmsUserFor } from "@/constant";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import { mapGetters } from "vuex";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import md5 from "md5";
|
||||
import { version } from '@/common/config'
|
||||
import { businessLogin, businessSendSms } from "@/api/login";
|
||||
import AreaPicker from "@/components/AreaPicker";
|
||||
import { checkLoginError } from "@/util/common";
|
||||
import { SmsUserFor } from "@/constant";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
|
||||
let timer;
|
||||
let timer;
|
||||
|
||||
export default {
|
||||
export default {
|
||||
components: {
|
||||
AreaPicker,
|
||||
},
|
||||
@@ -134,12 +93,15 @@ export default {
|
||||
loading: false,
|
||||
count: 0,
|
||||
isPwdLogin: true,
|
||||
active: 0,
|
||||
active: 1,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"config",
|
||||
]),
|
||||
v() {
|
||||
return version
|
||||
return this.config.name+' '+version
|
||||
},
|
||||
canLogin() {
|
||||
return (
|
||||
@@ -156,14 +118,16 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
click({ index }) {
|
||||
click({
|
||||
index
|
||||
}) {
|
||||
this.active = index;
|
||||
},
|
||||
copy() {
|
||||
uni.setClipboardData({
|
||||
showToast: false,
|
||||
data: version,
|
||||
success: function () {
|
||||
success: function() {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "复制成功",
|
||||
@@ -175,6 +139,11 @@ export default {
|
||||
this.loginInfo.areaCode = uni.getStorageSync("last_areaCode") || "86";
|
||||
this.loginInfo.email = uni.getStorageSync("last_email") || "";
|
||||
this.loginInfo.phoneNumber = uni.getStorageSync("last_phoneNumber") || "";
|
||||
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
this.loginInfo.email = "commiu@outlook.com";
|
||||
this.loginInfo.password = "qwe123";
|
||||
}
|
||||
},
|
||||
updateEye() {
|
||||
this.eying = !this.eying;
|
||||
@@ -191,14 +160,18 @@ export default {
|
||||
let data = {};
|
||||
try {
|
||||
data = await businessLogin({
|
||||
phoneNumber: this.loginInfo.phoneNumber,
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
areaCode: `+${this.loginInfo.areaCode}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
verifyCode: this.loginInfo.verificationCode,
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const { imToken, userID } = data;
|
||||
const {
|
||||
imToken,
|
||||
userID
|
||||
} = data;
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
userID,
|
||||
token: imToken,
|
||||
@@ -227,7 +200,11 @@ export default {
|
||||
// });
|
||||
},
|
||||
saveLoginProfile(data) {
|
||||
const { imToken, chatToken, userID } = data;
|
||||
const {
|
||||
imToken,
|
||||
token,
|
||||
userID
|
||||
} = data;
|
||||
uni.setStorage({
|
||||
key: "IMUserID",
|
||||
data: userID,
|
||||
@@ -238,7 +215,7 @@ export default {
|
||||
});
|
||||
uni.setStorage({
|
||||
key: "BusinessToken",
|
||||
data: chatToken,
|
||||
data: token,
|
||||
});
|
||||
},
|
||||
saveLoginInfo() {
|
||||
@@ -302,20 +279,18 @@ export default {
|
||||
}, 1000);
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page_container {
|
||||
.page_container {
|
||||
justify-content: space-between;
|
||||
|
||||
.login {
|
||||
color: #0c1c33;
|
||||
padding: 10vh 80rpx 0;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
background: linear-gradient(180deg,
|
||||
rgba(0, 137, 255, 0.1) 0%,
|
||||
rgba(255, 255, 255, 0) 100%
|
||||
);
|
||||
rgba(255, 255, 255, 0) 100%);
|
||||
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
@@ -435,5 +410,5 @@ export default {
|
||||
transform: scale(0.5, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -10,7 +10,11 @@
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}" ref="registerForm">
|
||||
<u-form-item prop="phoneNumber" label="手机号码">
|
||||
<u-form-item prop="email" label="邮箱" v-if="userInfo.type == 'email'">
|
||||
<u-input v-model="userInfo.email" border="surround" placeholder="请输入邮箱" clearable>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<u-form-item prop="phoneNumber" label="手机号码" v-if="userInfo.type == 'mobile'">
|
||||
<u-input v-model="userInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
|
||||
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
|
||||
<text class="areacode_content">+{{ userInfo.areaCode }}</text>
|
||||
@@ -50,6 +54,7 @@
|
||||
email: "",
|
||||
areaCode: "86",
|
||||
invitationCode: "",
|
||||
type:'email',
|
||||
},
|
||||
checked: [true],
|
||||
rules: {
|
||||
@@ -60,6 +65,12 @@
|
||||
trigger: ["blur", "change"],
|
||||
pattern: /^\d{11}$/,
|
||||
}, ],
|
||||
email: [{
|
||||
type: "email",
|
||||
required: true,
|
||||
message: "请输入邮箱",
|
||||
trigger: ["blur", "change"]
|
||||
}, ],
|
||||
},
|
||||
isRegister: true,
|
||||
pageStatus: "normal",
|
||||
@@ -67,15 +78,20 @@
|
||||
},
|
||||
onLoad(param) {
|
||||
this.isRegister = JSON.parse(param.isRegister);
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
this.userInfo.email = "commiu@outlook.com";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
sendSms() {
|
||||
this.$refs.registerForm.validate().then((valid) => {
|
||||
const options = {
|
||||
phoneNumber: this.userInfo.phoneNumber,
|
||||
mobile: this.userInfo.mobile,
|
||||
email: this.userInfo.email,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
usedFor: this.isRegister ? SmsUserFor.Register : SmsUserFor.Reset,
|
||||
event: this.isRegister ? 'register' : "reset_pwd",
|
||||
invitationCode: this.userInfo.invitationCode,
|
||||
type:this.userInfo.type
|
||||
};
|
||||
businessSendSms(options)
|
||||
.then(() => {
|
||||
|
||||
@@ -1,45 +1,23 @@
|
||||
<template>
|
||||
<view class="set_password_container content_with_back">
|
||||
<view class="title">重置密码</view>
|
||||
<u-form
|
||||
class="loginForm commonPage-form"
|
||||
labelPosition="top"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
:labelStyle="{
|
||||
<u-form class="loginForm commonPage-form" labelPosition="top" :model="formData" :rules="rules" :labelStyle="{
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}"
|
||||
ref="loginForm"
|
||||
>
|
||||
}" ref="loginForm">
|
||||
<u-form-item label="密码" prop="password">
|
||||
<u-input
|
||||
v-model="formData.password"
|
||||
border="surround"
|
||||
placeholder="请输入密码"
|
||||
:password="!passwordEying"
|
||||
>
|
||||
<u-icon
|
||||
@click="updateEye('passwordEying')"
|
||||
slot="suffix"
|
||||
:name="passwordEying ? 'eye-off' : 'eye'"
|
||||
></u-icon>
|
||||
<u-input v-model="formData.password" border="surround" placeholder="请输入密码" :password="!passwordEying">
|
||||
<u-icon @click="updateEye('passwordEying')" slot="suffix"
|
||||
:name="passwordEying ? 'eye-off' : 'eye'"></u-icon>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<view class="feild_desc">6~20位,至少包含数字、字母</view>
|
||||
<u-form-item label="确认密码" prop="confirmPassword">
|
||||
<u-input
|
||||
v-model="formData.confirmPassword"
|
||||
border="surround"
|
||||
placeholder="请输入密码"
|
||||
:password="!comfirmEying"
|
||||
>
|
||||
<u-icon
|
||||
@click="updateEye('comfirmEying')"
|
||||
slot="suffix"
|
||||
:name="comfirmEying ? 'eye-off' : 'eye'"
|
||||
></u-icon>
|
||||
<u-input v-model="formData.confirmPassword" border="surround" placeholder="请输入密码"
|
||||
:password="!comfirmEying">
|
||||
<u-icon @click="updateEye('comfirmEying')" slot="suffix"
|
||||
:name="comfirmEying ? 'eye-off' : 'eye'"></u-icon>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
@@ -52,14 +30,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { businessReset } from "@/api/login";
|
||||
export default {
|
||||
import {
|
||||
businessReset
|
||||
} from "@/api/login";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isRegister: false,
|
||||
codeValue: "",
|
||||
userInfo: {
|
||||
phoneNumber: "",
|
||||
email:"",
|
||||
areaCode: "",
|
||||
},
|
||||
formData: {
|
||||
@@ -69,8 +50,7 @@ export default {
|
||||
passwordEying: false,
|
||||
comfirmEying: false,
|
||||
rules: {
|
||||
password: [
|
||||
{
|
||||
password: [{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
@@ -85,8 +65,7 @@ export default {
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
confirmPassword: [
|
||||
{
|
||||
confirmPassword: [{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入确认密码",
|
||||
@@ -105,7 +84,11 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
const { userInfo, isRegister, codeValue } = options;
|
||||
const {
|
||||
userInfo,
|
||||
isRegister,
|
||||
codeValue
|
||||
} = options;
|
||||
this.userInfo = JSON.parse(userInfo);
|
||||
this.isRegister = JSON.parse(isRegister);
|
||||
this.codeValue = codeValue;
|
||||
@@ -118,9 +101,10 @@ export default {
|
||||
this.$refs.loginForm.validate().then((valid) => {
|
||||
if (valid) {
|
||||
const options = {
|
||||
phoneNumber: this.userInfo.phoneNumber,
|
||||
mobile: this.userInfo.phoneNumber,
|
||||
email: this.userInfo.em,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
VerifyCode: this.codeValue,
|
||||
code: this.codeValue,
|
||||
password: this.formData.password,
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
operationID: Date.now() + "",
|
||||
@@ -141,16 +125,14 @@ export default {
|
||||
this[key] = !this[key];
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.set_password_container {
|
||||
.set_password_container {
|
||||
margin-top: var(--status-bar-height);
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
background: linear-gradient(180deg,
|
||||
rgba(0, 137, 255, 0.1) 0%,
|
||||
rgba(255, 255, 255, 0) 100%
|
||||
);
|
||||
rgba(255, 255, 255, 0) 100%);
|
||||
padding-top: 150rpx;
|
||||
|
||||
.title {
|
||||
@@ -170,5 +152,5 @@ export default {
|
||||
.action_btn {
|
||||
margin-top: 12vh;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -54,6 +54,7 @@
|
||||
codeValue: "",
|
||||
userInfo: {
|
||||
phoneNumber: "",
|
||||
email: "",
|
||||
areaCode: "",
|
||||
nickname: "",
|
||||
password: "",
|
||||
@@ -71,7 +72,7 @@
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
trigger: ["blur", "change"],
|
||||
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{7,}$/,
|
||||
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
@@ -86,7 +87,7 @@
|
||||
required: true,
|
||||
message: "请输入确认密码",
|
||||
trigger: ["blur", "change"],
|
||||
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{7,}$/,
|
||||
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
@@ -109,6 +110,12 @@
|
||||
...JSON.parse(userInfo),
|
||||
};
|
||||
this.codeValue = codeValue;
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
this.userInfo.email = "commiu@outlook.com";
|
||||
this.userInfo.nickname = "commiu";
|
||||
this.userInfo.password = "qwe123";
|
||||
this.userInfo.confirmPassword = "qwe123";
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
return true;
|
||||
@@ -127,14 +134,13 @@
|
||||
async doRegister() {
|
||||
this.loading = true;
|
||||
const options = {
|
||||
verifyCode: this.codeValue,
|
||||
code: this.codeValue,
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
autoLogin: true,
|
||||
user: {
|
||||
...this.userInfo,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
password: md5(this.userInfo.password),
|
||||
},
|
||||
mobile: `+${this.userInfo.phoneNumber}`,
|
||||
};
|
||||
try {
|
||||
await businessRegister(options);
|
||||
@@ -143,7 +149,14 @@
|
||||
uni.$u.route("/pages/login/index")
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
uni.$u.toast(checkLoginError(err));
|
||||
if(err.msg=="验证码过期" || err.msg=="验证码错误"){
|
||||
uni.$u.route("/pages/login/verifyCode/index", {
|
||||
userInfo: JSON.stringify(this.userInfo),
|
||||
isRegister: true,
|
||||
resend: 1,
|
||||
})
|
||||
return ;
|
||||
}
|
||||
// uni.$u.toast('注册失败')
|
||||
} finally {
|
||||
this.loading = false;
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
import user from "../../../store/modules/user";
|
||||
import {
|
||||
businessSendSms,
|
||||
businessVerifyCode
|
||||
} from "@/api/login";
|
||||
@@ -41,6 +42,9 @@
|
||||
userInfo: {
|
||||
phoneNumber: "",
|
||||
areaCode: "",
|
||||
email: "",
|
||||
code: "",
|
||||
type: "email",
|
||||
},
|
||||
isRegister: false,
|
||||
};
|
||||
@@ -48,11 +52,18 @@
|
||||
onLoad(options) {
|
||||
const {
|
||||
userInfo,
|
||||
isRegister
|
||||
isRegister,
|
||||
resend
|
||||
} = options;
|
||||
console.log(userInfo,isRegister)
|
||||
this.userInfo = JSON.parse(userInfo);
|
||||
this.isRegister = JSON.parse(isRegister);
|
||||
if(resend == 1){
|
||||
this.count = 0;
|
||||
this.getSmsAgain();
|
||||
}else{
|
||||
this.startCount();
|
||||
}
|
||||
},
|
||||
onReady() {},
|
||||
methods: {
|
||||
@@ -63,10 +74,12 @@
|
||||
},
|
||||
checkCode(value) {
|
||||
const options = {
|
||||
phoneNumber: this.userInfo.phoneNumber,
|
||||
mobile: this.userInfo.phoneNumber,
|
||||
email: this.userInfo.email,
|
||||
type: this.userInfo.type,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
usedFor: this.isRegister ? SmsUserFor.Register : SmsUserFor.Reset,
|
||||
verifyCode: value,
|
||||
event: this.isRegister ? 'register' : 'reset_pwd',
|
||||
code: value,
|
||||
};
|
||||
businessVerifyCode(options)
|
||||
.then(() => {
|
||||
@@ -102,9 +115,11 @@
|
||||
getSmsAgain() {
|
||||
if (this.count === 0) {
|
||||
const options = {
|
||||
phoneNumber: this.userInfo.phoneNumber,
|
||||
mobile: this.userInfo.phoneNumber,
|
||||
email: this.userInfo.email,
|
||||
type: this.userInfo.type,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
usedFor: this.isRegister ? SmsUserFor.Register : SmsUserFor.Reset,
|
||||
event: this.isRegister ? 'register' : 'reset_pwd',
|
||||
};
|
||||
businessSendSms(options)
|
||||
.then(() => {
|
||||
|
||||
@@ -19,4 +19,5 @@ export default {
|
||||
storeReinstall: (state) => state.user.reinstall,
|
||||
storeProgress: (state) => state.user.progress,
|
||||
storeAuthData: (state) => state.user.authData,
|
||||
config: (state) => state.system.config,
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import user from "./modules/user";
|
||||
import contact from "./modules/contact";
|
||||
import conversation from "./modules/conversation";
|
||||
import message from "./modules/message";
|
||||
import system from "./modules/system";
|
||||
import getters from "./getters";
|
||||
|
||||
Vue.use(Vuex);
|
||||
@@ -14,6 +15,7 @@ const store = new Vuex.Store({
|
||||
contact,
|
||||
conversation,
|
||||
message,
|
||||
system,
|
||||
},
|
||||
getters,
|
||||
});
|
||||
|
||||
+131
-47
@@ -1,4 +1,6 @@
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import {
|
||||
v4 as uuidv4
|
||||
} from "uuid";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
|
||||
const state = {
|
||||
@@ -38,14 +40,18 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getFriendList({ commit }) {
|
||||
async getFriendList({
|
||||
commit
|
||||
}) {
|
||||
let offset = 0;
|
||||
let friendInfoList = [];
|
||||
let initialFetch = true;
|
||||
while (true) {
|
||||
try {
|
||||
const count = initialFetch ? 10000 : 1000;
|
||||
const { data } = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {
|
||||
offset,
|
||||
count,
|
||||
});
|
||||
@@ -62,15 +68,18 @@ const actions = {
|
||||
}
|
||||
commit("SET_FRIEND_LIST", friendInfoList);
|
||||
},
|
||||
async getGrouplist({ commit }) {
|
||||
async getGrouplist({
|
||||
commit
|
||||
}) {
|
||||
let offset = 0;
|
||||
let groupList = [];
|
||||
while (true) {
|
||||
try {
|
||||
const { data } = await IMSDK.asyncApi(
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi(
|
||||
"getJoinedGroupListPage",
|
||||
uuidv4(),
|
||||
{
|
||||
uuidv4(), {
|
||||
offset,
|
||||
count: 1000,
|
||||
}
|
||||
@@ -84,51 +93,80 @@ const actions = {
|
||||
}
|
||||
commit("SET_GROUP_LIST", groupList);
|
||||
},
|
||||
getBlacklist({ commit }) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetBlackList, uuidv4()).then(({ data }) => {
|
||||
getBlacklist({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetBlackList, uuidv4()).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_BLACK_LIST", data);
|
||||
});
|
||||
},
|
||||
getRecvFriendApplications({ commit }) {
|
||||
getRecvFriendApplications({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetFriendApplicationListAsRecipient,
|
||||
uuidv4(),
|
||||
).then(({ data }) => {
|
||||
).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getSentFriendApplications({ commit }) {
|
||||
getSentFriendApplications({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetFriendApplicationListAsApplicant,
|
||||
uuidv4(),
|
||||
).then(({ data }) => {
|
||||
).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getRecvGroupApplications({ commit }) {
|
||||
getRecvGroupApplications({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetGroupApplicationListAsRecipient,
|
||||
uuidv4(),
|
||||
).then(({ data }) => {
|
||||
).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
getSentGroupApplications({ commit }) {
|
||||
getSentGroupApplications({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetGroupApplicationListAsApplicant,
|
||||
uuidv4(),
|
||||
).then(({ data }) => {
|
||||
).then(({
|
||||
data
|
||||
}) => {
|
||||
commit("SET_SENT_GROUP_APPLICATIONS", data);
|
||||
});
|
||||
},
|
||||
pushNewFriend({ commit, state }, friendInfo) {
|
||||
pushNewFriend({
|
||||
commit,
|
||||
state
|
||||
}, friendInfo) {
|
||||
const tmpList = [...state.friendList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
|
||||
if (idx === -1) {
|
||||
commit("SET_FRIEND_LIST", [...tmpList, friendInfo]);
|
||||
}
|
||||
},
|
||||
updateFriendInfo({ commit, state }, { friendInfo, isRemove = false }) {
|
||||
updateFriendInfo({
|
||||
commit,
|
||||
state
|
||||
}, {
|
||||
friendInfo,
|
||||
isRemove = false
|
||||
}) {
|
||||
const tmpList = [...state.friendList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
|
||||
|
||||
@@ -143,14 +181,23 @@ const actions = {
|
||||
commit("SET_FRIEND_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewBlack({ commit, state }, blackInfo) {
|
||||
pushNewBlack({
|
||||
commit,
|
||||
state
|
||||
}, blackInfo) {
|
||||
const tmpList = [...state.blackList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
|
||||
if (idx === -1) {
|
||||
commit("SET_BLACK_LIST", [...tmpList, blackInfo]);
|
||||
}
|
||||
},
|
||||
updateBlackInfo({ commit, state }, { blackInfo, isRemove = false }) {
|
||||
updateBlackInfo({
|
||||
commit,
|
||||
state
|
||||
}, {
|
||||
blackInfo,
|
||||
isRemove = false
|
||||
}) {
|
||||
const tmpList = [...state.blackList];
|
||||
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
|
||||
|
||||
@@ -165,22 +212,31 @@ const actions = {
|
||||
commit("SET_BLACK_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewGroup({ commit, state }, groupInfo) {
|
||||
pushNewGroup({
|
||||
commit,
|
||||
state
|
||||
}, groupInfo) {
|
||||
const tmpList = [...state.groupList];
|
||||
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
|
||||
if (idx === -1) {
|
||||
commit("SET_GROUP_LIST", [...tmpList, groupInfo]);
|
||||
}
|
||||
},
|
||||
updateGroupInfo(
|
||||
{ commit, state, rootState },
|
||||
{ groupInfo, isRemove = false },
|
||||
) {
|
||||
updateGroupInfo({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
groupInfo,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
const tmpList = [...state.groupList];
|
||||
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
|
||||
|
||||
if (rootState.conversation.currentGroup.groupID === groupInfo.groupID) {
|
||||
commit("conversation/SET_CURRENT_GROUP", groupInfo, { root: true });
|
||||
commit("conversation/SET_CURRENT_GROUP", groupInfo, {
|
||||
root: true
|
||||
});
|
||||
}
|
||||
|
||||
if (idx !== -1) {
|
||||
@@ -194,7 +250,10 @@ const actions = {
|
||||
commit("SET_GROUP_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewRecvFriendApplition({ commit, state }, application) {
|
||||
pushNewRecvFriendApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
const tmpList = [...state.recvFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.fromUserID === application.fromUserID,
|
||||
@@ -204,10 +263,14 @@ const actions = {
|
||||
}
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateRecvFriendApplition(
|
||||
{ commit, state, rootState },
|
||||
{ application, isRemove = false },
|
||||
) {
|
||||
updateRecvFriendApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
const tmpList = [...state.recvFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.fromUserID === application.fromUserID,
|
||||
@@ -224,7 +287,10 @@ const actions = {
|
||||
commit("SET_RECV_FRIEND_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewSentFriendApplition({ commit, state }, application) {
|
||||
pushNewSentFriendApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
const tmpList = [...state.sentFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.toUserID === application.toUserID,
|
||||
@@ -234,10 +300,14 @@ const actions = {
|
||||
}
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateSentFriendApplition(
|
||||
{ commit, state, rootState },
|
||||
{ application, isRemove = false },
|
||||
) {
|
||||
updateSentFriendApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
const tmpList = [...state.sentFriendApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.toUserID === application.toUserID,
|
||||
@@ -254,7 +324,10 @@ const actions = {
|
||||
commit("SET_SENT_FRIEND_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewRecvGroupApplition({ commit, state }, application) {
|
||||
pushNewRecvGroupApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
const tmpList = [...state.recvGroupApplications];
|
||||
const idx = tmpList.findIndex((item) => item.userID === application.userID);
|
||||
if (idx !== -1) {
|
||||
@@ -262,10 +335,14 @@ const actions = {
|
||||
}
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateRecvGroupApplition(
|
||||
{ commit, state, rootState },
|
||||
{ application, isRemove = false },
|
||||
) {
|
||||
updateRecvGroupApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
const tmpList = [...state.recvGroupApplications];
|
||||
const idx = tmpList.findIndex((item) => item.userID === application.userID);
|
||||
|
||||
@@ -280,7 +357,10 @@ const actions = {
|
||||
commit("SET_RECV_GROUP_APPLICATIONS", tmpList);
|
||||
}
|
||||
},
|
||||
pushNewSentGroupApplition({ commit, state }, application) {
|
||||
pushNewSentGroupApplition({
|
||||
commit,
|
||||
state
|
||||
}, application) {
|
||||
const tmpList = [...state.sentGroupApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.groupID === application.groupID,
|
||||
@@ -290,10 +370,14 @@ const actions = {
|
||||
}
|
||||
commit("SET_SENT_GROUP_APPLICATIONS", [...tmpList, application]);
|
||||
},
|
||||
updateSentGroupApplition(
|
||||
{ commit, state, rootState },
|
||||
{ application, isRemove = false },
|
||||
) {
|
||||
updateSentGroupApplition({
|
||||
commit,
|
||||
state,
|
||||
rootState
|
||||
}, {
|
||||
application,
|
||||
isRemove = false
|
||||
}, ) {
|
||||
const tmpList = [...state.sentGroupApplications];
|
||||
const idx = tmpList.findIndex(
|
||||
(item) => item.groupID === application.groupID,
|
||||
|
||||
@@ -46,7 +46,10 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getConversationList({ state, commit }, isFirstPage = true) {
|
||||
async getConversationList({
|
||||
state,
|
||||
commit
|
||||
}, isFirstPage = true) {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
@@ -68,7 +71,9 @@ const actions = {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
getCurrentGroup({ commit }, groupID) {
|
||||
getCurrentGroup({
|
||||
commit
|
||||
}, groupID) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [
|
||||
groupID,
|
||||
]).then(({
|
||||
@@ -77,7 +82,10 @@ const actions = {
|
||||
commit("SET_CURRENT_GROUP", data[0] ?? {});
|
||||
});
|
||||
},
|
||||
getCurrentMemberInGroup({ commit, rootState }, groupID) {
|
||||
getCurrentMemberInGroup({
|
||||
commit,
|
||||
rootState
|
||||
}, groupID) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), {
|
||||
groupID,
|
||||
userIDList: [rootState.user.selfInfo.userID],
|
||||
@@ -87,7 +95,9 @@ const actions = {
|
||||
commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {});
|
||||
});
|
||||
},
|
||||
getUnReadCount({ commit }) {
|
||||
getUnReadCount({
|
||||
commit
|
||||
}) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then(
|
||||
(res) => {
|
||||
console.log(res);
|
||||
@@ -95,7 +105,10 @@ const actions = {
|
||||
},
|
||||
);
|
||||
},
|
||||
updateCurrentMemberInGroup({ commit, state }, memberInfo) {
|
||||
updateCurrentMemberInGroup({
|
||||
commit,
|
||||
state
|
||||
}, memberInfo) {
|
||||
console.log(memberInfo);
|
||||
if (
|
||||
memberInfo.groupID === state.currentMemberInGroup.groupID &&
|
||||
@@ -104,7 +117,9 @@ const actions = {
|
||||
commit("SET_CURRENT_MEMBER_IN_GROUP", memberInfo);
|
||||
}
|
||||
},
|
||||
resetConversationState({ commit }) {
|
||||
resetConversationState({
|
||||
commit
|
||||
}) {
|
||||
commit("SET_CURRENT_MEMBER_IN_GROUP", {});
|
||||
commit("SET_CURRENT_GROUP", {});
|
||||
commit("SET_CURRENT_CONVERSATION", {});
|
||||
|
||||
+29
-12
@@ -1,6 +1,13 @@
|
||||
import IMSDK, { MessageStatus, MessageType } from "openim-uniapp-polyfill";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { UpdateMessageTypes } from "@/constant";
|
||||
import IMSDK, {
|
||||
MessageStatus,
|
||||
MessageType
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {
|
||||
v4 as uuidv4
|
||||
} from "uuid";
|
||||
import {
|
||||
UpdateMessageTypes
|
||||
} from "@/constant";
|
||||
|
||||
const state = {
|
||||
historyMessageList: [],
|
||||
@@ -17,12 +24,17 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getHistoryMesageList({ commit, state }, params) {
|
||||
async getHistoryMesageList({
|
||||
commit,
|
||||
state
|
||||
}, params) {
|
||||
let emptyFlag = true;
|
||||
try {
|
||||
console.log("getHistoryMesageList:::");
|
||||
console.log(params);
|
||||
const { data } = await IMSDK.asyncApi(
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetAdvancedHistoryMessageList,
|
||||
uuidv4(),
|
||||
params,
|
||||
@@ -43,18 +55,21 @@ const actions = {
|
||||
emptyFlag,
|
||||
};
|
||||
},
|
||||
pushNewMessage({ commit, state }, message) {
|
||||
pushNewMessage({
|
||||
commit,
|
||||
state
|
||||
}, message) {
|
||||
commit("SET_HISTORY_MESSAGE_LIST", [...state.historyMessageList, message]);
|
||||
},
|
||||
updateOneMessage(
|
||||
{ commit, state },
|
||||
{
|
||||
updateOneMessage({
|
||||
commit,
|
||||
state
|
||||
}, {
|
||||
message,
|
||||
type = UpdateMessageTypes.Overall,
|
||||
keyWords = [],
|
||||
isSuccess = false,
|
||||
},
|
||||
) {
|
||||
}, ) {
|
||||
const tmpList = state.historyMessageList;
|
||||
const idx = tmpList.findIndex(
|
||||
(msg) => msg.clientMsgID === message.clientMsgID,
|
||||
@@ -73,7 +88,9 @@ const actions = {
|
||||
commit("SET_HISTORY_MESSAGE_LIST", tmpList);
|
||||
}
|
||||
},
|
||||
resetMessageState({ commit }) {
|
||||
resetMessageState({
|
||||
commit
|
||||
}) {
|
||||
commit("SET_HISTORY_MESSAGE_LIST", []);
|
||||
commit("SET_HAS_MORE_MESSAGE", true);
|
||||
},
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import {
|
||||
businessConfig
|
||||
} from "@/api/login";
|
||||
import {
|
||||
filterEmptyValue
|
||||
} from "@/util/common";
|
||||
|
||||
const state = {
|
||||
config: {}
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
SET_CONFIG(state, info) {
|
||||
state.config = {
|
||||
...info,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getConfig({
|
||||
commit
|
||||
}) {
|
||||
try {
|
||||
const data = await businessConfig();
|
||||
//filterEmptyValue(businessData);
|
||||
commit("SET_CONFIG", data);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
uni.$u.toast("获取系统信息失败");
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions,
|
||||
};
|
||||
+19
-5
@@ -1,7 +1,13 @@
|
||||
import { v4 as uuidv4} from "uuid";
|
||||
import {
|
||||
v4 as uuidv4
|
||||
} from "uuid";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import { businessGetUserInfo} from "@/api/login";
|
||||
import { filterEmptyValue} from "@/util/common";
|
||||
import {
|
||||
businessGetUserInfo
|
||||
} from "@/api/login";
|
||||
import {
|
||||
filterEmptyValue
|
||||
} from "@/util/common";
|
||||
|
||||
const state = {
|
||||
selfInfo: {},
|
||||
@@ -9,9 +15,13 @@ const state = {
|
||||
isSyncing: false,
|
||||
reinstall: false,
|
||||
progress: 0,
|
||||
token: ""
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
SET_TOKEN(state, info) {
|
||||
state.token = info;
|
||||
},
|
||||
SET_SELF_INFO(state, info) {
|
||||
state.selfInfo = {
|
||||
...info,
|
||||
@@ -34,7 +44,9 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getSelfInfo({ commit }) {
|
||||
async getSelfInfo({
|
||||
commit
|
||||
}) {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
@@ -42,7 +54,9 @@ const actions = {
|
||||
IMSDK.IMMethods.GetSelfUserInfo,
|
||||
uuidv4(),
|
||||
);
|
||||
const {users} = await businessGetUserInfo(data.userID);
|
||||
const {
|
||||
users
|
||||
} = await businessGetUserInfo(data.userID);
|
||||
console.log(users);
|
||||
const businessData = users[0] ?? {};
|
||||
filterEmptyValue(businessData);
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
// 此版本发布于2022-00-24
|
||||
const version = '2.0.34'
|
||||
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`\n %c uView V${version} %c https://uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;');
|
||||
}
|
||||
|
||||
export default {
|
||||
v: version,
|
||||
version,
|
||||
|
||||
+4
-2
@@ -37,8 +37,7 @@ export const getDbDir = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => {
|
||||
fs.root.getDirectory(
|
||||
"user",
|
||||
{
|
||||
"user", {
|
||||
create: true,
|
||||
},
|
||||
(entry) => {
|
||||
@@ -177,6 +176,9 @@ export const toastWithCallback = (message, callBack, duration = 1000) => {
|
||||
};
|
||||
|
||||
export const checkLoginError = (error) => {
|
||||
if (error?.msg) {
|
||||
return error.msg
|
||||
}
|
||||
if (!error?.errCode) {
|
||||
return "操作失败";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import appConfig from "@/common/config";
|
||||
import { v4 as uuidV4 } from "uuid";
|
||||
import {
|
||||
v4 as uuidV4
|
||||
} from "uuid";
|
||||
/**
|
||||
* 请求拦截
|
||||
* @param {Object} http
|
||||
@@ -13,11 +15,9 @@ module.exports = (vm) => {
|
||||
if (config.custom.isIMApi) {
|
||||
config.baseURL = appConfig.getApiUrl();
|
||||
}
|
||||
if (config.custom.isPgyerApi) {
|
||||
config.baseURL = "https://www.pgyer.com";
|
||||
}
|
||||
config.header = {
|
||||
...config.header,
|
||||
token:uni.getStorageSync("BusinessToken"),
|
||||
operationID: uuidV4(),
|
||||
};
|
||||
// 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中
|
||||
|
||||
@@ -3,13 +3,23 @@
|
||||
* @param {Object} http
|
||||
*/
|
||||
module.exports = (vm) => {
|
||||
uni.$u.http.interceptors.response.use(
|
||||
(response) => {
|
||||
uni.$u.http.interceptors.response.use((response) => {
|
||||
console.log("\n-"
|
||||
+"\n============================================================="
|
||||
+"\nurl:"+response.config.fullPath
|
||||
+"\nparams:"+JSON.stringify(response.config.params)
|
||||
+"\ndata:"+JSON.stringify(response.config.data)
|
||||
+"\nheader:"+JSON.stringify(response.config.header)
|
||||
+"\nresponse:"+JSON.stringify(response.data)
|
||||
+"\n=============================================================\n");
|
||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||
const data = response.data;
|
||||
// 自定义参数
|
||||
const custom = response.config?.custom;
|
||||
if (data.errCode !== 0 && data.code !== 0) {
|
||||
if(data?.msg){
|
||||
uni.$u.toast(data.msg)
|
||||
}
|
||||
// 服务端返回的状态码不等于200,则reject()
|
||||
// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
|
||||
// if (custom.toast !== false) {
|
||||
|
||||
Reference in New Issue
Block a user