index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view>
  3.  <u-tabs :scrollable="false" lineColor="#C30D23" :activeStyle="{ color: '#C30D23', fontWeight: 'bold' }"
  4. :list="tabs" @click="changeCurrent" :current="current" />
  5. <view style="height: 10px;" />
  6. <My_listbox ref="List" @getlist="getList" bottomHeight="70">
  7. <designList ref="designList" :list="list" @toDetail="toDetail" showStatus />
  8. </My_listbox>
  9. <view class="footer">
  10. <view class="add" hover-class="navigator" @click="toUpload">
  11. 上传
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import designList from "../../components/designList";
  18. export default {
  19. components: { designList },
  20. data() {
  21. return {
  22. current: 0,
  23. tabs: [{
  24. name: '我的设计',
  25. }, {
  26. name: '我的实景',
  27. }],
  28. list: [],
  29. "content": {
  30. "where": {
  31. "condition": "",
  32. "type": 4 //4:设计,5:实景
  33. }
  34. }
  35. }
  36. },
  37. onLoad(options) {
  38. uni.setNavigationBarTitle({
  39. title: '设计实景'
  40. });
  41. this.getList(true)
  42. },
  43. methods: {
  44. getList(init = false) {
  45. if (this.paging(this.content, init)) return;
  46. this.$Http.basic({
  47. "id": "2024052413361402",
  48. content: this.content
  49. }).then(res => {
  50. console.log("我的设计实景列表", res)
  51. this.$refs.List.RefreshToComplete()
  52. if (this.cutoff(res.msg)) return;
  53. res.data = this.$refs.designList.handleList(res.data)
  54. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  55. this.content = this.$refs.List.paging(this.content, res)
  56. })
  57. },
  58. changeCurrent({ name }) {
  59. this.content.where.type = name == '我的设计' ? 4 : 5;
  60. this.getList(true)
  61. },
  62. updateList(data = null) {
  63. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  64. let that = this;
  65. let content = this.paging(this.content, true, true)
  66. this.$Http.basic({
  67. "id": "2024052413361402",
  68. content
  69. }).then(res => {
  70. console.log("更新列表", res)
  71. if (this.cutoff(res.msg)) return;
  72. res.data = res.data.map(v => {
  73. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "sat_sharematerial") || v.attinfos[0]) : uni.getStorageSync("site").logo || ''
  74. return v
  75. })
  76. this.list = res.data;
  77. this.$refs.List.paging(content, res, true)
  78. if (data) handle();
  79. })
  80. function handle() {
  81. uni.showModal({
  82. title: '提示',
  83. content: '新建成功,是否立即查看',
  84. cancelText: '返回列表',
  85. confirmText: '查看详情',
  86. success: ({ confirm }) => {
  87. if (confirm) {
  88. let index = that.list.findIndex(v => v.sat_sharematerialid == data.sat_sharematerialid);
  89. if (index == -1) {
  90. uni.redirectTo({
  91. url: `/packageA/fullView/detail?id=${data.sat_sharematerialid}`
  92. });
  93. that.$Http.setCount = null;
  94. } else {
  95. that.toDetail(index, 2)
  96. }
  97. } else {
  98. uni.navigateBack();
  99. }
  100. },
  101. })
  102. }
  103. }
  104. },
  105. toDetail(index, type = 1) {
  106. let item = this.list[index]
  107. if (type == 1) {
  108. uni.navigateTo({
  109. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  110. });
  111. } else {
  112. uni.redirectTo({
  113. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  114. });
  115. }
  116. this.$Http.setCount = function (detail) {
  117. item.collectcount = detail.collectcount;
  118. item.commentcount = detail.commentcount;
  119. item.likecount = detail.likecount;
  120. item.islike = detail.islike;
  121. item.iscollect = detail.iscollect;
  122. this.$set(this.list, index, item)
  123. }.bind(this)
  124. },
  125. toUpload() {
  126. uni.navigateTo({
  127. url: '/packageA/fullView/upload?pageType=' + (this.content.where.type == 4 ? '设计' : '实景'),
  128. })
  129. this.$Http.updateList = this.updateList.bind(this);
  130. }
  131. },
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .footer {
  136. position: fixed;
  137. bottom: 0;
  138. width: 100vw;
  139. height: 65px;
  140. background: #FFFFFF;
  141. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  142. box-sizing: border-box;
  143. padding: 5px 10px;
  144. display: flex;
  145. .add {
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. width: 100%;
  150. height: 45px;
  151. background: #C30D23;
  152. border-radius: 5px;
  153. font-family: PingFang SC, PingFang SC;
  154. font-size: 14px;
  155. color: #FFFFFF;
  156. }
  157. }
  158. </style>