index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. this.$refs.List.paging(content, res, true)
  77. if (data) handle();
  78. })
  79. function handle() {
  80. uni.showModal({
  81. title: '提示',
  82. content: '新建成功,是否立即查看',
  83. cancelText: '返回列表',
  84. confirmText: '查看详情',
  85. success: ({ confirm }) => {
  86. if (confirm) {
  87. let index = that.list.findIndex(v => v.sat_sharematerialid == data.sat_sharematerialid);
  88. if (index == -1) {
  89. uni.redirectTo({
  90. url: `/packageA/fullView/detail?id=${data.sat_sharematerialid}`
  91. });
  92. that.$Http.setCount = null;
  93. } else {
  94. that.toDetail(index, 2)
  95. }
  96. } else {
  97. uni.navigateBack();
  98. }
  99. },
  100. })
  101. }
  102. }
  103. },
  104. toDetail(index, type = 1) {
  105. let item = this.list[index]
  106. if (type == 1) {
  107. uni.navigateTo({
  108. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  109. });
  110. } else {
  111. uni.redirectTo({
  112. url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
  113. });
  114. }
  115. this.$Http.setCount = function (detail) {
  116. item.collectcount = detail.collectcount;
  117. item.commentcount = detail.commentcount;
  118. item.likecount = detail.likecount;
  119. item.islike = detail.islike;
  120. item.iscollect = detail.iscollect;
  121. this.$set(this.list, index, item)
  122. }.bind(this)
  123. },
  124. toUpload() {
  125. uni.navigateTo({
  126. url: '/packageA/fullView/upload?pageType=' + (this.content.where.type == 4 ? '设计' : '实景'),
  127. })
  128. this.$Http.updateList = this.updateList.bind(this);
  129. }
  130. },
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .footer {
  135. position: fixed;
  136. bottom: 0;
  137. width: 100vw;
  138. height: 65px;
  139. background: #FFFFFF;
  140. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  141. box-sizing: border-box;
  142. padding: 5px 10px;
  143. display: flex;
  144. .add {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. width: 100%;
  149. height: 45px;
  150. background: #C30D23;
  151. border-radius: 5px;
  152. font-family: PingFang SC, PingFang SC;
  153. font-size: 14px;
  154. color: #FFFFFF;
  155. }
  156. }
  157. </style>