notice.vue 1.9 KB

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