diff --git a/images/ic_qxsc@2x.png b/images/ic_qxsc@2x.png new file mode 100644 index 0000000..dd18016 Binary files /dev/null and b/images/ic_qxsc@2x.png differ diff --git a/pages/lookup/loockvideo/video.js b/pages/lookup/loockvideo/video.js index 51b1dbd..5e351e5 100644 --- a/pages/lookup/loockvideo/video.js +++ b/pages/lookup/loockvideo/video.js @@ -6,7 +6,7 @@ Page({ */ data: { data: {}, - host: getApp().globalData.host + cdn: getApp().globalData.cdn }, /** diff --git a/pages/lookup/loockvideo/video.wxml b/pages/lookup/loockvideo/video.wxml index 324cade..08dae7d 100644 --- a/pages/lookup/loockvideo/video.wxml +++ b/pages/lookup/loockvideo/video.wxml @@ -1,6 +1,6 @@ - + {{data.title}} @@ -16,7 +16,7 @@ 收藏 - diff --git a/pages/lookup/lookimg/img.js b/pages/lookup/lookimg/img.js index d7e0a42..78d6265 100644 --- a/pages/lookup/lookimg/img.js +++ b/pages/lookup/lookimg/img.js @@ -6,7 +6,8 @@ Page({ * 页面的初始数据 */ data: { - + data: {}, + cdn: getApp().globalData.cdn }, /** @@ -27,8 +28,55 @@ Page({ wx.setBackgroundColor({ backgroundColor: '#000000', }) + let that = this + wx.getStorage({ + key: 'article', + success(res){ + console.log('todata') + console.log(res) + that.setData({ + data: res.data + }) + } + }) + }, + downloadfile(e){ + wx.showLoading({ + title: '正在下载', + mask: true + }) + var url = e.currentTarget.dataset.url; + //下载文件,生成临时地址 + wx.downloadFile({ + url: url, + success(res) { + console.log(res) + //保存到本地 + wx.saveFile({ + tempFilePath: res.tempFilePath, + success: function (res) { + console.log(res) + console.log('保存到本地',res) + wx.saveImageToPhotosAlbum({ + filePath: res.savedFilePath, + complete(res){ + wx.hideLoading(); + console.log('保存到相册',res) + } + }) + }, + fail: function (err) { + wx.hideLoading(); + console.log('保存失败:', err) + }, + complete(res){ + wx.hideLoading(); + console.log(res) + } + }); + } + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/lookup/lookimg/img.wxml b/pages/lookup/lookimg/img.wxml index 16b27f9..39de233 100644 --- a/pages/lookup/lookimg/img.wxml +++ b/pages/lookup/lookimg/img.wxml @@ -1,26 +1,26 @@ - + - 3月31日上海展厅摄影图片 + {{data.title}} 星途追风 星途凌云 - + + + diff --git a/pages/lookup/lookimg/img.wxss b/pages/lookup/lookimg/img.wxss index 517fa75..88a30f5 100644 --- a/pages/lookup/lookimg/img.wxss +++ b/pages/lookup/lookimg/img.wxss @@ -4,18 +4,20 @@ background-color: black; width: 750rpx; height: 90vh; + padding-bottom: 10vh; display: flex; justify-content: center; align-items: center; display: flex; flex-direction: column; - padding-bottom: 10vh; } -.bottom{ + +.bottom { width: 750rpx; position: fixed; bottom: 80rpx; } + .title { font-size: 32rpx; font-family: PingFangSC-Regular, PingFang SC; @@ -47,17 +49,23 @@ width: 750rpx; padding: 32rpx; } -.one{ - font-size: 20rpx; -font-family: PingFangSC-Regular, PingFang SC; -font-weight: 400; -color: #FFFFFF; -line-height: 20rpx; -display: flex; -flex-direction: column; -align-items: center; + +.one { + font-size: 20rpx!important; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #FFFFFF!important; + line-height: 20rpx!important; + display: flex; + flex-direction: column; + align-items: center; + width: auto!important; + border: none!important; + margin: 0rpx!important; + /* padding: 0rpx!important; */ } -.operation{ + +.operation { display: flex; justify-content: space-around; margin-top: 122rpx; diff --git a/pages/material/material.js b/pages/material/material.js index 61c5ce9..ca0dd62 100644 --- a/pages/material/material.js +++ b/pages/material/material.js @@ -101,7 +101,7 @@ Page({ questes: [], maxpage: 1, page: 1, - host: getApp().globalData.host + cdn: getApp().globalData.cdn }, /** * 生命周期函数--监听页面加载 @@ -237,7 +237,22 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.onRefresh() + }, + onRefresh:function(){ + //导航条加载动画 + wx.showNavigationBarLoading() + //loading 提示框 + wx.showLoading({ + title: 'Loading...', + }) + console.log("下拉刷新啦"); + setTimeout(function () { + wx.hideLoading(); + wx.hideNavigationBarLoading(); + //停止下拉刷新 + wx.stopPullDownRefresh(); + }, 2000) }, /** diff --git a/pages/material/material.json b/pages/material/material.json index 8835af0..7360326 100644 --- a/pages/material/material.json +++ b/pages/material/material.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/pages/material/material.wxml b/pages/material/material.wxml index 7930357..990c2c1 100644 --- a/pages/material/material.wxml +++ b/pages/material/material.wxml @@ -23,7 +23,7 @@ - + {{item.name}} diff --git a/pages/material/subpage/newest/newest.js b/pages/material/subpage/newest/newest.js index 3f244c8..a89bf4d 100644 --- a/pages/material/subpage/newest/newest.js +++ b/pages/material/subpage/newest/newest.js @@ -1,4 +1,9 @@ // pages/material/subpage/newest/newest.js +import { + http, + formatTime, + lookup +} from '../../../../utils/util' Page({ /** @@ -99,27 +104,73 @@ Page({ showOrHide: false, ac: false, choose: false, - id: null + id: null, + listdata: [], + count: 0, + flag: 5 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - // console.log(options.id) this.setData({ id: options.id }) + this.getdata() wx.setNavigationBarTitle({ title: '最新素材', success: function (res) {} }) }, + getdata() { + let that = this + http("/reference/listByDay", "post", { + date: formatTime(new Date(new Date().getTime() - 86400000 * that.data.count)), + groupId: Number(this.data.id), + }).then(res => { + if (res.data.length === 0) { + this.setData({ + count: this.data.count + 1, + }) + this.getdata() + } else { + // 单日数据 + let arr = {} + // 是否全选 + arr.all = false + arr.time = formatTime(new Date(new Date().getTime() - 86400000 * that.data.count)).split(' ')[0] + arr.refrence = [] + res.data.forEach(el=>{ + // 单卡数据 + let ele = el + // 单选 + ele.choose = false + // 当前位置 + ele.index = that.data.count + // 卡片数据 + arr.refrence = arr.refrence.concat(ele) + }) + this.setData({ + listdata: this.data.listdata.concat(arr), + flag: this.data.flag - 1, + }) + this.setData({ + count: this.data.count + 1, + }) + } + // if (this.data.flag > 1) { + // this.getdata() + // } + }) + }, to(e) { - if (this.data.choose) {} else { - wx.navigateTo({ - url: e.currentTarget.dataset.url, - }) - } + // if (this.data.choose) {} else { + // wx.navigateTo({ + // url: e.currentTarget.dataset.url, + // }) + // } + // console.log(e.currentTarget.dataset.item) + lookup(e.currentTarget.dataset.item) }, // 点击菜单栏触发的事件函数 handleClick: function (e) { @@ -155,7 +206,6 @@ Page({ } // 令当前点击的菜单栏高亮 navItem.forEach((v, i) => i === index ? v.is = true : v.is = false) - // console.log(selectItem[index].rank) this.setData({ showOrHide: true, selectedItem: selectItem[index].rank, @@ -188,7 +238,6 @@ Page({ v.is = false })) : (navItem.forEach((v) => v.is = false)) // 调取借口触发筛选 - // console.log(navItem) this.setData({ listNum: -1, showOrHide: false, @@ -196,19 +245,52 @@ Page({ selectedItem }) }, - tochoose () { + tochoose() { this.setData({ - choose:!this.data.choose + choose: !this.data.choose }) - }, - choose (e) { - console.log(e) + choose(e) { + let a = e.currentTarget.dataset.data.index + let b = e.currentTarget.dataset.index + let c = 'listdata[' + a + '].refrence[' + b + '].choose' this.setData({ - ac:!this.data.ac + [c] : !this.data.listdata[a].refrence[b].choose + }) + let flag = true + for (let i = 0; i < this.data.listdata[a].refrence.length; i++) { + if (this.data.listdata[a].refrence[i].choose) { + } else { + flag = false + } + } + if (flag) { + // this.data.listdata[a].all = true + let d = 'listdata[' + a + '].all' + this.setData({ + [d]: true + }) + } else { + // this.data.listdata[a].all = false + let d = 'listdata[' + a + '].all' + this.setData({ + [d]: false + }) + } + }, + chooseall (e) { + let a = 'listdata[' + e.currentTarget.dataset.index + '].all' + let b = e.currentTarget.dataset.index + for (let i = 0; i < this.data.listdata[b].refrence.length; i++) { + let c = 'listdata['+b+'].refrence['+i+'].choose' + this.setData({ + [c]: !this.data.listdata[b].all + }) + } + this.setData({ + [a]: !this.data.listdata[b].all }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -248,7 +330,7 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom() { - + this.getdata() }, /** diff --git a/pages/material/subpage/newest/newest.wxml b/pages/material/subpage/newest/newest.wxml index 42f8473..4f4eeb1 100644 --- a/pages/material/subpage/newest/newest.wxml +++ b/pages/material/subpage/newest/newest.wxml @@ -20,24 +20,28 @@ - - 今天 - + + + {{item.time}} + - + + - + - + - + + + \ No newline at end of file diff --git a/pages/material/subpage/newest/newest.wxss b/pages/material/subpage/newest/newest.wxss index 3f07284..5f27f58 100644 --- a/pages/material/subpage/newest/newest.wxss +++ b/pages/material/subpage/newest/newest.wxss @@ -138,6 +138,9 @@ line-height: 32rpx; margin-top: 8rpx; margin-bottom: 32rpx; + display: flex; + justify-content: space-between; + align-items: center; } .card { @@ -169,27 +172,46 @@ width: 32rpx; height: 32rpx; position: relative; - bottom: 165rpx; + bottom: 145rpx; left: 105rpx; } -.choose.non{ +.choose.non { width: 32rpx; height: 32rpx; background: rgba(0, 0, 0, 0.3); border: 2rpx solid #FFFFFF; position: relative; - bottom: 113rpx; + bottom: 93rpx; left: 100rpx; border-radius: 32rpx; } -.choose.active{ + +.choose.active { width: 32rpx; height: 32rpx; background: #006BFF; border: 2rpx solid #FFFFFF; position: relative; - bottom: 113rpx; + bottom: 93rpx; left: 100rpx; border-radius: 32rpx; +} + +.allin { + width: 120rpx !important; + height: 48rpx !important; + background: #F9F9F9; + border-radius: 24rpx !important; + font-size: 24rpx; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #333333; + line-height: 24rpx; + padding: 0rpx !important; + margin: 0rpx !important; + display: flex; + justify-content: center; + align-items: center; + right: 32rpx; } \ No newline at end of file diff --git a/pages/quest/quest.js b/pages/quest/quest.js index db02562..1523c3b 100644 --- a/pages/quest/quest.js +++ b/pages/quest/quest.js @@ -251,9 +251,23 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.onRefresh() + }, + onRefresh:function(){ + //导航条加载动画 + wx.showNavigationBarLoading() + //loading 提示框 + wx.showLoading({ + title: 'Loading...', + }) + console.log("下拉刷新啦"); + setTimeout(function () { + wx.hideLoading(); + wx.hideNavigationBarLoading(); + //停止下拉刷新 + wx.stopPullDownRefresh(); + }, 2000) }, - /** * 页面上拉触底事件的处理函数 */ diff --git a/pages/quest/quest.json b/pages/quest/quest.json index 8835af0..7360326 100644 --- a/pages/quest/quest.json +++ b/pages/quest/quest.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "enablePullDownRefresh": true } \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index c4f6eb4..4ae38de 100644 --- a/utils/util.js +++ b/utils/util.js @@ -10,7 +10,7 @@ const formatTime = date => { const minute = date.getMinutes() const second = date.getSeconds() - return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` + return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute, second].map(formatNumber).join(':')}` } const formatNumber = n => { @@ -63,7 +63,7 @@ const http = (url, method, data, isLoading = true) => { } const lookup = (e) => { - // console.log(e) + console.log(e.type) if (e.type === 1) { wx.navigateTo({ url: '/pages/lookup/loockvideo/video', @@ -73,7 +73,13 @@ const lookup = (e) => { data: e }) } else { - + wx.navigateTo({ + url: '/pages/lookup/lookimg/img', + }) + wx.setStorage({ + key: 'article', + data: e + }) } }