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

220 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 formNumberBox from '../components/formNumberBox.vue'
  140. import formUpload from '../components/formUpload.vue'
  141. import formTextarea from '../components/formTextarea.vue'
  142. export default {
  143. components: {
  144. formNumberBox,
  145. formUpload,
  146. formTextarea,
  147. },
  148. data() {
  149. return {
  150. id: null,
  151. auditStatus: null,
  152. form: {
  153. id: null,
  154. avatarUrl: null,
  155. nickName: null,
  156. imageUrl: null,
  157. times: 10,
  158. qrCode: null,
  159. description: null,
  160. },
  161. rules: {
  162. // todo
  163. },
  164. }
  165. },
  166. onLoad(option) {
  167. const { id } = option
  168. this.id = id
  169. // todo: init data by id
  170. },
  171. methods: {
  172. onChooseAvatar(res) {
  173. this.$Oss.ossUpload(res.target.avatarUrl)
  174. .then(url => {
  175. this.form.avatarUrl = url
  176. })
  177. },
  178. onSubmit() {
  179. // todo
  180. const params = { ...this.form }
  181. this.$api('submitPersonalSharing', params)
  182. },
  183. onPublish() {
  184. // todo
  185. },
  186. }
  187. }
  188. </script>
  189. <style scoped lang="scss">
  190. @import '../styles/pageForm.scss';
  191. .btn-avatar {
  192. background: transparent;
  193. border: none;
  194. border-radius: none;
  195. box-shadow: none;
  196. padding: 0;
  197. margin: 0;
  198. font-size: 0;
  199. text-align: right;
  200. }
  201. .button-submit {
  202. margin: 0;
  203. position: fixed;
  204. bottom: 138rpx;
  205. left: 20rpx;
  206. width: calc(100% - 40rpx);
  207. height: 90rpx;
  208. }
  209. </style>