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