editNamePopup.vue 4.5 KB

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