diff --git a/changelog.md b/changelog.md index a2ed193..87b4b9e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## v0.16.9 + * A 管理界面浏览历史查看 + * A 使用一些功能时登录校验 + ## v0.16.8 * A 支持填入微信个人信息 * F 使用用户名登录时账号判断错误而无法登录 diff --git a/miniprogram/admin/pages/page_history/history-item/history-item.js b/miniprogram/admin/pages/page_history/history-item/history-item.js new file mode 100644 index 0000000..4df6cd7 --- /dev/null +++ b/miniprogram/admin/pages/page_history/history-item/history-item.js @@ -0,0 +1,30 @@ + +Component({ + properties: { + data:Object + }, + + data: { + + }, + + methods: { + onTapBody(){ + let {options, page} = this.data.data; + let query = Object.keys(options).map(i=>`${i}=${options[i]}`).join("&"); + let url = "/"+page + "?" + query; + console.log(url) + wx.navigateTo({ + url + }) + }, + onTapKey(e){ + let {currentTarget:{dataset:{key}}} = e; + console.log(e); + let data = this.data.data[key]; + let detail = {[key]: data}; + console.log(detail); + this.triggerEvent("condition", detail, {bubbles: true}); + } + } +}) diff --git a/miniprogram/admin/pages/page_history/history-item/history-item.json b/miniprogram/admin/pages/page_history/history-item/history-item.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/admin/pages/page_history/history-item/history-item.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/admin/pages/page_history/history-item/history-item.wxml b/miniprogram/admin/pages/page_history/history-item/history-item.wxml new file mode 100644 index 0000000..b13a660 --- /dev/null +++ b/miniprogram/admin/pages/page_history/history-item/history-item.wxml @@ -0,0 +1,16 @@ + + + + {{data.time_show}} {{data.isCrawl?'爬虫访问':""}} + + + {{data.page_show}} + {{data.options_show}} + + + {{data.scene}} {{data.sceneDesc}} + + + {{data.openid}} + + \ No newline at end of file diff --git a/miniprogram/admin/pages/page_history/history-item/history-item.wxss b/miniprogram/admin/pages/page_history/history-item/history-item.wxss new file mode 100644 index 0000000..587a28c --- /dev/null +++ b/miniprogram/admin/pages/page_history/history-item/history-item.wxss @@ -0,0 +1,19 @@ + +.history{ + background: white; + padding: 12px; + border-radius: 8px; +} +.history.crawl{ + border: 2px green solid; +} +.header, +.detail{ + color: dimgray; + font-size: 12px; +} +.single-line{ + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} diff --git a/miniprogram/admin/pages/page_history/page_history.js b/miniprogram/admin/pages/page_history/page_history.js index 1bcad23..7c69852 100644 --- a/miniprogram/admin/pages/page_history/page_history.js +++ b/miniprogram/admin/pages/page_history/page_history.js @@ -49,7 +49,17 @@ Page({ let {page,limit} = this.options; let skip = (page-1)*limit; console.log(skip, limit); - let res = await pageHistoryCollection.orderBy("time", "desc").skip(skip).limit(limit).get(); + let query = pageHistoryCollection; + if(this.data.conditions){ + query = query.where(this.data.conditions); + } + if(refresh){ + query.count().then(res=>{ + console.log(res); + this.setData({total: res.total}); + }) + } + let res = await query.orderBy("time", "desc").skip(skip).limit(limit).get(); let data = res.data.map(i=>{ i.time_show = getFormatDatetime(i.time); i.options_show = JSON.stringify(i.options); @@ -77,6 +87,31 @@ Page({ }) }) }, + onConditionChange(e){ + let {detail} = e; + console.log(e); + console.log(detail); + let conditions = {...this.data.conditions, ...detail}; + this.setData({conditions}); + this.refresh({refresh:1}) + .then(res=>{ + wx.showToast({ + title:"筛选成功" + }) + }) + }, + deleteCondition(e){ + console.log(e); + let {currentTarget:{dataset:{key}}} = e; + let conditions = this.data.conditions; + delete conditions[key]; + this.setData({conditions}); + this.refresh({refresh:1}).then(res=>{ + wx.showToast({ + title: '去除成功' + }) + }) + }, onReady: function () { }, @@ -94,6 +129,7 @@ Page({ }, onPullDownRefresh: function () { + this.conditions = null; this.refresh({refresh:1}); }, diff --git a/miniprogram/admin/pages/page_history/page_history.json b/miniprogram/admin/pages/page_history/page_history.json index 09f295e..7de6c0d 100644 --- a/miniprogram/admin/pages/page_history/page_history.json +++ b/miniprogram/admin/pages/page_history/page_history.json @@ -1,5 +1,7 @@ { - "usingComponents": {}, + "usingComponents": { + "history-item":"./history-item/history-item" + }, "enablePullDownRefresh": true, "onReachBottomDistance": 260, "navigationBarTitleText": "访问记录" diff --git a/miniprogram/admin/pages/page_history/page_history.wxml b/miniprogram/admin/pages/page_history/page_history.wxml index 9ae9cb6..a29bd80 100644 --- a/miniprogram/admin/pages/page_history/page_history.wxml +++ b/miniprogram/admin/pages/page_history/page_history.wxml @@ -1,21 +1,15 @@ - - - - {{item.time_show}} {{item.isCrawl?'爬虫访问':""}} - - - {{item.page_show}} - {{item.options_show}} - - - {{item.scene}} {{item.sceneDesc}} - - - {{item.openid}} + + + {{index}} + + + + - - + + + \ No newline at end of file diff --git a/miniprogram/admin/pages/page_history/page_history.wxss b/miniprogram/admin/pages/page_history/page_history.wxss index 6bd3f66..1c3fbbd 100644 --- a/miniprogram/admin/pages/page_history/page_history.wxss +++ b/miniprogram/admin/pages/page_history/page_history.wxss @@ -1,31 +1,31 @@ -page{ - height: 100%; -} -.list{ - min-height: 100vh; -} -.history{ + +.top-sticky{ + position: sticky; + top: 0; + overflow-x: scroll; background: white; - padding: 12px; - margin: 10px; - border-radius: 8px; -} -.history.crawl{ - border: 2px green solid; } -.header, -.detail{ - color: dimgray; +.top-sticky>.item{ + margin: 4px; + padding: 4px 8px; + background: #00b0f0; + color: white; font-size: 12px; + border-radius: 50px; +} +.list{ + padding-bottom: 40px; +} +.history-item-wrp{ + margin-bottom: 10px } .footer{ display: flex; + bottom: 0; + position: fixed; } .footer>button{ flex: 1; border-radius: 0; } -.sticky{ - bottom: 0; - position: sticky; -} \ No newline at end of file + diff --git a/miniprogram/app.js b/miniprogram/app.js index 5483d1e..71da813 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -170,7 +170,7 @@ App({ content, success:res=>{ if(res.confirm) - app.navigateTo({url:"{account}"}) + this.navigateTo({url:"{account}"}) } }) } diff --git a/miniprogram/config.js b/miniprogram/config.js index ed5ea25..a7a45b6 100644 --- a/miniprogram/config.js +++ b/miniprogram/config.js @@ -1,6 +1,6 @@ const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; -let _version = "0.16.8"; +let _version = "0.16.9"; /** */ let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync(); diff --git a/miniprogram/pages/main/my_course/course-item/course-item.wxss b/miniprogram/pages/main/my_course/course-item/course-item.wxss index 3b389d7..05206b1 100644 --- a/miniprogram/pages/main/my_course/course-item/course-item.wxss +++ b/miniprogram/pages/main/my_course/course-item/course-item.wxss @@ -31,7 +31,7 @@ color: white; font-size:13px; border-radius: 5px; - padding: 17px 2px 11px 8px; + padding: 18px 3px 12px 8px; position: relative; overflow: hidden; }