index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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 v-if="isShowQrcode" @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. <!-- 入网认证 -->
  60. <u-modal
  61. :show="show"
  62. :title="title1"
  63. :content='content'
  64. cancelText='取消'
  65. confirmText='去认证'
  66. showCancelButton
  67. confirmColor='#ED0000'
  68. @confirm='networkConfirm'
  69. @cancel='networkCancel'
  70. @close='networkCancel'
  71. ></u-modal>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. navigateTo
  77. } from "@/utils/util.js"
  78. export default {
  79. data() {
  80. return {
  81. title: '全民分享',
  82. loading: false,
  83. statusBarHeight: 0, // 状态栏安全距离
  84. retailIndex: [], // 剧目列表
  85. fengxiang: this.$commonConfig.staticUrl+'index/fengxiang.png',
  86. // 入网认证
  87. isShowQrcode: false, // 是否展示 推广码
  88. show: true,
  89. title1:'入网提示',
  90. content:'你还未进行银联支付入网签约认证,请先完成签约认证!',
  91. }
  92. },
  93. onLoad() {
  94. },
  95. onShow() {
  96. this.statusBarHeight = getApp().globalData.statusBarHeight
  97. //this.load()
  98. },
  99. methods: {
  100. async load(paging){
  101. console.log("上拉 加载数据")
  102. try{
  103. let res = await this.$u.api.retailIndex({
  104. "page": paging.page,
  105. "pages": paging.size,
  106. })
  107. if(res && res.code ===200) {
  108. if(res.data.performList){
  109. this.retailIndex = this.retailIndex.concat(res.data.performList)
  110. }else {
  111. this.retailIndex = []
  112. }
  113. this.$refs.customScrollList.loadSuccess({
  114. list: this.retailIndex,
  115. total: this.retailIndex.length
  116. })
  117. } else {
  118. this.$refs.customScrollList.loadSuccess({
  119. list: [],
  120. total: 0
  121. })
  122. }
  123. }catch(e){
  124. //TODO handle the exception
  125. console.error("e===",e)
  126. this.$refs.customScrollList.loadSuccess({
  127. list: [],
  128. total: 0
  129. })
  130. }
  131. },
  132. paging(){
  133. console.log("下拉 加载数据")
  134. },
  135. /**
  136. * 下拉触底
  137. */
  138. async refresh(paging){
  139. console.log("上拉 加载数据",this.retailIndex)
  140. //this.$refs.customScrollList.showEmpty = true
  141. try{
  142. //this.$refs.customScrollList.showPullUp = true
  143. let res = await this.$u.api.retailIndex({
  144. pageNum: paging.page,
  145. pageSize: paging.size
  146. })
  147. if(res && res.code ===200) {
  148. if(res.data.performList){
  149. this.retailIndex = [].concat(res.data.performList)
  150. }else {
  151. this.retailIndex = []
  152. }
  153. // this.retailIndex = null
  154. this.$refs.customScrollList.refreshSuccess({
  155. list: this.retailIndex,
  156. total: this.retailIndex.length
  157. })
  158. } else {
  159. this.$refs.customScrollList.refreshSuccess({
  160. list: [],
  161. total: 0
  162. })
  163. }
  164. }catch(e){
  165. //TODO handle the exception
  166. console.error("e===",e)
  167. this.$refs.customScrollList.refreshSuccess({
  168. list: [],
  169. total: 0
  170. })
  171. }
  172. },
  173. /**
  174. * @author ygh
  175. * @data 2023-12-20
  176. */
  177. navigateToFun(url,data={}) {
  178. console.log("dsffd",data)
  179. navigateTo(url,data)
  180. },
  181. /**
  182. * 我的推广码
  183. */
  184. async getRetailQrcode(){
  185. try{
  186. let res = await this.$u.api.getRetailQrcode({
  187. noSign: 1,
  188. userid: this.distribution_user_info.userId
  189. })
  190. if(res && res.code ===200) {
  191. this.$refs.customPromotionCode.initData(res.data)
  192. // #ifdef H5
  193. //window.history.pushState(null, null, document.URL)
  194. // #endif
  195. }
  196. }catch(e){
  197. //TODO handle the exception
  198. console.error("e===",e)
  199. }
  200. },
  201. /** 入网认证 */
  202. networkConfirm() {
  203. this.show = false
  204. },
  205. networkCancel() {
  206. this.show = false
  207. },
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .index-content {
  213. display: flex;
  214. flex-direction: column;
  215. align-items: center;
  216. justify-content: center;
  217. box-sizing: border-box;
  218. --header-h: 170rpx;
  219. // background-color:
  220. .index-content-info {
  221. width: 100%;
  222. box-sizing: border-box;
  223. }
  224. }
  225. /** 头部主要内容 开始 */
  226. .index-content-header {
  227. width: 100%;
  228. height: var(--header-h);
  229. box-sizing: border-box;
  230. background-color: var(--gd-bgm-color);
  231. ::v-deep .u-search {
  232. padding: 0 30rpx !important;
  233. }
  234. ::v-deep .u-search__action {
  235. color: #fff !important;
  236. }
  237. }
  238. /** 头部主要内容 结束 **/
  239. /** 列表主要内容 开始 */
  240. .index-content-list {
  241. width: 100%;
  242. height: calc( 100% - var(--header-h) - var(--status-bar-h) );
  243. }
  244. .index-content-list-info {
  245. width: 100%;
  246. box-sizing: border-box;
  247. padding: 32rpx 32rpx 150rpx;
  248. .index-content-list-class {
  249. font-size: 32rpx;
  250. font-family: SourceHanSansCN, SourceHanSansCN;
  251. font-weight: bold;
  252. color: #2D2D2D;
  253. }
  254. .index-content-list-item {
  255. width: 100%;
  256. box-sizing: border-box;
  257. background: #FFFFFF;
  258. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(200,200,200,0.5);
  259. border-radius: 24rpx;
  260. overflow: hidden;
  261. margin-top: 40rpx;
  262. .index-content-list-content {
  263. width: 100%;
  264. box-sizing: border-box;
  265. .index-content-list-image {
  266. width: 100%;
  267. height: 242rpx;
  268. }
  269. .index-content-list-tool {
  270. display: flex;
  271. width: 100%;
  272. justify-content: space-between;
  273. align-items: center;
  274. padding:42rpx 28rpx 46rpx;
  275. box-sizing: border-box;
  276. .index-content-list-title {
  277. font-size: 28rpx;
  278. font-family: SourceHanSansCN, SourceHanSansCN;
  279. font-weight: bold;
  280. color: #363636;
  281. }
  282. .index-content-list-but {
  283. width: 160rpx;
  284. height: 51rpx;
  285. background: #ED0000;
  286. border-radius: 24rpx;
  287. font-size: 20rpx;
  288. font-family: PingFangSC, PingFang SC;
  289. font-weight: 400;
  290. color: #FFFFFF;
  291. display: flex;
  292. justify-content: center;
  293. align-items: center;
  294. }
  295. }
  296. }
  297. }
  298. }
  299. /** 列表主要内容 结束 **/
  300. </style>