init project
This commit is contained in:
166
pages/bookClassesDetail/index.js
Normal file
166
pages/bookClassesDetail/index.js
Normal file
@@ -0,0 +1,166 @@
|
||||
// pages/bookClassesDetail/index.js
|
||||
const app = getApp();
|
||||
let id = '';
|
||||
import {
|
||||
getCurrentPageUrl
|
||||
} from './../../utils/util.js'
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isOpenCoach: false,
|
||||
isOpenAnnouncements: false,
|
||||
lesson: {},
|
||||
isGoHome: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
})
|
||||
id = options.id;
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
let pages = getCurrentPages();
|
||||
this.setData({
|
||||
isGoHome: pages.length == 1
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
app.$api.venueLessonDetail({
|
||||
lessonId: id
|
||||
}).then(res => {
|
||||
let now = new Date().getTime()
|
||||
let isStartTime = now > new Date(res.lesson.date.replace(/-/g, "/") + " " + res.lesson.startTime).getTime()
|
||||
let isEndTime = now > new Date(res.lesson.date.replace(/-/g, "/") + " " + res.lesson.endTime).getTime();
|
||||
|
||||
if (res.lesson.flg == 0) {
|
||||
res.lesson.btnStatus = 1;
|
||||
}
|
||||
if (isStartTime) {
|
||||
res.lesson.btnStatus = 2;
|
||||
}
|
||||
if (isEndTime) {
|
||||
res.lesson.btnStatus = 3
|
||||
}
|
||||
if (!res.lesson.btnStatus) {
|
||||
res.lesson.btnStatus = 0
|
||||
}
|
||||
|
||||
this.setData({
|
||||
lesson: res.lesson,
|
||||
isOpenCoach: res.lesson.coach.description.length < 40,
|
||||
isOpenAnnouncements: res.lesson.coach
|
||||
})
|
||||
}, err => {
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.data.lesson.name,
|
||||
imageUrl: this.data.lesson.venueLessonImages[0].url
|
||||
}
|
||||
},
|
||||
|
||||
// 打开导航
|
||||
opnGPS() {
|
||||
wx.openLocation({
|
||||
latitude: Number(this.data.lesson.latitude),
|
||||
longitude: Number(this.data.lesson.longitude),
|
||||
name: this.data.lesson.venueName,
|
||||
address: this.data.lesson.address,
|
||||
})
|
||||
},
|
||||
|
||||
// 展开教练
|
||||
openCoach() {
|
||||
this.setData({
|
||||
isOpenCoach: true
|
||||
})
|
||||
},
|
||||
// 收起
|
||||
closeCoach() {
|
||||
this.setData({
|
||||
isOpenCoach: false
|
||||
})
|
||||
},
|
||||
|
||||
// 展开注意事项
|
||||
openAnnouncements() {
|
||||
this.setData({
|
||||
isOpenAnnouncements: true
|
||||
})
|
||||
},
|
||||
// 收起
|
||||
closeAnnouncements() {
|
||||
this.setData({
|
||||
isOpenAnnouncements: false
|
||||
})
|
||||
},
|
||||
|
||||
// 预约课程
|
||||
pushBookClasses() {
|
||||
if (!wx.getStorageSync('accessToken')) {
|
||||
wx.setStorageSync('history', getCurrentPageUrl());
|
||||
wx.redirectTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: `/pages/confirmOrder/index?id=${id}&venueId=${this.data.lesson.venueId}&venueType=${this.data.lesson.venueType}`,
|
||||
})
|
||||
},
|
||||
// 点击教练头像
|
||||
clickImage() {
|
||||
wx.previewImage({
|
||||
urls: [this.data.lesson.coach.avatar],
|
||||
})
|
||||
}
|
||||
})
|
||||
5
pages/bookClassesDetail/index.json
Normal file
5
pages/bookClassesDetail/index.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"header": "/component/header/header"
|
||||
}
|
||||
}
|
||||
97
pages/bookClassesDetail/index.wxml
Normal file
97
pages/bookClassesDetail/index.wxml
Normal file
@@ -0,0 +1,97 @@
|
||||
<!--pages/bookClassesDetail/index.wxml-->
|
||||
<header title="{{lesson.name}}" isGoHome="{{isGoHome}}"></header>
|
||||
<view class='container' wx:if="{{lesson.name}}">
|
||||
<swiper class='header' indicator-dots="{{lesson.venueLessonImages.length > 1}}" autoplay="{{true}}" circular="{{true}}">
|
||||
<block wx:for="{{lesson.venueLessonImages}}" wx:key="{{index}}">
|
||||
<swiper-item>
|
||||
<image src="{{item.url}}" mode='aspectFill'></image>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
<view class='cell-box'>
|
||||
<view class='cell'>
|
||||
<image src='../../images/42@3x.png' mode='aspectFit'></image>
|
||||
<text>开课时间: {{lesson.date}} {{lesson.startTime}} ~ {{lesson.endTime}}</text>
|
||||
</view>
|
||||
<view class='cell'>
|
||||
<image src='../../images/41@3x.png' mode='aspectFit'></image>
|
||||
<text>{{lesson.address}}</text>
|
||||
<view class='cell-right' bindtap='opnGPS'>
|
||||
<image src='../../images/34@3x.png' class='gps-img'></image>
|
||||
<text>导航</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cell'>
|
||||
<image src='../../images/33@3x.png' mode='aspectFit'></image>
|
||||
<text>价格: ¥{{lesson.price}}</text>
|
||||
</view>
|
||||
<view class='cell unline'>
|
||||
<image src='../../images/39@3x.png' mode='aspectFit'></image>
|
||||
<view class='more-text'>
|
||||
<text>已报: {{lesson.saleNum}}</text>
|
||||
<text>剩余: {{lesson.flg}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='cell-box'>
|
||||
<view class='coach-info'>
|
||||
<image src='{{lesson.coach.avatar}}' mode='aspectFill' bindtap='clickImage'></image>
|
||||
<view class='coach-text'>
|
||||
<view class='name'>{{lesson.coach.nickname}}</view>
|
||||
<view class='{{isOpenCoach ? "info":"info pack-up"}}'>{{lesson.coach.description}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='unfold' bindtap='openCoach' wx:if="{{!isOpenCoach}}">
|
||||
<text>展开</text>
|
||||
<image src='../../images/15@3x.png'></image>
|
||||
</view>
|
||||
<view class='unfold' bindtap='closeCoach' wx:if="{{isOpenCoach && lesson.coach.description}}">
|
||||
<text>收起</text>
|
||||
<image src='../../images/48@3x.png' style='width:22rpx; height:12rpx;'></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='cell-box' wx:if="{{lesson.note}}">
|
||||
<view class='cell'>
|
||||
<image src='../../images/32@3x.png' mode='aspectFit'></image>
|
||||
<view class='title'>
|
||||
<text>注意事项</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='rich-box'>
|
||||
<rich-text nodes="{{lesson.note}}"></rich-text>
|
||||
</view>
|
||||
<!-- <view class='unfold' style='margin-top:20rpx' bindtap='openAnnouncements' wx:if="{{!isOpenAnnouncements}}">
|
||||
<text>展开</text>
|
||||
<image src='../../images/15@3x.png'></image>
|
||||
</view>
|
||||
<view class='unfold' bindtap='closeAnnouncements' wx:if="{{isOpenAnnouncements}}">
|
||||
<text>收起</text>
|
||||
<image src='../../images/48@3x.png' style='width:22rpx; height:12rpx;'></image>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class='cell-box'>
|
||||
<view class='cell'>
|
||||
<image src='../../images/35@3x.png' mode='aspectFit'></image>
|
||||
<view class='title'>
|
||||
<text>课程介绍</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class='rich-box' >
|
||||
<rich-text nodes="{{lesson.description}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='footer-btn' style='background: #767578' wx:if="{{lesson.btnStatus == 1}}">满额</view>
|
||||
<view class='footer-btn' style='background: #767578' wx:elif="{{lesson.btnStatus == 2}}">已开始</view>
|
||||
<view class='footer-btn' style='background: #767578' wx:elif="{{lesson.btnStatus == 3}}">已结束</view>
|
||||
<view class='footer-btn' bindtap='pushBookClasses' wx:elif="{{lesson.btnStatus == 0}}">课程预约</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class='share-btn-box'>
|
||||
<button open-type='share'></button>
|
||||
<image src='https://yingdd.oss-cn-hangzhou.aliyuncs.com/9bc27242fd0c9f9f08d867dc027cc82b.png' style='width:100%; height: 100%'></image>
|
||||
</view>
|
||||
212
pages/bookClassesDetail/index.wxss
Normal file
212
pages/bookClassesDetail/index.wxss
Normal file
@@ -0,0 +1,212 @@
|
||||
/* pages/bookClassesDetail/index.wxss */
|
||||
|
||||
.container {
|
||||
padding-bottom: 130rpx;
|
||||
min-height: calc(100vh - 330rpx);
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
height: 350rpx;
|
||||
}
|
||||
|
||||
.header image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.cell-box {
|
||||
margin: 30rpx 30rpx 0 30rpx;
|
||||
background: #1a191e;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 90rpx;
|
||||
padding: 0 20rpx;
|
||||
border-bottom: 2rpx solid #212025;
|
||||
}
|
||||
|
||||
.cell-box .cell.unline {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.cell-box .cell>image {
|
||||
width: 34rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell>text {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.cell-box .cell .more-text {
|
||||
flex: 1;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.cell-box .cell .more-text>text:first-child {
|
||||
margin-right: 58rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right .gps-img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.cell-box .cell .cell-right>text {
|
||||
height: 20rpx;
|
||||
margin-top: 6rpx;
|
||||
line-height: 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .coach-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.cell-box .coach-info>image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
.cell-box .coach-info .coach-text {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.cell-box .coach-info .coach-text .name {
|
||||
height: 26rpx;
|
||||
margin-bottom: 20rpx;
|
||||
color: #d1b32b;
|
||||
font-size: 26rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
.cell-box .coach-info .coach-text .info {
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
line-height: 30rpx;
|
||||
}
|
||||
|
||||
.cell-box .coach-info .coach-text .info.pack-up {
|
||||
height: 60rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.cell-box .unfold {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
padding: 0 30rpx 18rpx 0;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.cell-box .unfold>image {
|
||||
width: 12rpx;
|
||||
height: 22rpx;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.cell-box .rich-box {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 24rpx;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.cell-box .rich-box.pack-up {
|
||||
height: 48rpx;
|
||||
overflow: hidden;
|
||||
/* text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical; */
|
||||
}
|
||||
|
||||
.cell-box .cell .title {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.cell-box .rich-box {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 24rpx;
|
||||
padding: 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.cell-box .rich-box .wscnph {
|
||||
width: calc(100% - 10rpx);
|
||||
margin-left: 5rpx;
|
||||
}
|
||||
|
||||
.footer-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
background: #ffda2e;
|
||||
color: #1a191e;
|
||||
font-size: 32rpx;
|
||||
text-align: center;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
|
||||
.share-btn-box {
|
||||
position: fixed;
|
||||
right: 30rpx;
|
||||
bottom: 130rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
color: #1a191e;
|
||||
font-size: 24rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.share-btn-box>button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
font-size: 24rpx;
|
||||
color: #1a191e;
|
||||
}
|
||||
.share-btn-box>button::after {
|
||||
border: none;
|
||||
}
|
||||
Reference in New Issue
Block a user