فهرست منبع

更新

app.js格式
Chicolor 4 سال پیش
والد
کامیت
9b49968985
100فایلهای تغییر یافته به همراه3902 افزوده شده و 3901 حذف شده
  1. 12 12
      README.md
  2. 6 6
      cloudfunctions/callback/config.json
  3. 25 25
      cloudfunctions/callback/index.js
  4. 13 13
      cloudfunctions/callback/package.json
  5. 5 5
      cloudfunctions/echo/config.json
  6. 8 8
      cloudfunctions/echo/index.js
  7. 13 13
      cloudfunctions/echo/package.json
  8. 5 5
      cloudfunctions/getOpenId/config.json
  9. 11 11
      cloudfunctions/getOpenId/index.js
  10. 14 14
      cloudfunctions/getOpenId/package.json
  11. 5 5
      cloudfunctions/login/config.json
  12. 36 36
      cloudfunctions/login/index.js
  13. 14 14
      cloudfunctions/login/package.json
  14. 14 14
      cloudfunctions/openapi/config.json
  15. 86 86
      cloudfunctions/openapi/index.js
  16. 14 14
      cloudfunctions/openapi/package.json
  17. 78 77
      miniprogram/app.js
  18. 63 63
      miniprogram/app.json
  19. 23 23
      miniprogram/app.wxss
  20. 48 48
      miniprogram/components/followNews/followNews.js
  21. 5 5
      miniprogram/components/followNews/followNews.json
  22. 6 6
      miniprogram/components/followNews/followNews.wxml
  23. 74 74
      miniprogram/components/imagePicker/imagePicker.js
  24. 3 3
      miniprogram/components/imagePicker/imagePicker.json
  25. 9 9
      miniprogram/components/imagePicker/imagePicker.wxml
  26. 27 27
      miniprogram/components/itemActivityComment/itemActivityComment.js
  27. 3 3
      miniprogram/components/itemActivityComment/itemActivityComment.json
  28. 4 4
      miniprogram/components/itemActivityComment/itemActivityComment.wxml
  29. 43 43
      miniprogram/components/itemCard/itemCard.js
  30. 5 5
      miniprogram/components/itemCard/itemCard.json
  31. 33 33
      miniprogram/components/itemPublisher/itemPublisher.js
  32. 5 5
      miniprogram/components/itemPublisher/itemPublisher.json
  33. 16 16
      miniprogram/components/itemPublisher/itemPublisher.wxml
  34. 22 22
      miniprogram/components/itemfollowNews/itemfollowNews.js
  35. 3 3
      miniprogram/components/itemfollowNews/itemfollowNews.json
  36. 12 12
      miniprogram/components/itemfollowNews/itemfollowNews.wxml
  37. 73 73
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.js
  38. 3 3
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.json
  39. 13 13
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.wxml
  40. 74 74
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.js
  41. 3 3
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.json
  42. 11 11
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.wxml
  43. 19 19
      miniprogram/components/itemmyNews/itemmyNews.js
  44. 3 3
      miniprogram/components/itemmyNews/itemmyNews.json
  45. 12 12
      miniprogram/components/itemmyNews/itemmyNews.wxml
  46. 65 65
      miniprogram/pages/aboutUs/aboutUs.js
  47. 2 2
      miniprogram/pages/aboutUs/aboutUs.json
  48. 2 2
      miniprogram/pages/aboutUs/aboutUs.wxml
  49. 243 243
      miniprogram/pages/activity/activity.js
  50. 5 5
      miniprogram/pages/activity/activity.json
  51. 40 40
      miniprogram/pages/activity/activity.wxml
  52. 236 236
      miniprogram/pages/activityPublish/activityPublish.js
  53. 4 4
      miniprogram/pages/activityPublish/activityPublish.json
  54. 175 175
      miniprogram/pages/activityPublish/activityPublish.wxml
  55. 65 65
      miniprogram/pages/administratorSetting/administratorSetting.js
  56. 2 2
      miniprogram/pages/administratorSetting/administratorSetting.json
  57. 2 2
      miniprogram/pages/administratorSetting/administratorSetting.wxml
  58. 263 263
      miniprogram/pages/main/main.js
  59. 5 5
      miniprogram/pages/main/main.json
  60. 46 46
      miniprogram/pages/main/main.wxml
  61. 19 19
      miniprogram/pages/message/message.js
  62. 5 5
      miniprogram/pages/message/message.json
  63. 6 6
      miniprogram/pages/message/message.wxml
  64. 7 7
      miniprogram/pages/message/message.wxss
  65. 65 65
      miniprogram/pages/myColor/myColor.js
  66. 2 2
      miniprogram/pages/myColor/myColor.json
  67. 2 2
      miniprogram/pages/myColor/myColor.wxml
  68. 44 44
      miniprogram/pages/myFavor/myFavor.js
  69. 5 5
      miniprogram/pages/myFavor/myFavor.json
  70. 5 5
      miniprogram/pages/myFavor/myFavor.wxml
  71. 7 7
      miniprogram/pages/myFavor/myFavor.wxss
  72. 34 34
      miniprogram/pages/myFollow/myFollow.js
  73. 5 5
      miniprogram/pages/myFollow/myFollow.json
  74. 5 5
      miniprogram/pages/myFollow/myFollow.wxml
  75. 7 7
      miniprogram/pages/myFollow/myFollow.wxss
  76. 65 65
      miniprogram/pages/myPublish/myPublish.js
  77. 2 2
      miniprogram/pages/myPublish/myPublish.json
  78. 2 2
      miniprogram/pages/myPublish/myPublish.wxml
  79. 145 145
      miniprogram/pages/myQuestion/myQuestion.js
  80. 2 2
      miniprogram/pages/myQuestion/myQuestion.json
  81. 14 14
      miniprogram/pages/myQuestion/myQuestion.wxml
  82. 150 150
      miniprogram/pages/opinion/opinion.js
  83. 4 4
      miniprogram/pages/opinion/opinion.json
  84. 86 86
      miniprogram/pages/opinion/opinion.wxml
  85. 186 186
      miniprogram/pages/publisher/publisher.js
  86. 4 4
      miniprogram/pages/publisher/publisher.json
  87. 24 24
      miniprogram/pages/publisher/publisher.wxml
  88. 65 65
      miniprogram/pages/publisherInfoChange/publisherInfoChange.js
  89. 2 2
      miniprogram/pages/publisherInfoChange/publisherInfoChange.json
  90. 2 2
      miniprogram/pages/publisherInfoChange/publisherInfoChange.wxml
  91. 146 146
      miniprogram/pages/publisherLogin/publisherLogin.js
  92. 4 4
      miniprogram/pages/publisherLogin/publisherLogin.json
  93. 106 106
      miniprogram/pages/publisherLogin/publisherLogin.wxml
  94. 104 104
      miniprogram/pages/publisherPage/publisherPage.js
  95. 2 2
      miniprogram/pages/publisherPage/publisherPage.json
  96. 44 44
      miniprogram/pages/publisherPage/publisherPage.wxml
  97. 145 145
      miniprogram/pages/receivedQuestion/receivedQuestion.js
  98. 2 2
      miniprogram/pages/receivedQuestion/receivedQuestion.json
  99. 15 15
      miniprogram/pages/receivedQuestion/receivedQuestion.wxml
  100. 234 234
      miniprogram/pages/search/search.js

+ 12 - 12
README.md

@@ -1,12 +1,12 @@
-# 云开发 quickstart
-
-这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:
-
-- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
-- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
-- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码
-
-## 参考文档
-
-- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)
-
+# 云开发 quickstart
+
+这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:
+
+- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
+- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
+- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码
+
+## 参考文档
+
+- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)
+

+ 6 - 6
cloudfunctions/callback/config.json

@@ -1,7 +1,7 @@
-{
-  "permissions": {
-    "openapi": [
-      "customerServiceMessage.send"
-    ]
-  }
+{
+  "permissions": {
+    "openapi": [
+      "customerServiceMessage.send"
+    ]
+  }
 }

+ 25 - 25
cloudfunctions/callback/index.js

@@ -1,25 +1,25 @@
-const cloud = require('wx-server-sdk')
-
-cloud.init({
-  // API 调用都保持和云函数当前所在环境一致
-  env: cloud.DYNAMIC_CURRENT_ENV
-})
-
-// 云函数入口函数
-exports.main = async (event, context) => {
-  console.log(event)
-
-  const { OPENID } = cloud.getWXContext()
-
-  const result = await cloud.openapi.customerServiceMessage.send({
-    touser: OPENID,
-    msgtype: 'text',
-    text: {
-      content: `收到:${event.Content}`,
-    }
-  })
-
-  console.log(result)
-
-  return result
-}
+const cloud = require('wx-server-sdk')
+
+cloud.init({
+  // API 调用都保持和云函数当前所在环境一致
+  env: cloud.DYNAMIC_CURRENT_ENV
+})
+
+// 云函数入口函数
+exports.main = async (event, context) => {
+  console.log(event)
+
+  const { OPENID } = cloud.getWXContext()
+
+  const result = await cloud.openapi.customerServiceMessage.send({
+    touser: OPENID,
+    msgtype: 'text',
+    text: {
+      content: `收到:${event.Content}`,
+    }
+  })
+
+  console.log(result)
+
+  return result
+}

+ 13 - 13
cloudfunctions/callback/package.json

@@ -1,14 +1,14 @@
-{
-  "name": "callback",
-  "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.3.2"
-  }
+{
+  "name": "callback",
+  "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.3.2"
+  }
 }

+ 5 - 5
cloudfunctions/echo/config.json

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

+ 8 - 8
cloudfunctions/echo/index.js

@@ -1,8 +1,8 @@
-const cloud = require('wx-server-sdk')
-
-exports.main = async (event, context) => {
-  // event.userInfo 是已废弃的保留字段,在此不做展示
-  // 获取 OPENID 等微信上下文请使用 cloud.getWXContext()
-  delete event.userInfo
-  return event
-}
+const cloud = require('wx-server-sdk')
+
+exports.main = async (event, context) => {
+  // event.userInfo 是已废弃的保留字段,在此不做展示
+  // 获取 OPENID 等微信上下文请使用 cloud.getWXContext()
+  delete event.userInfo
+  return event
+}

+ 13 - 13
cloudfunctions/echo/package.json

@@ -1,14 +1,14 @@
-{
-  "name": "echo",
-  "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.3.2"
-  }
+{
+  "name": "echo",
+  "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.3.2"
+  }
 }

+ 5 - 5
cloudfunctions/getOpenId/config.json

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

+ 11 - 11
cloudfunctions/getOpenId/index.js

@@ -1,11 +1,11 @@
-const cloud = require('wx-server-sdk')
-
-cloud.init()
-
-exports.main = async (event, context) => {
-  const wxContext = cloud.getWXContext()
-
-  return {
-    openId: wxContext.OPENID
-  }
-}
+const cloud = require('wx-server-sdk')
+
+cloud.init()
+
+exports.main = async (event, context) => {
+  const wxContext = cloud.getWXContext()
+
+  return {
+    openId: wxContext.OPENID
+  }
+}

+ 14 - 14
cloudfunctions/getOpenId/package.json

@@ -1,14 +1,14 @@
-{
-  "name": "getMainData",
-  "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.3.2"
-  }
-}
+{
+  "name": "getMainData",
+  "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.3.2"
+  }
+}

+ 5 - 5
cloudfunctions/login/config.json

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

+ 36 - 36
cloudfunctions/login/index.js

@@ -1,36 +1,36 @@
-// 云函数模板
-// 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”
-
-const cloud = require('wx-server-sdk')
-
-// 初始化 cloud
-cloud.init({
-  // API 调用都保持和云函数当前所在环境一致
-  env: cloud.DYNAMIC_CURRENT_ENV
-})
-
-/**
- * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
- * 
- * event 参数包含小程序端调用传入的 data
- * 
- */
-exports.main = async (event, context) => {
-  console.log(event)
-  console.log(context)
-
-  // 可执行其他自定义逻辑
-  // console.log 的内容可以在云开发云函数调用日志查看
-
-  // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)等信息
-  const wxContext = cloud.getWXContext()
-
-  return {
-    event,
-    openid: wxContext.OPENID,
-    appid: wxContext.APPID,
-    unionid: wxContext.UNIONID,
-    env: wxContext.ENV,
-  }
-}
-
+// 云函数模板
+// 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”
+
+const cloud = require('wx-server-sdk')
+
+// 初始化 cloud
+cloud.init({
+  // API 调用都保持和云函数当前所在环境一致
+  env: cloud.DYNAMIC_CURRENT_ENV
+})
+
+/**
+ * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
+ * 
+ * event 参数包含小程序端调用传入的 data
+ * 
+ */
+exports.main = async (event, context) => {
+  console.log(event)
+  console.log(context)
+
+  // 可执行其他自定义逻辑
+  // console.log 的内容可以在云开发云函数调用日志查看
+
+  // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)等信息
+  const wxContext = cloud.getWXContext()
+
+  return {
+    event,
+    openid: wxContext.OPENID,
+    appid: wxContext.APPID,
+    unionid: wxContext.UNIONID,
+    env: wxContext.ENV,
+  }
+}
+

+ 14 - 14
cloudfunctions/login/package.json

@@ -1,14 +1,14 @@
-{
-  "name": "login",
-  "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.3.2"
-  }
-}
+{
+  "name": "login",
+  "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.3.2"
+  }
+}

+ 14 - 14
cloudfunctions/openapi/config.json

@@ -1,15 +1,15 @@
-{
-  "permissions": {
-    "openapi": [
-      "wxacode.get",
-      "subscribeMessage.send",
-      "subscribeMessage.addTemplate",
-      "templateMessage.send",
-      "templateMessage.addTemplate",
-      "templateMessage.deleteTemplate",
-      "templateMessage.getTemplateList",
-      "templateMessage.getTemplateLibraryById",
-      "templateMessage.getTemplateLibraryList"
-    ]
-  }
+{
+  "permissions": {
+    "openapi": [
+      "wxacode.get",
+      "subscribeMessage.send",
+      "subscribeMessage.addTemplate",
+      "templateMessage.send",
+      "templateMessage.addTemplate",
+      "templateMessage.deleteTemplate",
+      "templateMessage.getTemplateList",
+      "templateMessage.getTemplateLibraryById",
+      "templateMessage.getTemplateLibraryList"
+    ]
+  }
 }

+ 86 - 86
cloudfunctions/openapi/index.js

@@ -1,86 +1,86 @@
-// 云函数入口文件
-const cloud = require('wx-server-sdk')
-
-cloud.init()
-
-// 云函数入口函数
-exports.main = async (event, context) => {
-  console.log(event)
-  switch (event.action) {
-    case 'requestSubscribeMessage': {
-      return requestSubscribeMessage(event)
-    }
-    case 'sendSubscribeMessage': {
-      return sendSubscribeMessage(event)
-    }
-    case 'getWXACode': {
-      return getWXACode(event)
-    }
-    case 'getOpenData': {
-      return getOpenData(event)
-    }
-    default: {
-      return
-    }
-  }
-}
-
-async function requestSubscribeMessage(event) {
-  // 此处为模板 ID,开发者需要到小程序管理后台 - 订阅消息 - 公共模板库中添加模板,
-  // 然后在我的模板中找到对应模板的 ID,填入此处
-  return '请到管理后台申请模板 ID 然后在此替换' // 如 'N_J6F05_bjhqd6zh2h1LHJ9TAv9IpkCiAJEpSw0PrmQ'
-}
-
-async function sendSubscribeMessage(event) {
-  const { OPENID } = cloud.getWXContext()
-
-  const { templateId } = event
-
-  const sendResult = await cloud.openapi.subscribeMessage.send({
-    touser: OPENID,
-    templateId,
-    miniprogram_state: 'developer',
-    page: 'pages/openapi/openapi',
-    // 此处字段应修改为所申请模板所要求的字段
-    data: {
-      thing1: {
-        value: '咖啡',
-      },
-      time3: {
-        value: '2020-01-01 00:00',
-      },
-    }
-  })
-
-  return sendResult
-}
-
-async function getWXACode(event) {
-  // 此处将获取永久有效的小程序码,并将其保存在云文件存储中,最后返回云文件 ID 给前端使用
-
-  const wxacodeResult = await cloud.openapi.wxacode.get({
-    path: 'pages/openapi/openapi',
-  })
-
-  const fileExtensionMatches = wxacodeResult.contentType.match(/\/([^/]+)/)
-  const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
-
-  const uploadResult = await cloud.uploadFile({
-    // 云文件路径,此处为演示采用一个固定名称
-    cloudPath: `wxacode_default_openapi_page.${fileExtension}`,
-    // 要上传的文件内容可直接传入图片 Buffer
-    fileContent: wxacodeResult.buffer,
-  })
-
-  if (!uploadResult.fileID) {
-    throw new Error(`upload failed with empty fileID and storage server status code ${uploadResult.statusCode}`)
-  }
-
-  return uploadResult.fileID
-}
-
-async function getOpenData(event) {
-  return cloud.getOpenData({
-    list: event.openData.list,
-  })
-}
+// 云函数入口文件
+const cloud = require('wx-server-sdk')
+
+cloud.init()
+
+// 云函数入口函数
+exports.main = async (event, context) => {
+  console.log(event)
+  switch (event.action) {
+    case 'requestSubscribeMessage': {
+      return requestSubscribeMessage(event)
+    }
+    case 'sendSubscribeMessage': {
+      return sendSubscribeMessage(event)
+    }
+    case 'getWXACode': {
+      return getWXACode(event)
+    }
+    case 'getOpenData': {
+      return getOpenData(event)
+    }
+    default: {
+      return
+    }
+  }
+}
+
+async function requestSubscribeMessage(event) {
+  // 此处为模板 ID,开发者需要到小程序管理后台 - 订阅消息 - 公共模板库中添加模板,
+  // 然后在我的模板中找到对应模板的 ID,填入此处
+  return '请到管理后台申请模板 ID 然后在此替换' // 如 'N_J6F05_bjhqd6zh2h1LHJ9TAv9IpkCiAJEpSw0PrmQ'
+}
+
+async function sendSubscribeMessage(event) {
+  const { OPENID } = cloud.getWXContext()
+
+  const { templateId } = event
+
+  const sendResult = await cloud.openapi.subscribeMessage.send({
+    touser: OPENID,
+    templateId,
+    miniprogram_state: 'developer',
+    page: 'pages/openapi/openapi',
+    // 此处字段应修改为所申请模板所要求的字段
+    data: {
+      thing1: {
+        value: '咖啡',
+      },
+      time3: {
+        value: '2020-01-01 00:00',
+      },
+    }
+  })
+
+  return sendResult
+}
+
+async function getWXACode(event) {
+  // 此处将获取永久有效的小程序码,并将其保存在云文件存储中,最后返回云文件 ID 给前端使用
+
+  const wxacodeResult = await cloud.openapi.wxacode.get({
+    path: 'pages/openapi/openapi',
+  })
+
+  const fileExtensionMatches = wxacodeResult.contentType.match(/\/([^/]+)/)
+  const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
+
+  const uploadResult = await cloud.uploadFile({
+    // 云文件路径,此处为演示采用一个固定名称
+    cloudPath: `wxacode_default_openapi_page.${fileExtension}`,
+    // 要上传的文件内容可直接传入图片 Buffer
+    fileContent: wxacodeResult.buffer,
+  })
+
+  if (!uploadResult.fileID) {
+    throw new Error(`upload failed with empty fileID and storage server status code ${uploadResult.statusCode}`)
+  }
+
+  return uploadResult.fileID
+}
+
+async function getOpenData(event) {
+  return cloud.getOpenData({
+    list: event.openData.list,
+  })
+}

+ 14 - 14
cloudfunctions/openapi/package.json

@@ -1,14 +1,14 @@
-{
-  "name": "openapi",
-  "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.3.2"
-  }
-}
+{
+  "name": "openapi",
+  "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.3.2"
+  }
+}

+ 78 - 77
miniprogram/app.js

@@ -1,78 +1,79 @@
-//app.js
-App({
-  onLaunch: function () {
-    // 展示本地存储能力
-    var logs = wx.getStorageSync('logs') || []
-    logs.unshift(Date.now())
-    wx.setStorageSync('logs', logs)
-
-    // 登录
-    wx.login({
-      success: res => {
-        // 发送 res.code 到后台换取 openId, sessionKey, unionId
-      }
-    })
-    // 获取用户信息
-    wx.getSetting({
-      success: res => {
-        if (res.authSetting['scope.userInfo']) {
-          // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
-          wx.getUserInfo({
-            success: res => {
-              // 可以将 res 发送给后台解码出 unionId
-              this.globalData.userInfo = res.userInfo
-              const db = wx.cloud.database()
-              db.collection("userInfoData").get({
-                success: function (user) {
-                  if (user.data.length == 0) {
-                    db.collection("userInfoData").add({
-                      data: {
-                        publisherId: []
-                      },
-                      success: function () {
-                        this.globalData.publisherId = []
-                        if (this.userInfoReadyCallback) {
-                          this.userInfoReadyCallback(res)
-                        }
-                      }.bind(this)
-                    })
-                  } else {
-                    this.globalData.publisherId = user.data[0].publisherId
-                    if (this.userInfoReadyCallback) {
-                      this.userInfoReadyCallback(res)
-                    }
-                  }
-                }.bind(this)
-              })
-            }
-          })
-        }
-      }
-    })
-    if (!wx.cloud) {
-      console.error('请使用 2.2.3 或以上的基础库以使用云能力')
-    } else {
-      wx.cloud.init({
-        // env 参数说明:
-        //   env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
-        //   此处请填入环境 ID, 环境 ID 可打开云控制台查看
-        //   如不填则使用默认环境(第一个创建的环境)
-        env: "msg-push-9ga0xxc9c4aa5242",
-        traceUser: true,
-      })
-      wx.cloud.callFunction({
-        name: "getOpenId",
-        success: function (res) {
-          this.globalData.openId = res.result.openId
-        }.bind(this)
-      })
-    }
-  },
-  globalData: {
-    userInfo: null,
-    openId: null,
-    publisherId: null,
-    noticeIndex: null,
-    vibrate: null
-  }
+//app.js
+App({
+  onLaunch: function () {
+    // 展示本地存储能力
+    var logs = wx.getStorageSync('logs') || []
+    logs.unshift(Date.now())
+    wx.setStorageSync('logs', logs)
+
+    // 登录
+    wx.login({
+      success: res => {
+        // 发送 res.code 到后台换取 openId, sessionKey, unionId
+      }
+    })
+    // 获取用户信息
+    wx.getSetting({
+      success: res => {
+        if (res.authSetting['scope.userInfo']) {
+          // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
+          wx.getUserInfo({
+            success: res => {
+              // 可以将 res 发送给后台解码出 unionId
+              this.globalData.userInfo = res.userInfo
+              const db = wx.cloud.database()
+              db.collection("userInfoData").get({
+                success: function (user) {
+                  if (user.data.length == 0) {
+                    db.collection("userInfoData").add({
+                      data: {
+                        publisherId: []
+                      },
+                      success: function () {
+                        this.globalData.publisherId = []
+                        if (this.userInfoReadyCallback) {
+                          this.userInfoReadyCallback(res)
+                        }
+                      }.bind(this)
+                    })
+                  } else {
+                    this.globalData.publisherId = user.data[0].publisherId
+                    if (this.userInfoReadyCallback) {
+                      this.userInfoReadyCallback(res)
+                    }
+                  }
+                }.bind(this)
+              })
+            }
+          })
+        }
+      }
+    })
+
+    if (!wx.cloud) {
+      console.error('请使用 2.2.3 或以上的基础库以使用云能力')
+    } else {
+      wx.cloud.init({
+        // env 参数说明:
+        //   env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源
+        //   此处请填入环境 ID, 环境 ID 可打开云控制台查看
+        //   如不填则使用默认环境(第一个创建的环境)
+        env: "msg-push-9ga0xxc9c4aa5242",
+        traceUser: true,
+      })
+      wx.cloud.callFunction({
+        name: "getOpenId",
+        success: function (res) {
+          this.globalData.openId = res.result.openId
+        }.bind(this)
+      })
+    }
+  },
+  globalData: {
+    userInfo: null,
+    openId: null,
+    publisherId: null,
+    noticeIndex: null,
+    vibrate: null
+  }
 })

+ 63 - 63
miniprogram/app.json

@@ -1,64 +1,64 @@
-{
-  "pages": [
-    "pages/main/main",
-    "pages/setting/setting",
-    "pages/activity/activity",
-    "pages/myFollow/myFollow",
-    "pages/publisher/publisher",
-    "pages/publisherPage/publisherPage",
-    "pages/publisherLogin/publisherLogin",
-    "pages/activityPublish/activityPublish",
-    "pages/user/user",
-    "pages/message/message",
-    "pages/search/search",
-    "pages/myQuestion/myQuestion",
-    "pages/receivedQuestion/receivedQuestion",
-    "pages/publisherInfoChange/publisherInfoChange",
-    "pages/aboutUs/aboutUs",
-    "pages/opinion/opinion",
-    "pages/myPublish/myPublish",
-    "pages/administratorSetting/administratorSetting",
-    "pages/myColor/myColor",
-    "pages/myFavor/myFavor"
-  ],
-  "window": {
-    "backgroundTextStyle": "light",
-    "navigationBarBackgroundColor": "#303f9f",
-    "navigationBarTitleText": "汇听",
-    "navigationBarTextStyle": "white"
-  },
-  "style": "v2",
-  "sitemapLocation": "sitemap.json",
-  "tabBar": {
-    "selectedColor": "#303f9f",
-    "backgroundColor": "#F5F5F5",
-    "color": "#707070",
-    "borderStyle": "white",
-    "list": [
-      {
-        "pagePath": "pages/main/main",
-        "text": "首页",
-        "iconPath": "images/tabbar/1.1.png",
-        "selectedIconPath": "images/tabbar/1.2.png"
-      },
-      {
-        "pagePath": "pages/search/search",
-        "text": "搜索",
-        "iconPath": "images/tabbar/2.1.png",
-        "selectedIconPath": "images/tabbar/2.2.png"
-      },
-      {
-        "pagePath": "pages/message/message",
-        "text": "消息",
-        "iconPath": "images/tabbar/3.1.png",
-        "selectedIconPath": "images/tabbar/3.2.png"
-      },
-      {
-        "pagePath": "pages/user/user",
-        "text": "我的",
-        "iconPath": "images/tabbar/4.1.png",
-        "selectedIconPath": "images/tabbar/4.2.png"
-      }
-    ]
-  }
+{
+  "pages": [
+    "pages/main/main",
+    "pages/setting/setting",
+    "pages/activity/activity",
+    "pages/myFollow/myFollow",
+    "pages/publisher/publisher",
+    "pages/publisherPage/publisherPage",
+    "pages/publisherLogin/publisherLogin",
+    "pages/activityPublish/activityPublish",
+    "pages/user/user",
+    "pages/message/message",
+    "pages/search/search",
+    "pages/myQuestion/myQuestion",
+    "pages/receivedQuestion/receivedQuestion",
+    "pages/publisherInfoChange/publisherInfoChange",
+    "pages/aboutUs/aboutUs",
+    "pages/opinion/opinion",
+    "pages/myPublish/myPublish",
+    "pages/administratorSetting/administratorSetting",
+    "pages/myColor/myColor",
+    "pages/myFavor/myFavor"
+  ],
+  "window": {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#303f9f",
+    "navigationBarTitleText": "汇听",
+    "navigationBarTextStyle": "white"
+  },
+  "style": "v2",
+  "sitemapLocation": "sitemap.json",
+  "tabBar": {
+    "selectedColor": "#303f9f",
+    "backgroundColor": "#F5F5F5",
+    "color": "#707070",
+    "borderStyle": "white",
+    "list": [
+      {
+        "pagePath": "pages/main/main",
+        "text": "首页",
+        "iconPath": "images/tabbar/1.1.png",
+        "selectedIconPath": "images/tabbar/1.2.png"
+      },
+      {
+        "pagePath": "pages/search/search",
+        "text": "搜索",
+        "iconPath": "images/tabbar/2.1.png",
+        "selectedIconPath": "images/tabbar/2.2.png"
+      },
+      {
+        "pagePath": "pages/message/message",
+        "text": "消息",
+        "iconPath": "images/tabbar/3.1.png",
+        "selectedIconPath": "images/tabbar/3.2.png"
+      },
+      {
+        "pagePath": "pages/user/user",
+        "text": "我的",
+        "iconPath": "images/tabbar/4.1.png",
+        "selectedIconPath": "images/tabbar/4.2.png"
+      }
+    ]
+  }
 }

+ 23 - 23
miniprogram/app.wxss

@@ -1,23 +1,23 @@
-/**app.wxss**/
-.container {
-  height: 100%;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: space-between;
-  padding: 200rpx 0;
-  box-sizing: border-box;
-} 
-
-.dark-primary-color    { background: #303F9F; }
-.default-primary-color { background: #3F51B5; }
-.dark-primary-color-font { color: #303F9F; }
-.default-primary-color-font { color: #3F51B5; }
-.light-primary-color   { background: #C5CAE9; }
-.text-primary-color    { color: #FFFFFF; }
-.accent-color          { background: #FF4081; }
-.primary-text-color    { color: #212121; }
-.secondary-text-color  { color: #DADADA; }
-.divider-color         { background: #BDBDBD; }
-.block-background-color{ background:#F0F0F0;}
-
+/**app.wxss**/
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+} 
+
+.dark-primary-color    { background: #303F9F; }
+.default-primary-color { background: #3F51B5; }
+.dark-primary-color-font { color: #303F9F; }
+.default-primary-color-font { color: #3F51B5; }
+.light-primary-color   { background: #C5CAE9; }
+.text-primary-color    { color: #FFFFFF; }
+.accent-color          { background: #FF4081; }
+.primary-text-color    { color: #212121; }
+.secondary-text-color  { color: #DADADA; }
+.divider-color         { background: #BDBDBD; }
+.block-background-color{ background:#F0F0F0;}
+

+ 48 - 48
miniprogram/components/followNews/followNews.js

@@ -1,49 +1,49 @@
-Component({
-  data: {
-    newMessage: []
-  },
-
-  lifetimes: {
-    ready: function() {
-      this.init()
-    }
-  },
-
-  pageLifetimes: {
-    show: function () {
-      this.init()
-    }
-  },
-
-  methods: {
-    init: function () {
-      wx.showNavigationBarLoading()
-      const db = wx.cloud.database()
-      const _ = db.command
-      db.collection("likeData").where({
-        type: "publisher"
-      }).get({
-        success: function (res) {
-          if (res.data.length == 0) {
-            wx.hideNavigationBarLoading()
-            return
-          }
-          var con = _.eq(res.data[0].id)
-          for (let j = 1; j < res.data.length; j++) {
-            con = con.or(_.eq(res.data[j].id))
-          }
-          db.collection("mainData").orderBy("time", "desc").limit(20).where({
-            publisherId: con
-          }).get({
-            success: function (res) {
-              this.setData({
-                newMessage: res.data
-              })
-              wx.hideNavigationBarLoading()
-            }.bind(this)
-          })
-        }.bind(this)
-      })
-    }
-  }
+Component({
+  data: {
+    newMessage: []
+  },
+
+  lifetimes: {
+    ready: function() {
+      this.init()
+    }
+  },
+
+  pageLifetimes: {
+    show: function () {
+      this.init()
+    }
+  },
+
+  methods: {
+    init: function () {
+      wx.showNavigationBarLoading()
+      const db = wx.cloud.database()
+      const _ = db.command
+      db.collection("likeData").where({
+        type: "publisher"
+      }).get({
+        success: function (res) {
+          if (res.data.length == 0) {
+            wx.hideNavigationBarLoading()
+            return
+          }
+          var con = _.eq(res.data[0].id)
+          for (let j = 1; j < res.data.length; j++) {
+            con = con.or(_.eq(res.data[j].id))
+          }
+          db.collection("mainData").orderBy("time", "desc").limit(20).where({
+            publisherId: con
+          }).get({
+            success: function (res) {
+              this.setData({
+                newMessage: res.data
+              })
+              wx.hideNavigationBarLoading()
+            }.bind(this)
+          })
+        }.bind(this)
+      })
+    }
+  }
 })

+ 5 - 5
miniprogram/components/followNews/followNews.json

@@ -1,6 +1,6 @@
-{
-  "component": true,
-  "usingComponents": {
-    "itemfollowNews":"../itemfollowNews/itemfollowNews"
-  }
+{
+  "component": true,
+  "usingComponents": {
+    "itemfollowNews":"../itemfollowNews/itemfollowNews"
+  }
 }

+ 6 - 6
miniprogram/components/followNews/followNews.wxml

@@ -1,6 +1,6 @@
-<!-- 含component:itemfollowNews; 含data:newMessageData.js-->
-<view class="page">
-  <view class="card" wx:for="{{newMessage}}" wx:for-item="item" wx:key="id" wx:index="index">
-    <itemfollowNews item="{{item}}"/>
-  </view>
-</view>
+<!-- 含component:itemfollowNews; 含data:newMessageData.js-->
+<view class="page">
+  <view class="card" wx:for="{{newMessage}}" wx:for-item="item" wx:key="id" wx:index="index">
+    <itemfollowNews item="{{item}}"/>
+  </view>
+</view>

+ 74 - 74
miniprogram/components/imagePicker/imagePicker.js

@@ -1,74 +1,74 @@
-// components/imagePicker/imagePicker.js
-Component({
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    images: Array,
-    max: Number,
-    imageWidth: Number,
-    imageHeight: Number,
-    readonly: Boolean
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    chooseImage: function(num, callback) {
-      wx.chooseImage({
-        count: num,
-        sizeType: ['original'],
-        sourceType: ['album'],
-        success: function (res) {
-          callback(res.tempFilePaths)
-        }.bind(this)
-      })
-    },
-  
-    previewImage: function (e) {
-      wx.previewImage({
-        urls: this.data.images,
-        current: e.currentTarget.dataset.url
-      })
-    },
-  
-    removeImage: function (e) {
-      for (var i = 0; i < this.properties.images.length; i++) {
-        if (this.properties.images[i] == e.currentTarget.dataset.url) {
-          var arr = this.properties.images
-          arr.splice(i, 1)
-          this.setData({
-            images: arr
-          })
-          this.triggerEvent("change", {
-            images: this.properties.images
-          })
-          break
-        }
-      }
-    },
-  
-    addImage: function () {
-      if (this.properties.images.length >= this.properties.max) {
-        return
-      }
-      this.chooseImage(this.properties.max - this.properties.images.length, (img) => {
-        var arr = this.properties.images.concat(img)
-        this.setData({
-          images: arr
-        })
-        this.triggerEvent("change", {
-          images: this.properties.images
-        })
-      })
-    },
-  }
-})
+// components/imagePicker/imagePicker.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    images: Array,
+    max: Number,
+    imageWidth: Number,
+    imageHeight: Number,
+    readonly: Boolean
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    chooseImage: function(num, callback) {
+      wx.chooseImage({
+        count: num,
+        sizeType: ['original'],
+        sourceType: ['album'],
+        success: function (res) {
+          callback(res.tempFilePaths)
+        }.bind(this)
+      })
+    },
+  
+    previewImage: function (e) {
+      wx.previewImage({
+        urls: this.data.images,
+        current: e.currentTarget.dataset.url
+      })
+    },
+  
+    removeImage: function (e) {
+      for (var i = 0; i < this.properties.images.length; i++) {
+        if (this.properties.images[i] == e.currentTarget.dataset.url) {
+          var arr = this.properties.images
+          arr.splice(i, 1)
+          this.setData({
+            images: arr
+          })
+          this.triggerEvent("change", {
+            images: this.properties.images
+          })
+          break
+        }
+      }
+    },
+  
+    addImage: function () {
+      if (this.properties.images.length >= this.properties.max) {
+        return
+      }
+      this.chooseImage(this.properties.max - this.properties.images.length, (img) => {
+        var arr = this.properties.images.concat(img)
+        this.setData({
+          images: arr
+        })
+        this.triggerEvent("change", {
+          images: this.properties.images
+        })
+      })
+    },
+  }
+})

+ 3 - 3
miniprogram/components/imagePicker/imagePicker.json

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

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

@@ -1,9 +1,9 @@
-<!--components/imagePicker/imagePicker.wxml-->
-<view style="text-align: center;">
-  <label wx:for="{{images}}" wx:for-item="item" wx:key="*this">
-    <image class="image" style="position: relative; width: {{imageWidth}}rpx; height: {{imageHeight}}rpx;" src="{{item}}" mode="aspectFill" data-url="{{item}}" catchtap="previewImage">
-      <icon wx:if="{{!readonly}}" style="position: absolute; top: 0; left: 0;" type="cancel" size="20" data-url="{{item}}" catchtap="removeImage"></icon>
-    </image>
-  </label>
-  <image wx:if="{{images.length < max && !readonly}}" class="image" style="width: 150rpx; height: 150rpx;" src="/images/add.png" mode="aspectFill" catchtap="addImage"></image>
-</view>
+<!--components/imagePicker/imagePicker.wxml-->
+<view style="text-align: center;">
+  <label wx:for="{{images}}" wx:for-item="item" wx:key="*this">
+    <image class="image" style="position: relative; width: {{imageWidth}}rpx; height: {{imageHeight}}rpx;" src="{{item}}" mode="aspectFill" data-url="{{item}}" catchtap="previewImage">
+      <icon wx:if="{{!readonly}}" style="position: absolute; top: 0; left: 0;" type="cancel" size="20" data-url="{{item}}" catchtap="removeImage"></icon>
+    </image>
+  </label>
+  <image wx:if="{{images.length < max && !readonly}}" class="image" style="width: 150rpx; height: 150rpx;" src="/images/add.png" mode="aspectFill" catchtap="addImage"></image>
+</view>

+ 27 - 27
miniprogram/components/itemActivityComment/itemActivityComment.js

@@ -1,27 +1,27 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    comment: Object,
-    time: String
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-
-  }
-})
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    comment: Object,
+    time: String
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 3 - 3
miniprogram/components/itemActivityComment/itemActivityComment.json

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

+ 4 - 4
miniprogram/components/itemActivityComment/itemActivityComment.wxml

@@ -1,4 +1,4 @@
-<view class="text default-primary-color-font">{{time}}</view>
-<view class="text">Q: {{comment.question}}</view>
-<view class="text">A: {{comment.answer}}</view>
-<view class="line divider-color"></view>
+<view class="text default-primary-color-font">{{time}}</view>
+<view class="text">Q: {{comment.question}}</view>
+<view class="text">A: {{comment.answer}}</view>
+<view class="line divider-color"></view>

+ 43 - 43
miniprogram/components/itemCard/itemCard.js

@@ -1,43 +1,43 @@
-// components/itemCard.js
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    item: Object
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    getPublisherInfo: function () {
-      wx.navigateTo({
-        url: "/pages/publisher/publisher?id=" + this.properties.item.publisherId
-      })
-    },
-
-    getActivityInfo: function () {
-      wx.navigateTo({
-        url: "/pages/activity/activity?id=" + this.properties.item._id
-      })
-    },
-
-    filterMsgType: function (e) {
-      this.triggerEvent("filtermsgtype", {
-        attr: this.properties.item.attribute[0]
-      })
-    }
-  }
-})
+// components/itemCard.js
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    item: Object
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    getPublisherInfo: function () {
+      wx.navigateTo({
+        url: "/pages/publisher/publisher?id=" + this.properties.item.publisherId
+      })
+    },
+
+    getActivityInfo: function () {
+      wx.navigateTo({
+        url: "/pages/activity/activity?id=" + this.properties.item._id
+      })
+    },
+
+    filterMsgType: function (e) {
+      this.triggerEvent("filtermsgtype", {
+        attr: this.properties.item.attribute[0]
+      })
+    }
+  }
+})

+ 5 - 5
miniprogram/components/itemCard/itemCard.json

@@ -1,6 +1,6 @@
-{
-  "component": true,
-  "usingComponents": {
-    "imagePicker": "/components/imagePicker/imagePicker"
-  }
+{
+  "component": true,
+  "usingComponents": {
+    "imagePicker": "/components/imagePicker/imagePicker"
+  }
 }

+ 33 - 33
miniprogram/components/itemPublisher/itemPublisher.js

@@ -1,33 +1,33 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  /**
-   * 组件的属性列表
-   */
-  properties: {
-    item:{
-      type:Object,
-      value:{}
-    }
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 组件的方法列表
-   */
-  methods: {
-    getActivityInfo: function () {
-      wx.navigateTo({
-        url: "/pages/activity/activity?id=" + this.properties.item._id
-      })
-    }
-  }
-})
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    item:{
+      type:Object,
+      value:{}
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    getActivityInfo: function () {
+      wx.navigateTo({
+        url: "/pages/activity/activity?id=" + this.properties.item._id
+      })
+    }
+  }
+})

+ 5 - 5
miniprogram/components/itemPublisher/itemPublisher.json

@@ -1,6 +1,6 @@
-{
-  "component": true,
-  "usingComponents": {
-    "imagePicker": "/components/imagePicker/imagePicker"
-  }
+{
+  "component": true,
+  "usingComponents": {
+    "imagePicker": "/components/imagePicker/imagePicker"
+  }
 }

+ 16 - 16
miniprogram/components/itemPublisher/itemPublisher.wxml

@@ -1,16 +1,16 @@
-<!-- 为发布者详情界面中的活动卡片,数据在mainData.js 注:mainData.js在主界面和此界面都被引用 -->
-<view class="card" bindtap="getActivityInfo">
-  <view class="profile">
-    <view style="display: flex;">
-      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill"></image>
-      <view class="publisher-name dark-primary-color-font">{{item.publisherName}}</view>
-      <view class="time">{{item.time}}</view>
-    </view>
-    <view class="activity-attribute accent-color text-primary-color" catchtap="filterMsgType">{{item.attribute[0]}}</view>
-  </view>
-  <view class="title">{{item.title}}</view>
-  <view class="sub-title">{{item.subTitle}}</view>
-  <imagePicker wx:if="{{item.poster != ''}}" images="{{[item.poster]}}" max="1" image-width="700" image-height="365" readonly />
-  <imagePicker wx:if="{{item.poster == '' && item.photo.length != 0}}" images="{{item.photo}}" max="1" image-width="{{item.photo.length == 1 ? 700 : item.photo.length <= 4 ? 330 : 220}}" image-height="{{item.photo.length == 1 ? 700 : item.photo.length <= 4 ? 330 : 220}}" readonly />
-  <view class="line divider-color"></view>
-</view>
+<!-- 为发布者详情界面中的活动卡片,数据在mainData.js 注:mainData.js在主界面和此界面都被引用 -->
+<view class="card" bindtap="getActivityInfo">
+  <view class="profile">
+    <view style="display: flex;">
+      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill"></image>
+      <view class="publisher-name dark-primary-color-font">{{item.publisherName}}</view>
+      <view class="time">{{item.time}}</view>
+    </view>
+    <view class="activity-attribute accent-color text-primary-color" catchtap="filterMsgType">{{item.attribute[0]}}</view>
+  </view>
+  <view class="title">{{item.title}}</view>
+  <view class="sub-title">{{item.subTitle}}</view>
+  <imagePicker wx:if="{{item.poster != ''}}" images="{{[item.poster]}}" max="1" image-width="700" image-height="365" readonly />
+  <imagePicker wx:if="{{item.poster == '' && item.photo.length != 0}}" images="{{item.photo}}" max="1" image-width="{{item.photo.length == 1 ? 700 : item.photo.length <= 4 ? 330 : 220}}" image-height="{{item.photo.length == 1 ? 700 : item.photo.length <= 4 ? 330 : 220}}" readonly />
+  <view class="line divider-color"></view>
+</view>

+ 22 - 22
miniprogram/components/itemfollowNews/itemfollowNews.js

@@ -1,23 +1,23 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  properties: {
-    item: Object
-  },
-
-  methods: {
-    getActivityInfo: function () {
-      wx.navigateTo({
-        url: "/pages/activity/activity?id=" + this.properties.item._id
-      })
-    },
-
-    getPublisherInfo: function () {
-      wx.navigateTo({
-        url: "/pages/publisher/publisher?id=" + this.properties.item.publisherId
-      })
-    }
-  }
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  properties: {
+    item: Object
+  },
+
+  methods: {
+    getActivityInfo: function () {
+      wx.navigateTo({
+        url: "/pages/activity/activity?id=" + this.properties.item._id
+      })
+    },
+
+    getPublisherInfo: function () {
+      wx.navigateTo({
+        url: "/pages/publisher/publisher?id=" + this.properties.item.publisherId
+      })
+    }
+  }
 })

+ 3 - 3
miniprogram/components/itemfollowNews/itemfollowNews.json

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

+ 12 - 12
miniprogram/components/itemfollowNews/itemfollowNews.wxml

@@ -1,12 +1,12 @@
-<!-- 为消息-关注动态里消息的组件,数据来自data: newMessageData.js-->
-<view class="card" catchtap="getActivityInfo">
-  <view class="profile">
-    <view class="publisher-name dark-primary-color-font" catchtap="getPublisherInfo">
-      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" />
-      <text>你关注的</text><text style="font-weight:800">{{item.publisherName}}</text><text>发布了新消息</text>
-    </view>
-  </view>
-  <view class="title">{{item.title}}</view>
-  <view class="sub-title">{{item.subTitle}}</view>
-  <view class="line divider-color"></view>
-</view>
+<!-- 为消息-关注动态里消息的组件,数据来自data: newMessageData.js-->
+<view class="card" catchtap="getActivityInfo">
+  <view class="profile">
+    <view class="publisher-name dark-primary-color-font" catchtap="getPublisherInfo">
+      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" />
+      <text>你关注的</text><text style="font-weight:800">{{item.publisherName}}</text><text>发布了新消息</text>
+    </view>
+  </view>
+  <view class="title">{{item.title}}</view>
+  <view class="sub-title">{{item.subTitle}}</view>
+  <view class="line divider-color"></view>
+</view>

+ 73 - 73
miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.js

@@ -1,74 +1,74 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  properties: {
-    item: Object
-  },
-
-  data: {
-    like: 1,
-    likeEnable: true
-  },
-
-  methods: {
-    getActivityInfo: function () {
-      wx.navigateTo({
-        url: "/pages/activity/activity?id=" + this.properties.item.id
-      })
-    },
-
-    toggleLike: function () {
-      if (!this.data.likeEnable) return
-      this.setData({
-        likeEnable: false
-      })
-      const db = wx.cloud.database()
-      if (this.data.like == 0) {
-        db.collection("likeData").add({
-          data: {
-            type: "message",
-            id: this.properties.item.id
-          },
-          success: function() {
-            this.setData({
-              like: 1,
-              likeEnable: true
-            })
-            wx.showToast({
-              title: "已收藏",
-            })
-          }.bind(this),
-          fail: function() {
-            wx.showToast({
-              title: "网络错误",
-              icon: "none"
-            })
-          }
-        })
-      } else {
-        db.collection("likeData").where({
-          type: "message",
-          id: this.properties.item.id
-        }).remove({
-          success: function() {
-            this.setData({
-              like: 0,
-              likeEnable: true
-            })
-            wx.showToast({
-              title: "已取消收藏",
-            })
-          }.bind(this),
-          fail: function() {
-            wx.showToast({
-              title: "网络错误",
-              icon: "none"
-            })
-          }
-        })
-      }
-    }
-  }
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  properties: {
+    item: Object
+  },
+
+  data: {
+    like: 1,
+    likeEnable: true
+  },
+
+  methods: {
+    getActivityInfo: function () {
+      wx.navigateTo({
+        url: "/pages/activity/activity?id=" + this.properties.item.id
+      })
+    },
+
+    toggleLike: function () {
+      if (!this.data.likeEnable) return
+      this.setData({
+        likeEnable: false
+      })
+      const db = wx.cloud.database()
+      if (this.data.like == 0) {
+        db.collection("likeData").add({
+          data: {
+            type: "message",
+            id: this.properties.item.id
+          },
+          success: function() {
+            this.setData({
+              like: 1,
+              likeEnable: true
+            })
+            wx.showToast({
+              title: "已收藏",
+            })
+          }.bind(this),
+          fail: function() {
+            wx.showToast({
+              title: "网络错误",
+              icon: "none"
+            })
+          }
+        })
+      } else {
+        db.collection("likeData").where({
+          type: "message",
+          id: this.properties.item.id
+        }).remove({
+          success: function() {
+            this.setData({
+              like: 0,
+              likeEnable: true
+            })
+            wx.showToast({
+              title: "已取消收藏",
+            })
+          }.bind(this),
+          fail: function() {
+            wx.showToast({
+              title: "网络错误",
+              icon: "none"
+            })
+          }
+        })
+      }
+    }
+  }
 })

+ 3 - 3
miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.json

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

+ 13 - 13
miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.wxml

@@ -1,13 +1,13 @@
-<!-- 为消息-关注动态里消息的组件,数据来自data: newMessageData.js-->
-<view class="card" catchtap="getActivityInfo">
-  <view class="profile">
-    <view class="publisher-name dark-primary-color-font">
-      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" />
-      <text style="font-weight:900">{{item.publisherName}}</text>
-    </view>
-    <image class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike" />
-  </view>
-  <view class="title">{{item.title}}</view>
-  <view class="sub-title">{{item.subTitle}}</view>
-  <view class="line divider-color"></view>
-</view>
+<!-- 为消息-关注动态里消息的组件,数据来自data: newMessageData.js-->
+<view class="card" catchtap="getActivityInfo">
+  <view class="profile">
+    <view class="publisher-name dark-primary-color-font">
+      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" />
+      <text style="font-weight:900">{{item.publisherName}}</text>
+    </view>
+    <image class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike" />
+  </view>
+  <view class="title">{{item.title}}</view>
+  <view class="sub-title">{{item.subTitle}}</view>
+  <view class="line divider-color"></view>
+</view>

+ 74 - 74
miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.js

@@ -1,75 +1,75 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  properties: {
-    item: Object
-  },
-
-  data: {
-    like: 1,
-    likeEnable: true
-  },
-
-  methods: {
-    getPublisherInfo: function () {
-      wx.navigateTo({
-        url: "/pages/publisher/publisher?id=" + this.properties.item.id
-      })
-    },
-    
-   
-    toggleLike: function () {
-      if (!this.data.likeEnable) return
-      this.setData({
-        likeEnable: false
-      })
-      const db = wx.cloud.database()
-      if (this.data.like == 0) {
-        db.collection("likeData").add({
-          data: {
-            type: "publisher",
-            id: this.properties.item.id
-          },
-          success: function() {
-            this.setData({
-              like: 1,
-              likeEnable: true
-            })
-            wx.showToast({
-              title: "已收藏",
-            })
-          }.bind(this),
-          fail: function() {
-            wx.showToast({
-              title: "网络错误",
-              icon: "none"
-            })
-          }
-        })
-      } else {
-        db.collection("likeData").where({
-          type: "publisher",
-          id: this.properties.item.id
-        }).remove({
-          success: function() {
-            this.setData({
-              like: 0,
-              likeEnable: true
-            })
-            wx.showToast({
-              title: "已取消收藏",
-            })
-          }.bind(this),
-          fail: function() {
-            wx.showToast({
-              title: "网络错误",
-              icon: "none"
-            })
-          }
-        })
-      }
-    }
-  }
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  properties: {
+    item: Object
+  },
+
+  data: {
+    like: 1,
+    likeEnable: true
+  },
+
+  methods: {
+    getPublisherInfo: function () {
+      wx.navigateTo({
+        url: "/pages/publisher/publisher?id=" + this.properties.item.id
+      })
+    },
+    
+   
+    toggleLike: function () {
+      if (!this.data.likeEnable) return
+      this.setData({
+        likeEnable: false
+      })
+      const db = wx.cloud.database()
+      if (this.data.like == 0) {
+        db.collection("likeData").add({
+          data: {
+            type: "publisher",
+            id: this.properties.item.id
+          },
+          success: function() {
+            this.setData({
+              like: 1,
+              likeEnable: true
+            })
+            wx.showToast({
+              title: "已收藏",
+            })
+          }.bind(this),
+          fail: function() {
+            wx.showToast({
+              title: "网络错误",
+              icon: "none"
+            })
+          }
+        })
+      } else {
+        db.collection("likeData").where({
+          type: "publisher",
+          id: this.properties.item.id
+        }).remove({
+          success: function() {
+            this.setData({
+              like: 0,
+              likeEnable: true
+            })
+            wx.showToast({
+              title: "已取消收藏",
+            })
+          }.bind(this),
+          fail: function() {
+            wx.showToast({
+              title: "网络错误",
+              icon: "none"
+            })
+          }
+        })
+      }
+    }
+  }
 })

+ 3 - 3
miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.json

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

+ 11 - 11
miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.wxml

@@ -1,11 +1,11 @@
-<!-- 为消息-我的消息里通知的组件,组件中数据来自data:newNewsData.js -->
-<view class="card" catchtap="getPublisherInfo">
-  <view class="profile">
-    <view class="publisher-name dark-primary-color-font">
-      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" />
-      <text style="font-weight:900">{{item.publisherName}}</text>
-    </view>
-    <image class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike" />
-  </view>
-  <view class="line divider-color"></view>
-</view>
+<!-- 为消息-我的消息里通知的组件,组件中数据来自data:newNewsData.js -->
+<view class="card" catchtap="getPublisherInfo">
+  <view class="profile">
+    <view class="publisher-name dark-primary-color-font">
+      <image class="publisher-avatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" />
+      <text style="font-weight:900">{{item.publisherName}}</text>
+    </view>
+    <image class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike" />
+  </view>
+  <view class="line divider-color"></view>
+</view>

+ 19 - 19
miniprogram/components/itemmyNews/itemmyNews.js

@@ -1,20 +1,20 @@
-Component({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  properties: {
-    item:{
-      type:Object,
-      value:{}
-    }
-  },
-
-  methods: {
-    getPublisherInfo: function(e) {
-      wx.navigateTo({
-        url: "/pages/publisher/publisher?id=" + e.target.dataset.publisherId
-      })
-    }
-  }
+Component({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  properties: {
+    item:{
+      type:Object,
+      value:{}
+    }
+  },
+
+  methods: {
+    getPublisherInfo: function(e) {
+      wx.navigateTo({
+        url: "/pages/publisher/publisher?id=" + e.target.dataset.publisherId
+      })
+    }
+  }
 })

+ 3 - 3
miniprogram/components/itemmyNews/itemmyNews.json

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

+ 12 - 12
miniprogram/components/itemmyNews/itemmyNews.wxml

@@ -1,12 +1,12 @@
-<!-- 为消息-我的消息里通知的组件,组件中数据来自data:newNewsData.js -->
-<view class="card">
-  <view class="profile">
-    <image class="publisherAvatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" bindtap="getPublisherInfo"/>
-    <view class="publisherName dark-primary-color-font" wx:if="{{item.publishType=='回复'}}">
-      <text style="font-weight:800">{{item.publisherName}}</text><text>对您的问题进行了回复</text>
-    </view>
-  </view>
-  <view class="title">{{item.title}}</view>
-  <view class="subTitle">{{item.subTitle}}</view>
-  <view class="line divider-color"></view>
-</view>
+<!-- 为消息-我的消息里通知的组件,组件中数据来自data:newNewsData.js -->
+<view class="card">
+  <view class="profile">
+    <image class="publisherAvatar" src="{{item.publisherAvatar}}" mode="aspectFill" data-publisher-id="{{item.publisherID}}" bindtap="getPublisherInfo"/>
+    <view class="publisherName dark-primary-color-font" wx:if="{{item.publishType=='回复'}}">
+      <text style="font-weight:800">{{item.publisherName}}</text><text>对您的问题进行了回复</text>
+    </view>
+  </view>
+  <view class="title">{{item.title}}</view>
+  <view class="subTitle">{{item.subTitle}}</view>
+  <view class="line divider-color"></view>
+</view>

+ 65 - 65
miniprogram/pages/aboutUs/aboutUs.js

@@ -1,66 +1,66 @@
-// pages/aboutUs/aboutUs.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// pages/aboutUs/aboutUs.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/aboutUs/aboutUs.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 2 - 2
miniprogram/pages/aboutUs/aboutUs.wxml

@@ -1,2 +1,2 @@
-<!--为我的-关于我们页面-->
-<text>pages/aboutUs/aboutUs.wxml</text>
+<!--为我的-关于我们页面-->
+<text>pages/aboutUs/aboutUs.wxml</text>

+ 243 - 243
miniprogram/pages/activity/activity.js

@@ -1,244 +1,244 @@
-const app = getApp()
-
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    activityInfo: {},
-    activityComment: [],
-    like: -1,
-    likeEnable: true,
-    commentText: ""
-  },
-
-  getPublisherInfo: function () {
-    wx.navigateTo({
-      url: "/pages/publisher/publisher?id=" + this.data.activityInfo.publisherId
-    })
-  },
-
-  toggleLike: function () {
-    if (!this.data.likeEnable) return
-    this.setData({
-      likeEnable: false
-    })
-    const db = wx.cloud.database()
-    if (this.data.like == 0) {
-      db.collection("likeData").add({
-        data: {
-          type: "message",
-          id: this.data.activityInfo._id
-        },
-        success: function() {
-          this.setData({
-            like: 1,
-            likeEnable: true
-          })
-          wx.showToast({
-            title: "已收藏",
-          })
-        }.bind(this),
-        fail: function() {
-          wx.showToast({
-            title: "网络错误",
-            icon: "none"
-          })
-        }
-      })
-    } else {
-      db.collection("likeData").where({
-        type: "message",
-        id: this.data.activityInfo._id
-      }).remove({
-        success: function() {
-          this.setData({
-            like: 0,
-            likeEnable: true
-          })
-          wx.showToast({
-            title: "已取消收藏",
-          })
-        }.bind(this),
-        fail: function() {
-          wx.showToast({
-            title: "网络错误",
-            icon: "none"
-          })
-        }
-      })
-    }
-  },
-
-  comment: function () {
-    if (this.data.commentText.length < 5) {
-      wx.showToast({
-        title: "提问字数至少为5",
-        icon: "none"
-      })
-    } else {
-      const db = wx.cloud.database()
-      db.collection("qaData").where({
-        _openid: app.globalData.openId,
-        activityId: this.data.activityInfo._id
-      }).get({
-        success: function (res) {
-          console.log(res)
-          if (res.data.length >= 10) {
-           wx.showToast({
-             title: "为防止刷屏,每人每消息至多提问10条",
-             icon: "none"
-           })
-          } else {
-            db.collection("qaData").add({
-              data: {
-                activityId: this.data.activityInfo._id,
-                publisherId: this.data.activityInfo.publisherId,
-                answer: "",
-                answerTime: "",
-                question: this.data.commentText,
-                questionTime: new Date(),
-                rank: ""
-              },
-              success: function () {
-                this.setData({
-                  commentText: ""
-                })
-                wx.showToast({
-                  title: "提问成功"
-                })
-              }.bind(this)
-            })
-          }
-        }.bind(this)
-      })
-    }
-  },
-
-  // 计算时间差
-  handleDate: function(date) {
-    var now = new Date().getTime()
-    var diffValue = now - date.getTime()
-    if (diffValue < 0) {
-      console.log("时间不同步")
-      return "刚刚"
-    }
-    var result = ""
-    var minute = 1000 * 60
-    var hour = minute * 60
-    var day = hour * 24
-    var minC = diffValue / minute
-    var hourC = diffValue / hour
-    var dayC = diffValue / day
-    if (parseInt(dayC) > 30) {
-      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
-    } else if (parseInt(dayC) > 1) {
-      result += parseInt(dayC) + "天前"
-    } else if (parseInt(dayC) == 1) {
-      result += "昨天"
-    } else if (hourC >= 1) {
-      result += parseInt(hourC) + "小时前"
-    } else if (minC >= 5) {
-      result += parseInt(minC) + "分钟前"
-    } else {
-      result += "刚刚"
-    }
-    return result
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    wx.showLoading({
-      title: "加载中",
-    })
-    const db = wx.cloud.database()
-    const _ = db.command
-    db.collection("mainData").doc(options.id).get({
-      success: function(res) {
-        this.setData({
-          activityInfo: res.data
-        })
-        wx.hideLoading()
-      }.bind(this)
-    })
-    db.collection("qaData").where({
-      activityId: options.id,
-      answer: _.neq("")
-    }).get({
-      success: function(res) {
-        for (let i = 0; i < res.data.length; i++) {
-          if (res.data[i].answerTime != "") {
-            res.data[i].time = this.handleDate(res.data[i].answerTime)
-          } else {
-            res.data[i].time = ""
-          }
-        }
-        this.setData({
-          activityComment: res.data
-        })
-      }.bind(this)
-    })
-    db.collection("likeData").where({
-      type: "message",
-      id: options.id
-    }).get({
-      success: function(res) {
-        this.setData({
-          like: res.data.length
-        })
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+const app = getApp()
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    activityInfo: {},
+    activityComment: [],
+    like: -1,
+    likeEnable: true,
+    commentText: ""
+  },
+
+  getPublisherInfo: function () {
+    wx.navigateTo({
+      url: "/pages/publisher/publisher?id=" + this.data.activityInfo.publisherId
+    })
+  },
+
+  toggleLike: function () {
+    if (!this.data.likeEnable) return
+    this.setData({
+      likeEnable: false
+    })
+    const db = wx.cloud.database()
+    if (this.data.like == 0) {
+      db.collection("likeData").add({
+        data: {
+          type: "message",
+          id: this.data.activityInfo._id
+        },
+        success: function() {
+          this.setData({
+            like: 1,
+            likeEnable: true
+          })
+          wx.showToast({
+            title: "已收藏",
+          })
+        }.bind(this),
+        fail: function() {
+          wx.showToast({
+            title: "网络错误",
+            icon: "none"
+          })
+        }
+      })
+    } else {
+      db.collection("likeData").where({
+        type: "message",
+        id: this.data.activityInfo._id
+      }).remove({
+        success: function() {
+          this.setData({
+            like: 0,
+            likeEnable: true
+          })
+          wx.showToast({
+            title: "已取消收藏",
+          })
+        }.bind(this),
+        fail: function() {
+          wx.showToast({
+            title: "网络错误",
+            icon: "none"
+          })
+        }
+      })
+    }
+  },
+
+  comment: function () {
+    if (this.data.commentText.length < 5) {
+      wx.showToast({
+        title: "提问字数至少为5",
+        icon: "none"
+      })
+    } else {
+      const db = wx.cloud.database()
+      db.collection("qaData").where({
+        _openid: app.globalData.openId,
+        activityId: this.data.activityInfo._id
+      }).get({
+        success: function (res) {
+          console.log(res)
+          if (res.data.length >= 10) {
+           wx.showToast({
+             title: "为防止刷屏,每人每消息至多提问10条",
+             icon: "none"
+           })
+          } else {
+            db.collection("qaData").add({
+              data: {
+                activityId: this.data.activityInfo._id,
+                publisherId: this.data.activityInfo.publisherId,
+                answer: "",
+                answerTime: "",
+                question: this.data.commentText,
+                questionTime: new Date(),
+                rank: ""
+              },
+              success: function () {
+                this.setData({
+                  commentText: ""
+                })
+                wx.showToast({
+                  title: "提问成功"
+                })
+              }.bind(this)
+            })
+          }
+        }.bind(this)
+      })
+    }
+  },
+
+  // 计算时间差
+  handleDate: function(date) {
+    var now = new Date().getTime()
+    var diffValue = now - date.getTime()
+    if (diffValue < 0) {
+      console.log("时间不同步")
+      return "刚刚"
+    }
+    var result = ""
+    var minute = 1000 * 60
+    var hour = minute * 60
+    var day = hour * 24
+    var minC = diffValue / minute
+    var hourC = diffValue / hour
+    var dayC = diffValue / day
+    if (parseInt(dayC) > 30) {
+      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
+    } else if (parseInt(dayC) > 1) {
+      result += parseInt(dayC) + "天前"
+    } else if (parseInt(dayC) == 1) {
+      result += "昨天"
+    } else if (hourC >= 1) {
+      result += parseInt(hourC) + "小时前"
+    } else if (minC >= 5) {
+      result += parseInt(minC) + "分钟前"
+    } else {
+      result += "刚刚"
+    }
+    return result
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.showLoading({
+      title: "加载中",
+    })
+    const db = wx.cloud.database()
+    const _ = db.command
+    db.collection("mainData").doc(options.id).get({
+      success: function(res) {
+        this.setData({
+          activityInfo: res.data
+        })
+        wx.hideLoading()
+      }.bind(this)
+    })
+    db.collection("qaData").where({
+      activityId: options.id,
+      answer: _.neq("")
+    }).get({
+      success: function(res) {
+        for (let i = 0; i < res.data.length; i++) {
+          if (res.data[i].answerTime != "") {
+            res.data[i].time = this.handleDate(res.data[i].answerTime)
+          } else {
+            res.data[i].time = ""
+          }
+        }
+        this.setData({
+          activityComment: res.data
+        })
+      }.bind(this)
+    })
+    db.collection("likeData").where({
+      type: "message",
+      id: options.id
+    }).get({
+      success: function(res) {
+        this.setData({
+          like: res.data.length
+        })
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 5 - 5
miniprogram/pages/activity/activity.json

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

+ 40 - 40
miniprogram/pages/activity/activity.wxml

@@ -1,40 +1,40 @@
-<!--为首页-信息详情页面-->
-<image wx:if="{{activityInfo.poster != ''}}" class="activity-poster" src="{{activityInfo.poster}}" mode="aspectFill"/>
-<view class="activity-info block-background-color">
-  <view class="line light-primary-color" style="margin-top: 0;"></view>
-  <view class="top-column">
-    <view class="brief-info" catchtap="getPublisherInfo">
-      <view class="brief-info-left">
-        <image class="publisher-avatar" src="{{activityInfo.publisherAvatar}}"></image>
-        <view class="publisher-name dark-primary-color-font">{{activityInfo.publisherName}}</view>
-      </view>
-      <image wx:if="{{like != -1}}" class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike"/>
-    </view>
-    <view class="activity-name primary-text-color">{{activityInfo.title}}</view>
-  </view>
-  <view wx:if="{{activityInfo.activityTime != ''}}" class="line light-primary-color"></view>
-  <view wx:if="{{activityInfo.activityTime != ''}}" class="activity-time">{{activityInfo.activityTime}}</view>
-  <view wx:if="{{activityInfo.place != ''}}" class="line light-primary-color"></view>
-  <view wx:if="{{activityInfo.place != ''}}" class="activity-place">{{activityInfo.place}}</view>
-  <view wx:if="{{activityInfo.details != ''}}"class="line light-primary-color"></view>
-  <view wx:if="{{activityInfo.details != ''}}"class="activity-detail">
-    <rich-text class="activity-detail-text">{{activityInfo.details}}</rich-text>
-  </view>
-  <imagePicker wx:if="{{activityInfo.photo.length != 0}}" images="{{activityInfo.photo}}" max="1" image-width="{{activityInfo.photo.length == 1 ? 700 : activityInfo.photo.length <= 4 ? 330 : 220}}" image-height="{{activityInfo.photo.length == 1 ? 700 : activityInfo.photo.length <= 4 ? 330 : 220}}" readonly />
-  <view class="line light-primary-color"></view>
-</view>
-<view class="message-block">
-  <view class="dark-primary-color-font">{{activityComment.length == 0 ? "暂无问答" : "答疑区:"}}</view>
-  <view class="card" wx:for="{{activityComment}}" wx:for-item="item" wx:key="_id">
-    <itemActivityComment comment="{{item}}" time="{{item.time}}"/>
-  </view>
-</view>
-
-<view class="comment block-background-color">
-  <view class="comment-inside" style="display: flex; align-items: center;">
-    <icon type="info" size="20" color="#B0B0B0"></icon>
-    <input class="comment-input primary-text-color" style="width: 550rpx;" model:value="{{commentText}}" placeholder="提问" confirm-type="send" bindconfirm="comment"></input>
-  </view>
-  <view class="comment-button {{commentText.length < 5 ? 'secondary-text-color' : 'dark-primary-color-font'}}" bindtap="comment">发送</view>
-</view>
-
+<!--为首页-信息详情页面-->
+<image wx:if="{{activityInfo.poster != ''}}" class="activity-poster" src="{{activityInfo.poster}}" mode="aspectFill"/>
+<view class="activity-info block-background-color">
+  <view class="line light-primary-color" style="margin-top: 0;"></view>
+  <view class="top-column">
+    <view class="brief-info" catchtap="getPublisherInfo">
+      <view class="brief-info-left">
+        <image class="publisher-avatar" src="{{activityInfo.publisherAvatar}}"></image>
+        <view class="publisher-name dark-primary-color-font">{{activityInfo.publisherName}}</view>
+      </view>
+      <image wx:if="{{like != -1}}" class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" catchtap="toggleLike"/>
+    </view>
+    <view class="activity-name primary-text-color">{{activityInfo.title}}</view>
+  </view>
+  <view wx:if="{{activityInfo.activityTime != ''}}" class="line light-primary-color"></view>
+  <view wx:if="{{activityInfo.activityTime != ''}}" class="activity-time">{{activityInfo.activityTime}}</view>
+  <view wx:if="{{activityInfo.place != ''}}" class="line light-primary-color"></view>
+  <view wx:if="{{activityInfo.place != ''}}" class="activity-place">{{activityInfo.place}}</view>
+  <view wx:if="{{activityInfo.details != ''}}"class="line light-primary-color"></view>
+  <view wx:if="{{activityInfo.details != ''}}"class="activity-detail">
+    <rich-text class="activity-detail-text">{{activityInfo.details}}</rich-text>
+  </view>
+  <imagePicker wx:if="{{activityInfo.photo.length != 0}}" images="{{activityInfo.photo}}" max="1" image-width="{{activityInfo.photo.length == 1 ? 700 : activityInfo.photo.length <= 4 ? 330 : 220}}" image-height="{{activityInfo.photo.length == 1 ? 700 : activityInfo.photo.length <= 4 ? 330 : 220}}" readonly />
+  <view class="line light-primary-color"></view>
+</view>
+<view class="message-block">
+  <view class="dark-primary-color-font">{{activityComment.length == 0 ? "暂无问答" : "答疑区:"}}</view>
+  <view class="card" wx:for="{{activityComment}}" wx:for-item="item" wx:key="_id">
+    <itemActivityComment comment="{{item}}" time="{{item.time}}"/>
+  </view>
+</view>
+
+<view class="comment block-background-color">
+  <view class="comment-inside" style="display: flex; align-items: center;">
+    <icon type="info" size="20" color="#B0B0B0"></icon>
+    <input class="comment-input primary-text-color" style="width: 550rpx;" model:value="{{commentText}}" placeholder="提问" confirm-type="send" bindconfirm="comment"></input>
+  </view>
+  <view class="comment-button {{commentText.length < 5 ? 'secondary-text-color' : 'dark-primary-color-font'}}" bindtap="comment">发送</view>
+</view>
+

+ 236 - 236
miniprogram/pages/activityPublish/activityPublish.js

@@ -1,237 +1,237 @@
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    currentTab:0,
-    winWidth:0,
-    winHeight:0,
-    activityName:"",
-    activitySubTitle:"",
-    activityTime:"",
-    activityPlace:"",
-    activityContact:"",
-    activityAim:"",
-    activityDetail:"",
-    activityPoster:[],
-    activityPicture:[],
-    activityProInfo:"",
-    activitySrc:"",
-    activityAttr: [],
-    activitySupply: [],
-    recruitName:"",
-    recruitSubTitle:"",
-    recruitTime:"",
-    recruitAttr: "",
-    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})
-  },
-
-  activitySupplyUpdate:function(e){
-    this.setData({activitySupply:e.detail.value})
-  },
-
-  recruitAttrUpdate:function(e){
-    this.setData({recruitAttr:e.detail.value})
-  } , 
-
-  notiAttrUpdate:function(e){
-    this.setData({notiAttr:e.detail.value})
-  } , 
-
-  updateActivityPoster:function(e){
-    this.setData({activityPoster: e.detail.images})
-  },
-
-  updateActivityPicture:function(e){
-    this.setData({activityPicture: e.detail.images})
-  },
-
-  updateRecruitPoster:function(e){
-    this.setData({recruitPoster: e.detail.images})
-  },
-
-  updateRecruitPicture:function(e){
-    this.setData({recruitPicture: e.detail.images})
-  },
-
-  updateNotiPoster:function(e){
-    this.setData({notiPoster: e.detail.images})
-  },
-
-  updateNotiPicture:function(e){
-    this.setData({notiPicture: e.detail.images})
-  },
-
-  switch1:function(e){
-    this.setData({currentTab:1})
-  },
-
-  switch2:function(e){
-    this.setData({currentTab:2})
-  },
-
-  switch3:function(e){
-    this.setData({currentTab:3})
-  },
-
-  randomString:function(){
-    var char = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
-    var str = ""
-    for (var i = 0; i < 16; i++) {
-      str += char[Math.floor(Math.random() * char.length)]
-    }
-    return str
-  },
-
-  switch4:function(e){
-    var obj = {}
-    if (this.data.currentTab == 1) {
-      if (this.data.activityName == "" || this.data.activityTime == "" || this.data.activityPlace == "" ||
-      this.data.activityAttr.length == 0 || this.data.activityContact == "" || this.data.activityDetail == "") {
-        wx.showToast({
-          title: "请确认信息填写完整",
-          icon: "none"
-        })
-        return
-      }
-      obj = {
-        title: this.data.activityName,
-        subTitle: this.data.activitySubTitle,
-        activityTime: this.data.activityTime,
-        place: this.data.activityPlace,
-        attribute: this.data.activityAttr,
-        supply: this.data.activitySupply,
-        contactDetails: this.data.activityContact,
-        objectOriented: this.data.activityAim,
-        details: this.data.activityDetail,
-        poster: this.data.activityPoster.length == 0 ? "" : this.data.activityPoster[0],
-        photo: this.data.activityPicture,
-        publicity: this.data.activityProInfo,
-        registrationLink: this.data.activitySrc
-      }
-    } else if (this.data.currentTab == 2) {
-      if (this.data.recruitName == "" || this.data.recruitTime == "" || this.data.recruitAttr == "" ||
-      this.data.recruitContact == "" || this.data.recruitDetail == "") {
-        wx.showToast({
-          title: "请确认信息填写完整",
-          icon: "none"
-        })
-        return
-      }
-      obj = {
-        title: this.data.recruitName,
-        subTitle: this.data.recruitSubTitle,
-        activityTime: this.data.recruitTime,
-        attribute: this.data.recruitAttr,
-        contactDetails: this.data.recruitContact,
-        objectOriented: this.data.recruitAim,
-        details: this.data.recruitDetail,
-        poster: this.data.recruitPoster.length == 0 ? "" : this.data.recruitPoster[0],
-        photo: this.data.recruitPicture,
-        publicity: this.data.recruitProInfo,
-        registrationLink: this.data.recruitSrc
-      }
-    } else {
-      if (this.data.notiName == "" || this.data.notiAttr.length == 0 || this.data.notiDetail == "") {
-        wx.showToast({
-          title: "请确认信息填写完整",
-          icon: "none"
-        })
-        return
-      }
-      obj = {
-        title: this.data.notiName,
-        subTitle: this.data.notiSubTitle,
-        attribute: this.data.notiAttr,
-        objectOriented: this.data.notiAim,
-        details: this.data.notiDetail,
-        poster: this.data.notiPoster.length == 0 ? "" : this.data.notiPoster[0],
-        photo: this.data.notiPicture
-      }
-    }
-    obj.time = new Date()
-    obj.publisherId = this.data.publisherId
-    wx.showLoading({
-      title: "发布中"
-    })
-    const db = wx.cloud.database()
-    db.collection("publisherInfoData").doc(this.data.publisherId).get({
-      success: async function (res) {
-        obj.publisherAvatar = res.data.publisherAvatar
-        obj.publisherName = res.data.publisherName
-        if (obj.poster != "") {
-          obj.poster = (await wx.cloud.uploadFile({
-            cloudPath: "activityPoster/" + this.randomString() + ".jpg",
-            filePath: obj.poster
-          })).fileID
-        }
-        var arr = []
-        for (let i = 0; i < obj.photo.length; i++) {
-          arr.push(wx.cloud.uploadFile({
-            cloudPath: "informPhoto/" + this.randomString() + ".jpg",
-            filePath: obj.photo[i]
-          }))
-        }
-        arr = await Promise.all(arr)
-        for (let i = 0; i < obj.photo.length; i++) {
-          obj.photo[i] = arr[i].fileID
-        }
-        db.collection("mainData").add({
-          data: obj,
-          success: function () {
-            this.setData({currentTab:4})
-            wx.hideLoading()
-          }.bind(this)
-        })
-      }.bind(this)
-    })
-  },
-
-  returnToUser:function(e){
-    wx.navigateBack()
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      publisherId: options.id
-    })
-    wx.getSystemInfo({
-      success: function (res) {
-        this.setData({winWidth:res.windowWidth})
-        this.setData({winHeight:res.windowHeight})
-      }.bind(this),
-    })
-  },
-  
-  updatePage: function(e) {
-    this.setData({
-      currentTab: e.detail.current
-    })
-  }
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    currentTab:0,
+    winWidth:0,
+    winHeight:0,
+    activityName:"",
+    activitySubTitle:"",
+    activityTime:"",
+    activityPlace:"",
+    activityContact:"",
+    activityAim:"",
+    activityDetail:"",
+    activityPoster:[],
+    activityPicture:[],
+    activityProInfo:"",
+    activitySrc:"",
+    activityAttr: [],
+    activitySupply: [],
+    recruitName:"",
+    recruitSubTitle:"",
+    recruitTime:"",
+    recruitAttr: "",
+    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})
+  },
+
+  activitySupplyUpdate:function(e){
+    this.setData({activitySupply:e.detail.value})
+  },
+
+  recruitAttrUpdate:function(e){
+    this.setData({recruitAttr:e.detail.value})
+  } , 
+
+  notiAttrUpdate:function(e){
+    this.setData({notiAttr:e.detail.value})
+  } , 
+
+  updateActivityPoster:function(e){
+    this.setData({activityPoster: e.detail.images})
+  },
+
+  updateActivityPicture:function(e){
+    this.setData({activityPicture: e.detail.images})
+  },
+
+  updateRecruitPoster:function(e){
+    this.setData({recruitPoster: e.detail.images})
+  },
+
+  updateRecruitPicture:function(e){
+    this.setData({recruitPicture: e.detail.images})
+  },
+
+  updateNotiPoster:function(e){
+    this.setData({notiPoster: e.detail.images})
+  },
+
+  updateNotiPicture:function(e){
+    this.setData({notiPicture: e.detail.images})
+  },
+
+  switch1:function(e){
+    this.setData({currentTab:1})
+  },
+
+  switch2:function(e){
+    this.setData({currentTab:2})
+  },
+
+  switch3:function(e){
+    this.setData({currentTab:3})
+  },
+
+  randomString:function(){
+    var char = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+    var str = ""
+    for (var i = 0; i < 16; i++) {
+      str += char[Math.floor(Math.random() * char.length)]
+    }
+    return str
+  },
+
+  switch4:function(e){
+    var obj = {}
+    if (this.data.currentTab == 1) {
+      if (this.data.activityName == "" || this.data.activityTime == "" || this.data.activityPlace == "" ||
+      this.data.activityAttr.length == 0 || this.data.activityContact == "" || this.data.activityDetail == "") {
+        wx.showToast({
+          title: "请确认信息填写完整",
+          icon: "none"
+        })
+        return
+      }
+      obj = {
+        title: this.data.activityName,
+        subTitle: this.data.activitySubTitle,
+        activityTime: this.data.activityTime,
+        place: this.data.activityPlace,
+        attribute: this.data.activityAttr,
+        supply: this.data.activitySupply,
+        contactDetails: this.data.activityContact,
+        objectOriented: this.data.activityAim,
+        details: this.data.activityDetail,
+        poster: this.data.activityPoster.length == 0 ? "" : this.data.activityPoster[0],
+        photo: this.data.activityPicture,
+        publicity: this.data.activityProInfo,
+        registrationLink: this.data.activitySrc
+      }
+    } else if (this.data.currentTab == 2) {
+      if (this.data.recruitName == "" || this.data.recruitTime == "" || this.data.recruitAttr == "" ||
+      this.data.recruitContact == "" || this.data.recruitDetail == "") {
+        wx.showToast({
+          title: "请确认信息填写完整",
+          icon: "none"
+        })
+        return
+      }
+      obj = {
+        title: this.data.recruitName,
+        subTitle: this.data.recruitSubTitle,
+        activityTime: this.data.recruitTime,
+        attribute: this.data.recruitAttr,
+        contactDetails: this.data.recruitContact,
+        objectOriented: this.data.recruitAim,
+        details: this.data.recruitDetail,
+        poster: this.data.recruitPoster.length == 0 ? "" : this.data.recruitPoster[0],
+        photo: this.data.recruitPicture,
+        publicity: this.data.recruitProInfo,
+        registrationLink: this.data.recruitSrc
+      }
+    } else {
+      if (this.data.notiName == "" || this.data.notiAttr.length == 0 || this.data.notiDetail == "") {
+        wx.showToast({
+          title: "请确认信息填写完整",
+          icon: "none"
+        })
+        return
+      }
+      obj = {
+        title: this.data.notiName,
+        subTitle: this.data.notiSubTitle,
+        attribute: this.data.notiAttr,
+        objectOriented: this.data.notiAim,
+        details: this.data.notiDetail,
+        poster: this.data.notiPoster.length == 0 ? "" : this.data.notiPoster[0],
+        photo: this.data.notiPicture
+      }
+    }
+    obj.time = new Date()
+    obj.publisherId = this.data.publisherId
+    wx.showLoading({
+      title: "发布中"
+    })
+    const db = wx.cloud.database()
+    db.collection("publisherInfoData").doc(this.data.publisherId).get({
+      success: async function (res) {
+        obj.publisherAvatar = res.data.publisherAvatar
+        obj.publisherName = res.data.publisherName
+        if (obj.poster != "") {
+          obj.poster = (await wx.cloud.uploadFile({
+            cloudPath: "activityPoster/" + this.randomString() + ".jpg",
+            filePath: obj.poster
+          })).fileID
+        }
+        var arr = []
+        for (let i = 0; i < obj.photo.length; i++) {
+          arr.push(wx.cloud.uploadFile({
+            cloudPath: "informPhoto/" + this.randomString() + ".jpg",
+            filePath: obj.photo[i]
+          }))
+        }
+        arr = await Promise.all(arr)
+        for (let i = 0; i < obj.photo.length; i++) {
+          obj.photo[i] = arr[i].fileID
+        }
+        db.collection("mainData").add({
+          data: obj,
+          success: function () {
+            this.setData({currentTab:4})
+            wx.hideLoading()
+          }.bind(this)
+        })
+      }.bind(this)
+    })
+  },
+
+  returnToUser:function(e){
+    wx.navigateBack()
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      publisherId: options.id
+    })
+    wx.getSystemInfo({
+      success: function (res) {
+        this.setData({winWidth:res.windowWidth})
+        this.setData({winHeight:res.windowHeight})
+      }.bind(this),
+    })
+  },
+  
+  updatePage: function(e) {
+    this.setData({
+      currentTab: e.detail.current
+    })
+  }
 })

+ 4 - 4
miniprogram/pages/activityPublish/activityPublish.json

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

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

@@ -1,175 +1,175 @@
-<!--为我的-信息发布页面-->
-<!-- 修改:信息发布页面移到首页-->
-
-<view class="title dark-primary-color-font">信息发布</view>
-
-<view wx:if="{{currentTab == 0}}" class="con">
-  <view class="title2">信息发布类型</view>
-  <view class="buttons">
-    <view><button class="button dark-primary-color text-primary-color" bindtap="switch1">活动</button></view>
-    <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">纳新</button></view>
-    <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">通知</button></view>
-  </view>
-</view>
-
-<scroll-view wx:if="{{currentTab == 1}}" 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="{{activityName}}"/>
-  </view>
-  <view class="block">
-    <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}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">*活动地点</view>:
-    <input class="input block-background-color" placeholder="请输入活动开展的地点" model:value="{{activityPlace}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">*活动属性</view>:
-    <checkbox-group class="checkbox-group" bindchange="activityAttrUpdate">
-      <label wx:for="{{types1}}" wx:for-item="item" wx:key="*this">
-        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
-      </label>
-    </checkbox-group>
-  </view>
-  <view class="block">
-    <view class="cate">活动提供</view>:
-    <checkbox-group class="checkbox-group" bindchange="activitySupplyUpdate">
-      <label wx:for="{{types2}}" wx:for-item="item" wx:key="*this">
-        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
-      </label>
-    </checkbox-group>
-  </view>
-  <view class="block">
-    <view class="cate">*联系方式</view>:
-    <input class="input block-background-color" model:value="{{activityContact}}" placeholder="请输入联系方式" />
-  </view>
-  <view class="block">
-    <view class="cate">面向对象</view>:
-    <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>
-  <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>
-  <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>
-  <view class="block2">
-    <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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
-</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}}"/>
-  </view>
-  <view class="block">
-    <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}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">*纳新属性</view>:
-    <radio-group class="checkbox-group" bindchange="recruitAttrUpdate">
-      <label wx:for="{{types3}}" wx:for-item="item" wx:key="*this">
-        <radio class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</radio>
-      </label>
-    </radio-group>
-  </view>
-  <view class="block">
-    <view class="cate">*联系方式</view>:
-    <input class="input block-background-color" model:value="{{recruitContact}}" placeholder="请输入联系方式" />
-  </view>
-  <view class="block">
-    <view class="cate">面向对象</view>:
-    <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>
-  <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>
-  <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>
-  <view class="block2">
-    <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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
-</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}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">副标题</view>:
-    <input class="input block-background-color" placeholder="请输入通知副标题" model:value="{{notiSubTitle}}"/>
-  </view>
-  <view class="block">
-    <view class="cate">*通知属性</view>:
-    <checkbox-group class="checkbox-group" bindchange="notiAttrUpdate">
-      <label wx:for="{{types4}}" wx:for-item="item" wx:key="*this">
-        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
-      </label>
-    </checkbox-group>
-  </view>
-  <view class="block">
-    <view class="cate">面向对象</view>:
-    <input class="input block-background-color" model:value="{{notiAim}}" placeholder="请输入面向对象" />
-  </view>
-  <view class="block2">
-    <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>
-    <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>
-    <imagePicker images="{{notiPicture}}" max="9" image-width="145" image-height="145" bindchange="updateNotiPicture" />
-  </view>
-  <button class="button dark-primary-color text-primary-color" bindtap="switch4">提交</button>
-</scroll-view>
-
-<view wx:if="{{currentTab == 4}}" class="con">
-  <view class="con1 dark-primary-color-font">发布成功!</view>
-  <image  class="success-icon" src="../../images/finish.png" mode="aspectFill"/>
-  <!-- <view class="con2"></view> -->
-  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser" >返回</button>
-</view>
+<!--为我的-信息发布页面-->
+<!-- 修改:信息发布页面移到首页-->
+
+<view class="title dark-primary-color-font">信息发布</view>
+
+<view wx:if="{{currentTab == 0}}" class="con">
+  <view class="title2">信息发布类型</view>
+  <view class="buttons">
+    <view><button class="button dark-primary-color text-primary-color" bindtap="switch1">活动</button></view>
+    <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">纳新</button></view>
+    <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">通知</button></view>
+  </view>
+</view>
+
+<scroll-view wx:if="{{currentTab == 1}}" 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="{{activityName}}"/>
+  </view>
+  <view class="block">
+    <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}}"/>
+  </view>
+  <view class="block">
+    <view class="cate">*活动地点</view>:
+    <input class="input block-background-color" placeholder="请输入活动开展的地点" model:value="{{activityPlace}}"/>
+  </view>
+  <view class="block">
+    <view class="cate">*活动属性</view>:
+    <checkbox-group class="checkbox-group" bindchange="activityAttrUpdate">
+      <label wx:for="{{types1}}" wx:for-item="item" wx:key="*this">
+        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
+      </label>
+    </checkbox-group>
+  </view>
+  <view class="block">
+    <view class="cate">活动提供</view>:
+    <checkbox-group class="checkbox-group" bindchange="activitySupplyUpdate">
+      <label wx:for="{{types2}}" wx:for-item="item" wx:key="*this">
+        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
+      </label>
+    </checkbox-group>
+  </view>
+  <view class="block">
+    <view class="cate">*联系方式</view>:
+    <input class="input block-background-color" model:value="{{activityContact}}" placeholder="请输入联系方式" />
+  </view>
+  <view class="block">
+    <view class="cate">面向对象</view>:
+    <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>
+  <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>
+  <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>
+  <view class="block2">
+    <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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
+</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}}"/>
+  </view>
+  <view class="block">
+    <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}}"/>
+  </view>
+  <view class="block">
+    <view class="cate">*纳新属性</view>:
+    <radio-group class="checkbox-group" bindchange="recruitAttrUpdate">
+      <label wx:for="{{types3}}" wx:for-item="item" wx:key="*this">
+        <radio class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</radio>
+      </label>
+    </radio-group>
+  </view>
+  <view class="block">
+    <view class="cate">*联系方式</view>:
+    <input class="input block-background-color" model:value="{{recruitContact}}" placeholder="请输入联系方式" />
+  </view>
+  <view class="block">
+    <view class="cate">面向对象</view>:
+    <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>
+  <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>
+  <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>
+  <view class="block2">
+    <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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
+</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}}"/>
+  </view>
+  <view class="block">
+    <view class="cate">副标题</view>:
+    <input class="input block-background-color" placeholder="请输入通知副标题" model:value="{{notiSubTitle}}"/>
+  </view>
+  <view class="block">
+    <view class="cate">*通知属性</view>:
+    <checkbox-group class="checkbox-group" bindchange="notiAttrUpdate">
+      <label wx:for="{{types4}}" wx:for-item="item" wx:key="*this">
+        <checkbox class="checkbox" value="{{item}}" color="#3F51B5">{{item}}</checkbox>
+      </label>
+    </checkbox-group>
+  </view>
+  <view class="block">
+    <view class="cate">面向对象</view>:
+    <input class="input block-background-color" model:value="{{notiAim}}" placeholder="请输入面向对象" />
+  </view>
+  <view class="block2">
+    <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>
+    <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>
+    <imagePicker images="{{notiPicture}}" max="9" image-width="145" image-height="145" bindchange="updateNotiPicture" />
+  </view>
+  <button class="button dark-primary-color text-primary-color" bindtap="switch4">提交</button>
+</scroll-view>
+
+<view wx:if="{{currentTab == 4}}" class="con">
+  <view class="con1 dark-primary-color-font">发布成功!</view>
+  <image  class="success-icon" src="../../images/finish.png" mode="aspectFill"/>
+  <!-- <view class="con2"></view> -->
+  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser" >返回</button>
+</view>

+ 65 - 65
miniprogram/pages/administratorSetting/administratorSetting.js

@@ -1,66 +1,66 @@
-// pages/administratorSetting/administratorSetting.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// pages/administratorSetting/administratorSetting.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/administratorSetting/administratorSetting.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 2 - 2
miniprogram/pages/administratorSetting/administratorSetting.wxml

@@ -1,2 +1,2 @@
-<!--pages/administratorSetting/administratorSetting.wxml-->
-<text>pages/administratorSetting/administratorSetting.wxml</text>
+<!--pages/administratorSetting/administratorSetting.wxml-->
+<text>pages/administratorSetting/administratorSetting.wxml</text>

+ 263 - 263
miniprogram/pages/main/main.js

@@ -1,264 +1,264 @@
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    mainDatas: [],
-    toggleEnable: true,
-    filterList: 0,
-    filterItem: ["", "", "", ""],
-    filterName: [
-      {},
-      {
-        type: "信息类型",
-        list: [
-          {
-            sub: "通知",
-            item : [
-              {
-                secondSub:"生活通知",
-                subitem:["水电通知", "缴费通知", "假期通知", "后勤通知", "图书馆通知"]            
-              },
-              {
-                secondSub:"学业通知",
-                subitem:["选课通知", "竞赛通知", "考试通知"]
-              },
-              {
-                secondSub:"其他通知",
-                subitem:["其他通知"]
-              }
-        ]
-      },
-          {
-            sub: "活动",
-            item: ["志愿活动", "文艺活动", "体育活动", "学术活动", "素质拓展", "精品课程", "其他活动"]
-          },
-          {
-            sub: "纳新",
-            item: ["社团纳新", "组织纳新"]
-          }
-        ]
-      },
-      {
-        type: "发布来源",
-        item: ["我关注的", "社团", "组织", "权服侠", "学校部门"]
-      },
-      {
-        type: "我的需求",
-        item: ["二课分", "三课分", "四课分", "勤工助学", "志愿者小时数", "综素/活动纪实"]
-      }
-    ],
-    activity: null,
-    inform: null,
-    recruit: null
-  },
-
-  showList: function (id) {
-    this.data.toggleEnable = false
-    this.setData({
-      filterList: id
-    })
-    this.animate("#arrow" + id, [
-      { rotate: 0 },
-      { rotate: 180 },
-    ], 150)
-    this.animate("#list" + id, [
-      { opacity: 0 },
-      { opacity: 1 },
-    ], 150)
-    setTimeout(function () {
-      this.setData({
-        toggleEnable: true
-      })
-    }.bind(this), 200)
-  },
-
-  hideList: function (id) {
-    this.data.toggleEnable = false
-    this.animate("#arrow" + id, [
-      { rotate: 180 },
-      { rotate: 360 },
-    ], 150)
-    this.animate("#list" + id, [
-      { opacity: 1 },
-      { opacity: 0 },
-    ], 150, function () {
-      this.setData({
-        filterList: 0
-      })
-    }.bind(this))
-    setTimeout(function () {
-      this.setData({
-        toggleEnable: true
-      })
-    }.bind(this), 200)
-  },
-
-  toggleFilterList: function (e) {
-    if (!this.data.toggleEnable) return
-    var list = e.currentTarget.dataset.filterList
-    if (this.data.filterList == list) {
-      if (this.data.filterList != 0) {
-        this.hideList(this.data.filterList)
-      }
-    } else {
-      if (this.data.filterList != 0) {
-        this.hideList(this.data.filterList)
-      }
-      if (list != 0) {
-        this.showList(list)
-      }
-    }
-  },
-
-  toggleFilterItem: function (e) {
-    if (!this.data.toggleEnable) return
-    if (this.data.filterList != 0 && this.data.filterList == e.currentTarget.dataset.filterList) {
-      var item = e.currentTarget.dataset.filterItem
-      var arr = this.data.filterItem
-      arr[this.data.filterList] = arr[this.data.filterList] == item ? "" : item;
-      this.setData({
-        filterItem: arr
-      })
-      this.hideList(this.data.filterList)
-    }
-  },
-
-  filterMsgType: function (e) {
-    var arr = this.data.filterItem
-    arr[1] = e.detail.attr
-    this.setData({
-      filterItem: arr
-    })
-  },
-
-  // 计算时间差
-  handleDate: function(date) {
-    var now = new Date().getTime()
-    var diffValue = now - date.getTime()
-    if (diffValue < 0) {
-      console.log("时间不同步")
-      return "刚刚"
-    }
-    var result = ""
-    var minute = 1000 * 60
-    var hour = minute * 60
-    var day = hour * 24
-    var minC = diffValue / minute
-    var hourC = diffValue / hour
-    var dayC = diffValue / day
-    if (parseInt(dayC) > 30) {
-      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
-    } else if (parseInt(dayC) > 1) {
-      result += parseInt(dayC) + "天前"
-    } else if (parseInt(dayC) == 1) {
-      result += "昨天"
-    } else if (hourC >= 1) {
-      result += parseInt(hourC) + "小时前"
-    } else if (minC >= 5) {
-      result += parseInt(minC) + "分钟前"
-    } else {
-      result += "刚刚"
-    }
-    return result
-  },
-
-  processData: function (start, arr) {
-    const db = wx.cloud.database()
-    for (let i = start; i < arr.length; i++) {
-      arr[i].time = this.handleDate(arr[i].time)
-      db.collection("publisherInfoData").where({
-        publisherName: arr[i].publisherName
-      }).get({
-        success: function (res) {
-          arr[i].publisherAttribute = res.data[0].publisherAttribute
-          this.setData({
-            mainDatas: arr
-          })
-          wx.hideNavigationBarLoading()
-        }.bind(this)
-      })
-    }
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    wx.showNavigationBarLoading()
-    const db = wx.cloud.database()
-    db.collection("mainData").orderBy("time", "desc").limit(20).get({
-      success: function (res) {
-        this.processData(0, res.data)
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-    wx.showNavigationBarLoading()
-    const db = wx.cloud.database()
-    db.collection("mainData").orderBy("time", "desc").limit(20).get({
-      success: function (res) {
-        this.processData(0, res.data)
-        wx.stopPullDownRefresh()
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-    wx.showNavigationBarLoading()
-    const db = wx.cloud.database()
-    db.collection("mainData").orderBy("time", "desc").skip(this.data.mainDatas.length).limit(20).get({
-      success: function (res) {
-        if (res.data.length == 0) {
-          wx.hideNavigationBarLoading()
-          return
-        }
-        res.data = this.data.mainDatas.concat(res.data)
-        this.processData(this.data.mainDatas.length, res.data)
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    mainDatas: [],
+    toggleEnable: true,
+    filterList: 0,
+    filterItem: ["", "", "", ""],
+    filterName: [
+      {},
+      {
+        type: "信息类型",
+        list: [
+          {
+            sub: "通知",
+            item : [
+              {
+                secondSub:"生活通知",
+                subitem:["水电通知", "缴费通知", "假期通知", "后勤通知", "图书馆通知"]            
+              },
+              {
+                secondSub:"学业通知",
+                subitem:["选课通知", "竞赛通知", "考试通知"]
+              },
+              {
+                secondSub:"其他通知",
+                subitem:["其他通知"]
+              }
+        ]
+      },
+          {
+            sub: "活动",
+            item: ["志愿活动", "文艺活动", "体育活动", "学术活动", "素质拓展", "精品课程", "其他活动"]
+          },
+          {
+            sub: "纳新",
+            item: ["社团纳新", "组织纳新"]
+          }
+        ]
+      },
+      {
+        type: "发布来源",
+        item: ["我关注的", "社团", "组织", "权服侠", "学校部门"]
+      },
+      {
+        type: "我的需求",
+        item: ["二课分", "三课分", "四课分", "勤工助学", "志愿者小时数", "综素/活动纪实"]
+      }
+    ],
+    activity: null,
+    inform: null,
+    recruit: null
+  },
+
+  showList: function (id) {
+    this.data.toggleEnable = false
+    this.setData({
+      filterList: id
+    })
+    this.animate("#arrow" + id, [
+      { rotate: 0 },
+      { rotate: 180 },
+    ], 150)
+    this.animate("#list" + id, [
+      { opacity: 0 },
+      { opacity: 1 },
+    ], 150)
+    setTimeout(function () {
+      this.setData({
+        toggleEnable: true
+      })
+    }.bind(this), 200)
+  },
+
+  hideList: function (id) {
+    this.data.toggleEnable = false
+    this.animate("#arrow" + id, [
+      { rotate: 180 },
+      { rotate: 360 },
+    ], 150)
+    this.animate("#list" + id, [
+      { opacity: 1 },
+      { opacity: 0 },
+    ], 150, function () {
+      this.setData({
+        filterList: 0
+      })
+    }.bind(this))
+    setTimeout(function () {
+      this.setData({
+        toggleEnable: true
+      })
+    }.bind(this), 200)
+  },
+
+  toggleFilterList: function (e) {
+    if (!this.data.toggleEnable) return
+    var list = e.currentTarget.dataset.filterList
+    if (this.data.filterList == list) {
+      if (this.data.filterList != 0) {
+        this.hideList(this.data.filterList)
+      }
+    } else {
+      if (this.data.filterList != 0) {
+        this.hideList(this.data.filterList)
+      }
+      if (list != 0) {
+        this.showList(list)
+      }
+    }
+  },
+
+  toggleFilterItem: function (e) {
+    if (!this.data.toggleEnable) return
+    if (this.data.filterList != 0 && this.data.filterList == e.currentTarget.dataset.filterList) {
+      var item = e.currentTarget.dataset.filterItem
+      var arr = this.data.filterItem
+      arr[this.data.filterList] = arr[this.data.filterList] == item ? "" : item;
+      this.setData({
+        filterItem: arr
+      })
+      this.hideList(this.data.filterList)
+    }
+  },
+
+  filterMsgType: function (e) {
+    var arr = this.data.filterItem
+    arr[1] = e.detail.attr
+    this.setData({
+      filterItem: arr
+    })
+  },
+
+  // 计算时间差
+  handleDate: function(date) {
+    var now = new Date().getTime()
+    var diffValue = now - date.getTime()
+    if (diffValue < 0) {
+      console.log("时间不同步")
+      return "刚刚"
+    }
+    var result = ""
+    var minute = 1000 * 60
+    var hour = minute * 60
+    var day = hour * 24
+    var minC = diffValue / minute
+    var hourC = diffValue / hour
+    var dayC = diffValue / day
+    if (parseInt(dayC) > 30) {
+      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
+    } else if (parseInt(dayC) > 1) {
+      result += parseInt(dayC) + "天前"
+    } else if (parseInt(dayC) == 1) {
+      result += "昨天"
+    } else if (hourC >= 1) {
+      result += parseInt(hourC) + "小时前"
+    } else if (minC >= 5) {
+      result += parseInt(minC) + "分钟前"
+    } else {
+      result += "刚刚"
+    }
+    return result
+  },
+
+  processData: function (start, arr) {
+    const db = wx.cloud.database()
+    for (let i = start; i < arr.length; i++) {
+      arr[i].time = this.handleDate(arr[i].time)
+      db.collection("publisherInfoData").where({
+        publisherName: arr[i].publisherName
+      }).get({
+        success: function (res) {
+          arr[i].publisherAttribute = res.data[0].publisherAttribute
+          this.setData({
+            mainDatas: arr
+          })
+          wx.hideNavigationBarLoading()
+        }.bind(this)
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.showNavigationBarLoading()
+    const db = wx.cloud.database()
+    db.collection("mainData").orderBy("time", "desc").limit(20).get({
+      success: function (res) {
+        this.processData(0, res.data)
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+    wx.showNavigationBarLoading()
+    const db = wx.cloud.database()
+    db.collection("mainData").orderBy("time", "desc").limit(20).get({
+      success: function (res) {
+        this.processData(0, res.data)
+        wx.stopPullDownRefresh()
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    wx.showNavigationBarLoading()
+    const db = wx.cloud.database()
+    db.collection("mainData").orderBy("time", "desc").skip(this.data.mainDatas.length).limit(20).get({
+      success: function (res) {
+        if (res.data.length == 0) {
+          wx.hideNavigationBarLoading()
+          return
+        }
+        res.data = this.data.mainDatas.concat(res.data)
+        this.processData(this.data.mainDatas.length, res.data)
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 5 - 5
miniprogram/pages/main/main.json

@@ -1,6 +1,6 @@
-{
-  "enablePullDownRefresh": true,
-  "usingComponents": {
-    "itemCard":"/components/itemCard/itemCard"
-  }
+{
+  "enablePullDownRefresh": true,
+  "usingComponents": {
+    "itemCard":"/components/itemCard/itemCard"
+  }
 }

+ 46 - 46
miniprogram/pages/main/main.wxml

@@ -1,46 +1,46 @@
-<!-- 为首页,含component:itemCard;data:mainData.js -->
-<!-- 更新了filter中的活动内容,但是由于有二级标题、还未给出页面美化需求,因此仅在js文件中更新,wxml未更新完全-->
-<view class="page primary-text-color">
-  <view class="filter default-primary-color">
-    <view class="filter-item {{filterList == 1 || filterItem[1] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="1" bindtap="toggleFilterList">
-      <text>{{filterItem[1] == "" ? filterName[1].type : filterItem[1]}}</text>
-      <image class="filter-arrow" id="arrow1" mode="aspectFit" src="/images/arrow.png"></image>
-    </view>
-    <view class="filter-line dark-primary-color"></view>
-    <view class="filter-item {{filterList == 2 || filterItem[2] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="2" bindtap="toggleFilterList">
-      <text>{{filterItem[2] == "" ? filterName[2].type : filterItem[2]}}</text>
-      <image class="filter-arrow" id="arrow2" mode="aspectFit" src="/images/arrow.png"></image>
-    </view>
-    <view class="filter-line dark-primary-color"></view>
-    <view class="filter-item {{filterList == 3 || filterItem[3] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="3" bindtap="toggleFilterList">
-      <text>{{filterItem[3] == "" ? filterName[3].type : filterItem[3]}}</text>
-      <image class="filter-arrow" id="arrow3" mode="aspectFit" src="/images/arrow.png"></image>
-    </view>
-  </view>
-  <view class="filter-lists">
-    <view wx:if="{{filterList == 1}}" class="filter-list1" id="list1">
-      <view wx:for="{{filterName[1].list}}" wx:for-item="item" wx:key="type">
-        <view class="filter-list-title default-primary-color-font">{{item.sub}}</view>
-        <view class="filter-list-subtitle default-primary-color-font">{{item.item[0].secondSub}}</view>
-        <view class="filter-list-item" wx:for="{{item.item[0].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
-        <view class="filter-list-subtitle default-primary-color-font">{{item.item[1].secondSub}}</view>
-        <view class="filter-list-item" wx:for="{{item.item[1].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
-        <view class="filter-list-subtitle default-primary-color-font">{{item.item[2].secondSub}}</view>
-        <view class="filter-list-item" wx:for="{{item.item[2].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
-      </view>
-    </view>
-    <view class="filter-list"></view>
-    <view wx:if="{{filterList == 2}}" class="filter-list" id="list2">
-      <view class="filter-list-item" wx:for="{{filterName[2].item}}" wx:for-item="name" wx:key="*this" data-filter-list="2" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[2] == name}}">✔</view></view>
-    </view>
-    <view class="filter-list"></view>
-    <view wx:if="{{filterList == 3}}" class="filter-list" id="list3">
-      <view class="filter-list-item" wx:for="{{filterName[3].item}}" wx:for-item="name" wx:key="*this" data-filter-list="3" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[3] == name}}">✔</view></view>
-    </view>
-  </view>
-  <view style="margin-top: 75rpx;">
-    <view wx:for="{{mainDatas}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
-      <itemCard wx:if="{{(filterItem[1] == '' || filterItem[1] == item.attribute[0]) && (filterItem[2] == '' || filterItem[2] == item.publisherAttribute[0]) && (filterItem[3] == '' || filterItem[3] == item.supply[0])}}" item="{{item}}" bindfiltermsgtype="filterMsgType"/>
-    </view>
-  </view>
-</view>
+<!-- 为首页,含component:itemCard;data:mainData.js -->
+<!-- 更新了filter中的活动内容,但是由于有二级标题、还未给出页面美化需求,因此仅在js文件中更新,wxml未更新完全-->
+<view class="page primary-text-color">
+  <view class="filter default-primary-color">
+    <view class="filter-item {{filterList == 1 || filterItem[1] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="1" bindtap="toggleFilterList">
+      <text>{{filterItem[1] == "" ? filterName[1].type : filterItem[1]}}</text>
+      <image class="filter-arrow" id="arrow1" mode="aspectFit" src="/images/arrow.png"></image>
+    </view>
+    <view class="filter-line dark-primary-color"></view>
+    <view class="filter-item {{filterList == 2 || filterItem[2] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="2" bindtap="toggleFilterList">
+      <text>{{filterItem[2] == "" ? filterName[2].type : filterItem[2]}}</text>
+      <image class="filter-arrow" id="arrow2" mode="aspectFit" src="/images/arrow.png"></image>
+    </view>
+    <view class="filter-line dark-primary-color"></view>
+    <view class="filter-item {{filterList == 3 || filterItem[3] != 0 ? 'text-primary-color' : ' secondary-text-color'}}" data-filter-list="3" bindtap="toggleFilterList">
+      <text>{{filterItem[3] == "" ? filterName[3].type : filterItem[3]}}</text>
+      <image class="filter-arrow" id="arrow3" mode="aspectFit" src="/images/arrow.png"></image>
+    </view>
+  </view>
+  <view class="filter-lists">
+    <view wx:if="{{filterList == 1}}" class="filter-list1" id="list1">
+      <view wx:for="{{filterName[1].list}}" wx:for-item="item" wx:key="type">
+        <view class="filter-list-title default-primary-color-font">{{item.sub}}</view>
+        <view class="filter-list-subtitle default-primary-color-font">{{item.item[0].secondSub}}</view>
+        <view class="filter-list-item" wx:for="{{item.item[0].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
+        <view class="filter-list-subtitle default-primary-color-font">{{item.item[1].secondSub}}</view>
+        <view class="filter-list-item" wx:for="{{item.item[1].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
+        <view class="filter-list-subtitle default-primary-color-font">{{item.item[2].secondSub}}</view>
+        <view class="filter-list-item" wx:for="{{item.item[2].subitem}}" wx:for-item="name" wx:key="*this" data-filter-list="1" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[1] == name}}">✔</view></view>
+      </view>
+    </view>
+    <view class="filter-list"></view>
+    <view wx:if="{{filterList == 2}}" class="filter-list" id="list2">
+      <view class="filter-list-item" wx:for="{{filterName[2].item}}" wx:for-item="name" wx:key="*this" data-filter-list="2" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[2] == name}}">✔</view></view>
+    </view>
+    <view class="filter-list"></view>
+    <view wx:if="{{filterList == 3}}" class="filter-list" id="list3">
+      <view class="filter-list-item" wx:for="{{filterName[3].item}}" wx:for-item="name" wx:key="*this" data-filter-list="3" data-filter-item="{{name}}" bindtap="toggleFilterItem">{{name}}<view wx:if="{{filterItem[3] == name}}">✔</view></view>
+    </view>
+  </view>
+  <view style="margin-top: 75rpx;">
+    <view wx:for="{{mainDatas}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
+      <itemCard wx:if="{{(filterItem[1] == '' || filterItem[1] == item.attribute[0]) && (filterItem[2] == '' || filterItem[2] == item.publisherAttribute[0]) && (filterItem[3] == '' || filterItem[3] == item.supply[0])}}" item="{{item}}" bindfiltermsgtype="filterMsgType"/>
+    </view>
+  </view>
+</view>

+ 19 - 19
miniprogram/pages/message/message.js

@@ -1,20 +1,20 @@
-var newNews = require("../../data/newNewsData.js");
-Component({
-  data: {
-    newNews:{
-
-    }
-  },
-
-  lifetimes: {
-    ready: function() {
-      this.setData({
-        newNews:newNews.newNews
-      })
-    }
-  },
-
-  methods: {
-
-  }
+var newNews = require("../../data/newNewsData.js");
+Component({
+  data: {
+    newNews:{
+
+    }
+  },
+
+  lifetimes: {
+    ready: function() {
+      this.setData({
+        newNews:newNews.newNews
+      })
+    }
+  },
+
+  methods: {
+
+  }
 })

+ 5 - 5
miniprogram/pages/message/message.json

@@ -1,6 +1,6 @@
-{
-  "component":true,
-  "usingComponents": {
-    "itemmyNews":"/components/itemmyNews/itemmyNews"
-  }
+{
+  "component":true,
+  "usingComponents": {
+    "itemmyNews":"/components/itemmyNews/itemmyNews"
+  }
 }

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

@@ -1,7 +1,7 @@
-<!-- 为消息的导航栏 两个component界面:“关注动态”followNews “我的消息”myNews-->
-<!-- 修改:将关注动态转移到首页,消息页面删除导航栏-->
-<view class="page">
-  <view class="card" wx:for="{{newNews}}" wx:for-item="item" wx:key="id" wx:index="index">
-    <itemmyNews item="{{item}}"/>
-  </view>
+<!-- 为消息的导航栏 两个component界面:“关注动态”followNews “我的消息”myNews-->
+<!-- 修改:将关注动态转移到首页,消息页面删除导航栏-->
+<view class="page">
+  <view class="card" wx:for="{{newNews}}" wx:for-item="item" wx:key="id" wx:index="index">
+    <itemmyNews item="{{item}}"/>
+  </view>
 </view>

+ 7 - 7
miniprogram/pages/message/message.wxss

@@ -1,7 +1,7 @@
-.page{
-  display: flex;
-  flex-direction: column;
-  justify-content: flex-start;
-  align-items: center;
-  margin: 0%;
-}
+.page{
+  display: flex;
+  flex-direction: column;
+  justify-content: flex-start;
+  align-items: center;
+  margin: 0%;
+}

+ 65 - 65
miniprogram/pages/myColor/myColor.js

@@ -1,66 +1,66 @@
-// miniprogram/pages/myColor/myColor.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// miniprogram/pages/myColor/myColor.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/myColor/myColor.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 2 - 2
miniprogram/pages/myColor/myColor.wxml

@@ -1,2 +1,2 @@
-<!--miniprogram/pages/myColor/myColor.wxml-->
-<text>miniprogram/pages/myColor/myColor.wxml</text>
+<!--miniprogram/pages/myColor/myColor.wxml-->
+<text>miniprogram/pages/myColor/myColor.wxml</text>

+ 44 - 44
miniprogram/pages/myFavor/myFavor.js

@@ -1,45 +1,45 @@
-Component({
-  data: {
-    newNews: []
-  },
-
-  lifetimes: {
-    ready: function() {
-      wx.showLoading({
-        title: "加载中",
-      })
-      const db = wx.cloud.database()
-      db.collection("likeData").where({
-        type: "message"
-      }).get({
-        success: function (res) {
-          if (res.data.length == 0) {
-            wx.hideLoading()
-            return
-          }
-          this.processData(res.data)
-        }.bind(this)
-      })
-    }
-  },
-
-  methods: {
-    processData: function (arr) {
-      const db = wx.cloud.database()
-      for (let i = 0; i < arr.length; i++) {
-        db.collection("mainData").doc(arr[i].id).get({
-          success: function (res) {
-            arr[i].publisherAvatar = res.data.publisherAvatar
-            arr[i].publisherName = res.data.publisherName
-            arr[i].title = res.data.title
-            arr[i].subTitle = res.data.subTitle
-            this.setData({
-              newNews: arr
-            })
-            wx.hideLoading()
-          }.bind(this)
-        })
-      }
-    }
-  }
+Component({
+  data: {
+    newNews: []
+  },
+
+  lifetimes: {
+    ready: function() {
+      wx.showLoading({
+        title: "加载中",
+      })
+      const db = wx.cloud.database()
+      db.collection("likeData").where({
+        type: "message"
+      }).get({
+        success: function (res) {
+          if (res.data.length == 0) {
+            wx.hideLoading()
+            return
+          }
+          this.processData(res.data)
+        }.bind(this)
+      })
+    }
+  },
+
+  methods: {
+    processData: function (arr) {
+      const db = wx.cloud.database()
+      for (let i = 0; i < arr.length; i++) {
+        db.collection("mainData").doc(arr[i].id).get({
+          success: function (res) {
+            arr[i].publisherAvatar = res.data.publisherAvatar
+            arr[i].publisherName = res.data.publisherName
+            arr[i].title = res.data.title
+            arr[i].subTitle = res.data.subTitle
+            this.setData({
+              newNews: arr
+            })
+            wx.hideLoading()
+          }.bind(this)
+        })
+      }
+    }
+  }
 })

+ 5 - 5
miniprogram/pages/myFavor/myFavor.json

@@ -1,6 +1,6 @@
-{
-  "component": true,
-  "usingComponents": {
-    "itemmyLikeMessage": "/components/itemmyLikeMessage/itemmyLikeMessage"
-  }
+{
+  "component": true,
+  "usingComponents": {
+    "itemmyLikeMessage": "/components/itemmyLikeMessage/itemmyLikeMessage"
+  }
 }

+ 5 - 5
miniprogram/pages/myFavor/myFavor.wxml

@@ -1,6 +1,6 @@
-<!-- 消息-我的消息组件,含component:itemmyNews;含data:newNewsData -->
-<view class="page">
-  <view class="card" wx:for="{{newNews}}" wx:for-item="item" wx:key="id">
-    <itemmyLikeMessage item="{{item}}"/>
-  </view>
+<!-- 消息-我的消息组件,含component:itemmyNews;含data:newNewsData -->
+<view class="page">
+  <view class="card" wx:for="{{newNews}}" wx:for-item="item" wx:key="id">
+    <itemmyLikeMessage item="{{item}}"/>
+  </view>
 </view>

+ 7 - 7
miniprogram/pages/myFavor/myFavor.wxss

@@ -1,7 +1,7 @@
-.page{
-  display: flex;
-  flex-direction: column;
-  justify-content: flex-start;
-  align-items: center;
-  margin: 0%;
-}
+.page{
+  display: flex;
+  flex-direction: column;
+  justify-content: flex-start;
+  align-items: center;
+  margin: 0%;
+}

+ 34 - 34
miniprogram/pages/myFollow/myFollow.js

@@ -1,35 +1,35 @@
-Component({
-  data: {
-    newMessage: []
-  },
-
-  lifetimes: {
-    ready: function() {
-      const db = wx.cloud.database()
-      db.collection("likeData").where({
-        type: "publisher"
-      }).get({
-        success: function (res) {
-          this.processData(res.data)
-        }.bind(this)
-      })
-    }
-  },
-
-  methods: {
-    processData: function (arr) {
-      const db = wx.cloud.database()
-      for (let i = 0; i < arr.length; i++) {
-        db.collection("publisherInfoData").doc(arr[i].id).get({
-          success: function (res) {
-            arr[i].publisherAvatar = res.data.publisherAvatar
-            arr[i].publisherName = res.data.publisherName
-            this.setData({
-              newMessage: arr
-            })
-          }.bind(this)
-        })
-      }
-    }
-  }
+Component({
+  data: {
+    newMessage: []
+  },
+
+  lifetimes: {
+    ready: function() {
+      const db = wx.cloud.database()
+      db.collection("likeData").where({
+        type: "publisher"
+      }).get({
+        success: function (res) {
+          this.processData(res.data)
+        }.bind(this)
+      })
+    }
+  },
+
+  methods: {
+    processData: function (arr) {
+      const db = wx.cloud.database()
+      for (let i = 0; i < arr.length; i++) {
+        db.collection("publisherInfoData").doc(arr[i].id).get({
+          success: function (res) {
+            arr[i].publisherAvatar = res.data.publisherAvatar
+            arr[i].publisherName = res.data.publisherName
+            this.setData({
+              newMessage: arr
+            })
+          }.bind(this)
+        })
+      }
+    }
+  }
 })

+ 5 - 5
miniprogram/pages/myFollow/myFollow.json

@@ -1,6 +1,6 @@
-{
-  "component": true,
-  "usingComponents": {
-    "itemmyLikePublisher":"/components/itemmyLikePublisher/itemmyLikePublisher"
-  }
+{
+  "component": true,
+  "usingComponents": {
+    "itemmyLikePublisher":"/components/itemmyLikePublisher/itemmyLikePublisher"
+  }
 }

+ 5 - 5
miniprogram/pages/myFollow/myFollow.wxml

@@ -1,6 +1,6 @@
-<!-- 我关注的发布者组件,含component:itemfollowNews; 含data:newMessageData.js-->
-<view class="page">
-  <view class="card" wx:for="{{newMessage}}" wx:for-item="item" wx:key="id" wx:index="index">
-    <itemmyLikePublisher item="{{item}}"/>
-  </view>
+<!-- 我关注的发布者组件,含component:itemfollowNews; 含data:newMessageData.js-->
+<view class="page">
+  <view class="card" wx:for="{{newMessage}}" wx:for-item="item" wx:key="id" wx:index="index">
+    <itemmyLikePublisher item="{{item}}"/>
+  </view>
 </view>

+ 7 - 7
miniprogram/pages/myFollow/myFollow.wxss

@@ -1,7 +1,7 @@
-.page{
-  display: flex;
-  flex-direction: column;
-  justify-content: flex-start;
-  align-items: center;
-  margin: 0%;
-}
+.page{
+  display: flex;
+  flex-direction: column;
+  justify-content: flex-start;
+  align-items: center;
+  margin: 0%;
+}

+ 65 - 65
miniprogram/pages/myPublish/myPublish.js

@@ -1,66 +1,66 @@
-// pages/myPublish/myPublish.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// pages/myPublish/myPublish.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/myPublish/myPublish.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 2 - 2
miniprogram/pages/myPublish/myPublish.wxml

@@ -1,2 +1,2 @@
-<!--pages/myPublish/myPublish.wxml-->
-<text>pages/myPublish/myPublish.wxml</text>
+<!--pages/myPublish/myPublish.wxml-->
+<text>pages/myPublish/myPublish.wxml</text>

+ 145 - 145
miniprogram/pages/myQuestion/myQuestion.js

@@ -1,146 +1,146 @@
-// miniprogram/pages/receivedQuestion/receivedQuestion.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    questions: [],
-    publisherId: "",
-    notAnswered: true,
-    answered: true
-  },
-
-  updateText: function (e) {
-    var arr = this.data.questions
-    arr[e.target.dataset.index].answer = e.detail.value
-    this.setData({
-      questions: arr
-    })
-  },
-
-  updateFilter: function (e) {
-    var check0 = false
-    var check1 = false
-    for (let i = 0; i < e.detail.value.length; i++) {
-      if (e.detail.value[i] == 0) check0 = true
-      if (e.detail.value[i] == 1) check1 = true
-    }
-    this.setData({
-      notAnswered: check0,
-      answered: check1
-    })
-  },
-
-  saveQuestion: function (e) {
-    const db = wx.cloud.database()
-    db.collection("qaData").doc(e.target.dataset.id).update({
-      data: {
-        answer: e.target.dataset.answer,
-        answerTime: new Date()
-      },
-      success: function () {
-        wx.showToast({
-          title: "保存成功",
-        })
-      }
-    })
-  },
-
-  removeQuestion: function (e) {
-    wx.showModal({
-      content: "确认删除?",
-      success: function (res) {
-        if (res.confirm) {
-          const db = wx.cloud.database()
-          db.collection("qaData").doc(e.target.dataset.id).remove({
-            success: function () {
-              this.onLoad({
-                id: this.data.publisherId
-              })
-              wx.showToast({
-                title: "删除成功",
-              })
-            }.bind(this)
-          })
-        }
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      publisherId: options.id
-    })
-    const db = wx.cloud.database()
-    db.collection("qaData").where({
-      publisherId: this.data.publisherId,
-    }).orderBy("questionTime", "desc").get({
-      success: async function (res) {
-        let arr = []
-        for (let i = 0; i < res.data.length; i++) {
-          arr.push(db.collection("mainData").doc(res.data[i].activityId).get())
-        }
-        arr = await Promise.all(arr)
-        for (let i = 0; i < res.data.length; i++) {
-          res.data[i].title = arr[i].data.title
-        }
-        this.setData({
-          questions: res.data
-        })
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// miniprogram/pages/receivedQuestion/receivedQuestion.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    questions: [],
+    publisherId: "",
+    notAnswered: true,
+    answered: true
+  },
+
+  updateText: function (e) {
+    var arr = this.data.questions
+    arr[e.target.dataset.index].answer = e.detail.value
+    this.setData({
+      questions: arr
+    })
+  },
+
+  updateFilter: function (e) {
+    var check0 = false
+    var check1 = false
+    for (let i = 0; i < e.detail.value.length; i++) {
+      if (e.detail.value[i] == 0) check0 = true
+      if (e.detail.value[i] == 1) check1 = true
+    }
+    this.setData({
+      notAnswered: check0,
+      answered: check1
+    })
+  },
+
+  saveQuestion: function (e) {
+    const db = wx.cloud.database()
+    db.collection("qaData").doc(e.target.dataset.id).update({
+      data: {
+        answer: e.target.dataset.answer,
+        answerTime: new Date()
+      },
+      success: function () {
+        wx.showToast({
+          title: "保存成功",
+        })
+      }
+    })
+  },
+
+  removeQuestion: function (e) {
+    wx.showModal({
+      content: "确认删除?",
+      success: function (res) {
+        if (res.confirm) {
+          const db = wx.cloud.database()
+          db.collection("qaData").doc(e.target.dataset.id).remove({
+            success: function () {
+              this.onLoad({
+                id: this.data.publisherId
+              })
+              wx.showToast({
+                title: "删除成功",
+              })
+            }.bind(this)
+          })
+        }
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      publisherId: options.id
+    })
+    const db = wx.cloud.database()
+    db.collection("qaData").where({
+      publisherId: this.data.publisherId,
+    }).orderBy("questionTime", "desc").get({
+      success: async function (res) {
+        let arr = []
+        for (let i = 0; i < res.data.length; i++) {
+          arr.push(db.collection("mainData").doc(res.data[i].activityId).get())
+        }
+        arr = await Promise.all(arr)
+        for (let i = 0; i < res.data.length; i++) {
+          res.data[i].title = arr[i].data.title
+        }
+        this.setData({
+          questions: res.data
+        })
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/myQuestion/myQuestion.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 14 - 14
miniprogram/pages/myQuestion/myQuestion.wxml

@@ -1,14 +1,14 @@
-<!--为我的-我的提问页面-->
-<!--还未完成功能,仅有页面框架-->
-<view wx:if="{{questions.length == 0}}" class="title dark-primary-color-font" style="text-align: center;">这里空空如也</view>
-<view wx:for="{{questions}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
-  <view wx:if="{{notAnswered && item.answer == '' || answered && item.answer != ''}}" class="card">
-    <view class="title dark-primary-color-font">{{item.title}}</view>
-    <view class="question primary-text-color">提出的问题:{{item.question}}</view>
-    <view class="question primary-text-color">收到的回复:{{item.answer}}</view>
-    <textarea class="answer block-background-color" value="{{item.answer}}" placeholder="回复" data-index="{{index}}" bindinput="updateText"></textarea>
-    <view class="save-btn default-primary-color text-primary-color" data-id="{{item._id}}" data-answer="{{item.answer}}" bindtap="saveQuestion">保存</view>
-    <icon style="position: absolute; top: 0; right: 0;" type="cancel" size="20" data-id="{{item._id}}" catchtap="removeQuestion"></icon>
-  </view>
-</view>
-
+<!--为我的-我的提问页面-->
+<!--还未完成功能,仅有页面框架-->
+<view wx:if="{{questions.length == 0}}" class="title dark-primary-color-font" style="text-align: center;">这里空空如也</view>
+<view wx:for="{{questions}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
+  <view wx:if="{{notAnswered && item.answer == '' || answered && item.answer != ''}}" class="card">
+    <view class="title dark-primary-color-font">{{item.title}}</view>
+    <view class="question primary-text-color">提出的问题:{{item.question}}</view>
+    <view class="question primary-text-color">收到的回复:{{item.answer}}</view>
+    <textarea class="answer block-background-color" value="{{item.answer}}" placeholder="回复" data-index="{{index}}" bindinput="updateText"></textarea>
+    <view class="save-btn default-primary-color text-primary-color" data-id="{{item._id}}" data-answer="{{item.answer}}" bindtap="saveQuestion">保存</view>
+    <icon style="position: absolute; top: 0; right: 0;" type="cancel" size="20" data-id="{{item._id}}" catchtap="removeQuestion"></icon>
+  </view>
+</view>
+

+ 150 - 150
miniprogram/pages/opinion/opinion.js

@@ -1,151 +1,151 @@
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    currentTab:0,
-    winWidth:0,
-    winHeight:0,
-    inviteCode:"",
-    publisherName:"",
-    publisherContact:"",
-    publisherIntro:"",
-    publisherType:"",
-    publisherAvatar:[],
-    types:["校级", "园级", "院级"],
-    stars:["一星级", "二星级", "三星级", "四星级", "五星级"],
-  },
-
-  stopTouchMove:function(){
-    return false;
-  },
-
-  updateRadio:function(e){
-    this.setData({publisherType: e.detail.value})
-  },
-
-  updatePublishAvatar:function(e){
-    this.setData({publisherAvatar: e.detail.images})
-  },
-
-  switch1:function(e){
-    this.setData({currentTab:1})
-  },
-
-  switch2:function(e){
-    this.setData({currentTab:2})
-  },
-
-  switch3:function(e){
-    this.setData({currentTab:3})
-  },
-
-  switch4:function(e){
-    this.setData({currentTab:4})
-  },
-
-  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) {
-    wx.getSystemInfo({
-      success: function (res) {
-        this.setData({winWidth:res.windowWidth})
-        this.setData({winHeight:res.windowHeight})
-      }.bind(this),
-    })
-  },
-  
-  updatePage: function(e) {
-    this.setData({
-      currentTab: e.detail.current
-    })
-  }
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    currentTab:0,
+    winWidth:0,
+    winHeight:0,
+    inviteCode:"",
+    publisherName:"",
+    publisherContact:"",
+    publisherIntro:"",
+    publisherType:"",
+    publisherAvatar:[],
+    types:["校级", "园级", "院级"],
+    stars:["一星级", "二星级", "三星级", "四星级", "五星级"],
+  },
+
+  stopTouchMove:function(){
+    return false;
+  },
+
+  updateRadio:function(e){
+    this.setData({publisherType: e.detail.value})
+  },
+
+  updatePublishAvatar:function(e){
+    this.setData({publisherAvatar: e.detail.images})
+  },
+
+  switch1:function(e){
+    this.setData({currentTab:1})
+  },
+
+  switch2:function(e){
+    this.setData({currentTab:2})
+  },
+
+  switch3:function(e){
+    this.setData({currentTab:3})
+  },
+
+  switch4:function(e){
+    this.setData({currentTab:4})
+  },
+
+  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) {
+    wx.getSystemInfo({
+      success: function (res) {
+        this.setData({winWidth:res.windowWidth})
+        this.setData({winHeight:res.windowHeight})
+      }.bind(this),
+    })
+  },
+  
+  updatePage: function(e) {
+    this.setData({
+      currentTab: e.detail.current
+    })
+  }
 })

+ 4 - 4
miniprogram/pages/opinion/opinion.json

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

+ 86 - 86
miniprogram/pages/opinion/opinion.wxml

@@ -1,86 +1,86 @@
-<!--为我的-意见反馈页面-->
-
-<view class="con">
-  <view class="title2">请选择反馈类型</view>
-</view>
-<view class="subTitle">向开发者反馈</view>
-<view class="con">
-    <view class="buttons">
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch1">功能异常</button></view>
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">支付问题</button></view>
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">产品建议</button></view>
-    </view>
-</view>
-<view class="subTitle">向微信平台投诉</view>
-<view class="con">
-    <view class="buttons">
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch4">违规举报</button></view>
-    </view>
-</view>
-
-<view wx:if="{{currentTab == 1}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="con">
-    <view class="title2">请选择反馈内容</view>
-      <view class="buttons">
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_1">无法打开小程序</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_2">小程序闪退</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_3">卡顿</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_4">黑屏白屏</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_5">死机</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_6">界面错位</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_7">界面加载慢</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_8">其他异常</button></view>
-      </view>
-  </view>
-</view>
-
-<view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="con">
-    <view class="title2">请选择反馈内容</view>
-      <view class="buttons">
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_1">支付失败</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_2">支付成功未生效</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_3">退款问题</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_4">其他</button></view>
-      </view>
-  </view>
-</view>
-
-<view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="block">
-    <view class="cate">产品建议</view>:
-    <input class="input block-background-color" placeholder="请填写10个字以上的问题描述以便我们提供更好的帮助" model:value="{{inviteCode}}"/>
-  </view>
-  <view class="block2">
-    <view class="block22"><view class="cate">相关截图(选填)</view>:</view>
-    <imagePicker images="{{publisherAvatar}}" max="1" image-width="450" image-height="450" bindchange="updatePublishAvatar" />
-  </view>
-  <view class="block">
-    <view class="cate">联系方式</view>:
-    <input class="input block-background-color" placeholder="邮箱/手机号" model:value="{{publisherContact}}"/>
-  </view>
-  <button class="button dark-primary-color text-primary-color" bindtap="switchend">提交</button>
-</view>
-
-<view wx:if="{{currentTab == 4}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="con">
-    <view class="title2">请选择投诉原因</view>
-      <view class="buttons">
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_1">新冠肺炎疫情相关</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_2">se</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_3">卡顿</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_4">黑屏白屏</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_5">死机</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_6">界面错位</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_7">界面加载慢</button></view>
-        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_8">其他异常</button></view>
-      </view>
-  </view>
-</view>
-
-<view wx:if="{{currentTab == end}}" class="con">
-  <view class="con1 dark-primary-color-font">恭喜您完成填写!</view>
-  <image  class="pic" src="../../images/finish.png" mode="aspectFill"/>
-  <view class="con2">感谢您的入驻</view>
-  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser">返回</button>
-</view>
+<!--为我的-意见反馈页面-->
+
+<view class="con">
+  <view class="title2">请选择反馈类型</view>
+</view>
+<view class="subTitle">向开发者反馈</view>
+<view class="con">
+    <view class="buttons">
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch1">功能异常</button></view>
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">支付问题</button></view>
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">产品建议</button></view>
+    </view>
+</view>
+<view class="subTitle">向微信平台投诉</view>
+<view class="con">
+    <view class="buttons">
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch4">违规举报</button></view>
+    </view>
+</view>
+
+<view wx:if="{{currentTab == 1}}" scroll-y style="height: {{winHeight - 60}}px;">
+  <view class="con">
+    <view class="title2">请选择反馈内容</view>
+      <view class="buttons">
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_1">无法打开小程序</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_2">小程序闪退</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_3">卡顿</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_4">黑屏白屏</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_5">死机</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_6">界面错位</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_7">界面加载慢</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch1_8">其他异常</button></view>
+      </view>
+  </view>
+</view>
+
+<view wx:if="{{currentTab == 2}}" scroll-y style="height: {{winHeight - 60}}px;">
+  <view class="con">
+    <view class="title2">请选择反馈内容</view>
+      <view class="buttons">
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_1">支付失败</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_2">支付成功未生效</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_3">退款问题</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch2_4">其他</button></view>
+      </view>
+  </view>
+</view>
+
+<view wx:if="{{currentTab == 3}}" scroll-y style="height: {{winHeight - 60}}px;">
+  <view class="block">
+    <view class="cate">产品建议</view>:
+    <input class="input block-background-color" placeholder="请填写10个字以上的问题描述以便我们提供更好的帮助" model:value="{{inviteCode}}"/>
+  </view>
+  <view class="block2">
+    <view class="block22"><view class="cate">相关截图(选填)</view>:</view>
+    <imagePicker images="{{publisherAvatar}}" max="1" image-width="450" image-height="450" bindchange="updatePublishAvatar" />
+  </view>
+  <view class="block">
+    <view class="cate">联系方式</view>:
+    <input class="input block-background-color" placeholder="邮箱/手机号" model:value="{{publisherContact}}"/>
+  </view>
+  <button class="button dark-primary-color text-primary-color" bindtap="switchend">提交</button>
+</view>
+
+<view wx:if="{{currentTab == 4}}" scroll-y style="height: {{winHeight - 60}}px;">
+  <view class="con">
+    <view class="title2">请选择投诉原因</view>
+      <view class="buttons">
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_1">新冠肺炎疫情相关</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_2">se</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_3">卡顿</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_4">黑屏白屏</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_5">死机</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_6">界面错位</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_7">界面加载慢</button></view>
+        <view><button class="button dark-primary-color text-primary-color" bindtap="switch4_8">其他异常</button></view>
+      </view>
+  </view>
+</view>
+
+<view wx:if="{{currentTab == end}}" class="con">
+  <view class="con1 dark-primary-color-font">恭喜您完成填写!</view>
+  <image  class="pic" src="../../images/finish.png" mode="aspectFill"/>
+  <view class="con2">感谢您的入驻</view>
+  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser">返回</button>
+</view>

+ 186 - 186
miniprogram/pages/publisher/publisher.js

@@ -1,187 +1,187 @@
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    publisherInfo: [],
-    mainDatas: [],
-    like: -1,
-    likeEnable: true
-  },
-
-  handleDate: function(date) {
-    var now = new Date().getTime()
-    var diffValue = now - date.getTime()
-    if (diffValue < 0) {
-      console.log("时间不同步")
-      return "刚刚"
-    }
-    var result = ""
-    var minute = 1000 * 60
-    var hour = minute * 60
-    var day = hour * 24
-    var minC = diffValue / minute
-    var hourC = diffValue / hour
-    var dayC = diffValue / day
-    if (parseInt(dayC) > 30) {
-      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
-    } else if (parseInt(dayC) > 1) {
-      result += parseInt(dayC) + "天前"
-    } else if (parseInt(dayC) == 1) {
-      result += "昨天"
-    } else if (hourC >= 1) {
-      result += parseInt(hourC) + "小时前"
-    } else if (minC >= 5) {
-      result += parseInt(minC) + "分钟前"
-    } else {
-      result += "刚刚"
-    }
-    return result
-  },
-
-  processData: function (start, arr) {
-    for (let i = start; i < arr.length; i++) {
-      arr[i].time = this.handleDate(arr[i].time)
-    }
-    this.setData({
-      mainDatas: arr
-    })
-    wx.hideLoading()
-  },
-
-  toggleLike: function () {
-    if (!this.data.likeEnable) return
-    this.setData({
-      likeEnable: false
-    })
-    const db = wx.cloud.database()
-    if (this.data.like == 0) {
-      db.collection("likeData").add({
-        data: {
-          type: "publisher",
-          id: this.data.publisherInfo._id
-        },
-        success: function() {
-          this.setData({
-            like: 1,
-            likeEnable: true
-          })
-          wx.showToast({
-            title: "已关注",
-          })
-        }.bind(this),
-        fail: function() {
-          wx.showToast({
-            title: "网络错误",
-            icon: "none"
-          })
-        }
-      })
-    } else {
-      db.collection("likeData").where({
-        type: "publisher",
-        id: this.data.publisherInfo._id
-      }).remove({
-        success: function() {
-          this.setData({
-            like: 0,
-            likeEnable: true
-          })
-          wx.showToast({
-            title: "已取消关注",
-          })
-        }.bind(this),
-        fail: function() {
-          wx.showToast({
-            title: "网络错误",
-            icon: "none"
-          })
-        }
-      })
-    }
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    wx.showLoading({
-      title: "加载中"
-    })
-    const db = wx.cloud.database()
-    db.collection("publisherInfoData").doc(options.id).get({
-      success: function (res) {
-        this.setData({
-          publisherInfo: res.data
-        })
-        db.collection("mainData").where({
-          publisherName: this.data.publisherInfo.publisherName
-        }).orderBy("time", "desc").limit(20).get({
-          success: function (res) {
-            this.processData(0, res.data)
-          }.bind(this)
-        })
-      }.bind(this)
-    })
-    db.collection("likeData").where({
-      type: "publisher",
-      id: options.id
-    }).get({
-      success: function(res) {
-        this.setData({
-          like: res.data.length
-        })
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    publisherInfo: [],
+    mainDatas: [],
+    like: -1,
+    likeEnable: true
+  },
+
+  handleDate: function(date) {
+    var now = new Date().getTime()
+    var diffValue = now - date.getTime()
+    if (diffValue < 0) {
+      console.log("时间不同步")
+      return "刚刚"
+    }
+    var result = ""
+    var minute = 1000 * 60
+    var hour = minute * 60
+    var day = hour * 24
+    var minC = diffValue / minute
+    var hourC = diffValue / hour
+    var dayC = diffValue / day
+    if (parseInt(dayC) > 30) {
+      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
+    } else if (parseInt(dayC) > 1) {
+      result += parseInt(dayC) + "天前"
+    } else if (parseInt(dayC) == 1) {
+      result += "昨天"
+    } else if (hourC >= 1) {
+      result += parseInt(hourC) + "小时前"
+    } else if (minC >= 5) {
+      result += parseInt(minC) + "分钟前"
+    } else {
+      result += "刚刚"
+    }
+    return result
+  },
+
+  processData: function (start, arr) {
+    for (let i = start; i < arr.length; i++) {
+      arr[i].time = this.handleDate(arr[i].time)
+    }
+    this.setData({
+      mainDatas: arr
+    })
+    wx.hideLoading()
+  },
+
+  toggleLike: function () {
+    if (!this.data.likeEnable) return
+    this.setData({
+      likeEnable: false
+    })
+    const db = wx.cloud.database()
+    if (this.data.like == 0) {
+      db.collection("likeData").add({
+        data: {
+          type: "publisher",
+          id: this.data.publisherInfo._id
+        },
+        success: function() {
+          this.setData({
+            like: 1,
+            likeEnable: true
+          })
+          wx.showToast({
+            title: "已关注",
+          })
+        }.bind(this),
+        fail: function() {
+          wx.showToast({
+            title: "网络错误",
+            icon: "none"
+          })
+        }
+      })
+    } else {
+      db.collection("likeData").where({
+        type: "publisher",
+        id: this.data.publisherInfo._id
+      }).remove({
+        success: function() {
+          this.setData({
+            like: 0,
+            likeEnable: true
+          })
+          wx.showToast({
+            title: "已取消关注",
+          })
+        }.bind(this),
+        fail: function() {
+          wx.showToast({
+            title: "网络错误",
+            icon: "none"
+          })
+        }
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.showLoading({
+      title: "加载中"
+    })
+    const db = wx.cloud.database()
+    db.collection("publisherInfoData").doc(options.id).get({
+      success: function (res) {
+        this.setData({
+          publisherInfo: res.data
+        })
+        db.collection("mainData").where({
+          publisherName: this.data.publisherInfo.publisherName
+        }).orderBy("time", "desc").limit(20).get({
+          success: function (res) {
+            this.processData(0, res.data)
+          }.bind(this)
+        })
+      }.bind(this)
+    })
+    db.collection("likeData").where({
+      type: "publisher",
+      id: options.id
+    }).get({
+      success: function(res) {
+        this.setData({
+          like: res.data.length
+        })
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 4 - 4
miniprogram/pages/publisher/publisher.json

@@ -1,5 +1,5 @@
-{
-  "usingComponents": {
-    "itemCard":"/components/itemPublisher/itemPublisher"
-  }
+{
+  "usingComponents": {
+    "itemCard":"/components/itemPublisher/itemPublisher"
+  }
 }

+ 24 - 24
miniprogram/pages/publisher/publisher.wxml

@@ -1,24 +1,24 @@
-<!-- 为发布者具体页面 含component:itemPublisher;data:publisherInfoData.js mainData.js -->
-<view class="top">
-  <view class="publisher  block-background-color" >
-    <view class="brief-info light-primary-color">
-      <image class="publisher-avatar" src="{{publisherInfo.publisherAvatar}}" mode="aspectFill"/>
-      <view class="brief-info-right">
-        <view class="publisher-name default-primary-color-font">{{publisherInfo.publisherName}}</view>
-        <view class="brief-info-right-below">
-          <view class="publisher-attribute accent-color text-primary-color">{{publisherInfo.publisherAttribute}}</view>
-          <image wx:if="{{like != -1}}" class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" bindtap="toggleLike"/>
-        </view>
-      </view>
-    </view>
-    <view class="detailed-info">
-      <view class="publisher-intro"><text class="b">简介:</text>{{publisherInfo.publisherIntro}}</view>
-      <view class="publisher-contact">{{publisherInfo.publisherContact}}</view>
-    </view>
-  </view>
-</view>
-<view class="page">
-  <view class="card" wx:for="{{mainDatas}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
-    <itemCard item="{{item}}"/>
-  </view>
-</view>
+<!-- 为发布者具体页面 含component:itemPublisher;data:publisherInfoData.js mainData.js -->
+<view class="top">
+  <view class="publisher  block-background-color" >
+    <view class="brief-info light-primary-color">
+      <image class="publisher-avatar" src="{{publisherInfo.publisherAvatar}}" mode="aspectFill"/>
+      <view class="brief-info-right">
+        <view class="publisher-name default-primary-color-font">{{publisherInfo.publisherName}}</view>
+        <view class="brief-info-right-below">
+          <view class="publisher-attribute accent-color text-primary-color">{{publisherInfo.publisherAttribute}}</view>
+          <image wx:if="{{like != -1}}" class="like" src="/images/like/{{like ? 'heart' : 'hollowheart'}}.png" bindtap="toggleLike"/>
+        </view>
+      </view>
+    </view>
+    <view class="detailed-info">
+      <view class="publisher-intro"><text class="b">简介:</text>{{publisherInfo.publisherIntro}}</view>
+      <view class="publisher-contact">{{publisherInfo.publisherContact}}</view>
+    </view>
+  </view>
+</view>
+<view class="page">
+  <view class="card" wx:for="{{mainDatas}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
+    <itemCard item="{{item}}"/>
+  </view>
+</view>

+ 65 - 65
miniprogram/pages/publisherInfoChange/publisherInfoChange.js

@@ -1,66 +1,66 @@
-// miniprogram/pages/publisherInfoChange/publisherInfoChange.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// miniprogram/pages/publisherInfoChange/publisherInfoChange.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/publisherInfoChange/publisherInfoChange.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 2 - 2
miniprogram/pages/publisherInfoChange/publisherInfoChange.wxml

@@ -1,2 +1,2 @@
-<!--为发布者信息更改页面-->
-<text>miniprogram/pages/publisherInfoChange/publisherInfoChange.wxml</text>
+<!--为发布者信息更改页面-->
+<text>miniprogram/pages/publisherInfoChange/publisherInfoChange.wxml</text>

+ 146 - 146
miniprogram/pages/publisherLogin/publisherLogin.js

@@ -1,147 +1,147 @@
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    currentTab:0,
-    winWidth:0,
-    winHeight:0,
-    inviteCode:"",
-    publisherName:"",
-    publisherContact:"",
-    publisherIntro:"",
-    publisherType:"",
-    publisherAvatar:[],
-    types:["校级", "园级", "院级"],
-    stars:["一星级", "二星级", "三星级", "四星级", "五星级"],
-  },
-
-  stopTouchMove:function(){
-    return false;
-  },
-
-  updateRadio:function(e){
-    this.setData({publisherType: e.detail.value})
-  },
-
-  updatePublishAvatar:function(e){
-    this.setData({publisherAvatar: e.detail.images})
-  },
-
-  switch1:function(e){
-    this.setData({currentTab:1})
-  },
-
-  switch2:function(e){
-    this.setData({currentTab:2})
-  },
-
-  switch3:function(e){
-    this.setData({currentTab:3})
-  },
-
-  switch4: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:4})
-                                wx.hideLoading()
-                              }.bind(this)
-                            })
-                          }.bind(this)
-                        })
-                      }.bind(this)
-                    })
-                  }.bind(this)
-                })
-              }.bind(this)
-            })
-          }.bind(this)
-        })
-      }.bind(this)
-    })
-  },
-
-  returnToUser:function(e){
-    wx.navigateBack()
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (e) {
-    wx.getSystemInfo({
-      success: function (res) {
-        this.setData({winWidth:res.windowWidth})
-        this.setData({winHeight:res.windowHeight})
-      }.bind(this),
-    })
-  },
-  
-  updatePage: function(e) {
-    this.setData({
-      currentTab: e.detail.current
-    })
-  }
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    currentTab:0,
+    winWidth:0,
+    winHeight:0,
+    inviteCode:"",
+    publisherName:"",
+    publisherContact:"",
+    publisherIntro:"",
+    publisherType:"",
+    publisherAvatar:[],
+    types:["校级", "园级", "院级"],
+    stars:["一星级", "二星级", "三星级", "四星级", "五星级"],
+  },
+
+  stopTouchMove:function(){
+    return false;
+  },
+
+  updateRadio:function(e){
+    this.setData({publisherType: e.detail.value})
+  },
+
+  updatePublishAvatar:function(e){
+    this.setData({publisherAvatar: e.detail.images})
+  },
+
+  switch1:function(e){
+    this.setData({currentTab:1})
+  },
+
+  switch2:function(e){
+    this.setData({currentTab:2})
+  },
+
+  switch3:function(e){
+    this.setData({currentTab:3})
+  },
+
+  switch4: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:4})
+                                wx.hideLoading()
+                              }.bind(this)
+                            })
+                          }.bind(this)
+                        })
+                      }.bind(this)
+                    })
+                  }.bind(this)
+                })
+              }.bind(this)
+            })
+          }.bind(this)
+        })
+      }.bind(this)
+    })
+  },
+
+  returnToUser:function(e){
+    wx.navigateBack()
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (e) {
+    wx.getSystemInfo({
+      success: function (res) {
+        this.setData({winWidth:res.windowWidth})
+        this.setData({winHeight:res.windowHeight})
+      }.bind(this),
+    })
+  },
+  
+  updatePage: function(e) {
+    this.setData({
+      currentTab: e.detail.current
+    })
+  }
 })

+ 4 - 4
miniprogram/pages/publisherLogin/publisherLogin.json

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

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

@@ -1,106 +1,106 @@
-<!--为社团/组织入驻页面-->
-<view class="title dark-primary-color-font">社团/组织入驻</view>
-
-<scroll-view wx:if="{{currentTab == 0}}" scroll-y style="height: {{winHeight - 60}}px;">
-  <view class="subTitle default-primary-color-font">社团/组织如何注册入驻?</view>
-  <view class="thirdTitle">1、前提条件</view>
-  <view class="text">浙江大学社团/学生组织的负责人代表社团/学生组织进行入驻登记。</view>
-  <view class="thirdTitle">2、输入邀请码</view>
-  <view class="text">社团/组织可以通过社联或学生会获取邀请码,邀请码仅可使用一次。</view>
-  <view class="thirdTitle">3、填写基本资料</view>
-  <view class="text">在注册页面如实填写所在社团/学生组织的基本资料。</view>
-  <view class="thirdTitle">4、入驻成功</view>
-  <view class="text">填写完成后,相应的社团/组织管理功能将开启。</view>
-
-  <view class="subTitle default-primary-color-font">社团/组织成功入驻,我可以:</view>
-  <view class="thirdTitle">1、发布活动</view>
-  <view class="text">发布近期召开的活动,招纳活动参与者,扩大活动影响力和宣传范围。</view>
-  <view class="thirdTitle">2、发布通知</view>
-  <view class="text">及时传达给同学们学校正在发生的大小事,保证时效性。</view>
-  <view class="thirdTitle">3、发布纳新</view>
-  <view class="text">在纳新季确保同学们能够看到每一个社团/学生组织的纳新信息。</view>
-  <view class="thirdTitle">4、与参加活动的同学私信交流</view>
-  <view class="text">一键通知面试时间、面试结果、活动招募情况,再也不用手动发送信息了。</view>
-  <button class="button dark-primary-color text-primary-color" bindtap="switch1">一键入驻</button>
-</scroll-view>
-
-<view wx:if="{{currentTab == 1}}" class="con">
-  <view class="title2">请问您入驻的类型是?</view>
-    <view class="buttons">
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">组织</button></view>
-      <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">社团</button></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="updateRadio">
-      <label wx:for="{{types}}" wx:for-item="item" wx:key="*this">
-        <radio class="radio" value="{{item}}" color="#3F51B5">{{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="updatePublishAvatar" />
-  </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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
-</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="updateRadio">
-      <label wx:for="{{stars}}" wx:for-item="item" wx:key="*this">
-        <radio class="radio" value="{{item}}" color="#3F51B5">{{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="updatePublishAvatar" />
-  </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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
-</scroll-view>
-
-<view wx:if="{{currentTab == 4}}" class="con">
-  <view class="con1 dark-primary-color-font">恭喜您完成填写!</view>
-  <image  class="pic" src="../../images/finish.png" mode="aspectFill"/>
-  <view class="con2">感谢您的入驻</view>
-  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser">返回</button>
-</view>
+<!--为社团/组织入驻页面-->
+<view class="title dark-primary-color-font">社团/组织入驻</view>
+
+<scroll-view wx:if="{{currentTab == 0}}" scroll-y style="height: {{winHeight - 60}}px;">
+  <view class="subTitle default-primary-color-font">社团/组织如何注册入驻?</view>
+  <view class="thirdTitle">1、前提条件</view>
+  <view class="text">浙江大学社团/学生组织的负责人代表社团/学生组织进行入驻登记。</view>
+  <view class="thirdTitle">2、输入邀请码</view>
+  <view class="text">社团/组织可以通过社联或学生会获取邀请码,邀请码仅可使用一次。</view>
+  <view class="thirdTitle">3、填写基本资料</view>
+  <view class="text">在注册页面如实填写所在社团/学生组织的基本资料。</view>
+  <view class="thirdTitle">4、入驻成功</view>
+  <view class="text">填写完成后,相应的社团/组织管理功能将开启。</view>
+
+  <view class="subTitle default-primary-color-font">社团/组织成功入驻,我可以:</view>
+  <view class="thirdTitle">1、发布活动</view>
+  <view class="text">发布近期召开的活动,招纳活动参与者,扩大活动影响力和宣传范围。</view>
+  <view class="thirdTitle">2、发布通知</view>
+  <view class="text">及时传达给同学们学校正在发生的大小事,保证时效性。</view>
+  <view class="thirdTitle">3、发布纳新</view>
+  <view class="text">在纳新季确保同学们能够看到每一个社团/学生组织的纳新信息。</view>
+  <view class="thirdTitle">4、与参加活动的同学私信交流</view>
+  <view class="text">一键通知面试时间、面试结果、活动招募情况,再也不用手动发送信息了。</view>
+  <button class="button dark-primary-color text-primary-color" bindtap="switch1">一键入驻</button>
+</scroll-view>
+
+<view wx:if="{{currentTab == 1}}" class="con">
+  <view class="title2">请问您入驻的类型是?</view>
+    <view class="buttons">
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch2">组织</button></view>
+      <view><button class="button dark-primary-color text-primary-color" bindtap="switch3">社团</button></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="updateRadio">
+      <label wx:for="{{types}}" wx:for-item="item" wx:key="*this">
+        <radio class="radio" value="{{item}}" color="#3F51B5">{{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="updatePublishAvatar" />
+  </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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
+</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="updateRadio">
+      <label wx:for="{{stars}}" wx:for-item="item" wx:key="*this">
+        <radio class="radio" value="{{item}}" color="#3F51B5">{{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="updatePublishAvatar" />
+  </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 dark-primary-color text-primary-color" bindtap="switch4">提交</button>
+</scroll-view>
+
+<view wx:if="{{currentTab == 4}}" class="con">
+  <view class="con1 dark-primary-color-font">恭喜您完成填写!</view>
+  <image  class="pic" src="../../images/finish.png" mode="aspectFill"/>
+  <view class="con2">感谢您的入驻</view>
+  <button class="button dark-primary-color text-primary-color" bindtap="returnToUser">返回</button>
+</view>

+ 104 - 104
miniprogram/pages/publisherPage/publisherPage.js

@@ -1,105 +1,105 @@
-// miniprogram/pages/publisherPage/publisherPage.js
-const app = getApp()
-
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    publisherInfo: null,
-    hasPublisherInfo: false
-  },
-
-  publishInfo: function () {
-    wx.navigateTo({
-      url: "/pages/activityPublish/activityPublish?id=" + this.data.publisherInfo._id,
-    })
-  },
-
-  receivedQuestion: function () {
-    wx.navigateTo({
-      url: "/pages/receivedQuestion/receivedQuestion?id=" + this.data.publisherInfo._id
-    })
-  },
-
-  publisherInfoChange: function () {
-    wx.navigateTo({
-      url: "/pages/publisherInfoChange/publisherInfoChange?id=" + this.data.publisherInfo._id
-    })
-  },
-
-  administratorSetting: function () {
-    wx.navigateTo({
-      url: "/pages/administratorSetting/administratorSetting?id=" + this.data.publisherInfo._id
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    wx.showLoading({
-      title: "加载中",
-    })
-    const db = wx.cloud.database()
-    db.collection("publisherInfoData").doc(options.id).get({
-      success: function (res) {
-        this.setData({
-          publisherInfo: res.data,
-          hasPublisherInfo: true
-        })
-        wx.hideLoading()
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// miniprogram/pages/publisherPage/publisherPage.js
+const app = getApp()
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    publisherInfo: null,
+    hasPublisherInfo: false
+  },
+
+  publishInfo: function () {
+    wx.navigateTo({
+      url: "/pages/activityPublish/activityPublish?id=" + this.data.publisherInfo._id,
+    })
+  },
+
+  receivedQuestion: function () {
+    wx.navigateTo({
+      url: "/pages/receivedQuestion/receivedQuestion?id=" + this.data.publisherInfo._id
+    })
+  },
+
+  publisherInfoChange: function () {
+    wx.navigateTo({
+      url: "/pages/publisherInfoChange/publisherInfoChange?id=" + this.data.publisherInfo._id
+    })
+  },
+
+  administratorSetting: function () {
+    wx.navigateTo({
+      url: "/pages/administratorSetting/administratorSetting?id=" + this.data.publisherInfo._id
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    wx.showLoading({
+      title: "加载中",
+    })
+    const db = wx.cloud.database()
+    db.collection("publisherInfoData").doc(options.id).get({
+      success: function (res) {
+        this.setData({
+          publisherInfo: res.data,
+          hasPublisherInfo: true
+        })
+        wx.hideLoading()
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/publisherPage/publisherPage.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 44 - 44
miniprogram/pages/publisherPage/publisherPage.wxml

@@ -1,45 +1,45 @@
-<!-- 为发布者个人页面 -->
-<view class="card block-background-color">
-  <cover-image class="avatar" src="{{hasPublisherInfo ? publisherInfo.publisherAvatar : '/images/user/user.png'}}"></cover-image>
-  <view wx:if="{{hasPublisherInfo}}" class="publisher-name primary-text">{{publisherInfo.publisherName}}</view>
-</view>
-
-<view class="gap"></view>
-
-<view class="btn block-background-color" hover-class="btn-hover" bindtap="publishInfo">
-  <image class="btn-icon" mode="aspectFit" src="/images/user/publish1.png"></image>
-  <view class="btn-text primary-text">发布消息</view>
-  <view class="btn-arrow secondary-text">></view>
-</view>
-
-<view class="line"></view>
-
-<view class="btn block-background-color" hover-class="btn-hover" bindtap="myPublish">
-  <image class="btn-icon" mode="aspectFit" src="/images/user/publish2.png"></image>
-  <view class="btn-text primary-text">我发布的消息</view>
-  <view class="btn-arrow secondary-text">></view>
-</view>
-
-<view class="line"></view>
-
-<view class="btn block-background-color" hover-class="btn-hover" bindtap="receivedQuestion">
-  <image class="btn-icon" mode="aspectFit" src="/images/user/question.png"></image>
-  <view class="btn-text primary-text">我收到的问题</view>
-  <view class="btn-arrow secondary-text">></view>
-</view>
-
-<view class="gap"></view>
-
-<view class="btn block-background-color" hover-class="btn-hover" bindtap="administratorSetting">
-  <image class="btn-icon" mode="aspectFit" src="/images/user/setting.png"></image>
-  <view class="btn-text primary-text">管理员资格设置</view>
-  <view class="btn-arrow secondary-text">></view>
-</view>
-
-<view class="line"></view>
-
-<view class="btn block-background-color" hover-class="btn-hover" bindtap="publisherInfoChange">
-  <image class="btn-icon" mode="aspectFit" src="/images/user/modify.png"></image>
-  <view class="btn-text primary-text">组织信息修改</view>
-  <view class="btn-arrow secondary-text">></view>
+<!-- 为发布者个人页面 -->
+<view class="card block-background-color">
+  <cover-image class="avatar" src="{{hasPublisherInfo ? publisherInfo.publisherAvatar : '/images/user/user.png'}}"></cover-image>
+  <view wx:if="{{hasPublisherInfo}}" class="publisher-name primary-text">{{publisherInfo.publisherName}}</view>
+</view>
+
+<view class="gap"></view>
+
+<view class="btn block-background-color" hover-class="btn-hover" bindtap="publishInfo">
+  <image class="btn-icon" mode="aspectFit" src="/images/user/publish1.png"></image>
+  <view class="btn-text primary-text">发布消息</view>
+  <view class="btn-arrow secondary-text">></view>
+</view>
+
+<view class="line"></view>
+
+<view class="btn block-background-color" hover-class="btn-hover" bindtap="myPublish">
+  <image class="btn-icon" mode="aspectFit" src="/images/user/publish2.png"></image>
+  <view class="btn-text primary-text">我发布的消息</view>
+  <view class="btn-arrow secondary-text">></view>
+</view>
+
+<view class="line"></view>
+
+<view class="btn block-background-color" hover-class="btn-hover" bindtap="receivedQuestion">
+  <image class="btn-icon" mode="aspectFit" src="/images/user/question.png"></image>
+  <view class="btn-text primary-text">我收到的问题</view>
+  <view class="btn-arrow secondary-text">></view>
+</view>
+
+<view class="gap"></view>
+
+<view class="btn block-background-color" hover-class="btn-hover" bindtap="administratorSetting">
+  <image class="btn-icon" mode="aspectFit" src="/images/user/setting.png"></image>
+  <view class="btn-text primary-text">管理员资格设置</view>
+  <view class="btn-arrow secondary-text">></view>
+</view>
+
+<view class="line"></view>
+
+<view class="btn block-background-color" hover-class="btn-hover" bindtap="publisherInfoChange">
+  <image class="btn-icon" mode="aspectFit" src="/images/user/modify.png"></image>
+  <view class="btn-text primary-text">组织信息修改</view>
+  <view class="btn-arrow secondary-text">></view>
 </view>

+ 145 - 145
miniprogram/pages/receivedQuestion/receivedQuestion.js

@@ -1,146 +1,146 @@
-// miniprogram/pages/receivedQuestion/receivedQuestion.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    questions: [],
-    publisherId: "",
-    notAnswered: true,
-    answered: true
-  },
-
-  updateText: function (e) {
-    var arr = this.data.questions
-    arr[e.target.dataset.index].answer = e.detail.value
-    this.setData({
-      questions: arr
-    })
-  },
-
-  updateFilter: function (e) {
-    var check0 = false
-    var check1 = false
-    for (let i = 0; i < e.detail.value.length; i++) {
-      if (e.detail.value[i] == 0) check0 = true
-      if (e.detail.value[i] == 1) check1 = true
-    }
-    this.setData({
-      notAnswered: check0,
-      answered: check1
-    })
-  },
-
-  saveQuestion: function (e) {
-    const db = wx.cloud.database()
-    db.collection("qaData").doc(e.target.dataset.id).update({
-      data: {
-        answer: e.target.dataset.answer,
-        answerTime: new Date()
-      },
-      success: function () {
-        wx.showToast({
-          title: "保存成功",
-        })
-      }
-    })
-  },
-
-  removeQuestion: function (e) {
-    wx.showModal({
-      content: "确认删除?",
-      success: function (res) {
-        if (res.confirm) {
-          const db = wx.cloud.database()
-          db.collection("qaData").doc(e.target.dataset.id).remove({
-            success: function () {
-              this.onLoad({
-                id: this.data.publisherId
-              })
-              wx.showToast({
-                title: "删除成功",
-              })
-            }.bind(this)
-          })
-        }
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      publisherId: options.id
-    })
-    const db = wx.cloud.database()
-    db.collection("qaData").where({
-      publisherId: this.data.publisherId,
-    }).orderBy("questionTime", "desc").get({
-      success: async function (res) {
-        let arr = []
-        for (let i = 0; i < res.data.length; i++) {
-          arr.push(db.collection("mainData").doc(res.data[i].activityId).get())
-        }
-        arr = await Promise.all(arr)
-        for (let i = 0; i < res.data.length; i++) {
-          res.data[i].title = arr[i].data.title
-        }
-        this.setData({
-          questions: res.data
-        })
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
+// miniprogram/pages/receivedQuestion/receivedQuestion.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    questions: [],
+    publisherId: "",
+    notAnswered: true,
+    answered: true
+  },
+
+  updateText: function (e) {
+    var arr = this.data.questions
+    arr[e.target.dataset.index].answer = e.detail.value
+    this.setData({
+      questions: arr
+    })
+  },
+
+  updateFilter: function (e) {
+    var check0 = false
+    var check1 = false
+    for (let i = 0; i < e.detail.value.length; i++) {
+      if (e.detail.value[i] == 0) check0 = true
+      if (e.detail.value[i] == 1) check1 = true
+    }
+    this.setData({
+      notAnswered: check0,
+      answered: check1
+    })
+  },
+
+  saveQuestion: function (e) {
+    const db = wx.cloud.database()
+    db.collection("qaData").doc(e.target.dataset.id).update({
+      data: {
+        answer: e.target.dataset.answer,
+        answerTime: new Date()
+      },
+      success: function () {
+        wx.showToast({
+          title: "保存成功",
+        })
+      }
+    })
+  },
+
+  removeQuestion: function (e) {
+    wx.showModal({
+      content: "确认删除?",
+      success: function (res) {
+        if (res.confirm) {
+          const db = wx.cloud.database()
+          db.collection("qaData").doc(e.target.dataset.id).remove({
+            success: function () {
+              this.onLoad({
+                id: this.data.publisherId
+              })
+              wx.showToast({
+                title: "删除成功",
+              })
+            }.bind(this)
+          })
+        }
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      publisherId: options.id
+    })
+    const db = wx.cloud.database()
+    db.collection("qaData").where({
+      publisherId: this.data.publisherId,
+    }).orderBy("questionTime", "desc").get({
+      success: async function (res) {
+        let arr = []
+        for (let i = 0; i < res.data.length; i++) {
+          arr.push(db.collection("mainData").doc(res.data[i].activityId).get())
+        }
+        arr = await Promise.all(arr)
+        for (let i = 0; i < res.data.length; i++) {
+          res.data[i].title = arr[i].data.title
+        }
+        this.setData({
+          questions: res.data
+        })
+      }.bind(this)
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 2 - 2
miniprogram/pages/receivedQuestion/receivedQuestion.json

@@ -1,3 +1,3 @@
-{
-  "usingComponents": {}
+{
+  "usingComponents": {}
 }

+ 15 - 15
miniprogram/pages/receivedQuestion/receivedQuestion.wxml

@@ -1,15 +1,15 @@
-<!--为发布者-我收到的问题页面-->
-<view wx:if="{{questions.length == 0}}" class="title dark-primary-color-font" style="text-align: center;">这里空空如也</view>
-<checkbox-group wx:if="{{questions.length != 0}}" class="checkbox-group" bindchange="updateFilter">
-  <view><checkbox class="checkbox" value="0" checked color="#3F51B5">未回答</checkbox></view>
-  <view><checkbox class="checkbox" value="1" checked color="#3F51B5">已回答</checkbox></view>
-</checkbox-group>
-<view wx:for="{{questions}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
-  <view wx:if="{{notAnswered && item.answer == '' || answered && item.answer != ''}}" class="card">
-    <view class="title dark-primary-color-font">{{item.title}}</view>
-    <view class="question primary-text-color">问:{{item.question}}</view>
-    <textarea class="answer block-background-color" value="{{item.answer}}" placeholder="填写回答" data-index="{{index}}" bindinput="updateText"></textarea>
-    <view class="save-btn default-primary-color text-primary-color" data-id="{{item._id}}" data-answer="{{item.answer}}" bindtap="saveQuestion">保存</view>
-    <icon style="position: absolute; top: 0; right: 0;" type="cancel" size="20" data-id="{{item._id}}" catchtap="removeQuestion"></icon>
-  </view>
-</view>
+<!--为发布者-我收到的问题页面-->
+<view wx:if="{{questions.length == 0}}" class="title dark-primary-color-font" style="text-align: center;">这里空空如也</view>
+<checkbox-group wx:if="{{questions.length != 0}}" class="checkbox-group" bindchange="updateFilter">
+  <view><checkbox class="checkbox" value="0" checked color="#3F51B5">未回答</checkbox></view>
+  <view><checkbox class="checkbox" value="1" checked color="#3F51B5">已回答</checkbox></view>
+</checkbox-group>
+<view wx:for="{{questions}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
+  <view wx:if="{{notAnswered && item.answer == '' || answered && item.answer != ''}}" class="card">
+    <view class="title dark-primary-color-font">{{item.title}}</view>
+    <view class="question primary-text-color">问:{{item.question}}</view>
+    <textarea class="answer block-background-color" value="{{item.answer}}" placeholder="填写回答" data-index="{{index}}" bindinput="updateText"></textarea>
+    <view class="save-btn default-primary-color text-primary-color" data-id="{{item._id}}" data-answer="{{item.answer}}" bindtap="saveQuestion">保存</view>
+    <icon style="position: absolute; top: 0; right: 0;" type="cancel" size="20" data-id="{{item._id}}" catchtap="removeQuestion"></icon>
+  </view>
+</view>

+ 234 - 234
miniprogram/pages/search/search.js

@@ -1,235 +1,235 @@
-var hotTagData = require("../../data/hotTagData.js")
-var hotBarData = require("../../data/hotBarData.js")
-
-Page({
-  options: {
-    styleIsolation: "apply-shared"
-  },
-
-  // 页面的初始数据
-  data: {
-    toggleEnable: true,
-    searchEnable: false,
-    searchText: "",
-    hotTagData: [],
-    hotBarData: [],
-    searchResult: [],
-    searchHistory: []
-  },
-
-  onLoad: function () {
-    wx.getStorage({
-      key: "searchHistory",
-      success: function (res) {
-        this.setData({
-          searchHistory: res.data
-        })
-      }.bind(this)
-    })
-    const db = wx.cloud.database()
-    db.collection("searchData").orderBy("time", "desc").limit(20).get({
-      success: function (res) {
-        var count = {}, hotTag = []
-        for (let j = 0; j < res.data.length; j++) {
-          if (count[res.data[j].key] == undefined) {
-            count[res.data[j].key] = 0
-          }
-          count[res.data[j].key]++
-        }
-        for (let key in count) {
-          hotTag.push({tag: key})
-        }
-        hotTag.sort(function (a, b) {
-          return count[b] - count[a]
-        })
-        hotTag.splice(10)
-        this.setData({
-          hotTagData: hotTag
-        })
-      }.bind(this)
-    })
-    this.setData({
-      hotBarData: hotBarData.hotBarData
-    })
-  },
-
-  update: function (e) {
-    this.setData({
-      searchText: e.detail.value,
-      searchResult: []
-    })
-  },
-
-  focus: function () {
-    if (!this.data.toggleEnable || this.data.searchEnable) return
-    this.data.toggleEnable = false
-    this.setData({
-      searchEnable: true
-    })
-    this.animate('.cancel-button', [
-      { opacity: 0 },
-      { opacity: 1 },
-    ], 150)
-    this.animate('.search-block', [
-      { opacity: 0 },
-      { opacity: 1 },
-    ], 150)
-    setTimeout(function () {
-      this.setData({
-        toggleEnable: true
-      })
-    }.bind(this), 200)
-  },
-
-  blur: function () {
-    if (this.data.searchText != "") return
-    this.cancel()
-  },
-
-  // 计算时间差
-  handleDate: function(date) {
-    var now = new Date().getTime()
-    var diffValue = now - date.getTime()
-    if (diffValue < 0) {
-      console.log("时间不同步")
-      return "刚刚"
-    }
-    var result = ""
-    var minute = 1000 * 60
-    var hour = minute * 60
-    var day = hour * 24
-    var minC = diffValue / minute
-    var hourC = diffValue / hour
-    var dayC = diffValue / day
-    if (parseInt(dayC) > 30) {
-      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
-    } else if (parseInt(dayC) > 1) {
-      result += parseInt(dayC) + "天前"
-    } else if (parseInt(dayC) == 1) {
-      result += "昨天"
-    } else if (hourC >= 1) {
-      result += parseInt(hourC) + "小时前"
-    } else if (minC >= 5) {
-      result += parseInt(minC) + "分钟前"
-    } else {
-      result += "刚刚"
-    }
-    return result
-  },
-
-  search: function () {
-    var history = this.data.searchHistory
-    if (history == undefined) history = []
-    for (let i = 0; i < history.length; i++) {
-      if (history[i] == this.data.searchText) {
-        history.splice(i, 1)
-        break
-      }
-    }
-    if (history.length > 9) {
-      history.splice(9, history.length - 9)
-    }
-    history = [this.data.searchText].concat(history)
-    this.setData({
-      searchHistory: history
-    })
-    wx.setStorage({
-      key: "searchHistory",
-      data: history
-    })
-    wx.showLoading({
-      title: "搜索中",
-    })
-    const db = wx.cloud.database()
-    const _ = db.command
-    db.collection("searchData").add({
-      data: {
-        key: this.data.searchText,
-        time: new Date()
-      },
-      success: function () {
-        var reg = new RegExp(this.data.searchText, "i")
-        db.collection("mainData").where(
-          _.or([
-            {title: reg},
-            {subTitle: reg},
-            {details: reg}
-          ])
-        ).orderBy("time", "desc").limit(20).get({
-          success: function (res) {
-            for (let i = 0; i < res.data.length; i++) {
-              res.data[i].time = this.handleDate(res.data[i].time)
-            }
-            this.setData({
-              searchResult: res.data
-            })
-            wx.hideLoading()
-          }.bind(this)
-        })
-      }.bind(this)
-    })
-  },
-
-  cancel: function () {
-    if (!this.data.toggleEnable || !this.data.searchEnable) return
-    this.data.toggleEnable = false
-    this.setData({
-      searchText: "",
-    })
-    this.animate('.cancel-button', [
-      { opacity: 1 },
-      { opacity: 0 },
-    ], 150)
-    this.animate('.search-block', [
-      { opacity: 1 },
-      { opacity: 0 },
-    ], 150)
-    setTimeout(function () {
-      this.setData({
-        toggleEnable: true,
-        searchEnable: false,
-        searchResult: []
-      })
-    }.bind(this), 200)
-  },
-
-  searchTag: function (e) {
-    this.setData({
-      searchText: e.target.dataset.searchTag
-    })
-    this.focus()
-    this.search()
-  },
-
-  searchAgain: function (e) {
-    this.setData({
-      searchText: e.target.dataset.history
-    })
-    this.focus()
-    this.search()
-  },
-
-  removeHistory: function (e) {
-    var history = this.data.searchHistory
-    if (history == undefined) history = []
-    for (let i = 0; i < history.length; i++) {
-      if (history[i] == e.target.dataset.history) {
-        history.splice(i, 1)
-        break
-      }
-    }
-    this.setData({
-      searchHistory: history
-    })
-    wx.setStorage({
-      key: "searchHistory",
-      data: history
-    })
-  },
-
-  viewActivity: function (e) {
-    wx.navigateTo({
-      url: "/pages/activity/activity?id=" + e.target.dataset.activityId
-    })
-  }
+var hotTagData = require("../../data/hotTagData.js")
+var hotBarData = require("../../data/hotBarData.js")
+
+Page({
+  options: {
+    styleIsolation: "apply-shared"
+  },
+
+  // 页面的初始数据
+  data: {
+    toggleEnable: true,
+    searchEnable: false,
+    searchText: "",
+    hotTagData: [],
+    hotBarData: [],
+    searchResult: [],
+    searchHistory: []
+  },
+
+  onLoad: function () {
+    wx.getStorage({
+      key: "searchHistory",
+      success: function (res) {
+        this.setData({
+          searchHistory: res.data
+        })
+      }.bind(this)
+    })
+    const db = wx.cloud.database()
+    db.collection("searchData").orderBy("time", "desc").limit(20).get({
+      success: function (res) {
+        var count = {}, hotTag = []
+        for (let j = 0; j < res.data.length; j++) {
+          if (count[res.data[j].key] == undefined) {
+            count[res.data[j].key] = 0
+          }
+          count[res.data[j].key]++
+        }
+        for (let key in count) {
+          hotTag.push({tag: key})
+        }
+        hotTag.sort(function (a, b) {
+          return count[b] - count[a]
+        })
+        hotTag.splice(10)
+        this.setData({
+          hotTagData: hotTag
+        })
+      }.bind(this)
+    })
+    this.setData({
+      hotBarData: hotBarData.hotBarData
+    })
+  },
+
+  update: function (e) {
+    this.setData({
+      searchText: e.detail.value,
+      searchResult: []
+    })
+  },
+
+  focus: function () {
+    if (!this.data.toggleEnable || this.data.searchEnable) return
+    this.data.toggleEnable = false
+    this.setData({
+      searchEnable: true
+    })
+    this.animate('.cancel-button', [
+      { opacity: 0 },
+      { opacity: 1 },
+    ], 150)
+    this.animate('.search-block', [
+      { opacity: 0 },
+      { opacity: 1 },
+    ], 150)
+    setTimeout(function () {
+      this.setData({
+        toggleEnable: true
+      })
+    }.bind(this), 200)
+  },
+
+  blur: function () {
+    if (this.data.searchText != "") return
+    this.cancel()
+  },
+
+  // 计算时间差
+  handleDate: function(date) {
+    var now = new Date().getTime()
+    var diffValue = now - date.getTime()
+    if (diffValue < 0) {
+      console.log("时间不同步")
+      return "刚刚"
+    }
+    var result = ""
+    var minute = 1000 * 60
+    var hour = minute * 60
+    var day = hour * 24
+    var minC = diffValue / minute
+    var hourC = diffValue / hour
+    var dayC = diffValue / day
+    if (parseInt(dayC) > 30) {
+      result += date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate()
+    } else if (parseInt(dayC) > 1) {
+      result += parseInt(dayC) + "天前"
+    } else if (parseInt(dayC) == 1) {
+      result += "昨天"
+    } else if (hourC >= 1) {
+      result += parseInt(hourC) + "小时前"
+    } else if (minC >= 5) {
+      result += parseInt(minC) + "分钟前"
+    } else {
+      result += "刚刚"
+    }
+    return result
+  },
+
+  search: function () {
+    var history = this.data.searchHistory
+    if (history == undefined) history = []
+    for (let i = 0; i < history.length; i++) {
+      if (history[i] == this.data.searchText) {
+        history.splice(i, 1)
+        break
+      }
+    }
+    if (history.length > 9) {
+      history.splice(9, history.length - 9)
+    }
+    history = [this.data.searchText].concat(history)
+    this.setData({
+      searchHistory: history
+    })
+    wx.setStorage({
+      key: "searchHistory",
+      data: history
+    })
+    wx.showLoading({
+      title: "搜索中",
+    })
+    const db = wx.cloud.database()
+    const _ = db.command
+    db.collection("searchData").add({
+      data: {
+        key: this.data.searchText,
+        time: new Date()
+      },
+      success: function () {
+        var reg = new RegExp(this.data.searchText, "i")
+        db.collection("mainData").where(
+          _.or([
+            {title: reg},
+            {subTitle: reg},
+            {details: reg}
+          ])
+        ).orderBy("time", "desc").limit(20).get({
+          success: function (res) {
+            for (let i = 0; i < res.data.length; i++) {
+              res.data[i].time = this.handleDate(res.data[i].time)
+            }
+            this.setData({
+              searchResult: res.data
+            })
+            wx.hideLoading()
+          }.bind(this)
+        })
+      }.bind(this)
+    })
+  },
+
+  cancel: function () {
+    if (!this.data.toggleEnable || !this.data.searchEnable) return
+    this.data.toggleEnable = false
+    this.setData({
+      searchText: "",
+    })
+    this.animate('.cancel-button', [
+      { opacity: 1 },
+      { opacity: 0 },
+    ], 150)
+    this.animate('.search-block', [
+      { opacity: 1 },
+      { opacity: 0 },
+    ], 150)
+    setTimeout(function () {
+      this.setData({
+        toggleEnable: true,
+        searchEnable: false,
+        searchResult: []
+      })
+    }.bind(this), 200)
+  },
+
+  searchTag: function (e) {
+    this.setData({
+      searchText: e.target.dataset.searchTag
+    })
+    this.focus()
+    this.search()
+  },
+
+  searchAgain: function (e) {
+    this.setData({
+      searchText: e.target.dataset.history
+    })
+    this.focus()
+    this.search()
+  },
+
+  removeHistory: function (e) {
+    var history = this.data.searchHistory
+    if (history == undefined) history = []
+    for (let i = 0; i < history.length; i++) {
+      if (history[i] == e.target.dataset.history) {
+        history.splice(i, 1)
+        break
+      }
+    }
+    this.setData({
+      searchHistory: history
+    })
+    wx.setStorage({
+      key: "searchHistory",
+      data: history
+    })
+  },
+
+  viewActivity: function (e) {
+    wx.navigateTo({
+      url: "/pages/activity/activity?id=" + e.target.dataset.activityId
+    })
+  }
 });

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است