You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
830 B
43 lines
830 B
// 用户登录client
|
|
export const clients = { mp: 0, h5: 1, android: 2, ios: 3 };
|
|
|
|
// 用户登录类型
|
|
export const types = {
|
|
mp: 0,
|
|
phone: 1,
|
|
email: 2,
|
|
username: 3,
|
|
wx: 4,
|
|
wx_web: 5,
|
|
wb: 6,
|
|
};
|
|
|
|
// 小程序获取参数
|
|
export const mp = () => {
|
|
return new Promise((resolve, reject) => {
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success(res) {
|
|
if (res.code) {
|
|
const params = {
|
|
client: uni.$t.user.clients['mp'],
|
|
type: uni.$t.user.types['mp'],
|
|
data: { identifier: res.code, credential: 'tall' },
|
|
};
|
|
resolve(params);
|
|
} else {
|
|
reject(res.errMsg);
|
|
}
|
|
},
|
|
fail() {
|
|
console.log('fail');
|
|
reject('微信登录失败');
|
|
},
|
|
});
|
|
});
|
|
};
|
|
|
|
export default {
|
|
clients,
|
|
types,
|
|
};
|
|
|