draw.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. <view style="color: #fff;">
  4. <tn-nav-bar backgroundColor="#26B3A0" :bottomShadow="false">绘画记录</tn-nav-bar>
  5. </view>
  6. <z-paging ref="paging" refresher-complete-delay="200" v-model="drawList" @query="queryList">
  7. <view slot="top" class="z_tabs" :style="{ marginTop: tobheight + 'px' }"></view>
  8. <view class="u-flex flex-wrap">
  9. <block v-for="(item,index) in drawList" :key="index">
  10. <view @click="preview(index)" class="draw_view">
  11. <image :src="item.path" mode="aspectFill"></image>
  12. <view class="prompt">{{item.prompt}}</view>
  13. <view class="circle" @click.stop="gallerydel(index)">
  14. <u-icon name="close-circle-fill" color="#e83a30" size="24"></u-icon>
  15. </view>
  16. </view>
  17. </block>
  18. <!-- <view class="draw_view">
  19. <image src="https://yijian-painting-prod.cdn.bcebos.com/content/766556a3c73e28803cf28e30d06b88e0/85aa8a0e-e4d3-40c0-8a4d-38c21e8dfd2e.jpg" mode="aspectFill"></image>
  20. <view class="">画一碗猪脚面</view>
  21. </view>
  22. <view class="draw_view">
  23. <image src="https://yijian-painting-prod.cdn.bcebos.com/content/766556a3c73e28803cf28e30d06b88e0/85aa8a0e-e4d3-40c0-8a4d-38c21e8dfd2e.jpg" mode="aspectFill"></image>
  24. <view class="">画一碗猪脚面</view>
  25. </view>
  26. <view class="draw_view">
  27. <image src="https://yijian-painting-prod.cdn.bcebos.com/content/766556a3c73e28803cf28e30d06b88e0/85aa8a0e-e4d3-40c0-8a4d-38c21e8dfd2e.jpg" mode="aspectFill"></image>
  28. <view class="">画一碗猪脚面</view>
  29. </view> -->
  30. </view>
  31. </z-paging>
  32. <wike-loading-page :isLoading="isLoading"></wike-loading-page>
  33. </view>
  34. </template>
  35. <script>
  36. import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
  37. export default {
  38. data() {
  39. return {
  40. tobheight: 45,
  41. platform: this.$platform.get(),
  42. isLoading: true,
  43. drawList:[]
  44. }
  45. },
  46. computed: {
  47. ...mapGetters(['appInfo', 'userInfo', 'isLogin'])
  48. },
  49. onLoad() {
  50. const that = this;
  51. if (this.platform == 'wxMiniProgram') {
  52. var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight;
  53. var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop;
  54. this.tobheight = menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height;
  55. }
  56. },
  57. methods: {
  58. queryList(pageNo, pageSize) {
  59. //这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  60. const params = {
  61. page: pageNo,
  62. limit: pageSize
  63. };
  64. this.$http('gallery.list', params).then(res => {
  65. if (res.code == 0) {
  66. uni.setNavigationBarTitle({
  67. title: this.appInfo.site_name
  68. });
  69. this.$refs.paging.complete(res.data.data);
  70. this.isLoading = false;
  71. }
  72. });
  73. },
  74. preview(e){
  75. uni.previewImage({
  76. urls: [this.drawList[e].path],
  77. });
  78. },
  79. gallerydel(e){
  80. var that = this;
  81. uni.showModal({
  82. confirmText: '删除',
  83. content: '是否删除此绘画记录',
  84. title: '提示',
  85. confirmColor: '#26B3A0',
  86. success(res) {
  87. // console.log(res);
  88. if (res.confirm) {
  89. that.$http('gallery.del', {id:that.drawList[e].id}).then(res => {
  90. if (res.code == 0) {
  91. uni.showToast({
  92. title:'删除成功'
  93. })
  94. // that.drawList = []
  95. that.$refs.paging.reload(true);
  96. }else{
  97. uni.showToast({
  98. title:'删除失败',
  99. icon:'none'
  100. })
  101. }
  102. });
  103. }
  104. }
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. page {
  112. background: #f6f7fb;
  113. }
  114. .draw_view{
  115. margin: 30rpx;
  116. width: 100%;
  117. background: #fff;
  118. border-radius: 0 0 20rpx 20rpx;
  119. // padding: 30rpx;
  120. position: relative;
  121. image{
  122. width: 100%;
  123. height: 280rpx;
  124. border-radius: 20rpx 20rpx 0 0;
  125. }
  126. .prompt{
  127. padding: 20rpx 30rpx 30rpx;
  128. }
  129. .circle{
  130. position: absolute;
  131. right: -12rpx;
  132. top: -12rpx;
  133. background: #fff;
  134. border-radius: 50%;
  135. }
  136. }
  137. </style>