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

View File

@@ -0,0 +1,40 @@
// component/actionSheet/actionSheet.js
Component({
/**
* 组件的属性列表
*/
properties: {
value:{
type: Array,
value: []
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
// 点击取消
cancel() {
this.triggerEvent('cancel', {}, {});
},
// 点击选择
click(e) {
let index = e.currentTarget.dataset.index;
this.triggerEvent('selected', this.data.value[index], {});
},
// 禁止背景滚动
unMove() {
return;
}
}
})

View File

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

View File

@@ -0,0 +1,7 @@
<!--component/actionSheet/actionSheet.wxml-->
<view class='popup-box' catchtouchmove='unMove' catchtap='cancel'>
<view class='body'>
<view class='cell' wx:for="{{value}}" wx:key="{{index}}" catchtap='click' data-index='{{index}}'>{{item.label}}</view>
<view class='cell cancel' catchtap='cancel'>取消</view>
</view>
</view>

View File

@@ -0,0 +1,32 @@
/* component/actionSheet/actionSheet.wxss */
.popup-box {
position: fixed;
top: 0;
left: 0;
display: flex;
align-items: flex-end;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: 1;
}
.popup-box .body {
flex: 1;
background: #f5f5f5;
}
.popup-box .body .cell {
width: 100%;
height: 80rpx;
margin-bottom: 2rpx;
line-height: 80rpx;
text-align: center;
font-size: 26rpx;
background: #FFF;
}
.popup-box .body .cell.cancel {
margin-top: 8rpx;
}

View File

@@ -0,0 +1,104 @@
// pages/authorizedMask/authorizedMask.js
const app = getApp();
Component({
/**
* 组件的属性列表
*/
properties: {
isSetting: {
type: Boolean,
value: false
},
content: {
type: String,
value: '使用小程序需要您授权登录'
},
isCancel: {
type: Boolean,
value: false
},
/**
* Only: 只有一個
* TwainCance 兩個帶取消
* */
type: {
type: String,
value: 'Only'
}
},
/**
* 组件的初始数据
*/
data: {
showBox: true,
},
/**
* 组件的方法列表
*/
methods: {
stopSlide() {
return;
},
wxTap() {
this.setData({
showBox: false
})
},
// 微信登录
wxLogin(e) {
if (e.detail.errMsg === 'getUserInfo:fail auth deny') {
this.setData({
showBox: true
})
return
}
this.setData({
showBox: false
})
let that = this;
wx.login({
success: function(res) {
if (res.code) {
app.$api.login({
avatar: e.detail.userInfo.avatarUrl,
code: res.code,
nickname: e.detail.userInfo.nickName,
}).then(res => {
wx.setStorageSync('access_token', res.data.accessToken);
wx.setStorageSync('userInfo', e.detail.userInfo);
that.triggerEvent('loginSuccess', {}, {});
})
} else {
wx.showToast({
title: '登录失败',
icon: 'none',
})
}
},
fail: function(res) {
wx.showToast({
title: '登录失败',
icon: 'none',
})
},
})
},
// 取消
cance() {
this.triggerEvent('cance', {}, {});
},
// 打开设置
setSuccess: function (e) {
this.triggerEvent('setsuccess', e.detail, {});
// if (e.detail.authSetting["scope.userLocation"]) {//如果打开了地理位置就会为true
// this.setData({
// showFlag: true
// })
// }
}
}
})

View File

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

View File

@@ -0,0 +1,17 @@
<!--pages/authorizedMask/authorizedMask.wxml-->
<view class='auth-bg' catchtouchmove='stopSlide'>
<view class='auth-box' wx:if="{{showBox}}">
<!-- wx:if="{{type == 'TwainCance'}}" -->
<view class='close' bindtap='cance' wx:if="{{isCancel}}">
<image src='../../images/23@3x.png'></image>
</view>
<view class='message'>{{content}}</view>
<view class='btn-bg' wx:if="{{type == 'Only'}}">
<button open-type="getUserInfo" bindgetuserinfo="wxLogin" wx:if="{{!isSetting}}">授权登录</button>
<button open-type="openSetting" bindopensetting="setSuccess" wx:if="{{isSetting}}" >进入授权管理</button>
</view>
<!-- <view class='btn-bg btn-tow' wx:if="{{showBox}}">
<button open-type="openSetting" wx:if="{{isSetting}}">进入授权管理</button>
</view> -->
</view>
</view>

View File

@@ -0,0 +1,67 @@
/* pages/authorizedMask/authorizedMask.wxss */
.auth-bg {
position: fixed;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.6);
z-index: 1001;
}
.auth-box {
position: relative;
width: 70%;
height: 350rpx;
background: #252330;
border-radius: 10rpx;
color: #989898;
}
.message {
display: flex;
justify-content: center;
align-items: center;
height: 250rpx;
/* border-bottom: 2rpx solid #EBEEF5; */
font-size: 28rpx;
}
.btn-bg>button {
width: 60%;
height: 70rpx;
line-height: 70rpx;
font-size: 26rpx;
color: #252330;
border-radius: 35rpx;
background: #ffc129;
}
.btn-bg.btn-tow {
display: flex;
}
button::after {
border: none;
border-radius: 0;
}
.close {
position: absolute;
top: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
width: 60rpx;
height: 60rpx;
}
.close>image {
width: 26rpx;
height: 26rpx;
}

View File

@@ -0,0 +1,72 @@
// component/confirmDialog/confirmDialog.js
Component({
/**
* 组件的属性列表
*/
properties: {
title: {
type: String,
value: ''
},
message: {
type: String,
value: ''
},
confirmBtnTitle: {
type: String,
value: '确认'
},
cancelBtnTitle: {
type: String,
value: '取消'
},
showCancel: {
type: Boolean,
value: true
},
isAuth: {
type: Boolean,
value: false
},
isUserInfo: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
unMove() {
return;
},
// 点击取消
cancel() {
this.triggerEvent('cancelselect', {}, {})
},
// 点击确认
confirm() {
this.triggerEvent('confirmselect', {}, {})
},
// 点击编辑授权
openSetting(e) {
this.triggerEvent('opensetting', e.detail, {});
},
// 点击获取个人信息
openUserInfo(e) {
this.triggerEvent('getuserinfo', e.detail, {});
}
}
})

View File

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

View File

@@ -0,0 +1,14 @@
<!--component/confirmDialog/confirmDialog.wxml-->
<view class='box' catchtouchmove='unMove'>
<view class='body'>
<view class='title'>{{title}}</view>
<view class='message'>{{message}}</view>
<view class='btn-box'>
<button wx:if="{{showCancel}}" bindtap='cancel'>{{cancelBtnTitle}}</button>
<view class='line' wx:if="{{showCancel}}"></view>
<button open-type='openSetting' wx:if="{{isAuth}}" bindopensetting="openSetting">{{confirmBtnTitle}}</button>
<button open-type='getUserInfo' wx:elif="{{isUserInfo}}" bindgetuserinfo="openUserInfo">{{confirmBtnTitle}}</button>
<button wx:else bindtap='confirm'>{{confirmBtnTitle}}</button>
</view>
</view>
</view>

View File

@@ -0,0 +1,67 @@
/* component/confirmDialog/confirmDialog.wxss */
.box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.6);
z-index: 1001;
}
.box .body {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 72%;
min-height: 300rpx;
border-radius: 20rpx;
text-align: center;
background: #252330;
}
.box .body .title {
margin: 40rpx 0;
font-size: 32rpx;
line-height: 32rpx;
font-weight: bold;
color: #fff;
}
.box .body .message {
flex: 1;
margin: 0 20rpx 60rpx 20rpx;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.6);
}
.box .body .btn-box {
display: flex;
width: 100%;
border-top: 2rpx solid #3d3b45;
}
.box .body .btn-box .line {
width: 2rpx;
height: 90rpx;
background: #3d3b45;
}
.box .body .btn-box>button {
flex: 1;
height: 90rpx;
background: none;
font-size: 32rpx;
color: #ffda2e;
line-height: 90rpx;
text-align: center;
}
.box .body .btn-box>button::after {
border: none;
}

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;
}