postMessage.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view>
  3. <u-navbar back-text="发布信息" back-icon-size="28" back-icon-color="#ffffff" :background="{backgroundColor: '#2795FD',}"
  4. :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 发布标题 -->
  6. <view class="post-title">
  7. <view class="title">
  8. 发布标题
  9. </view>
  10. <view class="title-content">
  11. <input v-model="form.title" class="input" type="text" value="" placeholder="请填写标题内容" />
  12. </view>
  13. <!-- 类型选择 -->
  14. <view class="type">
  15. <view class="name">
  16. <text>*</text>共享类型
  17. </view>
  18. <!-- 单选框 -->
  19. <u-radio-group v-model="form.type">
  20. <u-radio v-for="(item, index) in list" :key="index" :name="item.type"
  21. :disabled="item.disabled">
  22. {{item.name}}
  23. </u-radio>
  24. </u-radio-group>
  25. </view>
  26. </view>
  27. <!-- 内容描述 -->
  28. <view class="content-description">
  29. <view class="title">
  30. 内容描述
  31. </view>
  32. <view class="content-textarea">
  33. <textarea v-model="form.content" class="textarea" value="" placeholder="请描述共享用工需求内容,并留下您的联系方式。" />
  34. </view>
  35. </view>
  36. <!-- 底部按钮 -->
  37. <button class="btn" @click="publishInformation">发布信息</button>
  38. </view>
  39. </template>
  40. <script>
  41. import * as packagesAPI from '@/apis/pagejs/packages.js'
  42. export default {
  43. data() {
  44. return {
  45. list: [{
  46. name: '急需用工',
  47. type: '1',
  48. disabled: false
  49. },
  50. {
  51. name: '资源共享',
  52. type: '2',
  53. disabled: false
  54. },
  55. ],
  56. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  57. form: {
  58. id: '',
  59. type: '1',
  60. title: '',
  61. content: ''
  62. },
  63. };
  64. },
  65. methods: {
  66. publishInformation() {
  67. if(!this.form.title) {
  68. uni.showToast({
  69. title: "请填写标题内容",
  70. icon: "none"
  71. })
  72. return
  73. }
  74. if(!this.form.content) {
  75. uni.showToast({
  76. title: "请描述共享用工需求内容",
  77. icon: "none"
  78. })
  79. return
  80. }
  81. uni.showLoading({
  82. title: "加载中",
  83. mask: true,
  84. })
  85. packagesAPI.createShareWork(this.form).then((res) => {
  86. uni.hideLoading();
  87. uni.navigateTo({
  88. url: '/pages/packages/mine/employmentService/shareEmployment'
  89. })
  90. }).catch(error => {
  91. uni.showToast({
  92. title: error,
  93. icon: "none"
  94. })
  95. })
  96. }
  97. }
  98. };
  99. </script>
  100. <style>
  101. page {
  102. background: #F0F0F2;
  103. padding-bottom: 50px;
  104. }
  105. </style>
  106. <style scoped lang="scss">
  107. // 发布标题
  108. .post-title {
  109. margin: 24rpx 32rpx 0;
  110. padding: 24rpx 32rpx;
  111. color: rgba(16, 16, 16, 1);
  112. font-size: 36rpx;
  113. background-color: #fff;
  114. border-radius: 24rpx;
  115. .title {
  116. font-family: 'PingFangSC-medium';
  117. }
  118. .title-content {
  119. .input {
  120. width: 100%;
  121. height: 96rpx;
  122. line-height: 96rpx;
  123. color: rgba(136, 136, 136, 1);
  124. font-family: Microsoft Yahei;
  125. }
  126. }
  127. // 类型选择
  128. .type {
  129. display: flex;
  130. align-items: center;
  131. margin-top: 16rpx;
  132. .name {
  133. font-size: 32rpx;
  134. color: #101010;
  135. margin-right: 40rpx;
  136. text {
  137. color: #EE3138
  138. }
  139. }
  140. }
  141. }
  142. // 内容描述
  143. .content-description {
  144. margin: 24rpx 32rpx 0;
  145. padding: 24rpx 32rpx;
  146. color: rgba(16, 16, 16, 1);
  147. font-size: 36rpx;
  148. background-color: #fff;
  149. border-radius: 24rpx;
  150. .title {
  151. font-family: 'PingFangSC-medium';
  152. }
  153. .content-textarea {
  154. margin-top: 24rpx;
  155. .textarea {
  156. width: 100%;
  157. height: 640rpx;
  158. color: rgba(136, 136, 136, 1);
  159. font-family: Microsoft Yahei;
  160. line-height: 40rpx;
  161. }
  162. }
  163. }
  164. // 底部按钮
  165. .btn {
  166. position: fixed;
  167. bottom: 32rpx;
  168. left: 0;
  169. right: 0;
  170. background-color: #F0F0F2;
  171. padding: 0 32rpx;
  172. border-radius: 50px;
  173. background-color: rgba(34, 149, 255, 1);
  174. color: rgba(241, 241, 241, 1);
  175. font-size: 36rpx;
  176. margin: 0 32rpx;
  177. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.03);
  178. }
  179. </style>