123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <view class="index-content" :style="{'--status-bar-': statusBarHeight}">
- <view class="index-content-info">
- <!-- 头部主要内容 开始 -->
- <view class="index-content-header">
- <customNavbar
- title="搜索"
- bgColor="rgba(0,0,0,0)"
- :is-left="true"
- :leftStyle="{ color: '#fff' }"
- :customNavbarInfo='{}'></customNavbar>
- <u-search
- v-model="keyValue"
- :showAction="true"
- bgColor="#fff"
- actionText="搜索"
- @search="search"
- @custom="search"
- ></u-search>
- </view>
- <!-- 头部主要内容 结束 -->
-
- <!-- 列表主要内容 开始 -->
-
- <view class="index-content-list">
- <customScrollList
- ref="customScrollList"
- @load="load"
- @paging="paging"
- @refresh="refresh"
- >
- <view class="index-content-list-info" v-if="retailIndex.length>0">
- <text class="index-content-list-class">剧目</text>
- <view
- class="index-content-list-item"
- v-for="(item,index) in retailIndex"
- :key="index">
-
- <view class="index-content-list-content">
- <image
- class="index-content-list-image"
- :src="item.showImg" mode="scaleToFill"></image>
- <view class="index-content-list-tool">
- <text class="index-content-list-title">{{ item.name }}</text>
- <text
- class="index-content-list-but"
- @click="navigateToFun('/pages/publicSharingDetails/index',item)"
- >查看</text>
- </view>
- </view>
- </view>
- </view>
- </customScrollList>
- </view>
- <!-- 列表主要内容 结束 -->
- </view>
- </view>
- </template>
- <script>
- import {
- navigateTo
- } from "@/utils/util.js"
- export default {
- data() {
- return {
- title: '全民分享',
- loading: false,
- statusBarHeight: 0, // 状态栏安全距离
- retailIndex: [], // 剧目列表
- keyValue: ''
- }
- },
- onLoad() {
-
- },
- onShow() {
- this.statusBarHeight = getApp().globalData.statusBarHeight
- //this.load()
- },
- methods: {
- /** 搜索 */
- search(){
- if(!this.keyValue) {
- uni.showToast({
- title: "请输入关键字",
- icon: 'none'
- })
- return
- }
- this.$refs.customScrollList.refresh()
- },
- async load(paging){
- if(!this.keyValue) {
- this.$refs.customScrollList.loadSuccess({
- list: [],
- total: 100
- })
- return
- }
- console.log("上拉 加载数据")
- try{
- let res = await this.$u.api.retailIndex({
- "page": paging.page,
- "pages": paging.size,
- "name": this.keyValue
- })
- if(res && res.code ===200) {
- this.retailIndex = this.retailIndex.concat(res.data.performList)
- // this.retailIndex = null
- this.$refs.customScrollList.loadSuccess({
- list: this.retailIndex,
- total: this.retailIndex.length
- })
- } else {
- this.$refs.customScrollList.loadSuccess({
- list: [],
- total: 0
- })
- }
- }catch(e){
- //TODO handle the exception
- console.error("e===",e)
- this.$refs.customScrollList.loadSuccess({
- list: [],
- total: 0
- })
- }
- },
- paging(){
- console.log("下拉 加载数据")
- },
- /**
- * 下拉触底
- */
- async refresh(paging){
- console.log("上拉 加载数据",this.retailIndex)
- //this.$refs.customScrollList.showEmpty = true
- try{
- //this.$refs.customScrollList.showPullUp = true
- let res = await this.$u.api.retailIndex({
- pageNum: paging.page,
- pageSize: paging.size,
- name: this.keyValue
- })
- if(res && res.code ===200) {
- if(res.data.performList){
- this.retailIndex = [].concat(res.data.performList)
- }else {
- this.retailIndex = []
- }
-
- this.$refs.customScrollList.refreshSuccess({
- list: this.retailIndex,
- total:this.retailIndex.length
- })
- } else {
- this.$refs.customScrollList.refreshSuccess({
- list: [],
- total: 0
- })
- }
- }catch(e){
- //TODO handle the exception
- console.error("e===",e)
- this.$refs.customScrollList.refreshSuccess({
- list: [],
- total: 0
- })
- }
- },
- /**
- * @author ygh
- * @data 2023-12-20
- */
- navigateToFun(url,data) {
- navigateTo(url,{performId:data.id})
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .index-content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- box-sizing: border-box;
-
- --header-h: 170rpx;
- // background-color:
- .index-content-info {
- width: 100%;
- box-sizing: border-box;
- }
- }
- /** 头部主要内容 开始 */
- .index-content-header {
- width: 100%;
- height: var(--header-h);
- box-sizing: border-box;
- background-color: var(--gd-bgm-color);
- ::v-deep .u-search {
- padding: 0 30rpx !important;
- }
- ::v-deep .u-search__action {
- color: #fff !important;
- }
- }
- /** 头部主要内容 结束 **/
-
-
- /** 列表主要内容 开始 */
- .index-content-list {
- width: 100%;
- height: calc( 100% - var(--header-h) - var(--status-bar-h) );
- }
-
- .index-content-list-info {
- width: 100%;
- box-sizing: border-box;
- padding: 32rpx 32rpx 20rpx;
- .index-content-list-class {
- font-size: 32rpx;
- font-family: SourceHanSansCN, SourceHanSansCN;
- font-weight: bold;
- color: #2D2D2D;
- }
- .index-content-list-item {
- width: 100%;
- box-sizing: border-box;
- background: #FFFFFF;
- box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(200,200,200,0.5);
- border-radius: 24rpx;
- overflow: hidden;
- margin-top: 40rpx;
- .index-content-list-content {
- width: 100%;
- box-sizing: border-box;
- .index-content-list-image {
- width: 100%;
- height: 242rpx;
- }
- .index-content-list-tool {
- display: flex;
- width: 100%;
- justify-content: space-between;
- align-items: center;
- padding:42rpx 28rpx 46rpx;
- box-sizing: border-box;
- .index-content-list-title {
- font-size: 28rpx;
- font-family: SourceHanSansCN, SourceHanSansCN;
- font-weight: bold;
- color: #363636;
- }
- .index-content-list-but {
- width: 160rpx;
- height: 51rpx;
- background: #ED0000;
- border-radius: 24rpx;
- font-size: 20rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- }
- }
- /** 列表主要内容 结束 **/
- </style>
|