|
@@ -5,33 +5,12 @@ Page({
|
|
|
*/
|
|
*/
|
|
|
data: {
|
|
data: {
|
|
|
currentTab: 0,
|
|
currentTab: 0,
|
|
|
- winWidth: 0,
|
|
|
|
|
- winHeight: 0,
|
|
|
|
|
- inviteCode: "",
|
|
|
|
|
- publisherName: "",
|
|
|
|
|
- publisherContact: "",
|
|
|
|
|
- publisherIntro: "",
|
|
|
|
|
- publisherType: "",
|
|
|
|
|
- publisherAvatar: [],
|
|
|
|
|
- types: ["校级", "园级", "院级"],
|
|
|
|
|
- stars: ["一星级", "二星级", "三星级", "四星级", "五星级"],
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
stopTouchMove: function () {
|
|
stopTouchMove: function () {
|
|
|
return false;
|
|
return false;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- updateRadio: function (e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- publisherType: e.detail.value
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- updatePublishAvatar: function (e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- publisherAvatar: e.detail.images
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
switch1: function (e) {
|
|
switch1: function (e) {
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -45,126 +24,11 @@ Page({
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- switch3: function (e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- currentTab: 3
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- switch4: function (e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- currentTab: 4
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- switch4_1: function (e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- currentTab: 41
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- switchend: function (e) {
|
|
|
|
|
- if (this.data.inviteCode == "" || this.data.publisherName == "" || this.data.publisherContact == "" ||
|
|
|
|
|
- this.data.publisherIntro == "" || this.data.publisherType == "" || this.data.publisherAvatar.length == 0) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: "请确认信息填写完整",
|
|
|
|
|
- icon: "none"
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- const db = wx.cloud.database()
|
|
|
|
|
- const _ = db.command
|
|
|
|
|
- db.collection("inviteCodeData").where({
|
|
|
|
|
- code: this.data.inviteCode,
|
|
|
|
|
- used: false
|
|
|
|
|
- }).get({
|
|
|
|
|
- success: function (code) {
|
|
|
|
|
- if (code.data.length == 0) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: "邀请码不存在",
|
|
|
|
|
- icon: "none"
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- db.collection("publisherInfoData").where({
|
|
|
|
|
- publisherName: this.data.publisherName
|
|
|
|
|
- }).get({
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- if (res.data.length != 0) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: "名称已使用",
|
|
|
|
|
- icon: "none"
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- wx.showLoading({
|
|
|
|
|
- title: "入驻中"
|
|
|
|
|
- })
|
|
|
|
|
- wx.cloud.uploadFile({
|
|
|
|
|
- cloudPath: "publisherAvater/" + this.data.publisherName + '.jpg',
|
|
|
|
|
- filePath: this.data.publisherAvatar[0],
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- db.collection("publisherInfoData").add({
|
|
|
|
|
- data: {
|
|
|
|
|
- publisherAttribute: [this.data.currentTab == 2 ? "组织" : "社团"],
|
|
|
|
|
- publisherAvatar: res.fileID,
|
|
|
|
|
- publisherContact: this.data.publisherContact,
|
|
|
|
|
- publisherIntro: this.data.publisherIntro,
|
|
|
|
|
- publisherName: this.data.publisherName,
|
|
|
|
|
- publisherType: this.data.publisherType
|
|
|
|
|
- },
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- db.collection("inviteCodeData").doc(code.data[0]._id).update({
|
|
|
|
|
- data: {
|
|
|
|
|
- used: true,
|
|
|
|
|
- publisherId: res._id
|
|
|
|
|
- },
|
|
|
|
|
- success: function () {
|
|
|
|
|
- db.collection("userInfoData").get({
|
|
|
|
|
- success: function (user) {
|
|
|
|
|
- db.collection("userInfoData").doc(user.data[0]._id).update({
|
|
|
|
|
- data: {
|
|
|
|
|
- publisherId: _.push(res._id)
|
|
|
|
|
- },
|
|
|
|
|
- success: function () {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- currentTab: end
|
|
|
|
|
- })
|
|
|
|
|
- wx.hideLoading()
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this)
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- returnToUser: function (e) {
|
|
|
|
|
- wx.navigateBack()
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
*/
|
|
|
onLoad: function (e) {
|
|
onLoad: function (e) {
|
|
|
- wx.getSystemInfo({
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- winWidth: res.windowWidth
|
|
|
|
|
- })
|
|
|
|
|
- this.setData({
|
|
|
|
|
- winHeight: res.windowHeight
|
|
|
|
|
- })
|
|
|
|
|
- }.bind(this),
|
|
|
|
|
- })
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
updatePage: function (e) {
|
|
updatePage: function (e) {
|