diff --git a/miniprogram/app.json b/miniprogram/app.json index 4170833..996eaea 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -9,7 +9,8 @@ "pages/userProtocol/userProtocol", "pages/mine/mine", "pages/ContactUs/ContactUs", - "pages/selections/selections" + "pages/selections/selections", + "pages/selectionDetail/selectionDetail" ], "window": { "backgroundTextStyle": "light", diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 52e5bbd..446ea98 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -125,12 +125,12 @@ Page({ }, goToChat() { - wx.navigateTo({ - url: '/pages/chat/chat', - }) // wx.navigateTo({ - // url: '/pages/selections/selections', + // url: '/pages/chat/chat', // }) + wx.navigateTo({ + url: '/pages/selections/selections', + }) }, checkCheatCode(e) { diff --git a/miniprogram/pages/selectionDetail/selectionDetail.js b/miniprogram/pages/selectionDetail/selectionDetail.js new file mode 100644 index 0000000..92fed27 --- /dev/null +++ b/miniprogram/pages/selectionDetail/selectionDetail.js @@ -0,0 +1,103 @@ +// pages/selectionDetail.ts +const app = getApp() +import request from '../../utils/request' +import { scrollToID, keyWordsEnum } from '../../utils/util' +Page({ + + /** + * 页面的初始数据 + */ + data: { + id: "", + list: [] + }, + + getTypeList(id) { + const that = this + request.get({ + url: `/api/promote/titleList?typeId=${id}` + }).then(res => { + console.log(res, 'res'); + let i = 0 + const len = res.data.length + const interval = setInterval(() => { + if (i == len) { + clearInterval(interval) + return + } + const list = that.data.list + list.push(res.data[i]) + that.setData({ + list + }) + i++ + }, 100); + + + }).catch(err => { + console.log(err, 'err'); + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const that = this + if (options.id) { + this.setData({ + id: options.id + }) + this.getTypeList(options.id) + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/selectionDetail/selectionDetail.json b/miniprogram/pages/selectionDetail/selectionDetail.json new file mode 100644 index 0000000..825d963 --- /dev/null +++ b/miniprogram/pages/selectionDetail/selectionDetail.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "问答模板", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#0d1322", + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/selectionDetail/selectionDetail.less b/miniprogram/pages/selectionDetail/selectionDetail.less new file mode 100644 index 0000000..1fa8b9e --- /dev/null +++ b/miniprogram/pages/selectionDetail/selectionDetail.less @@ -0,0 +1,38 @@ +/* pages/selectionDetail.wxss */ +page { + .content { + width: 100%; + min-height: 1500rpx; + background-color: #0d1322; + padding: 35rpx 0; + box-sizing: border-box; + + .title { + color: #ffffff; + text-align: center; + font-size: 38rpx; + margin-bottom: 60rpx; + } + + @keyframes getIn { + 0% { + transform: translateY(3000rpx); + } + + 100% { + transform: translateY(0); + } + } + + .item { + width: 65%; + color: #ffffff; + text-align: center; + background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + margin: 50rpx auto; + padding: 20rpx 0; + border-radius: 20rpx; + animation: getIn 1s linear; + } + } +} \ No newline at end of file diff --git a/miniprogram/pages/selectionDetail/selectionDetail.wxml b/miniprogram/pages/selectionDetail/selectionDetail.wxml new file mode 100644 index 0000000..90ce277 --- /dev/null +++ b/miniprogram/pages/selectionDetail/selectionDetail.wxml @@ -0,0 +1,5 @@ + + + 你可以选择以下模板 + {{ item.title }} + \ No newline at end of file diff --git a/miniprogram/pages/selections/selections.js b/miniprogram/pages/selections/selections.js index 4ad016f..f4add19 100644 --- a/miniprogram/pages/selections/selections.js +++ b/miniprogram/pages/selections/selections.js @@ -48,31 +48,21 @@ Page({ url: '/api/promote/list' }).then(res => { console.log(res, 'res'); - // if (res.data) { - // that.setData({ - // list: res.data - // }) - // } + if (res.data) { + that.setData({ + list: res.data + }) + } }).catch(err => { console.log(err, 'err'); }) }, - getTypeList(id) { - const that = this - return request.get({ - url: `/api/promote/titleList?typeId=${id}` - }) - }, - goDetail(e) { const id = e.currentTarget.dataset.id - this.getTypeList(id) - .then(res => { - console.log(res, 'res'); - }).catch(err => { - console.log(err, 'err'); - }) + wx.navigateTo({ + url: `/pages/selectionDetail/selectionDetail?id=${id}`, + }) }, /** diff --git a/miniprogram/pages/selections/selections.less b/miniprogram/pages/selections/selections.less index 4f8c9c6..afd7c30 100644 --- a/miniprogram/pages/selections/selections.less +++ b/miniprogram/pages/selections/selections.less @@ -27,14 +27,12 @@ page { .artItem { width: 45%; - height: 280rpx; text-align: center; color: #ffffff; margin: 5rpx; border-radius: 10rpx; border: 2px solid #fff; padding: 10rpx; - padding-bottom: 0; margin-bottom: 15rpx; image { diff --git a/miniprogram/pages/selections/selections.wxml b/miniprogram/pages/selections/selections.wxml index 67668f3..7a54d77 100644 --- a/miniprogram/pages/selections/selections.wxml +++ b/miniprogram/pages/selections/selections.wxml @@ -6,10 +6,10 @@ - + {{ item.name }} - {{ item.detail }} + {{ '简述简述简述' }} diff --git a/tsconfig.json b/tsconfig.json index be4bf69..24e7853 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -39,6 +39,7 @@ "miniprogram/components/userNumberChkeck/userNumberChkeck.js", "miniprogram/pages/ContactUs/ContactUs.js", "miniprogram/pages/selections/selections.js", + "miniprogram/pages/selectionDetail/selectionDetail.js", ], "exclude": [ "node_modules"