diff --git a/cloudfunctions/OCR_getPrint/config.json b/cloudfunctions/OCR_getPrint/config.json new file mode 100644 index 0000000..6197dd1 --- /dev/null +++ b/cloudfunctions/OCR_getPrint/config.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "openapi": [ + "openapi.ocr.printedText" + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/OCR_getPrint/index.js b/cloudfunctions/OCR_getPrint/index.js new file mode 100644 index 0000000..001bd57 --- /dev/null +++ b/cloudfunctions/OCR_getPrint/index.js @@ -0,0 +1,22 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') + +cloud.init() + +// 云函数入口函数 +exports.main = async (event, context) => { + + const{ + buffer + } =event + let imgBuffer=new Buffer(buffer) + let result + result=await cloud.openapi.ocr.printedText({ + type:"photo", + img:{ + contentType:"image/png", + value:imgBuffer + } + }) + return result +} \ No newline at end of file diff --git a/cloudfunctions/OCR_getPrint/package.json b/cloudfunctions/OCR_getPrint/package.json new file mode 100644 index 0000000..415f9cf --- /dev/null +++ b/cloudfunctions/OCR_getPrint/package.json @@ -0,0 +1,14 @@ +{ + "name": "OCR_getPhoto", + "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.4.0" + } +} \ No newline at end of file diff --git a/cloudfunctions/getCollection/config.json b/cloudfunctions/getCollection/config.json new file mode 100644 index 0000000..5ecc33e --- /dev/null +++ b/cloudfunctions/getCollection/config.json @@ -0,0 +1,6 @@ +{ + "permissions": { + "openapi": [ + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/getCollection/index.js b/cloudfunctions/getCollection/index.js new file mode 100644 index 0000000..74cfdaf --- /dev/null +++ b/cloudfunctions/getCollection/index.js @@ -0,0 +1,19 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') + +cloud.init() + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + + if(event._id!=null){ + return await cloud.database().collection("Collection").where({ + _openid:wxContext.OPENID, + noteid:event._id + }).get() + } + else return await cloud.database().collection("Collection").where({ + _openid:wxContext.OPENID + }).get() +} \ No newline at end of file diff --git a/cloudfunctions/getCollection/package.json b/cloudfunctions/getCollection/package.json new file mode 100644 index 0000000..d0e532f --- /dev/null +++ b/cloudfunctions/getCollection/package.json @@ -0,0 +1,14 @@ +{ + "name": "getCollection", + "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.4.0" + } +} \ No newline at end of file diff --git a/cloudfunctions/getNotes/config.json b/cloudfunctions/getNotes/config.json new file mode 100644 index 0000000..5ecc33e --- /dev/null +++ b/cloudfunctions/getNotes/config.json @@ -0,0 +1,6 @@ +{ + "permissions": { + "openapi": [ + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/getNotes/index.js b/cloudfunctions/getNotes/index.js new file mode 100644 index 0000000..4ce5441 --- /dev/null +++ b/cloudfunctions/getNotes/index.js @@ -0,0 +1,32 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') + +cloud.init() + +// 云函数入口函数 +exports.main = async (event, context) => { + + const wxContext = cloud.getWXContext() + if(event.type==3){ + return await cloud.database().collection("note").where({ + _id:event._id + }).get() + }else if(event.type==1){ + return await cloud.database().collection("note").where({ + title:new RegExp(event.title) + }).orderBy('Collection', 'desc').get() + }else if(event.type==2){ + return await cloud.database().collection("note").where({ + title:new RegExp(event.title), + _id:event.noteid + }).orderBy('create_time', 'desc').get() + }else return await cloud.database().collection("note").where({ + _openid:wxContext.OPENID, + title:new RegExp(event.title) + }).orderBy('create_time', 'desc').get() + // .then(res=>{ + // return res + // }).catch(res=>{ + // return res + // }) +} \ No newline at end of file diff --git a/cloudfunctions/getNotes/package.json b/cloudfunctions/getNotes/package.json new file mode 100644 index 0000000..5e30ba6 --- /dev/null +++ b/cloudfunctions/getNotes/package.json @@ -0,0 +1,14 @@ +{ + "name": "getNotes", + "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.4.0" + } +} \ No newline at end of file diff --git a/cloudfunctions/getopid/config.json b/cloudfunctions/getopid/config.json new file mode 100644 index 0000000..5ecc33e --- /dev/null +++ b/cloudfunctions/getopid/config.json @@ -0,0 +1,6 @@ +{ + "permissions": { + "openapi": [ + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/getopid/index.js b/cloudfunctions/getopid/index.js new file mode 100644 index 0000000..fb682ec --- /dev/null +++ b/cloudfunctions/getopid/index.js @@ -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, + } +} \ No newline at end of file diff --git a/cloudfunctions/getopid/package.json b/cloudfunctions/getopid/package.json new file mode 100644 index 0000000..b1cedc1 --- /dev/null +++ b/cloudfunctions/getopid/package.json @@ -0,0 +1,14 @@ +{ + "name": "getopid", + "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.4.0" + } +} \ No newline at end of file diff --git a/cloudfunctions/updatenote/config.json b/cloudfunctions/updatenote/config.json new file mode 100644 index 0000000..5ecc33e --- /dev/null +++ b/cloudfunctions/updatenote/config.json @@ -0,0 +1,6 @@ +{ + "permissions": { + "openapi": [ + ] + } +} \ No newline at end of file diff --git a/cloudfunctions/updatenote/index.js b/cloudfunctions/updatenote/index.js new file mode 100644 index 0000000..64cc156 --- /dev/null +++ b/cloudfunctions/updatenote/index.js @@ -0,0 +1,21 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') + +cloud.init() + +// 云函数入口函数 +exports.main = async (event, context) => { + + if(event.type==2){ + return await cloud.database().collection('note').doc(event.itemid).update({ + data:{ + Collection:cloud.database().command.inc(-1) + } + }) + }else return await cloud.database().collection('note').doc(event.itemid).update({ + data:{ + Collection:cloud.database().command.inc(1) + } + }) + +} \ No newline at end of file diff --git a/cloudfunctions/updatenote/package.json b/cloudfunctions/updatenote/package.json new file mode 100644 index 0000000..888a43c --- /dev/null +++ b/cloudfunctions/updatenote/package.json @@ -0,0 +1,14 @@ +{ + "name": "updatenote", + "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.4.0" + } +} \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js new file mode 100644 index 0000000..846e084 --- /dev/null +++ b/miniprogram/app.js @@ -0,0 +1,22 @@ +//app.js +App({ + globalData:{ + islogin:false + }, + onLaunch: function () { + if (!wx.cloud) { + console.error('请使用 2.2.3 或以上的基础库以使用云能力') + } else { + wx.cloud.init({ + // env 参数说明: + // env 参数决定接下来小程序发起的云开发调用(wx.cloud.xxx)会默认请求到哪个云环境的资源 + // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 + // 如不填则使用默认环境(第一个创建的环境) + // env: 'my-env-id', + traceUser: true, + }) + } + + this.globalData = {} + } +}) diff --git a/miniprogram/app.json b/miniprogram/app.json new file mode 100644 index 0000000..191453d --- /dev/null +++ b/miniprogram/app.json @@ -0,0 +1,55 @@ +{ + "pages": [ + "pages/index/index", + "pages/myCollection/myCollection", + "pages/community/community", + "pages/chakan/chakan", + "pages/paibiji/paibiji", + "pages/home/home", + "pages/xiugaibiji/xiugaibiji", + "pages/dubiji/dubiji", + "pages/xiebiji/xiebiji" + + ], + "window": { + "backgroundColor": "#DDDCE1", + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#DDDCE1", + "navigationBarTitleText": "晴川课堂笔记", + "navigationBarTextStyle": "black", + "enablePullDownRefresh":true + }, + "tabBar": { + "list": [{ + "pagePath": "pages/index/index", + "text": "主页", + "iconPath": "images/zhuye_0.png", + "selectedIconPath": "images/zhuye_1.png" + }, + { + "pagePath": "pages/community/community", + "text": "班级", + "iconPath": "images/shequ_0.png", + "selectedIconPath": "images/shequ_1.png" + } + ,{ + "pagePath": "pages/home/home", + "text": "我的", + "iconPath": "images/geren_0.png", + "selectedIconPath": "images/geren_1.png" + }], + "selectedColor":"#0094aa" + }, + "sitemapLocation": "sitemap.json", + "style": "v2", + "plugins": { + "ocr-plugin": { + "version": "3.0.6", + "provider": "wx4418e3e031e551be" + }, + "WechatSI": { + "version": "0.3.4", + "provider": "wx069ba97219f66d99" + } + } +} \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss new file mode 100644 index 0000000..82678d6 --- /dev/null +++ b/miniprogram/app.wxss @@ -0,0 +1,156 @@ +/**app.wxss**/ +.container { + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; +} + +button { + background: initial; +} + +button:focus{ + outline: 0; +} + +button::after{ + border: none; +} + + +page { + background: #f6f6f6; + display: flex; + flex-direction: column; + justify-content: flex-start; +} + +.userinfo, .uploader, .tunnel { + margin-top: 40rpx; + height: 140rpx; + width: 100%; + background: #fff; + border: 1px solid rgba(0, 0, 0, 0.1); + border-left: none; + border-right: none; + display: flex; + flex-direction: row; + align-items: center; + transition: all 300ms ease; +} + +.userinfo-avatar { + width: 100rpx; + height: 100rpx; + margin: 20rpx; + border-radius: 50%; + background-size: cover; + background-color: white; +} + +.userinfo-avatar:after { + border: none; +} + +.userinfo-nickname { + font-size: 32rpx; + color: #007aff; + background-color: white; + background-size: cover; +} + +.userinfo-nickname::after { + border: none; +} + +.uploader, .tunnel { + height: auto; + padding: 0 0 0 40rpx; + flex-direction: column; + align-items: flex-start; + box-sizing: border-box; +} + +.uploader-text, .tunnel-text { + width: 100%; + line-height: 52px; + font-size: 34rpx; + color: #007aff; +} + +.uploader-container { + width: 100%; + height: 400rpx; + padding: 20rpx 20rpx 20rpx 0; + display: flex; + align-content: center; + justify-content: center; + box-sizing: border-box; + border-top: 1px solid rgba(0, 0, 0, 0.1); +} + +.uploader-image { + width: 100%; + height: 360rpx; +} + +.tunnel { + padding: 0 0 0 40rpx; +} + +.tunnel-text { + position: relative; + color: #222; + display: flex; + flex-direction: row; + align-content: center; + justify-content: space-between; + box-sizing: border-box; + border-top: 1px solid rgba(0, 0, 0, 0.1); +} + +.tunnel-text:first-child { + border-top: none; +} + +.tunnel-switch { + position: absolute; + right: 20rpx; + top: -2rpx; +} + +.disable { + color: #888; +} + +.service { + position: fixed; + right: 40rpx; + bottom: 40rpx; + width: 140rpx; + height: 140rpx; + border-radius: 50%; + background: linear-gradient(#007aff, #0063ce); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3); + display: flex; + align-content: center; + justify-content: center; + transition: all 300ms ease; +} + +.service-button { + position: absolute; + top: 40rpx; +} + +.service:active { + box-shadow: none; +} + +.request-text { + padding: 20rpx 0; + font-size: 24rpx; + line-height: 36rpx; + word-break: break-all; +} diff --git a/miniprogram/images/geren_0.png b/miniprogram/images/geren_0.png new file mode 100644 index 0000000..f7c387b Binary files /dev/null and b/miniprogram/images/geren_0.png differ diff --git a/miniprogram/images/geren_1.png b/miniprogram/images/geren_1.png new file mode 100644 index 0000000..390c089 Binary files /dev/null and b/miniprogram/images/geren_1.png differ diff --git a/miniprogram/images/grid.png b/miniprogram/images/grid.png new file mode 100644 index 0000000..066a6c1 Binary files /dev/null and b/miniprogram/images/grid.png differ diff --git a/miniprogram/images/jiahao1.png b/miniprogram/images/jiahao1.png new file mode 100644 index 0000000..e252e50 Binary files /dev/null and b/miniprogram/images/jiahao1.png differ diff --git a/miniprogram/images/laji.png b/miniprogram/images/laji.png new file mode 100644 index 0000000..f5ffcf0 Binary files /dev/null and b/miniprogram/images/laji.png differ diff --git a/miniprogram/images/paibiji.png b/miniprogram/images/paibiji.png new file mode 100644 index 0000000..946d7c4 Binary files /dev/null and b/miniprogram/images/paibiji.png differ diff --git a/miniprogram/images/shanchu.png b/miniprogram/images/shanchu.png new file mode 100644 index 0000000..97511c3 Binary files /dev/null and b/miniprogram/images/shanchu.png differ diff --git a/miniprogram/images/shequ_0.png b/miniprogram/images/shequ_0.png new file mode 100644 index 0000000..84edf88 Binary files /dev/null and b/miniprogram/images/shequ_0.png differ diff --git a/miniprogram/images/shequ_1.png b/miniprogram/images/shequ_1.png new file mode 100644 index 0000000..4237e5c Binary files /dev/null and b/miniprogram/images/shequ_1.png differ diff --git a/miniprogram/images/wenjian0.png b/miniprogram/images/wenjian0.png new file mode 100644 index 0000000..788005f Binary files /dev/null and b/miniprogram/images/wenjian0.png differ diff --git a/miniprogram/images/wenjian1.png b/miniprogram/images/wenjian1.png new file mode 100644 index 0000000..1dc0f6c Binary files /dev/null and b/miniprogram/images/wenjian1.png differ diff --git a/miniprogram/images/xiebiji.png b/miniprogram/images/xiebiji.png new file mode 100644 index 0000000..aadda76 Binary files /dev/null and b/miniprogram/images/xiebiji.png differ diff --git a/miniprogram/images/xieriji.png b/miniprogram/images/xieriji.png new file mode 100644 index 0000000..019a5b5 Binary files /dev/null and b/miniprogram/images/xieriji.png differ diff --git a/miniprogram/images/xx.png b/miniprogram/images/xx.png new file mode 100644 index 0000000..6cb9759 Binary files /dev/null and b/miniprogram/images/xx.png differ diff --git a/miniprogram/images/xx2.png b/miniprogram/images/xx2.png new file mode 100644 index 0000000..7f40e75 Binary files /dev/null and b/miniprogram/images/xx2.png differ diff --git a/miniprogram/images/yuying.png b/miniprogram/images/yuying.png new file mode 100644 index 0000000..15dbee8 Binary files /dev/null and b/miniprogram/images/yuying.png differ diff --git a/miniprogram/images/yuying1.png b/miniprogram/images/yuying1.png new file mode 100644 index 0000000..5c3dff1 Binary files /dev/null and b/miniprogram/images/yuying1.png differ diff --git a/miniprogram/images/zhi.jpg b/miniprogram/images/zhi.jpg new file mode 100644 index 0000000..b883f8a Binary files /dev/null and b/miniprogram/images/zhi.jpg differ diff --git a/miniprogram/images/zhuye_0.png b/miniprogram/images/zhuye_0.png new file mode 100644 index 0000000..316a675 Binary files /dev/null and b/miniprogram/images/zhuye_0.png differ diff --git a/miniprogram/images/zhuye_1.png b/miniprogram/images/zhuye_1.png new file mode 100644 index 0000000..b76fda5 Binary files /dev/null and b/miniprogram/images/zhuye_1.png differ diff --git a/miniprogram/pages/chakan/chakan.js b/miniprogram/pages/chakan/chakan.js new file mode 100644 index 0000000..ba99589 --- /dev/null +++ b/miniprogram/pages/chakan/chakan.js @@ -0,0 +1,84 @@ + +Page({ + + /** + * 页面的初始数据 + */ + data: { + _id:"", + title:"", + content:"", + text:"" + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (e) { + this.setData({ + _id:e.id + }) + wx.cloud.callFunction({ + name:"getNotes", + data:{ + type:3, + _id:this.data._id, + } + }).then(res=>{ + this.setData({ + title:res.result.data[0].title, + content:res.result.data[0].content, + text:res.result.data[0].text + }) + }).catch(res=>{ + console.log("笔记获取失败",res); + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function (e) { + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/chakan/chakan.json b/miniprogram/pages/chakan/chakan.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/chakan/chakan.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/chakan/chakan.wxml b/miniprogram/pages/chakan/chakan.wxml new file mode 100644 index 0000000..0cf2de2 --- /dev/null +++ b/miniprogram/pages/chakan/chakan.wxml @@ -0,0 +1,4 @@ + + + + diff --git a/miniprogram/pages/chakan/chakan.wxss b/miniprogram/pages/chakan/chakan.wxss new file mode 100644 index 0000000..3aed245 --- /dev/null +++ b/miniprogram/pages/chakan/chakan.wxss @@ -0,0 +1,20 @@ +.xiebj_2{ + border-bottom: 1px solid rgb(92, 100, 99); + position: relative; + width: 50%; +} +.neirong_1{ + + border-top: 1px solid rgb(119, 134, 131); +} +page{ + background-color: #DDDCE1; + +} +.btn_2{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(59, 168, 168); + background-color: rgba(151, 94, 204, 0.267); +} \ No newline at end of file diff --git a/miniprogram/pages/community/community.js b/miniprogram/pages/community/community.js new file mode 100644 index 0000000..4e6fa8f --- /dev/null +++ b/miniprogram/pages/community/community.js @@ -0,0 +1,174 @@ +// pages/community/community.js +const _ = wx.cloud.database().command; +var app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + _openid:"", + list:[], + title:"", + itemid:"" + }, + note: function (e) { + if (e.currentTarget.dataset.type == 1) { + wx.navigateTo({ + url: '../chakan/chakan?id=' + e.currentTarget.dataset.id + }) + } else { + wx.navigateTo({ + url: '../chakan/chakan?id=' + e.currentTarget.dataset.id + }) + } + }, + getCollections(_id){ + wx.cloud.callFunction({ + name:"getCollection", + data:{ + _id:_id + } + }).then(res=>{ + if(app.globalData.islogin){ + if(res.result.data[0]!=null){ + wx.showToast({ + icon:"none", + title: '已经收藏过了', + }) + }else{ + wx.cloud.callFunction({ + name:"updatenote", + data:{ + itemid:this.data.itemid + } + }).then(res=>{ + wx.showToast({ + title: '收藏成功', + }) + this.getnotes() + wx.cloud.database().collection('Collection').add({ + data:{ + noteid:this.data.itemid + } + }).catch(res=>{ + console.log("noteid写入数据库失败",res) + }) + }).catch(res=>{ + console.log("收藏失败",res) + }) + } + }else{ + wx.showToast({ + icon:"none", + title: '请先授权', + }) + } + + }).catch(res=>{ + console.log("getCollection失败",res); + }) + }, + search(e){ + this.setData({ + title:e.detail.value + } + ) + this.getnotes() + }, + CollectionFs(e){ + this.setData({ + itemid:e.currentTarget.dataset.itemid + }), + this.getCollections(this.data.itemid), + this.getnotes() + }, + getnotes(){ + wx.cloud.callFunction({ + name:"getNotes", + data:{ + title:this.data.title, + type:1 + } + }).then(res=>{ + this.setData({ + list:res.result.data + }) + }).catch(res=>{ + console.log("调用getNotes失败",res); + }) + }, + onToggle() { + this.setData({ + value: "", + isSearch:false, + title:"", + }) + this.getnotes() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.cloud.callFunction({ + name:"getopid", + success: res=>{ + this.setData({ + _openid:res.result.openid + }) + }, + fail(res){ + console.log("getopid获取失败",res); + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getnotes() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/community/community.json b/miniprogram/pages/community/community.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/community/community.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/community/community.wxml b/miniprogram/pages/community/community.wxml new file mode 100644 index 0000000..39d2551 --- /dev/null +++ b/miniprogram/pages/community/community.wxml @@ -0,0 +1,53 @@ + + + + + + + + 搜索 + + + + + + + + + + + + + + {{item.title}} + + + {{item.create_time}} + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/community/community.wxss b/miniprogram/pages/community/community.wxss new file mode 100644 index 0000000..30d62e0 --- /dev/null +++ b/miniprogram/pages/community/community.wxss @@ -0,0 +1,371 @@ +/**index.wxss**/ + +.view_title{ + display: flex; + justify-content: center; +} +.view_content{ +padding: 1; +} +.navigator_title{ + padding: 20rpx; + flex: 1; +} +.navigator_content{ + padding: 30rpx; +} +/* .view_item{ + border: 1px solid #70bcf6; + +} */ +.search{ + width:700rpx; + height:70rpx; + background: rgb(245, 245, 245); + border-radius:30rpx; + padding-left: 20rpx; + display: flex; + +} +.search input{ + flex:1; + margin-left: 20rpx; + +} + +.search_item{ + background-color: aliceblue; + font-size: 26rpx; + display: flex; + align-items: center; +} + +/* 底部弹出 */ +.pupContentBG { width: 100vw; height: 100vh; position: fixed; top: 0; } + +.pupContent { + width: 100%; + top: 70%; + background: rgb(206, 198, 198); + position: absolute; + bottom: 0; box-shadow: 0 0 10rpx #333; + height: 0; z-index: 999; } /* 设置显示的背景 */ + +.showBG { display: block; } + +.hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + +@keyframes slideBGtUp { + from { background: transparent; } + to { background: rgba(0, 0, 0, 0.1); } } + +@keyframes slideBGDown { + from { background: rgba(0, 0, 0, 0.1); } + to { background: transparent; } } /* 显示或关闭内容时动画 */ + +.openBG { animation: slideBGtUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + +.closeBG { animation: slideBGDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ + +.showContent { display: block; } + +.hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + +@keyframes slideContentUp { + from { height: 0; } + to { height: 800rpx; } } + +@keyframes slideContentDown { + from { height: 800rpx; } + to { height: 0; } } /* 显示或关闭内容时动画 */ + +.open { + animation: slideContentUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + +.close { + animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } +.btn_22[plain]{ + padding: 0; + border:none; + /* width: 150rpx; */ + height: 150rpx; + position: fixed; + bottom: 0; + width: 100%; +} +.image_22{ + height: 150rpx; + position: fixed; + bottom: 0; + width: 20%; + right: 1%; +} +.xiebj_1{ + width: 120rpx; + height: 120rpx; +} +.paibj_1{ + width: 120rpx; + height: 120rpx; +} +.dubj_1{ + width: 120rpx; + height: 120rpx; +} +.riji_1{ + width: 120rpx; + height: 120rpx; +} + +.goods_item{ +display: flex; +} + +.goods_info_wrap{ + /* margin-top: 1%; */ +/* flex: 3; */ + +/* position: relative; */ +display: flex; +height: 150rpx; +flex-direction: column; +justify-content: space-around; +} +.img_6{ + width: 120rpx; + height: 120rpx; + } + .biaoti_1{ + text-align: left; + font-style: normal; + font-weight: bold; + font-size: 1.2rem; + color: #0f1213; + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + + -webkit-line-clamp: 1; + } +.neirong_1{ + color: rgb(44, 30, 66); + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + /* 第几行省略就是几👇 */ + -webkit-line-clamp: 2; +}/**index.wxss**/ + +.view_title{ + display: flex; + justify-content: center; +} +.view_content{ +padding: 1; +} +.navigator_title{ + padding: 20rpx; + flex: 1; +} +.navigator_content{ + padding: 30rpx; +} +/* .view_item{ + border: 1px solid #70bcf6; + +} */ + +.search{ + width:700rpx; + height:70rpx; + background: rgb(245, 245, 245); + border-radius:30rpx; + padding-left: 20rpx; + display: flex; + +} +.search input{ + flex:1; + margin-left: 20rpx; + +} + +.search_item{ + background-color: aliceblue; + font-size: 26rpx; + display: flex; + align-items: center; +} + +/* 底部弹出 */ +.pupContentBG { width: 100vw; height: 100vh; position: fixed; top: 0; } + +.pupContent { + width: 100%; + top: 70%; + background: rgb(206, 198, 198); + position: absolute; + bottom: 0; box-shadow: 0 0 10rpx #333; + height: 0; z-index: 999; } /* 设置显示的背景 */ + +.showBG { display: block; } + +.hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + +@keyframes slideBGtUp { + from { background: transparent; } + to { background: rgba(0, 0, 0, 0.1); } } + +@keyframes slideBGDown { + from { background: rgba(0, 0, 0, 0.1); } + to { background: transparent; } } /* 显示或关闭内容时动画 */ + +.openBG { animation: slideBGtUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + +.closeBG { animation: slideBGDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ + +.showContent { display: block; } + +.hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + +@keyframes slideContentUp { + from { height: 0; } + to { height: 800rpx; } } + +@keyframes slideContentDown { + from { height: 800rpx; } + to { height: 0; } } /* 显示或关闭内容时动画 */ + +.open { + animation: slideContentUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + +.close { + animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } +.btn_22[plain]{ + padding: 0; + border:none; + /* width: 150rpx; */ + height: 150rpx; + position: fixed; + bottom: 0; + width: 100%; +} +.image_22{ + height: 150rpx; + position: fixed; + bottom: 0; + width: 20%; + right: 1%; +} +.xiebj_1{ + width: 120rpx; + height: 120rpx; +} +.paibj_1{ + width: 120rpx; + height: 120rpx; +} +.dubj_1{ + width: 120rpx; + height: 120rpx; +} +.riji_1{ + width: 120rpx; + height: 120rpx; +} + +.goods_item{ +display: flex; +/* border-bottom: 1px solid rgb(112, 224, 209); */ +} +.goods_img_wrap{ + + display: flex; + justify-content: center; + align-items: center; + } +.first_tab{ + border-bottom: 1px solid rgb(190, 188, 204); + margin-top: 1%; + height: 13%; + + display: flex; + flex-wrap: wrap; +} +.shijian_1{ + position: relative; + left: 0; + font-size: 0.5rem; +} + + +.img_6{ + width: 120rpx; + height: 120rpx; + } + .btn_sc{ + position: absolute; + display: flex; + left: 80%; + width: 10%; + height:100rpx; + + + } + + .sc_1{ + position: absolute; + bottom: 0%; + left: 45%; + font-size: 15px; + font-weight: normal; + } + .image_1{ + position: absolute; + width: 70rpx; + height: 70rpx; + right: 15%; + bottom: 35%; + } + +.neirong_1{ + color: rgb(44, 30, 66); + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + /* 第几行省略就是几👇 */ + -webkit-line-clamp: 2; +} +.bg_99{ + background-color: #DDDCE1; +} +.top { + width: 100%; + background-color: #cfcbdf; +} +.topsearch { + width: 90%; + margin-left: 5%; + display: flex; + padding: 2% 0; + align-items: center; +} +.frame { + background-color: white; + width: 75%; + border-radius: 20rpx; + padding: 0 3%; +} +.frame>input { + font-size: 24rpx; + margin: 6rpx 0; +} +page{ + background-color: #DDDCE1; + +} +.topsearch>text { + width: 15%; + margin-left: 5%; + color: #040608; +} \ No newline at end of file diff --git a/miniprogram/pages/dubiji/dubiji.js b/miniprogram/pages/dubiji/dubiji.js new file mode 100644 index 0000000..84b86c8 --- /dev/null +++ b/miniprogram/pages/dubiji/dubiji.js @@ -0,0 +1,201 @@ +// pages/dubiji/dubiji.js +var plugin = requirePlugin("WechatSI") +let manager = plugin.getRecordRecognitionManager() +Page({ + + /** + * 页面的初始数据 + */ + data: { + title: '', + text: '', + text_old: '', + recording: false, // 正在录音 + recordStatus: 0, // 状态: 0 - 录音中 1- 翻译中 2 - 翻译完成/二次翻译 + id: '', + authed:false + }, + saveFs(){ + this.setData({ + create_time:new Date().toLocaleString() + }) + wx.cloud.database().collection("note").add({ + data:{ + title:this.data.title, + text:this.data.text, + content:this.data.text, + create_time:this.data.create_time, + type:1, + Collection:0 + }}).then(res=>{ + wx.switchTab({ + url: '/pages/index/index', + }) + }).catch(res=>{ + console.log("type=1 的笔记写入失败",res); + }) + }, + titleInput(e){ + this.setData({ + title:e.detail.value + }) + }, + textareaAInput(e){ + this.setData({ + text:e.detail.value + }) + }, + streamRecord(){ + wx.vibrateShort({ + complete: (res) => {}, + }) + manager.start({duration:30000, lang: "zh_CN"}) + }, + endStreamRecord(){ + // 防止重复触发stop函数 + manager.stop() + if (!this.data.recording || this.data.recordStatus != 0) { + console.warn("has finished!") + return + } + + + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (e) { + this.initRecord() + this.getRecordAuth() + }, + initRecord: function () { + //有新的识别内容返回,则会调用此事件 + // manager.onRecognize = (res) => { + // this.setData({ + // text: this.data.text_old + res.result, + // }) + // } + + // 识别结束事件 + manager.onStop = (res) => { + + let text = res.result + if (text == '') { + this.showRecordEmptyTip() + return + } + this.setData({ + text: this.data.text_old +text, + recordStatus: 1, + recording: false, + }), + this.setData({ + text_old:String(this.data.text) + }) + } + + // 识别错误事件 + manager.onError = (res) => { + + this.setData({ + recording: false, + }) + + } + }, + getRecordAuth: function () { + wx.getSetting().then(res=>{ + if(res.authSetting['scope.record']){ + this.setData({ + authed:true + }) + }else{ + wx.authorize({ + scope: 'scope.record', + }).then(res=>{ + this.setData({ + authed:true + }) + }).catch(res=>{ + this.cancel_auth() + }) + } + }) + }, + cancel_auth(){ + wx.showModal({ + title:"提示", + content:"未授权无法录音哦~", + cancelText:"不授权", + confirmText:"去授权", + success:res=>{ + if(res.confirm){ + wx.openSetting({ + success:res=>{ + if(res.authSetting['scope.record']){ + this.setData({ + authed:true + }) + } + } + }) + } + } + }) + }, + showRecordEmptyTip(){ + wx.showToast({ + title: '识别为空', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/dubiji/dubiji.json b/miniprogram/pages/dubiji/dubiji.json new file mode 100644 index 0000000..bc12026 --- /dev/null +++ b/miniprogram/pages/dubiji/dubiji.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + + } +} \ No newline at end of file diff --git a/miniprogram/pages/dubiji/dubiji.wxml b/miniprogram/pages/dubiji/dubiji.wxml new file mode 100644 index 0000000..09a66be --- /dev/null +++ b/miniprogram/pages/dubiji/dubiji.wxml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/miniprogram/pages/dubiji/dubiji.wxss b/miniprogram/pages/dubiji/dubiji.wxss new file mode 100644 index 0000000..9a74fc2 --- /dev/null +++ b/miniprogram/pages/dubiji/dubiji.wxss @@ -0,0 +1,56 @@ +.v_view{ + background-color:#C0CCD8; + display: flex; + width: 10vh; + left: 27vh; + position: relative; + justify-content: center; +} +.i_voice{ + /* right: 00vh; + left: 25vh; */ + width: 110rpx; + height: 110rpx; + border-radius: 50%; + z-index: 999; + position: relative; + justify-content: center; +} +.bg_1{ + background-color: #DDDCE1; +} +.txt_1{ + display: flex; + flex: 1; + text-align: center; + justify-content: center; + line-height: 85rpx; + } +.re_1{ + + display: flex; + left: 0; + + justify-content: center; + position: fixed; + } +.wenben_1{ + display: flex; + flex: 2; + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(21, 24, 24); + position: relative; + left: 50%; +} +.re_2{ + display: inline; +} +.yuyin_1{ + display: inline; +} +page{ + background-color: #DDDCE1; + +} \ No newline at end of file diff --git a/miniprogram/pages/home/home.js b/miniprogram/pages/home/home.js new file mode 100644 index 0000000..560cc91 --- /dev/null +++ b/miniprogram/pages/home/home.js @@ -0,0 +1,135 @@ +// pages/home/home.js +var app = getApp(); +const db=wx.cloud.database() +Page({ + + /** + * 页面的初始数据 + */ + data: { + userInfo:"", + hasUserInfo:false, + day:0, + openid:"", + count:0 + }, + handleContact (e) { + console.log(e.detail.path) + console.log(e.detail.query) + }, + shouquanFs(){ + this.getUserProfile() + }, + handleCollection(){ + wx.navigateTo({ + url: '../myCollection/myCollection', + }) + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 + // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + app.globalData.islogin=true + + db.collection("user").where({_openid:this.data.openid}).get() + .then(res=>{ + //将此用户添加到user表中 + if(res.data.length===0){ + wx.cloud.database().collection('user').add({ + data:{ + date:new Date(), + } + })} + this.setData({ + day:parseInt((new Date()-res.data[0].date)/86400000+1) + }) + }).catch(res=>{ + console.log("get失败",res); + }), + + //笔记数 + db.collection("note").where({_openid:this.data.openid}).count().then(res=>{ + const num=res.total + this.setData({ + count:num + }) + }) + }, + fail: (res)=>{ + console.log("用户信息获取失败",res); + } + }) + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.cloud.callFunction({ + name:"getopid" + }).then(res=>{ + this.setData({ + openid:res.result.openid + }) + }).catch(res=>{ + console.log("获取用户opid失败",res); + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // const userinfo=wx.getStorageSync('userinfo'); + // this.setData({userinfo}) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/home/home.json b/miniprogram/pages/home/home.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/home/home.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml new file mode 100644 index 0000000..404c0de --- /dev/null +++ b/miniprogram/pages/home/home.wxml @@ -0,0 +1,62 @@ + + + + + {{day}} + {{count}} + + + + + + + + + 使用天数 + 笔记数 + + + + + + + + + + + + + + + + + + + + + + diff --git a/miniprogram/pages/home/home.wxss b/miniprogram/pages/home/home.wxss new file mode 100644 index 0000000..906b41b --- /dev/null +++ b/miniprogram/pages/home/home.wxss @@ -0,0 +1,151 @@ +.user_info_wrap{ + height: 45vh; + background-color:" rgb(220, 221, 221)"; + overflow: hidden; + position: relative; + + } + .user_img_wrap{ + position: relative; + } + .user_bg{ + width: 100%; + height: 46vh; + /* 高斯模糊 */ + filter: blur(10rpx); + } + .user_info{ + position: absolute; + left: 50%; + transform: translateX(-50%); + top: 20%; + text-align: center; + + } + .user_icon{ + width: 165rpx; + height: 165rpx; + border-radius: 50%; + /* 边框圆角 */ + } + .user_name{ + color: aliceblue; + margin-top: 40rpx; + font-size: 40rpx; + } + .user_btn{ + position: absolute; + left: 50%; + transform: translateX(-50%); + top:45%; + color: rgb(104, 124, 118); + font-size: 60rpx; + border: 1rpx solid rgba(138, 182, 185, 0.596); + border-radius: 50rpx; + /* border: 1rpx solid rgba(183, 247, 10, 0.952); */ + /* color: rgb(228, 72, 33); + font-size: 38rpx; + padding: 30rpx; + border-radius: 50rpx; */ + } + .lodin_bg{ + width: 100%; + filter: blur(5rpx); + } + .good_1{ + flex-flow: column; + display:flex; + flex: 1; + margin-top: 5%; + margin-bottom: 0%; + } + /* .good_2{ + display:flex; + flex: 2; + } */ + .btn_fenxiang{ + display:flex; + flex: 1; + width: 100%; + border-bottom: 1px solid rgb(9, 14, 13); + } + .btn_sc{ + display:flex; + flex: 1; + border-bottom: 1px solid rgb(9, 14, 13) + } + .btn_kf{ + display:flex; + flex: 1; + border-bottom: 1px solid rgb(9, 14, 13); +} + .btn_fk{ + display:flex; + flex: 1; + border-bottom: 1px solid rgb(6, 12, 11); +} + + + +page{ + background-color: #DDDCE1; + +} +.divLine{ + position: absolute; + background: #000000; + width: 100%; + height: 1rpx; + bottom: 46%; + } +.bg_101{ + background-color: #DDDCE1; +} +.divLine2{ + position: absolute; + background: #000000; + width: 100%; + height: 1rpx; + bottom: 37%; + } +.bg_9527{ + display: flex; + flex-flow: column; +} +.txt_10{ + display: flex; + flex: 1; + flex-flow: row; +} +.txt_22{ + flex: 1; + flex-flow: row; + margin-left: 20%; + font-weight: bold; +} +.txt_12{ + flex: 1; + font-weight: bold; + flex-flow: row; + margin-left: 26%; +} +.txt_20{ + display: flex; + flex: 1; + flex-flow: row; +} +.txt_11{ + margin-left: 20%; + margin-top: 5%; + flex: 1; + font-weight: bold; + flex-flow: row; +} +.txt_21{ + margin-top: 5%; + font-weight: bold; + margin-left: 15%; + flex: 1; + flex-flow: row; +} + diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js new file mode 100644 index 0000000..3c56534 --- /dev/null +++ b/miniprogram/pages/index/index.js @@ -0,0 +1,155 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + list:[], + _openid:"", + itemid:"", + title:"", + // 底部弹出 + click: false, + option: false, + }, + + search(e){ + this.setData({ + title:e.detail.value + } + ) + this.getnotes() + }, + getnotes(){ + wx.cloud.callFunction({ + name:"getNotes", + data:{ + title:this.data.title + } + }).then(res=>{ + this.setData({ + list:res.result.data + }) + }).catch(res=>{ + console.log("调用getNotes失败",res); + }) + }, + shanchuFs(e){ + this.setData({ + itemid:e.currentTarget.dataset.itemid + }) + wx.cloud.database().collection('note').doc(this.data.itemid).remove().then(res=>{ + }).catch(res=>{ + console.log("删除失败",res) + }) + wx.cloud.database().collection('Collection').where({noteid:this.data.itemid}).remove().then(res=>{ + }).catch(res=>{ + console.log("删除失败",res) + }) + this.getnotes() + }, + note: function (e) { + if (e.currentTarget.dataset.type == 1) { + wx.navigateTo({ + url: '../xiugaibiji/xiugaibiji?id=' + e.currentTarget.dataset.id + }) + } else { + wx.navigateTo({ + url: '../xiugaibiji/xiugaibiji?id=' + e.currentTarget.dataset.id + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + wx.cloud.callFunction({ + name:"getopid", + success: res=>{ + this.setData({ + _openid:res.result.openid + }) + this.getnotes() + + }, + fail(res){ + console.log("getopid获取失败",res); + } + }) + }, + onToggle() { + this.setData({ + value: "", + isSearch:false, + title:"" + }) + this.getnotes() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getnotes() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + + // 底部弹窗 + clickPup: function() { + let _that = this; + if (!_that.data.click) + { + _that.setData({ click: true, }) + } + if (_that.data.option) { _that.setData({ option: false, }) // 关闭显示弹窗动画的内容,不设置的话会出现:点击任何地方都会出现弹窗,就不是指定位置点击出现弹窗了 + setTimeout(() => { + _that.setData({ click: false, }) }, 500) } + else { _that.setData({ option: true }) } }, + + + +}) + + diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml new file mode 100644 index 0000000..fca7a06 --- /dev/null +++ b/miniprogram/pages/index/index.wxml @@ -0,0 +1,92 @@ + + + + + + + + 搜索 + + + + + + + + + + + + + + {{item.title}} + + {{item.create_time}} + + + + + + + + + + + + + + + + + + 写笔记 + + + + 拍笔记 + + + + 读笔记 + + + + + + + + diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss new file mode 100644 index 0000000..5936e6d --- /dev/null +++ b/miniprogram/pages/index/index.wxss @@ -0,0 +1,277 @@ +/**index.wxss**/ + +.view_title{ + display: flex; + justify-content: center; +} +.view_content{ +padding: 1; +} +.navigator_title{ + padding: 20rpx; + flex: 1; +} +.navigator_content{ + padding: 30rpx; +} +.view_item{ + border: 1px solid #70bcf6; + +} +/* .search{ + width:700rpx; + height:70rpx; + background: rgb(245, 245, 245); + border-radius:30rpx; + padding-left: 20rpx; + display: flex; + +} */ +.search input{ + flex:1; + margin-left: 20rpx; + +} + +.search_item{ + background-color: aliceblue; + font-size: 26rpx; + display: flex; + align-items: center; +} + +/* 底部弹出 */ +.pupContentBG { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + + + } + + .pupContent { + width: 100%; + background-color: #C0CCD8; + top: 70%; + /* background:#DDDCE1; */ + position: absolute; + position:fixed; + bottom: 0; box-shadow: 0 0 10rpx #333; + height: 0; z-index: 999; } /* 设置显示的背景 */ + + .showBG { display: block; } + + .hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideBGtUp { + from { background: transparent; } + to { background: rgba(0, 0, 0, 0.1); } } + + @keyframes slideBGDown { + from { background: rgba(0, 0, 0, 0.1); } + to { background: transparent; } } /* 显示或关闭内容时动画 */ + + .openBG { animation: slideBGtUp 0.01s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .closeBG { animation: slideBGDown 0.01s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ + + .showContent { display: block; } + + .hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideContentUp { + from { height: 0; } + to { height: 100%; } } + + @keyframes slideContentDown { + from { height: 100%; } + to { height: 0; } } /* 显示或关闭内容时动画 */ + + .open { + animation: slideContentUp 0.01s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .close { + animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } +.btn_22[plain]{ + padding: 0; + border:none; + /* width: 150rpx; */ + height: 150rpx; + position: fixed; + bottom: 0; + + width: 100%; +} +.image_22{ + height: 150rpx; + position: fixed; + bottom: 0; + width: 50rpx; + right: 1%; +} +.xiebj_1{ + width: 80rpx; + height: 80rpx; + position: fixed; + left: 7%; +} +.paibj_1{ + width: 80rpx; + height: 80rpx; + position: fixed; + right: 45%; +} +.dubj_1{ + width: 80rpx; + height: 80rpx; + right: 7%; + position: fixed; +} +.riji_1{ + width: 120rpx; + height: 120rpx; +} + +.goods_item{ +display: flex; + +} + + +.goods_img_wrap{ + +display: flex; +justify-content: center; +align-items: center; +} +.img_6{ + width: 120rpx; + height: 120rpx; + } +.goods_info_wrap{ + /* margin-top: 1%; */ +/* flex: 3; */ + +/* position: relative; */ +display: flex; +height: 150rpx; +flex-direction: column; +justify-content: space-around; +} + +.biaoti_1{ + text-align: left; + font-style: normal; + font-weight: bold; + font-size: 1.2rem; + color: #0f1213; +display: -webkit-box; +overflow: hidden; +-webkit-box-orient: vertical; + +-webkit-line-clamp: 1; +} +.btn_sc{ + position: absolute; + display: flex; + left: 80%; + width: 10%; + height: 70rpx; + + +} +.image_1{ + position: absolute; + width: 70rpx; + height: 70rpx; + right: 15%; + bottom: 8%; +} +.neirong_1{ + color: rgb(44, 30, 66); + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + /* 第几行省略就是几👇 */ + -webkit-line-clamp: 2; +} +.shijian_1{ + position: relative; + left: 0; + font-size: 0.5rem; +} +.txt111{ + position: relative; + + align-items: center; + text-align: center; + justify-content: center; + /* border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(49, 47, 165); */ +} +.txt_66{ + position: fixed; + bottom: 150rpx; + left: 5%; +} +.txt_65{ + position: fixed; + bottom: 150rpx; + right: 5%; +} +page{ + background-color: #DDDCE1; + +} +.txt_64{ + position: fixed; + bottom: 150rpx; + right: 43%; +} +.bg_1{ + /* background-color: #DDDCE1; */ + width: 100%; + height: 100%; +} +.btn_fk{ + background-color: #C0CCD8; +} +.top { + width: 100%; + background-color: #cfcbdf; +} +.topsearch { + width: 90%; + margin-left: 5%; + display: flex; + padding: 2% 0; + align-items: center; +} +.frame { + background-color: white; + width: 75%; + border-radius: 20rpx; + padding: 0 3%; +} +.frame>input { + font-size: 24rpx; + margin: 6rpx 0; +} +.topsearch>text { + width: 15%; + margin-left: 5%; + color: #040608; +} +.first_tab{ + border-bottom: 1px solid rgb(190, 188, 204); + margin-top: 1%; + + display: flex; + flex-wrap: wrap; +} + + + diff --git a/miniprogram/pages/myCollection/myCollection.js b/miniprogram/pages/myCollection/myCollection.js new file mode 100644 index 0000000..a43b15e --- /dev/null +++ b/miniprogram/pages/myCollection/myCollection.js @@ -0,0 +1,124 @@ +// pages/myCollection/myCollection.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + Collections:[], + itemid:"", + list:[] + }, + async getCollections(){ + //调用云函数getCollection获取Collection表noteid[] + this.setData({ + list:[] + }) + wx.cloud.callFunction({ + name:"getCollection" + }).then(res=>{ + let datas=res.result.data + //根据noteid[]遍历,调用note数据库的get()把一条数据传给lists + //将lists赋值list + datas.forEach((element,index) => { + wx.cloud.callFunction({ + name:"getNotes", + data:{ + type:2, + noteid:element.noteid, + title:this.data.title + } + }).then(res=>{ + this.setData({ + list:this.data.list.concat(res.result.data[0]) + }) + }) + }); + this.setData({ + Collections:datas, + }) + }) + }, + + cancelCollection(e){ + this.setData({ + itemid:e.currentTarget.dataset.itemid + }) + wx.cloud.database().collection('Collection').where({noteid:this.data.itemid}).remove().then(res=>{ + }).catch(res=>{ + console.log("取消收藏失败",res) + }) + wx.cloud.callFunction({ + name:"updatenote", + data:{ + type:2, + itemid:this.data.itemid + } + }) + this.getCollections() + }, + note: function (e) { + if (e.currentTarget.dataset.type == 1) { + wx.navigateTo({ + url: '../chakan/chakan?id=' + e.currentTarget.dataset.id + }) + } else { + wx.navigateTo({ + url: '../chakan/chakan?id=' + e.currentTarget.dataset.id + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getCollections() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/myCollection/myCollection.json b/miniprogram/pages/myCollection/myCollection.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/myCollection/myCollection.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/myCollection/myCollection.wxml b/miniprogram/pages/myCollection/myCollection.wxml new file mode 100644 index 0000000..2aa5984 --- /dev/null +++ b/miniprogram/pages/myCollection/myCollection.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + {{item.title}} + + + {{item.create_time}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/myCollection/myCollection.wxss b/miniprogram/pages/myCollection/myCollection.wxss new file mode 100644 index 0000000..9873c54 --- /dev/null +++ b/miniprogram/pages/myCollection/myCollection.wxss @@ -0,0 +1,357 @@ +/**index.wxss**/ + +.view_title{ + display: flex; + justify-content: center; + } + .view_content{ + padding: 1; + } + .navigator_title{ + padding: 20rpx; + flex: 1; + } + .navigator_content{ + padding: 30rpx; + } + .view_item{ + border: 1px solid #70bcf6; + + } + .search{ + width:700rpx; + height:70rpx; + background: rgb(245, 245, 245); + border-radius:30rpx; + padding-left: 20rpx; + display: flex; + + } + .search input{ + flex:1; + margin-left: 20rpx; + + } + + .search_item{ + background-color: aliceblue; + font-size: 26rpx; + display: flex; + align-items: center; + } + + /* 底部弹出 */ + .pupContentBG { width: 100vw; height: 100vh; position: fixed; top: 0; } + + .pupContent { + width: 100%; + top: 70%; + background: rgb(206, 198, 198); + position: absolute; + bottom: 0; box-shadow: 0 0 10rpx #333; + height: 0; z-index: 999; } /* 设置显示的背景 */ + + .showBG { display: block; } + + .hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideBGtUp { + from { background: transparent; } + to { background: rgba(0, 0, 0, 0.1); } } + + @keyframes slideBGDown { + from { background: rgba(0, 0, 0, 0.1); } + to { background: transparent; } } /* 显示或关闭内容时动画 */ + + .openBG { animation: slideBGtUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .closeBG { animation: slideBGDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ + + .showContent { display: block; } + + .hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideContentUp { + from { height: 0; } + to { height: 800rpx; } } + + @keyframes slideContentDown { + from { height: 800rpx; } + to { height: 0; } } /* 显示或关闭内容时动画 */ + + .open { + animation: slideContentUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .close { + animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + .btn_22[plain]{ + padding: 0; + border:none; + /* width: 150rpx; */ + height: 150rpx; + position: fixed; + bottom: 0; + width: 100%; + } + .image_22{ + height: 150rpx; + position: fixed; + bottom: 0; + width: 20%; + right: 1%; + } + .xiebj_1{ + width: 120rpx; + height: 120rpx; + } + .paibj_1{ + width: 120rpx; + height: 120rpx; + } + .dubj_1{ + width: 120rpx; + height: 120rpx; + } + .riji_1{ + width: 120rpx; + height: 120rpx; + } + + .goods_item{ + display: flex; + /* border-bottom: 1px solid rgb(112, 224, 209); */ + } + .goods_img_wrap{ + + display: flex; + justify-content: center; + align-items: center; + } + + .img_6{ + width: 120rpx; + height: 120rpx; + } + .biaoti_1{ + text-align: left; + font-style: normal; + font-weight: bold; + font-size: 1.2rem; + color: #0f1213; + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + + -webkit-line-clamp: 1; + } + .shijian_1{ + position: relative; + left: 0; + font-size: 0.5rem; + } + .btn_sc{ + position: absolute; + display: flex; + left: 80%; + width: 10%; + height:100rpx; + + + } + .btn_sanchu{ + position: absolute; + display: flex; + left: 80%; + margin-top: 18%; + width: 40rpx; + + height: 100rpx; + + + } + .image_2{ + position: absolute; + width: 70rpx; + height: 70rpx; + right: 15%; + top: 5%; + + display: flex; + + } + .image_1{ + position: absolute; + width: 70rpx; + height: 70rpx; + right: 15%; + bottom: 35%; + } + + .sc_1{ + position: absolute; + bottom: 0%; + left: 45%; + font-size: 15px; + font-weight: normal; + } + .shoucang_1{ + position: relative; + left: 75%; + font-size: 0.5rem; + } + .neirong_1{ + color: rgb(44, 30, 66); + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + /* 第几行省略就是几👇 */ + -webkit-line-clamp: 2; + } +.view_title{ + display: flex; + justify-content: center; + } + .view_content{ + padding: 1; + } + .navigator_title{ + padding: 20rpx; + flex: 1; + } + .navigator_content{ + padding: 30rpx; + } + .view_item{ + border: 1px solid #70bcf6; + + } + .search{ + width:700rpx; + height:70rpx; + background: rgb(245, 245, 245); + border-radius:30rpx; + padding-left: 20rpx; + display: flex; + + } + .search input{ + flex:1; + margin-left: 20rpx; + + } + + .search_item{ + background-color: aliceblue; + font-size: 26rpx; + display: flex; + align-items: center; + } + + /* 底部弹出 */ + .pupContentBG { width: 100vw; height: 100vh; position: fixed; top: 0; } + + .pupContent { + width: 100%; + top: 70%; + background: rgb(206, 198, 198); + position: absolute; + bottom: 0; box-shadow: 0 0 10rpx #333; + height: 0; z-index: 999; } /* 设置显示的背景 */ + + .showBG { display: block; } + + .hideBG { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideBGtUp { + from { background: transparent; } + to { background: rgba(0, 0, 0, 0.1); } } + + @keyframes slideBGDown { + from { background: rgba(0, 0, 0, 0.1); } + to { background: transparent; } } /* 显示或关闭内容时动画 */ + + .openBG { animation: slideBGtUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .closeBG { animation: slideBGDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } /* 设置显示内容 */ + + .showContent { display: block; } + + .hideContent { display: none; } /* 弹出或关闭动画来动态设置内容高度 */ + + @keyframes slideContentUp { + from { height: 0; } + to { height: 800rpx; } } + + @keyframes slideContentDown { + from { height: 800rpx; } + to { height: 0; } } /* 显示或关闭内容时动画 */ + + .open { + animation: slideContentUp 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + + .close { + animation: slideContentDown 0.5s ease-in both; /* animation-fill-mode: both 动画将会执行 forwards 和 backwards 执行的动作。 */ } + .btn_22[plain]{ + padding: 0; + border:none; + /* width: 150rpx; */ + height: 150rpx; + position: fixed; + bottom: 0; + width: 100%; + } + .image_22{ + height: 150rpx; + position: fixed; + bottom: 0; + width: 20%; + right: 1%; + } + .xiebj_1{ + width: 120rpx; + height: 120rpx; + } + .paibj_1{ + width: 120rpx; + height: 120rpx; + } + .dubj_1{ + width: 120rpx; + height: 120rpx; + } + .riji_1{ + width: 120rpx; + height: 120rpx; + } + + .goods_item{ + display: flex; + + } + .goods_info_wrap{ + /* margin-top: 1%; */ + /* flex: 3; */ + + /* position: relative; */ + display: flex; + height: 150rpx; + flex-direction: column; + justify-content: space-around; + } + +.bg_13{ + background-color: #DDDCE1; + +} +page{ + background-color: #DDDCE1; + +} +.first_tab{ + border-bottom: 1px solid rgb(153, 151, 165); + margin-top: 1%; + height: 200rpx; + + display: flex; + flex-wrap: wrap; +} diff --git a/miniprogram/pages/paibiji/paibiji.js b/miniprogram/pages/paibiji/paibiji.js new file mode 100644 index 0000000..7f5011a --- /dev/null +++ b/miniprogram/pages/paibiji/paibiji.js @@ -0,0 +1,101 @@ +// pages/demo01/demo01.js +Page({ + data:{ + img_src:"", + img_text:[], + text:"", + create_time:"", + title:"", + content:"" + }, + titletFs(e){ + this.setData({ + title:e.detail.value + }) + }, + onEditorReady(){ + const that = this + wx.createSelectorQuery().select('#editor').context(function(res) { + that.editorCtx = res.context + that.editorCtx.setContents({ + html:that.data.content + }); + }).exec() + + }, + saveFs(){ + this.setData({ + create_time:new Date().toLocaleString() + }) + wx.cloud.database().collection("note").add({ + data:{ + img_src:this.data.img_src, + title:this.data.title, + text:this.data.text, + content:this.data.content, + create_time:this.data.create_time, + type:1, + Collection:0 + }}).then(res=>{ + wx.switchTab({ + url: '/pages/index/index', + }) + }).catch(res=>{ + console.log("type=1 的笔记写入失败",res); + }) + } + , + upImg(){ + let that=this + wx.chooseImage({ + count: 1, + sizeType: [ 'compressed'], + sourceType: ['album', 'camera'], + success: res => { + // tempFilePath可以作为img标签的src属性显示图片 + const tempFilePaths = res.tempFilePaths; + this.uploadFile(tempFilePaths[0]); + let fileBuffer=wx.getFileSystemManager().readFileSync(tempFilePaths[0]); + wx.cloud.callFunction({ + name:"OCR_getPrint", + data:{ + buffer:fileBuffer + }, + success :res => { + let items=res.result.items; + let text="" + let content="" + items.forEach(element => { + text=text+element.text; + content=content+"

"+element.text+"


"; + }); + that.setData({ + img_text:items, + text, + content + }) + this.onEditorReady() + }, + fail(res){ + console.log("识别失败",res); + } + }) + + } + }) + + }, + uploadFile(tempFilePaths){ + wx.cloud.uploadFile({ + cloudPath: new Date().getTime()+'.png', // 上传至云端的路径 + filePath: tempFilePaths, // 小程序临时文件路径 + success: res => { + // 返回文件 ID + this.setData({ + img_src:res.fileID + }) + }, + fail: console.error + }) + } +}) \ No newline at end of file diff --git a/miniprogram/pages/paibiji/paibiji.json b/miniprogram/pages/paibiji/paibiji.json new file mode 100644 index 0000000..c4f3fd1 --- /dev/null +++ b/miniprogram/pages/paibiji/paibiji.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "ocr-navigator": "plugin://ocr-plugin/ocr-navigator" + } +} \ No newline at end of file diff --git a/miniprogram/pages/paibiji/paibiji.wxml b/miniprogram/pages/paibiji/paibiji.wxml new file mode 100644 index 0000000..1accd06 --- /dev/null +++ b/miniprogram/pages/paibiji/paibiji.wxml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/paibiji/paibiji.wxss b/miniprogram/pages/paibiji/paibiji.wxss new file mode 100644 index 0000000..16b698d --- /dev/null +++ b/miniprogram/pages/paibiji/paibiji.wxss @@ -0,0 +1,41 @@ +.xiebj_2{ + text-align: center; + border-bottom: 1px solid rgb(9, 14, 13); + + position: relative; + width: 50%; +} +/* .neirong_1{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(59, 168, 168); +} */ +.bg_99{ + margin-top: 5%; +} +.btn_2{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(59, 168, 168); + background-color: rgba(151, 94, 204, 0.267); +} +.btn_9{ + border: 1rpx solid rgba(138, 182, 185, 0.596); + background-color: #C0CCD8; + position: relative; + left: 0rpx; + top: -8rpx; + width: 336rpx; height: 100rpx; display: block; box-sizing: border-box +} +page{ + background-color: #DDDCE1; + +} +.bg_1{ + background-color: #DDDCE1; +} +.btn_1{ + background-color: #C0CCD8; +} \ No newline at end of file diff --git a/miniprogram/pages/xiebiji/xiebiji.js b/miniprogram/pages/xiebiji/xiebiji.js new file mode 100644 index 0000000..9de0264 --- /dev/null +++ b/miniprogram/pages/xiebiji/xiebiji.js @@ -0,0 +1,103 @@ +// pages/xiebiji/xiebiji.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + title:"", + text:"", + content:"", + create_time:"", + }, + contentFs(e){ + this.setData({ + text: e.detail.text, + content: e.detail.html + }) + }, + + + titletFs(e){ + this.setData({ + title:e.detail.value + }) + }, + + xieFs(){ + this.setData({ + create_time:new Date().toLocaleString() + }) + wx.cloud.database().collection("note").add({ + data:{ + title:this.data.title, + text:this.data.text, + content:this.data.content, + create_time:this.data.create_time, + type:1, + Collection:0 + }}).then(res=>{ + wx.switchTab({ + url: '/pages/index/index', + }) + }).catch(res=>{ + console.log("type=1 的笔记写入失败",res); + }) + + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/xiebiji/xiebiji.json b/miniprogram/pages/xiebiji/xiebiji.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/xiebiji/xiebiji.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/xiebiji/xiebiji.wxml b/miniprogram/pages/xiebiji/xiebiji.wxml new file mode 100644 index 0000000..4c18c09 --- /dev/null +++ b/miniprogram/pages/xiebiji/xiebiji.wxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/miniprogram/pages/xiebiji/xiebiji.wxss b/miniprogram/pages/xiebiji/xiebiji.wxss new file mode 100644 index 0000000..5765c69 --- /dev/null +++ b/miniprogram/pages/xiebiji/xiebiji.wxss @@ -0,0 +1,44 @@ +.xiebj_2{ + display: flex; + flex: 2; + border-bottom: 1px solid rgb(113, 122, 120); + position: relative; + + margin-left: 13%; + } + /* .neirong_1{ + /* border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(59, 168, 168); */ + /* } */ + .btn_2{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(24, 24, 24); + background-color: #C0CCD8; + } + + .txt_1{ + display: flex; + flex: 1; + text-align: center; + justify-content: center; + line-height: 85rpx; + } + .re_1{ + + display: flex; + left: 0; + + justify-content: center; + position: fixed; + } + page{ + background-color: #DDDCE1; + + } + .bg_22{ + background-color: #DDDCE1; + } \ No newline at end of file diff --git a/miniprogram/pages/xiugaibiji/xiugaibiji.js b/miniprogram/pages/xiugaibiji/xiugaibiji.js new file mode 100644 index 0000000..ec38c59 --- /dev/null +++ b/miniprogram/pages/xiugaibiji/xiugaibiji.js @@ -0,0 +1,116 @@ +// pages/xiugaibiji/xiugaibiji.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + _id:"", + title:"", + content:"", + text:"" + }, + contentFs(e){ + this.setData({ + text: e.detail.text, + content: e.detail.html + }) + }, + onEditorReady(){ + const that = this + wx.createSelectorQuery().select('#editor').context(function(res) { + that.editorCtx = res.context + that.editorCtx.setContents({ + html:that.data.content + }); + }).exec() + + }, + + titletFs(e){ + this.setData({ + title:e.detail.value + }) + }, + xiugaiFs(){ + wx.cloud.database().collection("note").doc(this.data._id).update({ + data:{ + title:this.data.title, + content:this.data.content, + text:this.data.text, + create_time:new Date().toLocaleString() + } + }).then(res=>{ + wx.switchTab({ + url: '/pages/index/index',}) + }).catch(res=>{ + console.log("笔记修改失败",res); + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (e) { + this.setData({ + _id:e.id + }) + wx.cloud.database().collection("note").doc(this.data._id).get().then(res=>{ + this.setData({ + title:res.data.title, + content:res.data.content, + text:res.data.text + }) + this.onEditorReady() + }).catch(res=>{ + console.log("笔记获取失败",res); + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function (e) { + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/xiugaibiji/xiugaibiji.json b/miniprogram/pages/xiugaibiji/xiugaibiji.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/xiugaibiji/xiugaibiji.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/xiugaibiji/xiugaibiji.wxml b/miniprogram/pages/xiugaibiji/xiugaibiji.wxml new file mode 100644 index 0000000..6cb7e74 --- /dev/null +++ b/miniprogram/pages/xiugaibiji/xiugaibiji.wxml @@ -0,0 +1,7 @@ + + + + + diff --git a/miniprogram/pages/xiugaibiji/xiugaibiji.wxss b/miniprogram/pages/xiugaibiji/xiugaibiji.wxss new file mode 100644 index 0000000..e3e034d --- /dev/null +++ b/miniprogram/pages/xiugaibiji/xiugaibiji.wxss @@ -0,0 +1,22 @@ +.xiebj_2{ + border-bottom: 1px solid rgb(9, 14, 13); + position: relative; + width: 50%; + } + .neirong_1{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(132, 136, 136); + } + page{ + background-color: #DDDCE1; + + } + .btn_2{ + border: "1"; + border-style: solid; + border-width: 1px; + border-color: rgb(150, 156, 156); + background-color: rgba(151, 94, 204, 0.267); + } \ No newline at end of file diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json new file mode 100644 index 0000000..27b2b26 --- /dev/null +++ b/miniprogram/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..e9a6aa1 --- /dev/null +++ b/project.config.json @@ -0,0 +1,66 @@ +{ + "miniprogramRoot": "miniprogram/", + "cloudfunctionRoot": "cloudfunctions/", + "setting": { + "urlCheck": true, + "es6": true, + "enhance": true, + "postcss": true, + "preloadBackgroundData": false, + "minified": true, + "newFeature": true, + "coverView": true, + "nodeModules": false, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "uglifyFileName": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "compileHotReLoad": false, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "enableEngineNative": false, + "bundle": false, + "useIsolateContext": true, + "useCompilerModule": true, + "userConfirmedUseCompilerModuleSwitch": false, + "userConfirmedBundleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [], + "minifyWXSS": true + }, + "appid": "wxfdb9c8dfa774e1d9", + "projectname": "%E6%99%B4%E5%B7%9D%E8%AF%BE%E5%A0%82%E7%AC%94%E8%AE%B0", + "libVersion": "2.14.1", + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "plugin": { + "list": [] + }, + "game": { + "list": [] + }, + "miniprogram": { + "list": [ + { + "id": -1, + "name": "db guide", + "pathName": "pages/databaseGuide/databaseGuide" + } + ] + } + } +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json new file mode 100644 index 0000000..73efdb3 --- /dev/null +++ b/project.private.config.json @@ -0,0 +1,54 @@ +{ + "setting": {}, + "condition": { + "plugin": { + "list": [] + }, + "game": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [ + { + "id": -1, + "name": "db guide", + "pathName": "pages/databaseGuide/databaseGuide", + "query": "" + }, + { + "name": "收藏", + "pathName": "pages/myCollection/myCollection", + "query": "", + "scene": null + }, + { + "name": "拍笔记", + "pathName": "pages/paibiji/paibiji", + "query": "", + "scene": null + }, + { + "name": "社区", + "pathName": "pages/community/community", + "query": "", + "scene": null + }, + { + "name": "我的", + "pathName": "pages/home/home", + "query": "", + "scene": null + }, + { + "name": "写笔记", + "pathName": "pages/xiebiji/xiebiji", + "query": "", + "scene": null + } + ] + } + } +} \ No newline at end of file