拓恒河湖长制全民护河平台WEB端
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.

25 lines
801B

  1. import {getOpenId, getUserData} from '../api/login.js'
  2. export function getOpenidData() {
  3. return new Promise((resolve)=> {
  4. wx.login({
  5. success: result=> {
  6. let code = result.code
  7. getOpenId(code).then(i=> {
  8. if(i.code === 0) {
  9. const {openId,unionId} = i.data
  10. wx.setStorage({
  11. key: 'openid',
  12. data: openId
  13. })
  14. wx.setStorage({
  15. key: 'unionid',
  16. data: unionId
  17. })
  18. resolve({openid: openId,unionid: unionId})
  19. }
  20. })
  21. }
  22. })
  23. })
  24. }