四零语境前端代码仓库
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.

224 lines
4.4 KiB

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