index.vue 5.6 KB

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