From a1e0b507a79ebecab71e1bb96844ebd9fed11f1c Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Tue, 30 Mar 2021 10:43:54 +0800 Subject: [PATCH] init --- .gitignore | 2 ++ app.js | 19 +++++++++++ app.json | 13 ++++++++ app.wxss | 0 package.json | 5 +++ pages/index/index.js | 7 ++++ pages/index/index.json | 3 ++ pages/index/index.scss | 12 +++++++ pages/index/index.wxml | 4 +++ pages/index/index.wxss | 14 ++++++++ pages/logs/logs.js | 15 +++++++++ pages/logs/logs.json | 4 +++ pages/logs/logs.wxml | 6 ++++ pages/logs/logs.wxss | 8 +++++ project.config.json | 73 ++++++++++++++++++++++++++++++++++++++++++ sitemap.json | 7 ++++ utils/util.js | 19 +++++++++++ yarn.lock | 8 +++++ 18 files changed, 219 insertions(+) create mode 100644 .gitignore create mode 100644 app.js create mode 100644 app.json create mode 100644 app.wxss create mode 100644 package.json create mode 100644 pages/index/index.js create mode 100644 pages/index/index.json create mode 100644 pages/index/index.scss create mode 100644 pages/index/index.wxml create mode 100644 pages/index/index.wxss create mode 100644 pages/logs/logs.js create mode 100644 pages/logs/logs.json create mode 100644 pages/logs/logs.wxml create mode 100644 pages/logs/logs.wxss create mode 100644 project.config.json create mode 100644 sitemap.json create mode 100644 utils/util.js create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f32e4b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +node_modules \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..1ed57c4 --- /dev/null +++ b/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + }, + globalData: { + userInfo: null + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..fb804a6 --- /dev/null +++ b/app.json @@ -0,0 +1,13 @@ +{ + "pages":[ + "pages/index/index", + "pages/logs/logs" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Weixin", + "navigationBarTextStyle":"black" + }, + "sitemapLocation": "sitemap.json" +} diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json new file mode 100644 index 0000000..f4ed081 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@vant/weapp": "^1.6.8" + } +} diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..fbdc216 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,7 @@ +// index.js +// 获取应用实例 +const app = getApp() + +Page({ + +}) diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/index/index.scss b/pages/index/index.scss new file mode 100644 index 0000000..a886d4b --- /dev/null +++ b/pages/index/index.scss @@ -0,0 +1,12 @@ +.map{ + width: 100%; + height: 100%; +} +page{ + width: 100%; + height: 100%; +} +.container{ + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..f473bea --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..91ac0d3 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,14 @@ +.map { + width: 100%; + height: 100%; +} + +page { + width: 100%; + height: 100%; +} + +.container { + width: 100%; + height: 100%; +} diff --git a/pages/logs/logs.js b/pages/logs/logs.js new file mode 100644 index 0000000..3c7cb60 --- /dev/null +++ b/pages/logs/logs.js @@ -0,0 +1,15 @@ +// logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad() { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return util.formatTime(new Date(log)) + }) + }) + } +}) diff --git a/pages/logs/logs.json b/pages/logs/logs.json new file mode 100644 index 0000000..3ee76c1 --- /dev/null +++ b/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "查看启动日志", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/logs/logs.wxml b/pages/logs/logs.wxml new file mode 100644 index 0000000..b5a85ac --- /dev/null +++ b/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log}} + + diff --git a/pages/logs/logs.wxss b/pages/logs/logs.wxss new file mode 100644 index 0000000..94d4b88 --- /dev/null +++ b/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..3baee0b --- /dev/null +++ b/project.config.json @@ -0,0 +1,73 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": false, + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": false, + "showShadowRootInWxmlPanel": true, + "enableEngineNative": false, + "minifyWXSS": true, + "packNpmManually": true, + "packNpmRelationList": [ + { + "packageJsonPath": "./package.json", + "miniprogramNpmDistDir": "./" + } + ] + }, + "compileType": "miniprogram", + "libVersion": "2.0.4", + "appid": "wx932dd04d3a7e7341", + "projectname": "%E6%88%BF%E8%BD%A6", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..764bc2c --- /dev/null +++ b/utils/util.js @@ -0,0 +1,19 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +module.exports = { + formatTime +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..bd102bb --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@vant/weapp@^1.6.8": + version "1.6.8" + resolved "https://registry.npmjs.org/@vant/weapp/-/weapp-1.6.8.tgz#948ae16fba07c5a2054c52783f22aaf6a04453e1" + integrity sha512-CvRgAZdGUtJKEnd2wmjw3oaRYXBq/YqerFTmf19cTd3G9+vRR67nSXPMUNQEoPPSm7LZo6gF6Xk/5pYx4Q4C0Q==