diff --git a/app.js b/app.js index a2ec264..60dea10 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,7 @@ App({ + data : { + is_admin : false, + }, onLaunch() { }, diff --git a/app.json b/app.json index 6361f55..4ecb683 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "pages": [ "pages/index/index", "pages/test/index", - "pages/logs/index" + "pages/admin/admin" ], "window": { "navigationBarTextStyle": "black", @@ -16,24 +16,24 @@ "color": "#7F8389", "selectedColor": "#0097E6", "backgroundColor": "#FFFFFF", - "list": [ - { - "pagePath": "pages/test/index", - "iconPath": "images/tabbar/icon-testing.png", - "selectedIconPath": "images/tabbar/icon-testing-selected.png", - "text": "测试" - }, + "list": [ { "pagePath": "pages/index/index", "iconPath": "images/tabbar/icon-home.png", "selectedIconPath": "images/tabbar/icon-home-selected.png", - "text": "首页" + "text": "提交订单" }, { - "pagePath": "pages/logs/index", + "pagePath": "pages/admin/admin", + "iconPath": "images/tabbar/icon-admin.png", + "selectedIconPath": "images/tabbar/icon-admin-selected.png", + "text":"审核与发布" + }, + { + "pagePath": "pages/test/index", "iconPath": "images/tabbar/icon-log.png", "selectedIconPath": "images/tabbar/icon-log-selected.png", - "text": "日志" + "text": "相关与反馈" } ] }, @@ -48,5 +48,7 @@ "123456", "34356576", "457658769" - ] + ], + "usingComponents": { + } } \ No newline at end of file diff --git a/app.qss b/app.qss index e69de29..7796809 100644 --- a/app.qss +++ b/app.qss @@ -0,0 +1,9 @@ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 10rpx 0; + box-sizing: border-box; +} diff --git a/cloudfunctions/getOpenid/index.js b/cloudfunctions/getOpenid/index.js new file mode 100644 index 0000000..2314739 --- /dev/null +++ b/cloudfunctions/getOpenid/index.js @@ -0,0 +1,22 @@ +// 云函数入口文件 +const cloud = require('qq-server-sdk'); +cloud.init({ + env: cloud.DYNAMIC_CURRENT_ENV +}) + +// 云函数入口函数 +exports.main = async (event, context) => { + + const { + OPENID, + APPID, + ENV + } = await cloud.getQQContext() + + return { + event, + openid : OPENID, + appid : APPID, + env : cloud.DYNAMIC_CURRENT_ENV + } +} diff --git a/cloudfunctions/getOpenid/package.json b/cloudfunctions/getOpenid/package.json new file mode 100644 index 0000000..348a0fb --- /dev/null +++ b/cloudfunctions/getOpenid/package.json @@ -0,0 +1,14 @@ +{ + "name": "getOpenid", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "qq-server-sdk": "latest" + } +} diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js new file mode 100644 index 0000000..9cb9ff3 --- /dev/null +++ b/custom-tab-bar/index.js @@ -0,0 +1,32 @@ +Component({ + data: { + selected : 0, + color: "#7F8389", + selectedColor: "#0097E6", + backgroundColor: "#FFFFFF", + list : [ { + "pagePath": "/pages/index/index", + "iconPath": "/images/tabbar/icon-home.png", + "selectedIconPath": "/images/tabbar/icon-home-selected.png", + "text": "提交订单" + }, + { + "pagePath": "/pages/test/index", + "iconPath": "/images/tabbar/icon-log.png", + "selectedIconPath": "/images/tabbar/icon-log-selected.png", + "text": "相关与反馈" + }] + }, + attached() { + }, + methods: { + switchTab(e) { + const data = e.currentTarget.dataset + const url = data.path + wx.switchTab({url}) + this.setData({ + selected: data.index + }) + } + }, +}); diff --git a/custom-tab-bar/index.json b/custom-tab-bar/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/custom-tab-bar/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/custom-tab-bar/index.qml b/custom-tab-bar/index.qml new file mode 100644 index 0000000..e69de29 diff --git a/custom-tab-bar/index.qss b/custom-tab-bar/index.qss new file mode 100644 index 0000000..704d1a3 --- /dev/null +++ b/custom-tab-bar/index.qss @@ -0,0 +1,38 @@ +.tab-bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 48px; + background: white; + display: flex; + padding-bottom: env(safe-area-inset-bottom); +} + +.tab-bar-border { + background-color: rgba(0, 0, 0, 0.33); + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + transform: scaleY(0.5); +} + +.tab-bar-item { + flex: 1; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.tab-bar-item cover-image { + width: 27px; + height: 27px; +} + +.tab-bar-item cover-view { + font-size: 10px; +} diff --git a/images/pages/index/Unselected.png b/images/pages/index/Unselected.png new file mode 100644 index 0000000..799f5c5 Binary files /dev/null and b/images/pages/index/Unselected.png differ diff --git a/images/pages/index/default-avatar.png b/images/pages/index/default-avatar.png new file mode 100644 index 0000000..42cd544 Binary files /dev/null and b/images/pages/index/default-avatar.png differ diff --git a/images/pages/index/selected.png b/images/pages/index/selected.png new file mode 100644 index 0000000..1c65a00 Binary files /dev/null and b/images/pages/index/selected.png differ diff --git a/images/tabbar/icon-admin-selected.png b/images/tabbar/icon-admin-selected.png new file mode 100644 index 0000000..140235e Binary files /dev/null and b/images/tabbar/icon-admin-selected.png differ diff --git a/images/tabbar/icon-admin.png b/images/tabbar/icon-admin.png new file mode 100644 index 0000000..5ee463d Binary files /dev/null and b/images/tabbar/icon-admin.png differ diff --git a/pages/admin-common/index.qss b/pages/admin-common/index.qss new file mode 100644 index 0000000..6239cc0 --- /dev/null +++ b/pages/admin-common/index.qss @@ -0,0 +1,242 @@ +.index-hd { + padding: 64rpx 80rpx; + width: 100%; + margin: 20rpx 0; + text-align: center; + background: #ffffff; +} + +.index-bd { +} + +.index-ft { + padding-bottom: 20rpx; + text-align: center; +} + +.index-logo { + width: 88rpx; + height: 88rpx; +} + +.index-desc { + margin-top: 40rpx; + color: #878B99; + line-height: 1.5; + font-size: 28rpx; + letter-spacing: 0; + text-align: center; +} + +navigator { + display: inline-block; +} + +.index-navigator { + display: inline-block; + font-size: 28rpx; + color: #4D94FF; +} + + +.list-wrap { + margin-bottom: 24rpx; +} + +.list-wrap__group { + background-color: #FFF; +} + +.list-wrap__group_expand { +} + +.list-wrap__group_expand .list-wrap__group-bd { + display: block; +} + +.list-wrap__group_expand .list-wrap__group-title::after { + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMThweCIgaGVpZ2h0PSIxOHB4IiB2aWV3Qm94PSIwIDAgMTggMTgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjIgKDc4MTgxKSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7kuIvmi4nop5LmoIdf5LiL5ouJPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGcgaWQ9Iue7hOS7tiIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IuS4i+aLieinkuagh1/kuIvmi4kiIGZpbGw9IiNCMEIzQkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMTUuMDcxMjIxNCwxMS4yMTQ1NTcgTDUuMTM3MzE2OCwxNy42NzIxMDY0IEM0LjE5NDY4NTY4LDE4LjI4NDg2NTIgMi45MzYwNzk5LDE4LjAxMzkxNjUgMi4zMjYxNDIxMiwxNy4wNjY5MjU3IEMyLjExMzI1ODQ1LDE2LjczNjQwMjEgMiwxNi4zNTExMDk5IDIsMTUuOTU3NDI3OSBMMiwzLjA0MjMyOTA4IEMyLDEuOTE0MzgxODcgMi45MTAxNzIzMSwxIDQuMDMyOTI2NzUsMSBDNC40MjQ3OTYzNiwxIDQuODA4MzE0NzgsMS4xMTM3ODIyOCA1LjEzNzMxNjgsMS4zMjc2NTA1MyBMMTUuMDcxMjIxNCw3Ljc4NTE5OTkyIEMxNi4wMTM4NTI1LDguMzk3OTU4NjggMTYuMjgzNTUzNyw5LjY2MjM4NTU0IDE1LjY3MzYxNTksMTAuNjA5Mzc2MyBDMTUuNTE3NjE2NiwxMC44NTE1ODEyIDE1LjMxMjMxMTIsMTEuMDU3ODM2MiAxNS4wNzEyMjE0LDExLjIxNDU1NyBaIiBpZD0iVHJpYW5nbGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDkuMDAwMDAwLCA5LjUwMDAwMCkgcm90YXRlKC0yNzAuMDAwMDAwKSB0cmFuc2xhdGUoLTkuMDAwMDAwLCAtOS41MDAwMDApICI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+'); +} + +.list-wrap__group_collapse { +} + +.list-wrap__group_collapse .list-wrap__group-bd { + display: none; +} + +.list-wrap__group_collapse .list-wrap__group-title::after { + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMThweCIgaGVpZ2h0PSIxOHB4IiB2aWV3Qm94PSIwIDAgMTggMTgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDU1LjIgKDc4MTgxKSAtIGh0dHBzOi8vc2tldGNoYXBwLmNvbSAtLT4KICAgIDx0aXRsZT7kuIvmi4nop5LmoIdf6buY6K6kPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGcgaWQ9Iue7hOS7tiIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IuS4i+aLieinkuagh1/pu5jorqQiIGZpbGw9IiNCMEIzQkYiPgogICAgICAgICAgICA8ZyBpZD0i5LiL5ouJ6KeS5qCHIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjAwMDAwMCwgMS4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMy4wNzEyMjE0LDEwLjIxNDU1NyBMMy4xMzczMTY4LDE2LjY3MjEwNjQgQzIuMTk0Njg1NjgsMTcuMjg0ODY1MiAwLjkzNjA3OTkwNCwxNy4wMTM5MTY1IDAuMzI2MTQyMTE5LDE2LjA2NjkyNTcgQzAuMTEzMjU4NDUzLDE1LjczNjQwMjEgMCwxNS4zNTExMDk5IDAsMTQuOTU3NDI3OSBMMCwyLjA0MjMyOTA4IEMwLDAuOTE0MzgxODczIDAuOTEwMTcyMzA4LDAgMi4wMzI5MjY3NSwwIEMyLjQyNDc5NjM2LDAgMi44MDgzMTQ3OCwwLjExMzc4MjI3NiAzLjEzNzMxNjgsMC4zMjc2NTA1MzMgTDEzLjA3MTIyMTQsNi43ODUxOTk5MiBDMTQuMDEzODUyNSw3LjM5Nzk1ODY4IDE0LjI4MzU1MzcsOC42NjIzODU1NCAxMy42NzM2MTU5LDkuNjA5Mzc2MzUgQzEzLjUxNzYxNjYsOS44NTE1ODEyMiAxMy4zMTIzMTEyLDEwLjA1NzgzNjIgMTMuMDcxMjIxNCwxMC4yMTQ1NTcgWiIgaWQ9IlRyaWFuZ2xlIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=='); +} + +.list-wrap__group-hd { + position: relative; + z-index: 1; + + padding: 34rpx 32rpx; +} + +.list-wrap__group-hd::after { + content: ""; + display: block; + position: absolute; + left: 32rpx; + right: 0; + bottom: 0; + z-index: 8; + height: 1px; + background-color: #EBEDF5; +} + +.list-wrap__group-title { + display: block; + position: relative; + z-index: 1; + line-height: 1.3; + padding-left: 34rpx; + font-size: 34rpx; + color: #03081A; +} + +.list-wrap__group-title::after { + content: ""; + display: block; + position: absolute; + top: 50%; + left: 0; + z-index: 8; + width: 18rpx; + height: 18rpx; + transform: translateY(-50%); + background-size: cover; +} + +.list-wrap__group-icon { + display: block; + border-radius: 26rpx; + position: absolute; + top: 50%; + right: 32rpx; + z-index: 12; + width: 56rpx; + height: 56rpx; + transform: translateY(-50%); +} + +.list-wrap__group-bd { +} + +.list-wrap__item { + display: flex; + align-items: center; + padding: 34rpx 32rpx; + + position: relative; + z-index: 1; +} + +.list-wrap__item::after { + content: ""; + display: block; + position: absolute; + left: 32rpx; + right: 0; + bottom: 0; + z-index: 8; + height: 1px; + background-color: #EBEDF5; +} + +.list-wrap__item-bd { + flex: 1; +} + +.list-wrap__txt-title { + padding-left: 34rpx; + line-height: 1.3; + font-size: 34rpx; + color: #03081A; +} + +.list-wrap__group-icon-more { + display: block; + position: absolute; + top: 50%; + right: 24rpx; + z-index: 12; + width: 32rpx; + height: 32rpx; + transform: translateY(-50%); +} + +.list-wrap__item-ft { +} + +.list-wrap__group-ft { +} + +.list-wrap__group_video { +} + +.list-wrap__group_video .list-wrap__group-title::after { + display: none; +} + +.list-wrap__group_video .list-wrap__group-tips { + padding: 12rpx 32rpx 24rpx 62rpx; + background-color: #F5F6FA; +} + +.list-wrap__group_video .list-wrap__group-txt-tips { + display: inline-block; + line-height: 1.3; + font-size: 28rpx; + color: #878B99; +} + + +@media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx), (-ms-high-contrast: active), (-ms-high-contrast: none) { + + /*下边框*/ + .list-wrap__item::after, + .list-wrap__group-hd::after { + -webkit-transform: scaleY(.5); + transform: scaleY(.5); + } + + /*下边框*/ + .list-wrap__item::after, + .list-wrap__group-hd::after { + -webkit-transform-origin: 100% 100%; + transform-origin: 100% 100%; + } +} + +/* 解决1.5屏幕下某些边框不显式问题 */ +@media (-webkit-device-pixel-ratio: 1.5) { + /*下边框*/ + .list-wrap__item::after, + .list-wrap__group-hd::after { + -webkit-transform: scaleY(.66666666); + transform: scaleY(.66666666); + } +} + +@media (-webkit-device-pixel-ratio: 3) { + /*下边框*/ + .list-wrap__item::after, + .list-wrap__group-hd::after { + -webkit-transform: scaleY(.3333); + transform: scaleY(.3333); + } +} + +.navigator { + margin: 0 auto; + padding: 0 32%; + color: #4D94FF; +} + +.superpowerText { + padding-left: 0; +} \ No newline at end of file diff --git a/pages/admin-common/lib/qui.qss b/pages/admin-common/lib/qui.qss new file mode 100644 index 0000000..3a63c04 --- /dev/null +++ b/pages/admin-common/lib/qui.qss @@ -0,0 +1,185 @@ +/** qui.qss **/ +page { +} + +view, text { + line-height: 1; +} + +.qui-row { + display: flex; + flex-direction: row; + flex-wrap: wrap; +} + +.qui-row__item { + flex: 1; +} + +.qui-row__item { +} + +.qui-col { + display: flex; + flex-direction: column; + /* flex-wrap:wrap; */ +} + +.qui-col__item { +} + + +.qui-flex { + display: flex; + /* flex-wrap:wrap; */ +} + +.qui-flex__item { + flex: 1; +} + + +.qui-cell-group { +} + +.qui-cell-group + .qui-cell-group { + margin-top: 20rpx; +} + +.qui-cell-group__hd { + position: relative; + z-index: 1; +} + +.qui-cell-group__txt-title { + display: inline-block; + padding: 32rpx 32rpx 8rpx 32rpx; + line-height: 1.5; + font-size: 28rpx; + color: #878B99; +} + +.qui-cell-group__bd { +} + +.qui-cell { + display: flex; + align-items: center; + position: relative; + z-index: 1; + padding: 0 32rpx; + min-height: 112rpx; + background-color: #FFF; + box-sizing: border-box; +} + +.qui-cell::after { + content: ""; + display: block; + position: absolute; + left: 32rpx; + right: 0; + bottom: 0; + z-index: 8; + height: 1px; + background-color: #EBEDF5; +} + +.qui-cell:nth-last-of-type(1)::after { + display: none; +} + +.qui-cell__txt-tips { + display: inline-block; + padding: 12rpx 32rpx 0 32rpx; + line-height: 1.5; + font-size: 28rpx; + color: #878B99; +} + +.qui-cell_input { + /* padding:28rpx 32rpx; + align-items:center; */ +} + +.qui-cell_input .qui-input { + padding-left: 48rpx; +} + +.qui-cell__hd { +} + +.qui-cell__txt-label { + display: inline-block; + line-height: 1.3; + font-size: 34rpx; + color: #03081A; +} + +.qui-cell__bd { + flex: 1; +} + +.qui-cell__txt { + display: inline-block; + line-height: 1.3; + font-size: 34rpx; + color: #03081A; +} + +.qui-cell__ft { +} + + +@media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx), (-ms-high-contrast: active), (-ms-high-contrast: none) { + + /*下边框*/ + .qui-cell::after { + -webkit-transform: scaleY(.5); + transform: scaleY(.5); + } + + /*下边框*/ + .qui-cell::after { + -webkit-transform-origin: 100% 100%; + transform-origin: 100% 100%; + } +} + +@media (-webkit-device-pixel-ratio: 1.5) { + /*下边框*/ + .qui-cell::after { + -webkit-transform: scaleY(.66666666); + transform: scaleY(.66666666); + } +} + +@media (-webkit-device-pixel-ratio: 3) { + /*下边框*/ + .qui-cell::after { + -webkit-transform: scaleY(.3333); + transform: scaleY(.3333); + } +} + + +.qui-input { + position: relative; + z-index: 1; +} + +.qui-input__txt-input { + display: inline-block; + line-height: 1.3; + width: 100%; + font-size: 34rpx; + color: #03081A; + background-color: #FFF; +} + +.qui-input__txt-placeholder { + display: inline-block; + line-height: 1.3; + font-size: 34rpx; + color: #B0B3BF; +} \ No newline at end of file diff --git a/pages/admin/admin.js b/pages/admin/admin.js new file mode 100644 index 0000000..8c4cf65 --- /dev/null +++ b/pages/admin/admin.js @@ -0,0 +1,370 @@ +//index.js +//获取应用实例 +const app = getApp() + +Page({ + data: { + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: qq.canIUse('button.open-type.getUserInfo'), + pictureNums : 0, + tmp_img: "", + convert_img : [], + datalist: [], + base64str : " ", + readytosend : new Array(100).fill(false), + readyPictures : new Array(100).fill(" "), + rowscount : new Array(10).fill(0), + // chooseornot : [ + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false], + // [false,false,false,false,false,false,false,false,false,false] + // ] + chooseornot : [] + }, + loadDataBase : function () { + const db = qq.cloud.database(); + let getDatabase = async () => { + return await db.collection('postwall').where({ + post_done: false + }).get().then(res => { + this.setData({ + datalist: res.data.slice(0, 9) + }) + console.log("datalist:", this.data.datalist) + tmp_list = this.data.datalist + for (var i = 0; i < this.data.datalist.length; i++) { + tmp_list[i].open = false + } + this.setData({ + datalist: tmp_list + }) + }).then(res => console.log(this.data.datalist)) + } + getDatabase() + .then(async res => { + const that = this + const str = this.data.base64str + console.log("test datalist:", this.data.datalist.length) + for (let i = 0; i < this.data.datalist.length; i++) { + await qq.request({ + url: "https://www.zzsqwq.cn:5000/image", + method : "POST", + data: this.data.datalist[i], + header: { + 'content-type': 'application/json' // 默认值 + }, + success(res) { + let userImageBase64 = 'data:image/png;base64,' + res.data + userImageBase64 = userImageBase64.replace(/[\r\n]/g, '') + let imageList = that.data.datalist[i].image_list + var imgPath = qq.env.USER_DATA_PATH + '/index' + '/' + that.data.datalist[i]._id + '.png'; + var fs = qq.getFileSystemManager(); + fs.writeFileSync(imgPath, res.data, "base64"); + imageList.unshift(imgPath) + that.setData({ + base64str : userImageBase64 + }) + that.data.readyPictures[i*10] = imgPath; + for(let j=1;j { + console.log("test tempfile", res.tempFilePath) + that.data.readyPictures[i*10+j] = res.tempFilePath; + }).catch(res => { + console.error("download file error!",res) + }) + } + } + }) + } + } + ).then(res => { + qq.showToast({ + title: '加载完成', + icon: 'success', + duration: 1000 + }) + }) + }, + //事件处理函数 + // bindViewTap: function () { + // qq.navigateTo({ + // url: '../logs/logs' + // }) + // }, + onLoad: function () { + // init chooseornot + a = this.data.chooseornot + for(var i=0;i<10;i++) { + var b = [] + for(var j=0;j<10;j++) { + b[j] = false + } + a[i] = b + } + this.setData({ + chooseornot : a + }) + + console.log(this.data.chooseornot) + qq.cloud.init({ + env: 'postwall-4gy7eykl559a475a', + traceUser: true + }) + this.loadDataBase() + // .then( res => { + // for(let i = 0; i < this.data.datalist.length; i++) { + // for(let j=1;j { + // console.log("test tempfile", res.tempFilePath) + // this.data.readyPictures[i*10+j] = res.tempFilePath; + // }).catch(res => { + // console.error("download file error!") + // }) + // } + // } + // }) + if (app.globalData.userInfo) { + this.setData({ + userInfo: app.globalData.userInfo, + hasUserInfo: true + }) + } else if (this.data.canIUse) { + // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + app.userInfoReadyCallback = res => { + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + } else { + // 在没有 open-type=getUserInfo 版本的兼容处理 + qq.getUserInfo({ + success: res => { + app.globalData.userInfo = res.userInfo + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + } + }, + onPullDownRefresh(options) { + console.log("test refresh") + this.loadDataBase() + qq.stopPullDownRefresh({ + success: res => { + qq.showToast({ + title: '刷新成功', + icon: 'success', + duration: 1000 + }) + } + }) + }, + onReady(options) { + console.log("test pictureNums:", this.data.pictureNums) + }, + getUserInfo: function (e) { + console.log(e) + app.globalData.userInfo = e.detail.userInfo + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + }, + previewAvatar(e) { + const current = e.target.dataset.src + userinfo = app.globalData.userInfo + console.log(e) + qq.previewImage({ + current: userinfo.avatarUrl, + urls: [userinfo.avatarUrl] + }) + }, + previewImg(e) { + const img_id = e.target.dataset.id; + const img_index = e.target.dataset.index; + console.log(e); + qq.previewImage({ + urls : [this.data.datalist[img_id].image_list[img_index]] + }) + }, + kindToggle(e) { + //console.log(e.currentTarget) + //console.log("test pictureNums:", this.data.pictureNums) + //this.convertAllCanvas() + const id = e.currentTarget.id + const list = this.data.datalist + for (let i = 0, len = list.length; i < len; ++i) { + if (list[i]._id === id) { + list[i].open = !list[i].open + } else { + list[i].open = false + } + } + this.setData({ + datalist: list + }) + // qq.reportAnalytics('click_view_programmatically', {}) + }, + selectImg(e) { + const index = parseInt(e.currentTarget.dataset.item) + const id = parseInt(e.currentTarget.id) + this_data = this.data.chooseornot + console.log("index", index) + console.log("id", id) + console.log("index+id", index*10+id) + this_data[index][id] = !this_data[index][id] + if(this_data[index][id] == true) { + this.data.readytosend[index*10+id] = true; + }else { + this.data.readytosend[index*10+id] = false; + } + console.log(this.data.readytosend) + this.setData({ + chooseornot : this_data + }) + }, + toQzone() { + medias = [] + now_index = 1 + next_index = 0 + post_detail = "" + for(var i=0;i<100;i++) { + if(this.data.readytosend[i] == true) { + medias.push({ + type : 'photo', + path : this.data.readyPictures[i] + }) + index = parseInt(i/10) + this.data.rowscount[index]++; + console.log(index,this.data.rowscount[index]) + } + } + for(var i=0;i<10;i++) { + console.log(this.data.rowscount[i]) + if(this.data.rowscount[i]!=0) { + next_index = now_index + this.data.rowscount[i] - 1; + post_detail += "P" + now_index + "-" + next_index + ":[" + this.data.datalist[i].post_type + "]" + this.data.datalist[i].post_title + "\n" + now_index = next_index + 1 + } + } + console.log(medias) + qq.openQzonePublish({ + footnote: '自助贴贴墙', + path: 'pages/index/index', + text: post_detail, + media: medias + }) + }, + + /** + * 显示删除按钮 + */ + showDeleteButton: function (e) { + let productIndex = e.currentTarget.dataset.productindex + this.setXmove(productIndex, -65) + }, + + /** + * 隐藏删除按钮 + */ + hideDeleteButton: function (e) { + let productIndex = e.currentTarget.dataset.productindex + + this.setXmove(productIndex, 0) + }, + + /** + * 设置movable-view位移 + */ + setXmove: function (productIndex, xmove) { + let productList = this.data.datalist + productList[productIndex].xmove = xmove + + this.setData({ + datalist: productList + }) + }, + + /** + * 处理movable-view移动事件 + */ + handleMovableChange: function (e) { + if (e.detail.source === 'friction') { + if (e.detail.x < -30) { + this.showDeleteButton(e) + } else { + this.hideDeleteButton(e) + } + } else if (e.detail.source === 'out-of-bounds' && e.detail.x === 0) { + this.hideDeleteButton(e) + } + }, + + /** + * 处理touchstart事件 + */ + handleTouchStart(e) { + this.startX = e.touches[0].pageX + }, + + /** + * 处理touchend事件 + */ + handleTouchEnd(e) { + if(e.changedTouches[0].pageX < this.startX && e.changedTouches[0].pageX - this.startX <= -30) { + this.showDeleteButton(e) + } else if(e.changedTouches[0].pageX > this.startX && e.changedTouches[0].pageX - this.startX < 30) { + this.showDeleteButton(e) + } else { + this.hideDeleteButton(e) + } + }, + + /** + * 删除产品 + */ + handleDeleteProduct: function ({ currentTarget: { dataset: { id } } }) { + let productList = this.data.datalist + let productIndex = productList.findIndex(item => item.id === id) + + productList.splice(productIndex, 1) + + this.setData({ + datalist : productList + }) + if (productList[productIndex]) { + this.setXmove(productIndex, 0) + } + }, + + /** + * slide-delete 删除产品 + */ + handleSlideDelete({ detail: { id } }) { + let slideProductList = this.data.slideProductList + let productIndex = slideProductList.findIndex(item => item.id === id) + + slideProductList.splice(productIndex, 1) + + this.setData({ + slideProductList + }) + } + +}) diff --git a/pages/admin/admin.json b/pages/admin/admin.json new file mode 100644 index 0000000..b55b5a2 --- /dev/null +++ b/pages/admin/admin.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/pages/admin/admin.qml b/pages/admin/admin.qml new file mode 100644 index 0000000..193060f --- /dev/null +++ b/pages/admin/admin.qml @@ -0,0 +1,73 @@ + + + + + + + + + + + {{userInfo.nickName}} + + + 审核指南及墙机守则,请务必严格遵守! + + + + + + + {{"[" + item.post_type + "]" + item.post_title}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/admin/admin.qss b/pages/admin/admin.qss new file mode 100644 index 0000000..3a84a46 --- /dev/null +++ b/pages/admin/admin.qss @@ -0,0 +1,83 @@ +@import "../admin-common/lib/qui.qss"; +@import "../admin-common/index.qss"; + +page { + background-color: #F5F6FA !important; +} + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; +} + +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 10rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; + margin: 25rpx auto 25rpx auto; +} + +.default-nickname { + color: #aaa; +} + +.usermotto { + margin-top: 200px; +} + +.logo-class { + width: 260rpx; + height: 260rpx; +} + +.text-class { + font-size: 50rpx; +} + +.test-class { + position: absolute; + margin: 0 0 0 -46rpx; + display: inline-block; + width: 50rpx; + height: 50rpx; +} + +.canvas-class { + display: block; +} + +.result-photo-class { + display: inline-block; + margin: 0 auto; + width: 70%; + background-color: lightgray; + max-width: 600rpx; + height: 650rpx; +} + +.image-block { + display: block; + width: 100%; +} + +.imgList{ + width:100%; + height: 650rpx; +} +.imgList .img{ + /*max-width: 700rpx;*/ + max-width: 600rpx; + height: 650rpx; +} + +.test-img { + height: 650rpx; + width:650rpx; + display:block; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 1cfb2dc..8ebbcab 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -11,13 +11,71 @@ Page({ post_text_value : "", contact_qq_value : "", contact_wechat_value : "", - contact_tel_value : "" + contact_tel_value : "", + adminer_list : [], + admin_barlist : [ + { + "pagePath": "/pages/index/index", + "iconPath": "/images/tabbar/icon-home.png", + "selectedIconPath": "/images/tabbar/icon-home-selected.png", + "text": "提交订单" + }, + { + "pagePath": "/pages/admin/admin", + "iconPath": "/images/tabbar/icon-admin.png", + "selectedIconPath": "/images/tabbar/icon-admin-selected.png", + "text":"审核与发布" + }, + { + "pagePath": "/pages/logs/index", + "iconPath": "/images/tabbar/icon-log.png", + "selectedIconPath": "/images/tabbar/icon-log-selected.png", + "text": "相关与反馈" + } + ] + }, + setAdminBar() { + console.log(typeof this.getTabBar === 'function') + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + console.log("function!") + this.getTabBar().setData({ + list : this.data.admin_barlist, + }) + console.log(this.getTabBar().data) + } + }, + checkAdmin() { + const db = qq.cloud.database(); + const that = this + db.collection("adminList").get().then( res => { + let adminList = res.data; + console.log("adminList",adminList) + qq.cloud.callFunction({ + name : 'getOpenid', + data: { + a : 1 // 此处填入了某种方式获取得到的 Buffer 数据,可以是 request 下来的,可以是读文件读出来的等等 + }, + }).then( res => { + now_openid = res.result.openid; + console.log(now_openid) + for(var i=0;i