裂变星小程序-25.03.04
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.

203 lines
5.7 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="视频分享" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="content">
  5. <uv-form
  6. ref="form"
  7. :model="form"
  8. :rules="rules"
  9. labelPosition="left"
  10. labelWidth="340rpx"
  11. :labelStyle="{
  12. color: '#1B1B1B',
  13. fontSize: '32rpx',
  14. fontWeight: 'bold',
  15. }"
  16. >
  17. <view class="flex upload__view">
  18. <view class="upload upload-cover">
  19. <uv-form-item labelWidth="0" prop="coverImageUrl">
  20. <formUpload v-model="form.coverImageUrl">
  21. <template v-slot="{ value }">
  22. <!-- todo: 默认 -->
  23. <image
  24. :src="value"
  25. mode="aspectFill"
  26. style="width: 344rpx; height: 344rpx;"
  27. radius="14rpx"
  28. />
  29. </template>
  30. </formUpload>
  31. <view class="upload-cover-text flex">设置封面</view>
  32. </uv-form-item>
  33. </view>
  34. <view class="upload upload-video">
  35. <uv-form-item labelWidth="0" prop="videoUrl">
  36. <formUpload v-model="form.videoUrl">
  37. <template v-slot="{ value }">
  38. <image v-if="value"
  39. :src="form.videoUrl"
  40. mode="aspectFill"
  41. style="width: 344rpx; height: 344rpx;"
  42. radius="14rpx"
  43. />
  44. <view v-else class="flex flex-column" style="width: 344rpx; height: 344rpx;">
  45. <uv-icon name="camera" color="#000000" size="129rpx"></uv-icon>
  46. <text class="upload-video-text">上传视频</text>
  47. </view>
  48. </template>
  49. </formUpload>
  50. </uv-form-item>
  51. </view>
  52. </view>
  53. <view class="form-item">
  54. <uv-form-item label="标题" labelWidth="84rpx" prop="title">
  55. <view class="form-item-content">
  56. <formInput v-model="form.title" placeholder="请输入你的视频名称" width="584rpx"></formInput>
  57. </view>
  58. </uv-form-item>
  59. </view>
  60. <view class="form-item">
  61. <uv-form-item label="设置广告弹出时间(s)" prop="mins">
  62. <view class="form-item-content">
  63. <formNumberBox v-model="form.mins" ></formNumberBox>
  64. </view>
  65. </uv-form-item>
  66. </view>
  67. <view class="form-item">
  68. <uv-form-item label="设置转发次数(次)" prop="times">
  69. <view class="form-item-content">
  70. <formNumberBox v-model="form.times" ></formNumberBox>
  71. </view>
  72. </uv-form-item>
  73. </view>
  74. <view class="form-item">
  75. <uv-form-item label="选择二维码" prop="qrCode">
  76. <view class="form-item-content">
  77. <formUpload v-model="form.qrCode">
  78. <template v-slot="{ value }">
  79. <view class="flex" style="min-width: 93rpx; height: 45rpx;">
  80. <image
  81. :src="value"
  82. mode="aspectFill"
  83. style="width: 45rpx; height: 45rpx;"
  84. radius="14rpx"
  85. />
  86. <uv-icon style="margin-left: 20rpx" name="arrow-right" color="#000000" size="28rpx"></uv-icon>
  87. </view>
  88. </template>
  89. </formUpload>
  90. </view>
  91. </uv-form-item>
  92. </view>
  93. <view class="form-item">
  94. <uv-form-item label="视频描述" prop="description" labelPosition="top">
  95. <view style="margin-top: 32rpx;">
  96. <formTextarea
  97. v-model="form.description"
  98. placeholder="请描述你的视频"
  99. ></formTextarea>
  100. </view>
  101. </uv-form-item>
  102. </view>
  103. </uv-form>
  104. </view>
  105. <button v-if="auditStatus === 1" class="button-submit" @click="onPublish">
  106. 发布
  107. </button>
  108. <button v-else-if="auditStatus !== 0" class="button-submit" @click="onSubmit">
  109. 提交审核
  110. </button>
  111. </view>
  112. </template>
  113. <script>
  114. import formUpload from '../components/formUpload.vue'
  115. import formInput from '../components/formInput.vue'
  116. import formNumberBox from '../components/formNumberBox.vue'
  117. import formTextarea from '../components/formTextarea.vue'
  118. export default {
  119. components: {
  120. formUpload,
  121. formInput,
  122. formNumberBox,
  123. formTextarea,
  124. },
  125. data() {
  126. return {
  127. id: null,
  128. auditStatus: null,
  129. form: {
  130. title: null,
  131. coverImageUrl: null,
  132. videoUrl: null,
  133. mins: 2,
  134. times: 10,
  135. qrCode: null,
  136. description: null,
  137. },
  138. rules: {
  139. // todo
  140. },
  141. }
  142. },
  143. onLoad(option) {
  144. const { id } = option
  145. this.id = id
  146. // todo: init data by id
  147. },
  148. methods: {
  149. onSubmit() {
  150. // todo
  151. const params = { ...this.form }
  152. this.$api('submitPersonalSharing', params)
  153. },
  154. onPublish() {
  155. // todo
  156. },
  157. }
  158. }
  159. </script>
  160. <style scoped lang="scss">
  161. @import '../styles/pageForm.scss';
  162. .upload__view {
  163. justify-content: space-between;
  164. margin-bottom: 20rpx;
  165. }
  166. .upload {
  167. background-color: $uni-fg-color;
  168. border-radius: 12rpx;
  169. overflow: hidden;
  170. }
  171. .upload-video {
  172. &-text {
  173. color: #1B1B1B;
  174. font-size: 32rpx;
  175. }
  176. }
  177. .upload-cover {
  178. position: relative;
  179. &-text {
  180. position: absolute;
  181. bottom: 0;
  182. width: 100%;
  183. background-color: rgba($color: #000000, $alpha: 0.6);
  184. color: #FFFFFF;
  185. padding: 21rpx 0;
  186. }
  187. }
  188. </style>