inbound_info_modal.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. {{define "inboundInfoModal"}}
  2. {{template "component/inboundInfo"}}
  3. <a-modal id="inbound-info-modal" v-model="infoModal.visible" title='{{ i18n "pages.inbounds.details"}}' @ok="infoModal.ok"
  4. :closable="true" :mask-closable="true"
  5. ok-text='{{ i18n "pages.inbounds.copyLink"}}' cancel-text='{{ i18n "close" }}' :ok-button-props="infoModal.okBtnPros">
  6. <inbound-info :db-inbound="dbInbound" :inbound="inbound"></inbound-info>
  7. </a-modal>
  8. <script>
  9. const infoModal = {
  10. visible: false,
  11. inbound: new Inbound(),
  12. dbInbound: new DBInbound(),
  13. clipboard: null,
  14. okBtnPros: {
  15. attrs: {
  16. id: "inbound-info-modal-ok-btn",
  17. style: "",
  18. },
  19. },
  20. show(dbInbound) {
  21. this.inbound = dbInbound.toInbound();
  22. this.dbInbound = new DBInbound(dbInbound);
  23. this.visible = true;
  24. if (dbInbound.hasLink()) {
  25. this.okBtnPros.attrs.style = "";
  26. } else {
  27. this.okBtnPros.attrs.style = "display: none";
  28. }
  29. if (this.clipboard == null) {
  30. infoModalApp.$nextTick(() => {
  31. this.clipboard = new ClipboardJS(`#${this.okBtnPros.attrs.id}`, {
  32. text: () => this.dbInbound.genLink(),
  33. });
  34. this.clipboard.on('success', () => app.$message.success('{{ i18n "copySuccess" }}'));
  35. });
  36. }
  37. },
  38. close() {
  39. infoModal.visible = false;
  40. },
  41. };
  42. const infoModalApp = new Vue({
  43. delimiters: ['[[', ']]'],
  44. el: '#inbound-info-modal',
  45. data: {
  46. infoModal,
  47. get dbInbound() {
  48. return this.infoModal.dbInbound;
  49. },
  50. get inbound() {
  51. return this.infoModal.inbound;
  52. }
  53. },
  54. });
  55. </script>
  56. {{end}}