From 700db04c9cad2fc6813a0d9231caa547f0a500f7 Mon Sep 17 00:00:00 2001 From: link_1999 <1402246900@qq.com> Date: Mon, 4 Apr 2022 21:49:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'=E6=96=B0=E9=97=BB=E5=B0=8F=E7=A8=8B=E5=BA=8F'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 新闻小程序/.eslintrc.js | 31 +++++++++++++++++++++++++++++++ 新闻小程序/app.js | 22 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 新闻小程序/.eslintrc.js create mode 100644 新闻小程序/app.js 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 + } +})