changyong-list.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="changyong-list">
  3. <view class="changyong-item u-flex u-col-top" v-for="(item,index) in changList" :key="index">
  4. <view class="item-text u-flex-1">
  5. {{item.content}}
  6. </view>
  7. <image @click="emit(item.content,item.id)" src="/pagesC/static/edit.png" mode=""></image>
  8. <image @click="dell(item.id)" src="/pagesC/static/del.png" mode=""></image>
  9. </view>
  10. <view style="height: 70vh;display: flex;justify-content: center;align-items: center;"
  11. v-if="changList.length == 0">
  12. <u-empty text="暂无数据" mode="list"></u-empty>
  13. </view>
  14. <view class="changyong-down">
  15. <view class="u-flex u-row-center changyong-btn">
  16. <text @click="toadd">添加常用语</text>
  17. </view>
  18. <view class="safe-area-inset-bottom"></view>
  19. </view>
  20. <u-modal :show="show" :content="title" :show-cancel-button="true" @confirm="del"
  21. @cancel="show = false"></u-modal>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. phraseList,
  27. phrase_destory
  28. } from "../units/inquire.js"
  29. export default {
  30. data() {
  31. return {
  32. changList: [],
  33. show: false,
  34. title: "确定要删除此常用语吗?"
  35. }
  36. },
  37. onLoad() {
  38. },
  39. onShow() {
  40. this.getlist()
  41. },
  42. methods: {
  43. dell(id) {
  44. this.show = true
  45. this.id = id
  46. },
  47. emit(content, id) {
  48. uni.navigateTo({
  49. url: "/pagesC/changyong-add?content=" + content + "&id=" + id
  50. })
  51. },
  52. del() {
  53. phrase_destory({
  54. id: this.id
  55. }).then(res => {
  56. this.getlist()
  57. this.show = false
  58. })
  59. },
  60. getlist() {
  61. phraseList().then(res => {
  62. this.changList = res.data
  63. })
  64. },
  65. toadd() {
  66. uni.navigateTo({
  67. url: "/pagesC/changyong-add"
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. .changyong-list {
  75. padding: 0 32rpx;
  76. .changyong-down {
  77. position: fixed;
  78. bottom: 0;
  79. left: 0;
  80. z-index: 99;
  81. background-color: #fff;
  82. box-shadow: 0rpx -1rpx 0rpx 0rpx rgba(0, 0, 0, 0.1);
  83. width: 750rpx;
  84. .changyong-btn {
  85. padding: 16rpx 0;
  86. text {
  87. width: 686rpx;
  88. line-height: 88rpx;
  89. background: #0C66C2;
  90. border-radius: 12rpx;
  91. text-align: center;
  92. font-size: 32rpx;
  93. font-family: PingFangSC-Regular, PingFang SC;
  94. font-weight: 400;
  95. color: #FFFFFF;
  96. }
  97. }
  98. }
  99. .changyong-item {
  100. padding: 32rpx 0;
  101. border-bottom: 2rpx solid #F0F0F0;
  102. .item-text {
  103. margin-right: 16rpx;
  104. font-size: 30rpx;
  105. font-family: PingFangSC-Regular, PingFang SC;
  106. font-weight: 400;
  107. color: #222222;
  108. }
  109. image {
  110. width: 40rpx;
  111. height: 40rpx;
  112. margin-left: 32rpx;
  113. }
  114. }
  115. }
  116. </style>