TopTools.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="top-tools">
  3. <div class="left-tools">
  4. <img src="../../assets/image/home/home.png" class="img-home" @click="backHome" />
  5. <div class="title" v-if="!show_edit" @click="toEdit">{{ current_name }}</div>
  6. <div class="title" v-else>
  7. <a-input ref="inputRef" v-model="current_name" @blur="saveName"></a-input>
  8. </div>
  9. <div class="sub-title" v-if="updated_at">最近保存{{ updated_at }}</div>
  10. </div>
  11. <div class="right-tools">
  12. <SearchAndUpload></SearchAndUpload>
  13. </div>
  14. <ModalCloseRecord
  15. :visible.async="show_close_record"
  16. @ok="handlerOk"
  17. @cancel="show_close_record = false"
  18. ></ModalCloseRecord>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { ref, nextTick } from 'vue';
  23. import SearchAndUpload from './top-tools/SearchAndUpload.vue';
  24. import ModalCloseRecord from './top-tools/ModalCloseRecord.vue';
  25. import { bus_change_page, bus_stop_record } from '../../base/event-bus.js';
  26. import { updateMeetingDetail } from '../../apis/home.js';
  27. import { useMeetingStore } from '../../base/store/use-meeting.js';
  28. const useMeeting = useMeetingStore();
  29. const current_name = ref(useMeeting.current_meeting_data.name);
  30. const show_edit = ref(false);
  31. const inputRef = ref(null);
  32. const updated_at = ref(useMeeting.current_meeting_data.updated_at);
  33. const show_close_record = ref(false);
  34. const toEdit = () => {
  35. show_edit.value = true;
  36. nextTick(() => {
  37. inputRef.value.focus();
  38. });
  39. };
  40. const backHome = () => {
  41. if (useMeeting.meet_type == 'startMeet') {
  42. console.log('startMeet');
  43. show_close_record.value = true;
  44. } else {
  45. handlerOk();
  46. }
  47. // TODO:加提示
  48. };
  49. const handlerOk = () => {
  50. console.log('handlerOk');
  51. // 初始化数据后回到首页
  52. useMeeting.initMeetingData();
  53. bus_stop_record.emit();
  54. bus_change_page.emit('home');
  55. };
  56. const saveName = (e) => {
  57. // TODO:更新名称
  58. const meeting_id = useMeeting.meet_id;
  59. const data = {
  60. name: e.target.value,
  61. description: ''
  62. };
  63. updateMeetingDetail(meeting_id, data).then((res) => {
  64. show_edit.value = false;
  65. });
  66. };
  67. </script>
  68. <style scoped lang="css">
  69. .top-tools {
  70. display: flex;
  71. flex-direction: row;
  72. justify-content: space-between;
  73. height: 100%;
  74. font-size: 18px;
  75. }
  76. .left-tools {
  77. display: flex;
  78. align-items: center;
  79. gap: 10px;
  80. }
  81. .title {
  82. font-weight: bold;
  83. }
  84. .sub-title {
  85. font-size: 12px;
  86. color: var(--text-save-time-color);
  87. margin-top: 10px;
  88. }
  89. .img-home {
  90. width: 24px;
  91. cursor: pointer;
  92. }
  93. :deep(.arco-input) {
  94. font-weight: bold;
  95. }
  96. </style>