oak-general-business/app/pages/token/login/index.ts

36 lines
816 B
TypeScript

export default OakPage({
path: 'token:login',
entity: 'token',
projection: {
id: 1,
wechatUser: {
id: 1,
},
userId: 1,
playerId: 1,
},
isList: true,
formData: async ({ features }) => {
const tokenValue = await features.token.getToken();
if (tokenValue) {
return {
loggedIn: true,
};
}
return {
loggedIn: false,
};
},
methods: {
async onLoginClicked(options: WechatMiniprogram.Touch) {
const { code } = await wx.login();
const env = await wx.getSystemInfo();
await this.features.token.loginWechatMp();
},
onReturnClicked() {
this.navigateBack();
},
},
});