index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. <!-- 入网认证 -->
  60. <u-modal
  61. :show="show"
  62. :title="title1"
  63. :content='content'
  64. cancelText='取消'
  65. :confirmText='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: -1, // 是否展示 推广码
  88. show: false,
  89. title1:'提示',
  90. content:'你的二维码已关闭!',
  91. confirmText: '确认',
  92. }
  93. },
  94. onLoad() {
  95. },
  96. onShow() {
  97. this.statusBarHeight = getApp().globalData.statusBarHeight
  98. //this.load()
  99. },
  100. methods: {
  101. async load(paging){
  102. console.log("上拉 加载数据")
  103. try{
  104. let res = await this.$u.api.retailIndex({
  105. "page": paging.page,
  106. "pages": paging.size,
  107. })
  108. if(res && res.code ===200) {
  109. if(res.data.performList){
  110. this.retailIndex = this.retailIndex.concat(res.data.performList)
  111. }else {
  112. this.retailIndex = []
  113. }
  114. this.$refs.customScrollList.loadSuccess({
  115. list: this.retailIndex,
  116. total: this.retailIndex.length
  117. })
  118. } else {
  119. this.$refs.customScrollList.loadSuccess({
  120. list: [],
  121. total: 0
  122. })
  123. }
  124. }catch(e){
  125. //TODO handle the exception
  126. console.error("e===",e)
  127. this.$refs.customScrollList.loadSuccess({
  128. list: [],
  129. total: 0
  130. })
  131. }
  132. },
  133. paging(){
  134. console.log("下拉 加载数据")
  135. },
  136. /**
  137. * 下拉触底
  138. */
  139. async refresh(paging){
  140. console.log("上拉 加载数据",this.retailIndex)
  141. //this.$refs.customScrollList.showEmpty = true
  142. try{
  143. //this.$refs.customScrollList.showPullUp = true
  144. let res = await this.$u.api.retailIndex({
  145. pageNum: paging.page,
  146. pageSize: paging.size
  147. })
  148. if(res && res.code ===200) {
  149. if(res.data.performList){
  150. this.retailIndex = [].concat(res.data.performList)
  151. }else {
  152. this.retailIndex = []
  153. }
  154. // this.retailIndex = null
  155. this.$refs.customScrollList.refreshSuccess({
  156. list: this.retailIndex,
  157. total: this.retailIndex.length
  158. })
  159. } else {
  160. this.$refs.customScrollList.refreshSuccess({
  161. list: [],
  162. total: 0
  163. })
  164. }
  165. }catch(e){
  166. //TODO handle the exception
  167. console.error("e===",e)
  168. this.$refs.customScrollList.refreshSuccess({
  169. list: [],
  170. total: 0
  171. })
  172. }
  173. },
  174. /**
  175. * @author ygh
  176. * @data 2023-12-20
  177. */
  178. navigateToFun(url,data={}) {
  179. console.log("dsffd",data)
  180. navigateTo(url,data)
  181. },
  182. /**
  183. * 我的推广码
  184. */
  185. async getRetailQrcode(){
  186. try{
  187. await this.getUserInfo()
  188. if(this.isShowQrcode === 0) {
  189. this.show = true
  190. }else {
  191. let res = await this.$u.api.getRetailQrcode({
  192. noSign: 1,
  193. userid: this.distribution_user_info.userId
  194. })
  195. if(res && res.code ===200) {
  196. this.$refs.customPromotionCode.initData(res.data)
  197. // #ifdef H5
  198. //window.history.pushState(null, null, document.URL)
  199. // #endif
  200. }
  201. }
  202. }catch(e){
  203. //TODO handle the exception
  204. console.error("e===",e)
  205. }
  206. },
  207. /** 入网认证 */
  208. networkConfirm() {
  209. this.show = false
  210. //this.navigateToFun('/pages/networkAuth/index')
  211. //this.getUnionAccessUrlFun()
  212. },
  213. networkCancel() {
  214. this.show = false
  215. },
  216. /**
  217. * 获取用户信息
  218. */
  219. async getUserInfo() {
  220. try{
  221. let res = await this.$u.api.getInfo({
  222. noSign: 1,
  223. userid: this.distribution_user_info.userId
  224. })
  225. if(res && res.code ===200) {
  226. this.isShowQrcode = res.data.qrcodeStatus
  227. }
  228. }catch(e){
  229. //TODO handle the exception
  230. console.error("e===",e)
  231. this.isShowQrcode = -1
  232. }
  233. },
  234. /** 银联签约入网地址 */
  235. async getUnionAccessUrlFun(){
  236. try{
  237. let res = await this.$u.api.getUnionAccessUrl({
  238. userid: this.distribution_user_info.userId
  239. })
  240. if(res && res.code ===200) {
  241. this.show = false
  242. location.href = res.data.jumpUrl
  243. } else {
  244. this.show = true
  245. }
  246. }catch(e){
  247. //TODO handle the exception
  248. this.show = true
  249. console.error("e===",e)
  250. }
  251. }
  252. }
  253. }
  254. </script>
  255. <style lang="scss" scoped>
  256. .index-content {
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. justify-content: center;
  261. box-sizing: border-box;
  262. --header-h: 170rpx;
  263. // background-color:
  264. .index-content-info {
  265. width: 100%;
  266. box-sizing: border-box;
  267. }
  268. }
  269. /** 头部主要内容 开始 */
  270. .index-content-header {
  271. width: 100%;
  272. height: var(--header-h);
  273. box-sizing: border-box;
  274. background-color: var(--gd-bgm-color);
  275. ::v-deep .u-search {
  276. padding: 0 30rpx !important;
  277. }
  278. ::v-deep .u-search__action {
  279. color: #fff !important;
  280. }
  281. }
  282. /** 头部主要内容 结束 **/
  283. /** 列表主要内容 开始 */
  284. .index-content-list {
  285. width: 100%;
  286. height: calc( 100% - var(--header-h) - var(--status-bar-h) );
  287. }
  288. .index-content-list-info {
  289. width: 100%;
  290. box-sizing: border-box;
  291. padding: 32rpx 32rpx 150rpx;
  292. .index-content-list-class {
  293. font-size: 32rpx;
  294. font-family: SourceHanSansCN, SourceHanSansCN;
  295. font-weight: bold;
  296. color: #2D2D2D;
  297. }
  298. .index-content-list-item {
  299. width: 100%;
  300. box-sizing: border-box;
  301. background: #FFFFFF;
  302. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(200,200,200,0.5);
  303. border-radius: 24rpx;
  304. overflow: hidden;
  305. margin-top: 40rpx;
  306. .index-content-list-content {
  307. width: 100%;
  308. box-sizing: border-box;
  309. .index-content-list-image {
  310. width: 100%;
  311. height: 242rpx;
  312. }
  313. .index-content-list-tool {
  314. display: flex;
  315. width: 100%;
  316. justify-content: space-between;
  317. align-items: center;
  318. padding:42rpx 28rpx 46rpx;
  319. box-sizing: border-box;
  320. .index-content-list-title {
  321. font-size: 28rpx;
  322. font-family: SourceHanSansCN, SourceHanSansCN;
  323. font-weight: bold;
  324. color: #363636;
  325. }
  326. .index-content-list-but {
  327. width: 160rpx;
  328. height: 51rpx;
  329. background: #ED0000;
  330. border-radius: 24rpx;
  331. font-size: 20rpx;
  332. font-family: PingFangSC, PingFang SC;
  333. font-weight: 400;
  334. color: #FFFFFF;
  335. display: flex;
  336. justify-content: center;
  337. align-items: center;
  338. }
  339. }
  340. }
  341. }
  342. }
  343. /** 列表主要内容 结束 **/
  344. </style>