main
wangsiyi 1 month ago
parent 719b6f1a8c
commit 254efb7634

@ -0,0 +1,2 @@
# 本地生活
![](./screenshot.png)

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

@ -0,0 +1,15 @@
{
"pages": [
"pages/index/index",
"pages/logs/logs"
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "Weixin",
"navigationBarBackgroundColor": "#ffffff"
},
"style": "v2",
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}

@ -0,0 +1,10 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@ -0,0 +1,42 @@
<swiper indicator-dots="true" autoplay="true" interval="3000">
<swiper-item>
<image src="/images/swiper01.jpg" />
</swiper-item>
<swiper-item>
<image src="/images/swiper02.jpg" />
</swiper-item>
</swiper>
<view class="grids">
<view class="item">
<image src="/images/shi.png" />
<text>美食</text>
</view>
<view class="item">
<image src="/images/yu.png" />
<text>洗浴</text>
</view>
<view class="item">
<image src="/images/che.png" />
<text>汽车</text>
</view>
<view class="item">
<image src="/images/chang.png" />
<text>唱歌</text>
</view>
<view class="item">
<image src="/images/fang.png" />
<text>住宿</text>
</view>
<view class="item">
<image src="/images/xue.png" />
<text>学习</text>
</view>
<view class="item">
<image src="/images/gong.png" />
<text>工作</text>
</view>
<view class="item">
<image src="/images/hun.png" />
<text>结婚</text>
</view>
</view>

@ -0,0 +1,39 @@
.grids {
display: flex;
flex-wrap: wrap;
}
.grids .item {
width: 250rpx;
height: 250rpx;
border-right: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.grids .item:nth-child(3) {
border-right: 0;
}
.grids .item:nth-child(6) {
border-right: 0;
}
.grids .item:nth-child(9) {
border-right: 0;
}
.grids .item image {
width: 70rpx;
height: 70rpx;
}
.grids .item text {
color: #999;
font-size: 28rpx;
margin-top: 20rpx;
}

@ -0,0 +1,8 @@
Page({
data: {
// 这里可以定义页面的数据
},
onLoad: function () {
// 页面加载时的逻辑
}
})

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "本地生活"
}

@ -0,0 +1,42 @@
<swiper indicator-dots="true" autoplay="true" interval="3000">
<swiper-item>
<image src="/images/swiper01.jpg" />
</swiper-item>
<swiper-item>
<image src="/images/swiper02.jpg" />
</swiper-item>
</swiper>
<view class="grids">
<view class="item">
<image src="/images/shi.png" />
<text>美食</text>
</view>
<view class="item">
<image src="/images/yu.png" />
<text>洗浴</text>
</view>
<view class="item">
<image src="/images/che.png" />
<text>汽车</text>
</view>
<view class="item">
<image src="/images/chang.png" />
<text>唱歌</text>
</view>
<view class="item">
<image src="/images/fang.png" />
<text>住宿</text>
</view>
<view class="item">
<image src="/images/xue.png" />
<text>学习</text>
</view>
<view class="item">
<image src="/images/gong.png" />
<text>工作</text>
</view>
<view class="item">
<image src="/images/hun.png" />
<text>结婚</text>
</view>
</view>

@ -0,0 +1,39 @@
.grids {
display: flex;
flex-wrap: wrap;
}
.grids .item {
width: 250rpx;
height: 250rpx;
border-right: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.grids .item:nth-child(3) {
border-right: 0;
}
.grids .item:nth-child(6) {
border-right: 0;
}
.grids .item:nth-child(9) {
border-right: 0;
}
.grids .item image {
width: 70rpx;
height: 70rpx;
}
.grids .item text {
color: #999;
font-size: 28rpx;
margin-top: 20rpx;
}

@ -0,0 +1,18 @@
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})

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

@ -0,0 +1,6 @@
<!--logs.wxml-->
<scroll-view class="scrollarea" scroll-y type="list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<view class="log-item">{{index + 1}}. {{log.date}}</view>
</block>
</scroll-view>

@ -0,0 +1,16 @@
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.log-item {
margin-top: 20rpx;
text-align: center;
}
.log-item:last-child {
padding-bottom: env(safe-area-inset-bottom);
}

@ -0,0 +1,41 @@
{
"compileType": "miniprogram",
"libVersion": "3.10.2",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"minifyWXML": true,
"localPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true,
"disableUseStrict": false,
"useCompilerPlugins": false
},
"condition": {},
"editorSetting": {
"tabIndent": "auto",
"tabSize": 2
},
"appid": "wx6e52167a149f40ff",
"simulatorPluginLibVersion": {}
}

@ -0,0 +1,24 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "%2525E6%25259C%2525AC%2525E5%25259C%2525B0%2525E7%252594%25259F%2525E6%2525B4%2525BB",
"setting": {
"compileHotReLoad": true,
"urlCheck": true,
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"autoAudits": false,
"useApiHook": true,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"bigPackageSizeSupport": false,
"checkInvalidKey": true,
"ignoreDevUnusedFiles": true
},
"libVersion": "3.10.2",
"condition": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 KiB

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

@ -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
}
Loading…
Cancel
Save