parent
abe67396a1
commit
a847392260
@ -0,0 +1,23 @@
|
||||
// app.js
|
||||
App({
|
||||
globalData: {
|
||||
userInfo: null
|
||||
},
|
||||
getUserInfo: function(cb) {
|
||||
var that = this
|
||||
if (this.globalData.userInfo) {
|
||||
typeof cb == "function" && cb(this.globalData.userInfo)
|
||||
} else {
|
||||
wx.login({
|
||||
success: function() {
|
||||
wx.getUserInfo({
|
||||
success: function(res) {
|
||||
that.globalData.userInfo = res.userInfo
|
||||
typeof cb == "function" && cb(that.globalData.userInfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -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;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
// pages/index/index.js
|
||||
Page({
|
||||
data: {
|
||||
userInfo: {
|
||||
avatarUrl: '/头像.png', // 替换为你的头像图片路径
|
||||
nickName: '汪思怡',
|
||||
gender: '女',
|
||||
city: '四川',
|
||||
province: '绵阳',
|
||||
specialty: 'cosplay',
|
||||
hobbies: '二次元'
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "个人信息"
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<!-- pages/index/index.wxml -->
|
||||
<view class="container">
|
||||
<view class="header">
|
||||
<image class="avatar" src="{{userInfo.avatarUrl}}" />
|
||||
<view class="info">
|
||||
<text class="nickname">{{userInfo.nickName}}</text>
|
||||
<view class="menu">
|
||||
<view class="menu-item">
|
||||
<text>性别:</text>
|
||||
<text>{{userInfo.gender}}</text>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<text>地区:</text>
|
||||
<text>{{userInfo.city}} {{userInfo.province}}</text>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<text>特长:</text>
|
||||
<text>{{userInfo.specialty}}</text>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<text>爱好:</text>
|
||||
<text>{{userInfo.hobbies}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -0,0 +1,32 @@
|
||||
/* pages/index/index.wxss */
|
||||
.container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.info {
|
||||
flex: 1;
|
||||
}
|
||||
.nickname {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.menu {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.menu-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
@ -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": {}
|
||||
}
|
||||
|
After Width: | Height: | Size: 391 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…
Reference in new issue