Commit ad8b61a8 authored by Huiying FU's avatar Huiying FU

提交首页

parent 5162abbe
// 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
}
})
{
"pages":[
"pages/index/index",
"pages/logs/logs"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
/**app.wxss**/
.container {
height: 100%;
display: flex;
background-color:#f7f0f0;
flex-direction: column;
align-items: center;
justify-content: space-between;
}
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 100 100" xml:space="preserve"><style>.st1{fill:#00653e}</style><circle cx="50" cy="50" r="50" fill="#fefefe"/><path class="st1" d="M51.1 44.1c-.6 0-.8-.2-1.2-.2-.4 0-1.2.3-1.4.6 0 .1.1.3.2.4.9.1 1.3.6 2.4.6 1 0 1.5-.5 2.4-.6.1-.1.2-.2.2-.4-.2-.3-1-.6-1.4-.6-.4 0-.5.2-1.2.2zm-3.7 3.1s-.3.1-.3.3c1.1.8 1.8 2.7 4.1 2.7 2.2 0 3-1.8 4-2.7-.1-.2-.3-.3-.3-.3s-1.4.3-3.7.3c-2.4 0-3.8-.3-3.8-.3zM51.1 18s-5.1 3.8-5.3 4c-.2.1-.1.4.2.3.4-.1 2.6-.4 5.1-.4 2.5 0 4.7.4 5.1.4.3 0 .4-.2.2-.3-.1-.2-5.3-4-5.3-4z"/><path class="st1" d="M86.8 49.3c-.6-1.4-1.3-2.8-2-4.2 6.8-1.2 9.6 3.7 15.2 4.1 0-1.3-.1-2.6-.2-3.9-5.2.6-9.9-5.6-16.8-3.2-2.6-3.9-6-7.2-9.9-9.9 3.8-1.5 8.3-1.2 12.2 1.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590.462 835.157 308.53C832.498 138.306 691.532 0 518.65 0S202.14 138.306 202.14 308.53c0 292.571 316.51 553.226 316.51 553.226zM345.765 316.509c0-95.75 77.133-172.883 172.883-172.883 95.751 0 172.883 77.132 172.883 172.883 0 95.75-77.132 172.883-172.883 172.883-95.75 0-172.883-79.792-172.883-172.883z"/><path d="M768.665 694.192c-21.278 26.598-39.896 53.195-61.174 74.473 220.758 13.299 268.634 58.514 279.273 82.452-10.64 26.597-159.585 90.431-454.816 90.431-295.231 2.66-444.177-63.834-452.156-87.771 7.98-21.278 42.556-63.834 244.696-79.793-18.618-21.278-39.896-47.875-61.174-74.472C98.41 718.13 0 758.026 0 851.117c0 135.647 335.127 170.223 534.608 170.223 199.48 0 534.608-37.236 534.608-170.223 0-98.41-122.348-140.966-300.551-156.925z"/></g></svg>
\ No newline at end of file
// index.js
// 获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello Woas',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad() {
if (wx.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
})
}
},
getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
console.log(res)
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
console.log(e)
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})
{
"usingComponents": {}
}
\ No newline at end of file
<view class="container">
<view class="top">
<image src="../asset/images/common/dg-share.png" class="ibanner" mode="scaleToFill">
</image>
</view>
<view class="center">
<view class="c-left">
<image src="../asset/images/common/default-avatar.png" class="mini-head" ></image>
</view>
<view class="c-center">
</view>
<view class="c-right">
</view>
</view>
<view class="bottom">
</view>
</view>
\ No newline at end of file
/**index.wxss**/
.ibanner{
height: 400rpx;
}
.center{
width: 690rpx;
height: 200rpx;
margin: 15rpx auto ;
position: relative;
background-color:#ffffff;
top: -100rpx;
border-radius: 20rpx;
}
.c-left{
width: 30%;
background-color: blue;
}
.c-center{
background-color: burlywood;
}
.c-right{
background-color: cadetblue;
}
.mini-head{
height: 80rpx;
width: 80rpx;
}
\ No newline at end of file
// 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
}
})
})
}
})
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}
\ No newline at end of file
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment