index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <page title="发起话题" ref="pageRef" light nav-color="transparent">
  3. <view class="flex-align padding14">
  4. <image :src="resource.weal_create_remind" style="width: 32rpx; height: 32rpx" />
  5. <view class="font2 color-white margin10">
  6. 审核通过后发布,不得包含非法内容,否则将审核不通过
  7. </view>
  8. </view>
  9. <view class="content paddingX14">
  10. <view class="font6 color-white paddingT20 paddingB2">话题</view>
  11. <view class="flex-align" style="height: 100rpx">
  12. <input
  13. v-model.trim="question"
  14. placeholder="请输入话题内容"
  15. class="color-white flex1"
  16. />
  17. </view>
  18. </view>
  19. <view class="content paddingX14">
  20. <view class="font6 color-white paddingY20">选项配置</view>
  21. <view class="flex-align">
  22. <view
  23. class="choose-btn flex-align-center"
  24. :class="[check === 2 && 'check']"
  25. @click="check = 2"
  26. >
  27. 2选项
  28. <image v-if="check === 2" :src="resource.icon_check2" class="flag" />
  29. </view>
  30. <view
  31. class="choose-btn marginL20 flex-align-center"
  32. :class="[check === 3 && 'check']"
  33. @click="check = 3"
  34. >
  35. 3选项
  36. <image v-if="check === 3" :src="resource.icon_check2" class="flag" />
  37. </view>
  38. </view>
  39. <view class="flex-align marginT10 line" style="height: 100rpx">
  40. <view class="color-white marginR25">选项1</view>
  41. <input v-model.trim="a1" placeholder="请输入选项1" class="color-white flex1" />
  42. </view>
  43. <view
  44. class="flex-align marginT10"
  45. :class="[check === 3 && 'line']"
  46. style="height: 100rpx"
  47. >
  48. <view class="color-white marginR25">选项2</view>
  49. <input v-model.trim="a2" placeholder="请输入选项2" class="color-white flex1" />
  50. </view>
  51. <view v-if="check === 3" class="flex-align marginT10" style="height: 100rpx">
  52. <view class="color-white marginR25">选项3</view>
  53. <input v-model.trim="a3" placeholder="请输入选项3" class="color-white flex1" />
  54. </view>
  55. </view>
  56. <view class="bottom-wrapper flex-align-center">
  57. <image :src="resource.sell_btn_create" webp class="btn-create" @click="submit" />
  58. </view>
  59. </page>
  60. </template>
  61. <script>
  62. import resource from '@/utils/resource'
  63. export default {
  64. data() {
  65. return {
  66. resource,
  67. question: '',
  68. check: 2,
  69. a1: '',
  70. a2: '',
  71. a3: ''
  72. }
  73. },
  74. methods: {
  75. async submit() {
  76. if (!this.question) {
  77. this.$message.warn('请输入话题')
  78. return
  79. }
  80. let a = []
  81. if (!this.a1) {
  82. this.$message.warn('请输入选项1')
  83. return
  84. }
  85. a.push(this.a1)
  86. if (!this.a2) {
  87. this.$message.warn('请输入选项2')
  88. return
  89. }
  90. a.push(this.a2)
  91. if (this.check === 3 && !this.a3) {
  92. this.$message.warn('请输入选项3')
  93. return
  94. }
  95. this.check === 3 && a.push(this.a3)
  96. const res = await this.$service.weal.topicCreate(this.question, a.join(','))
  97. if (res) {
  98. this.$message.alert('话题已提交成功,审核通过后会显示在爆炸头页面', () => {
  99. this.$router.back()
  100. })
  101. }
  102. }
  103. }
  104. }
  105. </script>
  106. <style>
  107. </style>
  108. <style lang="scss" scoped>
  109. .bg {
  110. position: fixed;
  111. z-index: -1;
  112. left: 0;
  113. right: 0;
  114. top: 0;
  115. width: 100%;
  116. height: 100%;
  117. opacity: 0.3;
  118. }
  119. .content {
  120. margin: 20rpx 28rpx;
  121. background: rgba(0, 0, 0, 0.5);
  122. box-shadow: 0px 0px 6px 3px rgba(147, 67, 255, 0.3);
  123. border: 2rpx solid rgba(174, 231, 255, 0.5);
  124. border-radius: 6px;
  125. .choose-btn {
  126. position: relative;
  127. width: 100px;
  128. height: 34px;
  129. border-radius: 4px;
  130. border: 1px solid #a76ef4;
  131. color: #a76ef4;
  132. &.check {
  133. color: #fff;
  134. border: none;
  135. background: linear-gradient(315deg, #6c6fff 0%, #a948ff 100%);
  136. }
  137. .flag {
  138. width: 40rpx;
  139. height: 40rpx;
  140. position: absolute;
  141. bottom: 0;
  142. right: 0;
  143. }
  144. }
  145. .line {
  146. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  147. }
  148. }
  149. .bottom-wrapper {
  150. padding-bottom: 48rpx;
  151. position: fixed;
  152. bottom: 0;
  153. left: 0;
  154. right: 0;
  155. }
  156. .btn-create {
  157. width: 616rpx;
  158. height: 128rpx;
  159. }
  160. </style>