This commit is contained in:
2021-03-30 10:43:54 +08:00
commit a1e0b507a7
18 changed files with 219 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.vscode
node_modules

19
app.js Normal file
View File

@@ -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
}
})

13
app.json Normal file
View File

@@ -0,0 +1,13 @@
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"sitemapLocation": "sitemap.json"
}

0
app.wxss Normal file
View File

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"@vant/weapp": "^1.6.8"
}
}

7
pages/index/index.js Normal file
View File

@@ -0,0 +1,7 @@
// index.js
// 获取应用实例
const app = getApp()
Page({
})

3
pages/index/index.json Normal file
View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

12
pages/index/index.scss Normal file
View File

@@ -0,0 +1,12 @@
.map{
width: 100%;
height: 100%;
}
page{
width: 100%;
height: 100%;
}
.container{
width: 100%;
height: 100%;
}

4
pages/index/index.wxml Normal file
View File

@@ -0,0 +1,4 @@
<!-- index.wxml -->
<view class="container">
<map name="" class="map"></map>
</view>

14
pages/index/index.wxss Normal file
View File

@@ -0,0 +1,14 @@
.map {
width: 100%;
height: 100%;
}
page {
width: 100%;
height: 100%;
}
.container {
width: 100%;
height: 100%;
}

15
pages/logs/logs.js Normal file
View File

@@ -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))
})
})
}
})

4
pages/logs/logs.json Normal file
View File

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

6
pages/logs/logs.wxml Normal file
View File

@@ -0,0 +1,6 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log}}</text>
</block>
</view>

8
pages/logs/logs.wxss Normal file
View File

@@ -0,0 +1,8 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

73
project.config.json Normal file
View File

@@ -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": []
}
}
}

7
sitemap.json Normal file
View File

@@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

19
utils/util.js Normal file
View File

@@ -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
}

8
yarn.lock Normal file
View File

@@ -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==