├── .gitignore ├── README.md ├── cloud ├── commentList │ ├── config.json │ ├── index.js │ └── package.json ├── delete_notices │ ├── config.json │ ├── index.js │ └── package.json ├── login │ ├── config.json │ ├── index.js │ └── package.json ├── operation │ ├── config.json │ ├── index.js │ └── package.json ├── parerInfo │ ├── config.json │ ├── index.js │ └── package.json ├── updata_user │ ├── config.json │ ├── index.js │ └── package.json ├── update_index │ ├── config.json │ ├── index.js │ └── package.json └── update_revert │ ├── config.json │ ├── index.js │ └── package.json ├── miniprogram ├── app.js ├── app.json ├── app.wxss ├── pages │ ├── about │ │ ├── about.js │ │ ├── about.json │ │ ├── about.wxml │ │ └── about.wxss │ ├── activity │ │ ├── activity.js │ │ ├── activity.json │ │ ├── activity.wxml │ │ ├── activity.wxss │ │ └── activityDetail │ │ │ ├── activityDetail.js │ │ │ ├── activityDetail.json │ │ │ ├── activityDetail.wxml │ │ │ └── activityDetail.wxss │ ├── admin │ │ ├── admin.js │ │ ├── admin.json │ │ ├── admin.wxml │ │ └── admin.wxss │ ├── articleList │ │ ├── articleList.js │ │ ├── articleList.json │ │ ├── articleList.wxml │ │ └── articleList.wxss │ ├── college │ │ ├── addcollege │ │ │ ├── addcollege.js │ │ │ ├── addcollege.json │ │ │ ├── addcollege.wxml │ │ │ └── addcollege.wxss │ │ ├── college.js │ │ ├── college.json │ │ ├── college.wxml │ │ └── college.wxss │ ├── detail │ │ ├── detail.js │ │ ├── detail.json │ │ ├── detail.wxml │ │ └── detail.wxss │ ├── icon │ │ ├── 3.png │ │ ├── 4.png │ │ ├── about.png │ │ ├── add.png │ │ ├── addCollege.png │ │ ├── addimags.png │ │ ├── admin_true.png │ │ ├── collega_false.png │ │ ├── collega_true.png │ │ ├── del.png │ │ ├── delete.svg │ │ ├── home-select.png │ │ ├── home.png │ │ ├── icon_add.png │ │ ├── icon_admin.png │ │ ├── icon_cancel.png │ │ ├── icon_college.png │ │ ├── icon_come.png │ │ ├── icon_fabu.png │ │ ├── icon_pinglun.png │ │ ├── icon_shezhi.png │ │ ├── icon_shoucang.png │ │ ├── icon_update.svg │ │ ├── issuance-select.png │ │ ├── issuance.png │ │ ├── me-select.png │ │ ├── me.png │ │ ├── noticeBar.png │ │ ├── shoucangFalse.svg │ │ └── shoucangTrue.svg │ ├── images │ │ ├── login.png │ │ ├── logo.jpg │ │ └── tip_jinggao.png │ ├── img │ │ ├── activity.png │ │ ├── chengji.png │ │ ├── love.png │ │ ├── questions.png │ │ ├── qushi.png │ │ └── sign.png │ ├── index │ │ ├── cet │ │ │ ├── cet.js │ │ │ ├── cet.json │ │ │ ├── cet.wxml │ │ │ └── cet.wxss │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── info │ │ ├── info.js │ │ ├── info.json │ │ ├── info.wxml │ │ └── info.wxss │ ├── issuance │ │ ├── issuance.js │ │ ├── issuance.json │ │ ├── issuance.wxml │ │ └── issuance.wxss │ ├── login │ │ ├── login.js │ │ ├── login.json │ │ ├── login.wxml │ │ └── login.wxss │ └── me │ │ ├── me.js │ │ ├── me.json │ │ ├── me.wxml │ │ ├── me.wxss │ │ ├── mycollect │ │ ├── mycollect.js │ │ ├── mycollect.json │ │ ├── mycollect.wxml │ │ └── mycollect.wxss │ │ ├── mycomment │ │ ├── mycomment.js │ │ ├── mycomment.json │ │ ├── mycomment.wxml │ │ └── mycomment.wxss │ │ ├── myissuance │ │ ├── myissuance.js │ │ ├── myissuance.json │ │ ├── myissuance.wxml │ │ └── myissuance.wxss │ │ └── setting │ │ ├── setting.js │ │ ├── setting.json │ │ ├── setting.wxml │ │ ├── setting.wxss │ │ └── settingInfo │ │ ├── settingInfo.js │ │ ├── settingInfo.json │ │ ├── settingInfo.wxml │ │ └── settingInfo.wxss ├── sitemap.json └── weui.wxss ├── project.config.json ├── project.private.config.json ├── 数据库 ├── activity.json ├── articles.json ├── collect.json ├── comment.json ├── index.json ├── user.json └── 说明.txt └── 节目秀 ├── Snipaste_2021-05-31_21-30-11.png ├── Snipaste_2021-05-31_21-30-29.png ├── Snipaste_2021-05-31_21-30-38.png ├── Snipaste_2021-05-31_21-30-53.png ├── Snipaste_2021-05-31_21-31-14.png ├── Snipaste_2021-05-31_21-31-40.png ├── Snipaste_2021-05-31_21-31-53.png ├── Snipaste_2021-05-31_21-32-10.png ├── Snipaste_2021-05-31_21-32-25.png ├── Snipaste_2021-05-31_21-32-42.png ├── Snipaste_2021-05-31_21-32-58.png ├── Snipaste_2021-05-31_21-33-11.png ├── Snipaste_2021-05-31_21-33-30.png └── programShow /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows 2 | [Dd]esktop.ini 3 | Thumbs.db 4 | $RECYCLE.BIN/ 5 | 6 | # macOS 7 | .DS_Store 8 | .fseventsd 9 | .Spotlight-V100 10 | .TemporaryItems 11 | .Trashes 12 | 13 | # Node.js 14 | node_modules/ 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 这算得上自己第一个独立完成的项目吧,不太完美,但还是满足了基本功能。 2 | 3 | **1、这个小程序是我的毕业设计,基本实现了社交软件的基本功能** 4 | 5 | **2、代码是直接从微信开发者工具内推送,如需使用请 修改其中部分代码** 6 | 7 | 特别是appid 要改成自己的appid 8 | 9 | 主图如下 10 | 11 | ![image](https://github.com/Liu-Hsin/WechatMini_program_School_Social_Software/assets/57285504/4a49d5b2-5e2e-4399-9dec-29307fb249e4) 12 | 13 | 14 | -------------------------------------------------------------------------------- /cloud/commentList/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/commentList/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | // 云函数入口函数 7 | exports.main = async (event, context) => { 8 | return await db.collection('comment').aggregate() 9 | .lookup({ 10 | from: 'articles', 11 | localField: 'articleid', 12 | foreignField: 'articleid', 13 | as: 'commentList', 14 | }) 15 | .end() 16 | .then(res => console.log(res)) 17 | .catch(err => console.error(err)) 18 | .end() 19 | } -------------------------------------------------------------------------------- /cloud/commentList/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "commentList", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/delete_notices/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/delete_notices/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | const _ = db.command 7 | // 云函数入口函数 8 | exports.main = async (event, context) => { 9 | return await db.collection('index').where({ 10 | '_id':'b00064a76054bf6b0adc04827ae254ba', 11 | }).update({ 12 | data:{ 13 | notices:_.pull(event.notices) 14 | }, 15 | success:res=>{ 16 | console.log(res) 17 | } 18 | }) 19 | } -------------------------------------------------------------------------------- /cloud/delete_notices/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "delete_notices", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/login/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /cloud/login/index.js: -------------------------------------------------------------------------------- 1 | // 云函数模板 2 | // 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署” 3 | 4 | const cloud = require('wx-server-sdk') 5 | 6 | // 初始化 cloud 7 | cloud.init({ 8 | // API 调用都保持和云函数当前所在环境一致 9 | env: cloud.DYNAMIC_CURRENT_ENV 10 | }) 11 | 12 | /** 13 | * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端 14 | * 15 | * event 参数包含小程序端调用传入的 data 16 | * 17 | */ 18 | exports.main = async (event, context) => { 19 | console.log(event) 20 | console.log(context) 21 | 22 | // 可执行其他自定义逻辑 23 | // console.log 的内容可以在云开发云函数调用日志查看 24 | 25 | // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)等信息 26 | const wxContext = cloud.getWXContext() 27 | 28 | return { 29 | event, 30 | openid: wxContext.OPENID, 31 | appid: wxContext.APPID, 32 | unionid: wxContext.UNIONID, 33 | env: wxContext.ENV, 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /cloud/login/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "login", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cloud/operation/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/operation/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | 6 | // 云函数入口函数 7 | exports.main = async (event, context) => { 8 | return await cloud.database().collection('comment').doc(event.id).update({ 9 | data:{ 10 | articleid:event.articleid, 11 | openid:event.openid, 12 | up : event.up, 13 | down: event.down, 14 | sc : event.sc, 15 | pinglun:event.pinglun, 16 | commentid:event.commentid 17 | 18 | } 19 | }).then(res=>{ 20 | console.log("success",res) 21 | return res 22 | }).catch(res=>{ 23 | console.log("false",res) 24 | return res 25 | }) 26 | } -------------------------------------------------------------------------------- /cloud/operation/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shoucang", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/parerInfo/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/parerInfo/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | const _ = db.command 7 | // 云函数入口函数 8 | exports.main = async (event, context) => { 9 | return await cloud.database().collection('activity').doc(event.id).update({ 10 | data:{ 11 | id: event.id, 12 | organizer : event.organizer, 13 | title: event.title, 14 | place : event.place, 15 | number:event.number, 16 | link : event.link, 17 | contents:event.contents, 18 | star_time:event.star_time, 19 | end_time:event.end_time, 20 | parter:_.addToSet(event.parter) 21 | } 22 | }).then(res=>{ 23 | console.log("success",res) 24 | return res 25 | }).catch(res=>{ 26 | console.log("false",res) 27 | return res 28 | }) 29 | } -------------------------------------------------------------------------------- /cloud/parerInfo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parerInfo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/updata_user/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/updata_user/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | // 云函数入口文件 3 | const cloud = require('wx-server-sdk') 4 | 5 | cloud.init() 6 | const db = cloud.database() 7 | const _ = db.command 8 | // 云函数入口函数 9 | exports.main = async (event, context) => { 10 | const targetDB = db.collection(event.db) 11 | //return targetDB 12 | try { 13 | console.log(event); 14 | if (event.type == "insert") { 15 | return await targetDB.add({ 16 | data: event.data, 17 | success: res => { 18 | console.log("添加纪录成功", res); 19 | }, 20 | fail: res => { 21 | console.log("添加纪录失败", res); 22 | } 23 | }) 24 | } 25 | 26 | if (event.type == "update") { 27 | return await targetDB.doc(event.indexKey).update({ 28 | data: event.data 29 | }) 30 | } 31 | if (event.type == "delete") { 32 | return await targetDB.doc(event.indexKey).remove() 33 | } 34 | 35 | if (event.type == "get") { 36 | return await targetDB.where(event.condition).get() 37 | } 38 | } catch (e) { 39 | console.error(e) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cloud/updata_user/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "updata_user", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/update_index/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/update_index/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | const _ = db.command 7 | // 云函数入口函数 8 | exports.main = async (event, context) => { 9 | return await db.collection('index').where({ 10 | '_id':'b00064a76054bf6b0adc04827ae254ba', 11 | }).update({ 12 | data:{ 13 | notices:_.addToSet(event.notices) 14 | }, 15 | success:res=>{ 16 | console.log(res) 17 | } 18 | }) 19 | 20 | } -------------------------------------------------------------------------------- /cloud/update_index/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "update_parter", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /cloud/update_revert/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloud/update_revert/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | const db = cloud.database() 6 | const _ = db.command 7 | // 云函数入口函数 8 | exports.main = async (event, context) => { 9 | return await db.collection('comment').doc(event.id).update({ 10 | data:{ 11 | revert:_.addToSet(event.revert) 12 | }, 13 | success:res=>{ 14 | console.log(res) 15 | } 16 | }) 17 | 18 | } -------------------------------------------------------------------------------- /cloud/update_revert/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "update_revert", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~2.4.0" 13 | } 14 | } -------------------------------------------------------------------------------- /miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | if (!wx.cloud) { 5 | console.error('请使用 2.2.3 或以上的基础库以使用云能力') 6 | } else { 7 | wx.cloud.init({ 8 | // env 参数说明: 9 | // env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源 10 | // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 11 | // 如不填则使用默认环境(第一个创建的环境) 12 | // env: 'my-env-id', 13 | traceUser: true, 14 | }) 15 | } 16 | this.globalData = {} 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "useExtendedLib": { 3 | "kbone": true, 4 | "weui": true 5 | }, 6 | 7 | "pages": [ 8 | "pages/index/index", 9 | "pages/info/info", 10 | "pages/login/login", 11 | "pages/index/cet/cet", 12 | "pages/activity/activity", 13 | "pages/me/me", 14 | "pages/college/college", 15 | "pages/college/addcollege/addcollege", 16 | "pages/me/myissuance/myissuance", 17 | "pages/me/mycollect/mycollect", 18 | "pages/me/mycomment/mycomment", 19 | "pages/me/setting/setting", 20 | "pages/me/setting/settingInfo/settingInfo", 21 | "pages/issuance/issuance", 22 | "pages/articleList/articleList", 23 | "pages/detail/detail", 24 | "pages/activity/activityDetail/activityDetail", 25 | "pages/admin/admin", 26 | "pages/about/about" 27 | ], 28 | "window": { 29 | "navigationBarBackgroundColor": "#239DF8", 30 | "navigationBarTitleText": "合经院社区", 31 | "navigationBarTextStyle": "black", 32 | "backgroundTextStyle": "dark" 33 | }, 34 | "tabBar": { 35 | "backgroundColor": "#1A73E8", 36 | "color": "#0000", 37 | "selectedColor": "#ffffff", 38 | "borderStyle": "black", 39 | "list": [ 40 | { 41 | "pagePath": "pages/index/index", 42 | "text": "首页", 43 | "iconPath": "/pages/icon/home.png", 44 | "selectedIconPath": "/pages/icon/home-select.png" 45 | }, 46 | { 47 | "pagePath": "pages/issuance/issuance", 48 | "text": "发布", 49 | "iconPath": "/pages/icon/issuance.png", 50 | "selectedIconPath": "/pages/icon/issuance-select.png" 51 | }, 52 | { 53 | "pagePath": "pages/me/me", 54 | "text": "我的", 55 | "iconPath": "/pages/icon/me.png", 56 | "selectedIconPath": "/pages/icon/me-select.png" 57 | } 58 | ] 59 | }, 60 | "sitemapLocation": "sitemap.json", 61 | "style": "v2" 62 | } -------------------------------------------------------------------------------- /miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | @import'weui.wxss'; 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } -------------------------------------------------------------------------------- /miniprogram/pages/about/about.js: -------------------------------------------------------------------------------- 1 | // pages/about/about.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | pact() { 11 | wx.navigateTo({ 12 | url: './pact', 13 | success: (result) => { 14 | console.log(result) 15 | }, 16 | fail: (res) => {}, 17 | complete: (res) => {}, 18 | }) 19 | }, 20 | service(){ 21 | wx.navigateTo({ 22 | url: 'service', 23 | success: (result) => {}, 24 | fail: (res) => {}, 25 | complete: (res) => {}, 26 | }) 27 | } 28 | }) -------------------------------------------------------------------------------- /miniprogram/pages/about/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/about/about.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

合经院社区

11 | 12 | 13 | 14 | 15 | 隐私协议 16 | 17 | 18 | 19 | 用户服务协议 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 在使用过程中遇到各种问题、反馈以及申请管理员、社团人员请联系客服操作 30 | 31 | 32 | 33 |
34 | 35 | 36 | 37 | 38 | 学校官网 39 | 40 | Copyright © 2021 合肥经济学院 刘鑫 41 | 42 | 43 |
-------------------------------------------------------------------------------- /miniprogram/pages/about/about.wxss: -------------------------------------------------------------------------------- 1 | /* pages/about/about.wxss */ 2 | .header { 3 | text-align: center; 4 | } 5 | .header image { 6 | width: 200rpx; 7 | height: 200rpx; 8 | } 9 | .line{ 10 | height: 2px; 11 | width: 100%; 12 | margin: 20px 0 ; 13 | background-color: #c0c0c059; 14 | } 15 | .weui-cell__bd{ 16 | height: 40px; 17 | padding: 5px; 18 | line-height: 40px; 19 | display: flex; 20 | flex-flow: row; 21 | } 22 | .tips{ 23 | width: 80%; 24 | } 25 | .img{ 26 | margin-top: 10px; 27 | width: 20px; 28 | height: 20px; 29 | } -------------------------------------------------------------------------------- /miniprogram/pages/activity/activity.js: -------------------------------------------------------------------------------- 1 | // pages/activity/activity.js 2 | var app = getApp() 3 | const db = wx.cloud.database() 4 | const _ = db.command 5 | let ID = '' 6 | 7 | Page({ 8 | 9 | data: { 10 | activityDetail: '', 11 | Name: '', 12 | Class: '', 13 | Phone: '', 14 | nickName: '', 15 | inputDialog: false, 16 | }, 17 | 18 | onShow() { 19 | wx.cloud.callFunction({ 20 | name: 'login', 21 | data: {}, 22 | success: res => { 23 | //获取openid 24 | console.log('user openid: ', res.result.openid) 25 | app.globalData.openid = res.result.openid 26 | this.setData({ 27 | openID: res.result.openid 28 | }) 29 | console.log("openid:", this.data.openID) 30 | wx.cloud.database().collection('user').where({ 31 | _openid: this.data.openID 32 | }).get().then(res => { 33 | console.log("用户信息数组长度", res.data) 34 | if (res.data.length != 1) { 35 | this.setData({ 36 | nickName: '' 37 | }) 38 | } else { 39 | this.setData({ 40 | nickName: res.data[0].nickName 41 | }) 42 | } 43 | }) 44 | }, 45 | fail: err => { 46 | console.error('调用失败', err) 47 | } 48 | }) 49 | db.collection('activity').orderBy('activityid', 'desc').get().then(res => { 50 | console.log(res) 51 | this.setData({ 52 | activityDetail: res.data 53 | }) 54 | }) 55 | }, 56 | 57 | goDetail(event) { 58 | // console.log("获取的_id", event) 59 | db.collection('activity').where({ 60 | id: event.currentTarget.dataset.id, 61 | parter: _.all([_.elemMatch({ parter_id: this.data.openID })]) 62 | }).get().then(res => { 63 | // console.log("是否报名", res) 64 | if (res.data.length == 0) { 65 | wx.showToast({ 66 | title: '报名后才能查看', 67 | icon: "error" 68 | }) 69 | return 70 | } else { 71 | wx.navigateTo({ 72 | url: '/pages/activity/activityDetail/activityDetail?id=' + event.currentTarget.dataset.id, 73 | }), 74 | wx.setNavigationBarTitle({ 75 | title: '活动详情' 76 | }) 77 | } 78 | }) 79 | }, 80 | 81 | powerDrawer: function (e) { 82 | if (this.data.nickName == '') { 83 | wx.showModal({ 84 | cancelColor: 'cancelColor', 85 | title: '您没有登入,是否登入?', 86 | content: '没有登入将无法使用!', 87 | success(res) { 88 | if (res.confirm) { 89 | wx.navigateTo({ 90 | url: '../login/login', 91 | }) 92 | // console.log('用户点击确定') 93 | } else if (res.cancel) { 94 | // console.log('用户点击取消') 95 | } 96 | } 97 | }) 98 | return 99 | } else { 100 | // console.log("活动id", e.target.id) 101 | ID = e.target.id 102 | var currentStatu = e.currentTarget.dataset.statu; 103 | this.setData({ 104 | inputDialog: true 105 | }); 106 | } 107 | }, 108 | close: function () { 109 | this.setData({ 110 | inputDialog: false, 111 | }) 112 | }, 113 | //获取信息 114 | getName(event) { 115 | this.setData({ 116 | Name: event.detail.value 117 | }) 118 | console.log("获取到的姓名", this.data.Name) 119 | }, 120 | getClass(event) { 121 | this.setData({ 122 | Class: event.detail.value 123 | }) 124 | console.log("获取到的班级", this.data.Class) 125 | }, 126 | getPhone(event) { 127 | this.setData({ 128 | Phone: event.detail.value 129 | }) 130 | console.log("获取到的手机", this.data.Phone) 131 | }, 132 | //确认报名 133 | inputButton() { 134 | if (this.data.Name.length < 2 || this.data.Name.length > 8 || this.data.Class.length < 2 || this.data.Phone.length < 5 || this.data.Phone.length > 20) { 135 | wx.showToast({ 136 | icon: 'none', 137 | title: '您的信息有误', 138 | }) 139 | return 140 | } 141 | let parterItems = {} 142 | parterItems.parter_id = this.data.openID 143 | parterItems.parter_name = this.data.Name 144 | parterItems.school_class = this.data.Class 145 | parterItems.link_qq = this.data.Phone 146 | console.log("用户数组:", parterItems) 147 | wx.showLoading({ 148 | title: '提交中', 149 | }) 150 | 151 | wx.cloud.callFunction({ 152 | name: 'parerInfo', 153 | data: { 154 | id: ID, 155 | parter: parterItems 156 | } 157 | }).then(res => { 158 | this.setData({ 159 | inputDialog: false, 160 | Name: '', 161 | Class: '', 162 | Phone: '' 163 | }) 164 | wx.hideLoading(), 1000 165 | wx.navigateTo({ 166 | url: '/pages/activity/activityDetail/activityDetail?id=' + ID, 167 | }) 168 | wx.setNavigationBarTitle({ 169 | title: '活动详情', 170 | }), 171 | console.log("success", res.result.stats) 172 | }).catch(res => { 173 | console.log("false", res) 174 | }) 175 | } 176 | }) 177 | -------------------------------------------------------------------------------- /miniprogram/pages/activity/activity.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/activity/activity.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 活动名称: 8 | {{item.title}} 9 | 10 | 11 | 12 | 13 | 组织人员: 14 | {{item.organizer}} 15 | 16 | 17 | 参与人数: 18 | {{item.number}} 19 | 20 | 21 | 活动地点: 22 | {{item.place}} 23 | 24 | 25 | 开始时间: 26 | {{item.star_time}} 27 | 28 | 29 | 30 | 31 | 活动详情: 32 | 33 | {{item.contents}} 34 | 35 | 36 | 37 | 38 | 39 | 我要参加 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 填写信息 48 | 49 | 50 | 51 | 个人姓名: 52 | 53 | 54 | 55 | 56 | 57 | 专业班级: 58 | 59 | 60 | 61 | 62 | 63 | 联系方式: 64 | 65 | 66 | 67 | 68 | 69 | 70 | 确认报名即代表同意本小程序 71 | 《隐私条款》 72 | 73 | 74 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /miniprogram/pages/activity/activity.wxss: -------------------------------------------------------------------------------- 1 | /* pages/activity/activity.wxss */ 2 | page { 3 | background: #f0f0f0; 4 | } 5 | 6 | .backgroundItem { 7 | background: #ffffff; 8 | border-radius: 10px; 9 | margin: 10px 5px 5px 5px; 10 | padding: 8px; 11 | } 12 | 13 | .items { 14 | padding: 4px; 15 | } 16 | 17 | .itemTitle { 18 | font-size: 40rpx; 19 | margin: 8rpx 0; 20 | } 21 | 22 | .itemTags { 23 | font-size: 35rpx; 24 | margin-left: 10px; 25 | } 26 | 27 | .itemTag { 28 | color: #707070; 29 | margin: 8rpx; 30 | } 31 | 32 | .tagText { 33 | display: inline-block; 34 | width: 30%; 35 | color: black; 36 | } 37 | 38 | .le { 39 | height: 1rpx; 40 | background: #ccc9c9; 41 | margin: 5rpx 0; 42 | } 43 | 44 | .itemContent { 45 | font-size: 38rpx; 46 | display: inline-block; 47 | height: 120px; 48 | } 49 | 50 | .contents { 51 | padding: 20rpx; 52 | } 53 | 54 | .inputButton { 55 | margin: 20px 0; 56 | padding: 0 0; 57 | font-size: 40rpx; 58 | } 59 | 60 | /*表单*/ 61 | /*button*/ 62 | .btn { 63 | font-size: 40rpx; 64 | font-weight: bolder; 65 | padding: 10rpx 0; 66 | border-radius: 10rpx; 67 | text-align: center; 68 | margin: 20rpx 10%; 69 | background: #ffffff; 70 | color: #277a00; 71 | } 72 | 73 | 74 | /*content*/ 75 | 76 | 77 | .drawerContent { 78 | height: 170px; 79 | text-align: left; 80 | } 81 | .drawerGrid { 82 | display: flex; 83 | flex-flow: row; 84 | margin: 10px; 85 | } 86 | 87 | .titleGrid { 88 | width: 30%; 89 | text-align: center; 90 | height: 30px; 91 | line-height: 30px; 92 | } 93 | .inputTable { 94 | width: 70%; 95 | } 96 | .inputGrid { 97 | border: 2rpx solid #ccc; 98 | height: 30px; 99 | width: 90%; 100 | line-height: 30px; 101 | font: 12px "microsoft yahei"; 102 | background: #fff; 103 | color: #000; 104 | padding-left: 4px; 105 | } 106 | 107 | .tipsText { 108 | font-size: 13px; 109 | } 110 | 111 | .tip_jinggao { 112 | width: 15px; 113 | height: 15px; 114 | margin: 0 10px 0 20px; 115 | } -------------------------------------------------------------------------------- /miniprogram/pages/activity/activityDetail/activityDetail.js: -------------------------------------------------------------------------------- 1 | // pages/activity/activityDetail/activityDetail.js 2 | const db = wx.cloud.database() 3 | const _ = db.command 4 | 5 | Page({ 6 | data: { 7 | activityDetail:'', 8 | parter:[] 9 | }, 10 | onLoad(option) { 11 | db.collection('activity').doc(option.id).get().then(res=>{ 12 | console.log("参与者:",res.data.parter) 13 | console.log(res.data) 14 | this.setData({ 15 | activityDetail:res.data, 16 | parter:res.data.parter 17 | }) 18 | }) 19 | }, 20 | }) -------------------------------------------------------------------------------- /miniprogram/pages/activity/activityDetail/activityDetail.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/activity/activityDetail/activityDetail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 活动名称: 4 | {{activityDetail.title}} 5 | 6 | 7 | 8 | 9 | 10 | 11 | 组织人员: 12 | {{activityDetail.organizer}} 13 | 14 | 15 | 参与人数: 16 | {{activityDetail.number}} 17 | 18 | 19 | 活动地点: 20 | {{activityDetail.place}} 21 | 22 | 23 | 联系方式: 24 | {{activityDetail.contact}}:{{activityDetail.link}} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {{activityDetail.contents}} 33 | 34 | 35 | 36 | 37 | 38 | 39 | 开始时间: 40 | {{activityDetail.star_time}} 41 | 42 | 43 | 结束时间: 44 | {{activityDetail.end_time}} 45 | 46 | 47 | 创建者: 48 | {{activityDetail.office}}:{{activityDetail.nickName}} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 报名人员信息: 60 | 61 | 62 | 63 | 64 | 姓名: 65 | {{item.parter_name}} 66 | 67 | 68 | 班级: 69 | {{item.school_class}} 70 | 71 | 72 | 联系方式: 73 | {{item.link_qq}} 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /miniprogram/pages/activity/activityDetail/activityDetail.wxss: -------------------------------------------------------------------------------- 1 | /* pages/activity/activityDetail/activityDetail.wxss */ 2 | /* pages/activity/activity.wxss */ 3 | .items{ 4 | margin: 20rpx 30rpx; 5 | margin-bottom: 40px; 6 | } 7 | .itemTitle{ 8 | font-size: 40rpx; 9 | margin: 8rpx 0; 10 | } 11 | .itemTags{ 12 | font-size: 35rpx; 13 | margin-left: 10px; 14 | } 15 | .itemTag{ 16 | color: #4b4b4b; 17 | margin: 8rpx; 18 | } 19 | 20 | 21 | .tagText{ 22 | 23 | width: 30%; 24 | color: black; 25 | } 26 | .le{ 27 | height: 1rpx; 28 | background: #ecececb6; 29 | margin: 5rpx 10rpx ; 30 | } 31 | .itemContent{ 32 | font-size: 38rpx; 33 | height: 140px; 34 | padding: 20rpx; 35 | } 36 | .infoText{ 37 | font-size: 20px; 38 | margin: 20rpx 0; 39 | } 40 | .date{ 41 | padding: 20rpx 0; 42 | } 43 | .line{ 44 | height: 1rpx; 45 | background-color: #ecececb6; 46 | margin: 20rpx 10rpx 20rpx 10rpx; 47 | } -------------------------------------------------------------------------------- /miniprogram/pages/admin/admin.js: -------------------------------------------------------------------------------- 1 | // pages/me/admin/admin.js 2 | const app = getApp() 3 | 4 | Page({ 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | curNav: 1, 10 | // 公告内容 11 | slideButtons: [{ 12 | src: '/pages/icon/delete.svg', // icon的路径 13 | }], 14 | delete: false, 15 | deleteValue: '', 16 | indexTextData: '', 17 | textNumber: '0', 18 | notice: '', 19 | wordNumber: 0, 20 | 21 | // 轮播图 22 | indexImgData: '', 23 | fileID: '', 24 | 25 | // 社团人员 26 | bossheads: '', 27 | 28 | // 所有用户 29 | show: false, 30 | addCollegaId: '', 31 | officeInfo: '', 32 | 33 | // 文章列表 34 | articles: '', 35 | 36 | // 评论列表 37 | comments: '' 38 | }, 39 | 40 | // 切换菜单 41 | switchRightTab: function (e) { 42 | let id = e.target.dataset.id; 43 | console.log(id); 44 | this.setData({ 45 | curNav: id, 46 | show: false, 47 | }) 48 | }, 49 | 50 | // 页面加载 51 | onLoad() { 52 | wx.cloud.database().collection('index').doc('b00064a76054bf6b0adc04827ae254ba').get().then(res => { 53 | console.log("onload 公告轮播图:", res.data) 54 | this.setData({ 55 | indexImgData: res.data.images, 56 | indexImgData_0: res.data.images[0], 57 | indexImgData_1: res.data.images[1], 58 | indexImgData_2: res.data.images[2], 59 | indexTextData: res.data.notices, 60 | }) 61 | }) 62 | 63 | wx.cloud.database().collection('user').where({ 64 | bosshead: true 65 | }).get().then(res => { 66 | console.log("onload 社团人员:", res.data) 67 | this.setData({ 68 | bossheads: res.data 69 | }) 70 | }) 71 | 72 | wx.cloud.database().collection('user').get().then(res => { 73 | console.log("onload 所有用户:", res.data) 74 | this.setData({ 75 | users: res.data, 76 | }) 77 | }) 78 | 79 | wx.cloud.database().collection('articles').get().then(res => { 80 | console.log("onload 文章:", res.data) 81 | this.setData({ 82 | articles: res.data 83 | }) 84 | }) 85 | 86 | wx.cloud.database().collection('comment').get().then(res => { 87 | console.log("onload 评论", res.data) 88 | this.setData({ 89 | comments: res.data 90 | }) 91 | }) 92 | 93 | }, 94 | 95 | // 公告栏 96 | 97 | hide(e) { 98 | // console.log(e) 99 | this.setData({ 100 | delete: false 101 | }) 102 | console.log("滑动显示删除:", this.data.delete) 103 | }, 104 | show(e) { 105 | // console.log(e) 106 | this.setData({ 107 | delete: true, 108 | deleteValue: e.currentTarget.id 109 | }) 110 | console.log("滑动显示删除:", this.data.delete) 111 | }, 112 | 113 | slideButtonTap(e) { 114 | var that = this 115 | if (this.data.delete == true) { 116 | wx.showModal({ 117 | cancelColor: 'cancelColor', 118 | title: '确定删除此条公告 ?', 119 | content: '删除后无法撤销!', 120 | success(res) { 121 | console.log(res) 122 | if (res.confirm) { 123 | const _ = wx.cloud.database().command 124 | 125 | wx.cloud.callFunction({ 126 | name: 'delete_notices', 127 | data: { 128 | notices: that.data.deleteValue 129 | } 130 | }).then(res => { 131 | wx.cloud.database().collection('index').doc('b00064a76054bf6b0adc04827ae254ba').get().then(res => { 132 | console.log(res.data) 133 | that.setData({ 134 | indexTextData: res.data.notices, 135 | notice: '' 136 | }) 137 | }) 138 | }) 139 | } else if (res.cancel) { 140 | console.log('取消') 141 | } 142 | 143 | } 144 | }) 145 | } 146 | }, 147 | 148 | 149 | getNotices(e) { 150 | this.setData({ 151 | notice: e.detail.value, 152 | wordNumber: e.detail.value.length 153 | }) 154 | console.log("notice文字", this.data.notice) 155 | }, 156 | 157 | setNotices() { 158 | if (this.data.notice.length > 4) { 159 | const _ = wx.cloud.database().command 160 | wx.cloud.callFunction({ 161 | name: 'update_index', 162 | data: { 163 | notices: this.data.notice 164 | } 165 | }).then(res => { 166 | wx.cloud.database().collection('index').doc('b00064a76054bf6b0adc04827ae254ba').get().then(res => { 167 | console.log(res.data) 168 | this.setData({ 169 | indexTextData: res.data.notices, 170 | notice: '' 171 | }) 172 | }) 173 | }) 174 | }else{ 175 | wx.showToast({ 176 | title: '至少 5 个字符', 177 | icon:'error', 178 | duration:1500 179 | }) 180 | } 181 | }, 182 | 183 | // 轮播图 184 | /** 预览图片 */ 185 | showImg: function (event) { 186 | console.log("图片数组", this.data.indexImgData) 187 | console.log("viewID", event.currentTarget.id) 188 | if (event.currentTarget.id == 0) { 189 | wx.previewMedia({ 190 | sources: [{ url: this.data.indexImgData_0, type: "image" }], 191 | }) 192 | } else if (event.currentTarget.id == 1) { 193 | wx.previewMedia({ 194 | sources: [{ url: this.data.indexImgData_1, type: "image" }], 195 | }) 196 | } else { 197 | wx.previewMedia({ 198 | sources: [{ url: this.data.indexImgData_2, type: "image" }], 199 | }) 200 | } 201 | }, 202 | 203 | 204 | /**上传图片 */ 205 | updateImg(e) { 206 | var buttonid = e.currentTarget.id 207 | console.log("按钮id", e.currentTarget.id) 208 | var that = this 209 | wx.chooseImage({ 210 | count: 1, 211 | sizeType: ['compressed'], 212 | sourceType: ['album', 'camera'], 213 | success: function (res) { 214 | wx.showLoading({ 215 | title: '上传中', 216 | }) 217 | const filePath = res.tempFilePaths[0] 218 | console.log("临时数据:", res) 219 | // 上传图片 220 | const cloudPath = '轮播图/' + Date.parse(new Date()) + `${filePath.match(/\.[^.]+?$/)[0]}` // 图片位置 221 | wx.cloud.uploadFile({ 222 | cloudPath, 223 | filePath, 224 | success: res => { 225 | console.log('[上传文件] 成功:', res.fileID) 226 | that.setData({ fileID: res.fileID }) 227 | }, 228 | fail: e => { 229 | console.error('[上传文件] 失败:', e) 230 | wx.showToast({ 231 | icon: 'none', 232 | title: '上传失败', 233 | }) 234 | }, 235 | complete: () => { 236 | wx.hideLoading() 237 | wx.cloud.callFunction({ 238 | name: 'updata_user', //云函数名称 239 | data: { 240 | type: 'update', //data所有的变量都是关联云函数的,按照编写的云函数需要的变量来 241 | db: 'index', //需要操作的集合 242 | indexKey: 'b00064a76054bf6b0adc04827ae254ba', 243 | data: { 244 | ['images.' + [buttonid]]: that.data.fileID 245 | }, 246 | }, 247 | success: res => { 248 | console.log(res) 249 | that.setData({ 250 | fileID: '' 251 | }) 252 | wx.cloud.database().collection('index').doc('b00064a76054bf6b0adc04827ae254ba').get().then(res => { 253 | console.log("onload 公告轮播图:", res.data) 254 | that.setData({ 255 | indexImgData: res.data.images, 256 | indexImgData_0: res.data.images[0], 257 | indexImgData_1: res.data.images[1], 258 | indexImgData_2: res.data.images[2], 259 | indexTextData: res.data.notices, 260 | }) 261 | }) 262 | } 263 | }) 264 | } 265 | }) 266 | }, 267 | }) 268 | }, 269 | 270 | 271 | // 社团人员 272 | cancelCollega(e) { 273 | var that = this 274 | console.log("字段 _id:", e.currentTarget.id) 275 | var collegaId = e.currentTarget.id 276 | wx.showModal({ 277 | cancelColor: 'cancelColor', 278 | title: "是否删除社团人员身份?", 279 | success(res) { 280 | if (res.confirm) { 281 | wx.cloud.callFunction({ 282 | name: 'updata_user', 283 | data: { 284 | type: 'update', 285 | db: 'user', 286 | indexKey: collegaId, 287 | data: { 288 | bosshead: false, 289 | office: '', 290 | }, 291 | } 292 | }) 293 | wx.showToast({ 294 | title: '删除成功!', 295 | icon: 'success', 296 | duration: 2000, 297 | success: res => { 298 | wx.startPullDownRefresh({ 299 | success: (res) => { 300 | wx.cloud.database().collection('user').where({ 301 | bosshead: true 302 | }).get().then(res => { 303 | console.log('自动刷新,社团:', res) 304 | that.setData({ 305 | bossheads: res.data 306 | }) 307 | }) 308 | }, 309 | }) 310 | } 311 | }) 312 | console.log('用户点击确定') 313 | } else if (res.cancel) { 314 | console.log('用户点击取消') 315 | } 316 | } 317 | }) 318 | }, 319 | 320 | 321 | 322 | // 所有用户 // 323 | // 添加社团 324 | addCollega(e) { 325 | this.setData({ 326 | show: true, 327 | addCollegaId: e.currentTarget.id 328 | }) 329 | // console.log(e.currentTarget.id) 330 | }, 331 | 332 | bindKeyInput(e) { 333 | // console.log("弹窗文字:",e.detail.value) 334 | this.setData({ 335 | officeInfo: e.detail.value 336 | }) 337 | }, 338 | btnDonate() { 339 | if (this.data.officeInfo.length < 1) { 340 | wx.showToast({ 341 | title: '内容不能为空!', 342 | icon: 'error' 343 | }) 344 | return 345 | } 346 | wx.cloud.callFunction({ 347 | name: 'updata_user', //你的云函数名称 348 | data: { 349 | type: 'update', //data所有的变量都是关联云函数的,按照编写的云函数需要的变量来 350 | db: 'user', //需要操作的集合 351 | indexKey: this.data.addCollegaId, 352 | data: { 353 | bosshead: true, 354 | office: this.data.officeInfo, 355 | }, 356 | } 357 | }) 358 | wx.showToast({ 359 | title: '添加成功!', 360 | icon: 'success', 361 | success: res => { 362 | wx.startPullDownRefresh({ 363 | success: (res) => { 364 | wx.cloud.database().collection('user').get().then(res => { 365 | // console.log(res.data) 366 | this.setData({ 367 | users: res.data, 368 | show: false 369 | }) 370 | }) 371 | }, 372 | }) 373 | } 374 | }) 375 | }, 376 | //删除用户 377 | deleteUser(e) { 378 | var that = this 379 | // console.log(e.currentTarget.dataset.id) 是否管理员 380 | var id = e.currentTarget.id // 字段: _id 381 | if (e.currentTarget.dataset.id == true) { 382 | wx.showToast({ 383 | title: '无法删除管理员', 384 | icon:'none' 385 | }) 386 | return 387 | } 388 | wx.showModal({ 389 | cancelColor: 'cancelColor', 390 | title: '是否删除该用户 ?', 391 | content: '仅删除用户注册信息,无法删除该用户文章及评论', 392 | success(res) { 393 | if (res.confirm) { 394 | wx.cloud.callFunction({ 395 | name: 'updata_user', //你的云函数名称 396 | data: { 397 | type: 'delete', //data所有的变量都是关联云函数的,按照编写的云函数需要的变量来 398 | db: 'user', //需要操作的集合 399 | indexKey: id, 400 | } 401 | }) 402 | wx.showToast({ 403 | title: '删除成功', 404 | success: res => { 405 | wx.startPullDownRefresh({ 406 | success: (res) => { 407 | wx.cloud.database().collection('user').get().then(res => { 408 | console.log("删除用户后:", res.data) 409 | that.setData({ 410 | users: res.data 411 | }) 412 | }) 413 | }, 414 | }) 415 | } 416 | }) 417 | console.log('用户点击确定') 418 | } else if (res.cancel) { 419 | console.log('用户点击取消') 420 | } 421 | } 422 | }) 423 | }, 424 | 425 | 426 | 427 | // 文章列表 428 | deleteArticle(e) { 429 | var that = this 430 | console.log(e.currentTarget.id) 431 | var id = e.currentTarget.id 432 | wx.showModal({ 433 | cancelColor: 'cancelColor', 434 | title: '是否删除该文章?', 435 | success(res) { 436 | if (res.confirm) { 437 | wx.cloud.callFunction({ 438 | name: 'updata_user', //你的云函数名称 439 | data: { 440 | type: 'delete', //data所有的变量都是关联云函数的,按照编写的云函数需要的变量来 441 | db: 'articles', //需要操作的集合 442 | indexKey: id, 443 | } 444 | }) 445 | wx.showToast({ 446 | title: '删除成功', 447 | success: res => { 448 | wx.startPullDownRefresh({ 449 | success: (res) => { 450 | wx.cloud.database().collection('articles').get().then(res => { 451 | console.log("文章2:", res.data) 452 | that.setData({ 453 | articles: res.data 454 | }) 455 | }) 456 | }, 457 | }) 458 | } 459 | }) 460 | console.log('用户点击确定') 461 | } else if (res.cancel) { 462 | console.log('用户点击取消') 463 | } 464 | } 465 | }) 466 | }, 467 | 468 | // 评论列表 469 | deleteComment(e) { 470 | var that = this 471 | console.log(e.currentTarget.id) 472 | var id = e.currentTarget.id 473 | wx.showModal({ 474 | cancelColor: 'cancelColor', 475 | title: '是否删除该条评论 ?', 476 | success(res) { 477 | if (res.confirm) { 478 | wx.cloud.callFunction({ 479 | name: 'updata_user', //你的云函数名称 480 | data: { 481 | type: 'delete', //data所有的变量都是关联云函数的,按照编写的云函数需要的变量来 482 | db: 'comment', //需要操作的集合 483 | indexKey: id, 484 | } 485 | }) 486 | wx.showToast({ 487 | title: '删除成功', 488 | success: res => { 489 | wx.startPullDownRefresh({ 490 | success: (res) => { 491 | wx.cloud.database().collection('comment').get().then(res => { 492 | console.log("评论:", res.data) 493 | that.setData({ 494 | comments: res.data 495 | }) 496 | }) 497 | }, 498 | }) 499 | } 500 | }) 501 | console.log('用户点击确定') 502 | } else if (res.cancel) { 503 | console.log('用户点击取消') 504 | } 505 | } 506 | }) 507 | }, 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | /** 519 | * 生命周期函数--监听页面初次渲染完成 520 | */ 521 | onReady: function () { 522 | 523 | }, 524 | 525 | /** 526 | * 生命周期函数--监听页面显示 527 | */ 528 | onShow() { 529 | 530 | }, 531 | 532 | /** 533 | * 生命周期函数--监听页面隐藏 534 | */ 535 | onHide: function () { 536 | 537 | }, 538 | 539 | /** 540 | * 生命周期函数--监听页面卸载 541 | */ 542 | onUnload: function () { 543 | 544 | }, 545 | 546 | /** 547 | * 页面相关事件处理函数--监听用户下拉动作 548 | */ 549 | onPullDownRefresh: function () { 550 | wx.stopPullDownRefresh({ 551 | success: (res) => { 552 | wx.cloud.database().collection('index').doc('b00064a76054bf6b0adc04827ae254ba').get().then(res => { 553 | console.log('公告与轮播图:', res.data) 554 | this.setData({ 555 | indexImgData: res.data.images, 556 | indexImgData_0: res.data.images[0], 557 | indexImgData_1: res.data.images[1], 558 | indexImgData_2: res.data.images[2], 559 | indexTextData: res.data.notices, 560 | }) 561 | }) 562 | 563 | wx.cloud.database().collection('user').where({ 564 | bosshead: true 565 | }).get().then(res => { 566 | console.log('社团人员:', res) 567 | this.setData({ 568 | bossheads: res.data 569 | }) 570 | }) 571 | 572 | wx.cloud.database().collection('user').get().then(res => { 573 | console.log("用户列表:", res.data) 574 | this.setData({ 575 | users: res.data, 576 | }) 577 | }) 578 | 579 | 580 | wx.cloud.database().collection('articles').get().then(res => { 581 | console.log("文章:", res.data) 582 | this.setData({ 583 | articles: res.data 584 | }) 585 | }) 586 | 587 | wx.cloud.database().collection('comment').get().then(res => { 588 | console.log("评论:", res.data) 589 | this.setData({ 590 | comments: res.data 591 | }) 592 | }) 593 | 594 | 595 | }, 596 | }) 597 | }, 598 | 599 | /** 600 | * 页面上拉触底事件的处理函数 601 | */ 602 | onReachBottom: function () { 603 | 604 | }, 605 | 606 | /** 607 | * 用户点击右上角分享 608 | */ 609 | onShareAppMessage: function () { 610 | 611 | } 612 | }) 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | // Page({ 627 | // data: { 628 | // slideButtons: [{ 629 | // src: '/pages/icon/shoucangFalse.svg', // icon的路径 630 | // }, { 631 | // src: '/pages/icon/delete.svg', // icon的路径 632 | // }], 633 | // }, 634 | 635 | 636 | // onLoad: function () { 637 | 638 | // }, 639 | // slideButtonTap(e) { 640 | // console.log('slide button tap', e.detail) 641 | // this.setData({ 642 | // slideButtons: [{ 643 | // src: '/pages/icon/shoucangTrue.svg', // icon的路径 644 | // }, { 645 | // src: '/pages/icon/delete.svg', // icon的路径 646 | // }], 647 | // }); 648 | // } 649 | // }); 650 | 651 | 652 | -------------------------------------------------------------------------------- /miniprogram/pages/admin/admin.json: -------------------------------------------------------------------------------- 1 | { 2 | "enablePullDownRefresh": true , 3 | "usingComponents": { 4 | "mp-cells": "weui-miniprogram/cells/cells", 5 | "mp-cell": "weui-miniprogram/cell/cell", 6 | "mp-slideview": "weui-miniprogram/slideview/slideview", 7 | "mp-half-screen-dialog": "weui-miniprogram/half-screen-dialog/half-screen-dialog" 8 | } 9 | } -------------------------------------------------------------------------------- /miniprogram/pages/admin/admin.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 公告栏 9 | 10 | 11 | 轮播图 12 | 13 | 14 | 社团人员 15 | 16 | 17 | 所有用户 18 | 19 | 20 | 文章列表 21 | 22 | 23 | 评论列表 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | {{item}} 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | {{wordNumber}}/20 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | tip:选择长宽比合适的图片; 91 | 如果没有加载出来请下拉刷新 92 | 93 | 图片只会加载所点击的图 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | {{item.nickName}} 111 | 112 | {{item.office}} 113 | 114 | 115 | 116 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | {{item.nickName}} 138 | 139 | 141 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 添加至社团人员 164 | 165 | 166 | 167 | 填写所在社团及职位 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 标题:{{item.title}} 192 | 分类:{{item.type}} 193 | 194 | {{item.content}} 195 | 196 | 199 | 200 | 201 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | {{item.content}} 222 | 昵称:{{item.commenter}} 223 | 224 | 标题:{{item.articletitle}} 225 | 226 | 229 | 230 | 231 | 232 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | -------------------------------------------------------------------------------- /miniprogram/pages/admin/admin.wxss: -------------------------------------------------------------------------------- 1 | /**/ 2 | /* 1. 设置整个页面的背景颜色 */ 3 | page { 4 | background: #f5f5f5; 5 | } 6 | 7 | /* 2.主盒子 */ 8 | .container { 9 | width: 100%; 10 | height: 100%; 11 | background-color: #eeeeeed8; 12 | } 13 | 14 | /* 3.左盒子*/ 15 | .nav_left { 16 | position: absolute; 17 | top: 0px; 18 | left: 0px; 19 | width: 20%; 20 | background: #f5f5f5; 21 | text-align: center; 22 | } 23 | 24 | .nav_left .nav_left_items { 25 | height: 80rpx; 26 | padding: 6rpx 0; 27 | border-bottom: 1px solid #dedede; 28 | font-size: 28rpx; 29 | line-height: 80rpx; 30 | } 31 | 32 | .nav_left .nav_left_items.active { 33 | background: #fff; 34 | color: #3385ff; 35 | border-left: 3px solid #3385ff; 36 | } 37 | 38 | /* 4.右盒子 */ 39 | .nav_right { 40 | position: absolute; 41 | top: 0; 42 | left: 20%; 43 | width: 80%; 44 | height: 100%; 45 | padding: 10px; 46 | box-sizing: border-box; 47 | background: #fff; 48 | display: inline-block; 49 | overflow: scroll; 50 | } 51 | 52 | /* 公告栏 */ 53 | .blockNotice { 54 | margin-right: 10px; 55 | margin-top: 10rpx; 56 | padding-bottom: 60px; 57 | } 58 | 59 | .weui-cell { 60 | padding: 8px; 61 | } 62 | 63 | .inputArea { 64 | margin-top: 100px; 65 | margin-left: 20rpx; 66 | margin-right: 20rpx; 67 | border: 0.5px #cccccc93 ridge; 68 | padding: 8px 16px; 69 | width: 82%; 70 | } 71 | 72 | .inputText { 73 | height: 80px; 74 | width: 100%; 75 | } 76 | 77 | .line { 78 | margin: 16rpx 0; 79 | height: 1px; 80 | background-color: #e7e6e665; 81 | } 82 | 83 | .button { 84 | margin-top: 60px; 85 | } 86 | 87 | 88 | /* 轮播图 */ 89 | 90 | .imgData_items { 91 | display: flex; 92 | flex-flow: row; 93 | } 94 | 95 | .imgData { 96 | padding: 10px; 97 | width: 70%; 98 | text-align: center; 99 | } 100 | 101 | .imgDelete { 102 | padding: 10px; 103 | width: 30%; 104 | height: 220rpx; 105 | text-align: center; 106 | line-height: 220rpx; 107 | } 108 | 109 | .imgData_item { 110 | width: 400rpx; 111 | height: 200rpx; 112 | } 113 | 114 | .imgData_delete { 115 | width: 72rpx; 116 | height: 72rpx; 117 | } 118 | .tipsBar{ 119 | margin: 10px; 120 | } 121 | 122 | .blockInfo{ 123 | padding-bottom: 40rpx; 124 | } 125 | 126 | /* 社团人员 */ 127 | 128 | .bossheadInfo { 129 | display: flex; 130 | flex-flow: row; 131 | } 132 | 133 | .weui-cell_info { 134 | margin-left: 10px; 135 | width: 340rpx; 136 | height: 110rpx; 137 | } 138 | 139 | .weui-cell_Name { 140 | padding-bottom: 2px; 141 | } 142 | 143 | .weui-cell_Info_img { 144 | width: 100rpx; 145 | height: 100rpx; 146 | } 147 | 148 | .weui-cell_Img { 149 | width: 100rpx; 150 | height: 100rpx; 151 | } 152 | 153 | .weui-cell_cancel_img { 154 | width: 100rpx; 155 | height: 100rpx; 156 | text-align: center; 157 | } 158 | 159 | .weui-cell_cancelImg { 160 | width: 25px; 161 | height: 25px; 162 | margin-top: 25rpx; 163 | } 164 | 165 | 166 | /* 所有用户 */ 167 | .weui-cell_all { 168 | height: 100rpx; 169 | line-height: 45rpx; 170 | } 171 | 172 | .weui-cell_allName { 173 | margin-left: 10px; 174 | width: 300rpx; 175 | height: 50rpx; 176 | } 177 | 178 | .weui-cells__title { 179 | margin: 10px 0; 180 | color: #000000; 181 | font-size: 14px; 182 | font-weight: 545; 183 | } 184 | 185 | .weui-input { 186 | margin: 10px; 187 | font-size: 18px; 188 | } 189 | 190 | .weui-cell_collegaImages { 191 | margin-left: 10px; 192 | } 193 | 194 | .collegaImages { 195 | width: 120rpx; 196 | height: 60rpx; 197 | } 198 | .adminImages{ 199 | width: 60rpx; 200 | height: 60rpx; 201 | } 202 | .weui-cell_operate_img { 203 | width: 160rpx; 204 | height: 100rpx; 205 | display: flex; 206 | flex-flow: row; 207 | } 208 | 209 | .weui-cell_operate_add { 210 | width: 100rpx; 211 | height: 100rpx; 212 | text-align: center; 213 | } 214 | 215 | .weui-cell_operate_del { 216 | width: 100rpx; 217 | height: 100rpx; 218 | text-align: center; 219 | } 220 | 221 | .weui-cell_delete_user_Img { 222 | width: 25px; 223 | height: 25px; 224 | margin-top: 25rpx; 225 | } 226 | 227 | 228 | /* 文章列表 */ 229 | .weui-cell_title { 230 | font-weight: 545; 231 | font-size: 34rpx; 232 | } 233 | 234 | .weui-cell_title_Contents { 235 | margin: 6rpx; 236 | padding: 4rpx; 237 | border-radius: 4px; 238 | background-color: #e0e0e02c; 239 | width: 480rpx; 240 | } 241 | 242 | .weui-cell_title_articleContent { 243 | height: 50px; 244 | font-size: 15px; 245 | overflow: hidden; 246 | text-overflow: ellipsis; 247 | display: -webkit-box; 248 | -webkit-line-clamp: 2; 249 | -webkit-box-orient: vertical; 250 | } 251 | 252 | .weui-cell_articleInfo { 253 | font-size: small; 254 | color: #6b6b6b; 255 | } 256 | 257 | .tips { 258 | font-size: small; 259 | color: #6b6b6b; 260 | } 261 | 262 | .weui-cell_type { 263 | font-size: 14px; 264 | color: #6b6b6b; 265 | } 266 | 267 | .weui-cell_delete_img { 268 | margin-left: 1vw; 269 | padding-top: 20%; 270 | } 271 | 272 | .weui-cell_deleteImg { 273 | width: 50rpx; 274 | height: 50rpx; 275 | } 276 | 277 | 278 | /* 评论 */ 279 | 280 | .weui-cell_comments { 281 | font-weight: 545; 282 | font-size: 34rpx; 283 | margin: 2px 0 2px 6px; 284 | } 285 | 286 | .weui-cell_commenter { 287 | font-size: 14px; 288 | color: #6b6b6bce; 289 | margin-left: 12px; 290 | } 291 | 292 | .weui-cell_comment_Contents { 293 | margin: 6rpx; 294 | padding: 4rpx; 295 | border-radius: 4px; 296 | background-color: #e0e0e021; 297 | width: 480rpx; 298 | } 299 | 300 | .weui-cell_title_commentContent { 301 | margin-left: 4px; 302 | height: 26px; 303 | font-size: 16px; 304 | overflow: hidden; 305 | text-overflow: ellipsis; 306 | display: -webkit-box; 307 | -webkit-line-clamp: 1; 308 | -webkit-box-orient: vertical; 309 | } 310 | .weui-cell_author{ 311 | padding-left: 4px; 312 | } 313 | .tip { 314 | color: #7e7e7ed2; 315 | font-size: 4px; 316 | } -------------------------------------------------------------------------------- /miniprogram/pages/articleList/articleList.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | detail: [], 4 | type: '', 5 | }, 6 | 7 | onLoad(event) { 8 | console.log(event.type) 9 | this.setData({ 10 | type: event.type, 11 | }) 12 | wx.cloud.database().collection('articles').where({ topicid: Number(this.data.type) }).orderBy('articleid', 'desc').get().then(res => { 13 | console.log(res) 14 | this.setData({ 15 | detail: res.data 16 | }) 17 | }).catch(res => { 18 | console.log(res) 19 | }) 20 | }, 21 | 22 | 23 | 24 | /**跳转 */ 25 | goDetail(event) { 26 | console.log("获取的id", event.currentTarget.dataset.id) 27 | wx.navigateTo({ 28 | url: '/pages/detail/detail?id=' + event.currentTarget.dataset.id, 29 | }) 30 | wx.setNavigationBarTitle({ 31 | title: '内容详情', 32 | }) 33 | }, 34 | 35 | // 下拉刷新 36 | onPullDownRefresh: function () { 37 | wx.cloud.database().collection('articles').where({ topicid: Number(this.data.type) }).orderBy('articleid', 'desc').get().then(res => { 38 | console.log(res) 39 | this.setData({ 40 | detail: res.data, 41 | }) 42 | }).catch(res => { 43 | console.log(res) 44 | }) 45 | wx.stopPullDownRefresh() 46 | }, 47 | }) -------------------------------------------------------------------------------- /miniprogram/pages/articleList/articleList.json: -------------------------------------------------------------------------------- 1 | { 2 | "enablePullDownRefresh": true , 3 | "usingComponents": { 4 | "mp-searchbar": "weui-miniprogram//searchbar/searchbar" 5 | } 6 | } -------------------------------------------------------------------------------- /miniprogram/pages/articleList/articleList.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {{item.title}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{item.nickName}} 31 | 32 | 33 | 34 | 35 | 36 | {{item.content}} 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /miniprogram/pages/articleList/articleList.wxss: -------------------------------------------------------------------------------- 1 | /* pages/home/home.wxss */ 2 | page { 3 | background-color: #ebebeb96; 4 | } 5 | 6 | .searchItem { 7 | line-height: 50%; 8 | display: flex; 9 | flex-flow: row; 10 | padding: 6px; 11 | background: #d8d4d46e; 12 | } 13 | .srearchIcon{ 14 | margin-top: 3.5px; 15 | padding: 4px; 16 | background-color: white; 17 | height: 26px; 18 | border-top-left-radius: 4px; 19 | border-bottom-left-radius: 4px; 20 | } 21 | .searchInputItem { 22 | padding: 4px 4px 4px 0; 23 | height: 28px; 24 | width: 80%; 25 | } 26 | 27 | .searchInput { 28 | border-top-right-radius: 4px; 29 | border-bottom-right-radius: 4px; 30 | background: white; 31 | padding: 6px; 32 | } 33 | 34 | .searchButton { 35 | padding-top: 5px; 36 | width: 20%; 37 | text-align: center; 38 | } 39 | 40 | .items { 41 | margin: 20rpx; 42 | } 43 | 44 | .itembg { 45 | margin: 10rpx 8rpx 0 8rpx; 46 | border: 2px solid #ebebeb96; 47 | background-color: #ffffff; 48 | border-radius: 15px; 49 | } 50 | 51 | .itemTitle { 52 | font-size: 46rpx; 53 | margin: 4rpx 0; 54 | font-weight: 350; 55 | } 56 | 57 | .itemAT { 58 | margin: 5rpx 0; 59 | } 60 | 61 | .itemAuthor { 62 | color: #313131; 63 | display: flex; 64 | flex-flow: row; 65 | } 66 | 67 | .authorImg { 68 | width: 80rpx; 69 | height: 80rpx; 70 | } 71 | 72 | .authorName { 73 | height: 80rpx; 74 | text-align: center; 75 | font-size: 36rpx; 76 | margin-top: 24rpx; 77 | margin-left: 40rpx; 78 | } 79 | 80 | .img { 81 | width: 80rpx; 82 | height: 80rpx; 83 | } 84 | 85 | .itemContent { 86 | font-size: 36rpx; 87 | margin: 0 5rpx; 88 | } 89 | .itemImages{ 90 | margin-top: 8px; 91 | } 92 | .itemImages image { 93 | width: 180rpx; 94 | height: 180rpx; 95 | } 96 | .imagesList{ 97 | margin: 0 10px 0 5px; 98 | } 99 | .none { 100 | height: 20px; 101 | background: #ebebeb3f; 102 | } -------------------------------------------------------------------------------- /miniprogram/pages/college/addcollege/addcollege.js: -------------------------------------------------------------------------------- 1 | var app = getApp() 2 | let name = '' 3 | let organizer = '' 4 | let number = '' 5 | let place = '' 6 | let link = '' 7 | let content = '' 8 | 9 | let activityid = Date.parse(new Date()); //文章id 为string类型时间 10 | Page({ 11 | 12 | data: { 13 | links: ["微信", "QQ", "手机号"], 14 | linksIndex: 0, 15 | contact: '微信', 16 | startime: "2021-01-01", 17 | endtime: "2021-01-01", 18 | wordNumber: "0", 19 | nickName:'', 20 | office:'' 21 | }, 22 | onLoad() { 23 | wx.cloud.callFunction({ 24 | name: 'login', 25 | data: {}, 26 | success: res => { 27 | //获取openid 28 | console.log('user openid: ', res.result.openid) 29 | app.globalData.openid = res.result.openid 30 | this.setData({ 31 | openID: res.result.openid 32 | }) 33 | // 通过openid查找 34 | // console.log(res.result) 35 | // console.log(this.data.openID) 36 | wx.cloud.database().collection('user').where({ 37 | _openid: this.data.openID 38 | }).get().then(res => { 39 | console.log("昵称", res.data.length) 40 | // for 遍历数组 41 | for (var i = 0; i < res.data.length; ++i) { 42 | // console.log(i); 43 | if (i >= 1) break; 44 | console.log(res.data[i]) 45 | this.setData({ 46 | nickName:res.data[i].nickName, 47 | office:res.data[i].office 48 | }) 49 | } 50 | }) 51 | }, 52 | 53 | fail: err => { 54 | console.error('调用失败', err) 55 | } 56 | }) 57 | 58 | 59 | }, 60 | // 获取页面所有的值 61 | getName(event) { 62 | console.log("名称", event.detail.value) 63 | name = event.detail.value 64 | }, 65 | getColleger(event) { 66 | console.log("人员", event.detail.value) 67 | organizer = event.detail.value 68 | }, 69 | getNumber(event) { 70 | console.log("人数", event.detail.value) 71 | number = event.detail.value 72 | }, 73 | getPlace(event) { 74 | console.log("地点", event.detail.value) 75 | place = event.detail.value 76 | }, 77 | getLink(event) { 78 | console.log("联系", event.detail.value) 79 | link = event.detail.value 80 | }, 81 | getContent(event) { 82 | console.log("详情", event.detail.value) 83 | content = event.detail.value 84 | this.setData({ 85 | wordNumber: event.detail.value.length 86 | }) 87 | }, 88 | getStartime(event) { 89 | console.log("开始时间", event.detail.value) 90 | this.setData({ startime: event.detail.value }) 91 | }, 92 | getEndtime(event) { 93 | console.log("结束时间", event.detail.value) 94 | this.setData({ endtime: event.detail.value }) 95 | }, 96 | 97 | 98 | changeLinks: function (e) { 99 | console.log('值为', e.detail.value); 100 | this.setData({ 101 | linksIndex: e.detail.value 102 | }) 103 | if (e.detail.value == 0) { 104 | this.setData({ 105 | contact: "微信" 106 | }) 107 | } else if (e.detail.value == 1) { 108 | this.setData({ 109 | contact: "QQ" 110 | }) 111 | } else { 112 | this.setData({ 113 | contact: "手机" 114 | }) 115 | } 116 | }, 117 | 118 | 119 | 120 | issuance() { 121 | if (name.length < 2 || organizer.length < 2 || number.length < 1 || place.length < 2 || link.length < 4 || content.length < 3) { 122 | wx.showToast({ 123 | title: '内容过短或未填完', 124 | icon: 'none' 125 | }) 126 | } else { 127 | wx.showLoading({ 128 | title: '发布中' 129 | }) 130 | wx.cloud.database().collection('activity').add({ 131 | data: { 132 | activityid: activityid, 133 | title: name, 134 | organizer: organizer, 135 | number: number, 136 | place: place, 137 | link: link, 138 | contents: content, 139 | star_time: this.data.startime, 140 | end_time: this.data.endtime, 141 | contact: this.data.contact, 142 | nickName: this.data.nickName, 143 | office:this.data.office 144 | } 145 | }) 146 | wx.hideLoading(), 2000 147 | } 148 | wx.navigateBack({ 149 | delta: 1 150 | }) 151 | 152 | 153 | } 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | }) -------------------------------------------------------------------------------- /miniprogram/pages/college/addcollege/addcollege.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/college/addcollege/addcollege.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 活动名称: 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 组织人员: 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 参与人数: 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 活动地点: 41 | 42 | 43 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {{links[linksIndex]}} 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |