editCompanyDesc.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="page-container">
  3. <nav-bar title="公司信息">
  4. <view class="nav-bar-right-btn" slot="right" @click="toNext">跳过</view>
  5. </nav-bar>
  6. <view class="content">
  7. <view class="num-title">
  8. <text class="current-num">3</text>
  9. <text>/6</text>
  10. </view>
  11. <view class="main-title">编辑公司简介</view>
  12. <view>可以简单介绍一下公司发展状况、服务领域、主要产品等信息</view>
  13. <view class="small-desc">一句短介绍</view>
  14. <view class="content-index">
  15. <view class="check-box">
  16. <textarea v-model="text" placeholder="填写公司介绍(最少10个字)" maxlength="500"
  17. class="textarea"></textarea>
  18. <view class="word-count">
  19. <text>{{ text ? text.length : 0 }}</text> /500
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="fixed-button">
  25. <view class="button" @click="goJobPostingSecond">保存</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import navBar from "@/components/nav-bar/index.vue";
  31. export default {
  32. data() {
  33. return {
  34. companyId: '',
  35. loading: false,
  36. text: '',
  37. };
  38. },
  39. components: {
  40. navBar,
  41. },
  42. onLoad(options) {
  43. let companyInfo = uni.getStorageSync('companyInfo');
  44. this.text = companyInfo.companyContent
  45. this.getCompanyInfo()
  46. },
  47. methods: {
  48. toNext() {
  49. uni.redirectTo({
  50. url: '/my/renzheng/mainWorkIntro'
  51. })
  52. },
  53. // 获取公司信息
  54. getCompanyInfo() {
  55. uni.showLoading({ title: '加载中' })
  56. this.$Request.get('/app/company/selectCompanyByUserId')
  57. .then((res) => {
  58. if (res.code != 0) {
  59. uni.showToast({
  60. title: res.msg || '查询状态失败',
  61. icon: 'none'
  62. });
  63. return
  64. }
  65. this.companyId = res.data.companyId
  66. this.text = res.data.companyContent || ''
  67. uni.hideLoading()
  68. })
  69. .catch((err) => {
  70. uni.hideLoading()
  71. uni.showToast({
  72. title: '网络异常',
  73. icon: 'none'
  74. })
  75. })
  76. },
  77. goJobPostingSecond() {
  78. if (this.loading) return
  79. if (this.text === '') {
  80. uni.showToast({
  81. title: "请填写公司介绍",
  82. icon: "none",
  83. });
  84. return;
  85. }
  86. if (this.text.length < 10) {
  87. uni.showToast({
  88. title: "公司介绍最少10个字",
  89. icon: "none",
  90. });
  91. return;
  92. }
  93. this.loading = true
  94. uni.showLoading({ title: '保存中' })
  95. let companyData = {
  96. companyId: this.companyId,
  97. companyContent: this.text
  98. }
  99. this.$Request.postJson('/app/company/updateCompany', companyData)
  100. .then(res => {
  101. if (res.code == 0) {
  102. uni.showToast({
  103. title: '提交成功',
  104. duration: 1500,
  105. });
  106. setTimeout(() => {
  107. uni.$emit('updateCompanyInfo')
  108. uni.navigateBack()
  109. }, 500)
  110. }
  111. this.loading = false
  112. uni.hideLoading()
  113. })
  114. .catch(() => {
  115. this.loading = false
  116. uni.hideLoading()
  117. })
  118. }
  119. },
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. @import './company.scss';
  124. .check-box {
  125. width: 100%;
  126. border-radius: 12rpx;
  127. background: rgba(240, 240, 240, 1);
  128. padding: 34rpx;
  129. padding-top: 40rpx;
  130. box-sizing: border-box;
  131. margin: 20rpx 0;
  132. .word-count {
  133. font-family: DM Sans;
  134. font-size: 20rpx;
  135. font-weight: 400;
  136. line-height: 26rpx;
  137. text-align: right;
  138. text {
  139. color: #016bf6;
  140. }
  141. }
  142. }
  143. .desc {
  144. color: rgba(102, 102, 102, 1);
  145. width: 100%;
  146. font-family: DM Sans;
  147. font-size: 24rpx;
  148. font-weight: 400;
  149. line-height: 32rpx;
  150. letter-spacing: 0.5%;
  151. text-align: left;
  152. box-sizing: border-box;
  153. margin-bottom: 20rpx;
  154. }
  155. .small-desc {
  156. color: rgba(34, 37, 42, 1);
  157. font-family: DM Sans;
  158. font-size: 32rpx;
  159. font-weight: 400;
  160. line-height: 48rpx;
  161. width: 100%;
  162. margin: 20rpx 0 12rpx;
  163. }
  164. .content-index {
  165. width: 100%;
  166. }
  167. ::v-deep .textarea-placeholder {
  168. color: rgba(153, 153, 153, 1);
  169. font-family: DM Sans;
  170. font-size: 20rpx !important;
  171. font-weight: 400;
  172. line-height: 26rpx;
  173. }
  174. ::v-deep .uni-textarea-textarea {
  175. font-size: 20rpx;
  176. }
  177. </style>