diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14ea590 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Windows +[Dd]esktop.ini +Thumbs.db +$RECYCLE.BIN/ + +# macOS +.DS_Store +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes + +# Node.js +node_modules/ diff --git a/cloudfunctionTemplate/passwd.json b/cloudfunctionTemplate/passwd.json new file mode 100644 index 0000000..5b57965 --- /dev/null +++ b/cloudfunctionTemplate/passwd.json @@ -0,0 +1,22 @@ +[ + { + "name": "decoder", + "value": { + "method": "decoder", + "argv": { + "handle": "b0bf0e91d3ae59711d9569998d4d334b3d551121ede824233d3c8888dd89c3d5", + "openid": "oLYkK4-QKvlCBxZFw8qF4suJplv0" + } + } + }, + { + "name": "deleter", + "value": { + "method": "deleter", + "argv": { + "openid": "oLYkK4y0t2DjbMijYDURhyqPCQSU", + "handle": "19ee001b09e1a39a3c37f72f01528dab2ede602880572b460229e8db85b167c5" + } + } + } +] \ No newline at end of file diff --git a/cloudfunctions/changePwd/index.js b/cloudfunctions/changePwd/index.js new file mode 100644 index 0000000..54034d2 --- /dev/null +++ b/cloudfunctions/changePwd/index.js @@ -0,0 +1,37 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + let passwd_key = crypto.createHash('sha256').update(event.passwd).digest('hex') + return new Promise((resolve, reject) => { + db.collection('users').where({ + openid : wxContext.OPENID + }).update({ + data:{ + passwd : passwd_key + }, + success:function(){ + resolve({ + status : "ok", + openid : wxContext.OPENID + }) + }, + fail: function () { + resolve({ + status: "fail", + openid: wxContext.OPENID + }) + } + }) + }) +} \ No newline at end of file diff --git a/cloudfunctions/changePwd/package.json b/cloudfunctions/changePwd/package.json new file mode 100644 index 0000000..9a2b1ad --- /dev/null +++ b/cloudfunctions/changePwd/package.json @@ -0,0 +1,15 @@ +{ + "name": "changePwd", + "version": "1.0.0", + "description": "修改用户六位独立密码", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest", + "crypto": "latest" + } +} \ No newline at end of file diff --git a/cloudfunctions/check/index.js b/cloudfunctions/check/index.js new file mode 100644 index 0000000..e90811a --- /dev/null +++ b/cloudfunctions/check/index.js @@ -0,0 +1,45 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() + + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + return new Promise((resolve, reject) => { + db.collection('users').where({ + openid: wxContext.OPENID + }).get().then(res=>{ + if(res.data.length > 0){ + resolve({ + event, + openid: wxContext.OPENID, + userInfo : { + avatarUrl:res.data[0].avatarUrl, + city: res.data[0].city, + date : res.data[0].date, + nickName : res.data[0].nickName, + language : res.data[0].language, + gender : res.data[0].gender, + }, + status: "UserFound" + }) + } + else{ + resolve({ + event, + openid: wxContext.OPENID, + userInfo: {}, + status:"UserNotFound" + }) + } + }) + }) +} \ No newline at end of file diff --git a/cloudfunctions/check/package.json b/cloudfunctions/check/package.json new file mode 100644 index 0000000..f124555 --- /dev/null +++ b/cloudfunctions/check/package.json @@ -0,0 +1,15 @@ +{ + "name": "check", + "version": "1.0.0", + "description": "检查用户是否存在", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Saturneric", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest", + "crypto": "latest" + } +} \ No newline at end of file diff --git a/cloudfunctions/checkPwd/index.js b/cloudfunctions/checkPwd/index.js new file mode 100644 index 0000000..91a9199 --- /dev/null +++ b/cloudfunctions/checkPwd/index.js @@ -0,0 +1,45 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + return new Promise((resolve, reject) => { + db.collection('users').where({ + openid: wxContext.OPENID + }).get().then(res => { + if (res.data.length > 0) { + var passwd_key = crypto.createHash('sha256').update(event.passwd).digest('hex') + if(passwd_key == res.data[0].passwd) + resolve({ + event, + openid: wxContext.OPENID, + status: "success" + }) + else + resolve({ + event, + openid: wxContext.OPENID, + status: "failed" + }) + } + else { + resolve({ + event, + openid: wxContext.OPENID, + status: "failed" + }) + } + }) + + }) + +} \ No newline at end of file diff --git a/cloudfunctions/checkPwd/package.json b/cloudfunctions/checkPwd/package.json new file mode 100644 index 0000000..c7f652a --- /dev/null +++ b/cloudfunctions/checkPwd/package.json @@ -0,0 +1,15 @@ +{ + "name": "checkPwd", + "version": "1.0.0", + "description": "检查六位密码是否与数据库中的一致", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Saturneric", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest", + "crypto": "latest" + } +} \ No newline at end of file diff --git a/cloudfunctions/createUser/index.js b/cloudfunctions/createUser/index.js new file mode 100644 index 0000000..19685a6 --- /dev/null +++ b/cloudfunctions/createUser/index.js @@ -0,0 +1,37 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + var passwd_key = crypto.createHash('sha256').update(event.passwd).digest('hex') + + return new Promise((resolve, reject) => { + db.collection("users").add({ + data : { + avatarUrl: event.avatarUrl, + city: event.city, + gender: event.gender, + language: event.language, + nickName: event.nickName, + openid: wxContext.OPENID, + passwd: passwd_key, + date: event.date + } + }).then(res=>{ + resolve({ + event, + openid: wxContext.OPENID, + status: "ok" + }) + }) + }) +} \ No newline at end of file diff --git a/cloudfunctions/createUser/package.json b/cloudfunctions/createUser/package.json new file mode 100644 index 0000000..4f4dc20 --- /dev/null +++ b/cloudfunctions/createUser/package.json @@ -0,0 +1,14 @@ +{ + "name": "createUser", + "version": "1.0.0", + "description": "创建新用户", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest" + } +} \ No newline at end of file diff --git a/cloudfunctions/getHash/index.js b/cloudfunctions/getHash/index.js new file mode 100644 index 0000000..6b77bb4 --- /dev/null +++ b/cloudfunctions/getHash/index.js @@ -0,0 +1,22 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + var hash_value = crypto.createHash('sha256').update(event.text).digest('hex') + return { + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + unionid: wxContext.UNIONID, + hash : hash_value + } +} \ No newline at end of file diff --git a/cloudfunctions/getHash/package.json b/cloudfunctions/getHash/package.json new file mode 100644 index 0000000..280f7a8 --- /dev/null +++ b/cloudfunctions/getHash/package.json @@ -0,0 +1,15 @@ +{ + "name": "getHash", + "version": "1.0.0", + "description": "得到字符串的哈希值", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Saturneric", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest", + "crypto": "latest" + } +} \ No newline at end of file diff --git a/cloudfunctions/login/config.json b/cloudfunctions/login/config.json new file mode 100644 index 0000000..16348ce --- /dev/null +++ b/cloudfunctions/login/config.json @@ -0,0 +1,5 @@ +{ + "permissions": { + "openapi": [] + } +} diff --git a/cloudfunctions/login/index.js b/cloudfunctions/login/index.js new file mode 100644 index 0000000..35ea7c7 --- /dev/null +++ b/cloudfunctions/login/index.js @@ -0,0 +1,31 @@ +// 云函数模板 +// 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署” + +const cloud = require('wx-server-sdk') + +// 初始化 cloud +cloud.init() + +/** + * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端 + * + * event 参数包含小程序端调用传入的 data + * + */ +exports.main = (event, context) => { + console.log(event) + console.log(context) + + // 可执行其他自定义逻辑 + // console.log 的内容可以在云开发云函数调用日志查看 + + // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件) + const wxContext = cloud.getWXContext() + + return { + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + unionid: wxContext.UNIONID, + } +} diff --git a/cloudfunctions/login/package.json b/cloudfunctions/login/package.json new file mode 100644 index 0000000..1bf791e --- /dev/null +++ b/cloudfunctions/login/package.json @@ -0,0 +1,14 @@ +{ + "name": "login", + "version": "1.0.0", + "description": "得到用户的openid", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest" + } +} diff --git a/cloudfunctions/passwd/index.js b/cloudfunctions/passwd/index.js new file mode 100644 index 0000000..99f4dca --- /dev/null +++ b/cloudfunctions/passwd/index.js @@ -0,0 +1,499 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk') +var crypto = require('crypto'); +var CryptoJS = require('crypto-js') + +cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" +}) + +const db = cloud.database() + +function encoder(argv) { + var keys = new Array(4); + for (let i = 0; i < 4; i++) { + keys[i] = new Array(10); + } + keys[0] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "#"] + keys[1] = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "#"] + keys[2] = ["a", "s", "d", "f", "g", "h", "j", "k", "l", "#", "#"] + keys[3] = ["z", "x", "c", "v", "b", "n", "m", "#", "#", "#", "#"] + + var rtn = { + data: "", + arrgs: [] + } + + var pos = new Array(randomer(rtn.arrgs,3), randomer(rtn.arrgs,10)) + var vec = new Array(0, 0), nvec = new Array(0, 0) + var getUpper = false, isUpperPoss = 0.2, allGetUpper = false + var getSpecial = false, isSpecialPoss = 0.1, allGetSpecial = false + for (let i = 0; i < argv.length; i++) { + nvec[0] = randomer(rtn.arrgs,50) + nvec[1] = randomer(rtn.arrgs,50) + vec[0] = nvec[0] * 0.08 + vec[1] = nvec[1] * 0.24 + if (possibility(rtn.arrgs, 0.5)) { + vec[0] *= -1 + } + if (possibility(rtn.arrgs, 0.5)) { + vec[1] *= -1 + } + pos = new Array(pos[0] + vec[0], pos[1] + vec[1]) + if (pos[0] > 3.4 || pos[0] < 0) { + pos[0] = randomer(rtn.arrgs,3) + } + if (pos[1] > 10.4 || pos[1] < 0) { + pos[1] = randomer(rtn.arrgs,10) + } + var tstr = keys[Math.round(pos[0])][Math.round(pos[1])] + if(tstr == "#"){ + i -= 1; + continue; + } + if (argv.hasUpper == true){ + if (possibility(rtn.arrgs, isUpperPoss)){ + tstr = tstr.toUpperCase() + getUpper = true + allGetUpper = true + } + + if ((i+2) == argv.length && allGetUpper == false) { + tstr = 'Z'; + } + + if(getUpper == false){ + isUpperPoss *= 1.5 + } + else{ + getUpper = false + isUpperPoss *= 0.2 + if(isUpperPoss < 0.1) isUpperPoss = 0.2 + } + } + + if (argv.hasSpecial == true) { + + if (possibility(rtn.arrgs, isSpecialPoss)) { + var selectedSpecial = argv.specialChar; + var srand = randomer(rtn.arrgs, selectedSpecial.length) + tstr = selectedSpecial[srand] + getSpecial = true + allGetSpecial = true + } + + if ((i+1) == argv.length && allGetSpecial == false) { + var selectedSpecial = argv.specialChar; + var srand = randomer(rtn.arrgs, selectedSpecial.length) + tstr = selectedSpecial[srand] + } + + if (getSpecial == false) { + isSpecialPoss *= 1.5 + } + else { + getSpecial = false + isSpecialPoss *= 0.1 + if (isSpecialPoss < 0.05) isSpecialPoss = 0.1 + } + } + + rtn.data += tstr + + } + return rtn +} + + +function decoder(argv, rands) { + var ridx = 0 + var keys = new Array(4); + for (let i = 0; i < 4; i++) { + keys[i] = new Array(10); + } + keys[0] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "#"] + keys[1] = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "#"] + keys[2] = ["a", "s", "d", "f", "g", "h", "j", "k", "l", "#", "#"] + keys[3] = ["z", "x", "c", "v", "b", "n", "m", "#", "#", "#", "#"] + + var rtn = { + data: "", + arrgs: [] + } + + var pos = new Array(derandomer(rands[ridx++], 3), derandomer(rands[ridx++], 10)) + var vec = new Array(0, 0), nvec = new Array(0, 0) + var getUpper = false, isUpperPoss = 0.2, allGetUpper = false + var getSpecial = false, isSpecialPoss = 0.1, allGetSpecial = false + for (let i = 0; i < argv.length; i++) { + nvec[0] = derandomer(rands[ridx++], 50) + nvec[1] = derandomer(rands[ridx++], 50) + vec[0] = nvec[0] * 0.08 + vec[1] = nvec[1] * 0.24 + if (depossibility(rands[ridx++], 0.5)) { + vec[0] *= -1 + } + if (depossibility(rands[ridx++], 0.5)) { + vec[1] *= -1 + } + pos = new Array(pos[0] + vec[0], pos[1] + vec[1]) + if (pos[0] > 3.4 || pos[0] < 0) { + pos[0] = derandomer(rands[ridx++], 3) + } + if (pos[1] > 10.4 || pos[1] < 0) { + pos[1] = derandomer(rands[ridx++], 10) + } + var tstr = keys[Math.round(pos[0])][Math.round(pos[1])] + if (tstr == "#") { + i -= 1; + continue; + } + if (argv.hasUpper == true) { + if (depossibility(rands[ridx++], isUpperPoss)) { + tstr = tstr.toUpperCase() + getUpper = true + allGetUpper = true + } + + if ((i+2) == argv.length && allGetUpper == false) { + tstr = 'Z'; + } + + if (getUpper == false) { + isUpperPoss *= 1.5 + } + else { + getUpper = false + isUpperPoss *= 0.2 + if (isUpperPoss < 0.1) isUpperPoss = 0.2 + } + } + + if (argv.hasSpecial == true) { + + if (depossibility(rands[ridx++], isSpecialPoss)) { + var selectedSpecial = argv.specialChar; + var srand = derandomer(rands[ridx++], selectedSpecial.length) + tstr = selectedSpecial[srand] + getSpecial = true + allGetSpecial = true + } + + if ((i+1) == argv.length && allGetSpecial == false) { + var selectedSpecial = argv.specialChar; + var srand = derandomer(rands[ridx++], selectedSpecial.length) + tstr = selectedSpecial[srand] + } + + if (getSpecial == false) { + isSpecialPoss *= 1.5 + } + else { + getSpecial = false + isSpecialPoss *= 0.1 + if (isSpecialPoss < 0.05) isSpecialPoss = 0.1 + } + } + + rtn.data += tstr + + } + return rtn +} + + +function possibility(args, possb){ + var tmp = Math.random() + args.push(tmp) + if (possb > tmp){ + return true; + } + else return false; +} + +function depossibility(arg, possb) { + var tmp = arg + if (possb > tmp) { + return true; + } + else return false; +} + +function randomer(args, range) { + var tmp = Math.random() + args.push(tmp) + return Math.floor(tmp * range); +} + +function derandomer(arg, range) { + var tmp = arg + return Math.floor(tmp * range); +} + +function aes_encrypt(data, openid, iv){ + var blocks = parseInt(data.length / 16) + if (data.length % 16 != 0) blocks += 1; + buffdata = new Buffer(16 * blocks) + console.log("Blocks",blocks) + buffdata.write(data) + data = buffdata + console.log("Buffdata",buffdata) + + var algorithm = 'aes-256-ecb' + var key = crypto.createHash('sha256').update(openid).digest('hex') + key = key.substr(0, 32) + key = key.toString('hex') + console.log("Data", data, "Key", key) + var clearEncoding = 'ascii' + var cipherEncoding = 'base64' + iv = iv || "" + var cipher = crypto.createCipher(algorithm, key, iv) + cipher.setAutoPadding(true); + var cipherChunks = [] + cipherChunks.push(cipher.update(data, clearEncoding, cipherEncoding)); + cipherChunks.push(cipher.final(cipherEncoding)); + return cipherChunks.join('') +} + +function aes_decode(ciphertext, openid, iv){ + var algorithm = 'aes-256-ecb' + var key = crypto.createHash('sha256').update(openid).digest('hex') + key = key.substr(0, 32) + key = key.toString('hex') + console.log("Key", key) + var clearEncoding = 'ascii' + var cipherEncoding = 'base64' + iv = iv || ""; + var decipher = crypto.createDecipheriv(algorithm, key, iv) + decipher.setAutoPadding(false); + console.log("crypted:" + ciphertext) + var cipherChunks = []; + cipherChunks.push(decipher.update(ciphertext, cipherEncoding, clearEncoding)); + cipherChunks.push(decipher.final(clearEncoding)); + var decrypted = cipherChunks.join('') + return decrypted; +} + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext() + console.log("[云函数] 调用 " + event.method) + if (event.method == "encoder") { + var rtn = encoder(event.argv) + + var code = String(wxContext.openid) + for (var i = 0; i < rtn.arrgs.length; i++) { + code += String(rtn.arrgs[i]) + } + var handle_hash = crypto.createHash('sha256').update(code).digest('hex'); + return new Promise((resolve, reject) => { + db.collection('passwd').add({ + data: { + openid: wxContext.OPENID, + args: rtn.arrgs, + handle_hash: handle_hash, + argv: event.argv + } + }).then(res => { + if (res.errMsg == "collection.add:ok") { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + passwd: rtn.data, + handle: handle_hash, + status: "ok" + }) + } + else { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + status: "fail" + }) + } + }) + }) + } + else if (event.method == "saver") { + var handle = event.argv.handle + var openid = event.argv.openid + var tag = event.argv.tag + return new Promise((resolve, reject) => { + db.collection("passwd").where({ + handle_hash: handle, + openid: openid + }).limit(1).get().then(res => { + console.log(res) + if (res.data.length > 0) { + var tag_hash = crypto.createHash('sha256').update(tag).digest('hex') + db.collection('passwd_saved').add({ + data: { + openid: wxContext.OPENID, + args: res.data[0].args, + handle_hash: handle, + tag_hash: tag_hash, + argv : res.data[0].argv, + custom: false + } + }).then(res => { + if (res.errMsg == "collection.add:ok") { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + handle: handle_hash, + status: "ok" + }) + } + else { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + status: "fail" + }) + } + }) + } + }) + }) + } + else if (event.method == "customer") { + var handle_hash = event.argv.handle + var openid = event.argv.openid + var tag = event.argv.tag + var passwd = event.argv.passwd + return new Promise((resolve, reject) => { + db.collection("passwd").where({ + handle_hash: handle_hash, + openid: openid + }).limit(1).get().then(res => { + if (res.data.length > 0) { + + var tag_hash = crypto.createHash('sha256').update(tag).digest('hex') + + var key = crypto.createHash('sha256').update(openid).digest('hex') + key = key.substr(0, 32) + key = key.toString('hex') + + var encrypt = CryptoJS.AES.encrypt(passwd, CryptoJS.enc.Utf8.parse(key), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }); + + db.collection("passwd_saved").add({ + data: { + openid: wxContext.OPENID, + ciphertext: encrypt.toString(), + handle_hash: handle_hash, + tag_hash: tag_hash, + custom: true + } + }).then(res => { + if (res.errMsg == "collection.add:ok") { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + handle: handle_hash, + status: "ok" + }) + } + else { + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + status: "fail" + }) + } + }) + } + }) + }) + } + else if (event.method == "decoder") { + var handle_hash = event.argv.handle + var openid = event.argv.openid + return new Promise((resolve, reject) => { + db.collection("passwd_saved").where({ + handle_hash: handle_hash, + openid: openid + }).limit(1).get().then(res => { + console.log(res) + if (res.data.length > 0) { + if(res.data[0].custom){ + var key = crypto.createHash('sha256').update(openid).digest('hex') + key = key.substr(0, 32) + key = key.toString('hex') + + var decrypt = CryptoJS.AES.decrypt(res.data[0].ciphertext, CryptoJS.enc.Utf8.parse(key), { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7 + }); + resolve({ + event, + openid: wxContext.OPENID, + appid: wxContext.APPID, + passwd: decrypt.toString(CryptoJS.enc.Utf8), + status : "ok", + handle : handle_hash + }) + } + else{ + var args = res.data[0].args + var argv = res.data[0].argv + var rtn = decoder(argv,args) + resolve({ + openid: wxContext.OPENID, + appid: wxContext.APPID, + passwd: rtn.data, + status: "ok", + handle: handle_hash + }) + } + } + }) + }) + } + else if (event.method == "deleter"){ + var handle_hash = event.argv.handle + var openid = event.argv.openid + return new Promise((resolve, reject) => { + if (wxContext.OPENID != openid){ + resolve({ + status: "failed", + openid : openid + }) + } + var handle = handle_hash + var openid = openid + db.collection("passwd-saved").where({ + handle: handle, + openid: wxContext.OPENID + }).get().then(res=>{ + console.log(res) + if(res.data.length > 0){ + db.collection("passwd-saved").doc(res.data[0]._id).remove().then(res => { + }) + resolve({ + status: "ok", + openid: openid + }) + } + else{ + resolve({ + status: "failed", + openid: openid + }) + } + }) + + + }) + } +} + diff --git a/cloudfunctions/passwd/package-lock.json b/cloudfunctions/passwd/package-lock.json new file mode 100644 index 0000000..881d337 --- /dev/null +++ b/cloudfunctions/passwd/package-lock.json @@ -0,0 +1,502 @@ +{ + "name": "passwd", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@cloudbase/database": { + "version": "0.0.9", + "resolved": "http://mirrors.tencentyun.com/npm/@cloudbase%2fdatabase/-/database-0.0.9.tgz", + "integrity": "sha512-OTlP0HtSxb8xIeaUN5GKq9gHJLHMEwIfqmOD53vFHMsO4IfOjPOVpNfULmCjtS4j2bhMIzFNnzBNjXjzPJLYDA==" + }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2faspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2fbase64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2fcodegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2feventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2ffetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "requires": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2ffloat/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2finquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2fpath/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2fpool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/@protobufjs%2futf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + }, + "@types/long": { + "version": "4.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/@types%2flong/-/long-4.0.0.tgz", + "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" + }, + "@types/node": { + "version": "10.14.7", + "resolved": "http://mirrors.tencentyun.com/npm/@types%2fnode/-/node-10.14.7.tgz", + "integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A==" + }, + "ajv": { + "version": "6.10.0", + "resolved": "http://mirrors.tencentyun.com/npm/ajv/-/ajv-6.10.0.tgz", + "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "http://mirrors.tencentyun.com/npm/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "http://mirrors.tencentyun.com/npm/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "http://mirrors.tencentyun.com/npm/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "http://mirrors.tencentyun.com/npm/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "http://mirrors.tencentyun.com/npm/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "http://mirrors.tencentyun.com/npm/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "http://mirrors.tencentyun.com/npm/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "http://mirrors.tencentyun.com/npm/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" + }, + "crypto-js": { + "version": "3.1.9-1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.9-1.tgz", + "integrity": "sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "http://mirrors.tencentyun.com/npm/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "http://mirrors.tencentyun.com/npm/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "http://mirrors.tencentyun.com/npm/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "http://mirrors.tencentyun.com/npm/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "http://mirrors.tencentyun.com/npm/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "http://mirrors.tencentyun.com/npm/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "http://mirrors.tencentyun.com/npm/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "getpass": { + "version": "0.1.7", + "resolved": "http://mirrors.tencentyun.com/npm/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "http://mirrors.tencentyun.com/npm/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "http://mirrors.tencentyun.com/npm/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "http://mirrors.tencentyun.com/npm/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-regex": { + "version": "1.0.4", + "resolved": "http://mirrors.tencentyun.com/npm/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "requires": { + "has": "^1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "http://mirrors.tencentyun.com/npm/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "http://mirrors.tencentyun.com/npm/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "http://mirrors.tencentyun.com/npm/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "http://mirrors.tencentyun.com/npm/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "http://mirrors.tencentyun.com/npm/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "http://mirrors.tencentyun.com/npm/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + }, + "long": { + "version": "4.0.0", + "resolved": "http://mirrors.tencentyun.com/npm/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "mime-db": { + "version": "1.40.0", + "resolved": "http://mirrors.tencentyun.com/npm/mime-db/-/mime-db-1.40.0.tgz", + "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + }, + "mime-types": { + "version": "2.1.24", + "resolved": "http://mirrors.tencentyun.com/npm/mime-types/-/mime-types-2.1.24.tgz", + "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "requires": { + "mime-db": "1.40.0" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "http://mirrors.tencentyun.com/npm/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "http://mirrors.tencentyun.com/npm/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "protobufjs": { + "version": "6.8.8", + "resolved": "http://mirrors.tencentyun.com/npm/protobufjs/-/protobufjs-6.8.8.tgz", + "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==", + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.0", + "@types/node": "^10.1.0", + "long": "^4.0.0" + } + }, + "psl": { + "version": "1.1.31", + "resolved": "http://mirrors.tencentyun.com/npm/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "http://mirrors.tencentyun.com/npm/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "http://mirrors.tencentyun.com/npm/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.88.0", + "resolved": "http://mirrors.tencentyun.com/npm/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "http://mirrors.tencentyun.com/npm/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "http://mirrors.tencentyun.com/npm/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "tcb-admin-node": { + "version": "1.6.0", + "resolved": "http://mirrors.tencentyun.com/npm/tcb-admin-node/-/tcb-admin-node-1.6.0.tgz", + "integrity": "sha512-GvM5uIB02BeOX9B8XVic3xojOQp0VMa4l7LIonRmsHhjzsiRAb573t37k1a6hl92r5kv4x+NkQEEpP8znXpNPw==", + "requires": { + "@cloudbase/database": "^0.0.9", + "is-regex": "^1.0.4", + "lodash.merge": "^4.6.1", + "request": "^2.87.0" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "http://mirrors.tencentyun.com/npm/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "http://mirrors.tencentyun.com/npm/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "http://mirrors.tencentyun.com/npm/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "http://mirrors.tencentyun.com/npm/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "http://mirrors.tencentyun.com/npm/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "http://mirrors.tencentyun.com/npm/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "uuid": { + "version": "3.3.2", + "resolved": "http://mirrors.tencentyun.com/npm/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "http://mirrors.tencentyun.com/npm/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wx-server-sdk": { + "version": "0.5.1", + "resolved": "http://mirrors.tencentyun.com/npm/wx-server-sdk/-/wx-server-sdk-0.5.1.tgz", + "integrity": "sha512-W4rL1mh0pM6dQiZ7OP0YT7t1eoF9Yhs3wKLOZChv5TgOz+esSyR95WeEzsGu0NHpw8C/jVlwfz4YqO9oh87DQQ==", + "requires": { + "protobufjs": "6.8.8", + "tcb-admin-node": "1.6.0", + "tslib": "^1.9.3" + } + } + } +} diff --git a/cloudfunctions/passwd/package.json b/cloudfunctions/passwd/package.json new file mode 100644 index 0000000..2b3faed --- /dev/null +++ b/cloudfunctions/passwd/package.json @@ -0,0 +1,16 @@ +{ + "name": "passwd", + "version": "1.0.0", + "description": "为用户计算并储存密码,维护密码数据库", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Saturneric", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "latest", + "crypto": "latest", + "crypto-js": "latest" + } +} diff --git a/miniprogram/app.js b/miniprogram/app.js new file mode 100644 index 0000000..b936d95 --- /dev/null +++ b/miniprogram/app.js @@ -0,0 +1,22 @@ +//app.js +App({ + onLaunch: function () { + + if (!wx.cloud) { + console.error('请使用 2.2.3 或以上的基础库以使用云能力') + } else { + wx.cloud.init({ + traceUser: true, + env: "ipasswd-7h7iu" + }) + } + + this.globalData = { + hasCheckPwd : false, + hasRegister : null, + openid : null, + refresh : false, + refreshCheck: false + } + } +}) diff --git a/miniprogram/app.json b/miniprogram/app.json new file mode 100644 index 0000000..7342e9a --- /dev/null +++ b/miniprogram/app.json @@ -0,0 +1,50 @@ +{ + "pages": [ + "pages/index/index", + "pages/chooseLib/chooseLib", + "pages/openapi/openapi", + "pages/openapi/serverapi/serverapi", + "pages/openapi/callback/callback", + "pages/openapi/cloudid/cloudid", + "pages/logs/logs", + "pages/create/create", + "pages/checkPwd/checkPwd", + "pages/show/show", + "pages/showPwd/showPwd", + "pages/showEdit/showEdit" + ], + "window": { + "backgroundColor": "#F6F6F6", + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#3f72af", + "navigationBarTitleText": "密码便签", + "navigationBarTextStyle": "white" + }, + "tabBar": { + "color": "#fff", + "selectedColor": "#45deff", + "borderStyle": "white", + "backgroundColor": "#3f72af", + "list": [ + { + "pagePath": "pages/index/index", + "text": "资料卡", + "iconPath": "images/1-1.png", + "selectedIconPath": "images/1-2.png" + }, + { + "pagePath": "pages/create/create", + "text": "密码便签", + "iconPath": "images/2-1.png", + "selectedIconPath": "images/2-2.png" + }, + { + "pagePath": "pages/logs/logs", + "text": "便签集", + "iconPath": "images/3-1.png", + "selectedIconPath": "images/3-2.png" + } + ] + }, + "sitemapLocation": "sitemap.json" +} \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss new file mode 100644 index 0000000..df8911a --- /dev/null +++ b/miniprogram/app.wxss @@ -0,0 +1,178 @@ +/**app.wxss**/ +@import './css/animate.wxss'; + +@font-face { + font-family: 'iconfont'; /* project id 518032 */ + src: url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.eot'); + src: url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.woff') format('woff'), + url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.ttf') format('truetype'), + url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.svg#iconfont') format('svg'); +} + +.iconfont { + font-family:"iconfont" !important; + font-size:60rpx; + font-style:normal; + -webkit-font-smoothing: antialiase; + -moz-osx-font-smoothing: grayscale; +} + +.icon-shanchu:before{content: '\e629';} +.icon-sousuo:before{content: '\e62f';} + +.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/css/animate.wxss b/miniprogram/css/animate.wxss new file mode 100644 index 0000000..41cc528 --- /dev/null +++ b/miniprogram/css/animate.wxss @@ -0,0 +1,1823 @@ +@charset "UTF-8"; + +/*! + * animate.css -http://daneden.me/animate + * Version - 3.7.0 + * Licensed under the MIT license - http://opensource.org/licenses/MIT + * + * Copyright (c) 2018 Daniel Eden + */ + + + +@keyframes bounce { + from, + 20%, + 53%, + 80%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + transform: translate3d(0, 0, 0); + } + + 40%, + 43% { + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + transform: translate3d(0, -30px, 0); + } + + 70% { + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + transform: translate3d(0, -15px, 0); + } + + 90% { + transform: translate3d(0, -4px, 0); + } +} + +.bounce { + animation-name: bounce; + transform-origin: center bottom; +} + +@keyframes flash { + from, + 50%, + to { + opacity: 1; + } + + 25%, + 75% { + opacity: 0; + } +} + +.flash { + animation-name: flash; +} + + +@keyframes pulse { + from { + transform: scale3d(1, 1, 1); + } + + 50% { + transform: scale3d(1.05, 1.05, 1.05); + } + + to { + transform: scale3d(1, 1, 1); + } +} + +.pulse { + animation-name: pulse; +} + + +@keyframes rubberBand { + from { + transform: scale3d(1, 1, 1); + } + + 30% { + transform: scale3d(1.25, 0.75, 1); + } + + 40% { + transform: scale3d(0.75, 1.25, 1); + } + + 50% { + transform: scale3d(1.15, 0.85, 1); + } + + 65% { + transform: scale3d(0.95, 1.05, 1); + } + + 75% { + transform: scale3d(1.05, 0.95, 1); + } + + to { + transform: scale3d(1, 1, 1); + } +} + +.rubberBand { + animation-name: rubberBand; +} + + +@keyframes shake { + from, + to { + transform: translate3d(0, 0, 0); + } + + 10%, + 30%, + 50%, + 70%, + 90% { + transform: translate3d(-10px, 0, 0); + } + + 20%, + 40%, + 60%, + 80% { + transform: translate3d(10px, 0, 0); + } +} + +.shake { + animation-name: shake; +} + + +@keyframes headShake { + 0% { + transform: translateX(0); + } + + 6.5% { + transform: translateX(-6px) rotateY(-9deg); + } + + 18.5% { + transform: translateX(5px) rotateY(7deg); + } + + 31.5% { + transform: translateX(-3px) rotateY(-5deg); + } + + 43.5% { + transform: translateX(2px) rotateY(3deg); + } + + 50% { + transform: translateX(0); + } +} + +.headShake { + animation-timing-function: ease-in-out; + animation-name: headShake; +} + + +@keyframes swing { + 20% { + transform: rotate3d(0, 0, 1, 15deg); + } + + 40% { + transform: rotate3d(0, 0, 1, -10deg); + } + + 60% { + transform: rotate3d(0, 0, 1, 5deg); + } + + 80% { + transform: rotate3d(0, 0, 1, -5deg); + } + + to { + transform: rotate3d(0, 0, 1, 0deg); + } +} + +.swing { + transform-origin: top center; + animation-name: swing; +} + + +@keyframes tada { + from { + transform: scale3d(1, 1, 1); + } + + 10%, + 20% { + transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); + } + + 30%, + 50%, + 70%, + 90% { + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + } + + 40%, + 60%, + 80% { + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + } + + to { + transform: scale3d(1, 1, 1); + } +} + +.tada { + animation-name: tada; +} + + + +@keyframes wobble { + from { + transform: translate3d(0, 0, 0); + } + + 15% { + transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + } + + 30% { + transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + } + + 45% { + transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + } + + 60% { + transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + } + + 75% { + transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.wobble { + animation-name: wobble; +} + +@keyframes jello { + from, + 11.1%, + to { + transform: translate3d(0, 0, 0); + } + + 22.2% { + transform: skewX(-12.5deg) skewY(-12.5deg); + } + + 33.3% { + transform: skewX(6.25deg) skewY(6.25deg); + } + + 44.4% { + transform: skewX(-3.125deg) skewY(-3.125deg); + } + + 55.5% { + transform: skewX(1.5625deg) skewY(1.5625deg); + } + + 66.6% { + transform: skewX(-0.78125deg) skewY(-0.78125deg); + } + + 77.7% { + transform: skewX(0.390625deg) skewY(0.390625deg); + } + + 88.8% { + transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + } +} + +.jello { + animation-name: jello; + transform-origin: center; +} + +@keyframes heartBeat { + 0% { + transform: scale(1); + } + + 14% { + transform: scale(1.3); + } + + 28% { + transform: scale(1); + } + + 42% { + transform: scale(1.3); + } + + 70% { + transform: scale(1); + } +} + +.heartBeat { + animation-name: heartBeat; + animation-duration: 1.3s; + animation-timing-function: ease-in-out; +} + + + +@keyframes bounceIn { + from, + 20%, + 40%, + 60%, + 80%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + opacity: 0; + transform: scale3d(0.3, 0.3, 0.3); + } + + 20% { + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + transform: scale3d(0.9, 0.9, 0.9); + } + + 60% { + opacity: 1; + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + transform: scale3d(0.97, 0.97, 0.97); + } + + to { + opacity: 1; + transform: scale3d(1, 1, 1); + } +} + +.bounceIn { + animation-duration: 0.75s; + animation-name: bounceIn; +} + + + +@keyframes bounceInDown { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + opacity: 0; + transform: translate3d(0, -3000px, 0); + } + + 60% { + opacity: 1; + transform: translate3d(0, 25px, 0); + } + + 75% { + transform: translate3d(0, -10px, 0); + } + + 90% { + transform: translate3d(0, 5px, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.bounceInDown { + animation-name: bounceInDown; +} + + +@keyframes bounceInLeft { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + opacity: 0; + transform: translate3d(-3000px, 0, 0); + } + + 60% { + opacity: 1; + transform: translate3d(25px, 0, 0); + } + + 75% { + transform: translate3d(-10px, 0, 0); + } + + 90% { + transform: translate3d(5px, 0, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.bounceInLeft { + animation-name: bounceInLeft; +} + + + +@keyframes bounceInRight { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + opacity: 0; + transform: translate3d(3000px, 0, 0); + } + + 60% { + opacity: 1; + transform: translate3d(-25px, 0, 0); + } + + 75% { + transform: translate3d(10px, 0, 0); + } + + 90% { + transform: translate3d(-5px, 0, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.bounceInRight { + animation-name: bounceInRight; +} + + + +@keyframes bounceInUp { + from, + 60%, + 75%, + 90%, + to { + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + opacity: 0; + transform: translate3d(0, 3000px, 0); + } + + 60% { + opacity: 1; + transform: translate3d(0, -20px, 0); + } + + 75% { + transform: translate3d(0, 10px, 0); + } + + 90% { + transform: translate3d(0, -5px, 0); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.bounceInUp { + animation-name: bounceInUp; +} + + + +@keyframes bounceOut { + 20% { + transform: scale3d(0.9, 0.9, 0.9); + } + + 50%, + 55% { + opacity: 1; + transform: scale3d(1.1, 1.1, 1.1); + } + + to { + opacity: 0; + transform: scale3d(0.3, 0.3, 0.3); + } +} + +.bounceOut { + animation-duration: 0.75s; + animation-name: bounceOut; +} + + + +@keyframes bounceOutDown { + 20% { + transform: translate3d(0, 10px, 0); + } + + 40%, + 45% { + opacity: 1; + transform: translate3d(0, -20px, 0); + } + + to { + opacity: 0; + transform: translate3d(0, 2000px, 0); + } +} + +.bounceOutDown { + animation-name: bounceOutDown; +} + + +@keyframes bounceOutLeft { + 20% { + opacity: 1; + transform: translate3d(20px, 0, 0); + } + + to { + opacity: 0; + transform: translate3d(-2000px, 0, 0); + } +} + +.bounceOutLeft { + animation-name: bounceOutLeft; +} + + + +@keyframes bounceOutRight { + 20% { + opacity: 1; + transform: translate3d(-20px, 0, 0); + } + + to { + opacity: 0; + transform: translate3d(2000px, 0, 0); + } +} + +.bounceOutRight { + animation-name: bounceOutRight; +} + + + +@keyframes bounceOutUp { + 20% { + transform: translate3d(0, -10px, 0); + } + + 40%, + 45% { + opacity: 1; + transform: translate3d(0, 20px, 0); + } + + to { + opacity: 0; + transform: translate3d(0, -2000px, 0); + } +} + +.bounceOutUp { + animation-name: bounceOutUp; +} + + + +@keyframes fadeIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +.fadeIn { + animation-name: fadeIn; +} + + + +@keyframes fadeInDown { + from { + opacity: 0; + transform: translate3d(0, -100%, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInDown { + animation-name: fadeInDown; +} + + + +@keyframes fadeInDownBig { + from { + opacity: 0; + transform: translate3d(0, -2000px, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInDownBig { + animation-name: fadeInDownBig; +} + + + +@keyframes fadeInLeft { + from { + opacity: 0; + transform: translate3d(-100%, 0, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInLeft { + animation-name: fadeInLeft; +} + + + +@keyframes fadeInLeftBig { + from { + opacity: 0; + transform: translate3d(-2000px, 0, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInLeftBig { + animation-name: fadeInLeftBig; +} + + + +@keyframes fadeInRight { + from { + opacity: 0; + transform: translate3d(100%, 0, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInRight { + animation-name: fadeInRight; +} + + + +@keyframes fadeInRightBig { + from { + opacity: 0; + transform: translate3d(2000px, 0, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInRightBig { + animation-name: fadeInRightBig; +} + + + +@keyframes fadeInUp { + from { + opacity: 0; + transform: translate3d(0, 100%, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInUp { + animation-name: fadeInUp; +} + + + +@keyframes fadeInUpBig { + from { + opacity: 0; + transform: translate3d(0, 2000px, 0); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.fadeInUpBig { + animation-name: fadeInUpBig; +} + + + +@keyframes fadeOut { + from { + opacity: 1; + } + + to { + opacity: 0; + } +} + +.fadeOut { + animation-name: fadeOut; +} + + + +@keyframes fadeOutDown { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(0, 100%, 0); + } +} + +.fadeOutDown { + animation-name: fadeOutDown; +} + + + +@keyframes fadeOutDownBig { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(0, 2000px, 0); + } +} + +.fadeOutDownBig { + animation-name: fadeOutDownBig; +} + + + +@keyframes fadeOutLeft { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(-100%, 0, 0); + } +} + +.fadeOutLeft { + animation-name: fadeOutLeft; +} + + + +@keyframes fadeOutLeftBig { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(-2000px, 0, 0); + } +} + +.fadeOutLeftBig { + animation-name: fadeOutLeftBig; +} + + + +@keyframes fadeOutRight { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(100%, 0, 0); + } +} + +.fadeOutRight { + animation-name: fadeOutRight; +} + + + +@keyframes fadeOutRightBig { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(2000px, 0, 0); + } +} + +.fadeOutRightBig { + animation-name: fadeOutRightBig; +} + + + +@keyframes fadeOutUp { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(0, -100%, 0); + } +} + +.fadeOutUp { + animation-name: fadeOutUp; +} + + + +@keyframes fadeOutUpBig { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(0, -2000px, 0); + } +} + +.fadeOutUpBig { + animation-name: fadeOutUpBig; +} + + + +@keyframes flip { + from { + transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 0) rotate3d(0, 1, 0, -360deg); + animation-timing-function: ease-out; + } + + 40% { + transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 150px) + rotate3d(0, 1, 0, -190deg); + animation-timing-function: ease-out; + } + + 50% { + transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 150px) + rotate3d(0, 1, 0, -170deg); + animation-timing-function: ease-in; + } + + 80% { + transform: perspective(400px) scale3d(0.95, 0.95, 0.95) translate3d(0, 0, 0) + rotate3d(0, 1, 0, 0deg); + animation-timing-function: ease-in; + } + + to { + transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 0) rotate3d(0, 1, 0, 0deg); + animation-timing-function: ease-in; + } +} + +.animated.flip { + backface-visibility: visible; + animation-name: flip; +} + + + +@keyframes flipInX { + from { + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + animation-timing-function: ease-in; + } + + 60% { + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + + 80% { + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + + to { + transform: perspective(400px); + } +} + +.flipInX { + backface-visibility: visible !important; + animation-name: flipInX; +} + + + +@keyframes flipInY { + from { + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + animation-timing-function: ease-in; + opacity: 0; + } + + 40% { + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + animation-timing-function: ease-in; + } + + 60% { + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + } + + 80% { + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + transform: perspective(400px); + } +} + +.flipInY { + backface-visibility: visible !important; + animation-name: flipInY; +} + + + +@keyframes flipOutX { + from { + transform: perspective(400px); + } + + 30% { + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + + to { + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} + +.flipOutX { + animation-duration: 0.75s; + animation-name: flipOutX; + backface-visibility: visible !important; +} + + + +@keyframes flipOutY { + from { + transform: perspective(400px); + } + + 30% { + transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + opacity: 1; + } + + to { + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} + +.flipOutY { + animation-duration: 0.75s; + backface-visibility: visible !important; + animation-name: flipOutY; +} + + + +@keyframes lightSpeedIn { + from { + transform: translate3d(100%, 0, 0) skewX(-30deg); + opacity: 0; + } + + 60% { + transform: skewX(20deg); + opacity: 1; + } + + 80% { + transform: skewX(-5deg); + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.lightSpeedIn { + animation-name: lightSpeedIn; + animation-timing-function: ease-out; +} + + + +@keyframes lightSpeedOut { + from { + opacity: 1; + } + + to { + transform: translate3d(100%, 0, 0) skewX(30deg); + opacity: 0; + } +} + +.lightSpeedOut { + animation-name: lightSpeedOut; + animation-timing-function: ease-in; +} + + + +@keyframes rotateIn { + from { + transform-origin: center; + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + + to { + transform-origin: center; + transform: translate3d(0, 0, 0); + opacity: 1; + } +} + +.rotateIn { + animation-name: rotateIn; +} + + + +@keyframes rotateInDownLeft { + from { + transform-origin: left bottom; + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + + to { + transform-origin: left bottom; + transform: translate3d(0, 0, 0); + opacity: 1; + } +} + +.rotateInDownLeft { + animation-name: rotateInDownLeft; +} + + + +@keyframes rotateInDownRight { + from { + transform-origin: right bottom; + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + transform-origin: right bottom; + transform: translate3d(0, 0, 0); + opacity: 1; + } +} + +.rotateInDownRight { + animation-name: rotateInDownRight; +} + + + +@keyframes rotateInUpLeft { + from { + transform-origin: left bottom; + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + transform-origin: left bottom; + transform: translate3d(0, 0, 0); + opacity: 1; + } +} + +.rotateInUpLeft { + animation-name: rotateInUpLeft; +} + + + +@keyframes rotateInUpRight { + from { + transform-origin: right bottom; + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + + to { + transform-origin: right bottom; + transform: translate3d(0, 0, 0); + opacity: 1; + } +} + +.rotateInUpRight { + animation-name: rotateInUpRight; +} + + + +@keyframes rotateOut { + from { + transform-origin: center; + opacity: 1; + } + + to { + transform-origin: center; + transform: rotate3d(0, 0, 1, 200deg); + opacity: 0; + } +} + +.rotateOut { + animation-name: rotateOut; +} + + + +@keyframes rotateOutDownLeft { + from { + transform-origin: left bottom; + opacity: 1; + } + + to { + transform-origin: left bottom; + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } +} + +.rotateOutDownLeft { + animation-name: rotateOutDownLeft; +} + + + +@keyframes rotateOutDownRight { + from { + transform-origin: right bottom; + opacity: 1; + } + + to { + transform-origin: right bottom; + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +.rotateOutDownRight { + animation-name: rotateOutDownRight; +} + + + +@keyframes rotateOutUpLeft { + from { + transform-origin: left bottom; + opacity: 1; + } + + to { + transform-origin: left bottom; + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} + +.rotateOutUpLeft { + animation-name: rotateOutUpLeft; +} + + + +@keyframes rotateOutUpRight { + from { + transform-origin: right bottom; + opacity: 1; + } + + to { + transform-origin: right bottom; + transform: rotate3d(0, 0, 1, 90deg); + opacity: 0; + } +} + +.rotateOutUpRight { + animation-name: rotateOutUpRight; +} + + + +@keyframes hinge { + 0% { + transform-origin: top left; + animation-timing-function: ease-in-out; + } + + 20%, + 60% { + transform: rotate3d(0, 0, 1, 80deg); + transform-origin: top left; + animation-timing-function: ease-in-out; + } + + 40%, + 80% { + transform: rotate3d(0, 0, 1, 60deg); + transform-origin: top left; + animation-timing-function: ease-in-out; + opacity: 1; + } + + to { + transform: translate3d(0, 700px, 0); + opacity: 0; + } +} + +.hinge { + animation-duration: 2s; + animation-name: hinge; +} + + + +@keyframes jackInTheBox { + from { + opacity: 0; + transform: scale(0.1) rotate(30deg); + transform-origin: center bottom; + } + + 50% { + transform: rotate(-10deg); + } + + 70% { + transform: rotate(3deg); + } + + to { + opacity: 1; + transform: scale(1); + } +} + +.jackInTheBox { + animation-name: jackInTheBox; +} + + + +@keyframes rollIn { + from { + opacity: 0; + transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + } + + to { + opacity: 1; + transform: translate3d(0, 0, 0); + } +} + +.rollIn { + animation-name: rollIn; +} + + + +@keyframes rollOut { + from { + opacity: 1; + } + + to { + opacity: 0; + transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + } +} + +.rollOut { + animation-name: rollOut; +} + + +@keyframes zoomIn { + from { + opacity: 0; + transform: scale3d(0.3, 0.3, 0.3); + } + + 50% { + opacity: 1; + } +} + +.zoomIn { + animation-name: zoomIn; +} + + + +@keyframes zoomInDown { + from { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + 60% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomInDown { + animation-name: zoomInDown; +} + + + +@keyframes zoomInLeft { + from { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + 60% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomInLeft { + animation-name: zoomInLeft; +} + + + +@keyframes zoomInRight { + from { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + 60% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomInRight { + animation-name: zoomInRight; +} + + + +@keyframes zoomInUp { + from { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + 60% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomInUp { + animation-name: zoomInUp; +} + + + +@keyframes zoomOut { + from { + opacity: 1; + } + + 50% { + opacity: 0; + transform: scale3d(0.3, 0.3, 0.3); + } + + to { + opacity: 0; + } +} + +.zoomOut { + animation-name: zoomOut; +} + + + +@keyframes zoomOutDown { + 40% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + to { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); + transform-origin: center bottom; + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomOutDown { + animation-name: zoomOutDown; +} + + + +@keyframes zoomOutLeft { + 40% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); + } + + to { + opacity: 0; + transform: scale(0.1) translate3d(-2000px, 0, 0); + transform-origin: left center; + } +} + +.zoomOutLeft { + animation-name: zoomOutLeft; +} + + + +@keyframes zoomOutRight { + 40% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); + } + + to { + opacity: 0; + transform: scale(0.1) translate3d(2000px, 0, 0); + transform-origin: right center; + } +} + +.zoomOutRight { + animation-name: zoomOutRight; +} + + + +@keyframes zoomOutUp { + 40% { + opacity: 1; + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + + to { + opacity: 0; + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); + transform-origin: center bottom; + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomOutUp { + animation-name: zoomOutUp; +} + + + +@keyframes slideInDown { + from { + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInDown { + animation-name: slideInDown; +} + + + +@keyframes slideInLeft { + from { + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInLeft { + animation-name: slideInLeft; +} + + + +@keyframes slideInRight { + from { + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInRight { + animation-name: slideInRight; +} + + + +@keyframes slideInUp { + from { + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + transform: translate3d(0, 0, 0); + } +} + +.slideInUp { + animation-name: slideInUp; +} + + + +@keyframes slideOutDown { + from { + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + transform: translate3d(0, 100%, 0); + } +} + +.slideOutDown { + animation-name: slideOutDown; +} + + + +@keyframes slideOutLeft { + from { + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + transform: translate3d(-100%, 0, 0); + } +} + +.slideOutLeft { + animation-name: slideOutLeft; +} + + + +@keyframes slideOutRight { + from { + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + transform: translate3d(100%, 0, 0); + } +} + +.slideOutRight { + animation-name: slideOutRight; +} + + + +@keyframes slideOutUp { + from { + transform: translate3d(0, 0, 0); + } + + to { + visibility: hidden; + transform: translate3d(0, -100%, 0); + } +} + +.slideOutUp { + animation-name: slideOutUp; +} + +.animated { + animation-duration: 1s; + animation-fill-mode: both; +} + +.animated.infinite { + animation-iteration-count: infinite; +} + +.animated.delay-1s { + animation-delay: 1s; +} + +.animated.delay-2s { + animation-delay: 2s; +} + +.animated.delay-3s { + animation-delay: 3s; +} + +.animated.delay-4s { + animation-delay: 4s; +} + +.animated.delay-5s { + animation-delay: 5s; +} + +.animated.fast { + animation-duration: 800ms; +} + +.animated.faster { + animation-duration: 500ms; +} + +.animated.slow { + animation-duration: 2s; +} + +.animated.slower { + animation-duration: 3s; +} + +@media (prefers-reduced-motion) { + .animated { + animation: unset !important; + transition: none !important; + } +} \ No newline at end of file diff --git a/miniprogram/images/001-2.png b/miniprogram/images/001-2.png new file mode 100644 index 0000000..d326e37 Binary files /dev/null and b/miniprogram/images/001-2.png differ diff --git a/miniprogram/images/001.png b/miniprogram/images/001.png new file mode 100644 index 0000000..b3a0731 Binary files /dev/null and b/miniprogram/images/001.png differ diff --git a/miniprogram/images/002-2.png b/miniprogram/images/002-2.png new file mode 100644 index 0000000..4775cfa Binary files /dev/null and b/miniprogram/images/002-2.png differ diff --git a/miniprogram/images/002.png b/miniprogram/images/002.png new file mode 100644 index 0000000..0b90666 Binary files /dev/null and b/miniprogram/images/002.png differ diff --git a/miniprogram/images/1-1.png b/miniprogram/images/1-1.png new file mode 100644 index 0000000..782e48f Binary files /dev/null and b/miniprogram/images/1-1.png differ diff --git a/miniprogram/images/1-2.png b/miniprogram/images/1-2.png new file mode 100644 index 0000000..aac2cbe Binary files /dev/null and b/miniprogram/images/1-2.png differ diff --git a/miniprogram/images/2-1.png b/miniprogram/images/2-1.png new file mode 100644 index 0000000..21d52b8 Binary files /dev/null and b/miniprogram/images/2-1.png differ diff --git a/miniprogram/images/2-2.png b/miniprogram/images/2-2.png new file mode 100644 index 0000000..b985fa5 Binary files /dev/null and b/miniprogram/images/2-2.png differ diff --git a/miniprogram/images/3-1.png b/miniprogram/images/3-1.png new file mode 100644 index 0000000..7b3a73a Binary files /dev/null and b/miniprogram/images/3-1.png differ diff --git a/miniprogram/images/3-2.png b/miniprogram/images/3-2.png new file mode 100644 index 0000000..5a184f8 Binary files /dev/null and b/miniprogram/images/3-2.png differ diff --git a/miniprogram/images/code-cloud-callback-config.png b/miniprogram/images/code-cloud-callback-config.png new file mode 100644 index 0000000..25b0bfc Binary files /dev/null and b/miniprogram/images/code-cloud-callback-config.png differ diff --git a/miniprogram/images/code-db-inc-dec.png b/miniprogram/images/code-db-inc-dec.png new file mode 100644 index 0000000..d8770b1 Binary files /dev/null and b/miniprogram/images/code-db-inc-dec.png differ diff --git a/miniprogram/images/code-db-onAdd.png b/miniprogram/images/code-db-onAdd.png new file mode 100644 index 0000000..22c7afb Binary files /dev/null and b/miniprogram/images/code-db-onAdd.png differ diff --git a/miniprogram/images/code-db-onQuery.png b/miniprogram/images/code-db-onQuery.png new file mode 100644 index 0000000..218550d Binary files /dev/null and b/miniprogram/images/code-db-onQuery.png differ diff --git a/miniprogram/images/code-db-onRemove.png b/miniprogram/images/code-db-onRemove.png new file mode 100644 index 0000000..b4eff71 Binary files /dev/null and b/miniprogram/images/code-db-onRemove.png differ diff --git a/miniprogram/images/code-func-sum.png b/miniprogram/images/code-func-sum.png new file mode 100644 index 0000000..0414529 Binary files /dev/null and b/miniprogram/images/code-func-sum.png differ diff --git a/miniprogram/images/console-entrance.png b/miniprogram/images/console-entrance.png new file mode 100644 index 0000000..bbbb973 Binary files /dev/null and b/miniprogram/images/console-entrance.png differ diff --git a/miniprogram/images/create-collection.png b/miniprogram/images/create-collection.png new file mode 100644 index 0000000..e0fdb34 Binary files /dev/null and b/miniprogram/images/create-collection.png differ diff --git a/miniprogram/pages/checkPwd/checkPwd.js b/miniprogram/pages/checkPwd/checkPwd.js new file mode 100644 index 0000000..6053b96 --- /dev/null +++ b/miniprogram/pages/checkPwd/checkPwd.js @@ -0,0 +1,143 @@ +// miniprogram/pages/checkPwd/checkPwd.js +const db = wx.cloud.database() +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + hasUserInfo : false, + confirmUserInfo : false, + userInfo : null, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + getPwdInfo: function(e){ + console.log(e) + if(e.detail.value.passwd.length < 6){ + wx.showToast({ + title: '独立密码长度要为6位', + icon: 'none', + duration: 2000 + }) + } + else{ + const that = this; + wx.showModal({ + title: '确认你刚刚输入的密码', + content: "“"+e.detail.value.passwd+'”,对吗?', + success: function (res) { + if (res.confirm) { + var nowdate = Date.parse(new Date()) + console.log("[云函数]调用createUser") + wx.cloud.callFunction({ + name: 'createUser', + data: { + avatarUrl: that.data.userInfo.avatarUrl, + city: that.data.userInfo.city, + gender: that.data.userInfo.gender, + language: that.data.userInfo.language, + nickName: that.data.userInfo.nickName, + openid: app.globalData.openid, + passwd: String(e.detail.value.passwd), + date: nowdate + }, + success: res => { + wx.showToast({ + title: '注册成功', + icon: 'success', + duration: 1500 + }) + app.globalData.hasRegister = true + app.globalData.refresh = true + setTimeout(function () { wx.navigateBack() }, 1500) + }, + fail :err =>{ + console.log(err) + } + }) + } + else if (res.cancel) { + wx.showToast({ + title: '我愿意等你', + icon: 'none', + duration: 800 + }) + } + } + }) + + } + }, + + confirmUserInfo: function (e) { + this.setData({ + confirmUserInfo: true, + }) + }, + + userInfoHandler: function (e) { + if(e.detail.errMsg == "getUserInfo:ok"){ + this.setData({ + hasUserInfo : true, + userInfo : e.detail.userInfo + }) + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/checkPwd/checkPwd.json b/miniprogram/pages/checkPwd/checkPwd.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/checkPwd/checkPwd.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/checkPwd/checkPwd.wxml b/miniprogram/pages/checkPwd/checkPwd.wxml new file mode 100644 index 0000000..a5aa08c --- /dev/null +++ b/miniprogram/pages/checkPwd/checkPwd.wxml @@ -0,0 +1,25 @@ + + + +
+ 请填写并牢记你的六位独立密码 + + +
+
+ + + “你将获得将你的密码与笔记结合的强大能力, + 定制的密码生成算法将确保您的账号安全无虞。” + 您的关键信息始终在云端加密储存,安全、稳妥。 + + + + + + + +
+ + +
diff --git a/miniprogram/pages/checkPwd/checkPwd.wxss b/miniprogram/pages/checkPwd/checkPwd.wxss new file mode 100644 index 0000000..09735d3 --- /dev/null +++ b/miniprogram/pages/checkPwd/checkPwd.wxss @@ -0,0 +1,98 @@ +/* miniprogram/pages/checkPwd/checkPwd.wxss */ +.passwd{ + background-color: #dbe2ef; + border-style: solid; + border-width: 5rpx; + border-color: #85C1E9; + width: 400rpx; + height: 80rpx; + margin-left: 150rpx; + margin-right: 150rpx; + margin-top: 80rpx; + text-align: center; + font-size: 60rpx; + border-radius: 20rpx; +} + +.info-text{ + font-size: 30rpx; + margin-top: 10rpx; +} + +.info-text-one{ + font-size: 30rpx; + margin-top: 50rpx; +} + +.info-text-end{ + font-size: 30rpx; + margin-top: 90rpx; +} + +.data{ + background-color: white; + margin-top: 80rpx; + margin-left: 20rpx; + margin-right: 20rpx; + border-radius: 20rpx; + height: 480rpx; + text-align: center; +} + +.set-button{ + background-color:#3f72af; + color:white; + margin-left: 50rpx; + margin-right: 50rpx; + margin-top: 130rpx; +} + +.register-view{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; + height: 480rpx; +} + +.register-button{ + background-color:#3f72af; + color:white; + width: 400rpx; +} + +.data text{ + color: #112d4e; +} + +.avatar{ + margin-top: 50rpx; + height: 200rpx; + width: 200rpx; + border-radius:50%; + display: flex; + overflow:hidden; + text-align: center; +} + +.show-view{ + height: 480rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; +} + +.confirm-button{ + margin-top: 65rpx; + background-color:#3f72af; + color:white; + width: 400rpx; + margin-left: 165rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/chooseLib/chooseLib.js b/miniprogram/pages/chooseLib/chooseLib.js new file mode 100644 index 0000000..e93478e --- /dev/null +++ b/miniprogram/pages/chooseLib/chooseLib.js @@ -0,0 +1,66 @@ +// pages/chooseLib/chooseLib.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + 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/chooseLib/chooseLib.json b/miniprogram/pages/chooseLib/chooseLib.json new file mode 100644 index 0000000..31c6280 --- /dev/null +++ b/miniprogram/pages/chooseLib/chooseLib.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "选择基础库", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/chooseLib/chooseLib.wxml b/miniprogram/pages/chooseLib/chooseLib.wxml new file mode 100644 index 0000000..3e9fb5e --- /dev/null +++ b/miniprogram/pages/chooseLib/chooseLib.wxml @@ -0,0 +1,14 @@ + + + + + + 初始化失败 + + + 请使用 2.2.3 或以上的基础库以使用云能力 + + + + + diff --git a/miniprogram/pages/chooseLib/chooseLib.wxss b/miniprogram/pages/chooseLib/chooseLib.wxss new file mode 100644 index 0000000..acce666 --- /dev/null +++ b/miniprogram/pages/chooseLib/chooseLib.wxss @@ -0,0 +1,7 @@ +/* pages/chooseLib/chooseLib.wxss */ + +@import "../../style/guide.wxss"; + +.black { + color: black; +} \ No newline at end of file diff --git a/miniprogram/pages/create/create.js b/miniprogram/pages/create/create.js new file mode 100644 index 0000000..22d540f --- /dev/null +++ b/miniprogram/pages/create/create.js @@ -0,0 +1,332 @@ +//index.js +//获取应用实例 +const app = getApp() +const db=wx.cloud.database() + +Page({ + data: { + id:"", + user:"", + scode:"", + handle:"", + usershow:"", + tagclass: "pass-ipt-plus", + ifusershow : false, + passwdclass : "pass-ipt", + isscode:false, //是否为系统生成密码 + scode_0:"" , //复制 + argv:{ + length: 8, + hasUpper: true, + hasSpecial: false, + specialChar: ["@", "#", "!"] + }, + len_array: ['短密码(6位)', '中等长度密码(8位)', '长密码(12位)','超长密码(16位)'], + len_objectArray: [ + { + id: 0, + name: '短密码(6位)' + }, + { + id: 1, + name: '中等长度密码(8位)' + }, + { + id: 2, + name: '长密码(12位)' + }, + { + id: 3, + name: '超长密码(16位)' + }, + ], + len_index : 1, + upper_array: ['可以有大写字母', '没有大写字母'], + upper_objectArray: [ + { + id: 0, + name: '可以有大写字母' + }, + { + id: 1, + name: '没有大写字母' + }, + ], + upper_index: 0, + special_array: ['可以有特殊字符', '没有特殊字符'], + special_objectArray: [ + { + id: 0, + name: '可以有特殊字符' + }, + { + id: 1, + name: '没有特殊字符' + }, + ], + special_index: 1, + if_generate : false, + id_tag : "" + }, + + onShow: function(){ + if(this.data.user.length > 12){ + let user = this.data.user + user = user.substr(0,12) + user += "..." + this.setData({ + usershow: user, + }) + } + else{ + this.setData({ + usershow: this.data.user + }) + } + }, + + goShow: function(){ + wx.navigateTo({ + url: '../show/show?textdata='+this.data.user, + }) + }, + + buttonShow: function(){ + + }, + + bindLenPickerChange: function (e) { + var targv = this.data.argv + if (e.detail.value == 0) targv.length = 6 + else if (e.detail.value == 1) targv.length = 8 + else if (e.detail.value == 2) targv.length = 12 + else if (e.detail.value == 3) targv.length = 16 + this.setData({ + argv: targv, + len_index: e.detail.value + }) + }, + bindUpperPickerChange: function (e) { + var targv = this.data.argv + if (e.detail.value == 0) targv.hasUpper = true + else targv.hasUpper = false + this.setData({ + argv : targv, + upper_index: e.detail.value + }) + }, + bindSpecialPickerChange: function (e) { + var targv = this.data.argv + if (e.detail.value == 0) targv.hasSpecial = true + else targv.hasSpecial = false + this.setData({ + argv: targv, + special_index: e.detail.value + }) + }, + + + scan : function(){ + const that = this + wx.scanCode({ + success: (res) => { + this.data.user = res.result + if (this.data.user.length > 18) { + let user = this.data.user + user = user.substr(0, 16) + user += "..." + this.setData({ + usershow: user, + }) + } + else { + this.setData({ + usershow: this.data.user + }) + } + wx.showToast({ + title: '成功', + icon: 'success', + duration: 2000 + }) + }, + fail: (res) => { + wx.showToast({ + title: '失败', + icon: 'none', + duration: 2000 + }) + }, + complete: (res) => { + } + }) + }, + + confirm:function(e){ + if (app.globalData.hasCheckPwd == true && app.globalData.hasRegister == true) { + + if (e.detail.value.wxml_id.length == 0){ + this.setData({id_tag : "请填写密码标签"}) + let that = this + setTimeout(function (){that.setData({ + tagclass: "pass-ipt-plus animated bounceIn", + id_tag: "" + })},2000) + return; + } + else{ + this.setData({ + id_tag: "" + }) + } + this.setData({ + id: e.detail.value.wxml_id, + user: this.data.user, + scode: e.detail.value.wxml_scode + }) + if (this.data.scode_0 != this.data.scode) + this.setData({ + isscode: false + }) + + //上传上传上传上传上传上传上传上传上传上传上传 + var ifhave=false + let that=this + db.collection('gaoziqi_test02').limit(1).where({ + _openid: app.globalData.openid, + id:this.data.id + }) + .get().then(res => { + if(res.data.length>0){ + ifhave=true + wx.showToast({ + title: '标题和已有标题重复,请重新输入', + icon: 'none', + duration: 2000 + }) + + } + else { + db.collection('gaoziqi_test02').add({ + data: { + id: this.data.id, + handle: this.data.handle, + user: this.data.user, + argv: this.data.argv, + isscode: this.data.isscode + }, + }) + } + if(ifhave==false){ + if (this.data.isscode == false) { + wx.cloud.callFunction({ + name: "passwd", + data: { + method: "customer", + argv: { + handle: this.data.handle, + openid: app.globalData.openid, + tag: this.data.id, + passwd:this.data.scode + } + + }, + complete: res => { + console.log(res) + if (res.result.status == "ok") { + console.log("[云函数][passwd]customer方法执行密码参数绑定成功") + } + } + }) + } + else { + wx.cloud.callFunction({ + name: "passwd", + data: { + method: "saver", + argv: { + handle: this.data.handle, + openid: app.globalData.openid, + tag: this.data.id + } + }, + complete: res => { + if (res.result.status == "ok") { + console.log("[云函数][passwd]saver方法执行密码参数绑定成功") + } + } + }) + } + this.setData({ + id : "", + user : "", + scode : "", + usershow : "", + if_generate: false + }) + wx.showToast({ + title: '密码添加成功', + icon: 'success', + duration: 2000 + }) + } + }) + } + else { + wx.showToast({ + title: '认证六位独立密码', + icon: 'none', + duration: 1500 + }) + } + +}, + +give_scode: function () { + if (app.globalData.hasCheckPwd == true && app.globalData.hasRegister == true){ + wx.showToast({ + title: '努力生成密码', + icon: 'loading', + duration: 1000 + }) + if (this.data.passwdclass == "pass-ipt animated bounceIn") { + this.setData({ + passwdclass: "pass-ipt", + scode: "", + scode_0: "" + }) + } + wx.cloud.callFunction({ + name: 'passwd', + data: { + method : "encoder", + argv: this.data.argv + }, + complete:res=>{ + console.log("[云函数][passwd]encoder方法调用成功") + this.setData({ + scode: res.result.passwd, + scode_0: res.result.passwd, + handle: res.result.handle, + isscode: true, + if_generate : true + }) + this.setData({ + passwdclass: "pass-ipt animated bounceIn", + }) + }, + }) + } + else{ + wx.showToast({ + title: '未认证六位密码', + icon: 'none', + duration: 1500 + }) + } + }, + onShareAppMessage: function () { + + } +}) + diff --git a/miniprogram/pages/create/create.json b/miniprogram/pages/create/create.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/create/create.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/create/create.wxml b/miniprogram/pages/create/create.wxml new file mode 100644 index 0000000..e69c40a --- /dev/null +++ b/miniprogram/pages/create/create.wxml @@ -0,0 +1,49 @@ + +
+ + + + + + + + + + + + + + 选择密码长度 + + + {{len_array[len_index]}} + + + + + + 是否含有大小写 + + + {{upper_array[upper_index]}} + + + + + + 是否含有特殊字符 + + + {{special_array[special_index]}} + + + + + + 您也可以生成密码后自定义您的密码 + + + 您的密码会在云端加密储存以确保安全 + +
+
diff --git a/miniprogram/pages/create/create.wxss b/miniprogram/pages/create/create.wxss new file mode 100644 index 0000000..9dc3195 --- /dev/null +++ b/miniprogram/pages/create/create.wxss @@ -0,0 +1,133 @@ +/* miniprogram/pages/create/create.wxss */ +.container{ + margin-top: 15rpx; + display: flex; + /*row 横向 column 列表 */ + flex-direction: row; + background-color: #f9f7f7; + border-radius: 15rpx; + margin-left:15rpx; + margin-right:15rpx; +} + +.d-container{ + display: flex; + /*row 横向 column 列表 */ + flex-direction: column; + background-color: white; + border-radius: 15rpx; + border-style: solid; + border-width: 4rpx; + border-color: #85C1E9; + margin-bottom: 20rpx; + margin-left: 15rpx; + margin-right: 15rpx; + margin-top: 15rpx; +} + +.section-title{ + border-style: solid; + border-color: #85C1E9; + border-width: 1rpx; + border-top: 0rpx; + border-left: 0rpx; + border-right: 0rpx; + background-color: #3f72af; + font-size: 30rpx; + color: #fcf9ec; +} + +.picker{ + height: 80rpx; + align-items: center; + justify-content: center; + text-align: center; + font-size: 35rpx; + background-color: #dbe2ef; + color: #454d66; +} +.picker-text{ + margin-top: 15rpx; +} + +.pass-ipt{ + border-style: solid; + border-width: 4rpx; + height: 110rpx; + width: 450rpx; + border-radius: 15rpx; + margin-bottom: 15rpx; + border-color: #3f72af; + font-size: 40rpx; + text-align: center; + background-color: #dbe2ef; +} + +.pass-ipt-plus{ + border-style: solid; + border-width: 4rpx; + height: 110rpx; + width: 700rpx; + border-radius: 15rpx; + margin-bottom: 15rpx; + border-color: #3f72af; + font-size: 40rpx; + text-align: center; + background-color: #dbe2ef; +} + +.blank-view{ + margin-top: 10rpx; +} + +.generate-btn{ + position: relative; + top:0rpx; + height: 110rpx; + border-style: solid; + border-width: 4rpx; + width: 200rpx; + border-color: #85C1E9; + border-radius: 15rpx; + vertical-align: middle; + text-align: center; + padding: 0rpx; + font-size: 40rpx; + background-color: #3f72af; + color: white; +} + +.all-container{ + margin-left: 25rpx; + margin-right: 25rpx; + margin-top: 25rpx; + border-radius: 15rpx; + border-style: solid; + border-width: 1rpx; + border-color: #85C1E9; + /*background-color: #f9f7f7;*/ + background-color: #f9f7f7; + font-family: Arial, "Microsoft YaHei"; +} + +.confirm-btn{ + background-color: #112d4e; + color: white; +} + +.info-label{ + text-align: center; + font-size: 30rpx; + color: red; +} + +.next-btn{ + background-color: #112d4e; + color: #f9f7f7; +} + +.tip-show{ + text-align: center; + font-size: 30rpx; + color: grey; +} \ No newline at end of file diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js new file mode 100644 index 0000000..46737e4 --- /dev/null +++ b/miniprogram/pages/index/index.js @@ -0,0 +1,304 @@ +//index.js +const app = getApp() +const db = wx.cloud.database() + +Page({ + data: { + avatarUrl: './user-unlogin.png', + userInfo: {}, + logged: false, + takeSession: false, + requestResult: '', + test: "Hello", + passwd_num : 0, + ifGetUser : null, + ifCheckPwd: false, + ifgetdays: false, + days : 0, + ifchangecode: false, + ifchangecode1: false, + button1: true, + }, + +goChange: function(e){ + this.setData({ + ifchangecode: true + }) +}, + +cancelChange: function(){ + this.setData({ + ifchangecode: false, + ifchangecode1: false, + button1: true, + }) +}, + +changecode: function (e) { + if(app.globalData.hasCheckPwd&&app.globalData.hasRegister){ + var old = null + + let that = this + db.collection("users").where({ + openid: app.globalData.openid + }).limit(1).get().then(res => { + if (res.data.length > 0) { + let that=this + wx.showToast({ + title: '正在验证密码', + icon: 'loading', + duration: 600 + }) + wx.cloud.callFunction({ + name: 'checkPwd', + data: { + passwd: e.detail.value.wxml_oldcode + }, + complete:res=>{ + if (res.result.status == "success" && e.detail.value.wxml_oldcode.length) { + this.setData({ + ifchangecode1: true, + ifchangecode: false, + button1: false, + }) + wx.showToast({ + title: '请输入您的新密码', + icon: 'none', + duration: 1500 + }) + + } + else if (e.detail.value.wxml_oldcode.length){ + wx.showToast({ + title: '密码错误', + icon: 'none', + duration: 1500 + }) + } + + }, + }) + } + else { + wx.showToast({ + title: '请注册', + icon: 'none', + duration: 1500 + }) + } + }) + } + else{ + wx.showToast({ + title: '请登录', + icon: 'none', + duration: 1500 + + }) + } +}, +changecode1: function (e) { + if (e.detail.value.wxml_newcode == e.detail.value.wxml_newcode1 && e.detail.value.wxml_newcode.length > 5 && this.data.ifchangecode1 == true) { + wx.showToast({ + title: '成功更改密码', + icon: 'success', + duration: 1500 + }) + let that = this + wx.cloud.callFunction({ + name: 'changePwd', + data: { + passwd: e.detail.value.wxml_newcode + }, + }) + this.setData({ + ifchangecode1: false, + ifchangecode: false, + button1: true, + }) + + } + else if (e.detail.value.wxml_newcode != e.detail.value.wxml_newcode1) { + wx.showToast({ + title: '两次输入需相同!', + icon: 'none', + duration: 1500 + }) + + } + else if (e.detail.value.wxml_newcode.length <= 5) { + wx.showToast({ + title: '密码需要六位', + icon: 'none', + duration: 1500 + }) + + } + else { + wx.showToast({ + title: '未知错误', + icon: 'none', + duration: 1500 + }) + } +}, + goRegister: function(){ + if (app.globalData.hasRegister == false) { + wx.navigateTo({ + url: '../checkPwd/checkPwd', + }) + } + }, + + goCheck:function(){ + if(app.globalData.hasCheckPwd == false){ + wx.navigateTo({ + url: '../loginPwd/loginPwd', + }) + } + }, + + onLoad: function() { + if (!wx.cloud) { + wx.redirectTo({ + url: '../chooseLib/chooseLib', + }) + } + this.onGetOpenid() + + }, + + onShow: function() { + if(app.globalData.refresh == true){ + this.onGetOpenid() + app.globalData.refresh == false + if(app.globalData.hasCheckPwd){ + this.setData({ + ifCheckPwd : true + }) + } + } + if (app.globalData.refreshCheck == true) { + if (app.globalData.hasCheckPwd) { + this.setData({ + ifCheckPwd: true + }) + } + app.globalData.refreshCheck = false + } + if (app.globalData.hasRegister == true){ + db.collection("gaoziqi_test02").where({ + _openid: app.globalData.openid + }).get().then(res => { + var that = this + db.collection('gaoziqi_test02').where({ + _openid: app.globalData.openid + }).count({success: function(res){ + that.setData({ + passwd_num: res.total + }) + }}) + + }) + var cdate = app.globalData.userInfo.date + var ndate = Date.parse(new Date()) + var fdate = new Date(ndate - cdate) + this.setData({ + days: fdate.getDate(), + ifgetdays : true + }) + } + }, + + onGetUserInfo: function(e) { + if (!this.logged && e.detail.userInfo) { + this.setData({ + logged: true, + avatarUrl: e.detail.userInfo.avatarUrl, + userInfo: e.detail.userInfo + }) + } + }, + + onGetOpenid: function() { + // 调用云函数 + wx.cloud.callFunction({ + name: 'login', + data: {}, + success: res => { + console.log('[云函数][login]获得用户的openid成功:', res.result.openid) + app.globalData.openid = res.result.openid + let that = this; + wx.cloud.callFunction({ + name: 'check', + data: {}, + success : res=>{ + console.log('[云函数] [check] 获取用户数据云函数调用成功') + if (res.result.status == "UserNotFound") { + console.log("[状态]未获得用户注册数据") + app.globalData.hasRegister = false + this.setData({ + ifGetUser: false + }) + } + else { + console.log("[应用状态]成功获取用户注册数据") + app.globalData.userInfo = res.result.userInfo + app.globalData.hasRegister = true + + that.setData({ + ifGetUser: true + }) + if(app.globalData.hasRegister) + db.collection('gaoziqi_test02').where({ + _openid: app.globalData.openid + }).count({ + success: function (res) { + that.setData({ + passwd_num: res.total + }) + } + }) + + } + if (app.globalData.hasRegister == false) { + wx.navigateTo({ + url: '../checkPwd/checkPwd', + }) + } + else { + if (app.globalData.hasCheckPwd == false) { + wx.navigateTo({ + url: '../loginPwd/loginPwd', + }) + } + } + }, + fail : err=>{ + + } + }) + }, + fail: err => { + console.error('[云函数][login]调用失败', err) + wx.navigateTo({ + url: '../deployFunctions/deployFunctions', + }) + } + }) + }, + + clickMe : function (){ + db.collection("users").where({ + name: "time" + }).limit(1).get({ + success : function(res){ + console.log(res.data) + }, + fail : function(err){ + console.log(err) + } + }) + }, + +}) 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..98cd9b9 --- /dev/null +++ b/miniprogram/pages/index/index.wxml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + 正在加载数据... + + + + + + 已使用密码便签 + + {{days}}天 + + + + + + 已储存密码便签数量 + + {{passwd_num}}条标签 + + + + + + +\n + + + +
+ + + + +
+ +
+ + + + + + + + +
+
+ diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss new file mode 100644 index 0000000..b95f490 --- /dev/null +++ b/miniprogram/pages/index/index.wxss @@ -0,0 +1,299 @@ +/**index.wxss**/ + +page { + background: #f6f6f6; + display: flex; + flex-direction: column; + justify-content: flex-start; +} +.container-change{ + margin-top: 15rpx; + display: flex; + /*row 横向 column 列表 */ + flex-direction: row; + background-color: #f9f7f7; + border-radius: 15rpx; + margin-left:15rpx; + margin-right:15rpx; +} + + + +.avatar{ + margin-top: 50rpx; + height: 200rpx; + width: 200rpx; + border-radius:50%; + display: flex; + overflow:hidden; + text-align: center; +} + +.show-view{ + display: flex; + flex-direction: column; + align-items: center; + background-color: white; + margin-top: 10rpx; + width: 720rpx; + border-radius: 20rpx; + height: 400rpx; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; +} + +.show-register{ + align-items: center; + background-color: white; + margin-top: 10rpx; + width: 720rpx; + border-radius: 20rpx; + height: 400rpx; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; +} + +.register-button{ + margin-left: 165rpx; + margin-top: 150rpx; + background-color:#3f72af; + color:white; + width: 400rpx; +} + +.check-button{ + margin-top: 150rpx; + background-color:#3f72af; + color:white; + width: 450rpx; +} + +.loading{ + margin-left: 150rpx; + margin-right: 150rpx; + margin-top: 160rpx; + text-align: center; + color: #112d4e; + font-size: 35rpx; +} + +.show-name{ + font-size: 40rpx; +} +.cd{ + border-style: solid; + border-width: 1rpx; + height: 110rpx; + width: 450rpx; + border-radius: 15rpx; + margin-bottom: 15rpx; + border-color: #3f72af; + font-size: 40rpx; + text-align: center; + background-color: #ffffff; +} +.cd-1{ + position: relative; + top:0rpx; + height: 110rpx; + border-style: solid; + border-width: 1rpx; + width: 200rpx; + border-color: rgb(255, 255, 255); + border-radius: 15rpx; + vertical-align: middle; + text-align: center; + padding: 0rpx; + font-size: 40rpx; + background-color: #3f72af; + color: white; +} +.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: purple; + background-color: white; + background-size: cover; +} + +.userinfo-nickname::after { + border: none; +} + +.uploader, .tunnel { + display: flex; + height: 200rpx; + flex-direction: column; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; +} + +.pwd_num { + text-align: center; + font-size: 35rpx; +} + +.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; +} + +.custom-css { + background-color: white; +} + +.change-form{ + margin-top: 50rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; +} + +.change-form-button{ + display: flex; + flex-direction: rows; + align-items: center; + justify-content: center; + width: 100%; +} + +.change-form-button-yes{ + width: 300rpx; + background-color:#3f72af; + color:white; +} + +.change-form-button-no{ + width: 200rpx; + background-color:#3f72af; + color:white; +} + +.change-form-all{ + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; + height: 450rpx; +} + +.button-cancel{ + border-style: solid; + border-width: 1rpx; + height: 110rpx; + width: 450rpx; + border-radius: 15rpx; + margin-bottom: 15rpx; + border-color: #3f72af; + font-size: 40rpx; + text-align: center; + background-color: #ffffff; +} \ No newline at end of file diff --git a/miniprogram/pages/index/user-unlogin.png b/miniprogram/pages/index/user-unlogin.png new file mode 100644 index 0000000..95b27e4 Binary files /dev/null and b/miniprogram/pages/index/user-unlogin.png differ diff --git a/miniprogram/pages/loginPwd/loginPwd.js b/miniprogram/pages/loginPwd/loginPwd.js new file mode 100644 index 0000000..b67dc5c --- /dev/null +++ b/miniprogram/pages/loginPwd/loginPwd.js @@ -0,0 +1,118 @@ +// miniprogram/pages/loginPwd/loginPwd.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + mover: "data animated bounce", + pwd : "" + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + onShow:function(options){ + + }, + + getPwdInfo: function(e) { + let that = this + wx.cloud.callFunction({ + name: 'checkPwd', + data: { + passwd: e.detail.value.passwd + }, + success: res => { + if(res.result.status == "success"){ + console.log("[云函数][checkPwd]执行密码哈希验证方式成功") + wx.showToast({ + title: '验证成功', + icon: 'success', + duration: 800 + }) + app.globalData.hasCheckPwd = true + app.globalData.refreshCheck = true + setTimeout(function () { wx.navigateBack() }, 800) + } + else { + console.log("[云函数][checkPwd]执行密码哈希验证方式失败") + if (that.data.mover == "data animated shake"){ + that.setData({ + mover: "", + }) + that.setData({ + mover: "data animated shake", + pwd: "" + }) + } + else{ + that.setData({ + mover: "data animated shake", + pwd: "" + }) + } + + app.globalData.hasCheckPwd = false + } + }, + fail: err => { + console.log(err) + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/loginPwd/loginPwd.json b/miniprogram/pages/loginPwd/loginPwd.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/loginPwd/loginPwd.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/loginPwd/loginPwd.wxml b/miniprogram/pages/loginPwd/loginPwd.wxml new file mode 100644 index 0000000..f496f71 --- /dev/null +++ b/miniprogram/pages/loginPwd/loginPwd.wxml @@ -0,0 +1,10 @@ + + +
+ + 验证六位独立密码 + + +
+
+
diff --git a/miniprogram/pages/loginPwd/loginPwd.wxss b/miniprogram/pages/loginPwd/loginPwd.wxss new file mode 100644 index 0000000..bfcc729 --- /dev/null +++ b/miniprogram/pages/loginPwd/loginPwd.wxss @@ -0,0 +1,43 @@ +/* miniprogram/pages/loginPwd/loginPwd.wxss */ +/* miniprogram/pages/checkPwd/checkPwd.wxss */ +.passwd{ + background-color: #dbe2ef; + border-style: solid; + border-width: 1rpx; + border-color: #85C1E9; + width: 400rpx; + height: 80rpx; + margin-left: 150rpx; + margin-right: 150rpx; + margin-top: 80rpx; + text-align: center; + font-size: 60rpx; + border-radius: 20rpx; +} + +.data{ + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; + background-color: white; + margin-top: 80rpx; + margin-left: 20rpx; + margin-right: 20rpx; + border-radius: 20rpx; + height: 480rpx; + text-align: center; +} + +.set-button{ + background-color:#3f72af; + color:white; + margin-left: 50rpx; + margin-right: 50rpx; + margin-top: 110rpx; +} + +.data-text{ + height: 30rpx; + color: #112d4e; + background-color: white; +} \ No newline at end of file diff --git a/miniprogram/pages/logs/logs.js b/miniprogram/pages/logs/logs.js new file mode 100644 index 0000000..edbe2f4 --- /dev/null +++ b/miniprogram/pages/logs/logs.js @@ -0,0 +1,178 @@ +//index.js +//获取应用实例 +const app = getApp() +const db = wx.cloud.database() +//assciated with in wxml; +var arryHeight = 0; +Page({ + data: { + flag: '', + focusKey: true, + viewlist: [], + showViewList:[], + inputValue: '', + bindlist: [], + hideScroll: true, + check1:false, + check2:false + + }, + + login: function () { + this.setData({ check1: app.globalData.hasCheckPwd, + check2: app.globalData.hasRegister + }) + if(this.data.check1&&this.data.check2){ + wx.showToast({ + title: '验证成功', + icon: 'none', + duration: 1500 + }) + + } + else { + wx.showToast({ + title: '请验证六位密码', + icon: 'none', + duration: 1500 + }) + + } + }, + onShow:function(){ + this.setData({ check1: app.globalData.hasCheckPwd, check2: app.globalData.hasRegister }) + var that = this + var keyId = app.globalData.openid + var list = [] + db.collection('gaoziqi_test02').where({ + _openid: keyId + }).get().then(res => { + list.push(res.data) + this.setData({ + viewlist: list[0] + }) + var tshowViewList = [] + for (let i = 0; i < this.data.viewlist.length; i++) { + let show_user = this.data.viewlist[i].user.substr(0, 12) + if (this.data.viewlist[i].user.length > 15) { + show_user += "..." + } + tshowViewList.push({ + id : "[ "+this.data.viewlist[i].id+" ]", + user : show_user + }) + } + this.setData({ + showViewList: tshowViewList + }) + }) + + }, + onLoad: function(options) { + + var that = this; + var keyId = app.globalData.openid; + var list = []; + + db.collection('gaoziqi_test02').where({ + _openid: keyId + }).get().then(res => { + list.push(res.data) + this.setData({ + viewlist: list[0] + }) + }) + }, + clickEvent: function (e) { + var ind = parseInt(e.target.id) + wx.navigateTo({ + url: '../showPwd/showPwd?hash='+this.data.viewlist[ind].handle+"&&openid="+this.data.viewlist[ind]._openid+"&&user="+this.data.viewlist[ind].user+"&&id="+this.data.viewlist[ind].id+"&&_id="+this.data.viewlist[ind]._id+"&&handle="+this.data.viewlist[ind].handle, + success: function (res) { }, + fail: function (res) { }, + complete: function (res) { }, + }) + }, + //失焦 + searchBlur: function (e) { + this.setData({ + focusKey: false + }) + }, + //聚焦 + searchFocus: function (e) { + }, + //输入联想,模糊搜索 + inputsearch: function (event) { + var prefix = event.detail.value + var newSource=[] + if (prefix != "") { + this.data.viewlist.forEach(function (e) { + if (e.id.indexOf(prefix) != -1) { + newSource.push(e.id) + } + }) + } + //匹配结果存在,将其返回,否则返回空数组 + if (newSource.length != 0) { + this.setData({ + //匹配结果存在,显示自动联想词下拉列表 + hideScroll: false, + bindlist: newSource, + arrayHeight: newSource.length * 71 + }) + } + else { + this.setData({ + //匹配无结果,不显示下拉列表 + hideScroll: true, + bindlist: [] + }) + } + }, + itemtap: function(e){ + var item=e.currentTarget.id + for (let i=0;i { + }) + } + else { + focusKey: false + } + }, + searchButton: function (event) { + if (this.data.flag) { + } + else { + wx.showToast({ + title: '请输入索引', + icon: none, + duration: 1500 + }) + } + } +}) \ No newline at end of file diff --git a/miniprogram/pages/logs/logs.json b/miniprogram/pages/logs/logs.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/logs/logs.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/logs/logs.wxml b/miniprogram/pages/logs/logs.wxml new file mode 100644 index 0000000..ceb738d --- /dev/null +++ b/miniprogram/pages/logs/logs.wxml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + {{item.id}} + {{item.user}} + + + + + {{item.id}} + {{item.user}} + + + + + +请先验证六位密码 + + \ No newline at end of file diff --git a/miniprogram/pages/logs/logs.wxss b/miniprogram/pages/logs/logs.wxss new file mode 100644 index 0000000..eaf3c0e --- /dev/null +++ b/miniprogram/pages/logs/logs.wxss @@ -0,0 +1,158 @@ +/* miniprogram/pages/logs/logs.wxss */ + +.margin{ + border-width: 1rpx; + border-style: solid; + border-color: #3f72af; + border-radius: 15rpx; + width: 749rpx; + background-color: #85C1E9; + margin-top: 15rpx; +} +.searchview{ + padding-right: 750rpx; + background-color: #85C1E9; + border-right: 0; + align-content: middle; + border-radius: 10rpx; + padding-left: 70rpx; + height: 70rpx; + width: 730rpx; +} +.overall{ + display: flex; + /*row 横向 column 列表 */ + flex-direction: row; + width: 100%; +} +.search-input{ + border-radius: 15rpx; + padding-right: 0rpx; + box-sizing: border-box; + background-color: #85C1E9; + color:#f9f7f7; + width: 100%; + left: 0; +} +.searchicon{ + position: absolute; + width: 70rpx; + height: 70rpx; + background-size: 31rpx auto; + left: 5rpx; + top: 10rpx; +} +.overall { + height: 83rpx; + padding-right: 20rpx; + margin-top: 10rpx; + width: 300rpx; + left: 20rpx; +} +.iconView{ + top:10rpx; + width: 20px; + height: 25px; + /*border-top: 2px solid #999; + border-right: 2px solid #999; + /*transform: rotate(45deg);*/ + right:0%; +} +.interval{ + height: 25rpx; + border-style: solid; + border-width: 2rpx; + border-right: 0; + border-color: #3f72af; + border-top: 0; + border-left: 0; +} +.textView1{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background-color:#85C1E9; + + font-style: normal; + font-weight: 500; + height: 110rpx; + width: 720rpx; + +} +.textView2{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 110rpx; + background-color:#dad9ff; + font-style: normal; + font-weight: 500; + width: 720rpx; + +} +.showView1{ + display: flex; + width: 750rpx; + justify-content: center; + align-items: center; + background: #3f72af; + height: 100rpx; + border-style:normal; + border-width: 10rpx; + border-right: 0; + border-color: #3f72af; +} +.showView2{ + display: flex; + width: 750rpx; + justify-content: center; + height: 100rpx; + align-items: center; + background: #3f72af; + border-style:normal; + border-width: 10rpx; + border-right: 0; + border-color: #3f72af; +} + +.brief{ + color:white; +} + +.brief-title{ + color: white; +} + +.log{ + text-align: center; + margin-top: 50rpx; + +} + +.scrollview{ + position: absolute; + background-color: rgb(156, 204, 236); + z-index: 999; + opacity:0.9; + text-align: center; + border-style: solid; + border-color: white; + border-width: 1rpx; + color:white; + left: 0%; +} + +.itemview{ + border-color: white; + border-width: 1rpx; + color:white; + margin-bottom: 2rpx; + font-size: 50rpx; +} + +.iconfont{ + position: fixed; + left: 6.8rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/logs/search.png b/miniprogram/pages/logs/search.png new file mode 100644 index 0000000..5217efb Binary files /dev/null and b/miniprogram/pages/logs/search.png differ diff --git a/miniprogram/pages/openapi/callback/callback.js b/miniprogram/pages/openapi/callback/callback.js new file mode 100644 index 0000000..23da325 --- /dev/null +++ b/miniprogram/pages/openapi/callback/callback.js @@ -0,0 +1,15 @@ +// miniprogram/pages/openapi/callback/callback.js +Page({ + + data: { + + }, + + onLoad: function (options) { + + }, + + onCustomerServiceButtonClick(e) { + console.log(e) + }, +}) diff --git a/miniprogram/pages/openapi/callback/callback.json b/miniprogram/pages/openapi/callback/callback.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/openapi/callback/callback.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/openapi/callback/callback.wxml b/miniprogram/pages/openapi/callback/callback.wxml new file mode 100644 index 0000000..cb2671c --- /dev/null +++ b/miniprogram/pages/openapi/callback/callback.wxml @@ -0,0 +1,21 @@ + + + + + + + 测试须知 + 1. 需在项目根目录创建消息推送配置文件 temp-cloud-callback-config.json + 2. 填写消息推送配置 + 3. 右键配置文件选择上传配置 + 4. 确认接收消息的云函数已上传 + 5. 在手机上测试 + + + + 示例客服消息配置 + + + diff --git a/miniprogram/pages/openapi/callback/callback.wxss b/miniprogram/pages/openapi/callback/callback.wxss new file mode 100644 index 0000000..0b5d03a --- /dev/null +++ b/miniprogram/pages/openapi/callback/callback.wxss @@ -0,0 +1,3 @@ +/* miniprogram/pages/openapi/callback/callback.wxss */ + +@import "../../../style/guide.wxss"; \ No newline at end of file diff --git a/miniprogram/pages/openapi/cloudid/cloudid.js b/miniprogram/pages/openapi/cloudid/cloudid.js new file mode 100644 index 0000000..6828ca0 --- /dev/null +++ b/miniprogram/pages/openapi/cloudid/cloudid.js @@ -0,0 +1,60 @@ +// miniprogram/pages/openapi/cloudid/cloudid.js +Page({ + + data: { + weRunResult: '', + userInfoResult: '', + }, + + onGetWeRunData() { + wx.getWeRunData({ + success: res => { + wx.cloud.callFunction({ + name: 'echo', + data: { + // info 字段在云函数 event 对象中会被自动替换为相应的敏感数据 + info: wx.cloud.CloudID(res.cloudID), + }, + }).then(res => { + console.log('[onGetWeRunData] 收到 echo 回包:', res) + + this.setData({ + weRunResult: JSON.stringify(res.result), + }) + + wx.showToast({ + title: '敏感数据获取成功', + }) + }).catch(err => { + console.log('[onGetWeRunData] 失败:', err) + }) + } + }) + + }, + + onGetUserInfo(e) { + console.log(e) + wx.cloud.callFunction({ + name: 'openapi', + data: { + action: 'getOpenData', + openData: { + list: [ + e.detail.cloudID, + ] + } + } + }).then(res => { + console.log('[onGetUserInfo] 调用成功:', res) + + this.setData({ + userInfoResult: JSON.stringify(res.result), + }) + + wx.showToast({ + title: '敏感数据获取成功', + }) + }) + } +}) diff --git a/miniprogram/pages/openapi/cloudid/cloudid.json b/miniprogram/pages/openapi/cloudid/cloudid.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/openapi/cloudid/cloudid.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/openapi/cloudid/cloudid.wxml b/miniprogram/pages/openapi/cloudid/cloudid.wxml new file mode 100644 index 0000000..21c5710 --- /dev/null +++ b/miniprogram/pages/openapi/cloudid/cloudid.wxml @@ -0,0 +1,41 @@ + + + + + 开放数据调用 + 通过 cloudID 获取敏感开放数据有以下两种方式 + 1. 小程序端 callFunction 自动获取 + 2. 通过 wx-server-sdk 获取 + 以下分别先后展示这两种获取方式 + + + + + + + + 测试须知 + 1. 公共库版本需大于 2.7.0 + 2. 请确保 echo 函数已上传 + + + + {{weRunResult}} + + + + + + + + + 测试须知 + 1. 公共库版本需大于 2.7.0 + 2. 请确保 openapi 函数已上传 + + + + {{userInfoResult}} + + + diff --git a/miniprogram/pages/openapi/cloudid/cloudid.wxss b/miniprogram/pages/openapi/cloudid/cloudid.wxss new file mode 100644 index 0000000..0219f2f --- /dev/null +++ b/miniprogram/pages/openapi/cloudid/cloudid.wxss @@ -0,0 +1 @@ +@import "../../../style/guide.wxss"; \ No newline at end of file diff --git a/miniprogram/pages/openapi/openapi.js b/miniprogram/pages/openapi/openapi.js new file mode 100644 index 0000000..9c26913 --- /dev/null +++ b/miniprogram/pages/openapi/openapi.js @@ -0,0 +1,109 @@ +Page({ + + data: { + templateMessageResult: '', + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }, + + submitTemplateMessageForm(e) { + this.setData({ + templateMessageResult: '', + }) + + wx.cloud.callFunction({ + name: 'openapi', + data: { + action: 'sendTemplateMessage', + formId: e.detail.formId, + }, + success: res => { + console.warn('[云函数] [openapi] templateMessage.send 调用成功:', res) + wx.showModal({ + title: '发送成功', + content: '请返回微信主界面查看', + showCancel: false, + }) + wx.showToast({ + title: '发送成功,请返回微信主界面查看', + }) + this.setData({ + templateMessageResult: JSON.stringify(res.result) + }) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '调用失败', + }) + console.error('[云函数] [openapi] templateMessage.send 调用失败:', err) + } + }) + }, + + onGetWXACode() { + + this.setData({ + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }) + + // 此处为演示,将使用 localStorage 缓存,正常开发中文件 ID 应存在数据库中 + const fileID = wx.getStorageSync('wxacodeCloudID') + + if (fileID) { + // 有云文件 ID 缓存,直接使用该 ID + // 如需清除缓存,选择菜单栏中的 “工具 -> 清除缓存 -> 清除数据缓存”,或在 Storage 面板中删掉相应的 key + this.setData({ + wxacodeSrc: fileID, + wxacodeResult: `从本地缓存中取得了小程序码的云文件 ID`, + showClearWXACodeCache: true, + }) + console.log(`从本地缓存中取得了小程序码的云文件 ID:${fileID}`) + } else { + wx.cloud.callFunction({ + name: 'openapi', + data: { + action: 'getWXACode', + }, + success: res => { + console.warn('[云函数] [openapi] wxacode.get 调用成功:', res) + wx.showToast({ + title: '调用成功', + }) + this.setData({ + wxacodeSrc: res.result, + wxacodeResult: `云函数获取二维码成功`, + showClearWXACodeCache: true, + }) + wx.setStorageSync('wxacodeCloudID', res.result) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '调用失败', + }) + console.error('[云函数] [openapi] wxacode.get 调用失败:', err) + } + }) + } + }, + + clearWXACodeCache() { + wx.removeStorageSync('wxacodeCloudID') + + this.setData({ + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }) + + wx.showToast({ + title: '清除成功', + }) + }, + +}) + diff --git a/miniprogram/pages/openapi/openapi.json b/miniprogram/pages/openapi/openapi.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/openapi/openapi.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/openapi/openapi.wxml b/miniprogram/pages/openapi/openapi.wxml new file mode 100644 index 0000000..dcf7de3 --- /dev/null +++ b/miniprogram/pages/openapi/openapi.wxml @@ -0,0 +1,22 @@ + + + + + + 服务端调用 + + + + + + 开放数据调用 + + + + + + 消息推送 + + + + diff --git a/miniprogram/pages/openapi/openapi.wxss b/miniprogram/pages/openapi/openapi.wxss new file mode 100644 index 0000000..02ec169 --- /dev/null +++ b/miniprogram/pages/openapi/openapi.wxss @@ -0,0 +1,7 @@ +/* miniprogram/pages/openapi/openapi.wxss */ + +@import "../../style/guide.wxss"; + +.black { + color: black; +} diff --git a/miniprogram/pages/openapi/serverapi/serverapi.js b/miniprogram/pages/openapi/serverapi/serverapi.js new file mode 100644 index 0000000..9c26913 --- /dev/null +++ b/miniprogram/pages/openapi/serverapi/serverapi.js @@ -0,0 +1,109 @@ +Page({ + + data: { + templateMessageResult: '', + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }, + + submitTemplateMessageForm(e) { + this.setData({ + templateMessageResult: '', + }) + + wx.cloud.callFunction({ + name: 'openapi', + data: { + action: 'sendTemplateMessage', + formId: e.detail.formId, + }, + success: res => { + console.warn('[云函数] [openapi] templateMessage.send 调用成功:', res) + wx.showModal({ + title: '发送成功', + content: '请返回微信主界面查看', + showCancel: false, + }) + wx.showToast({ + title: '发送成功,请返回微信主界面查看', + }) + this.setData({ + templateMessageResult: JSON.stringify(res.result) + }) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '调用失败', + }) + console.error('[云函数] [openapi] templateMessage.send 调用失败:', err) + } + }) + }, + + onGetWXACode() { + + this.setData({ + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }) + + // 此处为演示,将使用 localStorage 缓存,正常开发中文件 ID 应存在数据库中 + const fileID = wx.getStorageSync('wxacodeCloudID') + + if (fileID) { + // 有云文件 ID 缓存,直接使用该 ID + // 如需清除缓存,选择菜单栏中的 “工具 -> 清除缓存 -> 清除数据缓存”,或在 Storage 面板中删掉相应的 key + this.setData({ + wxacodeSrc: fileID, + wxacodeResult: `从本地缓存中取得了小程序码的云文件 ID`, + showClearWXACodeCache: true, + }) + console.log(`从本地缓存中取得了小程序码的云文件 ID:${fileID}`) + } else { + wx.cloud.callFunction({ + name: 'openapi', + data: { + action: 'getWXACode', + }, + success: res => { + console.warn('[云函数] [openapi] wxacode.get 调用成功:', res) + wx.showToast({ + title: '调用成功', + }) + this.setData({ + wxacodeSrc: res.result, + wxacodeResult: `云函数获取二维码成功`, + showClearWXACodeCache: true, + }) + wx.setStorageSync('wxacodeCloudID', res.result) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '调用失败', + }) + console.error('[云函数] [openapi] wxacode.get 调用失败:', err) + } + }) + } + }, + + clearWXACodeCache() { + wx.removeStorageSync('wxacodeCloudID') + + this.setData({ + wxacodeSrc: '', + wxacodeResult: '', + showClearWXACodeCache: false, + }) + + wx.showToast({ + title: '清除成功', + }) + }, + +}) + diff --git a/miniprogram/pages/openapi/serverapi/serverapi.json b/miniprogram/pages/openapi/serverapi/serverapi.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/openapi/serverapi/serverapi.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/openapi/serverapi/serverapi.wxml b/miniprogram/pages/openapi/serverapi/serverapi.wxml new file mode 100644 index 0000000..3147ee6 --- /dev/null +++ b/miniprogram/pages/openapi/serverapi/serverapi.wxml @@ -0,0 +1,41 @@ + + + +
+ + + 调用结果:{{templateMessageResult}} + +
+ + + 测试须知 + 1. 需在手机上预览测试,工具中无效 + 2. 需上传 cloudfunctions 目录下的 openapi 云函数 + 3. 调用成功后返回到微信主界面查看收到的模板消息 + + + + + 获取小程序码 + + + {{wxacodeResult}} + 清除缓存 + + + + + 测试须知 + 1. 需上传 cloudfunctions 目录下的 openapi 云函数 + 2. 云函数中获取图片后会上传至存储空间并返回至小程序使用和缓存 + 3. 云存储需设置为公有读 + + + + + + +
diff --git a/miniprogram/pages/openapi/serverapi/serverapi.wxss b/miniprogram/pages/openapi/serverapi/serverapi.wxss new file mode 100644 index 0000000..df74419 --- /dev/null +++ b/miniprogram/pages/openapi/serverapi/serverapi.wxss @@ -0,0 +1,7 @@ +/* miniprogram/pages/openapi/openapi.wxss */ + +@import "../../../style/guide.wxss"; + +.black { + color: black; +} \ No newline at end of file diff --git a/miniprogram/pages/show/show.js b/miniprogram/pages/show/show.js new file mode 100644 index 0000000..27bafd9 --- /dev/null +++ b/miniprogram/pages/show/show.js @@ -0,0 +1,19 @@ +var app = getApp() +Page({ + data: { + user : "" + }, + onLoad: function(option){ + this.setData({ + user: option.textdata, + }) + }, + inputSaver: function(e){ + let pages = getCurrentPages(); + let prevPage = pages[pages.length - 2]; + prevPage.setData({ + user : e.detail.value + }) + } + +}) \ No newline at end of file diff --git a/miniprogram/pages/show/show.json b/miniprogram/pages/show/show.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/show/show.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/show/show.wxml b/miniprogram/pages/show/show.wxml new file mode 100644 index 0000000..b0d6b91 --- /dev/null +++ b/miniprogram/pages/show/show.wxml @@ -0,0 +1,4 @@ + + + + diff --git a/miniprogram/pages/show/show.wxss b/miniprogram/pages/show/show.wxss new file mode 100644 index 0000000..73525f1 --- /dev/null +++ b/miniprogram/pages/show/show.wxss @@ -0,0 +1,34 @@ +/* miniprogram/pages/show/show.wxss */ + +.container{ + display: flex; + flex-direction: column; + align-items: center; + background-color: white; + margin-top: 10rpx; + margin-left: 15rpx; + width: 720rpx; + border-radius: 20rpx; + height: 450rpx; + border-style: solid; + border-width: 1rpx; + border-color: #3f72af; +} + +.edit{ + border-color: #3f72af; + font-size: 40rpx; + background-color: #dbe2ef; + border-radius: 20rpx; + margin-top: 15rpx; + margin-left: 10rpx; + width: 700rpx; + height: 420rpx; +} + +.saved-btn{ + background-color:#3f72af; + color:white; + width: 400rpx; + +} \ No newline at end of file diff --git a/miniprogram/pages/showEdit/showEdit.js b/miniprogram/pages/showEdit/showEdit.js new file mode 100644 index 0000000..9b5b716 --- /dev/null +++ b/miniprogram/pages/showEdit/showEdit.js @@ -0,0 +1,106 @@ +// miniprogram/pages/showEdit/showEdit.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + content:'', + count: 0, + tmaxlength : 140 + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (options.count == 1){ + this.setData({ + tmaxlength: 14 + }) + } + this.setData({ + content: options.content, + count: options.count + }) + }, + inputSaver: function (e) { + let pages = getCurrentPages(); + console.log("aaaaa", pages.length) + let prevPage = pages[pages.length - 2]; + if(this.data.count == 1) + prevPage.setData({ + id: e.detail.value, + changeId: true, + if_changed: true, + + }) + else if(this.data.count == 2) + prevPage.setData({ + user: e.detail.value, + changeUser: true, + if_changed: true, + }) + else if(this.data.count == 3) + prevPage.setData({ + changPPPWD: e.detail.value, + passwd: e.detail.value, + changePwd: true + }) + }, + confirmFunc: function(){ + let pages = getCurrentPages() + let prevPage = pages[pages.length - 2] + wx.navigateBack({ + success: res=>{ + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + 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/showEdit/showEdit.json b/miniprogram/pages/showEdit/showEdit.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/showEdit/showEdit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/showEdit/showEdit.wxml b/miniprogram/pages/showEdit/showEdit.wxml new file mode 100644 index 0000000..a6f84a5 --- /dev/null +++ b/miniprogram/pages/showEdit/showEdit.wxml @@ -0,0 +1,7 @@ + + + + + diff --git a/miniprogram/pages/showEdit/showEdit.wxss b/miniprogram/pages/showEdit/showEdit.wxss new file mode 100644 index 0000000..1560ac4 --- /dev/null +++ b/miniprogram/pages/showEdit/showEdit.wxss @@ -0,0 +1,33 @@ +/* miniprogram/pages/showEdit/showEdit.wxss */ +.edit{ + border-color: #3f72af; + font-size: 40rpx; + background-color: #dbe2ef; + border-radius: 20rpx; + margin-top: 15rpx; + margin-left: 10rpx; + width: 700rpx; + height: 420rpx; + border-width: 1rpx; + border-style: solid; +} +.icon-group{ + width:100%; + border-radius: 3px; + padding-top:2px; + font-size:14px; + background-color:#CC3333; + color:white; + overflow:hidden; + height:45px; + bottom: 0; + position: fixed; +} + +.confirmView{ + background-color:#3f72af; + color:white; + border-radius: 15rpx; + width: 710rpx; + margin-top: 15rpx; +} \ No newline at end of file diff --git a/miniprogram/pages/showPwd/showPwd.js b/miniprogram/pages/showPwd/showPwd.js new file mode 100644 index 0000000..d5fde5c --- /dev/null +++ b/miniprogram/pages/showPwd/showPwd.js @@ -0,0 +1,238 @@ +// miniprogram/pages/showPwd/showPwd.js +const db = wx.cloud.database() +const app=getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + handle: '', + _openid: '', + _hash: '', + passwd: '', + _id: '', + id: '', + user: '', + changPPPWD :"", + changePwd: false, + changeId: false, + changeUser: false, + mHidden: true, + if_changed: false + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + _hash: options.hash, + _openid: options.openid, + id: options.id, + _id: options._id, + user: options.user, + handle: options.handle + }) + //this.showPwd() + }, + copyPwd: function(){ + wx.setClipboardData({ + data: this.data.passwd, + success: function(res) { + wx.showToast({ + title: '复制成功', + icon: 'success', + duration: 1000 + }) + } + }) + }, + onShow: function(){ + if (this.data.changePwd) { + wx.cloud.callFunction({ + name: "passwd", + data: { + method: "deleter", + argv: { + handle: this.data._hash, + openid: this.data._openid + } + }, + success: res => { + } + }) + wx.cloud.callFunction({ + name: "passwd", + data: { + method: "customer", + argv: { + handle: this.data._hash, + openid: this.data._openid, + tag: this.data.id, + passwd: this.data.changPPPWD + } + } + }) + } + if(this.data.if_changed){ + db.collection('gaoziqi_test02').doc(this.data._id).update({ + data: { + id: this.data.id, + handle: this.data._hash, + user: this.data.user + }, + complete: res => { + console.log("更新数据库信息成功") + } + }) + } + if (this.data.if_changed || this.data.passwd == ''){ + this.showPwd() + } + this.setData({ + if_changed: false + }) + }, + confirmFunc: function(e){ + this.cancel() + this.setData({ + mHidden: true + }) + }, + cancelFunc: function(e){ + this.setData({ + mHidden: true + }) + }, + clickCancel: function(){ + /*this.setData({ + mHidden: false + })*/ + let that = this + wx.showModal({ + title: '你要删除这条标签对吗?', + content: "“" + "你确定删.除.这.条.标.签" + '”,对吗?', + success: function (res) { + if (res.confirm) { + that.confirmFunc() + } + else{ + + } + } + }) + }, + cancel: function(e){ + wx.cloud.callFunction({ + name: "passwd", + data: { + method: "deleter", + argv: { + handle: this.data._hash, + openid: app.globalData.openid + } + }, + complete: res=>{ + console.log(res) + if(res.result.status == "ok"){ + console.log("[云函数][passwd]deleter方法成功删除便签关联密码") + } + } + }) + db.collection('gaoziqi_test02').doc(this.data._id).remove({ + success: res => { + this.setData({ + handle: '', + _openid: '', + passwd: '', + id: '', + _id: '', + user: '', + }) + }, + }) + wx.navigateBack({ + success: res=>{ + wx.showToast({ + title: '删除成功', + duration: 1000 + }) + } + }) + }, + showPwd:function(res){ + wx.cloud.callFunction({ + name : "passwd", + data : { + method : "decoder", + argv : { + handle : this.data._hash, + openid : this.data._openid + } + }, + success: res=>{ + if (res.result.status == "ok") { + console.log("[云函数][passwd]decoder方法成功解密用户密码") + } + this.setData({ + passwd:res.result.passwd + }) + }, + fail: err=>{ + } + }) + + }, + tapEdit:function(e){ + var content = e.target.id + var count = e.currentTarget.dataset.experienced + wx.navigateTo({ + url:'../showEdit/showEdit?content='+content+'&&count='+count, + success: function (res) { }, + fail: function (res) { }, + complete: function (res) { }, + }) + + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/showPwd/showPwd.json b/miniprogram/pages/showPwd/showPwd.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/miniprogram/pages/showPwd/showPwd.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/showPwd/showPwd.wxml b/miniprogram/pages/showPwd/showPwd.wxml new file mode 100644 index 0000000..9242ed1 --- /dev/null +++ b/miniprogram/pages/showPwd/showPwd.wxml @@ -0,0 +1,24 @@ + + + + {{id}} + + + + + + + + 密码: {{passwd}} + + 复制密码 + + + + + \ No newline at end of file diff --git a/miniprogram/pages/showPwd/showPwd.wxss b/miniprogram/pages/showPwd/showPwd.wxss new file mode 100644 index 0000000..5a9a6a5 --- /dev/null +++ b/miniprogram/pages/showPwd/showPwd.wxss @@ -0,0 +1,122 @@ +/* miniprogram/pages/showPwd/showPwd.wxss */ +.overall{ + left:20rpx; + font-family: 'Courier New', Courier, monospace; + background-color: #d8f3fa; + height:100%; + word-break:break-all; +} +.container{ + margin-top: 15rpx; + display: flex; + /*row 横向 column 列表 */ + flex-direction: row; + background-color: #f7f8f9; + border-radius: 15rpx; + margin-left:15rpx; + margin-right:15rpx; +} + +.edit-title{ + position: fixed; + color: #3f72af; + bottom: 20rpx; + right: 0; + text-align: right; + height: 70rpx; +} +.edit{ + position: fixed; + color: #3f72af; + bottom: 0; + right: 0; + text-align: right; +} +.show{ + position: fixed; + font-size: 40rpx; + font-weight:bold; + width: 80%; + bottom: 20rpx; + left: 10rpx; + +} +.isRuleShow { + opacity: 1; +} +.isRuleHide { + opacity: 0; +} +.tag-show{ + display: flex; + flex-direction: rows; + margin-top: 15rpx; + width : 735rpx; + height : 80rpx; + background-color: #85C1E9; + border-style: solid; + border-width: 10rpx; + border-color: #3f72af; +} + +.user-show{ + width : 735rpx; + height : 450rpx; + background-color: #fcfcfc; + border-style: solid; + border-width: 10rpx; + border-color: #3f72af; + +} + +.passwd-show{ + display: flex; + flex-direction: rows; + margin-top: 25rpx; + width : 750rpx; + height : 70rpx; + background-color: #85C1E9; + font-size: 50rpx; + font-weight:bold; + border-style: solid; + border-width: 2rpx; + border-color: #3f72af; + font-family: 'Courier New', Courier, monospace; +} + +.icon-group{ + width:100%; + border-radius: 3px; + padding-top:2px; + font-size:14px; + color:red; + overflow:hidden; + height:45px; + bottom: 0; + position: fixed; + right: 0; +} + +.passwd-copy{ + position: fixed; + font-family: 'Courier New', Courier, monospace; + font-size:50rpx; + vertical-align: middle; + border-style: solid; + border-width: 1rpx; + border-radius: 15rpx; + width: 200rpx; + right: 0; + margin-top: 10rpx; +} + +.passwd-text{ + font-family: 'Courier New', Courier, monospace; + width: 100%; +} + +.icon-font{ + position: fixed; + left:233rpx; + bottom:0% +} \ No newline at end of file diff --git a/miniprogram/sitemap.json b/miniprogram/sitemap.json new file mode 100644 index 0000000..3a25ca0 --- /dev/null +++ b/miniprogram/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "密码记事本", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/miniprogram/style/guide.wxss b/miniprogram/style/guide.wxss new file mode 100644 index 0000000..5a77414 --- /dev/null +++ b/miniprogram/style/guide.wxss @@ -0,0 +1,144 @@ +page { + background: #f6f6f6; + display: flex; + flex-direction: column; + justify-content: flex-start; +} + +.list { + margin-top: 40rpx; + height: auto; + width: 100%; + background: #fff; + padding: 0 40rpx; + border: 1px solid rgba(0, 0, 0, 0.1); + border-left: none; + border-right: none; + transition: all 300ms ease; + display: flex; + flex-direction: column; + align-items: stretch; + box-sizing: border-box; +} + +.list-item { + width: 100%; + padding: 0; + line-height: 104rpx; + font-size: 34rpx; + color: #007aff; + border-top: 1px solid rgba(0, 0, 0, 0.1); + display: flex; + flex-direction: row; + align-content: center; + justify-content: space-between; + box-sizing: border-box; +} + +.list-item:first-child { + border-top: none; +} + +.list-item image { + max-width: 100%; + max-height: 20vh; + margin: 20rpx 0; +} + +.request-text { + color: #222; + padding: 20rpx 0; + font-size: 24rpx; + line-height: 36rpx; + word-break: break-all; +} + +.guide { + width: 100%; + padding: 40rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; +} + +.guide .headline { + font-size: 34rpx; + font-weight: bold; + color: #555; + line-height: 40rpx; +} + +.guide .p { + margin-top: 20rpx; + font-size: 28rpx; + line-height: 36rpx; + color: #666; +} + +.guide .code { + margin-top: 20rpx; + font-size: 28rpx; + line-height: 36rpx; + color: #666; + background: white; + white-space: pre; +} + +.guide .code-dark { + margin-top: 20rpx; + background: rgba(0, 0, 0, 0.8); + padding: 20rpx; + font-size: 28rpx; + line-height: 36rpx; + border-radius: 6rpx; + color: #fff; + white-space: pre +} + +.guide image { + max-width: 100%; +} + +.guide .image1 { + margin-top: 20rpx; + max-width: 100%; + width: 356px; + height: 47px; +} + +.guide .image2 { + margin-top: 20rpx; + width: 264px; + height: 100px; +} + +.guide .flat-image { + height: 100px; +} + +.guide .code-image { + max-width: 100%; +} + +.guide .copyBtn { + width: 180rpx; + font-size: 20rpx; + margin-top: 16rpx; + margin-left: 0; +} + +.guide .nav { + margin-top: 50rpx; + display: flex; + flex-direction: row; + align-content: space-between; +} + +.guide .nav .prev { + margin-left: unset; +} + +.guide .nav .next { + margin-right: unset; +} + diff --git a/miniprogram/until/until.js b/miniprogram/until/until.js new file mode 100644 index 0000000..8af6b8b --- /dev/null +++ b/miniprogram/until/until.js @@ -0,0 +1,19 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':') +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : '0' + n +} + +module.exports = { + formatTime: formatTime +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..91777f6 --- /dev/null +++ b/project.config.json @@ -0,0 +1,46 @@ +{ + "miniprogramRoot": "miniprogram/", + "cloudfunctionRoot": "cloudfunctions/", + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "autoAudits": false, + "uglifyFileName": true + }, + "appid": "wx252ae6ca7d168bf5", + "projectname": "%E5%AF%86%E7%A0%81%E8%AE%B0%E4%BA%8B%E6%9C%AC", + "libVersion": "2.2.5", + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "cloudfunctionTemplateRoot": "cloudfunctionTemplate", + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "plugin": { + "current": -1, + "list": [] + }, + "game": { + "list": [] + }, + "miniprogram": { + "current": 0, + "list": [ + { + "id": -1, + "name": "db guide", + "pathName": "pages/databaseGuide/databaseGuide" + } + ] + } + } +} \ No newline at end of file