feat: 配置clientId
This commit is contained in:
@@ -0,0 +1,28 @@
|
|||||||
|
// 小程序特有相关: 同时更改manifest.json和 project.config.json文件中的appid;
|
||||||
|
// 所有用户端的配置
|
||||||
|
export const CLIENT_CONFIGS = {
|
||||||
|
// 智念用户端
|
||||||
|
zhinian: {
|
||||||
|
clientId: '2',
|
||||||
|
appId: 'wx5e79df5996572539'
|
||||||
|
},
|
||||||
|
// 朵花用户端
|
||||||
|
duohua: {
|
||||||
|
clientId: '2',
|
||||||
|
appId: 'wx23f86d809ae80259'
|
||||||
|
},
|
||||||
|
// 天沐用户端
|
||||||
|
tianmu: {
|
||||||
|
clientId: '4',
|
||||||
|
appId: 'wx0be424e1d22065a9'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取当前用户端配置
|
||||||
|
const getCurrentConfig = () => {
|
||||||
|
return CLIENT_CONFIGS.zhinian;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const clientId = getCurrentConfig().clientId;
|
||||||
|
export const appId = getCurrentConfig().appId;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { loginAuth, bindPhone } from "@/manager/LoginManager";
|
import { loginAuth, bindPhone } from "@/manager/LoginManager";
|
||||||
|
// 引入base.js中的clientId
|
||||||
|
import { clientId } from "@/constant/base";
|
||||||
|
|
||||||
// 跳转登录
|
// 跳转登录
|
||||||
export const goLogin = () => uni.navigateTo({ url: "/pages/login/index" });
|
export const goLogin = () => uni.navigateTo({ url: "/pages/login/index" });
|
||||||
@@ -14,7 +16,7 @@ export const onLogin = async (e) => {
|
|||||||
console.info("onLogin code: ", code);
|
console.info("onLogin code: ", code);
|
||||||
|
|
||||||
// 绑定手机号
|
// 绑定手机号
|
||||||
const params = { wechatPhoneCode: code, clientId: "2" };
|
const params = { wechatPhoneCode: code, clientId: clientId };
|
||||||
const res = await bindPhone(params);
|
const res = await bindPhone(params);
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
} from "../request/api/LoginApi";
|
} from "../request/api/LoginApi";
|
||||||
import { getWeChatAuthCode } from "./AuthManager";
|
import { getWeChatAuthCode } from "./AuthManager";
|
||||||
import { useAppStore } from "@/store";
|
import { useAppStore } from "@/store";
|
||||||
|
import { clientId } from "@/constant/base";
|
||||||
|
|
||||||
const loginAuth = () => {
|
const loginAuth = () => {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
@@ -14,7 +15,7 @@ const loginAuth = () => {
|
|||||||
openIdCode: [openIdCode],
|
openIdCode: [openIdCode],
|
||||||
grant_type: "wechat",
|
grant_type: "wechat",
|
||||||
scope: "server",
|
scope: "server",
|
||||||
clientId: "2",
|
clientId: clientId,
|
||||||
});
|
});
|
||||||
console.log("获取到的微信授权response:", response);
|
console.log("获取到的微信授权response:", response);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user