1234567891011121314151617181920212223242526272829303132 |
- // app.js
- import {
- xcxdl
- } from "./apis/index"
- import authorize from "./utils/authorize"
- App({
- onLaunch() {
- // 登录
- let publicId = wx.getStorageSync("PUBLIC_ID")
- if (!publicId || !publicId.openid || !publicId.unionid) {
- wx.login({
- success: res => {
- xcxdl({
- js_code: res.code
- }).then((res) => {
- if (res.code == 200) {
- wx.setStorageSync('PUBLIC_ID', {
- openid: res.openid,
- unionid: res.unionid
- })
- }
- })
- }
- })
- }
- // 用户鉴权
- this.globalData = {
- authorize: authorize
- }
- },
- })
|