|
- import {getOpenId, getUserData} from '../api/login.js'
- export function getOpenidData() {
- return new Promise((resolve)=> {
- wx.login({
- success: result=> {
- let code = result.code
- getOpenId(code).then(i=> {
- if(i.code === 0) {
- const {openId,unionId} = i.data
- wx.setStorage({
- key: 'openid',
- data: openId
- })
- wx.setStorage({
- key: 'unionid',
- data: unionId
- })
- resolve({openid: openId,unionid: unionId})
- }
- })
- }
- })
- })
- }
|