# M朋友圈 **Repository Path**: takuxing/CloudUI ## Basic Information - **Project Name**: M朋友圈 - **Description**: 微信小程序模仿朋友圈实现(点赞、评论等)(白嫖可耻,star光荣) - **Primary Language**: JavaScript - **License**: Apache-2.0 - **Default Branch**: 组件版 - **Homepage**: https://www.cnblogs.com/masterchd/p/12363241.html - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 40 - **Created**: 2020-08-20 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

![](https://img.shields.io/badge/build-passing-brightgreen) ![](https://img.shields.io/badge/progress-80%25-blue) **TecLab - M朋友圈(组件版)** 🏹 减少后续维护成本,仅保留组件版 (现在已有Java SpringBoot后台版本,200r包安装,云开发版本永久免费,需要帮助部署的联系 QQ 1025584691) --- #### 效果展示
**发布页面 略** --- #### 组件引入准备 > 1.数据库 云数据库创建如下3张表: **circles_list(帖子列表)** **remarks_list(评论列表)** **thumbs_list(点赞列表)** > 2.全局变量 确保**app.js**中设置变量 **app.globalData.openid**作为用户身份识别作用。 或者模仿M朋友圈组件**app.js**文件写法,保留**_self**文件夹。修改**_self/application.js**配置文件。 ~~~js /** * @DESC 服务于全局的配置文件 * @TIPS 如果UseCloud 和 UseEsc 同时允许, 优先使用 云开发服务器 */ var CloudSetting = { UseCloud: true, //是否使用云开发服务器 CloudId:'自己的云环境开发id', //云开发环境id <⭐> TraceUser:true, //记录用户访问日志 AdaptStorge:true, //允许缓存用户数据 } var EscSetting = { UserEsc:true, //是否使用自己的服务器 EscIp:'localhost:', //服务的IP地址 <⭐> EscPort:'8999', //服务器的访问端口 <⭐> EscDomain:'localhost:',//服务器的域名 <⭐> AdaptStorge: true, //允许缓存用户数据 } var LogConfig = { //日志打印控制器 StorgeLog:true, //缓存成功日志 } ~~~ **_self/cloud.js** 文件不要做任何改动,**app.js** 文件获取 **openid**代码如下 ~~~js //app.js var pset = require('_self/application.js'); const cloud = require('_self/cloud.js'); App({ globalData:{ openid:'', userInfo:null }, //先序执行的函数 onLaunch: function() { this.CloudServer(); }, CloudServer() { var that = this; wx.getStorage({ key: 'wxuserinfo', success: function(res) { that.globalData.userInfo = res.data }, }) if (pset.CloudSetting.UseCloud) { console.log('* 云开发 * √' + ' 服务器:' + pset.CloudSetting.CloudId) if (!wx.cloud) { console.log(' -- 不支持云开发 -- ') } else { wx.cloud.init({ env: pset.CloudSetting.CloudId, traceUser: pset.CloudSetting.TraceUser }) //缓存信息 cloud.CallCloudFuncAndSetStorge('filter',pset.CloudSetting.AdaptStorge,'userinfo').then(function(res){ if (res !='callfuncfail'){ //console.log(res) that.globalData.openid = res //给全局变量 openid 赋值 } }) } } else { console.log('* 云开发 * X') } } }) ~~~ > 3.组件引用 **见项目** > 4.上传并部署三个云函数 > 5.修改project.config.json文件中appid为自己的appid