makeImgDetail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="makedetail-container">
  3. <!-- 顶部导航 -->
  4. <view class="header">
  5. <view class="back-icon" @click="goBack">
  6. <text class="iconfont icon-left">&#xe8ef;</text>
  7. </view>
  8. <view class="right-info">
  9. <view class="coin">
  10. <image src="/static/coin.png" mode="aspectFit"></image>
  11. <text>999</text>
  12. </view>
  13. <view class="diamond">
  14. <image src="/static/diamond.png" mode="aspectFit"></image>
  15. <text>2</text>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 创作预览区域 -->
  20. <view class="preview-section">
  21. <view class="preview-title">创作预览</view>
  22. <view class="preview-card">
  23. <image class="loading-icon" src="/static/loading.png" mode="aspectFit"></image>
  24. <text class="loading-text">生成中 0%</text>
  25. <text class="sub-text">请耐心等待制作完成</text>
  26. </view>
  27. </view>
  28. <!-- 创作描述输入区 -->
  29. <view class="description-section">
  30. <view class="section-header">
  31. <text class="section-title">创作描述<text class="required">*</text></text>
  32. <view class="clear-text" @click="clearDescription">
  33. <image src="/static/clear.png" mode="aspectFit"></image>
  34. <text>清空文本</text>
  35. </view>
  36. </view>
  37. <textarea
  38. class="input-area"
  39. v-model="description"
  40. placeholder="请输入描述语,例如:穿着白色运动服,外表俊朗..."
  41. maxlength="1000"
  42. @input="onDescriptionInput"
  43. ></textarea>
  44. <view class="word-count">{{descriptionLength}}/1000</view>
  45. </view>
  46. <!-- 行为动作选择区 -->
  47. <view class="action-section">
  48. <view class="section-title">行为动作</view>
  49. <input
  50. class="input-box"
  51. v-model="action"
  52. placeholder="可输入也可点击推荐词"
  53. />
  54. <view class="tag-group">
  55. <text
  56. class="tag"
  57. v-for="(item, index) in actionTags"
  58. :key="index"
  59. @click="selectAction(item)"
  60. >{{item}}</text>
  61. </view>
  62. </view>
  63. <!-- 主体环境选择区 -->
  64. <view class="environment-section">
  65. <view class="section-title">主体环境</view>
  66. <input
  67. class="input-box"
  68. v-model="environment"
  69. placeholder="可输入也可点击推荐词"
  70. />
  71. <view class="tag-group">
  72. <text
  73. class="tag"
  74. v-for="(item, index) in environmentTags"
  75. :key="index"
  76. @click="selectEnvironment(item)"
  77. >{{item}}</text>
  78. </view>
  79. </view>
  80. <!-- 主体形象选择区 -->
  81. <view class="image-section">
  82. <view class="section-title">主体形象</view>
  83. <input
  84. class="input-box"
  85. v-model="image"
  86. placeholder="可输入也可点击推荐词"
  87. />
  88. <view class="tag-group">
  89. <text
  90. class="tag"
  91. v-for="(item, index) in imageTags"
  92. :key="index"
  93. @click="selectImage(item)"
  94. >{{item}}</text>
  95. </view>
  96. </view>
  97. <!-- 参考风格选择区 -->
  98. <view class="style-section">
  99. <view class="section-title">选择参考风格<text class="required">*</text></view>
  100. <scroll-view class="style-scroll" scroll-x>
  101. <view
  102. class="style-item"
  103. v-for="(item, index) in styleList"
  104. :key="index"
  105. :class="{'active': selectedStyle === index}"
  106. @click="selectStyle(index)"
  107. >
  108. <image :src="item.image" mode="aspectFill"></image>
  109. <text>{{item.name}}</text>
  110. </view>
  111. </scroll-view>
  112. </view>
  113. <!-- 底部按钮 -->
  114. <view class="bottom-button">
  115. <button class="generate-btn" @click="generateImage">立即生成(消耗10贡献)</button>
  116. <view class="promotion-link">
  117. <text>> 即刻开通订阅,获取各种福利! <</text>
  118. </view>
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. export default {
  124. data() {
  125. return {
  126. description: '',
  127. descriptionLength: 0,
  128. action: '',
  129. environment: '',
  130. image: '',
  131. selectedStyle: -1,
  132. actionTags: ['跳舞', '开枪', '喝咖啡', '看书', '运动'],
  133. environmentTags: ['都市大道', '大树底下', '办公室', '厨房'],
  134. imageTags: ['戴着墨镜', '戴着耳机', '戴着帽子', '手持冲浪板'],
  135. styleList: [
  136. { name: '自然共生', image: '/static/style1.png' },
  137. { name: '国风新锋', image: '/static/style2.png' },
  138. { name: '萌系治愈', image: '/static/style3.png' }
  139. ]
  140. }
  141. },
  142. methods: {
  143. goBack() {
  144. uni.navigateBack()
  145. },
  146. clearDescription() {
  147. this.description = ''
  148. this.descriptionLength = 0
  149. },
  150. onDescriptionInput(e) {
  151. this.descriptionLength = e.detail.value.length
  152. },
  153. selectAction(tag) {
  154. this.action = tag
  155. },
  156. selectEnvironment(tag) {
  157. this.environment = tag
  158. },
  159. selectImage(tag) {
  160. this.image = tag
  161. },
  162. selectStyle(index) {
  163. this.selectedStyle = index
  164. },
  165. generateImage() {
  166. if (!this.description) {
  167. uni.showToast({
  168. title: '请输入创作描述',
  169. icon: 'none'
  170. })
  171. return
  172. }
  173. if (this.selectedStyle === -1) {
  174. uni.showToast({
  175. title: '请选择参考风格',
  176. icon: 'none'
  177. })
  178. return
  179. }
  180. // TODO: 调用生成接口
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. @import './makeImgDetail.scss';
  187. </style>