removeInfo.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="container">
  3. <view class="desc-box">
  4. 请您勾选需要删除的内容,删除后数据可能无法恢复,请您务必谨慎操作!
  5. </view>
  6. <view class="form-box">
  7. <u-checkbox-group @change="checkboxGroupChange" shape="circle" wrap>
  8. <u-checkbox
  9. icon-size="42"
  10. label-size="38"
  11. v-model="item.checked"
  12. v-for="(item, index) in checkOption" :key="index"
  13. :name="item.name"
  14. >{{item.name}}</u-checkbox>
  15. </u-checkbox-group>
  16. </view>
  17. <view class="bottom-box">
  18. <u-button type="primary" shape="circle" @click="onSubmit" :disabled="isSelect">提交</u-button>
  19. </view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import { ref, reactive, computed } from 'vue'
  24. import { onLoad, onReady } from '@dcloudio/uni-app'
  25. import { msgError, msgSuccess, showConfirm } from '@/utils/common'
  26. import { removeInfo } from '@/api/setting.js'
  27. const checkOption = ref([
  28. {
  29. value: 1,
  30. name: '消息',
  31. checked: false,
  32. disabled: false
  33. },
  34. {
  35. value: 2,
  36. name: '浏览历史',
  37. checked: false,
  38. disabled: false
  39. },
  40. {
  41. value: 3,
  42. name: '收藏',
  43. checked: false,
  44. disabled: false
  45. },
  46. {
  47. value: 4,
  48. name: '评论',
  49. checked: false,
  50. disabled: false
  51. },
  52. {
  53. value: 5,
  54. name: '点赞',
  55. checked: false,
  56. disabled: false
  57. },
  58. {
  59. value: 6,
  60. name: '订单(关闭)',
  61. checked: false,
  62. disabled: false
  63. },
  64. ])
  65. const isSelect = computed(() => {
  66. return checkOption.value.filter(item => item.checked).length === 0
  67. })
  68. function checkboxGroupChange() {
  69. }
  70. function onSubmit() {
  71. showConfirm('是否确认删除').then(res => {
  72. if (res.confirm) {
  73. const selectType = checkOption.value.filter(item => item.checked).map(item => item.value)
  74. const form = {
  75. type: `${selectType}`
  76. }
  77. removeInfo(form).then(res => {
  78. if (res && res.code === 0) {
  79. msgSuccess('操作成功')
  80. setTimeout(() => {
  81. uni.navigateBack()
  82. }, 500)
  83. } else {
  84. msgError('操作失败')
  85. }
  86. })
  87. }
  88. })
  89. }
  90. </script>
  91. <style>
  92. .u-checkbox{
  93. line-height: 2.2 !important;
  94. padding: 0 20rpx;
  95. }
  96. </style>
  97. <style lang="scss" scoped>
  98. .container {
  99. height: 100vh;
  100. width: 100vw;
  101. background-color: $uni-bg-color;
  102. padding: 20rpx;
  103. .desc-box {
  104. text-indent: 2em;
  105. line-height: 60rpx;
  106. padding: 20rpx 0;
  107. margin-bottom: 20rpx;
  108. }
  109. .form-box {
  110. padding: 20rpx 0;
  111. line-height: 2.8;
  112. .input-code {
  113. display: flex;
  114. align-items: center;
  115. gap: 20rpx;
  116. .input {
  117. width: 70%;
  118. }
  119. .btn {
  120. width: 30%;
  121. text-align: center;
  122. }
  123. }
  124. }
  125. .bottom-box {
  126. margin-top: 50rpx;
  127. padding: 0 50rpx;
  128. }
  129. }
  130. </style>