master
wuxiang 3 years ago
parent e97fc7c19c
commit 21d48233f8

@ -1,37 +1,38 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/chat/chat",
"pages/logs/logs", "pages/index/index",
"pages/test/icon", "pages/logs/logs",
"pages/test/cover-view", "pages/test/icon",
"pages/test/moveable-view", "pages/test/cover-view",
"pages/test/swiper", "pages/test/moveable-view",
"pages/test/scrollview", "pages/test/swiper",
"pages/test/view", "pages/test/scrollview",
"pages/test/text", "pages/test/view",
"pages/test/rich-text", "pages/test/text",
"pages/test/progress", "pages/test/rich-text",
"pages/test/button", "pages/test/progress",
"pages/test/checkbox", "pages/test/button",
"pages/test/input", "pages/test/checkbox",
"pages/test/form", "pages/test/input",
"pages/test/picker", "pages/test/form",
"pages/test/picker-view", "pages/test/picker",
"pages/test/radio", "pages/test/picker-view",
"pages/test/slider", "pages/test/radio",
"pages/test/switch", "pages/test/slider",
"pages/test/textarea", "pages/test/switch",
"pages/test/audio", "pages/test/textarea",
"pages/test/image", "pages/test/audio",
"pages/test/video", "pages/test/image",
"pages/test/camera" "pages/test/video",
], "pages/test/camera"
"window": { ],
"backgroundTextStyle": "light", "window": {
"navigationBarBackgroundColor": "#fff", "backgroundTextStyle": "light",
"navigationBarTitleText": "Weixin", "navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black" "navigationBarTitleText": "Weixin",
}, "navigationBarTextStyle": "black"
"style": "v2", },
"sitemapLocation": "sitemap.json" "style": "v2",
"sitemapLocation": "sitemap.json"
} }

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

@ -0,0 +1,16 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()
return {
event,
openid: wxContext.OPENID,
appid: wxContext.APPID,
unionid: wxContext.UNIONID,
}
}

@ -0,0 +1,14 @@
{
"name": "getOpenId",
"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.5.3"
}
}

@ -0,0 +1,85 @@
// pages/chat/chat.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.cloud.init()
wx.cloud.callFunction({
name: 'getOpenId',
complete: res => {
console.log('callFunction test result: ', res)
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
wx.cloud.init({env:'cloud1-2go8vh3uf39b51e1'})
const db = wx.cloud.database()
const _=db.command
const watcher = db.collection('message').where({
room:'bf4a0bf261c46ca1000a8f8d7fcf50e2',
time:_.gt(new Date('2021-12-23 00:00:00'))
}).watch({
onChange:snapshot=>{
console.log('新事件',snapshot)
},
onError:err=>{
console.error('监听错误',err)
}
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

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

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

@ -0,0 +1 @@
/* pages/chat/chat.wxss */

@ -1,5 +1,6 @@
{ {
"description": "项目配置文件", "description": "项目配置文件",
"cloudfunctionRoot": "cloudfunctions/",
"packOptions": { "packOptions": {
"ignore": [ "ignore": [
{ {
@ -59,6 +60,7 @@
"servePath": "" "servePath": ""
}, },
"isGameTourist": false, "isGameTourist": false,
"cloudfunctionTemplateRoot": "cloudfunctionTemplate",
"condition": { "condition": {
"search": { "search": {
"list": [] "list": []

Loading…
Cancel
Save