init project

This commit is contained in:
limqhz
2020-06-21 16:27:58 +08:00
commit e8fe10b5fb
178 changed files with 9964 additions and 0 deletions

106
component/header/header.js Normal file
View File

@@ -0,0 +1,106 @@
// components/header/header.js
Component({
/**
* 组件的属性列表
*/
properties: {
title: {
type: String,
value: '智慧云馆'
},
icon: {
type: String,
value: '../../images/back.png'
},
showIcon: {
type: Boolean,
value: true
},
isGoHome: {
type: Boolean,
value: false
},
isHistory: {
type: Boolean,
value: false
},
isLogin: {
type: Boolean,
value: false
},
},
/**
* 组件的初始数据
*/
data: {
unIcon: false
},
ready() {
let pages = getCurrentPages();
this.setData({
showIcon: pages.length > 1,
})
// console.log(pages);
// if (this.isLogin()) {
// this.setData({
// unIcon: pages[pages.length - 2].data.gohome
// })
// }
// pages/register/index
// pages/facialCapturing/index options isPass 1
},
/**
* 组件的方法列表
*/
methods: {
isLogin() {
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1];
let perPage = pages[pages.length - 2]
if (currentPage.route == 'pages/login/index') {
return true;
}
if (currentPage.route == 'pages/register/index') {
return true;
}
if (currentPage.route == 'pages/facialCapturing/index' && currentPage.options.isPass == 1) {
return true;
}
return false;
},
iconClick() {
let pages = getCurrentPages();
let route = wx.getStorageSync('history');
if (this.data.isGoHome) {
wx.redirectTo({
url: '/pages/home/index',
})
} else if (this.data.isLogin) {
wx.redirectTo({
url: '/pages/login/index',
})
} else if (this.data.isHistory && route) {
if (pages[pages.length - 2].data.gohome) {
wx.reLaunch({
url: '/pages/home/index',
})
return;
}
wx.removeStorageSync('history');
wx.redirectTo({
url: route,
})
} else {
wx.navigateBack({
delta: 1,
})
}
}
}
})

View File

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

View File

@@ -0,0 +1,11 @@
<!--components/header/header.wxml-->
<view class='header-bg'>
<view class='icon' bindtap='iconClick' wx:if="{{(showIcon || isGoHome)}}">
<image src='{{icon}}' mode='aspectFit' wx:if="{{!isGoHome}}"></image>
<image src='../../images/24.png' mode='aspectFit' wx:if="{{isGoHome}}"></image>
</view>
<view class='title'>
<view class='title-box'>{{title}}</view>
</view>
<view class='right' wx:if="{{showIcon || isGoHome}}"></view>
</view>

View File

@@ -0,0 +1,48 @@
/* components/header/header.wxss */
.header-bg {
position: fixed;
top: 0;
left: 0;
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
height: 100rpx;
padding-top: 40rpx;
background: #1a191e;
color: #fff;
font-size: 26rpx;
z-index: 1001;
}
.header-bg .icon {
display: flex;
align-items: center;
width: 90rpx;
height: 80%;
}
.header-bg .icon>image {
width: 80%;
height: 50%;
}
.header-bg .title {
flex: 1;
display: flex;
justify-content: center;
/* width: 50%; */
text-align: center;
}
.header-bg .title .title-box {
width: 50%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-bg .right {
width: 90rpx;
}