Procházet zdrojové kódy

Merge refs/remotes/origin/master into refs/heads/master

mulioid před 4 roky
rodič
revize
30454ed842

+ 6 - 0
cloudfunctions/createMessage/config.json

@@ -0,0 +1,6 @@
+{
+  "permissions": {
+    "openapi": [
+    ]
+  }
+}

+ 47 - 0
cloudfunctions/createMessage/index.js

@@ -0,0 +1,47 @@
+// 云函数入口文件
+const cloud = require('wx-server-sdk')
+
+cloud.init()
+const db = cloud.database()
+
+// 云函数入口函数
+exports.main = async (event, context) => {
+  let {
+    OPENID
+  } = cloud.getWXContext()
+
+  const manage_check = await db.collection('manager').where({
+    pub_id: event.pub_id,
+    user_id: OPENID
+  }).get()
+  if (manage_check.data.length === 0) {
+    return {
+      errMsg: '只有管理员可以发布'
+    }
+  }
+  if (manage_check.data[0].role !== '拥有者' && manage_check.data[0].role !== '发布者') {
+    return {
+      errMsg: '没有发布权限'
+    }
+  }
+
+  const message = await db.collection('message').add({
+    data: {
+      pub_id: '',
+      name: '',
+      type: '',
+      brief: '',
+      poster: '',
+      photo: '',
+      tag: '',
+      orient: '',
+      time: '',
+      place: '',
+      contact: '',
+      detail: '',
+      publish_time: new Date()
+    }
+  })
+
+  return message
+}

+ 14 - 0
cloudfunctions/createMessage/package.json

@@ -0,0 +1,14 @@
+{
+  "name": "createMessage",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "wx-server-sdk": "~2.4.0"
+  }
+}

+ 9 - 0
cloudfunctions/createPublisher/index.js

@@ -23,6 +23,7 @@ exports.main = async (event, context) => {
       errMsg: '邀请码已被使用'
     }
   }
+
   const name_check = await db.collection('publisher').where({
     name: event.name
   }).get()
@@ -31,6 +32,7 @@ exports.main = async (event, context) => {
       errMsg: '名称已存在'
     }
   }
+
   const publisher = await db.collection('publisher').add({
     data: {
       name: event.name,
@@ -38,9 +40,14 @@ exports.main = async (event, context) => {
       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()
     }
   })
+
   await db.collection('invite').where({
     code: event.code
   }).update({
@@ -49,6 +56,7 @@ exports.main = async (event, context) => {
       use_time: new Date()
     }
   })
+
   await db.collection('manager').add({
     data: {
       pub_id: publisher._id,
@@ -57,5 +65,6 @@ exports.main = async (event, context) => {
       role: '拥有者'
     }
   })
+
   return publisher
 }

+ 17 - 9
miniprogram/components/imagePicker/imagePicker.js

@@ -1,10 +1,12 @@
 // components/imagePicker/imagePicker.js
 Component({
+  behaviors: ['wx://form-field'],
+
   /**
    * 组件的属性列表
    */
   properties: {
-    images: Array,
+    value: Array,
     max: Number,
     imageWidth: Number,
     imageHeight: Number,
@@ -19,9 +21,9 @@ Component({
   },
 
   observers: {
-    'images, max, readonly': function (images, max, readonly) {
+    'value, max, readonly': function (value, max, readonly) {
       this.setData({
-        imageMargin: images.length + (images.length < max && !readonly) > 1 ? 5 : 0
+        imageMargin: value.length + (value.length < max && !readonly) > 1 ? 5 : 0
       })
     }
   },
@@ -42,23 +44,29 @@ Component({
 
     previewImage: function (e) {
       wx.previewImage({
-        urls: this.data.images,
+        urls: this.data.value,
         current: e.currentTarget.dataset.url
       })
     },
 
     removeImage: function (e) {
-      this.properties.images.splice(this.properties.images.indexOf(e.currentTarget.dataset.url), 1)
+      this.data.value.splice(this.data.value.indexOf(e.currentTarget.dataset.url), 1)
+      this.setData({
+        value: this.data.value
+      })
       this.triggerEvent("change", {
-        images: this.properties.images
+        value: this.data.value
       })
     },
 
     addImage: function () {
-      this.chooseImage(this.properties.max - this.properties.images.length, (imgs) => {
-        this.properties.images = this.properties.images.concat(imgs)
+      this.chooseImage(this.data.max - this.data.value.length, (imgs) => {
+        this.data.value = this.data.value.concat(imgs)
+        this.setData({
+          value: this.data.value
+        })
         this.triggerEvent("change", {
-          images: this.properties.images
+          value: this.data.value
         })
       })
     },

+ 2 - 2
miniprogram/components/imagePicker/imagePicker.wxml

@@ -1,6 +1,6 @@
 <!--components/imagePicker/imagePicker.wxml-->
 <view class="image-list">
-  <label wx:for="{{images}}" wx:for-item="item" wx:key="*this">
+  <label wx:for="{{value}}" wx:for-item="item" wx:key="*this">
     <image class="image"
       style="position: relative; margin: {{imageMargin}}rpx; width: {{imageWidth}}rpx; height: {{imageHeight}}rpx;"
       src="{{item}}" mode="aspectFill" data-url="{{item}}" catchtap="previewImage">
@@ -8,7 +8,7 @@
         data-url="{{item}}" catchtap="removeImage"></icon>
     </image>
   </label>
-  <image wx:if="{{images.length < max && !readonly}}" class="image"
+  <image wx:if="{{value.length < max && !readonly}}" class="image"
     style="margin: {{imageMargin}}rpx; width: 150rpx; height: 150rpx;" src="/images/add.png" mode="aspectFill"
     catchtap="addImage"></image>
 </view>

+ 47 - 0
miniprogram/components/myButton/myButton.js

@@ -0,0 +1,47 @@
+// components/myButton/myButton.js
+Component({
+  options: {
+    styleIsolation: 'apply-shared'
+  },
+
+  behaviors: ['wx://form-field-button'],
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    type: String,
+    size: String
+  },
+
+  lifetimes: {
+    attached: function () {
+      if (this.data.type !== 'default' && this.data.type !== 'primary') {
+        this.setData({
+          type: 'default'
+        })
+      }
+      if (this.data.size !== 'default' && this.data.type !== 'large') {
+        this.setData({
+          size: 'default'
+        })
+      }
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    handleTap: function () {
+      this.triggerEvent('tap');
+    }
+  }
+})

+ 4 - 0
miniprogram/components/myButton/myButton.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 6 - 0
miniprogram/components/myButton/myButton.wxml

@@ -0,0 +1,6 @@
+<!--components/myButton/myButton.wxml-->
+<button
+  class="{{'my-button ' + (type === 'primary' ? 'primary-background-color white-text-color ' : 'secondary-background-color primary-border-color ') + (size === 'large' && 'large-button ')}}"
+  bind="handleTap" form-type="submit">
+  <slot></slot>
+</button>

+ 9 - 0
miniprogram/components/myButton/myButton.wxss

@@ -0,0 +1,9 @@
+/* components/myButton/myButton.wxss */
+.my-button {
+  font-size: 30rpx;
+  border-radius: 50rpx;
+  width: 250rpx !important;
+  font-weight: normal !important;
+}
+
+.large-button {}

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

@@ -4,100 +4,126 @@ Page({
    * 页面的初始数据
    */
   data: {
-    currentTab:0,
-    winWidth:0,
-    winHeight:0,
-    activityName:"",
-    activitySubTitle:"",
-    activityTime:"",
-    activityPlace:"",
-    activityContact:"",
-    activityAim:"",
-    activityDetail:"",
-    activityPoster:[],
-    activityPicture:[],
-    activityProInfo:"",
-    activitySrc:"",
+    currentTab: 0,
+    winWidth: 0,
+    winHeight: 0,
+    activityName: "",
+    activitySubTitle: "",
+    activityTime: "",
+    activityPlace: "",
+    activityContact: "",
+    activityAim: "",
+    activityDetail: "",
+    activityPoster: [],
+    activityPicture: [],
+    activityProInfo: "",
+    activitySrc: "",
     activityAttr: [],
     activitySupply: [],
-    recruitName:"",
-    recruitSubTitle:"",
-    recruitTime:"",
+    recruitName: "",
+    recruitSubTitle: "",
+    recruitTime: "",
     recruitAttr: "",
-    recruitContact:"",
-    recruitAim:"",
-    recruitDetail:"",
-    recruitPoster:[],
-    recruitPicture:[],
-    recruitProInfo:"",
-    recruitSrc:"",
-    notiName:"",
-    notiSubTitle:"",
-    notiAttr:[],
-    notiAim:"",
-    notiDetail:"",
-    notiPoster:[],
-    notiPicture:[],
-    types1:["志愿活动", "文艺活动", "体育活动", "学术活动", "其他活动"],
-    types2:["二课分", "三课分", "志愿者小时数", "综素", "勤工助学", "活动纪实"],
-    types3:["组织纳新", "社团纳新"],
-    types4:["选课通知", "水电通知", "缴费通知", "其他通知"],
+    recruitContact: "",
+    recruitAim: "",
+    recruitDetail: "",
+    recruitPoster: [],
+    recruitPicture: [],
+    recruitProInfo: "",
+    recruitSrc: "",
+    notiName: "",
+    notiSubTitle: "",
+    notiAttr: [],
+    notiAim: "",
+    notiDetail: "",
+    notiPoster: [],
+    notiPicture: [],
+    types1: ["志愿活动", "文艺活动", "体育活动", "学术活动", "其他活动"],
+    types2: ["二课分", "三课分", "志愿者小时数", "综素", "勤工助学", "活动纪实"],
+    types3: ["组织纳新", "社团纳新"],
+    types4: ["选课通知", "水电通知", "缴费通知", "其他通知"],
     publisherId: ""
   },
 
-  activityAttrUpdate:function(e){
-    this.setData({activityAttr:e.detail.value})
+  activityAttrUpdate: function (e) {
+    this.setData({
+      activityAttr: e.detail.value
+    })
   },
 
-  activitySupplyUpdate:function(e){
-    this.setData({activitySupply:e.detail.value})
+  activitySupplyUpdate: function (e) {
+    this.setData({
+      activitySupply: e.detail.value
+    })
   },
 
-  recruitAttrUpdate:function(e){
-    this.setData({recruitAttr:e.detail.value})
-  } , 
+  recruitAttrUpdate: function (e) {
+    this.setData({
+      recruitAttr: e.detail.value
+    })
+  },
 
-  notiAttrUpdate:function(e){
-    this.setData({notiAttr:e.detail.value})
-  } , 
+  notiAttrUpdate: function (e) {
+    this.setData({
+      notiAttr: e.detail.value
+    })
+  },
 
-  updateActivityPoster:function(e){
-    this.setData({activityPoster: e.detail.images})
+  updateActivityPoster: function (e) {
+    this.setData({
+      activityPoster: e.detail.images
+    })
   },
 
-  updateActivityPicture:function(e){
-    this.setData({activityPicture: e.detail.images})
+  updateActivityPicture: function (e) {
+    this.setData({
+      activityPicture: e.detail.images
+    })
   },
 
-  updateRecruitPoster:function(e){
-    this.setData({recruitPoster: e.detail.images})
+  updateRecruitPoster: function (e) {
+    this.setData({
+      recruitPoster: e.detail.images
+    })
   },
 
-  updateRecruitPicture:function(e){
-    this.setData({recruitPicture: e.detail.images})
+  updateRecruitPicture: function (e) {
+    this.setData({
+      recruitPicture: e.detail.images
+    })
   },
 
-  updateNotiPoster:function(e){
-    this.setData({notiPoster: e.detail.images})
+  updateNotiPoster: function (e) {
+    this.setData({
+      notiPoster: e.detail.images
+    })
   },
 
-  updateNotiPicture:function(e){
-    this.setData({notiPicture: e.detail.images})
+  updateNotiPicture: function (e) {
+    this.setData({
+      notiPicture: e.detail.images
+    })
   },
 
-  switch1:function(e){
-    this.setData({currentTab:1})
+  switch1: function (e) {
+    this.setData({
+      currentTab: 1
+    })
   },
 
-  switch2:function(e){
-    this.setData({currentTab:2})
+  switch2: function (e) {
+    this.setData({
+      currentTab: 2
+    })
   },
 
-  switch3:function(e){
-    this.setData({currentTab:3})
+  switch3: function (e) {
+    this.setData({
+      currentTab: 3
+    })
   },
 
-  randomString:function(){
+  randomString: function () {
     var char = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
     var str = ""
     for (var i = 0; i < 16; i++) {
@@ -106,11 +132,11 @@ Page({
     return str
   },
 
-  switch4:function(e){
+  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 == "") {
+        this.data.activityAttr.length == 0 || this.data.activityContact == "" || this.data.activityDetail == "") {
         wx.showToast({
           title: "请确认信息填写完整",
           icon: "none"
@@ -134,7 +160,7 @@ Page({
       }
     } else if (this.data.currentTab == 2) {
       if (this.data.recruitName == "" || this.data.recruitTime == "" || this.data.recruitAttr == "" ||
-      this.data.recruitContact == "" || this.data.recruitDetail == "") {
+        this.data.recruitContact == "" || this.data.recruitDetail == "") {
         wx.showToast({
           title: "请确认信息填写完整",
           icon: "none"
@@ -202,7 +228,9 @@ Page({
         db.collection("mainData").add({
           data: obj,
           success: function () {
-            this.setData({currentTab:4})
+            this.setData({
+              currentTab: 4
+            })
             wx.hideLoading()
           }.bind(this)
         })
@@ -210,7 +238,7 @@ Page({
     })
   },
 
-  returnToUser:function(e){
+  returnToUser: function (e) {
     wx.navigateBack()
   },
 
@@ -223,13 +251,17 @@ Page({
     })
     wx.getSystemInfo({
       success: function (res) {
-        this.setData({winWidth:res.windowWidth})
-        this.setData({winHeight:res.windowHeight})
+        this.setData({
+          winWidth: res.windowWidth
+        })
+        this.setData({
+          winHeight: res.windowHeight
+        })
       }.bind(this),
     })
   },
-  
-  updatePage: function(e) {
+
+  updatePage: function (e) {
     this.setData({
       currentTab: e.detail.current
     })

+ 2 - 1
miniprogram/pages/activityPublish/activityPublish.json

@@ -1,5 +1,6 @@
 {
   "usingComponents": {
-    "imagePicker": "/components/imagePicker/imagePicker"
+    "imagePicker": "/components/imagePicker/imagePicker",
+    "myButton": "/components/myButton/myButton"
   }
 }

+ 76 - 40
miniprogram/pages/activityPublish/activityPublish.wxml

@@ -6,9 +6,15 @@
 <view wx:if="{{currentTab == 0}}" class="con">
   <view class="title2">信息发布类型</view>
   <view class="buttons">
-    <view><button class="button primary-background-color white-text-color" bindtap="switch1">活动</button></view>
-    <view><button class="button primary-background-color white-text-color" bindtap="switch2">纳新</button></view>
-    <view><button class="button primary-background-color white-text-color" bindtap="switch3">通知</button></view>
+    <view>
+      <myButton class="button" type="primary" bindtap="switch1">活动</myButton>
+    </view>
+    <view>
+      <myButton class="button" type="primary" bindtap="switch2">纳新</myButton>
+    </view>
+    <view>
+      <myButton class="button" type="primary" bindtap="switch3">通知</myButton>
+    </view>
   </view>
 </view>
 
@@ -16,19 +22,19 @@
   <view class="subTitle">活动发布</view>
   <view class="block">
     <view class="cate">*活动名称</view>:
-    <input class="input block-background-color" placeholder="请输入活动名称" model:value="{{activityName}}"/>
+    <input class="input block-background-color" placeholder="请输入活动名称" model:value="{{activityName}}" />
   </view>
   <view class="block">
-    <view class="cate">副标题</view>:
-    <input class="input block-background-color" placeholder="请输入活动副标题" model:value="{{activitySubTitle}}"/>
+    <view class="cate">简介</view>:
+    <input class="input block-background-color" placeholder="请输入活动副标题" model:value="{{activitySubTitle}}" />
   </view>
   <view class="block">
     <view class="cate">*活动时间</view>:
-    <input class="input block-background-color" placeholder="请输入活动开展的时间" model:value="{{activityTime}}"/>
+    <input class="input block-background-color" placeholder="请输入活动开展的时间" model:value="{{activityTime}}" />
   </view>
   <view class="block">
     <view class="cate">*活动地点</view>:
-    <input class="input block-background-color" placeholder="请输入活动开展的地点" model:value="{{activityPlace}}"/>
+    <input class="input block-background-color" placeholder="请输入活动开展的地点" model:value="{{activityPlace}}" />
   </view>
   <view class="block">
     <view class="cate">*活动属性</view>:
@@ -55,41 +61,53 @@
     <input class="input block-background-color" model:value="{{activityAim}}" placeholder="请输入面向对象" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">*活动详情</view>:</view>
-    <textarea class="textarea block-background-color" placeholder="请输入具体活动信息" model:value="{{activityDetail}}"></textarea>
+    <view class="block22">
+      <view class="cate">*活动详情</view>:
+    </view>
+    <textarea class="textarea block-background-color" placeholder="请输入具体活动信息"
+      model:value="{{activityDetail}}"></textarea>
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">活动海报</view>:</view>
-    <imagePicker images="{{activityPoster}}" max="1" image-width="450" image-height="270" bindchange="updateActivityPoster" />
+    <view class="block22">
+      <view class="cate">活动海报</view>:
+    </view>
+    <imagePicker images="{{activityPoster}}" max="1" image-width="450" image-height="270"
+      bindchange="updateActivityPoster" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">活动图片</view>:</view>
-    <imagePicker images="{{activityPicture}}" max="9" image-width="145" image-height="145" bindchange="updateActivityPicture" />
+    <view class="block22">
+      <view class="cate">活动图片</view>:
+    </view>
+    <imagePicker images="{{activityPicture}}" max="9" image-width="145" image-height="145"
+      bindchange="updateActivityPicture" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">现宣信息</view>:</view>
-    <textarea class="textarea block-background-color" placeholder="请输入你的现宣信息" model:value="{{activityProInfo}}"></textarea>
+    <view class="block22">
+      <view class="cate">现宣信息</view>:
+    </view>
+    <textarea class="textarea block-background-color" placeholder="请输入你的现宣信息"
+      model:value="{{activityProInfo}}"></textarea>
   </view>
   <view class="block">
     <view class="cate">报名链接</view>:
     <input class="input block-background-color" model:value="{{activitySrc}}" placeholder="请输入报名链接" />
   </view>
-  <button class="button primary-background-color white-text-color" bindtap="switch4">提交</button>
+  <myButton class="button" type="primary" bindtap="switch4">提交</myButton>
 </scroll-view>
 
 <scroll-view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="subTitle">纳新发布</view>
   <view class="block">
     <view class="cate">*纳新标题</view>:
-    <input class="input block-background-color" placeholder="请输入纳新标题" model:value="{{recruitName}}"/>
+    <input class="input block-background-color" placeholder="请输入纳新标题" model:value="{{recruitName}}" />
   </view>
   <view class="block">
-    <view class="cate">副标题</view>:
-    <input class="input block-background-color" placeholder="请输入纳新副标题" model:value="{{recruitSubTitle}}"/>
+    <view class="cate">简介</view>:
+    <input class="input block-background-color" placeholder="请输入纳新副标题" model:value="{{recruitSubTitle}}" />
   </view>
   <view class="block">
     <view class="cate">*纳新时间</view>:
-    <input class="input block-background-color" placeholder="请输入纳新开展的时间" model:value="{{recruitTime}}"/>
+    <input class="input block-background-color" placeholder="请输入纳新开展的时间" model:value="{{recruitTime}}" />
   </view>
   <view class="block">
     <view class="cate">*纳新属性</view>:
@@ -108,37 +126,49 @@
     <input class="input block-background-color" model:value="{{recruitAim}}" placeholder="请输入面向对象" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">*纳新详情</view>:</view>
-    <textarea class="textarea block-background-color" placeholder="请输入具体纳新信息" model:value="{{recruitDetail}}"></textarea>
+    <view class="block22">
+      <view class="cate">*纳新详情</view>:
+    </view>
+    <textarea class="textarea block-background-color" placeholder="请输入具体纳新信息"
+      model:value="{{recruitDetail}}"></textarea>
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">活动海报</view>:</view>
-    <imagePicker images="{{recruitPoster}}" max="1" image-width="450" image-height="270" bindchange="updateRecruitPoster" />
+    <view class="block22">
+      <view class="cate">纳新海报</view>:
+    </view>
+    <imagePicker images="{{recruitPoster}}" max="1" image-width="450" image-height="270"
+      bindchange="updateRecruitPoster" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">活动图片</view>:</view>
-    <imagePicker images="{{recruitPicture}}" max="9" image-width="145" image-height="145" bindchange="updateRecruitPicture" />
+    <view class="block22">
+      <view class="cate">纳新图片</view>:
+    </view>
+    <imagePicker images="{{recruitPicture}}" max="9" image-width="145" image-height="145"
+      bindchange="updateRecruitPicture" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">现宣信息</view>:</view>
-    <textarea class="textarea block-background-color" placeholder="请输入你的现宣信息" model:value="{{recruitProInfo}}"></textarea>
+    <view class="block22">
+      <view class="cate">现宣信息</view>:
+    </view>
+    <textarea class="textarea block-background-color" placeholder="请输入你的现宣信息"
+      model:value="{{recruitProInfo}}"></textarea>
   </view>
   <view class="block">
     <view class="cate">报名链接</view>:
     <input class="input block-background-color" model:value="{{recruitSrc}}" placeholder="请输入报名链接" />
   </view>
-  <button class="button primary-background-color white-text-color" bindtap="switch4">提交</button>
+  <myButton class="button" type="primary" bindtap="switch4">提交</myButton>
 </scroll-view>
 
 <scroll-view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
   <view class="subTitle">通知发布</view>
   <view class="block">
     <view class="cate">*通知标题</view>:
-    <input class="input block-background-color" placeholder="请输入通知标题" model:value="{{notiName}}"/>
+    <input class="input block-background-color" placeholder="请输入通知标题" model:value="{{notiName}}" />
   </view>
   <view class="block">
-    <view class="cate">副标题</view>:
-    <input class="input block-background-color" placeholder="请输入通知副标题" model:value="{{notiSubTitle}}"/>
+    <view class="cate">简介</view>:
+    <input class="input block-background-color" placeholder="请输入通知副标题" model:value="{{notiSubTitle}}" />
   </view>
   <view class="block">
     <view class="cate">*通知属性</view>:
@@ -153,23 +183,29 @@
     <input class="input block-background-color" model:value="{{notiAim}}" placeholder="请输入面向对象" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">*通知详情</view>:</view>
+    <view class="block22">
+      <view class="cate">*通知详情</view>:
+    </view>
     <textarea class="textarea block-background-color" placeholder="请输入通知详情" model:value="{{notiDetail}}"></textarea>
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">通知海报</view>:</view>
+    <view class="block22">
+      <view class="cate">通知海报</view>:
+    </view>
     <imagePicker images="{{notiPoster}}" max="1" image-width="450" image-height="270" bindchange="updateNotiPoster" />
   </view>
   <view class="block2">
-    <view class="block22"><view class="cate">通知图片</view>:</view>
+    <view class="block22">
+      <view class="cate">通知图片</view>:
+    </view>
     <imagePicker images="{{notiPicture}}" max="9" image-width="145" image-height="145" bindchange="updateNotiPicture" />
   </view>
-  <button class="button primary-background-color white-text-color" bindtap="switch4">提交</button>
+  <myButton class="button" type="primary" bindtap="switch4">提交</myButton>
 </scroll-view>
 
 <view wx:if="{{currentTab == 4}}" class="con">
   <view class="con1 primary-text-color">发布成功!</view>
-  <image  class="success-icon" src="../../images/finish.png" mode="aspectFill"/>
+  <image class="success-icon" src="../../images/finish.png" mode="aspectFill" />
   <!-- <view class="con2"></view> -->
-  <button class="button primary-background-color white-text-color" bindtap="returnToUser" >返回</button>
-</view>
+  <myButton class="button" type="primary" bindtap="returnToUser">返回</myButton>
+</view>

+ 8 - 8
miniprogram/pages/activityPublish/activityPublish.wxss

@@ -19,22 +19,22 @@
 }
 
 .picker-date {
-  width:450rpx;
-  text-align:center;
+  width: 450rpx;
+  text-align: center;
 }
 
 .picker-time {
-  width:210rpx;
-  text-align:center;
+  width: 210rpx;
+  text-align: center;
 }
 
 .checkbox {
-  transform:scale(0.8);
-  margin-left:10rpx;
+  transform: scale(0.8);
+  margin-left: 10rpx;
 }
 
 .checkbox-group {
-  width:450rpx;
+  width: 450rpx;
 }
 
 .text {
@@ -43,7 +43,7 @@
 }
 
 .button {
-  margin-top:40rpx;
+  margin-top: 40rpx;
   margin-bottom: 40rpx;
 }
 

+ 7 - 12
miniprogram/pages/publisherLogin/publisherLogin.js

@@ -31,7 +31,7 @@ Page({
 
   bindAvatarChange: function (e) {
     this.setData({
-      publisherAvatar: e.detail.images
+      publisherAvatar: e.detail.value
     })
   },
 
@@ -54,8 +54,9 @@ Page({
   },
 
   switch4: function (e) {
-    if (this.data.inviteCode == '' || this.data.publisherName == '' || this.data.publisherContact == '' ||
-      this.data.publisherIntro == '' || this.data.publisherType == '' || this.data.publisherAvatar.length == 0) {
+    const value = e.detail.value
+
+    if (value.code === '' || value.name === '' || value.level === '' || value.intro === '' || value.avatar.length === 0) {
       wx.showToast({
         title: '请确认信息填写完整',
         icon: 'none'
@@ -142,18 +143,12 @@ Page({
     })
     wx.cloud.uploadFile({
       cloudPath: `publisherAvater/${util.randomString(16)}.jpg`,
-      filePath: this.data.publisherAvatar[0]
+      filePath: value.avatar[0]
     }).then(res => {
+      value.avatar = res.fileID
       return wx.cloud.callFunction({
         name: 'createPublisher',
-        data: {
-          code: this.data.inviteCode,
-          name: this.data.publisherName,
-          type: this.data.currentTab == 2 ? '组织' : '社团',
-          level: this.data.publisherType,
-          intro: this.data.publisherIntro,
-          avatar: res.fileID
-        }
+        data: value
       })
     }).then(res => {
       wx.hideLoading()

+ 2 - 1
miniprogram/pages/publisherLogin/publisherLogin.json

@@ -1,5 +1,6 @@
 {
   "usingComponents": {
-    "imagePicker": "/components/imagePicker/imagePicker"
+    "imagePicker": "/components/imagePicker/imagePicker",
+    "myButton": "/components/myButton/myButton"
   }
 }

+ 105 - 78
miniprogram/pages/publisherLogin/publisherLogin.wxml

@@ -2,110 +2,137 @@
 <view class="title primary-text-color">社团/组织入驻</view>
 
 <scroll-view wx:if="{{currentTab == 0}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="subTitle primary-text-color">社团/组织如何注册入驻?</view>
-  <view class="thirdTitle">1、前提条件</view>
+  <view class="sub-title primary-text-color">社团/组织如何注册入驻?</view>
+  <view class="sub-sub-title">1、前提条件</view>
   <view class="text">浙江大学社团/学生组织的负责人代表社团/学生组织进行入驻登记。</view>
-  <view class="thirdTitle">2、输入邀请码</view>
+  <view class="sub-sub-title">2、输入邀请码</view>
   <view class="text">社团/组织可以通过社联或学生会获取邀请码,邀请码仅可使用一次。</view>
-  <view class="thirdTitle">3、填写基本资料</view>
+  <view class="sub-sub-title">3、填写基本资料</view>
   <view class="text">在注册页面如实填写所在社团/学生组织的基本资料。</view>
-  <view class="thirdTitle">4、入驻成功</view>
+  <view class="sub-sub-title">4、入驻成功</view>
   <view class="text">填写完成后,相应的社团/组织管理功能将开启。</view>
 
-  <view class="subTitle primary-text-color">社团/组织成功入驻,我可以:</view>
-  <view class="thirdTitle">1、发布活动</view>
+  <view class="sub-title primary-text-color">社团/组织成功入驻,我可以:</view>
+  <view class="sub-sub-title">1、发布活动</view>
   <view class="text">发布近期召开的活动,招纳活动参与者,扩大活动影响力和宣传范围。</view>
-  <view class="thirdTitle">2、发布通知</view>
+  <view class="sub-sub-title">2、发布通知</view>
   <view class="text">及时传达给同学们学校正在发生的大小事,保证时效性。</view>
-  <view class="thirdTitle">3、发布纳新</view>
+  <view class="sub-sub-title">3、发布纳新</view>
   <view class="text">在纳新季确保同学们能够看到每一个社团/学生组织的纳新信息。</view>
-  <view class="thirdTitle">4、与参加活动的同学私信交流</view>
+  <view class="sub-sub-title">4、与参加活动的同学私信交流</view>
   <view class="text">一键通知面试时间、面试结果、活动招募情况,再也不用手动发送信息了。</view>
-  <button class="button primary-background-color white-text-color" bindtap="switch1">一键入驻</button>
+  <myButton class="button" type="primary" bindtap="switch1">一键入驻</myButton>
 </scroll-view>
 
 <view wx:if="{{currentTab == 1}}" class="con">
   <view class="title2">请问您入驻的类型是?</view>
   <view class="buttons">
-    <view><button class="button primary-background-color white-text-color" bindtap="switch2">组织</button></view>
-    <view><button class="button primary-background-color white-text-color" bindtap="switch3">社团</button></view>
+    <view>
+      <myButton class="button" type="primary" bindtap="switch2">组织</myButton>
+    </view>
+    <view>
+      <myButton class="button" type="primary" bindtap="switch3">社团</myButton>
+    </view>
   </view>
 </view>
 
 <scroll-view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="subTitle">组织入驻</view>
-  <view class="block">
-    <view class="cate">邀请码</view>:
-    <input class="input block-background-color" placeholder="请输入邀请码" model:value="{{inviteCode}}" />
-  </view>
-  <view class="block">
-    <view class="cate">组织名称</view>:
-    <input class="input block-background-color" placeholder="请输入组织名" model:value="{{publisherName}}" />
-  </view>
-  <view class="block">
-    <view class="cate">组织类型</view>:
-    <radio-group class="radio-group" bindchange="bindLevelChange">
-      <label wx:for="{{types}}" wx:for-item="item" wx:key="*this">
-        <radio class="radio" value="{{item}}" color="#469298">{{item}}</radio>
-      </label>
-    </radio-group>
-  </view>
-  <view class="block2">
-    <view class="block22">
-      <view class="cate">组织头像</view>:
+  <view class="sub-title">组织入驻</view>
+  <form bindsubmit="switch4">
+    <view class="block" style="margin-bottom: 20rpx;">
+      <view class="cate">邀请码<span style="color: #FF0000">*</span></view>
+      <input class="input" placeholder="请填写" name="code" />
     </view>
-    <imagePicker images="{{publisherAvatar}}" max="1" image-width="450" image-height="450"
-      bindchange="bindAvatarChange" />
-  </view>
-  <view class="block">
-    <view class="cate">联系方式</view>:
-    <input class="input block-background-color" placeholder="请输入联系方式" model:value="{{publisherContact}}" />
-  </view>
-  <view class="block2">
-    <view class="block22">
-      <view class="cate">组织介绍</view>:
+    <view class="block">
+      <view class="cate">组织名称<span style="color: #FF0000">*</span></view>
+      <input class="input" placeholder="请填写" name="name" />
     </view>
-    <textarea class="textarea block-background-color" placeholder="请输入组织介绍" model:value="{{publisherIntro}}" />
+    <view class="block">
+      <view class="cate" style="align-self: flex-start;">组织类型<span style="color: #FF0000">*</span></view>
+      <radio-group class="radio-group" name="level">
+        <label wx:for="{{types}}" wx:for-item="item" wx:key="*this">
+          <radio class="radio" value="{{item}}" color="#469298">{{item}}</radio>
+        </label>
+      </radio-group>
     </view>
-  <button class="button primary-background-color white-text-color" bindtap="switch4">提交</button>
+    <view class="block">
+      <view class="cate" style="align-self: flex-start;">组织介绍<span style="color: #FF0000">*</span></view>
+      <textarea class="input" style="height: 200rpx;" placeholder="请填写" name="intro"></textarea>
+    </view>
+    <view class="block" style="margin-bottom: 20rpx;">
+      <view class="cate" style="align-self: flex-start;">组织头像<span style="color: #FF0000">*</span></view>
+      <imagePicker name="avatar" max="1" image-width="450" image-height="450" />
+    </view>
+    <view class="block">
+      <view class="cate">联系电话</view>
+      <input class="input" placeholder="请填写" name="phone" />
+    </view>
+    <view class="block">
+      <view class="cate">邮箱地址</view>
+      <input class="input" placeholder="请填写" name="email" />
+    </view>
+    <view class="block">
+      <view class="cate">官方QQ</view>
+      <input class="input" placeholder="请填写" name="qq" />
+    </view>
+    <view class="block">
+      <view class="cate">公众号</view>
+      <input class="input" placeholder="请填写" name="wechat" />
+    </view>
+    <myButton class="button" type="primary">提交</myButton>
+  </form>
 </scroll-view>
 
 <scroll-view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="subTitle">社团入驻</view>
-  <view class="block">
-    <view class="cate">邀请码</view>:
-    <input class="input block-background-color" placeholder="请输入邀请码" model:value="{{inviteCode}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">社团名称</view>:
-    <input class="input block-background-color" placeholder="请输入社团名" model:value="{{publisherName}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">社团规模</view>:
-    <radio-group class="radio-group" bindchange="bindLevelChange">
-      <label wx:for="{{stars}}" wx:for-item="item" wx:key="*this">
-        <radio class="radio" value="{{item}}" color="#469298">{{item}}</radio>
-      </label>
-    </radio-group>
-  </view>
-  <view class="block2">
-    <view class="block22"><view class="cate">社团头像</view>:</view>
-    <imagePicker images="{{publisherAvatar}}" max="1" image-width="450" image-height="450" bindchange="bindAvatarChange" />
-  </view>
-  <view class="block">
-    <view class="cate">联系方式</view>:
-    <input class="input block-background-color" placeholder="请输入联系方式" model:value="{{publisherContact}}"/>
-  </view>
-  <view class="block2">
-    <view class="block22"><view class="cate">社团介绍</view>:</view>
-    <textarea class="textarea block-background-color" placeholder="请输入社团介绍" model:value="{{publisherIntro}}"/>
-  </view>
-  <button class="button primary-background-color white-text-color" bindtap="switch4">提交</button>
+  <view class="sub-title">社团入驻</view>
+  <form bindsubmit="switch4">
+    <view class="block" style="margin-bottom: 20rpx;">
+      <view class="cate">邀请码<span style="color: #FF0000">*</span></view>
+      <input class="input" placeholder="请填写" name="code" />
+    </view>
+    <view class="block">
+      <view class="cate">社团名称<span style="color: #FF0000">*</span></view>
+      <input class="input" placeholder="请填写" name="name" />
+    </view>
+    <view class="block">
+      <view class="cate" style="align-self: flex-start;">社团星级<span style="color: #FF0000">*</span></view>
+      <radio-group class="radio-group" name="level">
+        <label wx:for="{{stars}}" wx:for-item="item" wx:key="*this">
+          <radio class="radio" value="{{item}}" color="#469298">{{item}}</radio>
+        </label>
+      </radio-group>
+    </view>
+    <view class="block">
+      <view class="cate" style="align-self: flex-start;">社团介绍<span style="color: #FF0000">*</span></view>
+      <textarea class="input" style="height: 200rpx;" placeholder="请填写" name="intro"></textarea>
+    </view>
+    <view class="block" style="margin-bottom: 20rpx;">
+      <view class="cate" style="align-self: flex-start;">社团头像<span style="color: #FF0000">*</span></view>
+      <imagePicker name="avatar" max="1" image-width="450" image-height="450" />
+    </view>
+    <view class="block">
+      <view class="cate">联系电话</view>
+      <input class="input" placeholder="请填写" name="phone" />
+    </view>
+    <view class="block">
+      <view class="cate">邮箱地址</view>
+      <input class="input" placeholder="请填写" name="email" />
+    </view>
+    <view class="block">
+      <view class="cate">官方QQ</view>
+      <input class="input" placeholder="请填写" name="qq" />
+    </view>
+    <view class="block">
+      <view class="cate">公众号</view>
+      <input class="input" placeholder="请填写" name="wechat" />
+    </view>
+    <myButton class="button" type="primary">提交</myButton>
+  </form>
 </scroll-view>
 
 <view wx:if="{{currentTab == 4}}" class="con">
-  <view class="con1 primary-background-color">恭喜您完成填写!</view>
-  <image  class="pic" src="../../images/finish.png" mode="aspectFill"/>
+  <view class="con1">恭喜您完成填写!</view>
+  <image class="pic" src="../../images/finish.png" mode="aspectFill" />
   <view class="con2">感谢您的入驻</view>
-  <button class="button primary-background-color white-text-color" bindtap="returnToUser">返回</button>
+  <myButton class="button" type="primary" bindtap="returnToUser">返回</myButton>
 </view>

+ 10 - 33
miniprogram/pages/publisherLogin/publisherLogin.wxss

@@ -6,13 +6,13 @@
   font-weight: 800;
 }
 
-.subTitle {
+.sub-title {
   font-size: 35rpx;
   margin: 20rpx 40rpx;
   font-weight: 900;
 }
 
-.thirdTitle {
+.sub-sub-title {
   font-size: 35rpx;
   margin: 20rpx 40rpx;
   font-weight: 600;
@@ -33,12 +33,7 @@
 }
 
 .button {
-  margin-top: 40rpx;
-  margin-bottom: 40rpx;
-  font-size: 35rpx;
-  margin: 20rpx 40rpx;
-  font-weight: 900;
-  border-radius: 98rpx;
+  margin: 10rpx;
 }
 
 .title2 {
@@ -57,37 +52,19 @@
 
 .block {
   display: flex;
-  margin: 20rpx 40rpx;
-  font-size: 35rpx;
   align-items: center;
+  margin: 4rpx 0rpx;
+  padding: 20rpx 40rpx;
+  font-size: 30rpx;
+  background-color: #FFFFFF;
 }
 
-.block2 {
-  display: flex;
-  margin: 20rpx 40rpx;
-  font-size: 35rpx;
-}
-
-.block22 {
-  display: flex;
+.cate {
+  width: 160rpx;
 }
 
 .input {
-  border-radius: 10rpx;
-  width: 450rpx;
-  padding: 0 20rpx;
-}
-
-.textarea {
-  border-radius: 10rpx;
-  width: 450rpx;
-  height: 200rpx;
-  padding: 0 20rpx;
-}
-
-.cate {
-  width: 140rpx;
-  text-align: right;
+  width: 500rpx;
 }
 
 .con {

+ 1 - 1
miniprogram/pages/user/user.wxml

@@ -52,7 +52,7 @@
 </view>
 
 <view wx:if="{{hasUserInfo}}">
-  <view wx:if="{{pubInfo.length === 0}}" class="publisher primary-background-color" hover-class="btn-hover"
+  <view wx:if="{{pubInfo.length !== 0}}" class="publisher primary-background-color" hover-class="btn-hover"
     bindtap="publisherLogin">
     <text class="white-text-color">社团\n组织\n入驻</text>
   </view>