ArticleAudit.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <view class="article-audit" v-if="data">
  3. <!-- 文章审核表单 -->
  4. <view class="info-section">
  5. <view class="section-header">
  6. <view class="section-indicator"></view>
  7. <text class="section-title">文章信息</text>
  8. </view>
  9. <view class="info-list">
  10. <!-- 基本信息 -->
  11. <view class="info-item">
  12. <text class="info-label">标题</text>
  13. <text class="info-value">{{ data.title || '-' }}</text>
  14. </view>
  15. <view class="info-item">
  16. <text class="info-label">公司</text>
  17. <text class="info-value">{{ data.companyName || '-' }}</text>
  18. </view>
  19. <view class="info-item">
  20. <text class="info-label">作者</text>
  21. <text class="info-value">{{ data.authorName || '-' }}</text>
  22. </view>
  23. <view class="info-item">
  24. <text class="info-label">分组</text>
  25. <text class="info-value">{{ data.groupName || '-' }}</text>
  26. </view>
  27. <view class="info-item">
  28. <text class="info-label">标签</text>
  29. <text class="info-value">{{ data.tags || '-' }}</text>
  30. </view>
  31. <view class="info-item">
  32. <text class="info-label">摘要</text>
  33. <text class="info-value">{{ data.summary || '-' }}</text>
  34. </view>
  35. <view class="info-item">
  36. <text class="info-label">上下架</text>
  37. <text class="info-value">{{ data.isPublish ? '上架' : '下架' }}</text>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 文章内容 -->
  42. <view class="info-section" v-if="data.articleContent || data.articleUrl">
  43. <view class="section-header">
  44. <view class="section-indicator"></view>
  45. <text class="section-title">文章内容</text>
  46. </view>
  47. <view class="article-content" v-if="data.articleContent">
  48. <!-- 直接显示文章内容 -->
  49. <view class="content-preview" @click="browseArticle">
  50. <rich-text :nodes="data.articleContent"></rich-text>
  51. <view class="browse-btn">
  52. <text>点击浏览全文</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="article-url" v-else-if="data.articleUrl">
  57. <!-- 文章链接 -->
  58. <view class="url-container" @click="openArticleUrl(data.articleUrl)">
  59. <text class="url-text">{{ data.articleUrl }}</text>
  60. <view class="open-btn">
  61. <text>打开链接</text>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 封面图 -->
  67. <view class="info-section" v-if="data.coverImageUrl">
  68. <view class="section-header">
  69. <view class="section-indicator"></view>
  70. <text class="section-title">封面图</text>
  71. </view>
  72. <view class="image-container">
  73. <image
  74. :src="data.coverImageUrl"
  75. style="width: 200rpx; height: 200rpx;"
  76. mode="aspectFill"
  77. @click="previewImage(data.coverImageUrl)"
  78. ></image>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. export default {
  85. name: 'ArticleAudit',
  86. props: {
  87. data: {
  88. type: Object,
  89. default: null
  90. }
  91. },
  92. methods: {
  93. // 浏览文章
  94. browseArticle() {
  95. if (this.data.articleContent) {
  96. // 这里可以实现浏览全文的逻辑,例如打开新页面或弹窗显示完整文章
  97. uni.showToast({
  98. title: '浏览文章功能开发中',
  99. icon: 'none'
  100. })
  101. }
  102. },
  103. // 打开文章链接
  104. openArticleUrl(url) {
  105. if (url) {
  106. uni.navigateTo({
  107. url: `/pages/common/webview?url=${encodeURIComponent(url)}`
  108. })
  109. }
  110. },
  111. // 预览图片
  112. previewImage(url) {
  113. uni.previewImage({
  114. urls: [url],
  115. current: url
  116. })
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .info-section {
  123. margin-bottom: 24rpx;
  124. background: #fff;
  125. border-radius: 16rpx;
  126. padding: 24rpx;
  127. .section-header {
  128. display: flex;
  129. align-items: center;
  130. margin-bottom: 24rpx;
  131. .section-indicator {
  132. width: 8rpx;
  133. height: 32rpx;
  134. background: #388BFF;
  135. border-radius: 4rpx;
  136. margin-right: 16rpx;
  137. }
  138. .section-title {
  139. font-size: 32rpx;
  140. font-weight: 500;
  141. color: #333;
  142. }
  143. }
  144. .info-list {
  145. .info-item {
  146. display: flex;
  147. justify-content: space-between;
  148. align-items: flex-start;
  149. margin-bottom: 20rpx;
  150. padding-bottom: 20rpx;
  151. border-bottom: 1rpx solid #F0F0F0;
  152. &:last-child {
  153. margin-bottom: 0;
  154. padding-bottom: 0;
  155. border-bottom: none;
  156. }
  157. .info-label {
  158. font-size: 28rpx;
  159. color: #666;
  160. width: 200rpx;
  161. }
  162. .info-value {
  163. font-size: 28rpx;
  164. color: #333;
  165. flex: 1;
  166. text-align: right;
  167. word-break: break-all;
  168. }
  169. }
  170. }
  171. .article-content {
  172. .content-preview {
  173. border: 1rpx solid #F0F0F0;
  174. border-radius: 8rpx;
  175. padding: 20rpx;
  176. background-color: #F9F9F9;
  177. cursor: pointer;
  178. rich-text {
  179. font-size: 28rpx;
  180. color: #333;
  181. }
  182. .browse-btn {
  183. margin-top: 20rpx;
  184. text-align: center;
  185. color: #388BFF;
  186. font-size: 28rpx;
  187. }
  188. }
  189. }
  190. .article-url {
  191. .url-container {
  192. border: 1rpx solid #F0F0F0;
  193. border-radius: 8rpx;
  194. padding: 20rpx;
  195. background-color: #F9F9F9;
  196. cursor: pointer;
  197. display: flex;
  198. justify-content: space-between;
  199. align-items: center;
  200. .url-text {
  201. font-size: 28rpx;
  202. color: #388BFF;
  203. flex: 1;
  204. word-break: break-all;
  205. }
  206. .open-btn {
  207. margin-left: 20rpx;
  208. padding: 10rpx 20rpx;
  209. background-color: #388BFF;
  210. color: #fff;
  211. border-radius: 4rpx;
  212. font-size: 24rpx;
  213. }
  214. }
  215. }
  216. .image-container {
  217. margin-top: 16rpx;
  218. display: flex;
  219. gap: 16rpx;
  220. image {
  221. border-radius: 8rpx;
  222. cursor: pointer;
  223. }
  224. }
  225. }
  226. </style>