editNamePopup.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <up-popup :show="showBoardPopup" closeable mode="center" round="8" @close="closePopup">
  3. <view class="board-popup">
  4. <view class="name">编辑木牌</view>
  5. <view class="board-content">
  6. <view class="board-img">
  7. <view class="tag-img">
  8. <view class="tag-content">
  9. <view class="tag-name">【{{ editForm?.treeName || '茜茜荔' }}】</view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="edit-form">
  14. <view class="form-item">
  15. <view class="item-name">树名</view>
  16. <up-input
  17. placeholder="请输入树名"
  18. border="none"
  19. v-model="editForm.treeName"
  20. maxlength="4"
  21. ></up-input>
  22. </view>
  23. <view class="form-item">
  24. <view class="item-name">守护时间</view>
  25. <up-input
  26. border="none"
  27. v-model="editForm.createDate"
  28. readonly
  29. ></up-input>
  30. </view>
  31. </view>
  32. <up-button shape="circle" type="primary" text="确认修改" @click="onSubmit"></up-button>
  33. </view>
  34. </view>
  35. </up-popup>
  36. </template>
  37. <script setup>
  38. import { ref, reactive } from "vue";
  39. const showBoardPopup = ref(false);
  40. function showPopup({id, treeName, nickname, showName, createDate}) {
  41. editForm.id = id
  42. editForm.showName = showName
  43. editForm.treeName = treeName
  44. editForm.nickname = nickname
  45. editForm.createDate = createDate
  46. showBoardPopup.value = true
  47. }
  48. const editForm = reactive({
  49. id: null,
  50. treeName: "",
  51. nickname: "",
  52. showName: 1,
  53. createDate: "2025.06.18"
  54. })
  55. function onSubmit() {
  56. VE_API.guard_tree.updateTreeName(editForm).then(({ code }) => {
  57. // code === 0 && ElMessage.success("编辑成功");
  58. showBoardPopup.value = false
  59. emit("editEnd")
  60. });
  61. }
  62. const emit = defineEmits(["editEnd"])
  63. defineExpose({ showPopup });
  64. const closePopup = () =>{
  65. showBoardPopup.value = false
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. @import "@/static/style/mixin.scss";
  70. .board-popup {
  71. width: 85vw;
  72. padding: 40rpx;
  73. box-sizing: border-box;
  74. @include ossBg("treePage/popup-mask.png");
  75. .name {
  76. font-size: 48rpx;
  77. margin-bottom: 24rpx;
  78. text-align: center;
  79. font-family: "PangMenZhengDao";
  80. }
  81. .button {
  82. margin-top: 48rpx;
  83. color: #fff;
  84. padding: 16rpx;
  85. text-align: center;
  86. background: #2199f8;
  87. border-radius: 4rpx;
  88. }
  89. .board-content {
  90. .board-img {
  91. width: 100%;
  92. height: 320rpx;
  93. @include ossBg("treePage/tree-bg.png");
  94. border-radius: 16rpx;
  95. position: relative;
  96. .tag-img {
  97. position: absolute;
  98. left: 50%;
  99. transform: translateX(-50%);
  100. bottom: 0;
  101. .tag-content {
  102. @include ossBg("treePage/tag-bg.png");
  103. width: 276rpx;
  104. height: 274rpx;
  105. display: flex;
  106. flex-direction: column;
  107. align-items: center;
  108. color: #fff;
  109. .tag-name {
  110. font-family: "jiangxizhuokai";
  111. font-size: 44rpx;
  112. padding-top: 66rpx;
  113. ::v-deep {
  114. .el-input__wrapper {
  115. background: transparent;
  116. box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  117. }
  118. .el-input__inner {
  119. color: #fff;
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. .edit-form {
  127. padding: 12px 0;
  128. .form-item {
  129. display: flex;
  130. align-items: center;
  131. height: 46px;
  132. .item-name {
  133. width: 72px;
  134. flex: none;
  135. font-size: 16px;
  136. color: #8F8F8F;
  137. line-height: 30px;
  138. }
  139. }
  140. .form-item + .form-item {
  141. border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  142. }
  143. }
  144. }
  145. }
  146. </style>