瀏覽代碼

update

init push
unknown 4 年之前
父節點
當前提交
48728a571f
共有 100 個文件被更改,包括 1857 次插入1 次删除
  1. 11 1
      README.md
  2. 7 0
      cloudfunctions/callback/config.json
  3. 25 0
      cloudfunctions/callback/index.js
  4. 14 0
      cloudfunctions/callback/package.json
  5. 5 0
      cloudfunctions/echo/config.json
  6. 8 0
      cloudfunctions/echo/index.js
  7. 14 0
      cloudfunctions/echo/package.json
  8. 6 0
      cloudfunctions/getOpenId/config.json
  9. 11 0
      cloudfunctions/getOpenId/index.js
  10. 14 0
      cloudfunctions/getOpenId/package.json
  11. 5 0
      cloudfunctions/login/config.json
  12. 36 0
      cloudfunctions/login/index.js
  13. 14 0
      cloudfunctions/login/package.json
  14. 15 0
      cloudfunctions/openapi/config.json
  15. 86 0
      cloudfunctions/openapi/index.js
  16. 14 0
      cloudfunctions/openapi/package.json
  17. 76 0
      miniprogram/app.js
  18. 61 0
      miniprogram/app.json
  19. 23 0
      miniprogram/app.wxss
  20. 49 0
      miniprogram/components/followNews/followNews.js
  21. 6 0
      miniprogram/components/followNews/followNews.json
  22. 6 0
      miniprogram/components/followNews/followNews.wxml
  23. 7 0
      miniprogram/components/followNews/followNews.wxss
  24. 74 0
      miniprogram/components/imagePicker/imagePicker.js
  25. 4 0
      miniprogram/components/imagePicker/imagePicker.json
  26. 9 0
      miniprogram/components/imagePicker/imagePicker.wxml
  27. 7 0
      miniprogram/components/imagePicker/imagePicker.wxss
  28. 27 0
      miniprogram/components/itemActivityComment/itemActivityComment.js
  29. 4 0
      miniprogram/components/itemActivityComment/itemActivityComment.json
  30. 4 0
      miniprogram/components/itemActivityComment/itemActivityComment.wxml
  31. 10 0
      miniprogram/components/itemActivityComment/itemActivityComment.wxss
  32. 43 0
      miniprogram/components/itemCard/itemCard.js
  33. 6 0
      miniprogram/components/itemCard/itemCard.json
  34. 16 0
      miniprogram/components/itemCard/itemCard.wxml
  35. 62 0
      miniprogram/components/itemCard/itemCard.wxss
  36. 33 0
      miniprogram/components/itemPublisher/itemPublisher.js
  37. 6 0
      miniprogram/components/itemPublisher/itemPublisher.json
  38. 16 0
      miniprogram/components/itemPublisher/itemPublisher.wxml
  39. 62 0
      miniprogram/components/itemPublisher/itemPublisher.wxss
  40. 23 0
      miniprogram/components/itemfollowNews/itemfollowNews.js
  41. 4 0
      miniprogram/components/itemfollowNews/itemfollowNews.json
  42. 12 0
      miniprogram/components/itemfollowNews/itemfollowNews.wxml
  43. 45 0
      miniprogram/components/itemfollowNews/itemfollowNews.wxss
  44. 74 0
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.js
  45. 4 0
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.json
  46. 13 0
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.wxml
  47. 50 0
      miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.wxss
  48. 75 0
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.js
  49. 4 0
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.json
  50. 11 0
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.wxml
  51. 36 0
      miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.wxss
  52. 20 0
      miniprogram/components/itemmyNews/itemmyNews.js
  53. 4 0
      miniprogram/components/itemmyNews/itemmyNews.json
  54. 12 0
      miniprogram/components/itemmyNews/itemmyNews.wxml
  55. 44 0
      miniprogram/components/itemmyNews/itemmyNews.wxss
  56. 45 0
      miniprogram/components/myLikeMessage/myLikeMessage.js
  57. 6 0
      miniprogram/components/myLikeMessage/myLikeMessage.json
  58. 6 0
      miniprogram/components/myLikeMessage/myLikeMessage.wxml
  59. 7 0
      miniprogram/components/myLikeMessage/myLikeMessage.wxss
  60. 35 0
      miniprogram/components/myLikePublisher/myLikePublisher.js
  61. 6 0
      miniprogram/components/myLikePublisher/myLikePublisher.json
  62. 6 0
      miniprogram/components/myLikePublisher/myLikePublisher.wxml
  63. 7 0
      miniprogram/components/myLikePublisher/myLikePublisher.wxss
  64. 20 0
      miniprogram/components/myNews/myNews.js
  65. 6 0
      miniprogram/components/myNews/myNews.json
  66. 6 0
      miniprogram/components/myNews/myNews.wxml
  67. 7 0
      miniprogram/components/myNews/myNews.wxss
  68. 21 0
      miniprogram/data/activityCommentData.js
  69. 18 0
      miniprogram/data/activityInfoData.js
  70. 31 0
      miniprogram/data/hotBarData.js
  71. 42 0
      miniprogram/data/hotTagData.js
  72. 57 0
      miniprogram/data/mainData.js
  73. 26 0
      miniprogram/data/newMessageData.js
  74. 26 0
      miniprogram/data/newNewsData.js
  75. 20 0
      miniprogram/data/publisherInfoData.js
  76. 66 0
      miniprogram/data/searchResult.js
  77. 二進制
      miniprogram/images/add.png
  78. 二進制
      miniprogram/images/arrow.png
  79. 二進制
      miniprogram/images/finish.png
  80. 二進制
      miniprogram/images/like/heart.png
  81. 二進制
      miniprogram/images/like/hollowheart.png
  82. 二進制
      miniprogram/images/tabbar/1.1.png
  83. 二進制
      miniprogram/images/tabbar/1.2.png
  84. 二進制
      miniprogram/images/tabbar/2.1.png
  85. 二進制
      miniprogram/images/tabbar/2.2.png
  86. 二進制
      miniprogram/images/tabbar/3.1.png
  87. 二進制
      miniprogram/images/tabbar/3.2.png
  88. 二進制
      miniprogram/images/tabbar/4.1.png
  89. 二進制
      miniprogram/images/tabbar/4.2.png
  90. 二進制
      miniprogram/images/user/about.png
  91. 二進制
      miniprogram/images/user/feedback.png
  92. 二進制
      miniprogram/images/user/follow.png
  93. 二進制
      miniprogram/images/user/modify.png
  94. 二進制
      miniprogram/images/user/publish1.png
  95. 二進制
      miniprogram/images/user/publish2.png
  96. 二進制
      miniprogram/images/user/question.png
  97. 二進制
      miniprogram/images/user/setting.png
  98. 二進制
      miniprogram/images/user/settle.png
  99. 二進制
      miniprogram/images/user/user.png
  100. 66 0
      miniprogram/pages/aboutUs/aboutUs.js

+ 11 - 1
README.md

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

+ 7 - 0
cloudfunctions/callback/config.json

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

+ 25 - 0
cloudfunctions/callback/index.js

@@ -0,0 +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
+}

+ 14 - 0
cloudfunctions/callback/package.json

@@ -0,0 +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"
+  }
+}

+ 5 - 0
cloudfunctions/echo/config.json

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

+ 8 - 0
cloudfunctions/echo/index.js

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

+ 14 - 0
cloudfunctions/echo/package.json

@@ -0,0 +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"
+  }
+}

+ 6 - 0
cloudfunctions/getOpenId/config.json

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

+ 11 - 0
cloudfunctions/getOpenId/index.js

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

+ 14 - 0
cloudfunctions/getOpenId/package.json

@@ -0,0 +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"
+  }
+}

+ 5 - 0
cloudfunctions/login/config.json

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

+ 36 - 0
cloudfunctions/login/index.js

@@ -0,0 +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,
+  }
+}
+

+ 14 - 0
cloudfunctions/login/package.json

@@ -0,0 +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"
+  }
+}

+ 15 - 0
cloudfunctions/openapi/config.json

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

+ 86 - 0
cloudfunctions/openapi/index.js

@@ -0,0 +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,
+  })
+}

+ 14 - 0
cloudfunctions/openapi/package.json

@@ -0,0 +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"
+  }
+}

+ 76 - 0
miniprogram/app.js

@@ -0,0 +1,76 @@
+//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
+  }
+})

+ 61 - 0
miniprogram/app.json

@@ -0,0 +1,61 @@
+{
+  "pages": [
+    "pages/main/main",
+    "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"
+  ],
+  "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 - 0
miniprogram/app.wxss

@@ -0,0 +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;}
+

+ 49 - 0
miniprogram/components/followNews/followNews.js

@@ -0,0 +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)
+      })
+    }
+  }
+})

+ 6 - 0
miniprogram/components/followNews/followNews.json

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

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

@@ -0,0 +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>

+ 7 - 0
miniprogram/components/followNews/followNews.wxss

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

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

@@ -0,0 +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
+        })
+      })
+    },
+  }
+})

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

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

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

@@ -0,0 +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>

+ 7 - 0
miniprogram/components/imagePicker/imagePicker.wxss

@@ -0,0 +1,7 @@
+/* components/imagePicker/imagePicker.wxss */
+.image {
+  margin: 5rpx;
+  border-style: solid;
+  border-width: 1rpx;
+  border-color: #D0D0D0;
+}

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

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

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

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

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

@@ -0,0 +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>

+ 10 - 0
miniprogram/components/itemActivityComment/itemActivityComment.wxss

@@ -0,0 +1,10 @@
+.text {
+  margin-top: 10rpx;
+  font-size: 25rpx;
+}
+
+.line {
+  width: 100%;
+  height: 1rpx;
+  margin: 10rpx 0;
+}

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

@@ -0,0 +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]
+      })
+    }
+  }
+})

+ 6 - 0
miniprogram/components/itemCard/itemCard.json

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

+ 16 - 0
miniprogram/components/itemCard/itemCard.wxml

@@ -0,0 +1,16 @@
+<!-- 为首页消息通知的组件,数据在mainData.js -->
+<view class="card" bindtap="getActivityInfo">
+  <view class="profile">
+    <view style="display: flex;" catchtap="getPublisherInfo">
+      <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>

+ 62 - 0
miniprogram/components/itemCard/itemCard.wxss

@@ -0,0 +1,62 @@
+.card{
+  display: flex;
+  flex-direction: column;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisher-avatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-left: 10rpx;
+  margin-right: 10rpx;
+}
+
+.profile{
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding-right: 30rpx;
+}
+
+.publisher-name{
+  font-size: 30rpx;
+  align-self: center;
+  margin-right: 10rpx;
+  font-weight: 800;
+}
+
+.time{
+  font-size: 20rpx;
+  align-self: center;
+}
+
+.activity-attribute{
+  font-size: 20rpx;
+  align-self: center;
+  padding-top: 5rpx;
+  padding-bottom: 5rpx;
+  padding-right: 20rpx;
+  padding-left: 20rpx;
+}
+
+.title{
+  font-size: 30rpx;
+  margin-left: 68rpx;
+  margin-bottom: 10rpx;
+  font-weight: 800;
+}
+
+.sub-title{
+  font-size: 30rpx;
+  margin-left: 68rpx;
+  margin-bottom: 20rpx;
+  margin-right: 20rpx;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}

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

@@ -0,0 +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
+      })
+    }
+  }
+})

+ 6 - 0
miniprogram/components/itemPublisher/itemPublisher.json

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

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

@@ -0,0 +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>

+ 62 - 0
miniprogram/components/itemPublisher/itemPublisher.wxss

@@ -0,0 +1,62 @@
+.card{
+  display: flex;
+  flex-direction: column;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisher-avatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-left: 10rpx;
+  margin-right: 10rpx;
+}
+
+.profile{
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  padding-right: 30rpx;
+}
+
+.publisher-name{
+  font-size: 30rpx;
+  align-self: center;
+  margin-right: 10rpx;
+  font-weight: 800;
+}
+
+.time{
+  font-size: 20rpx;
+  align-self: center;
+}
+
+.activity-attribute{
+  font-size: 20rpx;
+  align-self: center;
+  padding-top: 5rpx;
+  padding-bottom: 5rpx;
+  padding-right: 20rpx;
+  padding-left: 20rpx;
+}
+
+.title{
+  font-size: 30rpx;
+  margin-left: 68rpx;
+  margin-bottom: 10rpx;
+  font-weight: 800;
+}
+
+.sub-title{
+  font-size: 30rpx;
+  margin-left: 68rpx;
+  margin-bottom: 20rpx;
+  margin-right: 20rpx;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}

+ 23 - 0
miniprogram/components/itemfollowNews/itemfollowNews.js

@@ -0,0 +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
+      })
+    }
+  }
+})

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

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

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

@@ -0,0 +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>

+ 45 - 0
miniprogram/components/itemfollowNews/itemfollowNews.wxss

@@ -0,0 +1,45 @@
+.card{
+  height: auto;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisher-avatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-right: 20rpx;
+}
+
+.profile{
+  width: 700rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.publisher-name{
+  font-size: 30rpx;
+  align-self: center;
+  display: flex;
+}
+
+.title{
+  font-size: 30rpx;
+  margin-left: 70rpx;
+  margin-bottom: 10rpx;
+  font-weight: 800;
+}
+
+.sub-title{
+  font-size: 25rpx;
+  margin-left: 70rpx;
+  margin-bottom: 20rpx;
+  margin-right: 20rpx;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}

+ 74 - 0
miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.js

@@ -0,0 +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"
+            })
+          }
+        })
+      }
+    }
+  }
+})

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

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

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

@@ -0,0 +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>

+ 50 - 0
miniprogram/components/itemmyLikeMessage/itemmyLikeMessage.wxss

@@ -0,0 +1,50 @@
+.card{
+  height: auto;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisher-avatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-right: 20rpx;
+}
+
+.profile{
+  width: 700rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.publisher-name{
+  font-size: 30rpx;
+  align-self: center;
+  display: flex;
+}
+
+.title{
+  font-size: 30rpx;
+  margin-left: 70rpx;
+  margin-bottom: 10rpx;
+  font-weight: 800;
+}
+
+.sub-title{
+  font-size: 25rpx;
+  margin-left: 70rpx;
+  margin-bottom: 20rpx;
+  margin-right: 20rpx;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}
+
+.like{
+  height: 40rpx;
+  width: 40rpx;
+}

+ 75 - 0
miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.js

@@ -0,0 +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"
+            })
+          }
+        })
+      }
+    }
+  }
+})

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

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

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

@@ -0,0 +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>

+ 36 - 0
miniprogram/components/itemmyLikePublisher/itemmyLikePublisher.wxss

@@ -0,0 +1,36 @@
+.card{
+  height: auto;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisher-avatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-right: 20rpx;
+}
+
+.profile{
+  width: 700rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.publisher-name{
+  font-size: 35rpx;
+  align-self: center;
+  display: flex;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}
+
+.like{
+  width: 50rpx;
+  height: 50rpx;
+}

+ 20 - 0
miniprogram/components/itemmyNews/itemmyNews.js

@@ -0,0 +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
+      })
+    }
+  }
+})

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

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

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

@@ -0,0 +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>

+ 44 - 0
miniprogram/components/itemmyNews/itemmyNews.wxss

@@ -0,0 +1,44 @@
+.card{
+  height: auto;
+  width: 700rpx;
+  margin-top: 20rpx;
+}
+
+.publisherAvatar{
+  width: 50rpx;
+  height: 50rpx;
+  border-radius: 30rpx;
+  margin-left: 10rpx;
+  margin-right: 10rpx;
+}
+
+.profile{
+  display: flex;
+  flex-direction: row;
+}
+
+.publisherName{
+  font-size: 30rpx;
+  align-self: center;
+  margin-right: 10rpx;
+}
+
+.title{
+  font-size: 30rpx;
+  margin-left: 78rpx;
+  margin-bottom: 10rpx;
+  font-weight: 800;
+}
+
+.subTitle{
+  font-size: 25rpx;
+  margin-left: 78rpx;
+  margin-bottom: 20rpx;
+  margin-right: 20rpx;
+}
+
+.line{
+  width: 700rpx;
+  height: 1rpx;
+  margin-top: 20rpx;
+}

+ 45 - 0
miniprogram/components/myLikeMessage/myLikeMessage.js

@@ -0,0 +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)
+        })
+      }
+    }
+  }
+})

+ 6 - 0
miniprogram/components/myLikeMessage/myLikeMessage.json

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

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

@@ -0,0 +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>
+</view>

+ 7 - 0
miniprogram/components/myLikeMessage/myLikeMessage.wxss

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

+ 35 - 0
miniprogram/components/myLikePublisher/myLikePublisher.js

@@ -0,0 +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)
+        })
+      }
+    }
+  }
+})

+ 6 - 0
miniprogram/components/myLikePublisher/myLikePublisher.json

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

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

@@ -0,0 +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>
+</view>

+ 7 - 0
miniprogram/components/myLikePublisher/myLikePublisher.wxss

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

+ 20 - 0
miniprogram/components/myNews/myNews.js

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

+ 6 - 0
miniprogram/components/myNews/myNews.json

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

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

@@ -0,0 +1,6 @@
+<!-- 消息-我的消息的界面,含component:itemmyNews;含data:newNewsData -->
+<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 - 0
miniprogram/components/myNews/myNews.wxss

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

+ 21 - 0
miniprogram/data/activityCommentData.js

@@ -0,0 +1,21 @@
+// 为活动详情中组件itemActivityComment的数据
+var json=[
+  {
+    "id":"1",
+    "userAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "user":"路人甲",
+    "time":"1分钟前",
+    "question":"哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈"
+  },
+  {
+    "id":"2",
+    "userAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "user":"路人甲",
+    "time":"1分钟前",
+    "question":"哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈"
+  }
+]
+
+module.exports={
+  activityComment:json
+}

+ 18 - 0
miniprogram/data/activityInfoData.js

@@ -0,0 +1,18 @@
+// 为活动详情界面中的数据
+var json= {
+  "id":"1",
+  "activityPoster":"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1180478225,661749625&fm=26&gp=0.jpg",
+  // 活动照片
+  "activityAtrribute":"文艺活动",
+  "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+  "publisherName":"蓝田文体发展中心",
+  "activityName":"紫金新生达人秀|期待你的精彩",
+  "activityTime":"2020年12月18-20日晚1830-21:30",
+  "activityPlace":"浙江大学紫金港校区小剧场",
+  "activityDetail":"本次比赛可以分为五个阶段:初赛→复赛→特训→彩排→决赛。报名后具体比赛时间及场次将通过短信进一步通知。面向对象为全校学生,表演形式不限。可通过填写问卷星链接进行报名:www.xxxxx"
+}
+
+
+module.exports={
+  activityInfo:json
+}

+ 31 - 0
miniprogram/data/hotBarData.js

@@ -0,0 +1,31 @@
+var json = [
+  {
+    rank: 1,
+    id: "ce805e785ffef291043dd7cc0dc12ade",
+    title: "紫金新生达人秀|期待你的精彩"
+  },
+  {
+    rank: 2,
+    id: "b45a21d55ff9c07c043eeb0a3863507f",
+    title: "紫金港校区停水停电事宜"
+  },
+  {
+    rank: 3,
+    id: "023ce9555ff9c02503eeebd23eb4413e",
+    title: "春夏学期的选课开始啦!"
+  },
+  {
+    rank: 4,
+    id: "023ce9555ff9c26c03ef0c521b7fa1cd",
+    title: "名师点拨|微积分线代期末救命讲座"
+  },
+  {
+    rank: 5,
+    id: "be7fb3985ff9c1b8034c770573ed8f99",
+    title: "红会纳新 | 与红会一同乘风破浪吧!"
+  }
+]
+
+module.exports = {
+  hotBarData: json
+}

+ 42 - 0
miniprogram/data/hotTagData.js

@@ -0,0 +1,42 @@
+var json = [
+  {
+    tag: "青志",
+    rank: 1
+  },
+  {
+    tag: "志愿者",
+    heat: 2
+  },
+  {
+    tag: "二课分",
+    heat: 3
+  },
+  {
+    tag: "三课分",
+    heat: 4
+  },
+  {
+    tag: "四课分",
+    heat: 5
+  },
+  {
+    tag: "求是新晚",
+    heat: 6
+  },
+  {
+    tag: "互联网+大赛",
+    heat: 7
+  },
+  {
+    tag: "社团精品课程",
+    heat: 8
+  },
+  {
+    tag: "学生节方阵",
+    heat: 9
+  }
+]
+
+module.exports = {
+  hotTagData: json
+}

+ 57 - 0
miniprogram/data/mainData.js

@@ -0,0 +1,57 @@
+//首页中组件itemCard的数据与发布者详情页面中itemPublisher中的数据
+var json=[
+  {
+    "id":"1",
+    //此条通知对应id
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg", 
+    //组织头像
+    "publisherName":"蓝田文体发展中心",
+    "publisherID":1,
+    //组织id(不同组织有不同标号)
+    "time":"1分钟前",
+    "title":"紫金新生达人秀|期待你的精彩",
+    //主标题
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+    //副标题
+    "poster":[],
+    //图片(可以添加多张,所以是数组)
+    "activityAttribute":"7",
+    //对应上栏-信息类型
+    "activitySource":"3",
+    //对应上栏-发布来源
+    "additionPoint":""
+    //对应上栏-智能筛选
+  },
+
+  {
+    "id":"2",
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "publisherName":"蓝田文体发展中心",
+    "publisherID":2,
+    "time":"1分钟前",
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+    "poster":["https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1180478225,661749625&fm=26&gp=0.jpg"],
+    "activityAttribute":"6",
+    "activitySource":"3",
+    "AdditionPoint":""
+  },
+
+  {
+    "id":"3",
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "publisherName":"蓝田文体发展中心",
+    "publisherID":2,
+    "time":"1分钟前",
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+    "poster":["https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1180478225,661749625&fm=26&gp=0.jpg"],
+    "activityAttribute":"5",
+    "activitySource":"3",
+    "AdditionPoint":""
+  }
+]
+
+module.exports = {
+  mainData:json
+}

+ 26 - 0
miniprogram/data/newMessageData.js

@@ -0,0 +1,26 @@
+// 消息-关注动态中组件itemfollowNews的数据
+var json=[
+  {
+    "id":"1",
+    // 动态的编号id
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    //组织头像
+    "publisherName":"蓝田文体发展中心",
+    "publishType":"活动",
+    //动态类型
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+  },
+  {
+    "id":"2",
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "publisherName":"蓝田文体发展中心",
+    "publishType":"活动",
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+  }
+]
+
+module.exports = {
+  newMessage:json
+}

+ 26 - 0
miniprogram/data/newNewsData.js

@@ -0,0 +1,26 @@
+// 消息-我的消息中组件itemmyNews的数据
+var json=[
+  {
+    "id":"1",
+    // 消息的编号
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    // 组织头像
+    "publisherName":"蓝田文体发展中心",
+    "publishType":"回复",
+    // 消息类型
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+  },
+  {
+    "id":"2",
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    "publisherName":"蓝田文体发展中心",
+    "publishType":"回复",
+    "title":"紫金新生达人秀|期待你的精彩",
+    "subTitle":"紫金新生达人秀现面向全校学生开启报名通道,报名即有综素加分,通过初赛就有二课!",
+  }
+]
+
+module.exports = {
+  newNews:json
+}

+ 20 - 0
miniprogram/data/publisherInfoData.js

@@ -0,0 +1,20 @@
+// 为发布者页面中组件itemPublisher的数据
+var json=
+  {
+    "id":"1",
+    "publisherAvatar":"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608131389634&di=bf796ce931cfbe3befff359069468b0f&imgtype=0&src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_match%2F0%2F162260862%2F0.jpg",
+    // 组织头像
+    "publisherName":"蓝田文体发展中心",
+    "publisherAttribute":"园级组织",
+    // 组织类型(可以再调整一下分类)
+    "publisherIntro":"我们是蓝田文体发展中心我们是蓝田文体发展中心我们是蓝田文体发展中心我们是蓝田文体发展中心",
+    // 组织简介
+    "publisherQQ":"XXXXXXXXXXX",
+    "publisherPhone":"XXXXXXXXXXXX"
+    // 另有想添加/修改的可以直接加进去
+  }
+
+
+module.exports={
+  publisherInfo:json
+}

+ 66 - 0
miniprogram/data/searchResult.js

@@ -0,0 +1,66 @@
+var json = [
+  {
+    rank: 1,
+    id: 1,
+    title: "Lisa",
+    content: "lisa"
+  },
+  {
+    rank: 2,
+    id: 2,
+    title: "is",
+    content: "good"
+  },
+  {
+    rank: 3,
+    id: 3,
+    title: "good",
+    content: "bad"
+  },
+  {
+    rank: 4,
+    id: 4,
+    title: "and",
+    content: "is"
+  },
+  {
+    rank: 5,
+    id: 5,
+    title: "good",
+    content: "???"
+  },
+  {
+    rank: 6,
+    id: 5,
+    title: "and",
+    content: "test test"
+  },
+  {
+    rank: 7,
+    id: 5,
+    title: "good",
+    content: "lalala"
+  },
+  {
+    rank: 8,
+    id: 5,
+    title: "and",
+    content: "bad"
+  },
+  {
+    rank: 9,
+    id: 5,
+    title: "bad",
+    content: "good"
+  },
+  {
+    rank: 10,
+    id: 5,
+    title: "fat",
+    content: "and"
+  }
+]
+
+module.exports = {
+  searchResult: json
+}

二進制
miniprogram/images/add.png


二進制
miniprogram/images/arrow.png


二進制
miniprogram/images/finish.png


二進制
miniprogram/images/like/heart.png


二進制
miniprogram/images/like/hollowheart.png


二進制
miniprogram/images/tabbar/1.1.png


二進制
miniprogram/images/tabbar/1.2.png


二進制
miniprogram/images/tabbar/2.1.png


二進制
miniprogram/images/tabbar/2.2.png


二進制
miniprogram/images/tabbar/3.1.png


二進制
miniprogram/images/tabbar/3.2.png


二進制
miniprogram/images/tabbar/4.1.png


二進制
miniprogram/images/tabbar/4.2.png


二進制
miniprogram/images/user/about.png


二進制
miniprogram/images/user/feedback.png


二進制
miniprogram/images/user/follow.png


二進制
miniprogram/images/user/modify.png


二進制
miniprogram/images/user/publish1.png


二進制
miniprogram/images/user/publish2.png


二進制
miniprogram/images/user/question.png


二進制
miniprogram/images/user/setting.png


二進制
miniprogram/images/user/settle.png


二進制
miniprogram/images/user/user.png


+ 66 - 0
miniprogram/pages/aboutUs/aboutUs.js

@@ -0,0 +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 () {
+
+  }
+})

Some files were not shown because too many files changed in this diff