editNamePopup.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. import TREE from '@/api/tree.js'
  40. const showBoardPopup = ref(false);
  41. function showPopup({id, treeName, nickname, showName, createDate}) {
  42. editForm.id = id
  43. editForm.showName = showName
  44. editForm.treeName = treeName
  45. editForm.nickname = nickname
  46. editForm.createDate = createDate
  47. showBoardPopup.value = true
  48. }
  49. const editForm = reactive({
  50. id: null,
  51. treeName: "",
  52. nickname: "",
  53. showName: 1,
  54. createDate: ""
  55. })
  56. function onSubmit() {
  57. TREE.updateTreeName(editForm).then(({ code }) => {
  58. if(code === 0){
  59. uni.showToast({
  60. title: '编辑成功',
  61. icon:'none',
  62. duration: 2000
  63. });
  64. showBoardPopup.value = false
  65. emit("editEnd")
  66. }
  67. });
  68. }
  69. const emit = defineEmits(["editEnd"])
  70. defineExpose({ showPopup });
  71. const closePopup = () =>{
  72. showBoardPopup.value = false
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. @import "@/static/style/mixin.scss";
  77. .board-popup {
  78. width: 85vw;
  79. padding: 40rpx;
  80. box-sizing: border-box;
  81. @include ossBg("treePage/popup-mask.png");
  82. .name {
  83. font-size: 48rpx;
  84. margin-bottom: 24rpx;
  85. text-align: center;
  86. font-family: "PangMenZhengDao";
  87. }
  88. .button {
  89. margin-top: 48rpx;
  90. color: #fff;
  91. padding: 16rpx;
  92. text-align: center;
  93. background: #2199f8;
  94. border-radius: 4rpx;
  95. }
  96. .board-content {
  97. .board-img {
  98. width: 100%;
  99. height: 320rpx;
  100. @include ossBg("treePage/tree-bg.png");
  101. border-radius: 16rpx;
  102. position: relative;
  103. .tag-img {
  104. position: absolute;
  105. left: 50%;
  106. transform: translateX(-50%);
  107. bottom: 0;
  108. .tag-content {
  109. @include ossBg("treePage/tag-bg.png");
  110. width: 276rpx;
  111. height: 274rpx;
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. color: #fff;
  116. .tag-name {
  117. font-family: "jiangxizhuokai";
  118. font-size: 44rpx;
  119. padding-top: 66rpx;
  120. ::v-deep {
  121. .el-input__wrapper {
  122. background: transparent;
  123. box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  124. }
  125. .el-input__inner {
  126. color: #fff;
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. .edit-form {
  134. padding: 12px 0;
  135. .form-item {
  136. display: flex;
  137. align-items: center;
  138. height: 46px;
  139. .item-name {
  140. width: 72px;
  141. flex: none;
  142. font-size: 16px;
  143. color: #8F8F8F;
  144. line-height: 30px;
  145. }
  146. }
  147. .form-item + .form-item {
  148. border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  149. }
  150. }
  151. }
  152. }
  153. </style>