index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="index-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="index-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="index-content-header">
  6. <customNavbar
  7. title="全民分享"
  8. bgColor="rgba(0,0,0,0)"
  9. :is-left="false"
  10. :customNavbarInfo='{}'>
  11. <view slot="right">
  12. <image @click="getRetailQrcode()" style="width: 44rpx;height: 44rpx;" :src="fengxiang" mode=""></image>
  13. </view>
  14. </customNavbar>
  15. <u-search
  16. @clickIcon="navigateToFun('/pages/index/search')"
  17. @custom="navigateToFun('/pages/index/search')"
  18. @focus="navigateToFun('/pages/index/search')"
  19. :showAction="true"
  20. bgColor="#fff"
  21. actionText="搜索">
  22. </u-search>
  23. </view>
  24. <!-- 头部主要内容 结束 -->
  25. <!-- 列表主要内容 开始 -->
  26. <view class="index-content-list">
  27. <customScrollList
  28. ref="customScrollList"
  29. @load="load"
  30. @paging="paging"
  31. @refresh="refresh"
  32. >
  33. <view class="index-content-list-info" v-if="retailIndex.length>0">
  34. <text class="index-content-list-class">剧目</text>
  35. <view
  36. class="index-content-list-item"
  37. v-for="(item,index) in retailIndex"
  38. :key="index">
  39. <view class="index-content-list-content">
  40. <image
  41. class="index-content-list-image"
  42. :src="item.showImg" mode="scaleToFill"></image>
  43. <view class="index-content-list-tool">
  44. <text class="index-content-list-title">{{ item.name }}</text>
  45. <text
  46. class="index-content-list-but"
  47. @click="navigateToFun('/pages/publicSharingDetails/index',{ performId: item.id})"
  48. >查看</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </customScrollList>
  54. </view>
  55. <!-- 列表主要内容 结束 -->
  56. </view>
  57. <!-- 我的分享码 -->
  58. <customPromotionCode ref="customPromotionCode" />
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. navigateTo
  64. } from "@/utils/util.js"
  65. export default {
  66. data() {
  67. return {
  68. title: '全民分享',
  69. loading: false,
  70. statusBarHeight: 0, // 状态栏安全距离
  71. retailIndex: [], // 剧目列表
  72. fengxiang: this.$commonConfig.staticUrl+'index/fengxiang.png'
  73. }
  74. },
  75. onLoad() {
  76. },
  77. onShow() {
  78. this.statusBarHeight = getApp().globalData.statusBarHeight
  79. //this.load()
  80. },
  81. methods: {
  82. async load(paging){
  83. console.log("上拉 加载数据")
  84. try{
  85. let res = await this.$u.api.retailIndex({
  86. "page": paging.page,
  87. "pages": paging.size,
  88. })
  89. if(res && res.code ===200) {
  90. if(res.data.performList){
  91. this.retailIndex = this.retailIndex.concat(res.data.performList)
  92. }else {
  93. this.retailIndex = []
  94. }
  95. this.$refs.customScrollList.loadSuccess({
  96. list: this.retailIndex,
  97. total: this.retailIndex.length
  98. })
  99. } else {
  100. this.$refs.customScrollList.loadSuccess({
  101. list: [],
  102. total: 0
  103. })
  104. }
  105. }catch(e){
  106. //TODO handle the exception
  107. console.error("e===",e)
  108. this.$refs.customScrollList.loadSuccess({
  109. list: [],
  110. total: 0
  111. })
  112. }
  113. },
  114. paging(){
  115. console.log("下拉 加载数据")
  116. },
  117. /**
  118. * 下拉触底
  119. */
  120. async refresh(paging){
  121. console.log("上拉 加载数据",this.retailIndex)
  122. //this.$refs.customScrollList.showEmpty = true
  123. try{
  124. //this.$refs.customScrollList.showPullUp = true
  125. let res = await this.$u.api.retailIndex({
  126. pageNum: paging.page,
  127. pageSize: paging.size
  128. })
  129. if(res && res.code ===200) {
  130. if(res.data.performList){
  131. this.retailIndex = [].concat(res.data.performList)
  132. }else {
  133. this.retailIndex = []
  134. }
  135. // this.retailIndex = null
  136. this.$refs.customScrollList.refreshSuccess({
  137. list: this.retailIndex,
  138. total: this.retailIndex.length
  139. })
  140. } else {
  141. this.$refs.customScrollList.refreshSuccess({
  142. list: [],
  143. total: 0
  144. })
  145. }
  146. }catch(e){
  147. //TODO handle the exception
  148. console.error("e===",e)
  149. this.$refs.customScrollList.refreshSuccess({
  150. list: [],
  151. total: 0
  152. })
  153. }
  154. },
  155. /**
  156. * @author ygh
  157. * @data 2023-12-20
  158. */
  159. navigateToFun(url,data={}) {
  160. console.log("dsffd",data)
  161. navigateTo(url,data)
  162. },
  163. /**
  164. * 我的推广码
  165. */
  166. async getRetailQrcode(){
  167. try{
  168. let res = await this.$u.api.getRetailQrcode({
  169. noSign: 1,
  170. userid: this.distribution_user_info.userId
  171. })
  172. if(res && res.code ===200) {
  173. this.$refs.customPromotionCode.initData(res.data)
  174. // #ifdef H5
  175. //window.history.pushState(null, null, document.URL)
  176. // #endif
  177. }
  178. }catch(e){
  179. //TODO handle the exception
  180. console.error("e===",e)
  181. }
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. .index-content {
  188. display: flex;
  189. flex-direction: column;
  190. align-items: center;
  191. justify-content: center;
  192. box-sizing: border-box;
  193. --header-h: 170rpx;
  194. // background-color:
  195. .index-content-info {
  196. width: 100%;
  197. box-sizing: border-box;
  198. }
  199. }
  200. /** 头部主要内容 开始 */
  201. .index-content-header {
  202. width: 100%;
  203. height: var(--header-h);
  204. box-sizing: border-box;
  205. background-color: var(--gd-bgm-color);
  206. ::v-deep .u-search {
  207. padding: 0 30rpx !important;
  208. }
  209. ::v-deep .u-search__action {
  210. color: #fff !important;
  211. }
  212. }
  213. /** 头部主要内容 结束 **/
  214. /** 列表主要内容 开始 */
  215. .index-content-list {
  216. width: 100%;
  217. height: calc( 100% - var(--header-h) - var(--status-bar-h) );
  218. }
  219. .index-content-list-info {
  220. width: 100%;
  221. box-sizing: border-box;
  222. padding: 32rpx 32rpx 150rpx;
  223. .index-content-list-class {
  224. font-size: 32rpx;
  225. font-family: SourceHanSansCN, SourceHanSansCN;
  226. font-weight: bold;
  227. color: #2D2D2D;
  228. }
  229. .index-content-list-item {
  230. width: 100%;
  231. box-sizing: border-box;
  232. background: #FFFFFF;
  233. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(200,200,200,0.5);
  234. border-radius: 24rpx;
  235. overflow: hidden;
  236. margin-top: 40rpx;
  237. .index-content-list-content {
  238. width: 100%;
  239. box-sizing: border-box;
  240. .index-content-list-image {
  241. width: 100%;
  242. height: 242rpx;
  243. }
  244. .index-content-list-tool {
  245. display: flex;
  246. width: 100%;
  247. justify-content: space-between;
  248. align-items: center;
  249. padding:42rpx 28rpx 46rpx;
  250. box-sizing: border-box;
  251. .index-content-list-title {
  252. font-size: 28rpx;
  253. font-family: SourceHanSansCN, SourceHanSansCN;
  254. font-weight: bold;
  255. color: #363636;
  256. }
  257. .index-content-list-but {
  258. width: 160rpx;
  259. height: 51rpx;
  260. background: #ED0000;
  261. border-radius: 24rpx;
  262. font-size: 20rpx;
  263. font-family: PingFangSC, PingFang SC;
  264. font-weight: 400;
  265. color: #FFFFFF;
  266. display: flex;
  267. justify-content: center;
  268. align-items: center;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. /** 列表主要内容 结束 **/
  275. </style>