[006]小程序系列 | 简单实现电影院选座位Demo
生活随笔
收集整理的這篇文章主要介紹了
[006]小程序系列 | 简单实现电影院选座位Demo
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
效果:
渲染:
邏輯層:
const {$Message } = require('../../dist/base/index'); Page({/*** 頁面的初始數據*/data: {visible1: false,nameSeatOn: '',allS: '',onS: '',itemS: '',selectSeat: '',seatAll: [],seatClumn: [],spinShow: false},/*** 生命周期函數--監聽頁面加載*/onLoad: function(options) {let _this = thisconst db = wx.cloud.database()let tempSeatClumn = []let tempSeatAll = []_this.setData({spinShow: true})db.collection('sXuns_seatClumn').get().then(res => {for (let i = 0; i < res.data.length; i++) {tempSeatClumn.push(res.data[i])}_this.setData({seatClumn: tempSeatClumn})})db.collection('sXuns_seatAll').get().then(res => {for (let i = 0; i < res.data.length; i++) {tempSeatAll.push(res.data[i])}_this.setData({seatAll: tempSeatAll})})setTimeout(res => {_this.setData({spinShow: false})}, 1500)},clickSeat: function(res) {let _this = thislet all = res.currentTarget.dataset.alllet on = res.currentTarget.dataset.onlet item = res.currentTarget.dataset.itemlet temp = ''if (on == "A") {temp = _this.data.seatAll[all].A[item]} else {temp = _this.data.seatAll[all].B[item]}if (temp.name) {_this.setData({nameSeatOn: temp.nameSeat + ":" + temp.name})this.setData({visible1: true});} else {if (_this.data.selectSeat != temp.nameSeat) {_this.setData({selectSeat: temp.nameSeat})} else {_this.setData({allS: all,onS: on,itemS: item,selectSeat: ''})}}console.log("數據", _this.data.nameSeatOn)},handleClose1() {this.setData({visible1: false});},submitApplication: function() {$Message({content: '已提交后臺審核',type: 'success'});} })樣式:
.view-price {display: flex;flex-flow: row wrap;justify-content: space-around;padding: 20rpx 0rpx;border-bottom: #dcdcdc solid 2rpx;background: white; }.view-price-num {height: 60rpx;line-height: 60rpx;font-size: 30rpx;border: #dcdcdc solid 2rpx;width: 148rpx;text-align: center;display: flex; }.view-price-img {width: 30rpx;height: 30rpx;padding: 16rpx 10rpx; }.view-all {display: flex;flex-direction: row;}.view-price-column {display: flex;flex-flow: column wrap;justify-content: space-around;padding: 20rpx 10rpx;border-bottom: #dcdcdc solid 2rpx;background: white;width: 20%; }.view-price-column-num {height: 260rpx;line-height: 270rpx;font-size: 20rpx;border: #dcdcdc solid 1rpx;width: 148rpx;text-align: center;display: flex;color: #fff; }.view-price-column-num:last-child{height: 40rpx;line-height: 30rpx;font-size: 20rpx;border: #dcdcdc solid 1rpx;width: 148rpx;text-align: center;display: flex;color: #666; }.view-up-seat {margin: 0 auto;background: #fff;height: 170rpx;margin-top: 10rpx;display: flex;flex-direction: column; }.view-left-seat-up {display: flex;flex-direction: row; }.view-price-img-up {width: 60rpx;height: 60rpx;margin: 3rpx; }.view-bottom-seat{background: #ce590c;text-align: center;color: #fff;height: 40rpx;line-height: 34rpx; }.view-seat-all{width: 90%;margin: 0 auto;font-size: 24rpx; }總結
以上是生活随笔為你收集整理的[006]小程序系列 | 简单实现电影院选座位Demo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 机载雷达导论-学习笔记
- 下一篇: 基于simulink的三相PWM电压型逆