index.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301
  1. <template>
  2. <view class="page">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar">
  5. <view class="nav-content">
  6. <view class="nav-left" @click="goBack">
  7. <text class="back-icon">←</text>
  8. </view>
  9. <text class="page-title">书籍生成</text>
  10. <view class="nav-right">
  11. <text class="nav-btn" @click="switchTab">📚</text>
  12. </view>
  13. </view>
  14. </view>
  15. <!-- 主内容区 -->
  16. <view class="main-content">
  17. <!-- 视图1:书籍列表 -->
  18. <view v-if="currentView === 'list'" class="list-view">
  19. <!-- 创建新书籍按钮 -->
  20. <view class="create-card" @click="currentView = 'create'">
  21. <text class="create-icon">+</text>
  22. <text class="create-text">创建新书籍</text>
  23. </view>
  24. <!-- 视频生成入口 -->
  25. <view class="video-nav-card" @click="goToVideoGenerator">
  26. <view class="video-nav-content">
  27. <text class="video-nav-icon">🎬</text>
  28. <view class="video-nav-text">
  29. <text class="video-nav-title">视频生成</text>
  30. <text class="video-nav-desc">图片+音频生成精美视频</text>
  31. </view>
  32. </view>
  33. <text class="video-nav-arrow">→</text>
  34. </view>
  35. <!-- 书籍列表 -->
  36. <view v-if="books.length > 0" class="book-list">
  37. <view
  38. v-for="book in books"
  39. :key="book.id"
  40. class="book-card"
  41. >
  42. <view class="book-header" @click="openBook(book)">
  43. <text class="book-title">{{ book.title }}</text>
  44. <view :class="['status-badge', book.status]">
  45. {{ getStatusText(book.status) }}
  46. </view>
  47. </view>
  48. <text class="book-desc" @click="openBook(book)">{{ book.description }}</text>
  49. <view class="book-meta" @click="openBook(book)">
  50. <text>{{ book.totalChapters }}章</text>
  51. <text v-if="book.progress > 0">{{ book.progress }}%</text>
  52. </view>
  53. <view v-if="book.progress > 0 && book.progress < 100" class="progress-bar" @click="openBook(book)">
  54. <view class="progress-fill" :style="{ width: book.progress + '%' }"></view>
  55. </view>
  56. <!-- 批量生成音频按钮 - 只要有章节就显示 -->
  57. <view v-if="book.chapters && book.chapters.length > 0" class="book-actions">
  58. <button
  59. class="audio-btn"
  60. :disabled="generatingAudio"
  61. @click.stop="handleGenerateAllAudio(book)"
  62. >
  63. {{ generatingAudio ? '生成中...' : '🎵 生成全部音频' }}
  64. </button>
  65. <button
  66. class="video-btn"
  67. :disabled="generatingVideo"
  68. @click.stop="handleGenerateAllVideo(book)"
  69. >
  70. {{ generatingVideo ? '生成中...' : '🎬 生成全部视频' }}
  71. </button>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 空状态 -->
  76. <view v-else class="empty-state">
  77. <text class="empty-icon">📖</text>
  78. <text class="empty-text">暂无书籍</text>
  79. <text class="empty-hint">点击上方按钮创建第一本书</text>
  80. </view>
  81. </view>
  82. <!-- 视图2:创建书籍 -->
  83. <view v-if="currentView === 'create'" class="create-view">
  84. <view class="card">
  85. <view class="card-header">
  86. <text class="card-title">📖 创建新书籍</text>
  87. </view>
  88. <!-- 书名 -->
  89. <view class="form-item">
  90. <text class="form-label">书名 *</text>
  91. <input
  92. v-model="newBook.title"
  93. class="form-input"
  94. placeholder="例如:《时间是什么》"
  95. />
  96. </view>
  97. <!-- 副标题 -->
  98. <view class="form-item">
  99. <text class="form-label">副标题</text>
  100. <input
  101. v-model="newBook.subtitle"
  102. class="form-input"
  103. placeholder="例如:一本写给青少年的科普书"
  104. />
  105. </view>
  106. <!-- 描述/主题 -->
  107. <view class="form-item">
  108. <text class="form-label">内容描述 *</text>
  109. <textarea
  110. v-model="newBook.description"
  111. class="form-textarea"
  112. placeholder="描述这本书的内容、主题、写作目的..."
  113. :maxlength="500"
  114. />
  115. </view>
  116. <!-- 目标受众 -->
  117. <view class="form-item">
  118. <text class="form-label">目标受众</text>
  119. <view class="chip-group">
  120. <view
  121. v-for="audience in audiences"
  122. :key="audience"
  123. :class="['chip', newBook.targetAudience === audience ? 'active' : '']"
  124. @click="newBook.targetAudience = audience"
  125. >
  126. {{ audience }}
  127. </view>
  128. </view>
  129. </view>
  130. <!-- 写作风格 -->
  131. <view class="form-item">
  132. <text class="form-label">写作风格</text>
  133. <view class="chip-group">
  134. <view
  135. v-for="style in styles"
  136. :key="style"
  137. :class="['chip', newBook.style === style ? 'active' : '']"
  138. @click="newBook.style = style"
  139. >
  140. {{ style }}
  141. </view>
  142. </view>
  143. </view>
  144. <!-- 书籍规模 -->
  145. <view class="form-item">
  146. <text class="form-label">书籍规模</text>
  147. <view class="scale-picker">
  148. <view
  149. v-for="scale in bookScales"
  150. :key="scale.value"
  151. :class="['scale-option', { active: newBook.bookScale === scale.value }]"
  152. @click="selectBookScale(scale.value)"
  153. >
  154. <text class="scale-words">{{ scale.words }}</text>
  155. <text class="scale-label">{{ scale.label }}</text>
  156. <text class="scale-pages">{{ scale.pages }}</text>
  157. </view>
  158. </view>
  159. </view>
  160. <!-- 预估信息(选择规模后显示) -->
  161. <view v-if="bookEstimate" class="estimate-card">
  162. <view class="estimate-header">
  163. <text class="estimate-title">📊 生成预估</text>
  164. </view>
  165. <view class="estimate-row">
  166. <text class="estimate-label">预估字数:</text>
  167. <text class="estimate-value">{{ bookEstimate.words.min }}~{{ bookEstimate.words.max }}字</text>
  168. </view>
  169. <view class="estimate-row">
  170. <text class="estimate-label">预估时长:</text>
  171. <text class="estimate-value">{{ bookEstimate.audioMinutes.min }}~{{ bookEstimate.audioMinutes.max }}分钟</text>
  172. </view>
  173. <view class="estimate-row">
  174. <text class="estimate-label">预估章节:</text>
  175. <text class="estimate-value">约{{ bookEstimate.estimatedChapters }}章</text>
  176. </view>
  177. <!-- 配额检查结果 -->
  178. <view v-if="quotaCheck" class="quota-check">
  179. <view v-if="quotaCheck.allowed" class="quota-ok">
  180. <text class="quota-icon">✅</text>
  181. <text class="quota-text">额度充足,可生成</text>
  182. </view>
  183. <view v-else class="quota-warning">
  184. <text class="quota-icon">⚠️</text>
  185. <text class="quota-text">{{ quotaCheck.reason }}</text>
  186. </view>
  187. <!-- 详细配额信息 -->
  188. <view class="quota-detail">
  189. <text class="quota-info">您当前额度:{{ quotaCheck.quota.remainingMinutes }}分钟 / {{ quotaCheck.quota.totalMinutes }}分钟</text>
  190. <view v-if="quotaCheck.costEstimate.overageMinutes > 0" class="quota-overage">
  191. <text>预计超出:{{ quotaCheck.costEstimate.overageMinutes }}分钟</text>
  192. <text class="quota-price">额外费用:¥{{ quotaCheck.costEstimate.estimatedPrice }}</text>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. <view class="btn-group">
  198. <button class="btn-cancel" @click="currentView = 'list'">取消</button>
  199. <button
  200. class="btn-primary"
  201. :disabled="!canCreateBook || creating"
  202. @click="createNewBook"
  203. >
  204. {{ creating ? '创建中...' : '创建书籍' }}
  205. </button>
  206. </view>
  207. </view>
  208. </view>
  209. <!-- 视图3:书籍详情/生成 -->
  210. <view v-if="currentView === 'detail'" class="detail-view">
  211. <!-- 书籍信息 -->
  212. <view class="card book-info">
  213. <view class="book-title-row">
  214. <text class="book-title-large">{{ currentBook?.title }}</text>
  215. <view :class="['status-badge', currentBook?.status]">
  216. {{ getStatusText(currentBook?.status || 'draft') }}
  217. </view>
  218. </view>
  219. <text v-if="currentBook?.subtitle" class="book-subtitle">{{ currentBook.subtitle }}</text>
  220. <text class="book-desc">{{ currentBook?.description }}</text>
  221. <view class="book-meta-row">
  222. <text>章节:{{ currentBook?.totalChapters }} 章</text>
  223. <text>预估:{{ currentBook?.estimatedWords || 0 }} 字</text>
  224. </view>
  225. </view>
  226. <!-- 进度显示 -->
  227. <view v-if="currentBook && currentBook.progress > 0" class="card progress-card">
  228. <text class="card-title">📊 生成进度</text>
  229. <view class="progress-display">
  230. <text class="progress-text">{{ currentBook.progress }}%</text>
  231. <text class="progress-detail">
  232. {{ completedChapters }}/{{ currentBook.totalChapters }} 章
  233. </text>
  234. </view>
  235. <view class="progress-bar-large">
  236. <view class="progress-fill" :style="{ width: currentBook.progress + '%' }"></view>
  237. </view>
  238. <!-- 实时配额显示 -->
  239. <view v-if="currentBook.status === 'generating'" class="quota-monitor">
  240. <text class="quota-monitor-title">🎧 额度监控</text>
  241. <view class="quota-monitor-row">
  242. <text>已用:{{ usedAudioMinutes }}分钟</text>
  243. <text>剩余:{{ remainingAudioMinutes }}分钟</text>
  244. </view>
  245. <view v-if="overageMinutes > 0" class="quota-overage-warning">
  246. <text>⚠️ 已超出配额 {{ overageMinutes }} 分钟</text>
  247. </view>
  248. </view>
  249. <!-- 中断提示 -->
  250. <view v-if="currentBook.status === 'failed' && currentBook?.error?.includes('额度')" class="interrupted-tip">
  251. <text class="interrupted-icon">⚠️</text>
  252. <text class="interrupted-text">生成已中断:额度不足,已保存当前进度</text>
  253. <text class="interrupted-hint">可升级套餐后继续生成</text>
  254. </view>
  255. </view>
  256. <!-- 大纲展示 -->
  257. <view v-if="currentBook?.outline" class="card outline-card">
  258. <view class="card-header-row">
  259. <text class="card-title">📋 书籍大纲</text>
  260. <text class="outline-theme">{{ currentBook.outline.mainTheme }}</text>
  261. </view>
  262. <view class="outline-list">
  263. <view
  264. v-for="chapter in currentBook.outline.chapters"
  265. :key="chapter.number"
  266. class="outline-item"
  267. >
  268. <view class="chapter-num">{{ chapter.number }}</view>
  269. <view class="chapter-info">
  270. <text class="chapter-title">{{ chapter.title }}</text>
  271. <text class="chapter-summary">{{ chapter.summary }}</text>
  272. <view class="chapter-points">
  273. <text v-for="(point, idx) in chapter.keyPoints.slice(0, 3)" :key="idx" class="point-tag">
  274. {{ point }}
  275. </text>
  276. </view>
  277. </view>
  278. <view :class="['chapter-status', getChapterStatus(chapter.number)]">
  279. {{ getChapterStatusText(chapter.number) }}
  280. </view>
  281. </view>
  282. </view>
  283. </view>
  284. <!-- 完整内容区 - 前言/后记/章节 -->
  285. <view v-if="currentBook?.chapters && currentBook.chapters.length > 0" class="card content-card">
  286. <text class="card-title">📖 完整内容</text>
  287. <!-- 前言 -->
  288. <view v-if="currentBook?.metadata?.foreword" class="content-item foreword" @click="viewForeword">
  289. <view class="content-item-left">
  290. <text class="content-label">前言</text>
  291. <text class="content-word-count">{{ currentBook?.metadata?.foreword?.length || 0 }}字</text>
  292. </view>
  293. <view class="content-item-right">
  294. <text class="expand-icon">→</text>
  295. </view>
  296. </view>
  297. <!-- 章节列表 -->
  298. <view
  299. v-for="chapter in currentBook.chapters"
  300. :key="chapter.id"
  301. class="content-item chapter-item"
  302. @click="goToChapterDetail(chapter)"
  303. >
  304. <view class="content-item-header">
  305. <view class="content-item-left">
  306. <text class="chapter-num-badge">第{{ chapter.number }}章</text>
  307. <text class="chapter-title-short">{{ chapter.title }}</text>
  308. <text v-if="chapter.audioUrl" class="audio-badge">🎵</text>
  309. <text v-if="chapter.videoUrl" class="video-badge">🎬</text>
  310. </view>
  311. <view class="content-item-right">
  312. <text class="expand-icon">→</text>
  313. </view>
  314. </view>
  315. </view>
  316. <!-- 后记 -->
  317. <view v-if="currentBook?.metadata?.afterword" class="content-item afterword" @click="viewAfterword">
  318. <view class="content-item-left">
  319. <text class="content-label">后记</text>
  320. <text class="content-word-count">{{ currentBook?.metadata?.afterword?.length || 0 }}字</text>
  321. </view>
  322. <view class="content-item-right">
  323. <text class="expand-icon">→</text>
  324. </view>
  325. </view>
  326. </view>
  327. <!-- 操作按钮 -->
  328. <view class="card action-card">
  329. <!-- LangGraph 生成按钮 -->
  330. <view class="btn-col">
  331. <view class="btn-row">
  332. <button
  333. class="action-btn langgraph-btn"
  334. :disabled="generating"
  335. @click="handleLangGraphGenerate"
  336. >
  337. {{ generating ? '生成中...' : '🤖 开始生成' }}
  338. </button>
  339. </view>
  340. </view>
  341. <!-- 生成中 -->
  342. <view v-if="generating" class="generating-tip">
  343. <text>正在生成中,请稍候...</text>
  344. </view>
  345. <!-- 无章节警告 -->
  346. <view v-if="currentBook?.status === 'completed' && (!currentBook.chapters || currentBook.chapters.length === 0)" class="warning-tip">
  347. <text class="warning-icon">⚠️</text>
  348. <text class="warning-text">该书籍状态标记为已完成,但没有任何章节内容。</text>
  349. <text class="warning-hint">请尝试点击上方按钮重新生成。</text>
  350. </view>
  351. <!-- 返回列表 -->
  352. <button class="action-btn full-width" @click="backToList">
  353. 返回书籍列表
  354. </button>
  355. </view>
  356. </view>
  357. </view>
  358. </view>
  359. </template>
  360. <script setup lang="ts">
  361. import { ref, computed, onMounted, watch, nextTick } from 'vue';
  362. import { onShow } from '@dcloudio/uni-app';
  363. import * as api from '../../utils/book-generator-api';
  364. import type { Book, BookOutline, Chapter } from '../../utils/book-generator-api';
  365. // 使用相对路径(Nginx 反向代理)
  366. const BASE_URL = '/api';
  367. // 视图状态
  368. const currentView = ref<'list' | 'create' | 'detail' | 'toc' | 'chapter-detail'>('list');
  369. // 监听视图变化
  370. watch(currentView, (newView) => {
  371. if (newView === 'create') {
  372. // 打开创建视图时,加载默认规模的预估
  373. nextTick(() => {
  374. selectBookScale(newBook.value.bookScale);
  375. });
  376. }
  377. });
  378. // 书籍列表
  379. const books = ref<Book[]>([]);
  380. // 当前书籍
  381. const currentBook = ref<Book | null>(null);
  382. // 创建表单
  383. const showCreateModal = ref(false);
  384. const creating = ref(false);
  385. const newBook = ref({
  386. title: '',
  387. subtitle: '',
  388. description: '',
  389. targetAudience: '',
  390. style: '',
  391. bookScale: 'medium',
  392. });
  393. // 生成状态
  394. const generating = ref(false);
  395. // 书籍预估信息
  396. const bookEstimate = ref<{
  397. scale: string;
  398. words: { min: number; max: number; avg: number };
  399. audioMinutes: { min: number; max: number; avg: number };
  400. estimatedChapters: number;
  401. } | null>(null);
  402. // 配额检查结果
  403. const quotaCheck = ref<{
  404. allowed: boolean;
  405. reason: string | null;
  406. estimatedWords: { min: number; max: number; avg: number };
  407. estimatedAudioMinutes: { min: number; max: number; avg: number };
  408. quota: {
  409. totalMinutes: number;
  410. usedMinutes: number;
  411. remainingMinutes: number;
  412. overageEnabled: boolean;
  413. overagePrice: number;
  414. };
  415. costEstimate: {
  416. inQuotaMinutes: number;
  417. overageMinutes: number;
  418. estimatedPrice: number;
  419. displayText: string;
  420. };
  421. } | null>(null);
  422. // 音频生成状态
  423. const generatingAudio = ref(false);
  424. // 视频生成状态
  425. const generatingVideo = ref(false);
  426. // 选项配置
  427. const audiences = ['不填', '通用', '青少年', '儿童', '大学生', '专业人士', '老年'];
  428. const styles = ['不填', '通俗易懂', '专业严谨', '轻松幽默', '诗意优美', '故事化'];
  429. const bookScales = [
  430. { value: '800', label: '短文', words: '800字', pages: '约3页' },
  431. { value: '2000', label: '短文', words: '2000字', pages: '约8页' },
  432. { value: '5000', label: '短文', words: '5000字', pages: '约20页' },
  433. { value: '小册子', label: '小册子', words: '1~5万字', pages: '约50~120页' },
  434. { value: '标准教程', label: '标准教程', words: '5~15万字', pages: '约150~300页' },
  435. { value: '系统教材', label: '系统教材', words: '15~30万字', pages: '约300~550页' },
  436. // { value: '专业厚本', label: '专业厚本', words: '30~60万字', pages: '约550~900页' },
  437. // { value: '大部头', label: '大部头', words: '60万字以上', pages: '900页以上' },
  438. ];
  439. // 计算属性
  440. const canCreateBook = computed(() => {
  441. // 免费版需要检查配额
  442. if (quotaCheck.value && !quotaCheck.value.allowed) {
  443. return false;
  444. }
  445. return newBook.value.title.trim() && newBook.value.description.trim();
  446. });
  447. const completedChapters = computed(() => {
  448. if (!currentBook.value) return 0;
  449. return currentBook.value.chapters.filter((c) => c.status === 'completed').length;
  450. });
  451. // 计算已使用的音频时长(基于已完成章节的字数)
  452. const usedAudioMinutes = computed(() => {
  453. if (!currentBook.value) return 0;
  454. const totalWords = currentBook.value.chapters
  455. .filter((c) => c.status === 'completed')
  456. .reduce((sum, c) => sum + (c.wordCount || 0), 0);
  457. return Math.ceil(totalWords / 150); // 150字/分钟
  458. });
  459. // 计算剩余配额
  460. const remainingAudioMinutes = computed(() => {
  461. if (!quotaInfo.value) return 0;
  462. return Math.max(0, quotaInfo.value.totalMinutes - quotaInfo.value.usedMinutes);
  463. });
  464. // 计算超出配额分钟数
  465. const overageMinutes = computed(() => {
  466. if (!currentBook.value) return 0;
  467. const used = usedAudioMinutes.value;
  468. if (!quotaInfo.value) return 0;
  469. return Math.max(0, used - quotaInfo.value.totalMinutes);
  470. });
  471. // 配额信息(从API获取)
  472. const quotaInfo = ref<{
  473. totalMinutes: number;
  474. usedMinutes: number;
  475. remainingMinutes: number;
  476. overageEnabled: boolean;
  477. } | null>(null);
  478. // 选择书籍规模时加载预估
  479. async function selectBookScale(scale: string) {
  480. newBook.value.bookScale = scale;
  481. try {
  482. const response = await uni.request({
  483. url: `/api/book-generator/langgraph/estimate?scale=${encodeURIComponent(scale)}&userId=1`,
  484. method: 'GET'
  485. });
  486. const res = response.data as any;
  487. if (res.code === 0 && res.data) {
  488. bookEstimate.value = {
  489. scale: res.data.scale,
  490. words: res.data.words,
  491. audioMinutes: res.data.audioMinutes,
  492. estimatedChapters: res.data.estimatedChapters
  493. };
  494. // 如果有配额检查结果
  495. if (res.data.quotaCheck) {
  496. quotaCheck.value = res.data.quotaCheck;
  497. }
  498. }
  499. } catch (e) {
  500. console.error('加载预估失败:', e);
  501. bookEstimate.value = null;
  502. quotaCheck.value = null;
  503. }
  504. }
  505. // 方法
  506. function goBack() {
  507. uni.navigateBack();
  508. }
  509. function switchTab() {
  510. uni.switchTab({ url: '/pages/index/index' });
  511. }
  512. function goToVideoGenerator() {
  513. uni.navigateTo({ url: '/pages/video-generator/index' });
  514. }
  515. function getStatusText(status: string): string {
  516. const map: Record<string, string> = {
  517. draft: '草稿',
  518. planning: '规划中',
  519. generating: '生成中',
  520. completed: '已完成',
  521. failed: '失败',
  522. };
  523. return map[status] || status;
  524. }
  525. function getChapterStatus(chapterNum: number): string {
  526. const chapter = currentBook.value?.chapters.find((c) => c.number === chapterNum);
  527. if (!chapter) return 'pending';
  528. return chapter.status === 'completed' ? 'done' : 'pending';
  529. }
  530. function getChapterStatusText(chapterNum: number): string {
  531. const chapter = currentBook.value?.chapters.find((c) => c.number === chapterNum);
  532. if (!chapter) return '待生成';
  533. return chapter.status === 'completed' ? '✓' : '○';
  534. }
  535. // 加载书籍列表
  536. async function loadBooks() {
  537. try {
  538. const data = await api.getBooks();
  539. books.value = data || [];
  540. } catch (e) {
  541. console.error('加载书籍失败:', e);
  542. books.value = [];
  543. }
  544. }
  545. // 创建新书籍
  546. async function createNewBook() {
  547. if (!canCreateBook.value) return;
  548. creating.value = true;
  549. try {
  550. await api.createBook({
  551. title: newBook.value.title,
  552. subtitle: newBook.value.subtitle,
  553. description: newBook.value.description,
  554. ...(newBook.value.targetAudience ? { targetAudience: newBook.value.targetAudience } : {}),
  555. ...(newBook.value.style ? { style: newBook.value.style } : {}),
  556. bookScale: newBook.value.bookScale,
  557. });
  558. // 重置表单
  559. newBook.value = {
  560. title: '',
  561. subtitle: '',
  562. description: '',
  563. targetAudience: '',
  564. style: '',
  565. bookScale: 'medium',
  566. };
  567. showCreateModal.value = false;
  568. currentView.value = 'list';
  569. await loadBooks();
  570. uni.showToast({ title: '创建成功', icon: 'success' });
  571. } catch (e: any) {
  572. uni.showToast({ title: e.message || '创建失败', icon: 'none' });
  573. } finally {
  574. creating.value = false;
  575. }
  576. }
  577. // 打开书籍
  578. async function openBook(book: Book) {
  579. try {
  580. currentBook.value = await api.getBook(book.id);
  581. currentView.value = 'detail';
  582. // 更新 URL hash,带上书籍 ID
  583. updateUrlWithBookId(book.id);
  584. // 加载配额信息
  585. loadQuotaInfo();
  586. } catch (e) {
  587. uni.showToast({ title: '加载失败', icon: 'none' });
  588. }
  589. }
  590. // 更新 URL,带上书籍 ID
  591. function updateUrlWithBookId(bookId: string) {
  592. if (typeof window !== 'undefined') {
  593. const url = new URL(window.location.href);
  594. url.hash = `/pages/book-generator/index?id=${bookId}`;
  595. window.history.pushState({}, '', url.toString());
  596. }
  597. }
  598. // 从 URL 获取书籍 ID
  599. function getBookIdFromUrl(): string | null {
  600. if (typeof window !== 'undefined') {
  601. const hash = window.location.hash;
  602. const match = hash.match(/id=([^&]+)/);
  603. return match ? match[1] : null;
  604. }
  605. return null;
  606. }
  607. // 加载指定 ID 的书籍
  608. async function loadBookById(bookId: string) {
  609. try {
  610. currentBook.value = await api.getBook(bookId);
  611. currentView.value = 'detail';
  612. loadQuotaInfo();
  613. } catch (e) {
  614. console.error('加载书籍失败:', e);
  615. uni.showToast({ title: '加载失败', icon: 'none' });
  616. }
  617. }
  618. // 返回列表
  619. function backToList() {
  620. currentView.value = 'list';
  621. loadBooks();
  622. // 清除 URL 参数
  623. if (typeof window !== 'undefined') {
  624. const url = new URL(window.location.href);
  625. url.hash = '/pages/book-generator/index';
  626. window.history.pushState({}, '', url.toString());
  627. }
  628. }
  629. // 页面显示时检查 URL 参数
  630. onShow(() => {
  631. const bookId = getBookIdFromUrl();
  632. if (bookId && currentView.value === 'list') {
  633. loadBookById(bookId);
  634. }
  635. });
  636. // 加载用户配额信息
  637. async function loadQuotaInfo() {
  638. try {
  639. const response = await uni.request({
  640. url: '/api/subscription/audio-balance',
  641. method: 'GET'
  642. });
  643. const res = response.data as any;
  644. if (res.code === 0 && res.data) {
  645. quotaInfo.value = {
  646. totalMinutes: res.data.totalMinutes,
  647. usedMinutes: res.data.usedMinutes,
  648. remainingMinutes: res.data.remainingMinutes,
  649. overageEnabled: res.data.overageEnabled
  650. };
  651. }
  652. } catch (e) {
  653. console.error('加载配额信息失败:', e);
  654. }
  655. }
  656. // 生成大纲
  657. async function handleGenerateOutline() {
  658. if (!currentBook.value) return;
  659. generating.value = true;
  660. try {
  661. const outline = await api.generateOutline(currentBook.value.id);
  662. currentBook.value.outline = outline;
  663. currentBook.value.status = 'planning';
  664. // 初始化章节状态
  665. currentBook.value.chapters = outline.chapters.map((c) => ({
  666. id: '',
  667. bookId: currentBook.value!.id,
  668. number: c.number,
  669. title: c.title,
  670. content: '',
  671. wordCount: 0,
  672. status: 'pending' as const,
  673. }));
  674. uni.showToast({ title: '大纲生成成功', icon: 'success' });
  675. } catch (e: any) {
  676. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  677. } finally {
  678. generating.value = false;
  679. }
  680. }
  681. // 一键生成整本书(大纲+章节+前言+后记)- 异步模式
  682. let pollTimer: ReturnType<typeof setInterval> | null = null;
  683. async function handleGenerateAll() {
  684. if (!currentBook.value) return;
  685. generating.value = true;
  686. currentBook.value.status = 'generating';
  687. currentBook.value.progress = 0;
  688. try {
  689. // 启动异步生成任务(立即返回)
  690. await api.generateBook(currentBook.value.id, {
  691. generateForeword: true,
  692. generateAfterword: true,
  693. });
  694. // 显示提示
  695. uni.showToast({ title: '生成任务已启动,请稍候...', icon: 'none', duration: 2000 });
  696. // 开始轮询进度
  697. startPollingProgress(currentBook.value.id);
  698. } catch (e: any) {
  699. generating.value = false;
  700. currentBook.value.status = 'failed';
  701. uni.showToast({ title: e.message || '启动失败', icon: 'none' });
  702. }
  703. }
  704. // 轮询进度
  705. function startPollingProgress(bookId: string) {
  706. // 停止之前的轮询
  707. stopPollingProgress();
  708. pollTimer = setInterval(async () => {
  709. try {
  710. // 直接轮询书籍进度,不依赖工作流
  711. const progress = await api.getProgress(bookId);
  712. if (!progress) {
  713. return;
  714. }
  715. // 更新进度
  716. if (currentBook.value) {
  717. currentBook.value.progress = progress.progress;
  718. currentBook.value.status = progress.status as any;
  719. }
  720. // 检查是否完成
  721. if (progress.status === 'completed' || progress.status === 'failed') {
  722. stopPollingProgress();
  723. generating.value = false;
  724. // 刷新书籍详情
  725. currentBook.value = await api.getBook(bookId);
  726. if (progress.status === 'completed') {
  727. uni.showToast({ title: '整本书生成完成!', icon: 'success' });
  728. } else if (progress.status === 'failed') {
  729. uni.showToast({ title: '生成过程中有错误', icon: 'none' });
  730. }
  731. }
  732. } catch (e) {
  733. console.error('轮询进度失败:', e);
  734. }
  735. }, 3000); // 每3秒轮询一次
  736. }
  737. // 停止轮询
  738. function stopPollingProgress() {
  739. if (pollTimer) {
  740. clearInterval(pollTimer);
  741. pollTimer = null;
  742. }
  743. }
  744. // LangGraph 生成
  745. async function handleLangGraphGenerate() {
  746. if (!currentBook.value) return;
  747. generating.value = true;
  748. currentBook.value.status = 'generating';
  749. currentBook.value.progress = 0;
  750. try {
  751. const result = await api.generateWithLangGraph(currentBook.value.id);
  752. uni.showToast({ title: 'LangGraph 生成已启动', icon: 'none', duration: 2000 });
  753. startPollingProgress(currentBook.value.id);
  754. } catch (e: any) {
  755. generating.value = false;
  756. currentBook.value.status = 'failed';
  757. uni.showToast({ title: e.message || '启动失败', icon: 'none' });
  758. }
  759. }
  760. // 生成全部章节
  761. async function handleGenerateAllChapters() {
  762. if (!currentBook.value || !currentBook.value.outline) {
  763. uni.showToast({ title: '请先生成大纲', icon: 'none' });
  764. return;
  765. }
  766. generating.value = true;
  767. currentBook.value.status = 'generating';
  768. try {
  769. for (const outlineChapter of currentBook.value.outline.chapters) {
  770. try {
  771. const chapter = await api.generateChapter(currentBook.value.id, outlineChapter.number);
  772. // 更新章节
  773. const idx = currentBook.value.chapters.findIndex((c) => c.number === chapter.number);
  774. if (idx >= 0) {
  775. currentBook.value.chapters[idx] = chapter;
  776. }
  777. // 更新进度
  778. const completed = currentBook.value.chapters.filter((c) => c.status === 'completed').length;
  779. currentBook.value.progress = Math.round((completed / currentBook.value.totalChapters) * 100);
  780. } catch (e) {
  781. console.error(`生成第${outlineChapter.number}章失败:`, e);
  782. }
  783. }
  784. currentBook.value.status = 'completed';
  785. uni.showToast({ title: '全部章节生成完成', icon: 'success' });
  786. } catch (e: any) {
  787. currentBook.value.status = 'failed';
  788. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  789. } finally {
  790. generating.value = false;
  791. }
  792. }
  793. // 生成前言
  794. async function handleGenerateForeword() {
  795. if (!currentBook.value) return;
  796. generating.value = true;
  797. try {
  798. const foreword = await api.generateForeword(currentBook.value.id);
  799. currentBook.value.metadata = currentBook.value.metadata || {};
  800. currentBook.value.metadata.foreword = foreword;
  801. uni.showToast({ title: '前言生成成功', icon: 'success' });
  802. } catch (e: any) {
  803. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  804. } finally {
  805. generating.value = false;
  806. }
  807. }
  808. // 生成后记
  809. async function handleGenerateAfterword() {
  810. if (!currentBook.value) return;
  811. generating.value = true;
  812. try {
  813. const afterword = await api.generateAfterword(currentBook.value.id);
  814. currentBook.value.metadata = currentBook.value.metadata || {};
  815. currentBook.value.metadata.afterword = afterword;
  816. uni.showToast({ title: '后记生成成功', icon: 'success' });
  817. } catch (e: any) {
  818. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  819. } finally {
  820. generating.value = false;
  821. }
  822. }
  823. // 跳转到章节详情页
  824. function goToChapterDetail(chapter: Chapter) {
  825. if (!currentBook.value) return;
  826. // 跳转到独立的章节详情页面
  827. uni.navigateTo({
  828. url: `/pages/book-generator/chapter-detail?bookId=${encodeURIComponent(currentBook.value.id)}&chapter=${chapter.number}`
  829. });
  830. }
  831. // 查看前言
  832. function viewForeword() {
  833. uni.showModal({
  834. title: '前言',
  835. content: currentBook.value?.metadata?.foreword || '',
  836. showCancel: true,
  837. cancelText: '关闭',
  838. confirmText: '复制',
  839. success: (res) => {
  840. if (res.confirm) {
  841. uni.setClipboardData({
  842. data: currentBook.value?.metadata?.foreword || '',
  843. success: () => {
  844. uni.showToast({ title: '已复制', icon: 'success' });
  845. }
  846. });
  847. }
  848. }
  849. });
  850. }
  851. // 查看后记
  852. function viewAfterword() {
  853. uni.showModal({
  854. title: '后记',
  855. content: currentBook.value?.metadata?.afterword || '',
  856. showCancel: true,
  857. cancelText: '关闭',
  858. confirmText: '复制',
  859. success: (res) => {
  860. if (res.confirm) {
  861. uni.setClipboardData({
  862. data: currentBook.value?.metadata?.afterword || '',
  863. success: () => {
  864. uni.showToast({ title: '已复制', icon: 'success' });
  865. }
  866. });
  867. }
  868. }
  869. });
  870. }
  871. // ============ 音频生成 ============
  872. /**
  873. * 生成单个章节音频
  874. */
  875. async function handleGenerateChapterAudio(chapter: Chapter) {
  876. if (!currentBook.value) return;
  877. generatingAudio.value = true;
  878. try {
  879. await api.generateChapterAudio(currentBook.value.id, chapter.number, 'cherry');
  880. uni.showToast({ title: '音频生成任务已启动', icon: 'none', duration: 2000 });
  881. // 3秒后刷新书籍信息,检查音频是否生成完成
  882. setTimeout(async () => {
  883. if (currentBook.value) {
  884. currentBook.value = await api.getBook(currentBook.value.id);
  885. }
  886. }, 3000);
  887. } catch (e: any) {
  888. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  889. } finally {
  890. generatingAudio.value = false;
  891. }
  892. }
  893. /**
  894. * 批量生成书籍所有章节音频
  895. */
  896. async function handleGenerateAllAudio(book: Book) {
  897. generatingAudio.value = true;
  898. try {
  899. const result = await api.generateAllChaptersAudio(book.id, 'cherry');
  900. uni.showToast({
  901. title: `已启动 ${result.totalChapters} 个章节的音频生成`,
  902. icon: 'none',
  903. duration: 2500,
  904. });
  905. // 5秒后刷新书籍信息
  906. setTimeout(async () => {
  907. await loadBooks();
  908. if (currentBook.value?.id === book.id) {
  909. currentBook.value = await api.getBook(book.id);
  910. }
  911. }, 5000);
  912. } catch (e: any) {
  913. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  914. } finally {
  915. generatingAudio.value = false;
  916. }
  917. }
  918. // ============ 视频生成 ============
  919. /**
  920. * 生成单个章节视频
  921. */
  922. async function handleGenerateChapterVideo(chapter: Chapter) {
  923. if (!currentBook.value) return;
  924. generatingVideo.value = true;
  925. try {
  926. await api.generateChapterVideo(currentBook.value.id, chapter.number);
  927. uni.showToast({ title: '视频生成任务已启动', icon: 'none', duration: 2000 });
  928. // 3秒后刷新书籍信息,检查视频是否生成完成
  929. setTimeout(async () => {
  930. if (currentBook.value) {
  931. currentBook.value = await api.getBook(currentBook.value.id);
  932. }
  933. }, 3000);
  934. } catch (e: any) {
  935. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  936. } finally {
  937. generatingVideo.value = false;
  938. }
  939. }
  940. /**
  941. * 批量生成书籍所有章节视频
  942. */
  943. async function handleGenerateAllVideo(book: Book) {
  944. generatingVideo.value = true;
  945. try {
  946. const result = await api.generateAllChaptersVideo(book.id);
  947. uni.showToast({
  948. title: `已启动 ${result.totalChapters} 个章节的视频生成`,
  949. icon: 'none',
  950. duration: 2500,
  951. });
  952. // 5秒后刷新书籍信息
  953. setTimeout(async () => {
  954. await loadBooks();
  955. if (currentBook.value?.id === book.id) {
  956. currentBook.value = await api.getBook(book.id);
  957. }
  958. }, 5000);
  959. } catch (e: any) {
  960. uni.showToast({ title: e.message || '生成失败', icon: 'none' });
  961. } finally {
  962. generatingVideo.value = false;
  963. }
  964. }
  965. // 页面加载
  966. onMounted(() => {
  967. loadBooks();
  968. });
  969. </script>
  970. <style scoped>
  971. .page {
  972. min-height: 100vh;
  973. background: #f9fafb;
  974. }
  975. .nav-bar {
  976. position: fixed;
  977. top: 0;
  978. left: 0;
  979. right: 0;
  980. z-index: 100;
  981. background: #ffffff;
  982. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  983. }
  984. .nav-content {
  985. display: flex;
  986. align-items: center;
  987. justify-content: space-between;
  988. height: 88rpx;
  989. padding: 0 32rpx;
  990. padding-top: env(safe-area-inset-top);
  991. }
  992. .nav-left,
  993. .nav-right {
  994. width: 80rpx;
  995. }
  996. .back-icon,
  997. .nav-btn {
  998. font-size: 40rpx;
  999. color: #1f2937;
  1000. }
  1001. .page-title {
  1002. font-size: 32rpx;
  1003. font-weight: 600;
  1004. color: #1f2937;
  1005. }
  1006. .main-content {
  1007. padding: 120rpx 32rpx 32rpx;
  1008. }
  1009. /* 卡片样式 */
  1010. .card {
  1011. background: #ffffff;
  1012. border-radius: 24rpx;
  1013. padding: 32rpx;
  1014. margin-bottom: 24rpx;
  1015. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  1016. }
  1017. .card-header {
  1018. margin-bottom: 24rpx;
  1019. }
  1020. .card-header-row {
  1021. display: flex;
  1022. align-items: center;
  1023. justify-content: space-between;
  1024. margin-bottom: 24rpx;
  1025. }
  1026. .card-title {
  1027. font-size: 32rpx;
  1028. font-weight: 600;
  1029. color: #1f2937;
  1030. }
  1031. /* 创建卡片 */
  1032. .create-card {
  1033. display: flex;
  1034. align-items: center;
  1035. justify-content: center;
  1036. gap: 16rpx;
  1037. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  1038. border-radius: 24rpx;
  1039. padding: 48rpx;
  1040. margin-bottom: 24rpx;
  1041. }
  1042. .create-icon {
  1043. font-size: 48rpx;
  1044. color: #ffffff;
  1045. }
  1046. .create-text {
  1047. font-size: 32rpx;
  1048. font-weight: 600;
  1049. color: #ffffff;
  1050. }
  1051. /* 视频导航卡片 */
  1052. .video-nav-card {
  1053. display: flex;
  1054. align-items: center;
  1055. justify-content: space-between;
  1056. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  1057. border-radius: 24rpx;
  1058. padding: 36rpx;
  1059. margin-bottom: 24rpx;
  1060. }
  1061. .video-nav-content {
  1062. display: flex;
  1063. align-items: center;
  1064. gap: 24rpx;
  1065. }
  1066. .video-nav-icon {
  1067. font-size: 56rpx;
  1068. }
  1069. .video-nav-text {
  1070. display: flex;
  1071. flex-direction: column;
  1072. gap: 6rpx;
  1073. }
  1074. .video-nav-title {
  1075. font-size: 30rpx;
  1076. font-weight: 600;
  1077. color: #ffffff;
  1078. }
  1079. .video-nav-desc {
  1080. font-size: 22rpx;
  1081. color: rgba(255, 255, 255, 0.8);
  1082. }
  1083. .video-nav-arrow {
  1084. font-size: 40rpx;
  1085. color: #ffffff;
  1086. }
  1087. /* 书籍列表 */
  1088. .book-list {
  1089. display: flex;
  1090. flex-direction: column;
  1091. gap: 20rpx;
  1092. }
  1093. .book-card {
  1094. background: #ffffff;
  1095. border-radius: 20rpx;
  1096. padding: 28rpx;
  1097. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  1098. }
  1099. .book-header {
  1100. display: flex;
  1101. align-items: center;
  1102. justify-content: space-between;
  1103. margin-bottom: 12rpx;
  1104. }
  1105. .book-title {
  1106. font-size: 30rpx;
  1107. font-weight: 600;
  1108. color: #1f2937;
  1109. flex: 1;
  1110. }
  1111. .status-badge {
  1112. font-size: 22rpx;
  1113. padding: 6rpx 16rpx;
  1114. border-radius: 20rpx;
  1115. background: #e5e7eb;
  1116. color: #6b7280;
  1117. }
  1118. .status-badge.planning,
  1119. .status-badge.generating {
  1120. background: #fef3c7;
  1121. color: #d97706;
  1122. }
  1123. .status-badge.completed {
  1124. background: #d1fae5;
  1125. color: #059669;
  1126. }
  1127. .status-badge.failed {
  1128. background: #fee2e2;
  1129. color: #dc2626;
  1130. }
  1131. .book-desc {
  1132. font-size: 26rpx;
  1133. color: #6b7280;
  1134. display: -webkit-box;
  1135. -webkit-line-clamp: 2;
  1136. -webkit-box-orient: vertical;
  1137. overflow: hidden;
  1138. margin-bottom: 16rpx;
  1139. }
  1140. .book-meta {
  1141. display: flex;
  1142. gap: 24rpx;
  1143. font-size: 24rpx;
  1144. color: #9ca3af;
  1145. margin-bottom: 12rpx;
  1146. }
  1147. .progress-bar {
  1148. height: 6rpx;
  1149. background: #e5e7eb;
  1150. border-radius: 3rpx;
  1151. }
  1152. .progress-fill {
  1153. height: 100%;
  1154. background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  1155. border-radius: 3rpx;
  1156. transition: width 0.3s;
  1157. }
  1158. /* 空状态 */
  1159. .empty-state {
  1160. display: flex;
  1161. flex-direction: column;
  1162. align-items: center;
  1163. padding: 80rpx 0;
  1164. }
  1165. .empty-icon {
  1166. font-size: 120rpx;
  1167. margin-bottom: 24rpx;
  1168. }
  1169. .empty-text {
  1170. font-size: 32rpx;
  1171. color: #6b7280;
  1172. margin-bottom: 12rpx;
  1173. }
  1174. .empty-hint {
  1175. font-size: 26rpx;
  1176. color: #9ca3af;
  1177. }
  1178. /* 表单 */
  1179. .form-item {
  1180. margin-bottom: 28rpx;
  1181. }
  1182. .form-label {
  1183. display: block;
  1184. font-size: 28rpx;
  1185. color: #374151;
  1186. margin-bottom: 12rpx;
  1187. }
  1188. .form-input {
  1189. width: 100%;
  1190. height: 88rpx;
  1191. padding: 0 24rpx;
  1192. background: #f9fafb;
  1193. border-radius: 16rpx;
  1194. font-size: 28rpx;
  1195. box-sizing: border-box;
  1196. }
  1197. .form-textarea {
  1198. width: 100%;
  1199. height: 200rpx;
  1200. padding: 24rpx;
  1201. background: #f9fafb;
  1202. border-radius: 16rpx;
  1203. font-size: 28rpx;
  1204. box-sizing: border-box;
  1205. }
  1206. .slider-range {
  1207. display: flex;
  1208. justify-content: space-between;
  1209. font-size: 24rpx;
  1210. color: #9ca3af;
  1211. margin-top: 8rpx;
  1212. }
  1213. .scale-picker {
  1214. display: flex;
  1215. flex-direction: column;
  1216. gap: 12rpx;
  1217. margin-top: 12rpx;
  1218. }
  1219. .scale-option {
  1220. display: flex;
  1221. align-items: center;
  1222. padding: 20rpx 16rpx;
  1223. border: 2rpx solid #e5e7eb;
  1224. border-radius: 12rpx;
  1225. background: #f9fafb;
  1226. transition: all 0.2s;
  1227. }
  1228. .scale-option.active {
  1229. border-color: #4F46E5;
  1230. background: #eef2ff;
  1231. }
  1232. .scale-label {
  1233. font-size: 28rpx;
  1234. font-weight: 600;
  1235. color: #374151;
  1236. min-width: 160rpx;
  1237. margin-left: 24rpx;
  1238. }
  1239. .scale-option.active .scale-label {
  1240. color: #4F46E5;
  1241. }
  1242. .scale-words {
  1243. font-size: 28rpx;
  1244. color: #374151;
  1245. min-width: 160rpx;
  1246. font-weight: 500;
  1247. }
  1248. .scale-pages {
  1249. font-size: 22rpx;
  1250. color: #6b7280;
  1251. flex: 1;
  1252. text-align: right;
  1253. }
  1254. /* 预估信息卡片 */
  1255. .estimate-card {
  1256. background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  1257. border-radius: 16rpx;
  1258. padding: 24rpx;
  1259. margin-top: 20rpx;
  1260. border: 1px solid #fcd34d;
  1261. }
  1262. .estimate-header {
  1263. margin-bottom: 16rpx;
  1264. }
  1265. .estimate-title {
  1266. font-size: 28rpx;
  1267. font-weight: 600;
  1268. color: #92400e;
  1269. }
  1270. .estimate-row {
  1271. display: flex;
  1272. justify-content: space-between;
  1273. align-items: center;
  1274. padding: 8rpx 0;
  1275. }
  1276. .estimate-label {
  1277. font-size: 26rpx;
  1278. color: #78350f;
  1279. }
  1280. .estimate-value {
  1281. font-size: 26rpx;
  1282. font-weight: 600;
  1283. color: #92400e;
  1284. }
  1285. /* 配额检查结果 */
  1286. .quota-check {
  1287. margin-top: 16rpx;
  1288. padding-top: 16rpx;
  1289. border-top: 1px dashed #fcd34d;
  1290. }
  1291. .quota-ok, .quota-warning {
  1292. display: flex;
  1293. align-items: center;
  1294. gap: 12rpx;
  1295. padding: 12rpx 16rpx;
  1296. border-radius: 12rpx;
  1297. margin-bottom: 12rpx;
  1298. }
  1299. .quota-ok {
  1300. background: rgba(16, 185, 129, 0.1);
  1301. }
  1302. .quota-warning {
  1303. background: rgba(245, 158, 11, 0.1);
  1304. }
  1305. .quota-icon {
  1306. font-size: 32rpx;
  1307. }
  1308. .quota-text {
  1309. font-size: 26rpx;
  1310. color: #374151;
  1311. }
  1312. .quota-detail {
  1313. padding: 8rpx 0;
  1314. }
  1315. .quota-info {
  1316. font-size: 24rpx;
  1317. color: #6b7280;
  1318. }
  1319. .quota-overage {
  1320. display: flex;
  1321. justify-content: space-between;
  1322. align-items: center;
  1323. margin-top: 8rpx;
  1324. padding: 8rpx 12rpx;
  1325. background: rgba(239, 68, 68, 0.1);
  1326. border-radius: 8rpx;
  1327. }
  1328. .quota-overage text {
  1329. font-size: 24rpx;
  1330. color: #dc2626;
  1331. }
  1332. .quota-price {
  1333. font-weight: 600;
  1334. }
  1335. /* 标签组 */
  1336. .chip-group {
  1337. display: flex;
  1338. flex-wrap: wrap;
  1339. gap: 16rpx;
  1340. }
  1341. .chip {
  1342. padding: 12rpx 24rpx;
  1343. background: #f3f4f6;
  1344. border-radius: 30rpx;
  1345. font-size: 26rpx;
  1346. color: #6b7280;
  1347. }
  1348. .chip.active {
  1349. background: #4f46e5;
  1350. color: #ffffff;
  1351. }
  1352. /* 按钮组 */
  1353. .btn-group {
  1354. display: flex;
  1355. gap: 20rpx;
  1356. margin-top: 32rpx;
  1357. }
  1358. .btn-cancel,
  1359. .btn-primary {
  1360. flex: 1;
  1361. height: 88rpx;
  1362. border-radius: 16rpx;
  1363. font-size: 28rpx;
  1364. display: flex;
  1365. align-items: center;
  1366. justify-content: center;
  1367. border: none;
  1368. }
  1369. .btn-cancel {
  1370. background: #f3f4f6;
  1371. color: #6b7280;
  1372. }
  1373. .btn-primary {
  1374. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  1375. color: #ffffff;
  1376. }
  1377. .btn-primary[disabled] {
  1378. opacity: 0.6;
  1379. }
  1380. /* 详情页 */
  1381. .book-info {
  1382. margin-bottom: 24rpx;
  1383. }
  1384. .book-title-row {
  1385. display: flex;
  1386. align-items: center;
  1387. justify-content: space-between;
  1388. margin-bottom: 8rpx;
  1389. }
  1390. .book-title-large {
  1391. font-size: 36rpx;
  1392. font-weight: 700;
  1393. color: #1f2937;
  1394. flex: 1;
  1395. }
  1396. .book-subtitle {
  1397. font-size: 28rpx;
  1398. color: #6b7280;
  1399. margin-bottom: 16rpx;
  1400. }
  1401. .book-meta-row {
  1402. display: flex;
  1403. gap: 24rpx;
  1404. font-size: 26rpx;
  1405. color: #9ca3af;
  1406. margin-top: 16rpx;
  1407. }
  1408. /* 进度卡片 */
  1409. .progress-card {
  1410. margin-bottom: 24rpx;
  1411. }
  1412. .progress-display {
  1413. display: flex;
  1414. align-items: baseline;
  1415. gap: 16rpx;
  1416. margin: 16rpx 0;
  1417. }
  1418. .progress-text {
  1419. font-size: 48rpx;
  1420. font-weight: 700;
  1421. color: #4f46e5;
  1422. }
  1423. .progress-detail {
  1424. font-size: 28rpx;
  1425. color: #6b7280;
  1426. }
  1427. .progress-bar-large {
  1428. height: 12rpx;
  1429. background: #e5e7eb;
  1430. border-radius: 6rpx;
  1431. }
  1432. /* 大纲卡片 */
  1433. .outline-theme {
  1434. font-size: 24rpx;
  1435. color: #6b7280;
  1436. }
  1437. .outline-list {
  1438. margin-top: 20rpx;
  1439. }
  1440. .outline-item {
  1441. display: flex;
  1442. align-items: flex-start;
  1443. gap: 20rpx;
  1444. padding: 20rpx 0;
  1445. border-bottom: 1px solid #f3f4f6;
  1446. }
  1447. .outline-item:last-child {
  1448. border-bottom: none;
  1449. }
  1450. .chapter-num {
  1451. width: 48rpx;
  1452. height: 48rpx;
  1453. background: #4f46e5;
  1454. color: #ffffff;
  1455. border-radius: 50%;
  1456. display: flex;
  1457. align-items: center;
  1458. justify-content: center;
  1459. font-size: 24rpx;
  1460. font-weight: 600;
  1461. flex-shrink: 0;
  1462. }
  1463. .chapter-info {
  1464. flex: 1;
  1465. }
  1466. .chapter-title {
  1467. font-size: 28rpx;
  1468. font-weight: 600;
  1469. color: #1f2937;
  1470. margin-bottom: 6rpx;
  1471. display: block;
  1472. }
  1473. .chapter-summary {
  1474. font-size: 24rpx;
  1475. color: #6b7280;
  1476. display: block;
  1477. margin-bottom: 10rpx;
  1478. }
  1479. .chapter-points {
  1480. display: flex;
  1481. flex-wrap: wrap;
  1482. gap: 8rpx;
  1483. }
  1484. .point-tag {
  1485. font-size: 20rpx;
  1486. padding: 4rpx 12rpx;
  1487. background: #f3f4f6;
  1488. color: #6b7280;
  1489. border-radius: 6rpx;
  1490. }
  1491. .chapter-status {
  1492. font-size: 28rpx;
  1493. color: #9ca3af;
  1494. flex-shrink: 0;
  1495. }
  1496. .chapter-status.done {
  1497. color: #059669;
  1498. }
  1499. /* 操作卡片 */
  1500. .action-card {
  1501. margin-bottom: 24rpx;
  1502. }
  1503. .btn-row {
  1504. display: flex;
  1505. gap: 16rpx;
  1506. margin-bottom: 20rpx;
  1507. }
  1508. .action-btn {
  1509. flex: 1;
  1510. height: 88rpx;
  1511. background: #f3f4f6;
  1512. border-radius: 16rpx;
  1513. font-size: 28rpx;
  1514. color: #374151;
  1515. display: flex;
  1516. align-items: center;
  1517. justify-content: center;
  1518. border: none;
  1519. }
  1520. .action-btn.primary {
  1521. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  1522. color: #ffffff;
  1523. }
  1524. .action-btn.full-width {
  1525. width: 100%;
  1526. flex: none;
  1527. margin-bottom: 16rpx;
  1528. }
  1529. .action-btn[disabled] {
  1530. opacity: 0.6;
  1531. }
  1532. .generating-tip {
  1533. text-align: center;
  1534. padding: 20rpx;
  1535. color: #6b7280;
  1536. font-size: 26rpx;
  1537. }
  1538. /* LangGraph 按钮 */
  1539. .action-btn.langgraph-btn {
  1540. background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  1541. color: #ffffff;
  1542. }
  1543. /* 全屏弹窗 */
  1544. .modal-overlay {
  1545. position: fixed;
  1546. top: 0;
  1547. left: 0;
  1548. right: 0;
  1549. bottom: 0;
  1550. background: rgba(0, 0, 0, 0.5);
  1551. z-index: 1000;
  1552. display: flex;
  1553. align-items: flex-end;
  1554. }
  1555. .content-modal {
  1556. width: 100%;
  1557. height: 90vh;
  1558. background: #ffffff;
  1559. border-radius: 32rpx 32rpx 0 0;
  1560. display: flex;
  1561. flex-direction: column;
  1562. }
  1563. .modal-header {
  1564. display: flex;
  1565. align-items: center;
  1566. justify-content: space-between;
  1567. padding: 32rpx;
  1568. border-bottom: 1px solid #f3f4f6;
  1569. flex-shrink: 0;
  1570. }
  1571. .modal-title {
  1572. font-size: 32rpx;
  1573. font-weight: 600;
  1574. color: #1f2937;
  1575. }
  1576. .modal-close {
  1577. font-size: 40rpx;
  1578. color: #9ca3af;
  1579. padding: 8rpx;
  1580. }
  1581. .content-scroll {
  1582. flex: 1;
  1583. padding: 32rpx;
  1584. }
  1585. .content-body {
  1586. font-size: 28rpx;
  1587. line-height: 1.8;
  1588. color: #374151;
  1589. }
  1590. /* ==================== 目录视图 ==================== */
  1591. .toc-view {
  1592. position: fixed;
  1593. top: 0;
  1594. left: 0;
  1595. right: 0;
  1596. bottom: 0;
  1597. background: #f9fafb;
  1598. z-index: 200;
  1599. display: flex;
  1600. flex-direction: column;
  1601. }
  1602. .toc-view .nav-bar {
  1603. position: relative;
  1604. flex-shrink: 0;
  1605. }
  1606. .toc-content {
  1607. flex: 1;
  1608. padding: 24rpx 32rpx;
  1609. padding-top: calc(120rpx + env(safe-area-inset-top));
  1610. overflow-y: auto;
  1611. }
  1612. .toc-item {
  1613. display: flex;
  1614. align-items: center;
  1615. justify-content: space-between;
  1616. background: #ffffff;
  1617. border-radius: 16rpx;
  1618. padding: 28rpx 32rpx;
  1619. margin-bottom: 16rpx;
  1620. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  1621. }
  1622. .toc-item.foreword,
  1623. .toc-item.afterword {
  1624. background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  1625. }
  1626. .toc-item.foreword .toc-label,
  1627. .toc-item.afterword .toc-label {
  1628. font-size: 30rpx;
  1629. font-weight: 600;
  1630. color: #92400e;
  1631. }
  1632. .toc-item.chapter {
  1633. cursor: pointer;
  1634. }
  1635. .toc-item.chapter.pending {
  1636. opacity: 0.6;
  1637. }
  1638. .toc-item.chapter.done {
  1639. background: #ffffff;
  1640. }
  1641. .toc-left {
  1642. display: flex;
  1643. align-items: center;
  1644. gap: 20rpx;
  1645. flex: 1;
  1646. }
  1647. .toc-left .chapter-num {
  1648. width: 56rpx;
  1649. height: 56rpx;
  1650. background: #4f46e5;
  1651. color: #ffffff;
  1652. border-radius: 50%;
  1653. display: flex;
  1654. align-items: center;
  1655. justify-content: center;
  1656. font-size: 24rpx;
  1657. font-weight: 600;
  1658. flex-shrink: 0;
  1659. }
  1660. .toc-item.chapter.pending .chapter-num {
  1661. background: #9ca3af;
  1662. }
  1663. .toc-left .chapter-title {
  1664. font-size: 28rpx;
  1665. font-weight: 500;
  1666. color: #1f2937;
  1667. }
  1668. .toc-arrow {
  1669. font-size: 32rpx;
  1670. color: #9ca3af;
  1671. }
  1672. /* ==================== 章节详情视图 ==================== */
  1673. .chapter-detail-view {
  1674. position: fixed;
  1675. top: 0;
  1676. left: 0;
  1677. right: 0;
  1678. bottom: 0;
  1679. background: #f9fafb;
  1680. z-index: 200;
  1681. display: flex;
  1682. flex-direction: column;
  1683. }
  1684. .chapter-detail-view .nav-bar {
  1685. position: relative;
  1686. flex-shrink: 0;
  1687. }
  1688. .chapter-content {
  1689. flex: 1;
  1690. padding-top: calc(88rpx + env(safe-area-inset-top));
  1691. overflow: hidden;
  1692. }
  1693. .chapter-scroll {
  1694. height: 100%;
  1695. padding: 32rpx;
  1696. }
  1697. .chapter-header {
  1698. margin-bottom: 32rpx;
  1699. padding-bottom: 24rpx;
  1700. border-bottom: 1px solid #e5e7eb;
  1701. }
  1702. .chapter-title-large {
  1703. display: block;
  1704. font-size: 36rpx;
  1705. font-weight: 700;
  1706. color: #1f2937;
  1707. margin-bottom: 12rpx;
  1708. }
  1709. .chapter-word-count {
  1710. font-size: 24rpx;
  1711. color: #9ca3af;
  1712. }
  1713. .chapter-body {
  1714. background: #ffffff;
  1715. border-radius: 16rpx;
  1716. padding: 32rpx;
  1717. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  1718. }
  1719. .chapter-text {
  1720. font-size: 30rpx;
  1721. line-height: 1.9;
  1722. color: #374151;
  1723. text-align: justify;
  1724. }
  1725. /* ==================== 完整内容区样式 ==================== */
  1726. .content-card {
  1727. margin-top: 0;
  1728. }
  1729. .content-item {
  1730. display: flex;
  1731. align-items: center;
  1732. justify-content: space-between;
  1733. padding: 24rpx;
  1734. background: #f9fafb;
  1735. border-radius: 16rpx;
  1736. margin-top: 16rpx;
  1737. }
  1738. .content-item.foreword,
  1739. .content-item.afterword {
  1740. background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  1741. cursor: pointer;
  1742. }
  1743. .content-item-header {
  1744. display: flex;
  1745. align-items: center;
  1746. justify-content: space-between;
  1747. flex: 1;
  1748. cursor: pointer;
  1749. }
  1750. .content-item-left {
  1751. display: flex;
  1752. align-items: center;
  1753. gap: 16rpx;
  1754. flex: 1;
  1755. }
  1756. .content-item-right {
  1757. flex-shrink: 0;
  1758. margin-left: 16rpx;
  1759. }
  1760. .content-label {
  1761. font-size: 30rpx;
  1762. font-weight: 600;
  1763. color: #92400e;
  1764. }
  1765. .content-item.foreword .content-label,
  1766. .content-item.afterword .content-label {
  1767. color: #92400e;
  1768. }
  1769. .chapter-num-badge {
  1770. font-size: 24rpx;
  1771. font-weight: 600;
  1772. color: #ffffff;
  1773. background: #4f46e5;
  1774. padding: 6rpx 12rpx;
  1775. border-radius: 8rpx;
  1776. }
  1777. .chapter-title-short {
  1778. font-size: 28rpx;
  1779. font-weight: 500;
  1780. color: #1f2937;
  1781. flex: 1;
  1782. }
  1783. .audio-badge,
  1784. .video-badge {
  1785. font-size: 24rpx;
  1786. }
  1787. .content-word-count {
  1788. font-size: 22rpx;
  1789. color: #9ca3af;
  1790. }
  1791. .expand-icon {
  1792. font-size: 24rpx;
  1793. color: #9ca3af;
  1794. }
  1795. .content-body {
  1796. padding: 24rpx;
  1797. background: #ffffff;
  1798. border-radius: 12rpx;
  1799. margin-top: 12rpx;
  1800. border: 1px solid #e5e7eb;
  1801. }
  1802. .content-meta {
  1803. display: flex;
  1804. align-items: center;
  1805. justify-content: space-between;
  1806. margin-bottom: 16rpx;
  1807. padding-bottom: 16rpx;
  1808. border-bottom: 1px solid #f3f4f6;
  1809. }
  1810. .content-actions {
  1811. display: flex;
  1812. gap: 12rpx;
  1813. }
  1814. .mini-btn {
  1815. padding: 8rpx 16rpx;
  1816. border-radius: 8rpx;
  1817. font-size: 22rpx;
  1818. border: none;
  1819. }
  1820. .mini-btn.audio-btn {
  1821. background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  1822. color: #ffffff;
  1823. }
  1824. .mini-btn.video-btn {
  1825. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  1826. color: #ffffff;
  1827. }
  1828. .content-text {
  1829. font-size: 28rpx;
  1830. line-height: 1.9;
  1831. color: #374151;
  1832. text-align: justify;
  1833. white-space: pre-wrap;
  1834. }
  1835. /* ==================== 音频生成相关样式 ==================== */
  1836. /* 书籍卡片操作区 */
  1837. .book-actions {
  1838. margin-top: 20rpx;
  1839. padding-top: 20rpx;
  1840. border-top: 1px solid #f3f4f6;
  1841. }
  1842. .audio-btn {
  1843. width: 100%;
  1844. height: 72rpx;
  1845. background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  1846. border-radius: 12rpx;
  1847. font-size: 26rpx;
  1848. color: #ffffff;
  1849. display: flex;
  1850. align-items: center;
  1851. justify-content: center;
  1852. border: none;
  1853. }
  1854. .audio-btn[disabled] {
  1855. opacity: 0.6;
  1856. }
  1857. /* 视频按钮样式 */
  1858. .video-btn {
  1859. width: 100%;
  1860. height: 72rpx;
  1861. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  1862. border-radius: 12rpx;
  1863. font-size: 26rpx;
  1864. color: #ffffff;
  1865. display: flex;
  1866. align-items: center;
  1867. justify-content: center;
  1868. border: none;
  1869. margin-top: 16rpx;
  1870. }
  1871. .video-btn[disabled] {
  1872. opacity: 0.6;
  1873. }
  1874. /* 目录项操作区 */
  1875. .toc-actions {
  1876. display: flex;
  1877. align-items: center;
  1878. gap: 16rpx;
  1879. }
  1880. .chapter-info-col {
  1881. display: flex;
  1882. flex-direction: column;
  1883. gap: 6rpx;
  1884. }
  1885. .audio-status {
  1886. font-size: 20rpx;
  1887. color: #059669;
  1888. }
  1889. .mini-audio-btn {
  1890. width: 64rpx;
  1891. height: 64rpx;
  1892. background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  1893. border-radius: 50%;
  1894. font-size: 28rpx;
  1895. display: flex;
  1896. align-items: center;
  1897. justify-content: center;
  1898. border: none;
  1899. padding: 0;
  1900. }
  1901. .mini-audio-btn[disabled] {
  1902. opacity: 0.6;
  1903. }
  1904. .mini-video-btn {
  1905. width: 64rpx;
  1906. height: 64rpx;
  1907. background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  1908. border-radius: 50%;
  1909. font-size: 28rpx;
  1910. display: flex;
  1911. align-items: center;
  1912. justify-content: center;
  1913. border: none;
  1914. padding: 0;
  1915. }
  1916. .mini-video-btn[disabled] {
  1917. opacity: 0.6;
  1918. }
  1919. .video-status {
  1920. font-size: 20rpx;
  1921. color: #f5576c;
  1922. }
  1923. /* 额度监控 */
  1924. .quota-monitor {
  1925. margin-top: 20rpx;
  1926. padding: 16rpx;
  1927. background: rgba(16, 185, 129, 0.1);
  1928. border-radius: 12rpx;
  1929. }
  1930. .quota-monitor-title {
  1931. font-size: 24rpx;
  1932. font-weight: 600;
  1933. color: #059669;
  1934. margin-bottom: 8rpx;
  1935. display: block;
  1936. }
  1937. .quota-monitor-row {
  1938. display: flex;
  1939. justify-content: space-between;
  1940. font-size: 24rpx;
  1941. color: #374151;
  1942. }
  1943. .quota-overage-warning {
  1944. margin-top: 8rpx;
  1945. padding: 8rpx 12rpx;
  1946. background: rgba(239, 68, 68, 0.1);
  1947. border-radius: 8rpx;
  1948. }
  1949. .quota-overage-warning text {
  1950. font-size: 22rpx;
  1951. color: #dc2626;
  1952. }
  1953. /* 中断提示 */
  1954. .interrupted-tip {
  1955. margin-top: 20rpx;
  1956. padding: 20rpx;
  1957. background: rgba(245, 158, 11, 0.1);
  1958. border: 1px solid #fbbf24;
  1959. border-radius: 12rpx;
  1960. display: flex;
  1961. flex-direction: column;
  1962. gap: 8rpx;
  1963. }
  1964. .interrupted-icon {
  1965. font-size: 36rpx;
  1966. }
  1967. .interrupted-text {
  1968. font-size: 26rpx;
  1969. color: #92400e;
  1970. font-weight: 600;
  1971. }
  1972. .interrupted-hint {
  1973. font-size: 24rpx;
  1974. color: #b45309;
  1975. }
  1976. /* 无章节警告 */
  1977. .warning-tip {
  1978. margin-top: 20rpx;
  1979. padding: 24rpx;
  1980. background: rgba(239, 68, 68, 0.1);
  1981. border: 1px solid #fca5a5;
  1982. border-radius: 12rpx;
  1983. display: flex;
  1984. flex-direction: column;
  1985. align-items: center;
  1986. gap: 12rpx;
  1987. }
  1988. .warning-icon {
  1989. font-size: 48rpx;
  1990. }
  1991. .warning-text {
  1992. font-size: 26rpx;
  1993. color: #dc2626;
  1994. text-align: center;
  1995. font-weight: 500;
  1996. }
  1997. .warning-hint {
  1998. font-size: 24rpx;
  1999. color: #991b1b;
  2000. margin-bottom: 8rpx;
  2001. }
  2002. .warning-tip .action-btn {
  2003. margin-top: 8rpx;
  2004. width: 100%;
  2005. }
  2006. </style>