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

222 lines
6.6 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="300rpx"
  11. :labelStyle="{
  12. color: '#1B1B1B',
  13. fontSize: '32rpx',
  14. fontWeight: 'bold',
  15. }"
  16. >
  17. <view class="form-item">
  18. <uv-form-item label="用户ID" prop="id">
  19. <view class="form-item-content">
  20. <template v-if="form.id">
  21. <text>{{ form.id }}</text>
  22. <view style="margin-left: 20rpx;">
  23. <button class="btn-simple" plain @click="$utils.copyText(form.id)">
  24. <uv-icon name="file-text" color="#05D9A2" size="28rpx"></uv-icon>
  25. </button>
  26. </view>
  27. </template>
  28. </view>
  29. </uv-form-item>
  30. </view>
  31. <!-- todo: 选择头像 -->
  32. <view class="form-item">
  33. <uv-form-item label="选择头像" prop="imageUrl">
  34. <view class="form-item-content">
  35. <button
  36. class="btn-avatar"
  37. :plain="true"
  38. :hairline="false"
  39. open-type="chooseAvatar"
  40. @chooseavatar="onChooseAvatar"
  41. >
  42. <image
  43. :src="form.avatarUrl || '../static/auth/avatar.png'"
  44. style="width: 68rpx; height: 68rpx;"
  45. mode=""
  46. ></image>
  47. </button>
  48. <!-- <formUpload v-model="form.avatarUrl">
  49. <template v-slot="{ value }">
  50. <view class="flex" style="min-width: 116rpx; height: 45rpx;">
  51. <image
  52. :src="value"
  53. mode="aspectFill"
  54. style="width: 68rpx; height: 68rpx;"
  55. radius="14rpx"
  56. />
  57. <uv-icon style="margin-left: 20rpx" name="arrow-right" color="#000000" size="28rpx"></uv-icon>
  58. </view>
  59. </template>
  60. </formUpload> -->
  61. </view>
  62. </uv-form-item>
  63. </view>
  64. <view class="form-item">
  65. <uv-form-item label="昵称" labelWidth="105rpx" prop="nickName">
  66. <view class="form-item-content">
  67. <formInput v-model="form.nickName" placeholder="请输入你的群名称" width="540rpx"></formInput>
  68. </view>
  69. </uv-form-item>
  70. </view>
  71. <view class="form-item">
  72. <uv-form-item label="选择封面图" prop="imageUrl">
  73. <view class="form-item-content">
  74. <formUpload v-model="form.imageUrl">
  75. <template v-slot="{ value }">
  76. <view class="flex" style="min-width: 116rpx; height: 45rpx;">
  77. <image
  78. :src="value"
  79. mode="aspectFill"
  80. style="width: 68rpx; height: 68rpx;"
  81. radius="14rpx"
  82. />
  83. <uv-icon style="margin-left: 20rpx" name="arrow-right" color="#000000" size="28rpx"></uv-icon>
  84. </view>
  85. </template>
  86. </formUpload>
  87. </view>
  88. </uv-form-item>
  89. </view>
  90. <view class="form-item">
  91. <uv-form-item label="设置转发次数(次)" prop="times">
  92. <view class="form-item-content">
  93. <formNumberBox v-model="form.times" ></formNumberBox>
  94. </view>
  95. </uv-form-item>
  96. </view>
  97. <view class="form-item">
  98. <uv-form-item label="选择二维码" prop="qrCode">
  99. <view class="form-item-content">
  100. <formUpload v-model="form.qrCode">
  101. <template v-slot="{ value }">
  102. <view class="flex" style="min-width: 93rpx; height: 45rpx;">
  103. <image
  104. :src="value"
  105. mode="aspectFill"
  106. style="width: 45rpx; height: 45rpx;"
  107. radius="14rpx"
  108. />
  109. <uv-icon style="margin-left: 20rpx" name="arrow-right" color="#000000" size="28rpx"></uv-icon>
  110. </view>
  111. </template>
  112. </formUpload>
  113. </view>
  114. </uv-form-item>
  115. </view>
  116. <view class="form-item">
  117. <uv-form-item label="文案描述" prop="description" labelPosition="top">
  118. <view style="margin-top: 32rpx;">
  119. <formTextarea
  120. v-model="form.description"
  121. placeholder="请输入你的文案"
  122. ></formTextarea>
  123. </view>
  124. </uv-form-item>
  125. </view>
  126. </uv-form>
  127. </view>
  128. <!-- 审核通过 -->
  129. <button v-if="auditStatus === 1" class="button-submit" @click="onPublish">
  130. 发布
  131. </button>
  132. <!-- 不是 审核中 已发布 -> 创建分享 审核不通过 -->
  133. <button v-else-if="![0,2].includes(auditStatus)" class="button-submit" @click="onSubmit">
  134. 提交审核
  135. </button>
  136. </view>
  137. </template>
  138. <script>
  139. import formInput from '../components/formInput.vue'
  140. import formNumberBox from '../components/formNumberBox.vue'
  141. import formUpload from '../components/formUpload.vue'
  142. import formTextarea from '../components/formTextarea.vue'
  143. export default {
  144. components: {
  145. formInput,
  146. formNumberBox,
  147. formUpload,
  148. formTextarea,
  149. },
  150. data() {
  151. return {
  152. id: null,
  153. auditStatus: null,
  154. form: {
  155. id: null,
  156. avatarUrl: null,
  157. nickName: null,
  158. imageUrl: null,
  159. times: 10,
  160. qrCode: null,
  161. description: null,
  162. },
  163. rules: {
  164. // todo
  165. },
  166. }
  167. },
  168. onLoad(option) {
  169. const { id } = option
  170. this.id = id
  171. // todo: init data by id
  172. },
  173. methods: {
  174. onChooseAvatar(res) {
  175. this.$Oss.ossUpload(res.target.avatarUrl)
  176. .then(url => {
  177. this.form.avatarUrl = url
  178. })
  179. },
  180. onSubmit() {
  181. // todo
  182. const params = { ...this.form }
  183. this.$api('submitPersonalSharing', params)
  184. },
  185. onPublish() {
  186. // todo
  187. },
  188. }
  189. }
  190. </script>
  191. <style scoped lang="scss">
  192. @import '../styles/pageForm.scss';
  193. .btn-avatar {
  194. background: transparent;
  195. border: none;
  196. border-radius: none;
  197. box-shadow: none;
  198. padding: 0;
  199. margin: 0;
  200. font-size: 0;
  201. text-align: right;
  202. }
  203. .button-submit {
  204. margin: 0;
  205. position: fixed;
  206. bottom: 138rpx;
  207. left: 20rpx;
  208. width: calc(100% - 40rpx);
  209. height: 90rpx;
  210. }
  211. </style>