notice.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="center">
  3. <view class="row">
  4. <!-- <view class="left-text">发布公告</view> -->
  5. <!-- <u--textarea v-model="fleetInfo.notice" placeholder="输入公告文字,0-500字" maxlength="500" count></u--textarea> -->
  6. <u--textarea v-model="fleetInfo.notice" placeholder="输入公告文字,0-500字" maxlength="500" height="100"
  7. border="none" class="textInfo"></u--textarea>
  8. </view>
  9. <view class="number_css">
  10. {{fleetInfo.notice?fleetInfo.notice.length:"0"}}/500
  11. </view>
  12. <!-- <u-button type="primary" @click="submit"></u-button>-->
  13. <u-toast ref="uToast"></u-toast>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. id: "",
  21. fleetInfo: {
  22. notice: "",
  23. }
  24. }
  25. },
  26. onShow() {
  27. },
  28. onLoad(option) {
  29. this.id = option.id
  30. this.getList()
  31. },
  32. onNavigationBarButtonTap(e) {
  33. this.submit()
  34. },
  35. methods: {
  36. getList() {
  37. this.$request.baseRequest('get', '/fleetInfo/getFleetInfo', { //获取该车队的信息,用于提交发布信息
  38. id: this.id
  39. }).then(res => {
  40. this.fleetInfo = res.data
  41. })
  42. .catch(res => {
  43. uni.$u.toast(res.message);
  44. });
  45. },
  46. submit() {
  47. if (!this.fleetInfo.notice) {
  48. uni.navigateBack({
  49. delta: 1
  50. });
  51. return
  52. }
  53. this.fleetInfo.flag = 1
  54. this.$request.baseRequest('post', '/fleetInfo/api/editFleetInfo', this.fleetInfo).then(res => {
  55. if (res.code == 200) {
  56. this.$refs.uToast.show({
  57. type: 'success',
  58. message: "公告发布成功!",
  59. complete() {
  60. // uni.$u.route("pages/riders/myTeam")
  61. uni.navigateBack({
  62. delta: 1
  63. });
  64. }
  65. })
  66. }
  67. // this.fleetInfo = res.data
  68. })
  69. .catch(res => {
  70. uni.$u.toast(res.message);
  71. });
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .center {
  78. padding: 30rpx;
  79. }
  80. .textInfo {
  81. background: #F9F9FB;
  82. }
  83. .number_css {
  84. width: 100%;
  85. text-align: right;
  86. margin-top: 26rpx;
  87. color: #BABABA;
  88. }
  89. </style>