作者 朱振飞

1212121

正在显示 65 个修改的文件 包含 4740 行增加0 行删除

要显示太多修改。

为保证性能只显示 65 of 65+ 个文件。

//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
console.log(res)
let tempCode = res.code;
wx.setStorageSync('tempCode', res.code)
wx.getUserInfo({
lang: 'zh_CN',
success: ret => {
this.globalData.userInfo = ret.userInfo
let params = {
code: tempCode,
nickName: ret.userInfo.nickName,
avatarUrl: ret.userInfo.avatarUrl,
gender: ret.userInfo.gender
}
let codeurl = '/Portal/Index/getOpenid';
this.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
if(res.res== '0'){
wx.setStorageSync('register', false)
}else{
wx.setStorageSync('register', true)
}
wx.hideNavigationBarLoading();
wx.hideLoading();
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.hideNavigationBarLoading();
wx.hideLoading();
});
}
})
// 发送 res.code 到后台换取 openId, sessionKey, unionId
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
let params = {
code: tempCode,
userInfo: res.userInfo
}
let codeurl = '/Portal/Index/getOpenid';
this.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
if(res.res== '0'){
wx.setStorageSync('register', false)
}else{
wx.setStorageSync('register', true)
}
wx.hideNavigationBarLoading();
wx.hideLoading();
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.hideNavigationBarLoading();
wx.hideLoading();
});
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回、
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
} else {
console.log(JSON.stringify(res));
}
}
})
}
})
},
post: function (url, data) {
/**
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
wx.showLoading({
title: '加载中',
})
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
let baseUrl = 'https://fdjc.wx.bronet.cn/index.php';
// postData.signature = that.makeSign(postData);
//网络请求
wx.request({
url: baseUrl + url,
data: postData,
method: 'POST',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: function (res) {//返回取得的数据
if (res.data.code == 0) {
resolve(res.data.data);
} else {//返回错误提示信息
reject(res.data.msg);
}
setTimeout(function () {
wx.hideLoading()
wx.hideNavigationBarLoading()
}, 1500)
},
error: function (e) {
console.log(e)
reject('网络出错');
wx.hideLoading()
wx.hideNavigationBarLoading()
}
})
});
return promise;
},
getopenid(obj){
},
globalData: {
userInfo: null,
hasUserInfo: null,
register: false
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/book/booklist",
"pages/book/speed/speed",
"pages/register/register",
"pages/personal/personal",
"pages/book/birdTickt/birdTickt",
"pages/playBook/playBook",
"pages/book/bookaction/bookaction",
"pages/rank/rank",
"pages/signIn/sigInResult/sigInResult",
"pages/signIn/signIn",
"pages/electrPer/electrPer",
"pages/book/lineUp/lineUp",
"pages/article/article",
"pages/article/articleDetail/articleDetail",
"pages/logs/logs",
"pages/index/index",
"pages/book/paidui/paidui"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#000",
"navigationBarTitleText": "复旦剧社",
"navigationBarTextStyle": "white"
}
}
\ 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;
}
.menu_bottom{
padding-bottom: 110rpx;
}
/*底部菜单按钮*/
.menu_items{
height: 100rpx;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
background-color: #FFF;
z-index: 99;
}
.menu_item{
flex:1;
align-items: center;
justify-content: center;
display: flex;
flex-flow: column;
font-size: 20rpx;
}
.menu_item.active{
color: #696969;
}
.icon{
width: 40rpx;
height: 40rpx;
position: relative;
}
.icon::after{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.article:after{
background:url('http://fdjc.wx.bronet.cn/public/images/icon7.png');
background-size: cover;
}
.active .article:after{
background: url(http://fdjc.wx.bronet.cn/public/images/icon8.png);
background-size: cover;
}
.book:after{
background:url('http://fdjc.wx.bronet.cn/public/images/icon9.png');
background-size: cover;
}
.active .book:after{
background: url(http://fdjc.wx.bronet.cn/public/images/icon10.png);
background-size: cover;
}
.person:after{
background:url('http://fdjc.wx.bronet.cn/public/images/icon11.png');
background-size: cover;
}
.active .person:after{
background: url(http://fdjc.wx.bronet.cn/public/images/icon12.png);
background-size: cover;
}
.nomoredata{
font-size:26rpx;
color: #CFCFCF;
align-items: center;
justify-content: center;
padding:30rpx 0;
background-color: #F1F1F1;
display: none;
}
.nomoredata.active{
display: flex
}
.nodata{
height: 60%;
background-color: #F1F1F1;
display:none;
align-items:center;
justify-content:center;
flex-flow: column;
font-size: 26rpx;
color: #C1C1C1;
}
.nodatsImage{
width:205rpx;
height: 223rpx;
margin-bottom: 145rpx;
}
.gray_container{
height: 100vh;
background-color: #F1F1F1;
}
.has_bottom{
padding-bottom: 100rpx;
overflow: auto;
}
/*公共字体*/
@font-face {
font-family: 'iconfont'; /* project id 590930 */
src: url('//at.alicdn.com/t/font_590930_ed34kxpx17uba9k9.eot');
src: url('//at.alicdn.com/t/font_590930_ed34kxpx17uba9k9.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_590930_ed34kxpx17uba9k9.woff') format('woff'),
url('//at.alicdn.com/t/font_590930_ed34kxpx17uba9k9.ttf') format('truetype'),
url('//at.alicdn.com/t/font_590930_ed34kxpx17uba9k9.svg#iconfont') format('svg');
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
color: #FFF;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-xiala:before { content: "\e6b9"; }
.icon-wode001:before { content: "\e634"; }
.icon-xingxing:before { content: "\e642"; }
.icon-shangla:before { content: "\e61d"; }
.icon-wenzhang1:before { content: "\e659"; }
.icon-yuyuezidongtoubiao:before { content: "\e63d"; }
.icon-duigou:before { content: "\e730"; }
... ...
// components/menu/menu.js
const menu = {
tapmenu(e){
wx.setStorageSync('type', e.currentTarget.id)
let type = e.currentTarget.id
let naigateUrl = type=="article"?'/pages/article/article':type=='book'?'/pages/book/booklist':type=='personal'?'/pages/personal/personal':''
wx.redirectTo({
url: naigateUrl,
})
}
}
export default menu
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--components/menu/menu.wxml-->
<!--menu-->
<template name='bottomMenu'>
<view class='menu_items'>
<view class='menu_item {{type=="article"?"active":""}}' id='article' bindtap='tapmenu' >
<view class='article icon'></view>
<view class='menu_item'>文章</view>
</view>
<view class='menu_item {{type=="book"?"active":""}}' id='book' bindtap='tapmenu' >
<view class='book icon'></view>
<view class='menu_item'>预约</view>
</view>
<view class='menu_item {{type=="personal"?"active":""}}' id='personal' bindtap='tapmenu' >
<view class='person icon'></view>
<view class='menu_item'>我的</view>
</view>
</view>
</template>
... ...
/* components/menu/menu.wxss */
\ No newline at end of file
... ...
// pages/article/article.js
const app = getApp();
import menu from '../../components/menu/menu'
Page({
/**
* 页面的初始数据
*/
data: {
currentPage: 1,
pageSize: 10,
articleList:[],
type: wx.getStorageSync('type')
},
loadItems() {
let url = '/Portal/Arc/arclist';
let that = this;
app.post(url, { page: this.data.currentPage }).then((res) => {
let temp = that.data.articleList;
for( let obj of res){
temp.push(obj)
}
that.setData({
articleList: temp
})
}).catch((errMsg) => {
wx.showToast({
title:errMsg
})
})
},
tapmenu(e){
menu.tapmenu(e);
},
articelDetail(e){
let id = e.currentTarget.id;
wx.navigateTo({
url:'articleDetail/articleDetail?id='+id
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.loadItems()
this.setData({
type: wx.getStorageSync('type')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// this.loadItems();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
// 显示顶部刷新图标
wx.showNavigationBarLoading();
this.setData({
currentPage: currentPage+1
})
this.loadItems();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/article/article.wxml-->
<import src="/components/menu/menu" />
<template is="bottomMenu" data='{{type:type}}' />
<view class='gray_container '>
<view class='article_items has_bottom'>
<view class='article_item' wx:for='{{articleList}}' wx:key='' bindtap='articelDetail' id='{{item.id}}'>
<image src='{{item.pic}}'></image>
<!--information -->
<view class='article_information_bg'>
<view class='article_information_title'>{{item.title}}</view>
<view class='articel_information_author'>{{item.pst_author}}</view>
<view class='articel_information_author'>{{item.post_modified}}</view>
</view>
</view>
</view>
<view class='article_nodata {{articleList.length==0||articleList==null?"active":""}}' >
还没有相关文章哦
</view>
</view>
... ...
/* pages/article/article.wxss */
.article_item{
height: 310rpx;
position: relative;
border-bottom: 1rpx solid rgba(241,241,241,0.1);
background: #000;
}
.article_item image{
width: 100%;
height: 100%
}
.article_information_bg{
width: 300rpx;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-image: url('http://fdjc.wx.bronet.cn/public/images/mask.png');
background-size: cover;
display: flex;
box-sizing: border-box;
padding-left: 40rpx;
flex-flow: column;
justify-content: center;
}
.article_information_title{
font-size: 30rpx;
color: #000;
font-weight: bold;
margin-bottom: 35rpx;
}
.articel_information_author{
font-size: 26rpx;
color:#000;
}
.article_nodata{
height: 600rpx;
justify-content: center;
align-items: center;
font-size: 26rpx;
color: #333;
display: none;
}
.article_nodata.active{
display: flex;
}
\ No newline at end of file
... ...
// pages/article/articleDetail/articleDetail.js
const app = getApp();
var WxParse = require('../../../wxParse/wxParse.js');
import menu from '../../../components/menu/menu'
Page({
/**
* 页面的初始数据
*/
data: {
id:'',
detail:{},
contentHtml:'',
type: wx.getStorageSync('type')
},
tapmenu(e){
menu.tapmenu(e);
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.id,
type: wx.getStorageSync('type')
})
this.articleDetail();
},
articleDetail(){
let that = this;
let url = 'Portal/Arc/info';
app.post(url,{id: this.data.id}).then((res) =>{
this.setData({
detail: res
})
WxParse.wxParse('contentHtml', 'html', res.post_content, that, 5);
}).catch((errMsg) =>{
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/article/articleDetail/articleDetail.wxml-->
<import src="/components/menu/menu" />
<template is="bottomMenu" data = '{{type:type}}'/>
<view class='main_container'>
<view class='article_detail has_bottom'>
<view class='article_top_banner'>
<image src='{{detail.pic}}'></image>
</view>
<view class='article_detail_info'>
<view class='article_title'>{{detail.post_title}}</view>
<view class='article_author'>作者:{{detail.post_author}}</view>
<view class='article_author'>发表时间:{{detail.post_date}}</view>
<!--文章详情-->
<view class='article_content'>
<import src="/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:contentHtml.nodes}}"/>
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/article/articleDetail/articleDetail.wxss */
@import "/wxParse/wxParse.wxss";
.article_top_banner image{
width: 100%;
height: 310rpx;
}
.article_detail_info{
width: 650rpx;
margin: 0 auto;
}
.article_title{
font-size: 34rpx;
color: #000;
line-height: 68rpx;
}
.article_author{
font-size: 26rpx;
color: #000;
}
.article_content{
font-size: 28rpx;
color: #000;
margin-top: 32rpx;
}
.article_content image{
width: 100%;
}
\ No newline at end of file
... ...
// pages/book/bookaction/bookaction.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
playDetail:{},
times:[],
index:0,
hid:'',
item_id:'',
num: 1,
type: 'none',
authInfo:false,
creat: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let openid = wx.getStorageSync('openid');
if(openid){
this.setData({
hid:options.id,
authInfo: true
})
}else{
this.setData({
hid:options.id
})
}
this.playDetail();
},
playDetail(){
let id = this.data.hid
let url = '/Portal/Drama/appCan'
let tempItems = [{
name: '请选择预约场次',
id: '000',
hid: '000'
}]
app.post(url,{id:id}).then((res) =>{
res.enddate = res.enddate.substring(res.enddate.indexOf('-')+1,res.enddate.length);
for(let obj of res.item){
let tempstr = {
name:obj.title+' '+obj.date+' '+obj.start+'-'+obj.end,
id: obj.id,
hid: obj.hid
}
tempItems.push(tempstr)
}
this.setData({
playDetail: res,
times: tempItems,
item_id: '000',
hid: '000'
})
console.log(this.data.times)
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
playChoose(e){
this.setData({
item_id: this.data.times[e.detail.value].id,
index: e.detail.value,
hid: this.data.times[e.detail.value].hid,
})
},
getnum(e){
this.setData({
num: e.currentTarget.dataset.num
})
},
getUserInfo: function (e) {
// 登录
let code ;
if (e.detail.userInfo) {
this.setData({
authInfo: true
})
wx.login({
success: (res) => {
code = res.code;
let codeurl = '/Portal/Index/getOpenid';
let params = {
code: code,
gender: e.detail.userInfo.gender,
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
}
app.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
if(res.res=='0'){
this.setData({
register: false
})
wx.showModal({
title: '提示',
content: '您还没有注册,请先注册',
success: function(res){
if(res.confirm){
wx.navigateTo({
url: '../../register/register',
})
}
}
})
}else{
this.setData({
authInfo: true
})
this.subBook();
}
wx.hideNavigationBarLoading();
wx.hideLoading();
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.hideNavigationBarLoading();
wx.hideLoading();
});
}
})
app.globalData.userInfo = e.detail.userInfo
this.setData({
userName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
authInfo: true
})
}else{
this.setData({
authInfo: false
})
}
},
subBook(){
let url = '/Portal/Drama/gobird';
let that = this;
var openid = wx.getStorageSync('openid');
if(openid !==''){
if (that.data.item_id == '000') {
wx.showModal({
title: '提示',
content: '请选择预约场次',
showCancel: false
})
} else {
let params = {
openid: openid,
hid: that.data.hid,
item_id: that.data.item_id,
num: that.data.num
}
this.setData({
type: 'fail'
})
console.log(params)
app.post(url,params).then((res) =>{
console.log(res)
wx.showToast({
title: '进入早鸟票'
})
let url = res
wx.downloadFile({
url: url,
success: function (res) {
//如果二维码中的id为固定值可以将图片保存到本地,否则不用保存
console.log(res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function (res) {
wx.hideLoading()
wx.showToast({
icon: 'none',
title:'图片保存成功,可以分享到朋友圈'
})
that.setData({
creat: true
})
setTimeout(function(){
that.setData({
creat: false
})
},1500)
},
fail: function (res) {
wx.showModal({
title:'提示',
content:'图片保存失败',
showCancel: false
})
console.log(res)
}
})
},
fail: function (res) {
wx.showModal({
title:'提示',
content:'图片保存失败,请重试',
showCancel: false
})
}
})
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
}
}else{
this.setData({
authInfo: false
})
}
},
closemask(){
this.setData({
type: 'none'
})
wx.navigateTo({
url:'../booklist'
})
},
// 放弃
giveup(){
this.setData({
type: 'none'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
let openid = wx.getStorageSync('openid')
return {
title: '我在复旦剧社抢票,快来帮我加速吧!',
path: '/pages/book/speed/speed?id=' + this.data.item_id,
success: function (res) {
// 转发成功
},
fail: function (res) {
// 转发失败
}
}
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/birdTickt/birdTickt.wxml-->
<view class='book_container'>
<view class='book_box'>
<view class='book_top'>
演出预约
</view>
<!--预约主体 -->
<view class='book_main'>
<view class='book_main_top '>请选择</view>
<view class='form_input main_select iconfont icon-xiala'>
<picker bindchange="playChoose" value="{{index}}" id='{{times[index].id}}' range="{{times}}" range-key="name">
<view class="picker" > {{times[index].name}}</view>
</picker>
</view>
<view class='book_main_top'>请选择预约人数</view>
<!--复选框 -->
<view class='num_box'>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{num==1?"icon-duigou":""}}' data-num='1' bindtap='getnum'>
</view>
1
</view>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{num==2?"icon-duigou":""}}' data-num='2' bindtap='getnum'>
</view>
2
</view>
</view>
</view>
</view>
<view class='note'>
早鸟票截止时间:{{playDetail.kaidate}}
</view>
<view class='stop_btn' wx:if="{{authInfo}}" bindtap='subBook'>去抢早鸟票</view>
<button class='userinfo-name stop_btn' wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo">去抢早鸟票</button>
</view>
... ...
/* pages/book/birdTickt/birdTickt.wxss */
/* pages/playBook/playBook.wxss */
@import '../bookaction/bookaction.wxss';
.book_box{
width: 718rpx;
margin: 16rpx auto 0;
box-shadow: 1rpx 1rpx 10rpx 1rpx #BABABA;
border-radius: 8rpx;
}
.book_top{
height: 88rpx;
background-color: #FFDD75;
display: flex;
font-size: 30rpx;
align-items: center;
color: #000;
padding-left: 35rpx;
}
.book_main{
width: 614rpx;
margin: 0 auto;
}
.book_main{
font-size: 26rpx;
color: #000;
height: 800rpx;
}
.book_main_top{
padding: 50rpx 0;
}
.main_select{
width: 100%;
margin-bottom: 100rpx;
border: none;
border-bottom: 1rpx solid #F1F1F1;
}
.num_box{
margin-top: 46rpx;
}
.note{
font-size: 24rpx;
display: flex;
justify-content: center;
margin-top: 78rpx;
margin-bottom: 50rpx;
}
.stop_btn{
width: 470rpx;
height: 88rpx;
align-items: center;
justify-content: center;
font-size: 26rpx;
background-color: #F1F1F1;
margin: 0 auto;
display: flex;
background: #FFDD75;
}
.mask{
display: flex;
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%);
font-size: 24rpx;
color: #FFF;
padding: 20rpx 15rpx;
width: 320rpx;
height: 70rpx;
align-items: center;
text-align: center;
justify-content: center;
border-radius: 10rpx;
line-height: 1.5
}
\ No newline at end of file
... ...
// pages/book/bookaction/bookaction.js
const app = getApp();
var WxParse = require('../../../wxParse/wxParse.js')
import menu from '../../../components/menu/menu'
Page({
/**
* 页面的初始数据
*/
data: {
playDetail:{},
times:[],
index:0,
hid:'',
item_id:'',
num: 1,
subtype: 'none',
type: wx.getStorageSync('type'),
id:'',
timeName:'',
open: false,
authInfo: false,
playerHtml: '',
playerOpen: false,
descriptionHtml: ''
},
tapmenu(e){
menu.tapmenu(e);
},
open(){
this.setData({
open: !this.data.open
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let openid = wx.getStorageSync('openid');
if(openid){
this.setData({
hid:options.id,
authInfo: true
})
}else{
this.setData({
hid:options.id
})
}
this.playDetail();
},
playDetail(){
let id = this.data.hid
let url = '/Portal/Drama/appCan'
let tempItems = [{
name:'请选择预约场次',
id:'000',
hid:'000'
}]
app.post(url,{id:id}).then((res) =>{
this.setData({
playDetail: res
})
res.enddate = res.enddate.substring(res.enddate.indexOf('-') + 1, res.enddate.length);
if (res.item.length > 0) {
for (let obj of res.item) {
let tempstr = {
name: obj.title + ' ' + obj.date + ' ' + obj.start + '-' + obj.end,
id: obj.id,
hid: obj.hid
}
tempItems.push(tempstr)
}
}
this.setData({
times: tempItems,
item_id: '000',
hid: '000',
timeName: tempItems[0].name
})
WxParse.wxParse('playerHtml', 'html', res.workman, this, 5);
WxParse.wxParse('descriptionHtml', 'html', res.description, this, 5);
}).catch((errMsg) =>{
})
},
playChoose(e){
this.setData({
item_id: this.data.times[e.detail.value].id,
hid: this.data.times[e.detail.value].hid,
timeName: this.data.times[e.detail.value].id.name,
index: e.detail.value
})
},
getnum(e){
this.setData({
num: e.currentTarget.dataset.num
})
},
player(){
this.setData({
playerOpen: !this.data.playerOpen
})
},
getUserInfo: function (e) {
// 登录
let code ;
if (e.detail.userInfo) {
this.setData({
authInfo: true
})
wx.login({
success: (res) => {
code = res.code;
let codeurl = '/Portal/Index/getOpenid';
let params = {
code: code,
gender: e.detail.userInfo.gender,
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
}
app.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
if(res.res=='0'){
this.setData({
register: false
})
wx.redirectTo({
url: '../register/register',
})
}else{
this.setData({
authInfo: true
})
this.subBook();
}
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
});
}
})
app.globalData.userInfo = e.detail.userInfo
this.setData({
userName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
authInfo: true
})
this.subBook();
}else{
this.setData({
authInfo: false
})
}
},
subBook(){
let url = '/Portal/Drama/appoint';
let that = this;
let openid = wx.getStorageSync('openid');
if(this.data.playDetail.item.length<1){
wx.showModal({
title: '提示',
content: '暂无可预约场次',
showCancel: false
})
}else{
if(that.data.hid=='000'){
wx.showModal({
title: '提示',
content: '请选择预约场次',
showCancel: false
})
}else{
let params = {
openid: openid,
hid: that.data.hid,
item_id: that.data.item_id,
num: that.data.num
}
app.post(url,params).then((res) =>{
wx.showToast({
title: res,
})
setTimeout(function () {
wx.navigateBack({})
}, 1000);
}).catch((res) =>{
if(res=='未注册无法预约'){
wx.showModal({
title: '提示',
content: res,
success: function(res){
if(res.confirm){
wx.navigateTo({
url: '../../register/register',
})
}
}
})
} else if (res =='该剧预约已满'){
this.setData({
subtype: 'fail'
})
} else{
wx.showModal({
title: '提示',
content: res,
showCancel: false
})
}
})
}
}
},
closemask(){
this.setData({
subtype: 'none'
})
wx.navigateTo({
url:'../booklist'
})
},
// 放弃
giveup(){
this.setData({
subtype: 'none'
})
},
// 进入Waitlist
waitlist(){
let that = this;
let openid = wx.getStorageSync('openid');
let params = {
openid: openid,
hid: that.data.hid,
item_id: that.data.item_id,
num: that.data.num
}
let url = '/Portal/Drama/gowait'
app.post(url,params).then((res) =>{
wx.navigateTo({
url:'../lineUp/lineUp?item_id='+ that.data.item_id
})
}).catch((res) =>{
wx.showModal({
title: '提示',
content: res,
showCancel: false,
success: function(res){
console.log(res)
if(res.confirm){
that.setData({
subtype: 'none'
})
}
}
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/bookaction/bookaction.wxml-->
<import src="/components/menu/menu" />
<template is="bottomMenu" data = '{{type:type}}'/>
<view class='book_container has_bottom'>
<view class='book_list'>
<image src='{{playDetail.thumb}}'></image>
<!--预约时间及操作 -->
<view class='book_mask'>
<!--bookInfo-->
<view class='bookinfo'>
<view class='bookinfo_title'>{{playDetail.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{playDetail.startdate}} - {{playDetail.enddate}}</view>
<view class='bookinfo_adress'>{{playDetail.place}}</view>
</view>
</view>
<view class='book_btn'>可预约</view>
</view>
</view>
<!--剧情梗概 -->
<view class='book_detail'>
<view class='book_label'>剧情梗概</view>
<view class='book_describle {{open?"auto":""}}'>
<import src="/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:descriptionHtml.nodes}}"/>
</view>
<view class='detail_open_ac'>
<view class='iconfont icon-xiala ac_icon' bindtap='open' wx:if="{{open}}">
收起
</view>
<view class='iconfont icon-shangla ac_icon' bindtap='open' wx:else>
展开
</view>
</view>
</view>
<!--演出人员 -->
<view class='book_detail player'>
<view class='book_label'>演出人员</view>
<view class='player_box'>
<view class='player_box players {{playerOpen?"playerOpen":""}}' decode="true">
<import src="/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:playerHtml.nodes}}"/>
</view>
</view>
<view class='detail_open_ac'>
<view class='iconfont icon-xiala ac_icon' bindtap='player' wx:if="{{playerOpen}}">
收起
</view>
<view class='iconfont icon-shangla ac_icon' bindtap='player' wx:else>
展开
</view>
</view>
</view>
<!--演出预约 -->
<view class='book_form'>
<view class='book_title'>演出预约</view>
<!--预约表格主体 -->
<view class='book_form_body'>
<view class='book_label'>请选择演出场次</view>
<view class='form_input iconfont icon-xiala'>
<picker bindchange="playChoose" value="{{index}}" id='{{times[index].id}}' data-hid='{{times[index].hid}}' range="{{times}}" range-key="name">
<view class="picker" > {{times[index].name}}</view>
</picker>
</view>
<view class='book_label book_num'>请选择预约人数</view>
<!--复选框 -->
<view class='num_box'>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{num==1?"icon-duigou":""}}' data-num='1' bindtap='getnum'>
</view>
1
</view>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{num==2?"icon-duigou":""}}' data-num='2' bindtap='getnum'>
</view>
2
</view>
</view>
<!--确认预约按钮-->
<button class='make_sure' wx:if="{{authInfo}}" bindtap='subBook'>确认预约</button>
<button class='userinfo-name make_sure' wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo">确认预约</button>
</view>
</view>
<!--弹窗 -->
<view class='mask {{subtype=="error"||subtype=="success"||subtype=="fail"?"active":""}}'></view>
<view class='err_tost toast'>
<image class='error_image' src='http://fdjc.wx.bronet.cn/public/images/icon3.png'></image>
<view class='toast_message'>请选择您的预约人数和场次</view>
<button class='back' bindtap='closemask'>返回</button>
</view>
<view class='success_tost toast {{subtype=="success"||subtype=="fail"?"active":""}}'>
<view class='success_title'>恭喜您预约成功!</view>
<image class='error_image' src='http://fdjc.wx.bronet.cn/public/images/icon4.png'></image>
<view class='opera_name'>剧名</view>
<view class='toast_message'>2018.10.25 18:00-19:00 2人您可以通过“我的”-“我的预约”查看或更改预约</view>
<button class='back' bindtap='closemask'>返回</button>
</view>
<!--fail-->
<view class='fail_tost toast {{subtype=="fail"?"active":""}}'>
<view class='success_title'>预约失败</view>
<image class='error_image' src='http://fdjc.wx.bronet.cn/public/images/icon5.png'></image>
<view class='opera_name'>非常抱歉当前场次的预约已满</view>
<view class='toast_message'>感谢您对复旦剧社的关注和支持您可以尝试预约其他场次或者在演出开始前排队成为现场观众 </view>
<button class='waitlist' bindtap='waitlist'>进入Waitlist</button>
<button class='forgive' bindtap='giveup'>放 弃</button>
</view>
</view>
\ No newline at end of file
... ...
/* pages/book/bookaction/bookaction.wxss */
@import "/wxParse/wxParse.wxss";
@import '../booklist.wxss';
.book_detail{
height: auto;
background-color: #000;
box-sizing: border-box;
padding: 30rpx 33rpx;
padding-bottom: 0;
color: #FFF;
overflow: hidden;
}
.book_label{
font-size: 28rpx;
}
.book_describle{
width: 650rpx;
height: 115rpx;
margin-left: 11rpx;
font-size: 26rpx;
line-height: 40rpx;
text-indent: 2em;
text-overflow: ellipsis;
overflow: hidden;
margin-top: 30rpx;
}
.book_describle.auto{
min-height: 115rpx;
height: auto;
}
.detail_open_ac{
width: 650rpx;
height: 80rpx;
margin: 0 auto;
display: flex;
justify-content: flex-end;
}
.ac_icon{
height: 100%;
display: flex;
align-items: center;
font-size: 22rpx;
position: relative;
padding-left: 30rpx;
}
.ac_icon::before{
position: absolute;
left: 0;
}
.player{
background-color: #F1F1F1;
color: #000;
height: auto;
}
.players{
height: 68px;
overflow: hidden;
font-size: 24rpx;
line-height: 45rpx;
margin-left: 105rpx;
}
.players.playerOpen{
min-height: 68rpx;
height: auto;
}
.player_introduce{
display: flex;
}
.player_cheer{
width: 65rpx;
display: flex;
position: relative;
justify-content: space-between;
text-align: justify;
}
.player_cheer:after{
content: ':';
}
.player_name{
margin-left: 200rpx;
}
.insert{
margin-left: 89rpx
}
.plpayerList .player_cheer:after{
content: ''
}
.plpayerList .player_name{
margin-left: 90rpx;
}
.player .iconfont{
color: #C1C1C1;
}
.book_form{
padding: 0 50rpx;
font-size: 24rpx;
color: #000;
}
.book_title{
font-size: 28rpx;
padding: 40rpx 0;
}
.form_input{
width: 100%;
height: 72rpx;
padding-left: 18rpx;
border: 1px solid #D0D0D0;
margin:40rpx 0;
box-sizing: border-box;
position: relative;
font-size: 24rpx;
}
.form_input:before{
position: absolute;
right: 15rpx;
top: 50%;
transform: translateY(-50%);
color: #C1C1C1;
font-size: 48rpx;
}
.book_num{
margin-top: 87rpx;
margin-bottom: 56rpx;
}
.num_box{
display: flex;
margin-bottom: 146rpx;
}
.num_box_item{
display: flex;
margin-right: 136rpx;
align-items: center;
font-size: 28rpx;
}
.num_box_warp{
width: 50rpx;
height: 50rpx;
border: 1px solid #D0D0D0;
margin-right: 42rpx;
color: #D0D0D0;
font-size: 48rpx;
}
.make_sure{
height: 88rpx;
width: 558rpx;
margin-bottom: 100rpx;
background-color: #FFDD75;
border: none;
font-size: 26rpx;
color: #000;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.mask{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.7);
z-index: 999;
display: none;
}
.mask.active{
display: block;
}
.toast{
width: 542rpx;
background-color: #fff;
position: fixed;
z-index: 1000;
left: 50%;
top: 45%;
transform: translate(-50%,-50%);
/* display: flex; */
justify-content: center;
align-items: center;
padding-top: 75rpx;
padding-bottom: 80rpx;
flex-flow: column;
font-size: 28rpx;
border-radius: 10rpx;
display: none;
}
.toast.active{
display: flex;
}
.error_image{
width: 105rpx;
height: 111rpx;
}
.toast_message{
width: 411rpx;
margin-top: 30rpx;
margin-bottom: 70rpx;
text-align: center;
}
.err_toast{
display: none;
}
.back{
background-color: #FFDD75;
width: 200rpx;
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
}
.opera_name{
margin-top: 32rpx;
}
.success_title{
margin-bottom: 40rpx;
}
.waitlist{
width: 300rpx;
height: 72rpx;
font-size: 28rpx;
background-color: #FFDD75;
}
.forgive{
width: 300rpx;
height: 72rpx;
margin-top: 24rpx;
font-size: 28rpx;
display: flex;
border: 1rpx #C1C1C1 solid;
border-radius: 8rpx;
align-items: center;
justify-content: center;
}
.book_form_body{
font-size: 24rpx;
margin: 0 45rpx;
}
.picker{
height: 72rpx;
display: flex;
align-items: center;
color: #333;
position: relative;
z-index: 2;
}
\ No newline at end of file
... ...
// pages/book/booklist.js
const app = getApp();
import menu from '../../components/menu/menu'
Page({
/**
* 页面的初始数据
*/
data: {
playList:null,
page:1,
nodata:false,
type: 'book'
},
// 话剧列表
playItems(){
let url = '/Portal/Drama/index';
let that = this;
let params = {
page: this.data.page
}
app.post(url,params).then((res) =>{
let tempList = [];
console.log(res.length)
if(res.length>0){
for(let obj of res){
obj.enddate = obj.enddate.substring(obj.enddate.indexOf('-')+1,obj.enddate.length)
tempList.push(obj)
}
that.setData({
playList: tempList
})
}else{
that.setData({
nodata: true
})
}
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg ,
showCancel: false
})
})
},
tapmenu(e){
menu.tapmenu(e);
},
// 可预约操作
book(e){
console.log(e)
let id = e.currentTarget.id
wx.navigateTo({
url: 'bookaction/bookaction?id='+id
})
},
bookBirdTickt(e){
console.log(e)
let id = e.currentTarget.id
wx.navigateTo({
url: 'birdTickt/birdTickt?id='+id
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({
title: '加载中',
})
this.playItems()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/booklist.wxml-->
<import src="/components/menu/menu" />
<template is="bottomMenu" data = '{{type:type}}'/>
<view class='gray_container'>
<view class='book_lists has_bottom'>
<view class='book_list' wx:for='{{playList}}' wx:key=''>
<image src='{{item.thumb}}'></image>
<!--预约时间及操作 -->
<view class='book_mask'>
<!--bookInfo -->
<view class='bookinfo'>
<view class='bookinfo_title'>{{item.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>
<view>{{item.startdate}} - {{item.enddate}}</view>
<!-- <view>{{item.data}}</view> -->
</view>
<view class='bookinfo_adress'>({{item.place}})</view>
</view>
</view>
<view class='book_btn' wx:if="{{item.type==0}}" bindtap='book' id='{{item.id}}'>可预约</view>
<view class='book_btn' wx:elif="{{item.type==1}}" bindtap='bookBirdTickt' id='{{item.id}}'>早鸟票</view>
<view class='book_btn' wx:else>已停止</view>
</view>
</view>
</view>
<!--nodata -->
<view class='nomoredata {{ (0<playList.length&&playList.length<3)?"active":""}}'>
更多精彩演出,敬请期待!
</view>
<view class='nodata {{nodata?"active":""}}' >
<image src='http://fdjc.wx.bronet.cn/public/images/icon1.png' class='nodatsImage'></image>
<text>精彩演出,敬请期待!</text>
</view>
</view>
... ...
/* pages/book/booklist.wxss */
.book_list{
width: 100%;
height: 430rpx;
position: relative;
border-bottom: 1rpx solid #333;
overflow: hidden;
}
.book_list image{
height: 100%;
width: 100%;
}
.book_mask{
height: 140rpx;
width: 100%;
position: absolute;
bottom: 0;
box-sizing: border-box;
display: flex;
padding: 0 16rpx 0 24rpx;
font-size: 34rpx;
align-items: center;
justify-content: space-between;
background-color: rgba(0,0,0,.68);
}
.bookinfo{
display: flex;
flex-flow: column;
color: #FFF;
}
.book_btn{
width: 126rpx;
height: 72rpx;
background-color: #FFDD75;
color: #000;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
border-radius: 10rpx;
}
.bookinfo_time_adress{
font-size: 24rpx;
display: flex;
align-items: center;
margin-top: 12rpx;
}
.bookinfo_adress{
margin-left: 35rpx;
}
.nodata.active{
display: flex
}
\ No newline at end of file
... ...
// pages/book/lineUp/lineUp.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
item_id:'',
num: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
item_id: options.item_id
})
this.rankDetail()
},
rankDetail(){
let url = '/Portal/Center/waitlist'
let params = {
openid : wx.getStorageSync('openid'),
item_id : this.data.item_id
}
app.post(url,params).then((res) =>{
this.setData({
num:res
})
}).catch((errMsg) =>{
wx.showModal({
title: '',
content: '',
})
})
},
// 不排了
cancel(){
let url = '/Portal/Center/canelwait'
let params = {
id: this.data.item_id
}
app.post(url, params).then((res) => {
wx.showToast({
title: '取消成功',
})
setTimeout(function(){
wx.navigateTo({
url: '../../personal/personal',
})
},1000)
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
})
})
},
// confirm
confirm(){
wx.navigateTo({
url: '../../personal/personal',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/lineUp/lineUp.wxml-->
<view class='w_container'>
<view class='line_container'>
<view class='line_top'>恭喜你</view>
<view class='line_content'>
<view class='text_line'>您已成功进入后补名单</view>
<view class='text_line'>您前方还有{{num}}人等待正在排队中</view>
<view class='text_line'>请耐心等待</view>
<view class='text_line line_jiange'>如预约成功</view>
<view class='text_line'>我们会以短信通知您</view>
</view>
</view>
<!--操作按钮 -->
<view class='line_btn cover_bg' bindtap="confirm">确定</view>
<view class='line_btn' bindtap='cancel'>不排了</view>
</view>
... ...
/* pages/book/lineUp/lineUp.wxss */
.w_container{
height: 100vh;
width: 100%;
overflow: hidden;
background-color: #FFF;
}
.line_container{
width: 718rpx;
margin: 16rpx auto 127rpx;
height: 628rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx #ccc;
border-radius: 8rpx 8rpx 0 0;
}
.line_top{
height: 88rpx;
background-color: #FFDD75;
display: flex;
font-size: 36rpx;
align-items: center;
justify-content: center;
color: #000;
}
.line_content{
font-size: 30rpx;
color: #000;
}
.text_line{
text-align: center;
line-height: 60rpx;
}
.text_line:first-child{
margin-top: 70rpx;
}
.line_jiange{
margin-top: 60rpx;
}
.line_btn{
width: 350rpx;
height: 88rpx;
font-size: 26rpx;
color: #000;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #C1C1C1;
border-radius: 8rpx;
margin: 0 auto 40rpx;
}
.cover_bg{
background-color: #FFDD75;
}
\ No newline at end of file
... ...
// pages/book/lineUp/lineUp.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
item_id: '',
num: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
item_id: options.itemid,
id: options.id
})
this.rankDetail()
},
rankDetail() {
let url = '/Portal/Center/waitlist'
let params = {
openid: wx.getStorageSync('openid'),
item_id: this.data.item_id
}
app.post(url, params).then((res) => {
this.setData({
num: res
})
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
})
})
},
// 不排了
cancel() {
let url = '/Portal/Center/canelwait'
let params = {
id: this.data.id
}
app.post(url, params).then((res) => {
wx.showToast({
title: '取消成功',
})
setTimeout(function(){
wx.navigateTo({
url: '../../personal/personal',
})
},1000)
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
})
})
},
// confirm
confirm() {
wx.navigateTo({
url: '../../personal/personal',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/lineUp/lineUp.wxml-->
<view class='w_container'>
<view class='line_container'>
<view class='line_top'>请耐心等待</view>
<view class='line_content'>
<view class='text_line'>正在排队中</view>
<view class='text_line'>您前方还有{{num}}人等待</view>
<view class='text_line line_jiange'>如预约成功</view>
<view class='text_line'>我们会以短信通知您</view>
</view>
</view>
<!--操作按钮 -->
<view class='line_btn cover_bg' bindtap="confirm">确定</view>
<view class='line_btn' bindtap='cancel'>不排了</view>
</view>
\ No newline at end of file
... ...
.w_container{
height: 100vh;
width: 100%;
overflow: hidden;
background-color: #FFF;
}
.line_container{
width: 718rpx;
margin: 16rpx auto 127rpx;
height: 628rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx #ccc;
border-radius: 8rpx 8rpx 0 0;
}
.line_top{
height: 88rpx;
background-color: #FFDD75;
display: flex;
font-size: 36rpx;
align-items: center;
justify-content: center;
color: #000;
}
.line_content{
font-size: 30rpx;
color: #000;
}
.text_line{
text-align: center;
line-height: 60rpx;
}
.text_line:first-child{
margin-top: 70rpx;
}
.line_jiange{
margin-top: 60rpx;
}
.line_btn{
width: 350rpx;
height: 88rpx;
font-size: 26rpx;
color: #000;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #C1C1C1;
border-radius: 8rpx;
margin: 0 auto 40rpx;
}
.cover_bg{
background-color: #FFDD75;
}
\ No newline at end of file
... ...
// pages/book/speed/speed.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
progress:'',
id: '',
playDetail: null,
authInfo: false,
num:0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let openid = wx.getStorageSync('openid');
this.setData({
id: options.id
})
if(openid){
this.setData({
authInfo: true
})
}
this.myspeed()
},
myspeed(){
let params = {
id: this.data.id
}
let url = '/Portal/Center/mybird'
app.post(url, params).then((res) => {
let tempSpeed;
if(res.speed<100){
tempSpeed = res.speed;
}else{
tempSpeed = res.speed/(res.speed+20)
}
this.setData({
playDetail: res,
speed: res.speed,
progress: tempSpeed
})
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
helpSpeed(){
let openid = wx.getStorageSync('openid');
if(openid){
let params = {
id: this.data.id,
openid: openid
}
let url = '/Portal/Center/dospeed'
app.post(url,params).then( (res) =>{
wx.showToast({
title: '加速成功',
})
this.setData({
speed: parseInt(this.data.speed)+1
})
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
}else{
this.setData({
authInfo: false
})
}
},
iwant(){
wx.navigateTo({
url:'../booklist'
})
},
getUserInfo: function (e) {
// 登录
let code ;
if (e.detail.userInfo) {
this.setData({
authInfo: true
})
wx.login({
success: (res) => {
code = res.code;
let codeurl = '/Portal/Index/getOpenid';
let params = {
code: code,
gender: e.detail.userInfo.gender,
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
}
app.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
this.setData({
authInfo: true
})
this.helpSpeed();
wx.hideNavigationBarLoading();
wx.hideLoading();
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.hideNavigationBarLoading();
wx.hideLoading();
});
}
})
app.globalData.userInfo = e.detail.userInfo
this.setData({
userName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
authInfo: true
})
}else{
this.setData({
authInfo: false
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/book/speed/speed.wxml-->
<view class='speed_container'>
<view class='speed_top'>
<image src='{{playDetail.thumb}}'></image>
<!--剧场信息-->
<view class='opera_detail'>
<view class='opera_title'>{{playDetail.name}}</view>
<view class='detail_info'>
<view class='detail_info_time'>{{playDetail.dates}} {{playDetail.time}}</view>
<view class='detail_info_adress'>({{playDetail.place}})</view>
</view>
</view>
</view>
<!--info-->
<view class='speed_main'>
<view class='image_box'>
<image src='{{playDetail.headimg}}'></image>
</view>
<view class='nick_name'>{{playDetail.name}}</view>
<view class='help_note'>快来帮我加速</view>
<view class='progress'>
<view class='progress_base'>
<view class='progress_now' style='width:{{progress}}%'></view>
</view>
</view>
<view class='progress_jindu'>当前已有{{speed}}人为您加速,继续哦~</view>
</view>
<!--button -->
<view class='btn_groups'>
<view class='btn_single' wx:if="{{authInfo}}" bindtap='helpSpeed'>
点我帮TA加速
</view>
<button class='userinfo-name btn_single' wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo">点我帮TA加速</button>
<view class='btn_single btn_cover' bindtap='iwant'>
我也想要
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/book/speed/speed.wxss */
.speed_container{
height: 100vh;
background-color:#000000;
overflow: hidden;
}
.speed_top{
height: 400rpx;
width: 100%;
position: relative;
}
.speed_top image{
width: 100%;
height: 100%;
}
.opera_detail{
position: absolute;
bottom: 0;
left: 0;
height: 130rpx;
width: 100%;
background-color: rgba(0,0,0,.68);
display: flex;
flex-flow: column;
font-size: 24rpx;
justify-content: center;
color: #FFF;
padding-left: 30rpx;
}
.opera_title{
font-size: 34rpx;
}
.detail_info{
display: flex;
margin-top: 20rpx;
}
.speed_main{
display: flex;
align-items: center;
flex-flow: column;
justify-content: center;
color: #fff;
}
.image_box{
width: 120rpx;
height: 120rpx;
border-radius: 50%;
overflow: hidden;
margin-top: 48rpx;
}
.image_box image{
width: 100%;
height: 100%;
}
.nick_name{
font-size: 30rpx;
margin-top: 30rpx;
}
.help_note{
font-size: 34rpx;
margin-top: 74rpx;
margin-bottom: 40rpx;
}
.progress{
box-sizing: border-box;
border-radius: 24rpx;
border: 1rpx solid #B79F4E;
padding: 4rpx;
}
.progress_base{
background-color: #FFF;
border-radius: 20rpx;
width: 608rpx;
height: 40rpx;
display: flex;
overflow: hidden;
}
.progress_now{
height: 100%;
background-color: #FFDD75;
}
.progress_jindu{
font-size: 26rpx;
color: #FFF;
margin-top: 80rpx;
}
.btn_groups{
margin:90rpx 103rpx 0;
display: flex;
justify-content: space-around;
}
.btn_single{
font-size: 26rpx;
width: 250rpx;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8rpx;
background-color: #FFDE6D;
}
.btn-cover{
background-color: #DDA807;
}
.detail_info_adress{
margin-left:10px;
}
\ No newline at end of file
... ...
// pages/electrPer/electrPer.js
const app = getApp();
var WxParse = require('../../wxParse/wxParse.js');
Page({
/**
* 页面的初始数据
*/
data: {
item_id: null,
type: 1,
playDetail: null,
palyerHtml: null,
playHtml: null
},
// 电子期详情
electrPerDetail(){
let url = '/Portal/Center/techinfo'
let that = this;
app.post(url,{ item_id: this.data.item_id }).then((res) =>{
this.setData({
playDetail:res
})
WxParse.wxParse('palyerHtml', 'html', res.workman, that, 5);
WxParse.wxParse('playHtml', 'html', res.description, that, 5);
}).catch((errMsg) =>{
wx.showModal({
title:errMsg,
showCancel: false
})
})
},
// tab切换
switchTab(e){
this.setData({
type:e.currentTarget.id
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
item_id: options.id
})
this.electrPerDetail();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/electrPer/electrPer.wxml-->
<view class='elec_container'>
<view class='book_list'>
<image src='{{playDetail.thumb}}'></image>
<view class='book_mask'>
<view class='bookinfo'>
<view class='bookinfo_title'>{{playDetail.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{playDetail.startdate}} {{playDetail.start}}-{{playDetail.end}}</view>
<view class='bookinfo_adress'>({{playDetail.place}})</view>
</view>
</view>
</view>
</view>
<!--tab -->
<view class='tab_content'>
<view class='tab_items'>
<view class='tab_item {{type==1?"active":""}}' id='1' bindtap='switchTab'>演职人员表</view>
<view class='tab_item {{type==2?"active":""}}' id='2' bindtap='switchTab'>剧情简介</view>
</view>
</view>
<!--演职人员表 -->
<view class='player_box {{type==1?"active":""}}'>
<view class='palyer_detail'>
演职人员
</view>
<view class='player_introduce'>
<import src="/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:palyerHtml.nodes}}"/>
</view>
</view>
<!-- 剧情简介 -->
<view class='player_box play_box {{type==2?"active":""}}'>
<view class='palyer_detail play_detail'>
剧情梗概
</view>
<view class='player_introduce'>
<import src="/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:playHtml.nodes}}"/>
</view>
</view>
</view>
... ...
/* pages/electrPer/electrPer.wxss */
@import "/wxParse/wxParse.wxss";
@import '../book/booklist.wxss';
.tab_items{
display: flex;
align-items: center;
justify-content: center;
background-color: #FFF;
height: 97rpx;
border-bottom: 1rpx solid #DCDCDC;
}
.tab_item{
display: flex;
flex:1;
height: 100%;
align-items: center;
justify-content: center;
font-size: 28rpx;
position: relative;
}
.tab_item:after{
content: '';
position: absolute;
top: 0;
right: 0;
width: 2rpx;
height: 100%;
background-color: #DCDCDC;
}
.tab_item:last-child:after{
width: 0
}
.tab_item.active:before {
width: 100%;
height: 4rpx;
background-color: #FFDD75;
content: '';
bottom: 0;
left: 0;
position: absolute;
}
.player_box{
padding: 40rpx 70rpx 40rpx 85rpx;
display: none;
}
.player_box.active{
display: block;
}
.palyer_detail{
/*height: 64rpx;*/
position: relative;
display: flex;
justify-content: center;
flex-flow: column;
font-size: 28rpx;
left: -27rpx;
padding-left: 27rpx;
}
.palyer_detail:before{
content: '';
width: 8rpx;
height: 100%;
position: absolute;
left: 0rpx;
top: 0;
background-color: #FFDD75;
}
.player_introduce{
margin-top: 42rpx;
font-size: 26rpx;
}
.qiandao{
padding: 0 77rpx 0 100rpx;
}
.qiandao_note{
}
\ No newline at end of file
... ...
//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}}" background-size="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/personal/personal.js
const app = getApp();
import menu from '../../components/menu/menu'
Page({
/**
* 页面的初始数据
*/
data: {
tabshow: 'book',
openid:'',
hasUserInfo: true,
changeBook: false,
cancelBook: false,
cancleStanding: false,
evaluateType: false,
booklist:null,
playList:null,
userName:'',
tempNum: 1 ,
tempItemId: null,
tempHid: '',
tempCancelId: null,
currentPage: 1,
avatarUrl:null,
tempbookinfo:{},
tempselect:[],
index: 0,
changeId: null,
evaluate: null,
type: wx.getStorageSync('type'),
star: 2,
register: true,
tempImgUrl:'',
hybird: false
},
tapmenu(e){
menu.tapmenu(e);
},
selectstar(e){
this.setData({
star: e.currentTarget.dataset.id
})
},
getUserInfo: function (e) {
// 登录
let code ;
if (e.detail.userInfo) {
this.setData({
hasUserInfo: true
})
wx.login({
success: (res) => {
code = res.code;
let codeurl = '/Portal/Index/getOpenid';
let params = {
code: code,
gender: e.detail.userInfo.gender,
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
}
app.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
console.log(res)
if(res.res=='0'){
this.setData({
register: false
})
wx.redirectTo({
url: '../register/register',
})
}else{
this.setData({
register: true
})
}
wx.hideNavigationBarLoading();
wx.hideLoading();
this.booklist()
this.playlist()
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.hideNavigationBarLoading();
wx.hideLoading();
});
}
})
// app.onLaunch();
app.globalData.userInfo = e.detail.userInfo
this.setData({
userName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
hasUserInfo: true
})
}else{
this.setData({
hasUserInfo: false
})
}
},
switchTab(e){
let type = e.currentTarget.dataset.type;
this.setData({
tabshow: type
})
},
redictRegister(){
wx.redirectTo({
url: '../register/register',
})
},
booklist(){
let url = '/Portal/Center/myapp'
let openid = wx.getStorageSync('openid')
if(openid){
let params = {
openid: wx.getStorageSync('openid'),
page: this.data.currentPage
}
let that = this;
app.post(url,params).then((res) =>{
// 0 预约成功未签到
// -1 进入排队
// 1 早鸟票
// 2 预约已签到
that.setData({
booklist:res,
register: true
})
}).catch((errMsg) =>{
console.log(errMsg)
if (errMsg == 'false') {
that.setData({
register: false
})
} else {
wx.showModal({
title: '提示',
content: errmsg,
showCancel: false
})
}
})
}else{
this.setData({
hasUserInfo: false,
booklist:[],
playList:[],
})
}
},
// 话剧列表
playlist(){
let url = '/Portal/Center/mywatch'
let that = this
let params = {
openid: wx.getStorageSync('openid')
}
if(wx.getStorageSync('openid')){
app.post(url, params).then((res) =>{
if(res.uid){
console.log(1)
that.setData({
playList: [],
register: false
})
}else{
that.setData({
playList: res,
register: true
})
}
}).catch((errmsg) =>{
if (errmsg =='false'){
that.setData({
register: false
})
}else{
wx.showModal({
title: '提示',
content: errmsg,
showCancel: false
})
}
})
}else{
this.setData({
hasUserInfo: false,
booklist:[],
playList:[],
})
}
},
// 签到
signIn(e){
let item_id = e.currentTarget.id;
wx.navigateTo({
url:'../signIn/signIn?id='+item_id
})
},
// 查看签到
viewSign(e){
let id = e.currentTarget.id;
wx.navigateTo({
url:'../signIn/sigInResult/sigInResult?id='+id
})
},
// 电子期刊
viewElec(e){
console.log(e)
let item_id = e.currentTarget.id;
wx.navigateTo({
url:'../electrPer/electrPer?id='+item_id
})
},
// 修改预约
changeBook(e){
console.log(e)
let that = this;
let url = '/Portal/Center/editapp';
let tempItems = []
let params = {
openid: wx.getStorageSync('openid'),
id: e.target.id
}
this.setData({
changeId: e.target.id,
tempNum: e.currentTarget.dataset.num
})
let item_id = e.currentTarget.dataset.itemid
console.log(item_id)
app.post(url, params).then((res) =>{
for (let obj of res.item) {
let tempstr = {
name: obj.title + ' ' + obj.date + ' ' + obj.start + '-' + obj.end,
id: obj.id,
hid: obj.hid
}
tempItems.push(tempstr)
}
for (let index in res.item){
if (item_id == res.item[index].id) {
this.setData({
index: index
})
}
}
that.setData({
changeBook: true,
tempbookinfo:res,
tempselect: tempItems,
tempItemId: item_id,
tempHid: tempItems[0].hid
})
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
//修改选择预约场次
playChoose(e) {
this.setData({
tempItemId: this.data.tempselect[e.detail.value].id,
index: e.detail.value
})
},
// 确认修改
confirmChangeBook(){
let that = this
let url = '/Portal/Center/editdo'
let params = {
id: this.data.changeId,
openid: wx.getStorageSync('openid'),
hid: this.data.tempHid,
item_id: this.data.tempItemId,
num: this.data.tempNum
}
app.post(url,params).then((res) =>{
wx.showToast({
title: '修改成功',
})
that.setData({
changeBook: false
})
that.booklist()
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
// 取消预约操作
cancelBook(e){
this.setData({
cancelBook: true,
tempCancelId: e.currentTarget.id
})
},
// 确认取消
confirmCancel(){
let url = '/Portal/Center/canelapp';
let params = {
openid: wx.getStorageSync('openid'),
id: this.data.tempCancelId,
num: this.data.tempNum
}
app.post(url,params).then((res) =>{
wx.showToast({
title: "取消成功",
})
this.setData({
cancelBook: false,
tempCancelId: null
})
this.booklist()
}).catch((errMsg) =>{
wx.showModal({
title:'提示',
content:errMsg,
showCancel: false
})
})
},
// 修改修改预约的人数
getnum(e){
this.setData({
tempNum: e.currentTarget.id
})
},
// 取消排队
cancelStand(e){
this.setData({
tempItemId: e.currentTarget.id,
cancleStanding: true
})
},
// 确认取消排队
confirmCancelstand(){
let url = '/Portal/Center/canelwait';
let that = this;
app.post(url,{id:this.data.tempItemId}).then((res) =>{
wx.showToast({
title:'取消排队成功'
})
setTimeout(function(){
that.setData({
cancleStanding: false
})
that.booklist()
},1000)
}).catch((errMsg) =>{
wx.showModal({
title:'提示',
content: errMsg,
showCancel: false
})
})
},
//抢票中
qiangpiao(e){
let id = e.currentTarget.id
wx.navigateTo({
url: '../book/speed/speed?id=' + id
})
},
// 查看排行
viewRank(e){
let id = e.currentTarget.id
wx.navigateTo({
url:'../rank/rank?id='+id
})
},
// 查看排队
viewplay(e){
let id = e.currentTarget.id
let itemid = e.currentTarget.dataset.itemid
wx.navigateTo({
url: '../book/paidui/paidui?id=' + id + '&itemid=' + itemid
})
},
// 评价
getscore(e){
this.setData({
tempImgUrl: e.currentTarget.dataset.url,
evaluateType: true,
item_id: e.currentTarget.id,
hid: e.currentTarget.dataset.hid,
})
},
confirmevalaute(){
let params = {
id: this.data.item_id,
score: this.data.star
}
let url = '/Portal/Center/score'
let that = this;
app.post(url, params).then((res) => {
wx.showToast({
title: '评价成功',
})
setTimeout(function(){
that.setData({
evaluateType: false,
})
that.playlist()
},1000)
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
// 关闭弹窗统一操作
closeMask(){
this.setData({
changeBook: false,
cancelBook: false,
cancleStanding: false,
evaluateType: false
})
console.log(this.data.evaluateType)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(app.globalData.userInfo)
if(app.globalData.userInfo){
this.setData({
userName: app.globalData.userInfo.nickName,
avatarUrl: app.globalData.userInfo.avatarUrl,
hasUserInfo: true
})
console.log(this.data.hasUserInfo)
}
this.setData({
type: wx.getStorageSync('type'),
register: wx.getStorageSync('register')
})
this.booklist()
this.playlist()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/personal/personal.wxml-->
<view class='personal_container'>
<!--menu-->
<import src="/components/menu/menu" />
<template is="bottomMenu" data = '{{type:type}}'/>
<!--personal_top -->
<view class='personal_top'>
<view class='img_box' wx:if="{{!hasUserInfo}}">
<image src='http://fdjc.wx.bronet.cn/public/images/pic1.png'></image>
</view>
<view class='img_box' wx:else>
<image src='{{avatarUrl}}'></image>
</view>
<!--login_btn -->
<view class='userName' wx:if="{{register}}">{{userName}}</view>
<button class='userinfo-name login_btn' wx:if="{{!hasUserInfo}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo">注册</button>
<button class='userinfo-name login_btn register' wx:if="{{hasUserInfo&&!register}}" bindtap="redictRegister">注册</button>
</view>
<!--tab-->
<view class='tab_content'>
<view class='tab_items'>
<view class='tab_item {{ tabshow == "book" ? "active" :""}}' data-type='book' bindtap='switchTab'>我的预约</view>
<view class='tab_item {{ tabshow == "play" ? "active" :""}}' data-type='play' bindtap='switchTab'>看过的话剧</view>
</view>
</view>
<!--未注册提示 -->
<!--预约列表 -->
<view class='book_lists has_bottom {{ tabshow == "book" ? "active" :""}}'>
<view class='nodata {{(!register || booklist.length == 0 )? "active" :""}}'>
您还没有看过戏,快去预约吧!
</view>
<block wx:for="{{booklist}}" wx:key="">
<view class='book_list' wx:if="{{item.type==0||item.type==2}}">
<image src='{{item.thumb}}'></image>
<view class='book_mask'>
<view class='bookinfo'>
<view class='bookinfo_title'>{{item.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{item.date}} {{item.start}}-{{item.end}}</view>
<view class='book_person'>{{item.num}}人</view>
</view>
<view class='bookinfo_adress'>地址 - ({{item.place}})</view>
</view>
</view>
<view class='bookList_action'>
<view class='bookList_action_warp'>
<view class='book_ac_btn' id='{{item.item_id}}' wx:if="{{item.type==0}}" bindtap='signIn'>签到</view>
<view class='book_ac_btn book_ac_btn_qiang' id='{{item.id}}' wx:else bindtap='viewSign'>已签到</view>
<view class='book_ac_btn' id='{{item.item_id}}' wx:if="{{item.type==0}}" bindtap='viewElec'>电子场刊</view>
<view class='book_ac_btn' id='{{item.id}}' data-itemId="{{item.item_id}}" data-num="{{item.num}}" wx:if="{{item.type==0}}" bindtap='changeBook'>修改预约</view>
<view class='book_ac_btn' id='{{item.id}}' wx:if="{{item.type==0}}" bindtap='cancelBook'>取消预约</view>
</view>
</view>
</view>
<view class='book_list' wx:elif="{{item.type==1}}">
<image src='{{item.thumb}}'></image>
<view class='book_mask'>
<view class='bookinfo'>
<view class='bookinfo_title'>{{item.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{item.date}} {{item.start}}-{{item.end}}</view>
<view class='book_person'>{{item.num}}人</view>
</view>
<view class='bookinfo_adress'>地址 - ({{item.place}})</view>
</view>
</view>
<view class='bookList_action'>
<view class='bookList_action_warp'>
<view class='book_ac_btn book_ac_btn_qiang' id='{{item.item_id}}'>抢票中</view>
<view class='book_ac_btn book_ac_btn_qiang' id='{{item.item_id}}' bindtap='viewRank'>查看排行</view>
</view>
</view>
</view>
<view class='book_list' wx:else>
<image src='{{item.thumb}}'></image>
<view class='book_mask'>
<view class='bookinfo'>
<view class='bookinfo_title'>{{item.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{item.date}} {{item.start}}-{{item.end}}</view>
<view class='book_person'>{{item.num}}人</view>
</view>
<view class='bookinfo_adress'>地址 - ({{item.place}})</view>
</view>
</view>
<!--操作按钮 -->
<view class='bookList_action'>
<view class='bookList_action_warp'>
<view class='book_ac_btn book_ac_btn_qiang' data-itemid='{{item.item_id}}' id="{{item.id}}" bindtap='viewplay'>点击查看</view>
<view class='book_ac_btn book_ac_btn_qiang' id='{{item.id}}' bindtap='cancelStand'>取消排队</view>
</view>
</view>
</view>
</block>
</view>
<!--看过的话剧 -->
<view class='playItems has_bottom {{ tabshow == "play" ? "active" :""}}'>
<view class='nodata {{ (!register || playList.length == 0)? "active" :""}}' >
您还没有看过戏,快去预约吧!
</view>
<view class='playItem' wx:for="{{playList}}" wx:key="">
<image src='{{item.thumb}}'></image>
<view class='left_info'>
<view class='play_name'>{{item.name}}</view>
<view class='play_time'>{{item.date}} {{item.start}}-{{item.end}}</view>
<view class='play_score'>
评价:{{item.score}}
</view>
<view class='play_star' wx:if="{{item.is_score==0}}" id='{{item.id}}' data-url='{{item.thumb}}' data-hid='{{item.hid}}' bindtap='getscore'>
<view class='iconfont icon-xingxing '></view>
<view class='iconfont icon-xingxing '></view>
<view class='iconfont icon-xingxing '></view>
<view class='iconfont icon-xingxing '></view>
<view class='iconfont icon-xingxing'></view>
</view>
<view class='play_star' wx:else>
<view class='iconfont icon-xingxing {{item.is_score>=2?"active":""}}' data-id='2' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{item.is_score>=4?"active":""}}' data-id='4' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{item.is_score>=6?"active":""}}' data-id='6' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{item.is_score>=8?"active":""}}' data-id='8' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{item.is_score>=10?"active":""}}' data-id='10' bindtap='selectstar'></view>
</view>
</view>
</view>
</view>
<!--弹窗 -->
<view class='mask {{changeBook||cancelBook||cancleStanding||evaluateType?"active":""}}' bindtap='closeMask'></view>
<!-- <view class='mask {{evaluatetype?"active":""}}' bindtap='closeMask'></view>
<view class='mask {{changeBook?"active":""}}' bindtap='closeMask'></view>
<view class='mask {{cancelBook?"active":""}}' bindtap='closeMask'></view>
<view class='mask {{cancelstand?"active":""}}' bindtap='closeMask'></view> -->
<view class='confirm_main confirm_toast {{cancelBook?"active":""}}'>
<view class='cancle_note'>是否取消预约</view>
<view class='action_btns'>
<view class='action_btn' bindtap='confirmCancel'>是</view>
<view class='action_btn cover_bg' bindtap='closeMask'>否</view>
</view>
</view>
<!--取消排队 -->
<view class='confirm_main confirm_toast {{cancleStanding?"active":""}}'>
<view class='cancle_note'>是否取消排队</view>
<view class='action_btns'>
<view class='action_btn' bindtap='confirmCancelstand'>是</view>
<view class='action_btn cover_bg' bindtap='closeMask'>否</view>
</view>
</view>
<!--演出预约 -->
<view class='book_form confirm_toast {{changeBook?"active":""}}'>
<!--预约表格主体 -->
<view class='book_form_body'>
<view class='book_label'>请选择演出场次</view>
<!-- <input class='form_input iconfont icon-xiala' disabled placeholder='请选择' /> -->
<view class='form_input iconfont icon-xiala'>
<picker bindchange="playChoose" value="{{index}}" id='{{tempselect[index].id}}' range="{{tempselect}}" range-key="name">
<view class="picker" > {{tempselect[index].name}}</view>
</picker>
</view>
<view class='book_label book_num'>请选择预约人数</view>
<!--复选框 -->
<view class='num_box'>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{tempNum==1?"icon-duigou":""}}' id="1" bindtap='getnum'>
</view>
1
</view>
<view class='num_box_item'>
<view class='num_box_warp iconfont {{tempNum==2?"icon-duigou":""}}' id="2" bindtap='getnum'>
</view>
2
</view>
</view>
<!--确认预约按钮-->
<view class='action_btns'>
<view class='action_btn' bindtap='closeMask'>取消</view>
<view class='action_btn cover_bg' bindtap='confirmChangeBook'>确定</view>
</view>
</view>
</view>
<!-- 评价窗口 -->
<view class='confirm_toast evaluate {{evaluateType?"active":""}}'>
<view class='evaluate_img'>
<image src='{{tempImgUrl}}'></image>
</view>
<view class='bookinfo'>
<view class='bookinfo_title'>{{evaluate.name}}</view>
<view class='bookinfo_time_adress'>
<view class='bookinfo'>{{evaluate.data}} {{evaluate.start}}-{{evaluate.end}}</view>
</view>
</view>
<view class='play_star' >
<view class='iconfont icon-xingxing {{star>=2?"active":""}}' data-id='2' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{star>=4?"active":""}}' data-id='4' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{star>=6?"active":""}}' data-id='6' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{star>=8?"active":""}}' data-id='8' bindtap='selectstar'></view>
<view class='iconfont icon-xingxing {{star>=10?"active":""}}' data-id='10' bindtap='selectstar'></view>
</view>
<view class='evaluate_btn cover_bg' bindtap='confirmevalaute'>确认评价</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/personal/personal.wxss */
@import '../book/bookaction/bookaction.wxss';
.personal_container{
height: 100vh;
background-color: #f1f1f1;
}
.personal_top{
height: 360rpx;
align-items: center;
justify-content: center;
background-color: #FFDD75;
font-size: 28rpx;
color: #000;
display: flex;
flex-flow: column;
}
.img_box{
width: 166rpx;
height: 166rpx;
border-radius: 50%;
overflow: hidden;
border: 1rpx solid #fff;
}
.img_box image{
width: 166rpx;
height: 166rpx;
border-radius: 50%;
}
.login_btn{
width: 200rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #CBA244;
border-radius: 36rpx;
margin-top: 30rpx;
font-size: 24rpx;
}
.tab_items{
display: flex;
align-items: center;
justify-content: center;
background-color: #FFF;
height: 97rpx;
}
.tab_item{
display: flex;
flex:1;
height: 100%;
align-items: center;
justify-content: center;
font-size: 28rpx;
position: relative;
}
.tab_item:after{
content: '';
position: absolute;
top: 0;
right: 0;
width: 2rpx;
height: 100%;
background-color: #DCDCDC;
}
.tab_item:last-child:after{
width: 0
}
.tab_item.active:before {
width: 100%;
height: 4rpx;
background-color: #FFDD75;
content: '';
bottom: 0;
left: 0;
position: absolute;
}
.bookList_action{
width: 200rpx;
height: 430rpx;
background-color: rgba(0,0,0,.68);
position: absolute;
top: 0;
right: 0;
}
.book_mask{
height: 150rpx;
width: 550rpx;
font-size: 32rpx;
}
.bookinfo{
justify-content: space-around;
}
.bookinfo_time_adress{
display: flex;
margin: 6rpx 0;
font-size: 26rpx;
}
.bookinfo_adress{
margin-left: 0;
font-size: 26rpx;
}
.book_person{
margin-left: 28rpx;
}
.bookList_action_warp{
height: 100%;
width: 100%;
position: relative;
display: flex;
flex-flow: column;
align-items: center;
justify-content: space-around;
}
.bookList_action_warp:before{
content: '';
height: 386rpx;
width: 1rpx;
background-color: rgba(255,255,255,.4);
top: 50%;
left: 13rpx;
transform: translateY(-50%);
position: absolute;
}
.bookinfo_title{
font-size: 28rpx;
}
.book_ac_btn{
width: 136rpx;
height: 72rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #fff;
border: 1rpx solid rgba(255,255,255,.4)
}
.book_ac_btn_qiang{
width: 120rpx;
height: 150rpx;
}
.book_lists{
padding-bottom: 100rpx;
display: none;
}
.book_lists.active{
display: block;
}
.mask{
width: 100%;
height: 100%;
position:fixed;
background: rgba(0,0,0,0.7);
top:0;
left:0;
z-index: 999;
display: none;
align-items: center;
justify-content: center;
}
.mask.active{
display: flex
}
.confirm_main{
width: 556rpx;
height: 370rpx;
background-color: #FFF;
border-radius: 8rpx;
display: none;
align-items: center;
flex-flow: column;
}
.confirm_main.active{
display: flex;
}
.cancle_note{
font-size: 28rpx;
color: #000;
margin-top: 90rpx;
}
.action_btns{
display: flex;
font-size: 28rpx;
justify-content: center;
color: #000;
margin-top: 80rpx;
padding-bottom: 5rpx;
}
.action_btn{
width: 180rpx;
height: 72rpx;
border: 1rpx solid #c1c1c1;
border-radius: 8rpx;
display: flex;
justify-content: center;
align-items: center;
}
.cover_bg{
background-color: #FFDD75;
margin-left: 32rpx;
}
.confirm_toast{
background: #fff;
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
z-index: 1000
}
.book_form{
width: 700rpx;
height: 563rpx;
border-radius: 8rpx;
padding: 0 38rpx 0;
box-sizing: border-box;
display: none;
}
.book_form.active{
display: block;
}
.book_form_body{
overflow: hidden;
}
.book_label{
padding: 55rpx 0 33rpx;
margin-bottom: 0;
}
.form_input{
border: none;
margin-top: 0;
margin-left: 25rpx;
margin-bottom: 8rpx;
border-bottom: 1rpx solid #D0D0D0;
}
.book_num {
margin-top: 0;
}
.num_box{
margin-bottom: 65rpx;
display: flex;
align-items: center;
justify-content: center;
}
.num_box_item{
margin: 0 77rpx;
}
.num_box~.action_btns{
margin-top: 0;
}
.playItems{
display: none;
}
.playItems.active{
display: block;
}
.playItem{
height: 430rpx;
position: relative;
overflow: hidden;
border-bottom: 1rpx solid #ddd;
}
.left_info{
height: 100%;
position: absolute;
left: 0;
top: 0;
box-sizing: border-box;
width: 327rpx;
background: url(http://fdjc.wx.bronet.cn/public/images/mask.png);
background-size: 327rpx 430rpx;
padding-left: 33rpx;
padding-top: 75rpx;
}
.playItem image{
width: 100%;
height: 100%;
}
.play_name{
font-size: 30rpx;
}
.play_time{
font-size: 26rpx;
line-height: 48rpx;
width: 154rpx;
margin-top: 27rpx;
}
.play_score{
margin-top: 55rpx;
font-size: 26rpx;
}
.play_star{
display: flex;
margin-top: 28rpx;
}
.play_star .iconfont{
font-size: 48rpx;
color: #B5B5B5;
}
.iconfont.active{
color: #FFDD75
}
.userName{
font-size: 32rpx;
margin-top: 25rpx;
}
.evaluate{
width: 560rpx;
height: 730rpx;
box-sizing: border-box;
padding: 70rpx;
display: none;
border-radius: 10rpx;
}
.evaluate.active{
display: block
}
.evaluate image{
width: 417rpx;
height: 239rpx;
}
.evaluate .bookinfo{
color: #333;
}
.evaluate_btn{
margin: 0 auto;
width: 300rpx;
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #000;
margin-top: 70rpx;
border-radius: 8rpx;
box-sizing: border-box;
}
.evaluate .play_star{
justify-content: center;
margin-top: 70rpx;
}
.nodata{
display: none;
justify-content: center;
align-items: center;
padding-top: 200rpx;
}
.nodata.active{
display: flex;
}
\ No newline at end of file
... ...
// pages/playBook/playBook.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<!--pages/playBook/playBook.wxml-->
<view class='book_container'>
<view class='book_box'>
<view class='book_top'>
演出预约
</view>
<!--预约主体 -->
<view class='book_main'>
<view class='book_main_top '>请选择</view>
<input placeholder='请选择' class='form_input main_select iconfont icon-xiala' />
<view class='book_main_top'>请选择预约人数</view>
<!--复选框 -->
<view class='num_box'>
<view class='num_box_item'>
<view class='num_box_warp iconfont '>
</view>
1
</view>
<view class='num_box_item'>
<view class='num_box_warp iconfont icon-duigou'>
</view>
2
</view>
</view>
</view>
</view>
<view class='note'>
我们接受一定数量的现场观众,您可以来到时现场排队
</view>
<view class='stop_btn'>停止预约
</view>
</view>
... ...
/* pages/playBook/playBook.wxss */
@import '../book/bookaction/bookaction.wxss';
.book_box{
width: 718rpx;
margin: 16rpx auto 0;
box-shadow: 1rpx 1rpx 10rpx 1rpx #BABABA;
border-radius: 8rpx;
}
.book_top{
height: 88rpx;
background-color: #FFDD75;
display: flex;
font-size: 30rpx;
align-items: center;
color: #000;
padding-left: 35rpx;
}
.book_main{
width: 614rpx;
margin: 0 auto;
}
.book_main{
font-size: 26rpx;
color: #000;
height: 800rpx;
}
.book_main_top{
padding: 50rpx 0;
}
.main_select{
width: 100%;
padding: 22rpx 0;
margin-bottom: 100rpx;
border: none;
border-bottom: 1rpx solid #F1F1F1;
}
.num_box{
margin-top: 46rpx;
}
.note{
font-size: 24rpx;
display: flex;
justify-content: center;
margin-top: 78rpx;
margin-bottom: 50rpx;
}
.stop_btn{
width: 470rpx;
height: 88rpx;
align-items: center;
justify-content: center;
font-size: 26rpx;
background-color: #F1F1F1;
margin: 0 auto;
display: flex;
}
\ No newline at end of file
... ...
// pages/rank/rank.js
//
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
id: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.id,
ranklist: []
})
this.rankList()
},
//排行列表
rankList(){
let params = {
item_id: this.data.id,
openid: wx.getStorageSync('openid')
}
let url = '/Portal/Center/paihang'
app.post(url,params).then((res) =>{
this.setData({
ranklist: res,
my: res.my
})
}).catch((errMsg) =>{
wx.showModal({
title:'提示',
content:errMsg,
showCancel: false
})
})
},
continueSpeed(){
let params = {
item_id: this.data.id,
openid: wx.getStorageSync('openid')
}
let url = '/Portal/center/birdCode'
app.post(url,params).then((res) =>{
let imgUrl = res
wx.showLoading({
title: '加载中',
})
wx.downloadFile({
url: imgUrl,
success: function (res) {
//如果二维码中的id为固定值可以将图片保存到本地,否则不用保存
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function (res) {
wx.hideLoading()
wx.showToast({
icon: 'none',
title:'图片保存成功,可以分享到朋友圈'
})
that.setData({
creat: true
})
setTimeout(function(){
that.setData({
creat: false
})
},1500)
},
fail: function (res) {
wx.showToast({
icon: 'none',
title: '图片保存失败'
})
console.log(res)
}
})
},
fail: function (res) {
wx.showModal({
title:'提示',
content:'图片保存失败,请重试',
showCancel: false
})
}
})
}).catch((errMsg) =>{
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...
<view class='rank_container gray_container'>
<view class='rank_info' wx:if="{{my.number>10}}">您当前第{{my.number}}名,距离早鸟票结束时间还剩{{ranklist.else.zaodate}}天</view>
<view class='rank_info' wx:else>您已进入前{{ranklist.else.top}}名,距离早鸟票结束时间还剩{{ranklist.else.zaodate}}天</view>
<view class='rank_items has_bottom' >
<view class='rank_item' wx:if="{{my.number>10}}">
<image src='{{my.avatar}}' class='photoImg'></image>
<view class='rank_name'>{{my.number}}. {{my.name}}
</view>
<view class='rank_situation'>
已经加速{{my.speed}}
</view>
</view>
<view class='rank_item' wx:for="{{ranklist.list}}" wx:key=''>
<image src='{{item.avatar}}' class='photoImg'></image>
<view class='rank_name'>{{index+1}}. {{item.name}}
</view>
<view class='rank_situation'>
已经加速{{item.speed}}
</view>
</view>
</view>
<!--continue addSpeed -->
<view class='add' bindtap='continueSpeed'>点我继续加速</view>
</view>
\ No newline at end of file
... ...
/* pages/rank/rank.wxss */
.rank_info{
height: 88rpx;
background-color: #f1f1f1;
color: #c1c1c1;
font-size: 26rpx;
display: flex;
align-items: center;
justify-content: center;
}
.rank_items{
background-color: #FFF;
}
.rank_item{
padding: 32rpx 96rpx 32rpx 48rpx;
border-bottom: 1rpx solid #DCDCDC;
display: flex;
align-items: center;
justify-content: space-around;
font-size: 26rpx;
}
.rank_item:last-child{
border: none;
}
.rank_name{
margin-left: 25rpx;
}
.photoImg{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.rank_situation{
margin-left: auto;
margin-start:auto;
}
.add{
height: 96rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
background-color: #FFDD75;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
}
\ No newline at end of file
... ...
// pages/register/register.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
openid: wx.setStorageSync('openid'),
name: '',
sex: 0,
is_res: 1,
mobile: '',
code: '',
sexArry: [{ value: 0, name: '无' }, { value: 1, name: '男' }, { value: 2, name: '女' }],
index: 0,
stuIndex: 0,
is_resArry: [{ value: 1, name: '是' }, { value: 0, name: '不是' }],
codeAc: true,
is_fudan: 1,
time: 60,
authInfo: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let openid = wx.getStorageSync('openid')
if (openid) {
this.setData({
authInfo: true
})
}
},
getInput(e) {
let type = e.currentTarget.dataset.name;
let value = e.detail.value;
let obj = {}
return type == 'name' ? this.data.name = value : type == 'phone' ? this.data.mobile = value : type == 'code' ? this.data.code = value : '';
},
getCode() {
let phone = this.data.mobile;
let _this = this;
let reg = /^1[3456789]\d{9}$/;
if (!reg.test(phone)) {
wx.showModal({
title: '提示',
content: '手机号格式有误!',
showCancel: false,
success: function (res) { }
})
} else {
let codeurl = '/Portal/Index/get_code'
app.post(codeurl, { mobile: phone }).then((res) => {
//正确返回结果
console.log(res)
wx.showToast({
title: '发送成功',
})
_this.setData({
codeAc: false
})
let count = setInterval(() => {
let phoneCode = _this.data.time
phoneCode--
_this.setData({
time: phoneCode
})
if (phoneCode == 0) {
clearInterval(count)
_this.setData({
codeAc: true,
time: 60
})
}
}, 1000)
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
});
}
},
sexChange(e) {
this.setData({
sex: e.detail.value,
index: e.detail.value
})
},
resChange(e) {
console.log()
this.setData({
is_fudan: e.detail.value,
stuIndex: e.detail.value
})
},
getUserInfo: function (e) {
// 登录
let that = this;
let code;
if (e.detail.userInfo) {
this.setData({
authInfo: true
})
wx.login({
success: (res) => {
code = res.code;
let codeurl = '/Portal/Index/getOpenid';
let params = {
code: code,
gender: e.detail.userInfo.gender,
avatarUrl: e.detail.userInfo.avatarUrl,
nickName: e.detail.userInfo.nickName
}
app.post(codeurl, params).then((res) => {
//正确返回结果
wx.setStorageSync('openid', res.openid)
}).catch((errMsg) => {
console.log(errMsg);//错误提示信息
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false
})
});
}
})
app.globalData.userInfo = e.detail.userInfo
this.setData({
userName: e.detail.userInfo.nickName,
avatarUrl: e.detail.userInfo.avatarUrl,
authInfo: true
})
this.register();
} else {
this.setData({
authInfo: false
})
}
},
register() {
let params = {
openid: wx.getStorageSync('openid'),
name: this.data.name,
sex: this.data.sex,
is_res: this.data.is_res,
is_fudan: this.data.is_fudan,
mobile: this.data.mobile,
code: this.data.code
};
let reg = /^1[34578]\d{9}$/;
if (params.name == '' || typeof params.name == 'undefined') {
wx.showModal({
title: '提示',
content: '姓名不能为空!',
showCancel: false,
success: function (res) { }
})
return false;
} else if (!reg.test(params.mobile)) {
wx.showModal({
title: '提示',
content: '手机号格式有误!',
showCancel: false,
success: function (res) { }
})
return false;
} else if (params.code == '' || typeof params.code == 'undefined') {
wx.showModal({
title: '提示',
content: '验证码不能为空',
showCancel: false,
success: function (res) { }
})
return false;
} else {
let registerUrl = '/Portal/Index/res'
app.post(registerUrl, params).then((res) => {
wx.showToast({
title: res,
})
wx.navigateTo({
url: '../book/booklist',
})
}).catch((errMsg) => {
wx.showModal({
title: '提示',
content: errMsg,
showCancel: false,
success: function (res) { }
})
})
}
// 注册
},
viewFirst() {
wx.setStorageSync('type', 'article')
wx.navigateTo({
url: '/pages/article/article',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{}
\ No newline at end of file
... ...