notice.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. var data={
  55. flag : 1,
  56. notice:this.fleetInfo.notice,
  57. id:this.fleetInfo.id
  58. }
  59. this.$request.baseRequest('post', '/fleetInfo/api/editFleetInfo', data).then(res => {
  60. if (res.code == 200) {
  61. this.$refs.uToast.show({
  62. type: 'success',
  63. message: "公告发布成功!",
  64. complete() {
  65. // uni.$u.route("pages/riders/myTeam")
  66. uni.navigateBack({
  67. delta: 1
  68. });
  69. }
  70. })
  71. }
  72. // this.fleetInfo = res.data
  73. })
  74. .catch(res => {
  75. uni.$u.toast(res.message);
  76. });
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .center {
  83. padding: 30rpx;
  84. }
  85. .textInfo {
  86. background: #F9F9FB;
  87. }
  88. .number_css {
  89. width: 100%;
  90. text-align: right;
  91. margin-top: 26rpx;
  92. color: #BABABA;
  93. }
  94. </style>