diff --git a/.gitignore b/.gitignore index 73b021b..9ee33a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ .DS_Store -*.sublime-workspace - -app.js \ No newline at end of file +*.sublime-workspace \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..e69de29 diff --git a/app.js.sample b/app.js.sample deleted file mode 100644 index 072628a..0000000 --- a/app.js.sample +++ /dev/null @@ -1,41 +0,0 @@ -const jsonApi = require('utils/jsonapi-datastore/dist/jsonapi-datastore.js') -require('utils/polyfill.js') - -App({ - onLaunch: function () { - this.store = new(jsonApi.JsonApiDataStore) - this.jsonModel = jsonApi.JsonApiDataStoreModel - this.globalData.code = wx.getStorageSync('code') - }, - - getUserInfo: function (cb) { - var that = this - if(this.globalData.userInfo){ - typeof cb == "function" && cb(this.globalData.userInfo) - }else{ - wx.login({ - success: function (res) { - if (res.code) { - that.globalData.code = res.code - wx.setStorageSync('code', res.code) - wx.getUserInfo({ - success: function (res) { - that.globalData.userInfo = res.userInfo - typeof cb == "function" && cb(that.globalData.userInfo) - } - }) - } else { - console.log('获取用户登录态失败!' + res.errMsg) - } - } - }) - } - }, - - globalData:{ - userInfo: null, - currentCustomer: null, - // API_URL: 'http://localhost:3000' - API_URL: 'https://rapi-staging.bayekeji.com' - } -})