diff --git a/components/author-card/author-card.js b/components/author-card/author-card.js index 82c3b30..2765565 100644 --- a/components/author-card/author-card.js +++ b/components/author-card/author-card.js @@ -5,7 +5,11 @@ Component({ */ properties: { baseUrl: String, - author: Object + author: Object, + arrow: { + type: Boolean, + value: true + } }, /** diff --git a/components/author-card/author-card.wxml b/components/author-card/author-card.wxml index f06927b..dd476b3 100644 --- a/components/author-card/author-card.wxml +++ b/components/author-card/author-card.wxml @@ -1,12 +1,11 @@ - {{author.name}} - [{{author.age}}] + {{author.age}} ({{author.born}} ~{{author.dead?author.dead:'今'}}) diff --git a/components/author-info/author-info.js b/components/author-info/author-info.js new file mode 100644 index 0000000..e41dabe --- /dev/null +++ b/components/author-info/author-info.js @@ -0,0 +1,23 @@ +// components/author-info/author-info.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + info: Array + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/author-info/author-info.json b/components/author-info/author-info.json new file mode 100644 index 0000000..e21f663 --- /dev/null +++ b/components/author-info/author-info.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "t-empty": "tdesign-miniprogram/empty/empty" + } +} \ No newline at end of file diff --git a/components/author-info/author-info.wxml b/components/author-info/author-info.wxml new file mode 100644 index 0000000..4b380fb --- /dev/null +++ b/components/author-info/author-info.wxml @@ -0,0 +1,12 @@ + + + {{i.key}}: + {{i.value}} + + + \ No newline at end of file diff --git a/components/author-info/author-info.wxss b/components/author-info/author-info.wxss new file mode 100644 index 0000000..52d5dfc --- /dev/null +++ b/components/author-info/author-info.wxss @@ -0,0 +1,20 @@ +.author-info { + padding: 30rpx; + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.author-kv { + display: flex; + align-items: flex-start; +} + +.author-key { + color: #0052d9; + width: 160rpx; +} + +.author-key { + word-break: break-all; +} \ No newline at end of file diff --git a/config/network.js b/config/network.js index 08fabc4..c04866c 100644 --- a/config/network.js +++ b/config/network.js @@ -1,4 +1,5 @@ export default { backstageUrl: 'http://192.168.31.184:8080', + // backstageUrl: 'https://poem.mczhengyi.top/prod-api', ossUrl: '' } \ No newline at end of file diff --git a/pages/author-detail/author-detail.js b/pages/author-detail/author-detail.js index abd4ddc..344b134 100644 --- a/pages/author-detail/author-detail.js +++ b/pages/author-detail/author-detail.js @@ -1,66 +1,31 @@ -// pages/author-detail/author-detail.js +import network from '../../config/network'; +import request from '../../utils/request' Page({ - - /** - * 页面的初始数据 - */ data: { - + authorInfo: {}, + authorId: 0, + baseUrl: network.backstageUrl, + authorKV: [] + }, + /** 获取作者基本信息 */ + getAuthorInfo(authorId) { + request(`/poem/author/${authorId}`).then(res => { + this.setData({authorInfo: res.data.data}) + }) + }, + /** 获取作者详情信息 */ + getAuthorDetail(authorId) { + request(`/poem/info/list?authorId=${authorId}`).then(res => { + let authorDetail = res.data.data + this.setData({authorKV: authorDetail}) + }) }, - - /** - * 生命周期函数--监听页面加载 - */ onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + let authorId = options?.id + if(!authorId) authorId = 100 + this.setData({authorId}) + // 获取作者信息 + this.getAuthorInfo(authorId) + this.getAuthorDetail(authorId) } }) \ No newline at end of file diff --git a/pages/author-detail/author-detail.json b/pages/author-detail/author-detail.json index 8835af0..bb734ac 100644 --- a/pages/author-detail/author-detail.json +++ b/pages/author-detail/author-detail.json @@ -1,3 +1,8 @@ { - "usingComponents": {} + "usingComponents": { + "t-tabs": "tdesign-miniprogram/tabs/tabs", + "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", + "author-card": "/components/author-card/author-card", + "author-info": "/components/author-info/author-info" + } } \ No newline at end of file diff --git a/pages/author-detail/author-detail.wxml b/pages/author-detail/author-detail.wxml index 518f1db..548f27b 100644 --- a/pages/author-detail/author-detail.wxml +++ b/pages/author-detail/author-detail.wxml @@ -1,2 +1,18 @@ - -pages/author-detail/author-detail.wxml + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index f514609..c8b084a 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -35,6 +35,13 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "author-detail", + "pathName": "pages/author-detail/author-detail", + "query": "id=100", + "launchMode": "default", + "scene": null } ] }