作者 李洪娟

安乐国

正在显示 198 个修改的文件 包含 751 行增加0 行删除
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/main/mainindex/mainindex",
"pages/index/index",
"pages/logs/logs"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
}
}
\ No newline at end of file
... ...
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
... ...

229.8 KB

@font-face {font-family: "iconfont";
src: url('//at.alicdn.com/t/font_981332_nyneqzbu6je.eot?t=1545644784206'); /* IE9*/
src: url('//at.alicdn.com/t/font_981332_nyneqzbu6je.eot?t=1545644784206#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAAREAAsAAAAABogAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADMAAABCsP6z7U9TLzIAAAE8AAAARAAAAFY8l0gTY21hcAAAAYAAAABLAAABcOdJtg1nbHlmAAABzAAAAJQAAACUo1u6amhlYWQAAAJgAAAALQAAADYTq9t+aGhlYQAAApAAAAAcAAAAJAf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IyujoO1Vm9K+xQ8Jee1Y9zed0WxTU/3OFAQL0z1xTurLSeTpPgT1fG1J1dCtuy56UNJFezUkSskJe1rZUQuoBNmVXjhF6XNGJPyhnSP8ACVpuyAAAAHicY2BigAAuBuyAiZGJkZmBrTi/tLg0n4EBABF8AsoA') format('woff'),
url('//at.alicdn.com/t/font_981332_nyneqzbu6je.ttf?t=1545644784206') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('//at.alicdn.com/t/font_981332_nyneqzbu6je.svg?t=1545644784206#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-sousuo:before { content: "\e621"; }
... ...
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse){
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})
... ...
{}
\ No newline at end of file
... ...
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>
... ...
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 200px;
}
\ No newline at end of file
... ...
//logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad: function () {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return util.formatTime(new Date(log))
})
})
}
})
... ...
{
"navigationBarTitleText": "查看启动日志"
}
\ No newline at end of file
... ...
<!--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>
... ...
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
... ...
// pages/main/mainindex/mainindex.js
Page({
/**
* 页面的初始数据
*/
data: {
navbar: [{
name: '主页信息'
},
{
name: '于家为国'
},
{
name: '追思名人'
},
{
name: '民俗文化'
},
{
name: '商城'
},
],
currentTab: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
navbarTap: function(e) {
this.setData({
currentTab: e.currentTarget.dataset.idx,
category_id:e.currentTarget.dataset.categoryid,
goodslist:[],
page:''
})
this.buyfroupinfo()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
... ...
{}
\ No newline at end of file
... ...
<import src="../../template/templates.wxml" />
<template is="tabBar" data='{{...tabcurrent}}' />
<view class="box">
<view class="search">
<view class="iconfont icon-sousuo searchicon"></view>
<view class="search_hospital">
<input placeholder="身份证号或纪念堂号" class="enterword" bindinput="searchhospital"/>
</view>
</view>
<view class="nav">
<view wx:for="{{navbar}}" data-idx="{{index}}" class="nav_item {{currentTab==index ? 'active' : ''}}" wx:key="unique" bindtap="navbarTap" data-categoryid="{{item.id}}">{{item.name}}
</view>
</view>
<view class="topone">
<view class="toponetext">
如果你无法简洁的表达你的想法,那只说明你 还不够了解它。
</view>
<view class="topnonecontent">
<text class="toponetitle">--阿尔伯特·爱因斯坦</text>
<view class="totop">置顶</view>
</view>
</view>
<view class="topone">
<view class="toptwo">
<view class="toponetext toptwotext">
著名反派演员计春华去世,享 年57岁
</view>
<view class="toptwoimg ">
<image src="../../../img/NoPath - 副本 (240)@3x.png"></image>
</view>
</view>
<view class="topnonecontent">
<view class="newsimg">
<image src="../../../img/news.png"></image>
</view>
<text class="toponetitle">人民网</text>
<text class="toponetitle" style="margin-left:10rpx">3.2万人祭拜</text>
<view class="totop">置顶</view>
</view>
</view>
<view class="topone">
<video id="myVideo" src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400" binderror="videoErrorCallback" danmu-list="{{danmuList}}" enable-danmu danmu-btn controls></video>
</view>
<view class="topone">
<view class="toptwo">
<view class="toponetext toptwotext">
每逢佳节倍思亲,为家人加个 纪念馆
</view>
<view class="toptwoimg ">
<image src="../../../img/NoPath - 副本 (240)@3x.png"></image>
</view>
</view>
</view>
<view class="topone praylist">
<view class="prayimg">
<image src="../../../img/组 4218@3x.png"></image>
</view>
<view class="prayimg">
<image src="../../../img/组 4218@3x.png"></image>
</view>
<view class="prayimg">
<image src="../../../img/组 4218@3x.png"></image>
</view>
</view>
<view class="tourlist">
<view class="touristname">十一黄金周数万名游客齐聚西纸坊,共享民俗文化盛宴</view>
<view class="tourlistimglist">
<view class="tourlistimg">
<image src="../../../img/product_04@3x.png"></image>
</view>
<view class="tourlistimg">
<image src="../../../img/product_04@3x.png"></image>
</view>
<view class="tourlistimg">
<image src="../../../img/product_04@3x.png"></image>
</view>
</view>
<view class="carfrienditem">
<view class="carfriend"></view>
<view class="carfriendname">车友之家 1小时前</view>
</view>
</view>
</view>
... ...
@import '../../template/templates.wxss';
@import '../../icon/icon.wxss';
.box{
margin-bottom: 120rpx;
}
.search {
width:688rpx;
margin: 0 auto;
height:64rpx;
display:flex;
justify-content: center;
align-items:center;
padding:12rpx 20rpx 12rpx 33rpx;
background:rgba(245,245,245,1);
opacity:1;
border-radius:4px;
box-sizing:border-box;
position: relative
}
.enterword {
width:418rpx;
color:#CCCCCC;
font-size:28rpx;
text-align: center;
}
.searchicon{
position: absolute;
left:172rpx;
color:#CCCCCC;
font-size: 50rpx;
}
.nav {
height:60rpx;
display:flex;
justify-content:space-between;
align-items: center;
text-align:center;
padding:20rpx 20rpx;
background:#fff;
border-bottom:1rpx solid #f5f5f5;
}
.nav_item {
white-space:nowrap;
list-style:none;
font-size:28rpx;
color:#666666;
width:auto;
padding:0 20rpx;
position:relative;
}
.active{
color:#951B1B;
}
.active:after{
content:"";
display:bloc;
position:absolute;
left:0;
right:0;
margin: 0 auto;
top:62rpx;
width:32px;
height:3px;
background:rgba(149,27,27,1);
opacity:1;
}
.topone{
padding: 26rpx 36rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.toponetext{
color:#333333;
font-size: 34rxp;
padding-bottom: 12rpx;
}
.topnonecontent{
display:flex;
}
.toponetitle{
color:#999999;
font-size: 32rpx;
}
.totop{
width:74rpx;
height:38rpx;
border:2px solid rgba(149,27,27,1);
opacity:1;
font-size: 30rpx;
text-align: center;
line-height: 34rpx;
margin-left: 22rpx;
color:#951B1B;
}
.toptwoimg{
width:160rpx;
height:160rpx;
font-size: 0
}
.toptwoimg image{
width:100%;
height:100%;
}
.toptwo{
display: flex;
justify-content: space-between
}
.toptwotext{
width:488rpx;
}
.newsimg{
width:44rpx;
height:34rpx;
font-size: 0
}
.newsimg image{
width:100%;
height:100%;
}
video{
width:686rpx;
height:390rpx;
margin: 0 auto;
}
.prayimg{
width:208rpx;
height:224rpx;
font-size: 0
}
.prayimg image{
width:100%;
height:100%;
}
.praylist{
display:flex;
justify-content: space-between;
}
.touristname{
color:#333333;
font-size: 32rpx;
}
.tourlist{
padding: 20rpx 32rpx;
}
.tourlistimglist{
display:flex;
justify-content: space-between;
align-items: center;
margin-top: 10rpx;
}
.tourlistimg{
width:208rpx;
height: 166rpx;
font-size: 0;
border-radius: 16rpx;
}
.tourlistimg image{
width:100%;
height:100%;
border-radius:16rpx;
}
.carfriend{
width:32rpx;
height:32rpx;
border-radius:50%;
background: #F5F5F5;
}
.carfriendname{
font-size: 22rpx;
color:#999999;
margin-left: 2rpx
}
.carfrienditem{
display:flex;
margin-top: 14rpx;
}
\ No newline at end of file
... ...
<template name="tabBar">
<view class="mypublish_foot">
<view class="mypublish_item">
<view class="mypublish_img">
<image src="http://bronet.ibaby88.cn/nav12@2x.png"></image>
</view>
<view class="mypublish_name naughgty">首页</view>
</view>
<view class="mypublish_item">
<view class="mypublish_img">
<image src="http://bronet.ibaby88.cn/nav12@2x.png"></image>
</view>
<view class="mypublish_name naughgty">公祭</view>
</view>
<view class="mypublish_item" bindtap="sellidel">
<view class="sell_mypublish_img">
<image src="../../img/nav_03@3x.png"></image>
</view>
<view class="mypublish_name sellname">发布</view>
</view>
<view class="mypublish_item" bindtap="mypublish">
<view class="mypublish_img">
<image src="http://bronet.ibaby88.cn/nav14@2x.png"></image>
</view>
<view class="mypublish_name mypublish">墓地</view>
</view>
<view class="mypublish_item" bindtap="mypublish">
<view class="mypublish_img">
<image src="http://bronet.ibaby88.cn/nav14@2x.png"></image>
</view>
<view class="mypublish_name mypublish">我的</view>
</view>
</view>
</template>
... ...
.mypublish_img{
width:64rpx;
height:64rpx;
font-size: 0;
margin: 0 auto;
}
.sell_mypublish_img{
width:80rpx;
height:80rpx;
font-size: 0;
margin: 0 auto;
position:relative;
}
.mypublish_img image,.sell_mypublish_img image{
width:100%;
height:100%;
}
.sell_mypublish_img image{
position: absolute;
bottom:30rpx;
left:0;
right:0;
}
.sellname{
position: absolute;
bottom:0;
left:0;
right:0;
}
.mypublish_foot{
display:flex;
justify-content: space-between;
align-items: center;
/* padding: 0 40rpx; */
box-sizing: border-box;
position:fixed;
bottom:0;
left:0;
right:0;
border-top:1rpx solid #f5f5f5;
background: #fff;
}
.mypublish_name{
text-align: center;
color:#666;
font-size: 24rpx;
}
.mypublish_item{
width:33.33%;
}
... ...
{
"description": "项目配置文件。",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true
},
"compileType": "miniprogram",
"libVersion": "2.4.2",
"appid": "wx1f51f42105b63343",
"projectname": "anleguo",
"isGameTourist": false,
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
\ 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: formatTime
}
... ...