add-circle.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="add-circle-box iPhone-bottom flex-common-css box-border-box">
  3. <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
  4. <Nav title='发圈子' bgckgroundBox='#fff'></Nav>
  5. <view class="scroll-view-css box-border-box ptp-24">
  6. <view class="bgc-f box-border-box p-32">
  7. <view class="fs-34 fw-600 mb-20">内容描述 <span class='fs-34 fc-9 fw-400'>(必填)</span></view>
  8. <textarea v-model="fromData.content" class="textarea-class fs-24" :maxlength='500' placeholder='这一刻说些什么'
  9. @input='input'></textarea>
  10. <view class="text-align-right fs-28 fc-9">
  11. {{inputNum>=500?'500':inputNum}}/500
  12. </view>
  13. </view>
  14. <view class="bgc-f mb-20">
  15. <EnUpload v-model="fromData.image" number='9'></EnUpload>
  16. <view class='fc-ED301D pl-24 p-b-20 box-border-box'>
  17. 提示:如您上传图片,帖子将会进入内容安全审核
  18. </view>
  19. </view>
  20. <view class="bgc-f box-border-box p-32 flex-justify-space align-items-center" @click="openPop()">
  21. <view class="fs-34 fw-600">{{typeName}}</view>
  22. <image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
  23. </view>
  24. </view>
  25. <view class="box-border-box p-32" @click="save()">
  26. <view class="b-bottom text-align-center fs-32 fw-600 fc-f">发布</view>
  27. </view>
  28. <uni-popup ref="popup" type="bottom" background-color="#fff" @change="change">
  29. <view class="pop-box box-border-box p-24">
  30. <view class="head-pop flex-justify-space align-items-center mb-24">
  31. <uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
  32. <view class="fs-36 fc-0 fw-600">选发布类型</view>
  33. <view class="fs-28 fw-600 fc-41ABF5" @click.stop="closePop(2)">确定</view>
  34. </view>
  35. <view class="scroll-view-css">
  36. <view class="item-box fs-32 "
  37. :class="fromData.topic_id==item.id?'fc-41ABF5 bgc-D5EDFB':'bgc-F3F4F6'"
  38. v-for="(item,i) in classList" :key="i" @click="selectPopAddEditType(item)">{{item.name}}</view>
  39. </view>
  40. </view>
  41. </uni-popup>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. getTopic
  47. } from '@/api/category.js';
  48. import {
  49. alumniSave
  50. } from '@/api/alumni.js';
  51. import tools from '@/service/tools';
  52. import EnUpload from '@/components/en-from/en-upload/en-upload.vue';
  53. export default {
  54. components: {
  55. EnUpload
  56. },
  57. data() {
  58. return {
  59. fromData: {
  60. news_id: '',
  61. content: '',
  62. image: [],
  63. school_id: '',
  64. topic_id: '',
  65. },
  66. isAJAX: false,
  67. classList: [],
  68. typeName: '请选择发布类型',
  69. show: 'false',
  70. inputNum: 0
  71. }
  72. },
  73. onLoad(e) {
  74. if (e.news_id) {
  75. this.fromData.news_id = e.news_id;
  76. } else {
  77. this.fromData.news_id = '';
  78. }
  79. },
  80. methods: {
  81. input(e) {
  82. console.log(e.detail);
  83. this.inputNum = e.detail.cursor
  84. },
  85. change(e) {
  86. this.show = e.show
  87. },
  88. selectPopAddEditType(item) {
  89. if (this.fromData.topic_id != item.id) {
  90. this.fromData.topic_id = item.id;
  91. this.typeName = item.name;
  92. }
  93. },
  94. openPop() {
  95. getTopic().then((res) => {
  96. if (res.code === 1) {
  97. this.classList = res.data;
  98. this.$refs.popup.open();
  99. }
  100. })
  101. },
  102. closePop(type) {
  103. if (type === 1) {
  104. this.fromData.topic_id = '';
  105. this.typeName = '请选择发布类型';
  106. }
  107. this.$refs.popup.close();
  108. },
  109. save() {
  110. if (this.isAJAX) {
  111. return
  112. }
  113. this.isAJAX = true;
  114. let circleSchoolId = uni.getStorageSync('circleSchoolId');
  115. let school_id = uni.getStorageSync('school_id');
  116. this.fromData.alumni_school_id = circleSchoolId ? circleSchoolId : school_id;
  117. alumniSave(this.fromData).then((res) => {
  118. if (res.code === 1) {
  119. tools.success(res.msg, 1000)
  120. setTimeout(() => {
  121. this.isAJAX = false;
  122. uni.$emit('operateType', true);
  123. uni.navigateBack({
  124. delta: 1,
  125. });
  126. }, 1000)
  127. } else {
  128. tools.error(res.msg)
  129. this.isAJAX = false;
  130. }
  131. })
  132. },
  133. }
  134. }
  135. </script>
  136. <style scoped lang="scss">
  137. .textarea-class {
  138. width: 100%;
  139. }
  140. .add-circle-box {
  141. .b-bottom {
  142. width: 686rpx;
  143. height: 88rpx;
  144. line-height: 88rpx;
  145. background: linear-gradient(105deg, #57CAFF 0%, #41ABF5 100%);
  146. border-radius: 200rpx;
  147. }
  148. .right-icon {
  149. width: 32rpx;
  150. height: 32rpx;
  151. }
  152. .head-pop {
  153. padding-bottom: 34rpx !important;
  154. border-bottom: 1rpx solid #F2F2F2;
  155. }
  156. .pop-box {
  157. width: 100%;
  158. height: 50vh;
  159. // background-color: #fff;
  160. border-radius: 24rpx 24rpx 0rpx 0rpx;
  161. display: flex;
  162. flex-direction: column;
  163. .item-box {
  164. width: 100%;
  165. height: 92rpx;
  166. border-radius: 200rpx;
  167. line-height: 92rpx;
  168. text-align: center;
  169. margin-bottom: 24rpx;
  170. }
  171. }
  172. }
  173. </style>