tanyanfei 4 лет назад
Родитель
Сommit
22cbb96b5b

+ 4 - 3
app.json

@@ -1,12 +1,13 @@
 {
   "pages": [
     
-    
     "pages/index/index",
+    "pages/learning/learning",
+    
     "pages/mine/mine",
     "pages/knowledge/knowledge",
     "pages/search/search",
-    "pages/learning/learning",
+    "pages/conference/conference",
     "pages/order/order",
     "pages/searchList/searchList",
     "pages/wenzhang/wenzhang",
@@ -17,7 +18,7 @@
     "pages/eventDetail/eventDetail",
     "pages/order/hotel",
    
-    "pages/conference/conference",  
+    
     "pages/collect/collect",
     
    

+ 145 - 14
pages/conference/conference.js

@@ -7,7 +7,16 @@ Page({
    * 页面的初始数据
    */
   data: {
-    info:{}
+    info:{},
+    labels: {
+      company: '单位', name: '姓名', tax_company: '发票单位', idcard: '身份证号',
+      email: '邮箱', sex: '性别', age: '年龄', title: '职称',
+      remark1: '备注1', remark2: '备注2', remark3: '备注3', phone:'手机号'
+    },
+    sex_array: ['男', '女'],
+    sex: -1,
+    phone:'',
+    show:0
   },
 
   /**
@@ -17,29 +26,151 @@ Page({
     var that = this;
     wx.showNavigationBarLoading()
     var that = this;
-    wx.request({
-      url: host + '/api/detail',
-      method: 'GET',
-      data: {
-        type: 'activity',
-        id: options.id
+    wx.getStorage({
+      key: 'uid',
+      success: res => {
+        if (res.data) {
+          this.setData({
+            user_id: res.data
+          })
+          wx.request({
+            url: host + '/api/detail',
+            method: 'GET',
+            data: {
+              type: 'activity',
+              id: options.id,
+              uid: res.data
+            },
+            success: function (res) {
+              wx.hideNavigationBarLoading();
+              if(res.data.code != 0){
+                wx.showToast({
+                  title: '服务器开小差啦!',
+                  icon: 'none'
+                })
+                return
+              }
+              const info = res.data.data
+              if (info.sign_note) { info.sign_note = info.sign_note.replace(/\\n/, '\n') }
+              that.setData({
+                info: info
+              })
+            },
+            fail: function () {
+              wx.hideLoading();
+              wx.showToast({
+                title: '服务器开小差啦!',
+                icon: 'none'
+              })
+            }
+          })
+        }
       },
+    })
+  },
+  close: function () {
+    this.setData({
+      show: 0
+    })
+  },
+  open: function () {
+    this.setData({
+      show: 1
+    })
+  },
+  phoneChange: function (e) {
+    this.setData({
+      phone: e.detail.value
+    })
+  },
+  sendcode: function () {
+    if (this.data.phone.length < 11) {
+      wx.showToast({
+        title: '请输入正确的手机号',
+        icon: 'none'
+      })
+      return;
+    }
+    wx.request({
+      url: host + '/api/phcode',
+      method: 'POST',
+      data: { phone: this.data.phone },
       success: function (res) {
-        wx.hideNavigationBarLoading();
-        that.setData({
-          info: res.data.data
-        })
+        if (res.data.code == 0) {
+          wx.showToast({
+            title: '验证码已发送',
+          })
+        } else {
+          wx.showToast({
+            title: '发送失败',
+            icon: 'none'
+          })
+        }
       },
-      fail: function () {
-        wx.hideLoading();
+    })
+  },
+  bindSexChange: function (e) {
+    this.setData({
+      sex: e.detail.value
+    })
+  },
+  //提交报名信息
+  submit: function (e) {
+    var form = e.detail.value;
+    var list = this.data.list, index = this.data.index;
+    if (this.data.info.signup_fields.indexOf('sex') >= 0) {
+      form.sex = this.data.sex > -1 ? this.data.sex:''
+    }
+    form.uid = this.data.user_id;
+    form.conference_id = this.data.info.id;
+    form.conference_name = this.data.info.name;
+    form.type ='activity';
+    console.log(form)
+    var fields = this.data.info.signup_fields;
+    for(let i=0;i<fields.length;i++){
+      if (!form[fields[i]]){
         wx.showToast({
-          title: '服务器开小差啦!',
+          title: '请输入' + this.data.labels[fields[i]]+'!',
           icon: 'none'
         })
+        return;
       }
+    }
+    if (!form.code) {
+      wx.showToast({
+        title: '请输入验证码!',
+        icon: 'none'
+      })
+      return;
+    }
+    wx.showLoading({
+      title: '正在提交',
     })
+    wx.request({
+      url: host + '/api/user/signup',
+      method: 'POST',
+      data: form,
+      success: (res => {
+        if (res.data.code == 0) {
+          wx.hideLoading()
+          this.setData({
+            show: 0
+          })
+          wx.redirectTo({
+            url: '../order/order',
+          })
+        } else {
+          wx.showToast({
+            title: '提交失败',
+            icon: 'none'
+          })
+        }
+      })
+    })
+
   },
 
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 43 - 1
pages/conference/conference.wxml

@@ -1,5 +1,5 @@
+<image class='banner'  mode="widthFix" src="{{info.img}}"></image>
 <view class='name'>{{info.name}}</view>
-
 <view class="info">
   <text>发布单位:{{info.publish_unit}}</text>
   <text>主办方:{{info.hold_unit}}</text>
@@ -15,4 +15,46 @@
 <view class="title" wx:if='{{info.content}}'>活动内容:</view>
 <view class="content">
   <rich-text nodes='{{info.content}}'></rich-text>
+</view>
+<view class="list" wx:for='{{info.speaker}}'>
+                          <image mode="widthFix"  src="{{item.img}}"></image>
+                          <view>
+                              <view class="tt">{{item.name}}  </view>
+                              <text>{{item.intruduce}}</text>
+                          </view>
+</view> 
+<button  wx:if='{{info.is_signup}}' bindtap="open" class="post">我要报名</button>
+<view class="bg" wx:if='{{show}}'> 
+  <form  class="form" bindsubmit='submit'>
+        <image bindtap='close' class='close'  mode="widthFix" src="../images/close.png"></image>
+        <view class="form_tt">请填写报名信息</view>
+        <view class="item">
+            <label>手机号:</label>
+            <input bindinput="phoneChange" name='phone' 
+            placeholder-style='color:#999;' placeholder="请输入手机号"></input>
+            <text bindtap="sendcode" class="code">发送验证码</text>
+        </view>
+        <view class="item">
+            <label>验证码:</label><input name='code' placeholder-style='color:#999;' placeholder="请输入验证码"></input>
+        </view>
+        <view class="item" wx:for='{{info.signup_fields}}' wx:if='{{item!="phone"}}'>
+            <label>{{labels[item]}}:</label>
+            <input wx:if='{{item!="sex"}}' name='{{item}}' placeholder-style='color:#999;'  
+            placeholder="请输入{{labels[item]}}"></input>
+            <picker wx:if='{{item == "sex"}}' name='sex' bindchange="bindSexChange" 
+              value="{{sex}}" range="{{sex_array}}">
+              <view class="picker">
+                <text wx:if='{{sex<0}}'>请选择</text>
+                {{sex_array[sex]}}
+              </view>
+            </picker>
+        </view>
+
+
+        
+     
+        <text class="ts">温馨提示</text>
+        <text class="ts">报名成功后工作人员会尽快与您取得联系</text>
+        <button  formType="submit"  class="post">提交报名信息</button>
+  </form>
 </view>

+ 130 - 3
pages/conference/conference.wxss

@@ -2,10 +2,14 @@
 page{
   background: #fff;
 }
+.banner{
+  width: 100%;
+  border-radius: 18rpx;
+}
 .name{
-  font-size: 36rpx;
-  text-align: center;
-  color: #000;
+  font-size: 32rpx;
+  margin-top: 20rpx;
+  color: #333;
   margin-bottom: 30rpx;
 }
 .info text{
@@ -22,4 +26,127 @@ page{
   color: #666;
   line-height: 52rpx;
   margin-bottom: 20rpx;
+}
+.post{
+  width: 100% !important;
+  background: #0580D3;
+  color: #fff;
+  display: block;
+  font-size: 34rpx;
+  height: 90rpx;
+  line-height: 90rpx;
+  padding: 0;
+  border-radius: 18rpx;
+  margin-top: 30rpx;
+}
+.bg{
+  position: fixed;
+  width: 100%;
+  height: 100vh;
+  top: 0;
+  left: 0;
+  z-index: 99;
+  background: rgba(0,0,0,.5);
+  padding: 50rpx 0;
+  overflow: auto;
+}
+.form{
+  background: #fff;
+  border-radius: 18rpx;
+  padding: 50rpx 60rpx;
+  display: block;
+  position: relative;
+  width: 90%;
+  margin: auto;
+}
+.form_tt{
+  text-align: center;
+  color: #333;
+  font-size: 30rpx;
+  margin-bottom: 50rpx;
+}
+.item{
+  background: #F7F7F7;
+  height: 72rpx;
+  border-radius: 10rpx;
+  position: relative;
+  display: flex;
+  margin-bottom: 18rpx;
+  padding: 0 20rpx;
+}
+.item label{
+  line-height: 72rpx;
+  color: #999;
+  width: 32%;
+
+}
+.item input{
+  width: 63%;
+  height: 72rpx;
+}
+.item picker{
+  width: 63%;
+}
+.form .ts{
+  display: block;
+  text-align: center;
+  color: #999;
+  font-size: 22rpx;
+  line-height: 50rpx;
+}
+.close{
+  width: 50rpx;
+  position: absolute;
+  top: 20rpx;
+  right: 20rpx;
+}
+.code{
+  position: absolute;
+  color: #1682DA;
+  font-size: 22rpx;
+  right: 24rpx;
+  top: 0;
+  line-height: 72rpx;
+  z-index: 99;
+}
+.picker{
+  line-height: 72rpx;
+}
+.list{
+  /* box-shadow: 0px 2rpx 9rpx 0px rgba(0, 0, 0, 0.2); */
+  /* border-radius: 20rpx; */
+  display: flex;
+  /* padding: 20rpx; */
+  /* box-shadow: 0 0 15rpx 0px rgba(0, 0, 0, 0.2); */
+  /* margin: 0 20rpx 40rpx; */
+  border-bottom: 1px solid #F0F0F0;
+  padding: 28rpx 0;
+  
+}
+.list image{
+  width: 20%;
+  /* height: 50px; */
+}
+.list>view{
+  width: 80%;
+  vertical-align: middle;
+  padding-left: 20rpx;  
+}
+.list .tt{
+  margin-bottom: 20rpx;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+  font-size: 28rpx;
+}
+.list text{
+  color: #999;
+  display: block;
+  overflow: hidden;
+    text-overflow: ellipsis;
+    display: -webkit-box;
+    -webkit-line-clamp: 2;
+    -webkit-box-orient: vertical;
+    white-space: normal;
+    font-size: 26rpx;
 }

+ 2 - 1
pages/eventDetail/eventDetail.js

@@ -223,10 +223,11 @@ Page({
     if (this.data.info.signup_fields.indexOf('company')>=0){
       form.organizer_unit = list[0][index[0]].value + list[1][index[1]].value + list[2][index[2]].value
     }
-    
+    form.sex=this.data.sex
     form.uid=this.data.user_id;
     form.conference_id=this.data.info.id;
     form.conference_name = this.data.info.name;
+    form.type = 'conference';
     if(!form.name){
       wx.showToast({
         title: '请输入姓名!',

+ 1 - 0
pages/eventDetail/eventDetail.wxml

@@ -55,6 +55,7 @@
 <button  wx:if='{{info.is_signup && !info.is_user_signuped}}' bindtap="open" class="post">我要报名</button>
 <button  wx:if='{{info.is_signup && info.is_user_signuped}}' disabled="true" class="post">已报名</button>
 
+
 <view class="bg" wx:if='{{show}}'>
     <form wx:if='{{page==1}}' class="form" bindsubmit='submit'>
       <image bindtap='close' class='close'  mode="widthFix" src="../images/close.png"></image>

+ 23 - 13
pages/order/order.wxml

@@ -3,19 +3,29 @@
     <text bindtap="tab" data-id='2' class="{{act==2?'act':''}}">已结束</text>
 </view>
 <view class="content">
-    <navigator class="list" wx:for='{{list}}' url="../eventDetail/eventDetail?id={{item.conference_id}}">
-        <image src="{{item.conference_img}}"></image>
-        <view >
-            <view class="title">{{item.conference_name}}</view>
-            <text>报名时间:{{item.ctime}}</text>
-            <navigator url="../eventDetail/eventDetail?id={{item.conference_id}}&apply_id={{item.id}}" class="btn" wx:if='{{item.signup_status==0 || item.signup_status==-1}}' >上传凭证</navigator>
-            <navigator class="btn" style="background:#999;" wx:if='{{item.signup_status==1}}' >待审核</navigator>
-            <navigator class="btn" wx:if='{{item.signup_status==2}}' url="../order/hotel?id={{item.conference_id}}&&aid={{item.id}}"  class="btn">选酒店</navigator>
-            <view catchtap="verify" data-url='{{item.verify_qrcode}}' class="btn" wx:if='{{item.signup_status==3}}' >核销</view>
-            <view class="btn" style="background:#999;" wx:if='{{item.signup_status==4}}' >已核销</view>
-          
-        </view>
-    </navigator>
+  <block wx:for='{{list}}'>
+      <navigator wx:if='{{item.type=="activity"}}' class="list"  url="../conference/conference?id={{item.conference_id}}">
+          <image src="{{item.conference_img}}"></image>
+          <view >
+              <view class="title">{{item.conference_name}}</view>
+              <text>报名时间:{{item.ctime}}</text>
+            
+          </view>
+      </navigator>
+      <navigator wx:else class="list"  url="../eventDetail/eventDetail?id={{item.conference_id}}">
+          <image src="{{item.conference_img}}"></image>
+          <view >
+              <view class="title">{{item.conference_name}}</view>
+              <text>报名时间:{{item.ctime}}</text>
+              <navigator url="../eventDetail/eventDetail?id={{item.conference_id}}&apply_id={{item.id}}" class="btn" wx:if='{{item.signup_status==0 || item.signup_status==-1}}' >上传凭证</navigator>
+              <navigator class="btn" style="background:#999;" wx:if='{{item.signup_status==1}}' >待审核</navigator>
+              <navigator class="btn" wx:if='{{item.signup_status==2}}' url="../order/hotel?id={{item.conference_id}}&&aid={{item.id}}"  class="btn">选酒店</navigator>
+              <view catchtap="verify" data-url='{{item.verify_qrcode}}' class="btn" wx:if='{{item.signup_status==3}}' >核销</view>
+              <view class="btn" style="background:#999;" wx:if='{{item.signup_status==4}}' >已核销</view>
+            
+          </view>
+      </navigator>
+    </block>
 </view>
 
 <view class="bg" wx:if='{{code}}' bindtap="close">