Explorar el Código

FIX

修复信息数据缺失问题
RegMs If hace 4 años
padre
commit
fd53e89862

+ 13 - 13
cloudfunctions/createMessage/index.js

@@ -26,7 +26,7 @@ exports.main = async (event, context) => {
     }
   }
 
-  if (!event.type) {
+  if (event.type === '纳新') {
     const publisher = await db.collection('publisher')
       .doc(event.pub_id)
       .get()
@@ -36,19 +36,19 @@ exports.main = async (event, context) => {
   const message = await db.collection('message')
     .add({
       data: {
-        pub_id: event.pub_id,
+        pub_id: event.pub_id || '',
         user_id: OPENID,
-        name: event.name,
-        type: event.type,
-        brief: event.brief,
-        poster: event.poster,
-        photo: event.photo,
-        tag: event.tag,
-        orient: event.orient,
-        time: event.time,
-        place: event.place,
-        contact: event.contact,
-        detail: event.detail,
+        name: event.name || '',
+        type: event.type || '',
+        brief: event.brief || '',
+        poster: event.poster || '',
+        photo: event.photo || '',
+        tag: event.tag || '',
+        orient: event.orient || '',
+        time: event.time || '',
+        place: event.place || '',
+        contact: event.contact || '',
+        detail: event.detail || '',
         publish_time: new Date()
       }
     })

+ 9 - 9
cloudfunctions/createPublisher/index.js

@@ -38,15 +38,15 @@ exports.main = async (event, context) => {
   const publisher = await db.collection('publisher')
     .add({
       data: {
-        name: event.name,
-        type: event.type,
-        level: event.level,
-        intro: event.intro,
-        avatar: event.avatar,
-        phone: event.phone,
-        email: event.email,
-        qq: event.qq,
-        wechat: event.wechat,
+        name: event.name || '',
+        type: event.type || '',
+        level: event.level || '',
+        intro: event.intro || '',
+        avatar: event.avatar || '',
+        phone: event.phone || '',
+        email: event.email || '',
+        qq: event.qq || '',
+        wechat: event.wechat || '',
         reside_time: new Date()
       }
     })

+ 2 - 2
cloudfunctions/createUser/index.js

@@ -15,8 +15,8 @@ exports.main = async (event, context) => {
       .add({
         data: {
           _id: OPENID,
-          name: event.name,
-          avatar: event.avatar,
+          name: event.name || '',
+          avatar: event.avatar || '',
           gender: event.gender ? '男' : '女',
           university: '浙江大学',
           theme: '默认',

+ 1 - 1
cloudfunctions/getMessage/index.js

@@ -31,7 +31,7 @@ exports.main = async (event, context) => {
       .add({
         data: {
           user_id: OPENID,
-          msg_id: event.msg_id,
+          msg_id: event.msg_id || '',
           read_time: new Date()
         }
       })

+ 5 - 105
miniprogram/pages/activityPublish/activityPublish.js

@@ -65,113 +65,13 @@ Page({
   },
 
   switch4: function (e) {
-    // var obj = {}
-    // if (this.data.currentTab == 1) {
-    //   if (this.data.activityName == '' || this.data.activityTime == '' || this.data.activityPlace == '' ||
-    //     this.data.activityAttr.length == 0 || this.data.activityContact == '' || this.data.activityDetail == '') {
-    //     wx.showToast({
-    //       title: '请确认信息填写完整',
-    //       icon: 'none'
-    //     })
-    //     return
-    //   }
-    //   obj = {
-    //     title: this.data.activityName,
-    //     subTitle: this.data.activitySubTitle,
-    //     activityTime: this.data.activityTime,
-    //     place: this.data.activityPlace,
-    //     attribute: this.data.activityAttr,
-    //     supply: this.data.activitySupply,
-    //     contactDetails: this.data.activityContact,
-    //     objectOriented: this.data.activityAim,
-    //     details: this.data.activityDetail,
-    //     poster: this.data.activityPoster.length == 0 ? '' : this.data.activityPoster[0],
-    //     photo: this.data.activityPicture,
-    //     publicity: this.data.activityProInfo,
-    //     registrationLink: this.data.activitySrc
-    //   }
-    // } else if (this.data.currentTab == 2) {
-    //   if (this.data.recruitName == '' || this.data.recruitTime == '' || this.data.recruitAttr == '' ||
-    //     this.data.recruitContact == '' || this.data.recruitDetail == '') {
-    //     wx.showToast({
-    //       title: '请确认信息填写完整',
-    //       icon: 'none'
-    //     })
-    //     return
-    //   }
-    //   obj = {
-    //     title: this.data.recruitName,
-    //     subTitle: this.data.recruitSubTitle,
-    //     activityTime: this.data.recruitTime,
-    //     attribute: this.data.recruitAttr,
-    //     contactDetails: this.data.recruitContact,
-    //     objectOriented: this.data.recruitAim,
-    //     details: this.data.recruitDetail,
-    //     poster: this.data.recruitPoster.length == 0 ? '' : this.data.recruitPoster[0],
-    //     photo: this.data.recruitPicture,
-    //     publicity: this.data.recruitProInfo,
-    //     registrationLink: this.data.recruitSrc
-    //   }
-    // } else {
-    //   if (this.data.notiName == '' || this.data.notiAttr.length == 0 || this.data.notiDetail == '') {
-    //     wx.showToast({
-    //       title: '请确认信息填写完整',
-    //       icon: 'none'
-    //     })
-    //     return
-    //   }
-    //   obj = {
-    //     title: this.data.notiName,
-    //     subTitle: this.data.notiSubTitle,
-    //     attribute: this.data.notiAttr,
-    //     objectOriented: this.data.notiAim,
-    //     details: this.data.notiDetail,
-    //     poster: this.data.notiPoster.length == 0 ? '' : this.data.notiPoster[0],
-    //     photo: this.data.notiPicture
-    //   }
-    // }
-    // obj.time = new Date()
-    // obj.publisherId = this.data.publisherId
-    // wx.showLoading({
-    //   title: '发布中'
-    // })
-    // const db = wx.cloud.database()
-    // db.collection('publisherInfoData').doc(this.data.publisherId).get({
-    //   success: async function (res) {
-    //     obj.publisherAvatar = res.data.publisherAvatar
-    //     obj.publisherName = res.data.publisherName
-    //     if (obj.poster != '') {
-    //       obj.poster = (await wx.cloud.uploadFile({
-    //         cloudPath: 'activityPoster/' + this.randomString() + '.jpg',
-    //         filePath: obj.poster
-    //       })).fileID
-    //     }
-    //     var arr = []
-    //     for (let i = 0; i < obj.photo.length; i++) {
-    //       arr.push(wx.cloud.uploadFile({
-    //         cloudPath: 'informPhoto/' + this.randomString() + '.jpg',
-    //         filePath: obj.photo[i]
-    //       }))
-    //     }
-    //     arr = await Promise.all(arr)
-    //     for (let i = 0; i < obj.photo.length; i++) {
-    //       obj.photo[i] = arr[i].fileID
-    //     }
-    //     db.collection('mainData').add({
-    //       data: obj,
-    //       success: function () {
-    //         this.setData({
-    //           currentTab: 4
-    //         })
-    //         wx.hideLoading()
-    //       }.bind(this)
-    //     })
-    //   }.bind(this)
-    // })
-
     const value = e.detail.value
 
-    if (value.name === '' || this.data.currentTab !== 2 && value.type === '' || this.data.detail === '') {
+    if (this.data.currentTab === 2) {
+      value.type = '纳新'
+    }
+
+    if (value.name === '' || value.type === '' || this.data.detail === '') {
       wx.showToast({
         title: '请确认信息填写完整',
         icon: 'none'

+ 6 - 6
miniprogram/pages/activityPublish/activityPublish.wxml

@@ -3,7 +3,7 @@
 
 <view class="title primary-text-color">信息发布</view>
 
-<view wx:if="{{currentTab == 0}}" class="con">
+<view wx:if="{{currentTab === 0}}" class="con">
   <view class="title2">信息发布类型</view>
   <view class="buttons">
     <myButton class="button" type="primary" bindtap="switch1">活动</myButton>
@@ -12,7 +12,7 @@
   </view>
 </view>
 
-<scroll-view wx:if="{{currentTab == 1}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 1}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">活动发布</view>
   <form bindsubmit="switch4">
     <view class="block">
@@ -51,7 +51,7 @@
         </label>
       </checkbox-group>
     </view>
-    <view class="block" style="margin-bottom: 20rpx;">
+    <view class="block">
       <view class="cate">面向对象</view>
       <input class="input" placeholder="请填写" name="orient" />
     </view>
@@ -75,7 +75,7 @@
   </form>
 </scroll-view>
 
-<scroll-view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 2}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">纳新发布</view>
   <form bindsubmit="switch4">
     <view class="block">
@@ -122,7 +122,7 @@
   </form>
 </scroll-view>
 
-<scroll-view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 3}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">通知发布</view>
   <form bindsubmit="switch4">
     <view class="block">
@@ -161,7 +161,7 @@
   </form>
 </scroll-view>
 
-<view wx:if="{{currentTab == 4}}" class="con">
+<view wx:if="{{currentTab === 4}}" class="con">
   <view class="con1 primary-text-color">发布成功!</view>
   <image class="success-icon" src="../../images/finish.png" mode="aspectFill" />
   <!-- <view class="con2"></view> -->

+ 5 - 2
miniprogram/pages/publisherLogin/publisherLogin.js

@@ -43,10 +43,13 @@ Page({
     })
   },
 
-
   switch5: function (e) {
     const value = e.detail.value
 
+    if (this.data.currentTab === 4) {
+      value.level = '校级'
+    }
+
     if (value.code === '' || value.name === '' || value.level === '' || value.intro === '' || value.avatar.length === 0) {
       wx.showToast({
         title: '请确认信息填写完整',
@@ -66,7 +69,7 @@ Page({
       wx.showLoading({
         title: '正在入驻',
       })
-      value.type = this.data.currentTab === 2 ? '组织' : '社团'
+      value.type = this.data.currentTab === 2 ? '组织' : this.data.currentTab === 3 ? '社团' : '学校部门'
       value.avatar = res.fileID
       return wx.cloud.callFunction({
         name: 'createPublisher',

+ 6 - 6
miniprogram/pages/publisherLogin/publisherLogin.wxml

@@ -1,7 +1,7 @@
 <!--为社团/组织入驻页面-->
 <view class="title primary-text-color">社团/组织入驻</view>
 
-<scroll-view wx:if="{{currentTab == 0}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 0}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">社团/组织如何注册入驻?</view>
   <view class="sub-sub-title">1、前提条件</view>
   <view class="text">浙江大学社团/学生组织的负责人代表社团/学生组织进行入驻登记。</view>
@@ -24,7 +24,7 @@
   <myButton class="button" type="primary" bindtap="switch1">一键入驻</myButton>
 </scroll-view>
 
-<view wx:if="{{currentTab == 1}}" class="con">
+<view wx:if="{{currentTab === 1}}" class="con">
   <view class="title2">请问您入驻的类型是?</view>
   <view class="buttons">
     <myButton class="button" type="primary" bindtap="switch2">组织</myButton>
@@ -33,7 +33,7 @@
   </view>
 </view>
 
-<scroll-view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 2}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">组织入驻</view>
   <form bindsubmit="switch5">
     <view class="block" style="margin-bottom: 20rpx;">
@@ -80,7 +80,7 @@
   </form>
 </scroll-view>
 
-<scroll-view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 3}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">社团入驻</view>
   <form bindsubmit="switch5">
     <view class="block" style="margin-bottom: 20rpx;">
@@ -127,7 +127,7 @@
   </form>
 </scroll-view>
 
-<scroll-view wx:if="{{currentTab == 4}}" scroll-y style="height: {{winHeight - 60}}px;">
+<scroll-view wx:if="{{currentTab === 4}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="sub-title">学校部门入驻</view>
   <form bindsubmit="switch5">
     <view class="block" style="margin-bottom: 20rpx;">
@@ -166,7 +166,7 @@
   </form>
 </scroll-view>
 
-<view wx:if="{{currentTab == 5}}" class="con">
+<view wx:if="{{currentTab === 5}}" class="con">
   <view class="con1">恭喜您完成填写!</view>
   <image class="pic" src="../../images/finish.png" mode="aspectFill" />
   <view class="con2">感谢您的入驻</view>

+ 6 - 0
miniprogram/pages/publisherPage/publisherPage.js

@@ -37,6 +37,12 @@ Page({
     })
   },
 
+  publisherLogin: function () {
+    wx.navigateTo({
+      url: "/pages/publisherLogin/publisherLogin",
+    })
+  },
+
   /**
    * 生命周期函数--监听页面加载
    */

+ 10 - 3
miniprogram/pages/publisherPage/publisherPage.wxml

@@ -46,8 +46,7 @@
   <view class="btn-arrow secondary-text">></view>
 </view>
 
-
-<view class="block" hover-class="btn-hover" bindtap="publisherInfoChange">
+<view class="block2" hover-class="btn-hover" bindtap="publisherInfoChange">
   <view class="left">
     <image class="btn-icon" mode="aspectFit" src="/images/publisher/adjust.png"></image>
     <view class="btn-text primary-text">社团组织信息修改</view>
@@ -63,4 +62,12 @@
     </view>
     <view class="btn-arrow secondary-text">></view>
   </view>
-</picker>
+</picker>
+
+<view class="block" hover-class="btn-hover" bindtap="publisherLogin">
+  <view class="left">
+    <image class="btn-icon" mode="aspectFit" src="/images/publisher/adjust.png"></image>
+    <view class="btn-text primary-text">社团组织入驻</view>
+  </view>
+  <view class="btn-arrow secondary-text">></view>
+</view>