├── README.md ├── cloudfunctions ├── login │ ├── index.js │ └── package.json └── update │ ├── config.json │ ├── index.js │ └── package.json ├── miniprogram ├── app.js ├── app.json ├── app.wxss ├── components │ ├── messageList │ │ ├── messageList.js │ │ ├── messageList.json │ │ ├── messageList.wxml │ │ └── messageList.wxss │ └── search │ │ ├── search.js │ │ ├── search.json │ │ ├── search.wxml │ │ └── search.wxss ├── images │ ├── tabbar │ │ ├── home.png │ │ ├── home1.png │ │ ├── message.png │ │ ├── message1.png │ │ ├── near.png │ │ ├── near1.png │ │ ├── user.png │ │ └── user1.png │ └── user │ │ └── user-unlogin.png ├── pages │ ├── editUserInfo │ │ ├── avatar │ │ │ ├── avatar.js │ │ │ ├── avatar.json │ │ │ ├── avatar.wxml │ │ │ └── avatar.wxss │ │ ├── editUserInfo.js │ │ ├── editUserInfo.json │ │ ├── editUserInfo.wxml │ │ ├── editUserInfo.wxss │ │ ├── location │ │ │ ├── location.js │ │ │ ├── location.json │ │ │ ├── location.wxml │ │ │ └── location.wxss │ │ ├── name │ │ │ ├── name.js │ │ │ ├── name.json │ │ │ ├── name.wxml │ │ │ └── name.wxss │ │ ├── phone │ │ │ ├── phone.js │ │ │ ├── phone.json │ │ │ ├── phone.wxml │ │ │ └── phone.wxss │ │ ├── signature │ │ │ ├── signature.js │ │ │ ├── signature.json │ │ │ ├── signature.wxml │ │ │ └── signature.wxss │ │ └── weixin │ │ │ ├── weixin.js │ │ │ ├── weixin.json │ │ │ ├── weixin.wxml │ │ │ └── weixin.wxss │ ├── friendList │ │ ├── friendList.js │ │ ├── friendList.json │ │ ├── friendList.wxml │ │ └── friendList.wxss │ ├── home │ │ ├── home.js │ │ ├── home.json │ │ ├── home.wxml │ │ └── home.wxss │ ├── index │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ └── index.wxss │ ├── message │ │ ├── message.js │ │ ├── message.json │ │ ├── message.wxml │ │ └── message.wxss │ ├── near │ │ ├── near.js │ │ ├── near.json │ │ ├── near.wxml │ │ └── near.wxss │ └── user │ │ ├── user.js │ │ ├── user.json │ │ ├── user.wxml │ │ └── user.wxss ├── sitemap.json ├── style │ ├── iconfont │ │ └── iconfont.wxss │ └── pages.wxss └── wxs │ └── numberFormat.wxs ├── package.json ├── project.config.json └── sitemap.json /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 项目 4 | 5 | Meow Chat 6 | 7 | ### 项目结构 8 | 9 | #### 首页 10 | 11 | - 轮播图 12 | 13 | - 用户列表(推荐 / 最新) 14 | 15 | 头像 昵称 喜欢数 16 | 17 | 点击头像进入主页 18 | 19 | #### 附近 20 | 21 | 附近用户头像显示,点击头像进入主页 22 | 23 | #### 消息 24 | 25 | 通过实时数据推送监听收到的好友请求 26 | 点击头像查看主页,向左滑动,第一个按钮同意,第二个按钮删除 27 | 28 | 存在问题: 29 | - 同意或删除后页面渲染问题 30 | - 无法在页面内实时更新数据 31 | 32 | 聊天功能:暂未开发 33 | 34 | #### 我的 35 | 36 | - 微信授权登陆 37 | 38 | 登陆后显示 头像、昵称、个签 39 | 40 | - 编辑个人信息 41 | 42 | 头像、昵称、个签、位置共享、手机号、微信号 43 | 44 | - 好友列表 45 | 46 | - 个人主页 47 | 48 | 头像、昵称、性别、地区、喜欢数(点击增加喜欢,暂未添加限制,可无限点击) 49 | 50 | 个签 51 | 52 | 手机号(可拨打) 53 | 54 | 微信号(可复制) 55 | 56 | 添加好友按钮 / 已为好友则是发起聊天(聊天功能暂无) 57 | -------------------------------------------------------------------------------- /cloudfunctions/login/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init() 5 | 6 | // 云函数入口函数 7 | exports.main = async (event, context) => { 8 | const wxContext = cloud.getWXContext() 9 | 10 | return { 11 | event, 12 | openid: wxContext.OPENID, 13 | appid: wxContext.APPID, 14 | unionid: wxContext.UNIONID, 15 | } 16 | } -------------------------------------------------------------------------------- /cloudfunctions/login/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "login", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "latest" 13 | } 14 | } -------------------------------------------------------------------------------- /cloudfunctions/update/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "permissions": { 3 | "openapi": [ 4 | ] 5 | } 6 | } -------------------------------------------------------------------------------- /cloudfunctions/update/index.js: -------------------------------------------------------------------------------- 1 | // 云函数入口文件 2 | const cloud = require('wx-server-sdk') 3 | 4 | cloud.init({ 5 | env: cloud.DYNAMIC_CURRENT_ENV 6 | }) 7 | 8 | const db = cloud.database() 9 | const _ = db.command 10 | 11 | // 云函数入口函数 12 | exports.main = async (event, context) => { 13 | if(typeof event.data == 'string'){ 14 | event.data = eval(`(${event.data})`) 15 | } 16 | 17 | try { 18 | return await db.collection(event.collection).doc(event.doc) 19 | .update({ 20 | data: { 21 | ...event.data 22 | } 23 | }) 24 | } catch(e) { 25 | console.error(e) 26 | } 27 | } -------------------------------------------------------------------------------- /cloudfunctions/update/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "update", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "wx-server-sdk": "~1.8.0" 13 | } 14 | } -------------------------------------------------------------------------------- /miniprogram/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | // console.log('app launch') 5 | if (!wx.cloud) { 6 | console.error('请使用 2.2.3 或以上的基础库以使用云能力') 7 | } else { 8 | wx.cloud.init({ 9 | env: "mpdev-yangyang", 10 | traceUser: true, 11 | }) 12 | // wx.cloud.callFunction({ 13 | // name: 'login', 14 | // data: {} 15 | // }).then(res => { 16 | // // 实现自动登录功能 17 | // let db = wx.cloud.database() 18 | // db.collection('users').where({ 19 | // _openid: res.result.openid 20 | // }).get().then((res) => { 21 | // if (res.data.length) { 22 | // this.userInfo = Object.assign(this.userInfo, res.data[0]); 23 | // this.isLogged = true 24 | // wx.showToast({ 25 | // title: `${this.userInfo.nickName} 欢迎回来~`, 26 | // icon: 'none' 27 | // }) 28 | // } else { 29 | // this.isLogged = false 30 | // } 31 | // }) 32 | // }) 33 | } 34 | }, 35 | isLogged: false, 36 | userInfo: {}, 37 | userMessage: [], 38 | toRefresh: false, 39 | isDeleted: false 40 | }) -------------------------------------------------------------------------------- /miniprogram/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/near/near", 5 | "pages/message/message", 6 | "pages/user/user", 7 | "pages/editUserInfo/editUserInfo", 8 | "pages/friendList/friendList", 9 | "pages/home/home", 10 | "pages/editUserInfo/avatar/avatar", 11 | "pages/editUserInfo/name/name", 12 | "pages/editUserInfo/signature/signature", 13 | "pages/editUserInfo/location/location", 14 | "pages/editUserInfo/phone/phone", 15 | "pages/editUserInfo/weixin/weixin" 16 | ], 17 | "window": { 18 | "backgroundColor": "#cdcdcd", 19 | "backgroundTextStyle": "dark", 20 | "navigationBarBackgroundColor": "#ffde55", 21 | "navigationBarTitleText": "Meow Chat", 22 | "navigationBarTextStyle": "white" 23 | }, 24 | "tabBar": { 25 | "color": "#cdcdcd", 26 | "selectedColor": "black", 27 | "list": [ 28 | { 29 | "pagePath": "pages/index/index", 30 | "iconPath": "images/tabbar/home.png", 31 | "selectedIconPath": "images/tabbar/home1.png", 32 | "text": "首页" 33 | }, 34 | { 35 | "pagePath": "pages/near/near", 36 | "iconPath": "images/tabbar/near.png", 37 | "selectedIconPath": "images/tabbar/near1.png", 38 | "text": "附近" 39 | }, 40 | { 41 | "pagePath": "pages/message/message", 42 | "iconPath": "images/tabbar/message.png", 43 | "selectedIconPath": "images/tabbar/message1.png", 44 | "text": "消息" 45 | }, 46 | { 47 | "pagePath": "pages/user/user", 48 | "iconPath": "images/tabbar/user.png", 49 | "selectedIconPath": "images/tabbar/user1.png", 50 | "text": "我的" 51 | } 52 | ] 53 | }, 54 | "permission": { 55 | "scope.userLocation": { 56 | "desc": "你的位置信息将用于“附近”功能" 57 | } 58 | }, 59 | "sitemapLocation": "sitemap.json" 60 | } -------------------------------------------------------------------------------- /miniprogram/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | @import 'style/pages.wxss'; 3 | @import 'style/iconfont/iconfont.wxss'; -------------------------------------------------------------------------------- /miniprogram/components/messageList/messageList.js: -------------------------------------------------------------------------------- 1 | // components/messageList.js 2 | 3 | const db = wx.cloud.database() 4 | const app = getApp() 5 | 6 | Component({ 7 | /** 8 | * 组件的属性列表 9 | */ 10 | properties: { 11 | messageId: String 12 | }, 13 | 14 | /** 15 | * 组件的初始数据 16 | */ 17 | data: { 18 | userInfo: {} 19 | }, 20 | 21 | /** 22 | * 组件的方法列表 23 | */ 24 | methods: { 25 | getUserInfo(){ 26 | db.collection('users').doc(this.data.messageId).field({ 27 | userAvatar: true, 28 | nickName: true 29 | }).get().then(res => { 30 | this.setData({ 31 | userInfo: res.data 32 | }) 33 | }) 34 | }, 35 | toHome(ev){ 36 | let id = ev.target.dataset.id 37 | wx.navigateTo({ 38 | url: `/pages/home/home?userId=${id}` 39 | }) 40 | }, 41 | deleteMessage(){ 42 | wx.showModal({ 43 | content: '你确定要删除吗?', 44 | confirmText: '删除', 45 | confirmColor: '#ff0000', 46 | success: (res) => { 47 | if (res.confirm) { 48 | this.removeMessage() 49 | } 50 | } 51 | }) 52 | }, 53 | confirmMessage(){ 54 | wx.showModal({ 55 | content: '确定同意好友请求?', 56 | confirmText: '同意', 57 | confirmColor: '#00ff00', 58 | success: (res) => { 59 | if (res.confirm) { 60 | let _ = db.command 61 | db.collection('users').doc(app.userInfo._id).update({ 62 | data: { 63 | friendList: _.unshift(this.data.messageId) 64 | } 65 | }).then(res => {}) 66 | 67 | wx.cloud.callFunction({ 68 | name: 'update', 69 | data: { 70 | collection: 'users', 71 | doc: this.data.messageId, 72 | data: `{ 73 | friendList: _.unshift('${app.userInfo._id}') 74 | }` 75 | } 76 | }).then(res => { 77 | wx.showToast({ 78 | title: '添加成功!' 79 | }) 80 | }) 81 | this.removeMessage() 82 | } 83 | } 84 | }) 85 | }, 86 | removeMessage () { 87 | db.collection('message').where({ 88 | userId: app.userInfo._id 89 | }).get().then(res => { 90 | let list = res.data[0].list 91 | list = list.filter((val, i) => { 92 | return val != this.data.messageId 93 | }) 94 | let id = res.data[0]._id 95 | wx.cloud.callFunction({ 96 | name: 'update', 97 | data: { 98 | collection: 'message', 99 | doc: id, 100 | data: { 101 | list 102 | } 103 | } 104 | }).then(res => { 105 | this.triggerEvent('myevent', list) 106 | }) 107 | }) 108 | } 109 | 110 | }, 111 | lifetimes: { 112 | attached () { 113 | this.getUserInfo() 114 | } 115 | } 116 | }) 117 | -------------------------------------------------------------------------------- /miniprogram/components/messageList/messageList.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /miniprogram/components/messageList/messageList.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ userInfo.nickName }}请求加为好友 9 | 10 | 同意 11 | 删除 12 | 13 | 14 | -------------------------------------------------------------------------------- /miniprogram/components/messageList/messageList.wxss: -------------------------------------------------------------------------------- 1 | /* components/messageList.wxss */ 2 | .area{ width: calc(100% + 300rpx); transform: translateX(-300rpx); height: 150rpx; position: relative; border-bottom: 1px solid #cdcdcd;} 3 | .view{ width: calc(100% - 300rpx); height: 100%; background-color: #fff; position: absolute; left: 300rpx; top: 0;} 4 | .view .avatar{ width: 150rpx; height: 150rpx; position: absolute; top: 0; left: 0; padding: 20rpx; box-sizing: border-box;} 5 | .view .avatar image{ width: 100%; height: 100%; border-radius: 50%;} 6 | 7 | .view .content{ width: calc(100% - 150rpx); height: 100%; line-height: 150rpx; position: absolute; top: 0; left: 150rpx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;} 8 | 9 | .view .confirm{ width: 150rpx; height: 150rpx; background-color: skyblue; color: white; position: absolute; top: 0; right: -150rpx; line-height: 150rpx;} 10 | .view .confirm text{ position: absolute; left: 50%; transform: translateX(-42%);} 11 | 12 | .view .delete{ width: 150rpx; height: 150rpx; background-color: red; color: white; position: absolute; top: 0; right: -300rpx; line-height: 150rpx;} 13 | .view .delete text{ position: absolute; left: 50%; transform: translateX(-42%);} -------------------------------------------------------------------------------- /miniprogram/components/search/search.js: -------------------------------------------------------------------------------- 1 | // components/search/search.js 2 | 3 | const db = wx.cloud.database() 4 | const app = getApp() 5 | 6 | Component({ 7 | /** 8 | * 组件的属性列表 9 | */ 10 | options:{ 11 | styleIsolation: 'apply-shared' 12 | }, 13 | properties: { 14 | 15 | }, 16 | 17 | /** 18 | * 组件的初始数据 19 | */ 20 | data: { 21 | isFocus: false, 22 | historyList: [], 23 | searchList: [] 24 | }, 25 | 26 | /** 27 | * 组件的方法列表 28 | */ 29 | methods: { 30 | toSearch(){ 31 | if (!this.data.isFocus) { 32 | this.setData({ 33 | isFocus: true 34 | }) 35 | wx.getStorage({ 36 | key: 'searchHistory', 37 | success: (res) => { 38 | this.setData({ 39 | historyList: res.data 40 | }) 41 | } 42 | }) 43 | } 44 | }, 45 | cancelSearch(){ 46 | this.setData({ 47 | isFocus: false 48 | }) 49 | }, 50 | search(ev){ 51 | const value = ev.detail.value 52 | this.getData(value) 53 | 54 | let oldList = [...this.data.historyList] 55 | oldList.unshift(value) 56 | wx.setStorage({ 57 | key: "searchHistory", 58 | data: [...new Set(oldList)] 59 | }) 60 | wx.getStorage({ 61 | key: 'searchHistory', 62 | success: (res) => { 63 | this.setData({ 64 | historyList: res.data 65 | }) 66 | } 67 | }) 68 | }, 69 | getData (value) { 70 | db.collection('users').where({ 71 | nickName: db.RegExp({ 72 | regexp: value, 73 | options: 'i', 74 | }) 75 | }).field({ 76 | nickName: true, 77 | userAvatar: true 78 | }).get().then(res => { 79 | this.setData({ 80 | searchList: res.data 81 | }) 82 | }) 83 | }, 84 | toHome(ev){ 85 | const id = ev.currentTarget.dataset.id 86 | wx.navigateTo({ 87 | url: `/pages/home/home?userId=${id}` 88 | }) 89 | }, 90 | delete(ev){ 91 | // this.setData() 92 | const i = ev.target.dataset.index 93 | let list = this.data.searchList 94 | list.splice(i, 1) 95 | this.setData({ 96 | searchList: list 97 | }) 98 | }, 99 | clearHistory () { 100 | wx.showModal({ 101 | confirmColor: '#ff3300', 102 | content: '你确定要清空历史记录吗?', 103 | success: (res) => { 104 | if (res.confirm) { 105 | wx.removeStorage({ 106 | key: 'searchHistory' 107 | }) 108 | this.setData({ 109 | historyList: [] 110 | }) 111 | } 112 | } 113 | }) 114 | }, 115 | handleHistoryItem(ev){ 116 | const value = ev.target.dataset.text 117 | // console.log(value) 118 | this.getData(value) 119 | } 120 | } 121 | }) 122 | -------------------------------------------------------------------------------- /miniprogram/components/search/search.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /miniprogram/components/search/search.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 搜索喵星人~ 10 | 11 | 12 | 取消 13 | 14 | 15 | 16 | 17 | 历史记录 18 | 清空 19 | 20 | 21 | {{ item }} 22 | 暂无历史 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {{ item.nickName }} 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /miniprogram/components/search/search.wxss: -------------------------------------------------------------------------------- 1 | /* components/search/search.wxss */ 2 | .container{ background-color: #fff; padding: 0 20rpx; position: fixed; left: 0; top: 0; height: 90rpx; width: 100%; z-index: 999; box-sizing: border-box;} 3 | .search-container{ background-color: #fff; padding: 0 20rpx; position: fixed; left: 0; top: 0; height: 100%; width: 100%; z-index: 999; box-sizing: border-box;} 4 | 5 | .search-box{ height: 90rpx; display: flex; align-items: center;} 6 | .search-box .search-text { padding-right: 20rpx; width: 100%; background-color: #f6f6f6; border: 1px solid #cdcdcd; border-radius: 20rpx;} 7 | .search-box .search-text view{ width: fit-content; margin: 0 auto; display: flex;align-items: center;flex: 1; color: #cdcdcd;} 8 | .search-box .search-text view.left{ width: 100%; margin: 0; color: black;} 9 | .search-box .search-text view.left input{ flex: 1;} 10 | .search-box .search-text .iconsousuo { margin: 0 10rpx; font-size: 22px;} 11 | 12 | .search-box .search-cancel{ color: cornflowerblue; margin-left:10rpx; width: fit-content; white-space: nowrap;} 13 | 14 | .searching{ position: absolute; top: 90rpx; left: 0; background-color: #f6f6f6; width: 100%; height: calc(100% - 90rpx);} 15 | .searching .search-history{ margin: 20rpx;} 16 | .searching .search-history-header{ margin-bottom: 35rpx; display: flex; justify-content: space-between;} 17 | .searching .search-history-header .clear{ font-size: 12px; color: #cdcdcd;} 18 | 19 | .searching .search-history-content{ max-height: 100rpx; overflow: hidden; white-space: nowrap;} 20 | .searching .search-history-item{ display: inline-block; background-color: lightgray; margin: 20rpx 20rpx 0 0; width: fit-content; border-radius: 20rpx; padding: 10rpx 20rpx; border: 1px solid #cdcdcd;} 21 | .no-history { font-size: 12px; color: #cdcdcd;} 22 | 23 | .search-list{ margin-top: 40rpx; padding:0 20rpx; background: #fff;} 24 | .list-item{ width: 100%; height: 150rpx; display: flex; border-bottom: 1px solid #cdcdcd;} 25 | .list-item .avatar{ width: 150rpx; height: 150rpx; padding: 20rpx; box-sizing: border-box;} 26 | .list-item .avatar image{ width: 100%; height: 100%; border-radius: 50%;} 27 | 28 | .list-item .item-text{ width: calc(100% - 150rpx); display: flex; align-items: center; justify-content: space-between;} 29 | .list-item .item-text .name{ padding-left: 10rpx; font-size: 18px; } 30 | .list-item .item-text .icondel{ font-size: 26px; color: #c0c0c0; z-index: 99;} 31 | 32 | .hide{ display: none;} -------------------------------------------------------------------------------- /miniprogram/images/tabbar/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/home.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/home1.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/message.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/message1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/message1.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/near.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/near.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/near1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/near1.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/user.png -------------------------------------------------------------------------------- /miniprogram/images/tabbar/user1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/tabbar/user1.png -------------------------------------------------------------------------------- /miniprogram/images/user/user-unlogin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ly980408/MeowChat/8431d22580a737f99a8efca84a5394dfa842613c/miniprogram/images/user/user-unlogin.png -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/avatar/avatar.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/avatar/avatar.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | userAvatar: '', 13 | isUpdate: false 14 | }, 15 | 16 | /** 17 | * 生命周期函数--监听页面加载 18 | */ 19 | onLoad: function (options) { 20 | 21 | }, 22 | 23 | /** 24 | * 生命周期函数--监听页面初次渲染完成 25 | */ 26 | onReady: function () { 27 | this.setData({ 28 | userAvatar: app.userInfo.userAvatar 29 | }) 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面显示 34 | */ 35 | onShow: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面隐藏 41 | */ 42 | onHide: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 生命周期函数--监听页面卸载 48 | */ 49 | onUnload: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面相关事件处理函数--监听用户下拉动作 55 | */ 56 | onPullDownRefresh: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 页面上拉触底事件的处理函数 62 | */ 63 | onReachBottom: function () { 64 | 65 | }, 66 | 67 | /** 68 | * 用户点击右上角分享 69 | */ 70 | onShareAppMessage: function () { 71 | 72 | }, 73 | chooseImage(){ 74 | wx.chooseImage({ 75 | count: 1, 76 | sizeType: ['compressed'], 77 | sourceType: ['album', 'camera'], 78 | success: (res) => { 79 | const tempFilePath = res.tempFilePaths[0] 80 | this.setData({ 81 | userAvatar: tempFilePath, 82 | isUpdate: true 83 | }) 84 | } 85 | }) 86 | }, 87 | updateAvatar () { 88 | if (!this.data.isUpdate) { 89 | wx.showToast({ 90 | title: '请先点击头像进行更改!', 91 | icon: 'none' 92 | }) 93 | return 94 | } 95 | wx.showLoading({ 96 | title: '上传中...' 97 | }) 98 | 99 | let cloudPath = `userAvatar/${app.userInfo._openid}${Date.now()}.jpg` 100 | 101 | wx.cloud.uploadFile({ 102 | cloudPath, 103 | filePath: this.data.userAvatar 104 | }).then((res) => { 105 | let fileID = res.fileID 106 | if (fileID) { 107 | db.collection('users').doc(app.userInfo._id).update({ 108 | data: { 109 | userAvatar: fileID 110 | } 111 | }).then((res) => { 112 | wx.hideLoading() 113 | wx.showToast({ 114 | title: '上传成功!' 115 | }) 116 | app.userInfo.userAvatar = fileID 117 | }) 118 | } 119 | }) 120 | }, 121 | bindGetUserInfo (ev) { 122 | let userAvatar = ev.detail.userInfo.avatarUrl 123 | if(userAvatar){ 124 | this.setData({ 125 | userAvatar 126 | }, () => { 127 | wx.showLoading({ 128 | title: '上传中...' 129 | }) 130 | db.collection('users').doc(app.userInfo._id).update({ 131 | data: { 132 | userAvatar 133 | } 134 | }).then((res) => { 135 | wx.hideLoading() 136 | wx.showToast({ 137 | title: '上传成功!' 138 | }) 139 | app.userInfo.userAvatar = userAvatar 140 | }) 141 | }) 142 | } 143 | } 144 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/avatar/avatar.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/avatar/avatar.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/avatar/avatar.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/avatar/avatar.wxss */ 2 | image{ display: block; width: 200rpx; height: 200rpx; border-radius: 10rpx; margin: 10px auto;} 3 | button{ margin-bottom: 10px;} -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/editUserInfo.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/editUserInfo.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | } 66 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/editUserInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/editUserInfo.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 修改头像 6 | 7 | 8 | 9 | 10 | 11 | 修改昵称 12 | 13 | 14 | 15 | 16 | 17 | 编辑个性签名 18 | 19 | 20 | 21 | 22 | 23 | 位置共享 24 | 25 | 26 | 27 | 28 | 29 | 设置手机号 (仅好友可见) 30 | 31 | 32 | 33 | 34 | 35 | 设置微信号 (仅好友可见) 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/editUserInfo.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/editUserInfo.wxss */ 2 | .editUserInfo{ margin-top: 20rpx;} 3 | .editUserInfo-item{ 4 | height: 50rpx; 5 | border-bottom: 1px #cdcdcd solid; 6 | background: #fff; 7 | padding: 10px; 8 | display: flex; 9 | align-items: center; 10 | justify-content: space-between; 11 | } 12 | .editUserInfo-item .editUserInfo-item-tips{ 13 | font-size: 10px; 14 | color: red; 15 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/location/location.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/location/location.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | isLocation: true 13 | }, 14 | 15 | /** 16 | * 生命周期函数--监听页面加载 17 | */ 18 | onLoad: function (options) { 19 | 20 | }, 21 | 22 | /** 23 | * 生命周期函数--监听页面初次渲染完成 24 | */ 25 | onReady: function () { 26 | this.setData({ 27 | isLocation: app.userInfo.isLocation 28 | }) 29 | }, 30 | 31 | /** 32 | * 生命周期函数--监听页面显示 33 | */ 34 | onShow: function () { 35 | 36 | }, 37 | 38 | /** 39 | * 生命周期函数--监听页面隐藏 40 | */ 41 | onHide: function () { 42 | 43 | }, 44 | 45 | /** 46 | * 生命周期函数--监听页面卸载 47 | */ 48 | onUnload: function () { 49 | 50 | }, 51 | 52 | /** 53 | * 页面相关事件处理函数--监听用户下拉动作 54 | */ 55 | onPullDownRefresh: function () { 56 | 57 | }, 58 | 59 | /** 60 | * 页面上拉触底事件的处理函数 61 | */ 62 | onReachBottom: function () { 63 | 64 | }, 65 | 66 | /** 67 | * 用户点击右上角分享 68 | */ 69 | onShareAppMessage: function () { 70 | 71 | }, 72 | switchChange(ev){ 73 | let value = ev.detail.value 74 | db.collection('users').doc(app.userInfo._id).update({ 75 | data: { 76 | isLocation: value 77 | } 78 | }).then( (res) => { 79 | app.userInfo.isLocation = value 80 | }) 81 | } 82 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/location/location.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/location/location.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 开启位置共享: 4 | 5 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/location/location.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/location/location.wxss */ 2 | .location{ 3 | margin: 20px; 4 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/name/name.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/name/name.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | nickName: '', 13 | oldName: '' 14 | }, 15 | 16 | /** 17 | * 生命周期函数--监听页面加载 18 | */ 19 | onLoad: function (options) { 20 | 21 | }, 22 | 23 | /** 24 | * 生命周期函数--监听页面初次渲染完成 25 | */ 26 | onReady: function () { 27 | this.setData({ 28 | nickName: app.userInfo.nickName, 29 | oldName: app.userInfo.nickName 30 | }) 31 | }, 32 | 33 | /** 34 | * 生命周期函数--监听页面显示 35 | */ 36 | onShow: function () { 37 | 38 | }, 39 | 40 | /** 41 | * 生命周期函数--监听页面隐藏 42 | */ 43 | onHide: function () { 44 | 45 | }, 46 | 47 | /** 48 | * 生命周期函数--监听页面卸载 49 | */ 50 | onUnload: function () { 51 | 52 | }, 53 | 54 | /** 55 | * 页面相关事件处理函数--监听用户下拉动作 56 | */ 57 | onPullDownRefresh: function () { 58 | 59 | }, 60 | 61 | /** 62 | * 页面上拉触底事件的处理函数 63 | */ 64 | onReachBottom: function () { 65 | 66 | }, 67 | 68 | /** 69 | * 用户点击右上角分享 70 | */ 71 | onShareAppMessage: function () { 72 | 73 | }, 74 | getValue(ev){ 75 | let value = ev.detail.value 76 | this.setData({ 77 | nickName: value 78 | }) 79 | }, 80 | updateNickName(){ 81 | wx.showLoading({ 82 | title: '更新中...' 83 | }) 84 | db.collection('users').doc(app.userInfo._id).update({ 85 | data: { 86 | nickName: this.data.nickName 87 | } 88 | }).then((res) => { 89 | wx.hideLoading() 90 | wx.showToast({ 91 | title: '更新成功' 92 | }) 93 | app.userInfo.nickName = this.data.nickName 94 | }) 95 | }, 96 | bindGetUserInfo(ev){ 97 | // console.log(ev.detail.userInfo.nickName) 98 | let nickName = ev.detail.userInfo.nickName 99 | if(nickName){ 100 | this.setData({ 101 | nickName: nickName 102 | }, () => { 103 | this.updateNickName() 104 | }) 105 | } 106 | } 107 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/name/name.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/name/name.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/name/name.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/name/name.wxss */ 2 | .name{ 3 | margin: 0 20px; 4 | } 5 | input{ 6 | width: 100%; 7 | border: 1px solid #cdcdcd; 8 | margin: 20px auto; 9 | } 10 | button{ margin-bottom: 10px;} -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/phone/phone.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/phone/phone.js 2 | const app = getApp() 3 | const db = wx.cloud.database() 4 | 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | phoneNumber: '' 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function (options) { 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面初次渲染完成 23 | */ 24 | onReady: function () { 25 | this.setData({ 26 | phoneNumber: app.userInfo.phoneNumber 27 | }) 28 | }, 29 | 30 | /** 31 | * 生命周期函数--监听页面显示 32 | */ 33 | onShow: function () { 34 | 35 | }, 36 | 37 | /** 38 | * 生命周期函数--监听页面隐藏 39 | */ 40 | onHide: function () { 41 | 42 | }, 43 | 44 | /** 45 | * 生命周期函数--监听页面卸载 46 | */ 47 | onUnload: function () { 48 | 49 | }, 50 | 51 | /** 52 | * 页面相关事件处理函数--监听用户下拉动作 53 | */ 54 | onPullDownRefresh: function () { 55 | 56 | }, 57 | 58 | /** 59 | * 页面上拉触底事件的处理函数 60 | */ 61 | onReachBottom: function () { 62 | 63 | }, 64 | 65 | /** 66 | * 用户点击右上角分享 67 | */ 68 | onShareAppMessage: function () { 69 | 70 | }, 71 | getValue(ev){ 72 | let value = ev.detail.value 73 | this.setData({ 74 | phoneNumber: value 75 | }) 76 | }, 77 | updatePhoneNumber(){ 78 | if(!this.checkPhoneNumber(this.data.phoneNumber)){ 79 | wx.showToast({ 80 | title: '请输入正确的格式!', 81 | icon: 'none' 82 | }) 83 | } else { 84 | wx.showLoading({ 85 | title: '更新中...' 86 | }) 87 | db.collection('users').doc(app.userInfo._id).update({ 88 | data: { 89 | phoneNumber: this.data.phoneNumber 90 | } 91 | }).then((res) => { 92 | wx.hideLoading() 93 | wx.showToast({ 94 | title: '更新成功' 95 | }) 96 | app.userInfo.phoneNumber = this.data.phoneNumber 97 | }) 98 | } 99 | }, 100 | checkPhoneNumber(val){ 101 | if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(val))){ 102 | return false; 103 | } else { 104 | return true; 105 | } 106 | } 107 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/phone/phone.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/phone/phone.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/phone/phone.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/phone/phone.wxss */ 2 | .phone{ 3 | margin: 0 20px; 4 | } 5 | input{ 6 | width: 100%; 7 | border: 1px solid #cdcdcd; 8 | margin: 20px auto; 9 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/signature/signature.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/signature/signature.js 2 | const app = getApp() 3 | const db = wx.cloud.database() 4 | 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | signature: '' 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function (options) { 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面初次渲染完成 23 | */ 24 | onReady: function () { 25 | this.setData({ 26 | signature: app.userInfo.signature 27 | }) 28 | }, 29 | 30 | /** 31 | * 生命周期函数--监听页面显示 32 | */ 33 | onShow: function () { 34 | 35 | }, 36 | 37 | /** 38 | * 生命周期函数--监听页面隐藏 39 | */ 40 | onHide: function () { 41 | 42 | }, 43 | 44 | /** 45 | * 生命周期函数--监听页面卸载 46 | */ 47 | onUnload: function () { 48 | 49 | }, 50 | 51 | /** 52 | * 页面相关事件处理函数--监听用户下拉动作 53 | */ 54 | onPullDownRefresh: function () { 55 | 56 | }, 57 | 58 | /** 59 | * 页面上拉触底事件的处理函数 60 | */ 61 | onReachBottom: function () { 62 | 63 | }, 64 | 65 | /** 66 | * 用户点击右上角分享 67 | */ 68 | onShareAppMessage: function () { 69 | 70 | }, 71 | getValue(ev){ 72 | let value = ev.detail.value 73 | this.setData({ 74 | signature: value 75 | }) 76 | }, 77 | updateSignature(){ 78 | wx.showLoading({ 79 | title: '更新中...' 80 | }) 81 | db.collection('users').doc(app.userInfo._id).update({ 82 | data: { 83 | signature: this.data.signature 84 | } 85 | }).then((res) => { 86 | wx.hideLoading() 87 | wx.showToast({ 88 | title: '更新成功' 89 | }) 90 | app.userInfo.signature = this.data.signature 91 | }) 92 | } 93 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/signature/signature.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/signature/signature.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/signature/signature.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/signature/signature.wxss */ 2 | .signature{ 3 | margin: 0 20px; 4 | } 5 | textarea{ 6 | height: 100px; 7 | width: 100%; 8 | border: 1px solid #cdcdcd; 9 | margin: 20px auto; 10 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/weixin/weixin.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/editUserInfo/weixin/weixin.js 2 | const app = getApp() 3 | const db = wx.cloud.database() 4 | 5 | Page({ 6 | 7 | /** 8 | * 页面的初始数据 9 | */ 10 | data: { 11 | wxId: '' 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function (options) { 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面初次渲染完成 23 | */ 24 | onReady: function () { 25 | this.setData({ 26 | wxId: app.userInfo.wxId 27 | }) 28 | }, 29 | 30 | /** 31 | * 生命周期函数--监听页面显示 32 | */ 33 | onShow: function () { 34 | 35 | }, 36 | 37 | /** 38 | * 生命周期函数--监听页面隐藏 39 | */ 40 | onHide: function () { 41 | 42 | }, 43 | 44 | /** 45 | * 生命周期函数--监听页面卸载 46 | */ 47 | onUnload: function () { 48 | 49 | }, 50 | 51 | /** 52 | * 页面相关事件处理函数--监听用户下拉动作 53 | */ 54 | onPullDownRefresh: function () { 55 | 56 | }, 57 | 58 | /** 59 | * 页面上拉触底事件的处理函数 60 | */ 61 | onReachBottom: function () { 62 | 63 | }, 64 | 65 | /** 66 | * 用户点击右上角分享 67 | */ 68 | onShareAppMessage: function () { 69 | 70 | }, 71 | getValue(ev){ 72 | let value = ev.detail.value 73 | this.setData({ 74 | wxId: value 75 | }) 76 | }, 77 | updateWxId(){ 78 | wx.showLoading({ 79 | title: '更新中...' 80 | }) 81 | db.collection('users').doc(app.userInfo._id).update({ 82 | data: { 83 | wxId: this.data.wxId 84 | } 85 | }).then((res) => { 86 | wx.hideLoading() 87 | wx.showToast({ 88 | title: '更新成功' 89 | }) 90 | app.userInfo.wxId = this.data.wxId 91 | }) 92 | } 93 | }) -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/weixin/weixin.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/weixin/weixin.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /miniprogram/pages/editUserInfo/weixin/weixin.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/editUserInfo/weixin/weixin.wxss */ 2 | .weixin{ 3 | margin: 0 20px; 4 | } 5 | input{ 6 | width: 100%; 7 | border: 1px solid #cdcdcd; 8 | margin: 20px auto; 9 | } -------------------------------------------------------------------------------- /miniprogram/pages/friendList/friendList.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/friendList/friendList.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | friendList: [] 13 | }, 14 | 15 | /** 16 | * 生命周期函数--监听页面加载 17 | */ 18 | onLoad: function (options) { 19 | wx.setNavigationBarTitle({ 20 | title: '好友列表' 21 | }) 22 | }, 23 | 24 | /** 25 | * 生命周期函数--监听页面初次渲染完成 26 | */ 27 | onReady: function () { 28 | db.collection('users').where({ 29 | friendList: app.userInfo._id 30 | }).field({ 31 | userAvatar: true, 32 | nickName: true, 33 | signature: true 34 | }).get().then(res => { 35 | this.setData({ 36 | friendList: res.data 37 | }) 38 | }) 39 | }, 40 | 41 | /** 42 | * 生命周期函数--监听页面显示 43 | */ 44 | onShow: function () { 45 | 46 | }, 47 | 48 | /** 49 | * 生命周期函数--监听页面隐藏 50 | */ 51 | onHide: function () { 52 | 53 | }, 54 | 55 | /** 56 | * 生命周期函数--监听页面卸载 57 | */ 58 | onUnload: function () { 59 | 60 | }, 61 | 62 | /** 63 | * 页面相关事件处理函数--监听用户下拉动作 64 | */ 65 | onPullDownRefresh: function () { 66 | 67 | }, 68 | 69 | /** 70 | * 页面上拉触底事件的处理函数 71 | */ 72 | onReachBottom: function () { 73 | 74 | }, 75 | 76 | /** 77 | * 用户点击右上角分享 78 | */ 79 | onShareAppMessage: function () { 80 | 81 | } 82 | }) -------------------------------------------------------------------------------- /miniprogram/pages/friendList/friendList.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {}, 3 | "enablePullDownRefresh": false, 4 | "onReachBottomDistance": 50 5 | } -------------------------------------------------------------------------------- /miniprogram/pages/friendList/friendList.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ item.nickName }} 11 | {{ item.signature || '这个人很懒,什么也没留下~' }} 12 | 13 | 14 | 15 | 16 | 17 | 您还没有好友,快去添加吧~ 18 | 19 | 20 | -------------------------------------------------------------------------------- /miniprogram/pages/friendList/friendList.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/friendList/friendList.wxss */ 2 | .list-item{ width: 100%; height: 150rpx; display: flex; background: #fff; border-bottom: 1px solid #cdcdcd;} 3 | 4 | .list-item .avatar{ width: 150rpx; height: 150rpx; padding: 20rpx; box-sizing: border-box;} 5 | .list-item .avatar image{ width: 100%; height: 100%; border-radius: 50%;} 6 | 7 | .list-item .info{ width: calc(100% - 150rpx); height: 150rpx; padding: 15rpx 30rpx; box-sizing: border-box;} 8 | .list-item .info text{ display: block; width: 100%; height: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} 9 | .list-item .info .name{ font-size: 16px; line-height: 60rpx;} 10 | .list-item .info .signature{ font-size: 12px; color: gray; line-height: 60rpx;} 11 | 12 | .no-friend{ font-size: 16px; color: #cdcdcd; width: 60%; position: absolute; top: 50%; left: 50%; transform: translate(-50%); text-align: center;} 13 | -------------------------------------------------------------------------------- /miniprogram/pages/home/home.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/home/home.js 2 | 3 | const db = wx.cloud.database() 4 | const app = getApp() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | info: {}, 13 | isFriend: false, 14 | isMan: true, 15 | isSelf: false 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面加载 20 | */ 21 | onLoad: function (options) { 22 | let userId = options.userId 23 | db.collection('users') 24 | .doc(userId).get() 25 | .then(res => { 26 | this.setData({ 27 | info: res.data 28 | }) 29 | if ( userId == app.userInfo._id ){ 30 | this.setData({ 31 | isSelf: true 32 | }) 33 | } 34 | if (res.data.gender == 1) { 35 | this.setData({ isMan: true}) 36 | } else { 37 | this.setData({ isMan: false}) 38 | } 39 | let friendList = res.data.friendList 40 | if (friendList.includes(app.userInfo._id)) { 41 | this.setData({ 42 | isFriend: true 43 | }) 44 | } 45 | }) 46 | }, 47 | 48 | /** 49 | * 生命周期函数--监听页面初次渲染完成 50 | */ 51 | onReady: function () { 52 | }, 53 | 54 | /** 55 | * 生命周期函数--监听页面显示 56 | */ 57 | onShow: function () { 58 | 59 | }, 60 | 61 | /** 62 | * 生命周期函数--监听页面隐藏 63 | */ 64 | onHide: function () { 65 | 66 | }, 67 | 68 | /** 69 | * 生命周期函数--监听页面卸载 70 | */ 71 | onUnload: function () { 72 | 73 | }, 74 | 75 | /** 76 | * 页面相关事件处理函数--监听用户下拉动作 77 | */ 78 | onPullDownRefresh: function () { 79 | 80 | }, 81 | 82 | /** 83 | * 页面上拉触底事件的处理函数 84 | */ 85 | onReachBottom: function () { 86 | 87 | }, 88 | 89 | /** 90 | * 用户点击右上角分享 91 | */ 92 | onShareAppMessage: function () { 93 | 94 | }, 95 | handleLikes (ev) { 96 | // 此方法暂未实现第二次点击取消功能,而是可以无限喜欢 97 | // 待更新。。。 98 | let id = ev.target.dataset.id 99 | 100 | // 调用云函数 update 101 | wx.cloud.callFunction({ 102 | name: 'update', 103 | data: { 104 | collection: 'users', 105 | doc: id, 106 | data: `{ 107 | likes: _.inc(1) 108 | }` 109 | } 110 | }) 111 | .then(res => { 112 | let updated = res.result.stats.updated 113 | if (updated) { 114 | let oldInfo = this.data.info 115 | let newLikes = oldInfo.likes + 1 116 | let newInfo = { ...oldInfo } 117 | newInfo.likes = newLikes 118 | this.setData({ 119 | info: newInfo 120 | }) 121 | } 122 | }) 123 | }, 124 | call (ev) { 125 | let phoneNumber = ev.target.dataset.phone 126 | wx.makePhoneCall({ 127 | phoneNumber: phoneNumber 128 | }) 129 | }, 130 | copy (ev) { 131 | let wxId = ev.target.dataset.wx 132 | wx.setClipboardData({ 133 | data: wxId 134 | }) 135 | }, 136 | toEdit(){ 137 | wx.navigateTo({ 138 | url: '../editUserInfo/editUserInfo' 139 | }) 140 | }, 141 | 142 | // 添加好友事件 143 | addFriend(){ 144 | // console.log(app.isLogged) 145 | if (app.isLogged) { 146 | // 发送好友请求 147 | db.collection('message').where({ 148 | userId: this.data.info._id 149 | }).get().then(res => { 150 | if (res.data.length) { // 有数据 更新 151 | if ( res.data[0].list.includes(app.userInfo._id) ) { 152 | wx.showToast({ 153 | title: '已经发过请求啦!', 154 | duration: 1500, 155 | icon: 'none' 156 | }) 157 | } else { 158 | let id = res.data[0]._id 159 | // db.collection('message').doc(id) 160 | // .update({ 161 | // data: { 162 | // list: db.command.unshift(app.userInfo._id) 163 | // } 164 | // }) 165 | wx.cloud.callFunction({ 166 | name: 'update', 167 | data: { 168 | collection: 'message', 169 | doc: id, 170 | data: `{ 171 | list: _.unshift('${app.userInfo._id}') 172 | }` 173 | } 174 | }) 175 | .then(res => { 176 | wx.showToast({ 177 | title: '请求发送成功!', 178 | duration: 1500 179 | }) 180 | }) 181 | } 182 | 183 | } else { // 无数据 添加 184 | db.collection('message').add({ 185 | data: { 186 | userId: this.data.info._id, 187 | list: [app.userInfo._id] 188 | } 189 | }).then(res => { 190 | wx.showToast({ 191 | title: '请求发送成功!', 192 | duration: 1500 193 | }) 194 | }) 195 | } 196 | }) 197 | 198 | } else { 199 | wx.showToast({ 200 | title: '请先登录!', 201 | duration: 2000, 202 | icon: 'none', 203 | success: () => { 204 | setTimeout(() => { 205 | wx.switchTab({ 206 | url: '../user/user' 207 | }) 208 | }, 2000) 209 | } 210 | }) 211 | } 212 | } 213 | }) -------------------------------------------------------------------------------- /miniprogram/pages/home/home.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/home/home.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{ info.nickName }} 12 | 13 | 14 | 15 | 地区:{{ info.city+','+info.province }} 16 | 17 | 18 | 22 | 23 | 24 | 25 | 个性签名 26 | {{ info.signature || '这个人很懒,什么也没留下~' }} 27 | 28 | 29 | 30 | 手机号 31 | 32 | {{ info.phoneNumber || '(未设置)' }} 33 | 34 | 35 | 仅好友可见 36 | 37 | 38 | 39 | 微信号 40 | 41 | {{ info.wxId || '(未设置)' }} 42 | 43 | 44 | 仅好友可见 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /miniprogram/pages/home/home.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/home/home.wxss */ 2 | .home{ margin: 0 20rpx;} 3 | .header{ height: 200rpx; padding: 35rpx 10rpx; background: #fff; position: relative; border-bottom: 1px solid #cdcdcd;} 4 | .header .avatar{ width: 200rpx; height: 200rpx; border-radius: 10px;float: left;} 5 | 6 | .header .main{ float: left; height: 200rpx; padding: 20rpx 15rpx; width: 55%; box-sizing: border-box;} 7 | .header .main .name{ font-size: 18px;} 8 | .header .main .name text{ display: inline-block; max-width: 85%; padding-left: 5rpx; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} 9 | .header .main .name .iconnan { color: skyblue;} 10 | .header .main .name .iconnv { color: hotpink;} 11 | 12 | .header .main .area{ font-size: 12px; color: grey;} 13 | 14 | .header .likes{ float: right; padding-right: 15rpx; position: relative; top: 50%; transform: translateY(-50%);} 15 | .header .likes text{ display: block; text-align: center;} 16 | .header .likes .iconfont{ color: tomato; font-size: 28px;} 17 | .header .likes .likes-number{ font: 10px lightslategray;} 18 | 19 | .other{ margin: 20rpx 15rpx;} 20 | .other view{ height: 80rpx; border-bottom: 1px dashed #cdcdcd; line-height: 100rpx;} 21 | .other .item{ font-size: 16px; font-weight: bold; margin-right: 20rpx;} 22 | .other .signature{ width: 100%; overflow-x: hidden;} 23 | 24 | .other .iconfont{ margin-left: 15rpx; font-size: 55rpx; color: #ffde55;} 25 | .other .iconfuzhi{ font-size: 35rpx;} 26 | 27 | button { margin: 50rpx 30rpx 0; background: #fff;} 28 | 29 | .tip { font-size: 12px; color: tomato;} -------------------------------------------------------------------------------- /miniprogram/pages/index/index.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/index/index.js 2 | 3 | const db = wx.cloud.database() 4 | const app = getApp() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | imgUrls: [], 13 | dataList: [], 14 | current: 'likes' 15 | }, 16 | 17 | /** 18 | * 生命周期函数--监听页面加载 19 | */ 20 | onLoad: function (options) { 21 | 22 | }, 23 | 24 | /** 25 | * 生命周期函数--监听页面初次渲染完成 26 | */ 27 | onReady: function () { 28 | wx.cloud.callFunction({ 29 | name: 'login', 30 | data: {} 31 | }).then(res => { 32 | // 实现自动登录功能 33 | let db = wx.cloud.database() 34 | db.collection('users').where({ 35 | _openid: res.result.openid 36 | }).get().then((res) => { 37 | if (res.data.length) { 38 | app.userInfo = Object.assign(app.userInfo, res.data[0]); 39 | app.isLogged = true 40 | wx.showToast({ 41 | title: `${app.userInfo.nickName} 欢迎回来~`, 42 | icon: 'none' 43 | }) 44 | this.refreshData() 45 | this.watchMessage() 46 | } else { 47 | app.isLogged = false 48 | } 49 | }) 50 | }) 51 | this.getBannerList() 52 | }, 53 | 54 | /** 55 | * 生命周期函数--监听页面显示 56 | */ 57 | onShow: function () { 58 | this.refreshData() 59 | }, 60 | 61 | /** 62 | * 生命周期函数--监听页面隐藏 63 | */ 64 | onHide: function () { 65 | 66 | }, 67 | 68 | /** 69 | * 生命周期函数--监听页面卸载 70 | */ 71 | onUnload: function () { 72 | 73 | }, 74 | 75 | /** 76 | * 页面相关事件处理函数--监听用户下拉动作 77 | */ 78 | onPullDownRefresh: function () { 79 | wx.showLoading({ 80 | title: '正在刷新...', 81 | }) 82 | this.refreshData() 83 | wx.showToast({ 84 | title: '刷新成功', 85 | }) 86 | wx.stopPullDownRefresh() 87 | }, 88 | 89 | /** 90 | * 页面上拉触底事件的处理函数 91 | */ 92 | onReachBottom: function () { 93 | 94 | }, 95 | 96 | /** 97 | * 用户点击右上角分享 98 | */ 99 | onShareAppMessage: function () { 100 | 101 | }, 102 | refreshData(){ 103 | db.collection('users') 104 | .field({ 105 | userAvatar: true, 106 | nickName: true, 107 | gender: true, 108 | likes: true 109 | }) 110 | .orderBy(this.data.current, 'desc') 111 | .get() 112 | .then((res) => { 113 | this.setData({ 114 | dataList: res.data 115 | }) 116 | }) 117 | }, 118 | handleClick(ev){ 119 | let current = ev.target.dataset.sort 120 | if(current == this.data.current){ 121 | return false 122 | } 123 | this.setData({ 124 | current 125 | }) 126 | this.refreshData() 127 | }, 128 | toHome(ev){ 129 | let id = ev.target.dataset.id 130 | wx.navigateTo({ 131 | url: `../home/home?userId=${id}` 132 | }) 133 | }, 134 | watchMessage() { 135 | db.collection('message').where({ 136 | userId: app.userInfo._id 137 | }).watch({ 138 | onChange: function(snapshot) { 139 | if (snapshot.docChanges.length) { 140 | let list = snapshot.docChanges[0].doc.list 141 | if (list.length) { // 有消息 142 | wx.showTabBarRedDot({ 143 | index: 2 144 | }) 145 | app.userMessage = list 146 | // console.log('message list:',app.userMessage) 147 | app.toRefresh = true 148 | } else { 149 | wx.hideTabBarRedDot({ 150 | index: 2 151 | }) 152 | app.userMessage = [] 153 | } 154 | } 155 | }, 156 | onError: function(err) { 157 | console.error('the watch closed because of error', err) 158 | } 159 | }) 160 | }, 161 | getBannerList(){ 162 | db.collection('banner').limit(5).get().then(res => { 163 | // console.log(res.data) 164 | this.setData({ 165 | imgUrls: res.data 166 | }) 167 | }) 168 | } 169 | }) -------------------------------------------------------------------------------- /miniprogram/pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "search": "/components/search/search" 4 | }, 5 | "enablePullDownRefresh": true, 6 | "onReachBottomDistance": 50 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 推荐 21 | 最新 22 | 23 | 24 | 25 | 26 | 27 | {{ item.nickName }} 28 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /miniprogram/pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/index/index.wxss */ 2 | .index-swiper{ 3 | height: 400rpx; 4 | margin: 110rpx 20rpx 20rpx 20rpx; 5 | border-radius: 10rpx; 6 | overflow: hidden; 7 | } 8 | .index-swiper image{ 9 | width: 100%; 10 | height: 100%; 11 | } 12 | .index-tab{ 13 | display: flex; 14 | margin: 20rpx 0; 15 | position: sticky; 16 | top: 90rpx; 17 | left: 0; 18 | } 19 | .index-tab view{ 20 | flex: 1; 21 | text-align: center; 22 | padding: 20rpx 0; 23 | margin: 0 0 20rpx; 24 | background: #fff; 25 | } 26 | .index-tab view.active{ 27 | border-bottom: 2px solid #ffde55; 28 | color: #ffde55; 29 | } 30 | 31 | .index-list{ display: flex; flex-wrap: wrap; margin: 0 24rpx; margin-bottom: 20px;} 32 | .index-list .index-list-item{ width: 50%; margin-bottom: 20rpx;} 33 | .index-list .index-list-item image{ display: block; width: 90%; height: 300rpx; margin: 0 auto;} 34 | 35 | .index-list-text{ display: flex; width: 90%; height: 24px; justify-content: space-between; margin: 0 auto; color: #ffde55; font-size: 16px;} 36 | .index-list-text .iconfont{ font-size: 16px; color: tomato;} 37 | .index-list-text .likes-number { font-size: 12px; color: lightslategray;} 38 | .index-list-text .name{ color: hotpink; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} 39 | -------------------------------------------------------------------------------- /miniprogram/pages/message/message.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/message/message.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | isLogged: false, 13 | userMessage: [] 14 | }, 15 | 16 | /** 17 | * 生命周期函数--监听页面加载 18 | */ 19 | onLoad: function (options) { 20 | wx.setNavigationBarTitle({ 21 | title: '消息列表' 22 | }) 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面初次渲染完成 27 | */ 28 | onReady: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面显示 34 | */ 35 | onShow: function () { 36 | if (!app.userInfo._id) { 37 | wx.showToast({ 38 | title: '请先登录!', 39 | duration: 2000, 40 | icon: 'none', 41 | success: () => { 42 | setTimeout(() => { 43 | wx.switchTab({ 44 | url: '../user/user' 45 | }) 46 | }, 2000) 47 | } 48 | }) 49 | } else { 50 | this.setData({ 51 | isLogged: app.isLogged, 52 | userMessage: app.userMessage 53 | }) 54 | } 55 | }, 56 | 57 | /** 58 | * 生命周期函数--监听页面隐藏 59 | */ 60 | onHide: function () { 61 | 62 | }, 63 | 64 | /** 65 | * 生命周期函数--监听页面卸载 66 | */ 67 | onUnload: function () { 68 | 69 | }, 70 | 71 | /** 72 | * 页面相关事件处理函数--监听用户下拉动作 73 | */ 74 | onPullDownRefresh: function () { 75 | this.onShow() 76 | wx.showToast({ 77 | title: '刷新成功', 78 | success: () => { 79 | wx.stopPullDownRefresh() 80 | } 81 | }) 82 | }, 83 | 84 | /** 85 | * 页面上拉触底事件的处理函数 86 | */ 87 | onReachBottom: function () { 88 | 89 | }, 90 | 91 | /** 92 | * 用户点击右上角分享 93 | */ 94 | onShareAppMessage: function () { 95 | 96 | }, 97 | onDelete(ev){ 98 | this.setData({ 99 | userMessage: [] 100 | },() => { 101 | this.setData({ 102 | userMessage: ev.detail 103 | }) 104 | }) 105 | } 106 | }) -------------------------------------------------------------------------------- /miniprogram/pages/message/message.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "message-list": "/components/messageList/messageList" 4 | }, 5 | "enablePullDownRefresh": true, 6 | "onReachBottomDistance": 50 7 | } -------------------------------------------------------------------------------- /miniprogram/pages/message/message.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 暂无消息 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /miniprogram/pages/message/message.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/message/message.wxss */ 2 | .no-message{ font-size: 16px; color: #cdcdcd; position: absolute; top: 50%; left: 50%; transform: translate(-50%);} 3 | .message-list .message-item{ height: 50rpx;} -------------------------------------------------------------------------------- /miniprogram/pages/near/near.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/near/near.js 2 | 3 | const db = wx.cloud.database() 4 | const app = getApp() 5 | const _ = db.command 6 | 7 | Page({ 8 | 9 | /** 10 | * 页面的初始数据 11 | */ 12 | data: { 13 | longitude: undefined, 14 | latitude: undefined, 15 | markers: [] 16 | }, 17 | getLocation () { 18 | wx.getLocation({ 19 | type: 'gcj02', 20 | success: (res) => { 21 | const latitude = res.latitude 22 | const longitude = res.longitude 23 | this.setData({ 24 | longitude, 25 | latitude 26 | }) 27 | this.getNearUsers() 28 | } 29 | }) 30 | }, 31 | getNearUsers () { 32 | db.collection('users').where({ 33 | location: _.geoNear({ 34 | geometry: db.Geo.Point(this.data.longitude, this.data.latitude), 35 | minDistance: 0, 36 | maxDistance: 5000 37 | }), 38 | isLocation: true 39 | }).field({ 40 | longitude: true, 41 | latitude: true, 42 | userAvatar: true 43 | }).get().then(res => { 44 | // console.log(res.data) 45 | let data = res.data 46 | let result = [] 47 | if (data.length) { 48 | for (let i = 0; i < data.length; i++) { 49 | result.push({ 50 | iconPath: data[i].userAvatar, 51 | id: data[i]._id, 52 | latitude: data[i].latitude, 53 | longitude: data[i].longitude, 54 | width: 30, 55 | height: 30 56 | }) 57 | } 58 | this.setData({ 59 | markers: result 60 | }) 61 | } 62 | }) 63 | }, 64 | markertap (ev) { 65 | const id = ev.markerId 66 | wx.navigateTo({ 67 | url: `/pages/home/home?userId=${id}` 68 | }) 69 | }, 70 | /** 71 | * 生命周期函数--监听页面加载 72 | */ 73 | onLoad: function (options) { 74 | // this.getLocation() 75 | if (!app.userInfo._id) { 76 | wx.showToast({ 77 | title: '请先登录!', 78 | duration: 2000, 79 | icon: 'none', 80 | success: () => { 81 | setTimeout(() => { 82 | wx.switchTab({ 83 | url: '../user/user' 84 | }) 85 | }, 2000) 86 | } 87 | }) 88 | } else { 89 | const timer = setInterval(() => { 90 | if (this.data.longitude) { 91 | clearInterval(timer) 92 | db.collection('users').doc(app.userInfo._id).update({ 93 | data: { 94 | longitude: this.data.longitude, 95 | latitude: this.data.latitude, 96 | location: db.Geo.Point(this.data.longitude, this.data.latitude) 97 | } 98 | }) 99 | } 100 | }, 50) 101 | } 102 | }, 103 | 104 | /** 105 | * 生命周期函数--监听页面初次渲染完成 106 | */ 107 | onReady: function () { 108 | }, 109 | 110 | /** 111 | * 生命周期函数--监听页面显示 112 | */ 113 | onShow: function () { 114 | this.getLocation() 115 | }, 116 | 117 | /** 118 | * 生命周期函数--监听页面隐藏 119 | */ 120 | onHide: function () { 121 | 122 | }, 123 | 124 | /** 125 | * 生命周期函数--监听页面卸载 126 | */ 127 | onUnload: function () { 128 | 129 | }, 130 | 131 | /** 132 | * 页面相关事件处理函数--监听用户下拉动作 133 | */ 134 | onPullDownRefresh: function () { 135 | 136 | }, 137 | 138 | /** 139 | * 页面上拉触底事件的处理函数 140 | */ 141 | onReachBottom: function () { 142 | 143 | }, 144 | 145 | /** 146 | * 用户点击右上角分享 147 | */ 148 | onShareAppMessage: function () { 149 | 150 | } 151 | }) -------------------------------------------------------------------------------- /miniprogram/pages/near/near.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": { 3 | "search": "/components/search/search" 4 | } 5 | } -------------------------------------------------------------------------------- /miniprogram/pages/near/near.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | -------------------------------------------------------------------------------- /miniprogram/pages/near/near.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/near/near.wxss */ 2 | .near{ position: absolute; top: 0; left: 0; width: 100%; height: 100%;} 3 | #map{ width: 100%; height: 100%;} -------------------------------------------------------------------------------- /miniprogram/pages/user/user.js: -------------------------------------------------------------------------------- 1 | // miniprogram/pages/user/user.js 2 | 3 | const app = getApp() 4 | const db = wx.cloud.database() 5 | 6 | Page({ 7 | 8 | /** 9 | * 页面的初始数据 10 | */ 11 | data: { 12 | userAvatar: "/images/user/user-unlogin.png", 13 | nickName: '', 14 | signature: '', 15 | homepage: '', 16 | isLogged: false, 17 | disabled: true 18 | }, 19 | 20 | /** 21 | * 生命周期函数--监听页面加载 22 | */ 23 | onLoad: function (options) { 24 | wx.setNavigationBarTitle({ 25 | title: '我的' 26 | }) 27 | }, 28 | 29 | /** 30 | * 生命周期函数--监听页面初次渲染完成 31 | */ 32 | onReady: function () { 33 | this.getLocation() 34 | if (app.isLogged) { 35 | this.setData({ 36 | userAvatar: app.userInfo.userAvatar, 37 | nickName: app.userInfo.nickName, 38 | signature: app.userInfo.signature, 39 | homepage: `../home/home?userId=${app.userInfo._id}`, 40 | isLogged: true 41 | }) 42 | } else { 43 | this.setData({ 44 | isLogged: false, 45 | disabled: false 46 | }) 47 | } 48 | }, 49 | 50 | /** 51 | * 生命周期函数--监听页面显示 52 | */ 53 | onShow: function () { 54 | this.setData({ 55 | userAvatar: app.userInfo.userAvatar, 56 | nickName: app.userInfo.nickName, 57 | signature: app.userInfo.signature 58 | }) 59 | }, 60 | 61 | /** 62 | * 生命周期函数--监听页面隐藏 63 | */ 64 | onHide: function () { 65 | 66 | }, 67 | 68 | /** 69 | * 生命周期函数--监听页面卸载 70 | */ 71 | onUnload: function () { 72 | 73 | }, 74 | 75 | /** 76 | * 页面相关事件处理函数--监听用户下拉动作 77 | */ 78 | onPullDownRefresh: function () { 79 | 80 | }, 81 | 82 | /** 83 | * 页面上拉触底事件的处理函数 84 | */ 85 | onReachBottom: function () { 86 | 87 | }, 88 | 89 | /** 90 | * 用户点击右上角分享 91 | */ 92 | onShareAppMessage: function () { 93 | 94 | }, 95 | bindGetUserInfo (ev) { 96 | // 点击按钮后获取用户信息 97 | let userInfo = ev.detail.userInfo 98 | if (!this.data.isLogged && userInfo) { 99 | // 向集合users中添加记录 100 | db.collection('users').add({ 101 | data: { 102 | userAvatar: userInfo.avatarUrl, 103 | nickName: userInfo.nickName, 104 | gender: userInfo.gender, 105 | province: userInfo.province, 106 | city: userInfo.city, 107 | country: userInfo.country, 108 | signature: '', 109 | phoneNumber: '', 110 | wxId:'', 111 | likes: 0, 112 | time: new Date(), 113 | isLocation: true, 114 | longitude: this.longitude, 115 | latitude: this.latitude, 116 | location: db.Geo.Point(this.longitude, this.latitude), 117 | friendList: [] 118 | } 119 | }).then((res) => { 120 | // 读取信息并更新到全局属性中 121 | db.collection('users').doc(res._id).get().then((res) => { 122 | app.userInfo = Object.assign( app.userInfo, res.data ) 123 | // 利用setData方法更新数据 124 | this.setData({ 125 | userAvatar: app.userInfo.userAvatar, 126 | nickName: app.userInfo.nickName, 127 | isLogged: true 128 | }) 129 | app.isLogged = true 130 | this.watchMessage() 131 | }) 132 | }) 133 | } 134 | }, 135 | watchMessage() { 136 | db.collection('message').where({ 137 | userId: app.userInfo._id 138 | }).watch({ 139 | onChange: function(snapshot) { 140 | if (snapshot.docChanges.length) { 141 | let list = snapshot.docChanges[0].doc.list 142 | if (list.length) { // 有消息 143 | wx.showTabBarRedDot({ 144 | index: 2 145 | }) 146 | app.userMessage = list 147 | // console.log('message list:',app.userMessage) 148 | app.toRefresh = true 149 | } else { 150 | wx.hideTabBarRedDot({ 151 | index: 2 152 | }) 153 | app.userMessage = [] 154 | } 155 | } 156 | }, 157 | onError: function(err) { 158 | console.error('the watch closed because of error', err) 159 | } 160 | }) 161 | }, 162 | getLocation () { 163 | wx.getLocation({ 164 | type: 'gcj02', 165 | success: (res) => { 166 | this.latitude = res.latitude 167 | this.longitude = res.longitude 168 | } 169 | }) 170 | } 171 | }) -------------------------------------------------------------------------------- /miniprogram/pages/user/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "usingComponents": {} 3 | } -------------------------------------------------------------------------------- /miniprogram/pages/user/user.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 23 | 24 | 25 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /miniprogram/pages/user/user.wxss: -------------------------------------------------------------------------------- 1 | /* miniprogram/pages/user/user.wxss */ 2 | .user-info{ height: 200rpx; background: #fff; border-bottom: 85rpx solid #f6f6f6; display: flex; align-items: center;} 3 | .user-info image{ width: 160rpx; height: 160rpx; margin: 20rpx; border-radius: 10rpx;} 4 | .user-info button{ margin: 0;} 5 | .user-info-text { height: 100rpx; width: 60%;} 6 | .user-info-text text { display: block; height: 50%; width: 100%; box-sizing: border-box; overflow-x: hidden; text-overflow: ellipsis; white-space: nowrap;} 7 | /* .user-info-text .nickname {} */ 8 | .user-info-text .signature { padding-left: 10rpx; font-size: 14px; color: gray;} 9 | 10 | /* .user-info-list{} */ 11 | .user-info-list-item{ 12 | height: 50rpx; 13 | border-bottom: 1px #cdcdcd solid; 14 | background: #ffffff; 15 | padding: 10px; 16 | display: flex; 17 | align-items: center; 18 | justify-content: space-between; 19 | } 20 | -------------------------------------------------------------------------------- /miniprogram/sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /miniprogram/style/iconfont/iconfont.wxss: -------------------------------------------------------------------------------- 1 | @font-face {font-family: "iconfont"; 2 | src: url('//at.alicdn.com/t/font_1625439_zv3236w0bp7.eot?t=1581508058533'); /* IE9 */ 3 | src: url('//at.alicdn.com/t/font_1625439_zv3236w0bp7.eot?t=1581508058533#iefix') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('data:application/x-font-woff2;charset=utf-8;base64,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') format('woff2'), 5 | url('//at.alicdn.com/t/font_1625439_zv3236w0bp7.woff?t=1581508058533') format('woff'), 6 | url('//at.alicdn.com/t/font_1625439_zv3236w0bp7.ttf?t=1581508058533') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ 7 | url('//at.alicdn.com/t/font_1625439_zv3236w0bp7.svg?t=1581508058533#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family: "iconfont" !important; 12 | font-size: 16px; 13 | font-style: normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icondel:before { 19 | content: "\e607"; 20 | } 21 | 22 | .iconqingkong:before { 23 | content: "\e626"; 24 | } 25 | 26 | .iconxihuan1:before { 27 | content: "\e64b"; 28 | } 29 | 30 | .icontouxiang:before { 31 | content: "\e616"; 32 | } 33 | 34 | .iconjiantou-copy:before { 35 | content: "\e600"; 36 | } 37 | 38 | .iconquanzi:before { 39 | content: "\e668"; 40 | } 41 | 42 | .iconfuzhi:before { 43 | content: "\e6a1"; 44 | } 45 | 46 | .iconnv:before { 47 | content: "\e666"; 48 | } 49 | 50 | .iconshezhi:before { 51 | content: "\e667"; 52 | } 53 | 54 | .iconsousuo:before { 55 | content: "\e669"; 56 | } 57 | 58 | .iconxihuan:before { 59 | content: "\e66a"; 60 | } 61 | 62 | .iconzhuye:before { 63 | content: "\e66d"; 64 | } 65 | 66 | .icondianhua:before { 67 | content: "\e66e"; 68 | } 69 | 70 | .icondingwei:before { 71 | content: "\e66f"; 72 | } 73 | 74 | .icondianzan:before { 75 | content: "\e670"; 76 | } 77 | 78 | .iconmingpian:before { 79 | content: "\e671"; 80 | } 81 | 82 | .iconliaotian:before { 83 | content: "\e672"; 84 | } 85 | 86 | .iconnan:before { 87 | content: "\e673"; 88 | } 89 | -------------------------------------------------------------------------------- /miniprogram/style/pages.wxss: -------------------------------------------------------------------------------- 1 | page{ 2 | background: #f6f6f6; 3 | } -------------------------------------------------------------------------------- /miniprogram/wxs/numberFormat.wxs: -------------------------------------------------------------------------------- 1 | var numberFormat = function(number){ 2 | if(number >= 1000){ 3 | number = (number/1000).toFixed(1) + 'k'; 4 | } 5 | return number; 6 | } 7 | module.exports.numberFormat = numberFormat; 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "koa2": "^2.0.0-alpha.7" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "miniprogramRoot": "miniprogram/", 3 | "cloudfunctionRoot": "cloudfunctions/", 4 | "sitemapLocation": "sitemap.json", 5 | "setting": { 6 | "urlCheck": true, 7 | "es6": true, 8 | "postcss": true, 9 | "minified": true, 10 | "newFeature": true, 11 | "autoAudits": false, 12 | "checkInvalidKey": true, 13 | "checkSiteMap": true, 14 | "uploadWithSourceMap": true, 15 | "babelSetting": { 16 | "ignore": [], 17 | "disablePlugins": [], 18 | "outputPath": "" 19 | } 20 | }, 21 | "appid": "wx4647d862a37b1e96", 22 | "projectname": "Meow%20Chat", 23 | "libVersion": "2.10.1", 24 | "simulatorType": "wechat", 25 | "simulatorPluginLibVersion": {}, 26 | "condition": { 27 | "search": { 28 | "current": -1, 29 | "list": [] 30 | }, 31 | "conversation": { 32 | "current": -1, 33 | "list": [] 34 | }, 35 | "plugin": { 36 | "current": -1, 37 | "list": [] 38 | }, 39 | "game": { 40 | "list": [] 41 | }, 42 | "gamePlugin": { 43 | "current": -1, 44 | "list": [] 45 | }, 46 | "miniprogram": { 47 | "current": 1, 48 | "list": [ 49 | { 50 | "id": -1, 51 | "name": "db guide", 52 | "pathName": "pages/databaseGuide/databaseGuide", 53 | "query": "" 54 | }, 55 | { 56 | "id": -1, 57 | "name": "我的", 58 | "pathName": "pages/user/user", 59 | "query": "", 60 | "scene": null 61 | }, 62 | { 63 | "id": -1, 64 | "name": "pages/editUserInfo/editUserInfo", 65 | "pathName": "pages/editUserInfo/editUserInfo", 66 | "query": "", 67 | "scene": null 68 | }, 69 | { 70 | "id": -1, 71 | "name": "pages/editUserInfo/signature/signature", 72 | "pathName": "pages/editUserInfo/signature/signature", 73 | "query": "", 74 | "scene": null 75 | }, 76 | { 77 | "id": 4, 78 | "name": "pages/home/home", 79 | "pathName": "pages/home/home", 80 | "query": "userId=17d3d92e-0346-45f9-8c0c-9e9d45c852e8", 81 | "scene": null 82 | }, 83 | { 84 | "id": -1, 85 | "name": "pages/message/message", 86 | "pathName": "pages/message/message", 87 | "query": "userId=74b140b45e3d4cca0bcf05b9027b6ae0", 88 | "scene": null 89 | }, 90 | { 91 | "id": -1, 92 | "name": "pages/friendList/friendList", 93 | "pathName": "pages/friendList/friendList", 94 | "query": "", 95 | "scene": null 96 | }, 97 | { 98 | "id": -1, 99 | "name": "pages/near/near", 100 | "pathName": "pages/near/near", 101 | "scene": null 102 | } 103 | ] 104 | } 105 | } 106 | } -------------------------------------------------------------------------------- /sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": [{ 3 | "action": "allow", 4 | "pages": "*" 5 | }] 6 | } --------------------------------------------------------------------------------