feat: enhance super article features and UI updates

- Integrated AI writing capabilities in the super article editor, allowing users to upload multiple reference files and generate drafts using prompts.
- Updated the reading page to unify the display of book chapters and super articles, improving user navigation and experience.
- Enhanced the "My" page with new UI elements, including gradient icons and improved layout for better visual appeal.
- Added backend support for new article management endpoints, ensuring seamless integration with the front end.

This update aims to streamline the article creation process and enhance the overall user interface across the application.
This commit is contained in:
乘风
2026-05-11 15:43:10 +08:00
parent e6df2b78be
commit 01f9e216da
26 changed files with 553 additions and 81 deletions

View File

@@ -15,8 +15,8 @@ function newAttachId() {
Page({
data: {
/** 临时隐藏「AI 写文章」卡片;需上线时再设为 true */
showAiWriteSection: false,
/** 「AI 帮你写」卡片:参考图 + 提示词 + 生成 */
showAiWriteSection: true,
statusBarHeight: 44,
auditMode: false,
title: '',

View File

@@ -11,7 +11,7 @@
<!-- AI参考图片 + 提示词开关showAiWriteSection -->
<view wx:if="{{showAiWriteSection}}" class="card">
<text class="section-title">AI 帮你写</text>
<text class="label">参考图片(可选)</text>
<text class="label">参考图片(可选)</text>
<view class="file-actions">
<view class="add-file-btn" bindtap="chooseReferenceImages"> 添加图片</view>
</view>
@@ -25,7 +25,7 @@
</view>
<text class="file-remove" data-id="{{item.id}}" bindtap="removeAttachedFile">移除</text>
</view>
<text class="hint">从相册或相机添加参考图,可选(单次最多 9 张),上传后与 AI 生成。单张建议不超 30MB。</text>
<text class="hint">从相册或相机添加参考图,可选(单次最多 9 张),上传后与提示词一并交给 AI 分析。单张建议不超 30MB。</text>
<text class="label">提示词</text>
<view class="textarea-wrap">

View File

@@ -1,5 +1,5 @@
/**
* 动态广场:超级个体图文列表(触底分页)
* 动态广场:超级个体图文列表(下拉刷新 + 触底分页加载
*/
const app = getApp()
const { isSafeImageSrc } = require('../../utils/imageUrl.js')
@@ -85,6 +85,9 @@ function mapFeedRows(rows) {
}
Page({
/** 递增序列:下拉刷新时废弃进行中的上拉请求结果,避免列表错乱 */
loadSeq: 0,
data: {
statusBarHeight: 44,
feedList: [],
@@ -126,38 +129,63 @@ Page({
this.loadMore()
},
async onPullDownRefresh() {
try {
await app.getAuditMode()
} catch (_) {}
if (app.globalData.auditMode) {
wx.stopPullDownRefresh()
return
}
try {
await this.reloadFeed()
} finally {
wx.stopPullDownRefresh()
}
},
async reloadFeed() {
this.loadSeq += 1
const seq = this.loadSeq
this.setData({
loading: true,
loadingMore: false,
page: 1,
feedList: [],
hasMore: true,
total: 0,
})
try {
await this.fetchPage(1, true)
await this.fetchPage(1, true, seq)
} finally {
this.setData({ loading: false })
if (seq === this.loadSeq) {
this.setData({ loading: false })
}
}
},
async loadMore() {
if (this.data.loading || this.data.loadingMore || !this.data.hasMore) return
const seq = this.loadSeq
const next = this.data.page + 1
this.setData({ loadingMore: true })
try {
await this.fetchPage(next, false)
await this.fetchPage(next, false, seq)
} finally {
this.setData({ loadingMore: false })
}
},
async fetchPage(page, replace) {
async fetchPage(page, replace, seq) {
const res = await app.request({
url: `/api/miniprogram/super/articles/feed?page=${encodeURIComponent(String(page))}&pageSize=${PAGE_SIZE}`,
silent: true,
})
if (seq !== this.loadSeq) {
return
}
if (!res?.success) {
if (seq !== this.loadSeq) return
wx.showToast({ title: String(res?.error || '加载失败'), icon: 'none' })
if (replace) this.setData({ feedList: [], hasMore: false, total: 0 })
return

View File

@@ -2,7 +2,7 @@
"usingComponents": {
"icon": "/components/icon/icon"
},
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"onReachBottomDistance": 160,
"backgroundTextStyle": "light",
"backgroundColor": "#0b1220"