diff --git a/新闻小程序/.eslintrc.js b/新闻小程序/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/新闻小程序/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/新闻小程序/app.js b/新闻小程序/app.js new file mode 100644 index 0000000..b8b6e56 --- /dev/null +++ b/新闻小程序/app.js @@ -0,0 +1,22 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + wx.cloud.init({ + env: 'news-cloud-7gul2ujt6e0e41df' + }) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + }, + globalData: { + userInfo: null + } +})