四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
5.4 KiB

  1. <template>
  2. <uv-popup mode="bottom" ref="meaningPopup" round="32rpx" bg-color="#FFFFFF" :overlay="true" safeAreaInsetBottom>
  3. <view class="meaning-popup" v-if="currentWordMeaning">
  4. <view class="meaning-header">
  5. <view class="close-btn" @click="closeMeaningPopup">
  6. <text class="close-text">关闭</text>
  7. </view>
  8. <view class="meaning-title">释义</view>
  9. <view style="width: 80rpx;"></view>
  10. </view>
  11. <scroll-view class="meaning-scroll-container" scroll-y="true" :show-scrollbar="false" :enhanced="true">
  12. <view class="meaning-content">
  13. <image v-if="currentWordMeaning.image" class="meaning-image" :src="currentWordMeaning.image"
  14. mode="widthFix" />
  15. <view class="word-info">
  16. <view class="word-main">
  17. <text class="word-text">{{ currentWordMeaning.word }}</text>
  18. </view>
  19. <view class="phonetic-container">
  20. <uv-icon name="volume-fill" size="16" color="#007AFF" class="speaker-icon"
  21. @click="repeatWordAudio" v-if="currentWordMeaning.phonetic" />
  22. <text class="phonetic-text" v-if="currentWordMeaning.phonetic">{{ currentWordMeaning.phonetic }}</text>
  23. </view>
  24. <view class="word-meaning">
  25. <text class="part-of-speech" v-if="currentWordMeaning.partOfSpeech">{{ currentWordMeaning.partOfSpeech }}</text>
  26. <text class="meaning-text" v-if="currentWordMeaning.meaning">{{ currentWordMeaning.meaning }}</text>
  27. </view>
  28. </view>
  29. <view class="knowledge-gain" v-if="currentWordMeaning.knowledgeGain">
  30. <view class="knowledge-header">
  31. <image src="/static/knowledge-icon.png" class="knowledge-icon" mode="aspectFill" />
  32. <text class="knowledge-title">知识收获</text>
  33. </view>
  34. <text class="knowledge-content">{{ currentWordMeaning.knowledgeGain }}</text>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </uv-popup>
  40. </template>
  41. <script>
  42. export default {
  43. name: 'MeaningPopup',
  44. props: {
  45. currentWordMeaning: {
  46. type: Object,
  47. default: null
  48. }
  49. },
  50. methods: {
  51. open() {
  52. if (this.$refs.meaningPopup) {
  53. this.$refs.meaningPopup.open()
  54. }
  55. },
  56. close() {
  57. if (this.$refs.meaningPopup) {
  58. this.$refs.meaningPopup.close()
  59. }
  60. },
  61. closeMeaningPopup() {
  62. this.$emit('close-meaning-popup')
  63. this.close()
  64. },
  65. repeatWordAudio() {
  66. this.$emit('repeat-word-audio')
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. /* 释义弹窗样式 */
  73. .meaning-popup {
  74. background-color: #FFFFFF;
  75. overflow: hidden;
  76. display: flex;
  77. flex-direction: column;
  78. max-height: 80vh;
  79. }
  80. .meaning-scroll-container {
  81. flex: 1;
  82. height: 60vh;
  83. }
  84. .meaning-header {
  85. display: flex;
  86. justify-content: space-between;
  87. align-items: center;
  88. padding: 32rpx;
  89. border-bottom: 2rpx solid #EEEEEE;
  90. flex-shrink: 0;
  91. }
  92. .close-btn {
  93. width: 80rpx;
  94. }
  95. .close-text {
  96. font-family: PingFang SC;
  97. font-size: 32rpx;
  98. color: #8b8b8b;
  99. }
  100. .meaning-title {
  101. font-family: PingFang SC;
  102. font-weight: 500;
  103. font-size: 34rpx;
  104. color: #181818;
  105. }
  106. .meaning-content {
  107. padding: 32rpx;
  108. }
  109. .meaning-image {
  110. width: 670rpx;
  111. height: 268rpx;
  112. border-radius: 24rpx;
  113. margin-bottom: 32rpx;
  114. }
  115. .word-info {
  116. margin-bottom: 32rpx;
  117. }
  118. .word-main {
  119. display: flex;
  120. align-items: center;
  121. gap: 16rpx;
  122. margin-bottom: 8rpx;
  123. }
  124. .word-text {
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. font-size: 40rpx;
  128. color: #181818;
  129. }
  130. .phonetic-container {
  131. display: flex;
  132. gap: 24rpx;
  133. align-items: center;
  134. .speaker-icon {
  135. cursor: pointer;
  136. transition: opacity 0.2s ease;
  137. padding: 8rpx;
  138. border-radius: 8rpx;
  139. &:hover {
  140. opacity: 0.7;
  141. background-color: rgba(0, 122, 255, 0.1);
  142. }
  143. }
  144. .phonetic-text {
  145. font-family: PingFang SC;
  146. font-size: 28rpx;
  147. color: #262626;
  148. margin-bottom: 16rpx;
  149. }
  150. }
  151. .word-meaning {
  152. display: flex;
  153. gap: 16rpx;
  154. }
  155. .part-of-speech {
  156. font-family: PingFang SC;
  157. font-size: 28rpx;
  158. color: #262626;
  159. }
  160. .meaning-text {
  161. font-family: PingFang SC;
  162. font-size: 28rpx;
  163. color: #181818;
  164. flex: 1;
  165. }
  166. .knowledge-gain {
  167. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #F0FBFF 100%);
  168. border-radius: 24rpx;
  169. padding: 32rpx 40rpx;
  170. }
  171. .knowledge-header {
  172. display: flex;
  173. align-items: center;
  174. gap: 16rpx;
  175. margin-bottom: 20rpx;
  176. }
  177. .knowledge-icon {
  178. width: 48rpx;
  179. height: 48rpx;
  180. }
  181. .knowledge-title {
  182. font-family: PingFang SC;
  183. font-weight: 600;
  184. font-size: 30rpx;
  185. color: #3B3D3D;
  186. }
  187. .knowledge-content {
  188. font-family: PingFang SC;
  189. font-size: 28rpx;
  190. color: #4f4f4f;
  191. line-height: 48rpx;
  192. }
  193. </style>