index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <view>
  3. <sub-tabnav :tabs="tabs" @change="changeIndex" :selectIndex="selectIndex" :scrollTop="scrollTop"></sub-tabnav>
  4. <!-- #ifdef MP-WEIXIN -->
  5. <view class="" style="background: #ffffff;">
  6. <uni-search-bar @confirm="search" :focus="false" placeholder="请输入搜索内容" v-model="searchValue" @blur="blur" @focus="focus" @input="input"
  7. @cancel="cancel" @clear="clear">
  8. </uni-search-bar>
  9. </view>
  10. <!-- #endif -->
  11. <view v-if="selectIndex==0" class="mt15" style="margin:30upx 30upx 0 30upx;box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.04);">
  12. <home-banner :banners="banners"></home-banner>
  13. </view>
  14. <sub-tabvs class="pt5" v-if="selectIndex==1 && typetab[1]" :tabs="typetab" @change="changetype" :selectIndex="selecttype" :scrollTop="scrollTop"></sub-tabvs>
  15. <sub-tabvs class="pt5" v-if="selectIndex==1 && addddtab[1]" :tabs="addddtab" @change="changeadddd" :selectIndex="selectadddd" :scrollTop="scrollTop"></sub-tabvs>
  16. <sub-tabvs class="pt5" v-if="selectIndex==1 && yeartab[1]" :tabs="yeartab" @change="changeyear" :selectIndex="selectyear" :scrollTop="scrollTop"></sub-tabvs>
  17. <sub-tabvs class="pt5" v-if="selectIndex==2 && type2tab[1]" :tabs="type2tab" @change="changetype2" :selectIndex="selecttype2" :scrollTop="scrollTop"></sub-tabvs>
  18. <sub-tabvs class="pt5" v-if="selectIndex==3 && type3tab[1]" :tabs="type3tab" @change="changetype3" :selectIndex="selecttype3" :scrollTop="scrollTop"></sub-tabvs>
  19. <sub-tabvs class="pt5" v-if="selectIndex==4 && type4tab[1]" :tabs="type4tab" @change="changetype4" :selectIndex="selecttype4" :scrollTop="scrollTop"></sub-tabvs>
  20. <view class="pd20_15">
  21. <block v-for="(value,key) in listData" :key="key">
  22. <view class="box pd16_15 flex alcenter mb16" style="position: relative;" @click="detail(value.id,value.lx)">
  23. <image mode="aspectFill" class="tuan-product-l" :src="value.img"></image>
  24. <view class="btn-mini" style="position: absolute; top: 40upx; left: 280upx; border-radius: 10upx;font-size: 18upx;width: 60upx; height: 36upx;" :style="getBtnStyle">{{value.lxname}}</view>
  25. <view class="tuan-product-r pl15">
  26. <view class="ft14 ftw600 cl-main text-over2">{{value.name}}</view>
  27. <view class="mt16">
  28. <text class="ft12 cl-orange">会员价</text>
  29. <text class="ft12 cl-orange">¥</text>
  30. <text class="ft16 cl-orange ftw600">{{value.vipprice}}</text>
  31. <text class="ml15 ft12 cl-notice text-line">¥{{value.price}}</text>
  32. </view>
  33. <view class="mt16 flex space alcenter">
  34. <view class="ft12 cl-notice">{{value.updatetime}}</view>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. <uni-load-more :status="status" :content-text="contentText" />
  40. <!-- <uni-pagination title="" @change="onPageChange" v-if="total>pageSize" show-icon="true" :pageSize="pageSize" :total="total" current="1"></uni-pagination> -->
  41. </view>
  42. <!-- <dialog-login v-if="showLogin" @loginYes="loginYes" @closed="showLogin = false"></dialog-login> -->
  43. <!-- <com-footer model="tuan"></com-footer> -->
  44. </view>
  45. </template>
  46. <script>
  47. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  48. export default {
  49. components: {
  50. uniLoadMore
  51. },
  52. data(){
  53. return {
  54. banners:[],
  55. vipLevel:0,
  56. isLogin:true,
  57. showLogin:false,
  58. datasa:[],
  59. dataconfig:[],
  60. searchValue:'',
  61. tabs:[
  62. {name:'全部'},
  63. {name:'视频'},
  64. // {name:'音频'},
  65. // {name:'小说'},
  66. // {name:'壁纸'},
  67. ],
  68. selectIndex:0,
  69. scrollTop:0,
  70. type2tab:[],
  71. selecttype2:0,
  72. type2id:'',
  73. type3tab:[],
  74. selecttype3:0,
  75. type3id:'',
  76. type4tab:[],
  77. selecttype4:0,
  78. type4id:'',
  79. typetab:[],
  80. selecttype:0,
  81. typeid:'',
  82. addddtab:[],
  83. selectadddd:0,
  84. addddid:'',
  85. yeartab:[],
  86. selectyear:0,
  87. yearid:'',
  88. type:'',
  89. keytext:'',
  90. listData: [],
  91. total:0,
  92. pageSize:10,
  93. last_id: 0,
  94. reload: true,
  95. status: 'more',
  96. contentText: {
  97. contentdown: '上拉加载更多',
  98. contentrefresh: '加载中',
  99. contentnomore: '没有数据了'
  100. }
  101. }
  102. },
  103. onLoad(e){
  104. //console.log(111)
  105. if(e.selectIndex){
  106. this.selectIndex=e.selectIndex*1
  107. }
  108. this.status = 'more';
  109. this.getList();
  110. this.banners=uni.getStorageSync("config").banner
  111. },
  112. onPageScroll(e){
  113. this.scrollTop = e.scrollTop;
  114. },
  115. onReachBottom() {
  116. this.status = 'more';
  117. this.getList();
  118. },
  119. //监听搜索框文本变化
  120. onNavigationBarSearchInputChanged(e) {
  121. let text = e.text;
  122. if(text){
  123. this.keytext=text;
  124. }
  125. console.log(text)
  126. },
  127. //监听点击搜索按钮事件
  128. onNavigationBarSearchInputConfirmed(e) {
  129. // #ifdef APP-PLUS
  130. plus.key.hideSoftKeybord();
  131. // #endif
  132. var this_=this
  133. let text = e.text;
  134. if (!text) {
  135. uni.showModal({
  136. title: '',
  137. content:"请输入搜索内容",
  138. showCancel: false,
  139. confirmText: "确定",
  140. confirmColor:"#e19503",
  141. success: function (res) {
  142. this_.keytext='';
  143. this_.getList(0)
  144. }
  145. });
  146. return;
  147. } else {
  148. this.keytext=text;
  149. this.listData=[];
  150. this.last_id=0;
  151. this.type='';
  152. this.getList(0)
  153. }
  154. },
  155. methods:{
  156. detail(id,lx){
  157. console.log(lx);
  158. if(lx==1){
  159. var fxpid=1
  160. if(uni.getStorageSync("userinfo")){
  161. fxpid=uni.getStorageSync("userinfo").id
  162. }
  163. uni.navigateTo({
  164. url:'/pages/client/tuan/detail?id='+id+'&fxpid='+fxpid
  165. })
  166. }else if(lx==2){
  167. uni.navigateTo({
  168. url:'/pages/client/tuan/info?id='+id
  169. })
  170. }else if(lx==3){
  171. uni.navigateTo({
  172. url:'/pages/client/tuan/info?id='+id
  173. })
  174. }else if(lx==4){
  175. uni.navigateTo({
  176. url:'/pages/client/tuan/infotp?id='+id
  177. })
  178. }else{
  179. uni.navigateTo({
  180. url:'/pages/client/tuan/list?id='+id
  181. })
  182. }
  183. },
  184. onPageChange(e) {
  185. this.last_id=0
  186. this.reload=true
  187. this.getList()
  188. uni.pageScrollTo({
  189. scrollTop: 0,
  190. duration: 100
  191. });
  192. },
  193. getList() {
  194. let data = {
  195. //column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
  196. };
  197. var limit=10;
  198. if (this.last_id>0) {
  199. //说明已有数据,目前处于上拉加载
  200. this.status = 'loading';
  201. data.offset = this.last_id*limit;
  202. data._ = new Date().getTime() + '';
  203. }
  204. data.limit=limit
  205. if(this.selectIndex){
  206. data.lx=this.selectIndex
  207. }
  208. if(this.typeid && this.selectIndex==1){
  209. data.typeid=this.typeid
  210. }
  211. if(this.addddid && this.selectIndex==1){
  212. data.addddid=this.addddid
  213. }
  214. if(this.yearid && this.selectIndex==1){
  215. data.yearid=this.yearid
  216. }
  217. if(this.type2id && this.selectIndex==2){
  218. data.typeid=this.type2id
  219. }
  220. if(this.type3id && this.selectIndex==3){
  221. data.typeid=this.type3id
  222. }
  223. if(this.type4id && this.selectIndex==4){
  224. data.typeid=this.type4id
  225. }
  226. if(this.keytext){
  227. data.keytext=this.keytext
  228. }
  229. uni.request({
  230. url: this.configs.webUrl+'/api/video/lists',
  231. data: data,
  232. success: data => {
  233. //console.log(data.data)
  234. this.yeartab=data.data.typedata.year
  235. this.addddtab=data.data.typedata.adddd
  236. this.typetab=data.data.typedata.type
  237. this.type2tab=data.data.typedata.type2
  238. this.type3tab=data.data.typedata.type3
  239. this.type4tab=data.data.typedata.type4
  240. if (data.data.total>0) {
  241. let list = data.data.rows;
  242. this.listData = this.reload ? list : this.listData.concat(list);
  243. this.reload = false;
  244. this.last_id = this.last_id+1;
  245. if(data.data.total<this.last_id*limit){
  246. this.status = '';
  247. }
  248. }else{
  249. this.listData=[];
  250. this.contentText.contentdown='没有数据'
  251. this.status=''
  252. }
  253. },
  254. fail: (data, code) => {
  255. //console.log('fail' + JSON.stringify(data));
  256. }
  257. });
  258. },
  259. changeIndex(index){
  260. this.selectIndex = index;
  261. this.type=this.tabs[index].name
  262. this.getdata()
  263. },
  264. changetype(index){
  265. this.selecttype = index;
  266. this.typeid=this.typetab[index].id
  267. this.getdata()
  268. },
  269. changeadddd(index){
  270. this.selectadddd = index;
  271. this.addddid=this.addddtab[index].id
  272. this.getdata()
  273. },
  274. changeyear(index){
  275. this.selectyear = index;
  276. this.yearid=this.yeartab[index].id
  277. this.getdata()
  278. },
  279. changetype2(index){
  280. this.selecttype2 = index;
  281. this.type2id=this.type2tab[index].id
  282. this.getdata()
  283. },
  284. changetype3(index){
  285. this.selecttype3 = index;
  286. this.type3id=this.type3tab[index].id
  287. this.getdata()
  288. },
  289. changetype4(index){
  290. this.selecttype4 = index;
  291. this.type4id=this.type4tab[index].id
  292. this.getdata()
  293. },
  294. getdata(){
  295. this.last_id=0
  296. this.reload=true
  297. this.getList()
  298. },
  299. loginYes(){
  300. },
  301. mlinkTo(e){
  302. if(this.isLogin == true){
  303. let link = e.currentTarget.dataset.link;
  304. }else{
  305. this.showLogin = true;
  306. }
  307. },
  308. search(res) {
  309. this.listData=[];
  310. this.last_id=0;
  311. this.keytext=res.value;
  312. this.type='';
  313. this.getList(0)
  314. },
  315. clear(res) {
  316. },
  317. input(res) {
  318. console.log('----input:', res)
  319. },
  320. blur(res) {
  321. // this.listData=[];
  322. // this.last_id=0;
  323. // this.keytext=res.value;
  324. // this.type='';
  325. // this.getList(0)
  326. //res.value
  327. },
  328. focus(e) {
  329. },
  330. cancel(res) {
  331. this.keytext='';
  332. this.type='';
  333. this.getList(0)
  334. }
  335. }
  336. }
  337. </script>
  338. <style>
  339. .user-not-vip{
  340. width: 100%;
  341. height: 80rpx;
  342. background: #FDF6EC;
  343. border-radius: 40rpx;
  344. border: 2rpx solid #EFC381;
  345. text-align: center;
  346. line-height: 76rpx;
  347. font-size: 24rpx;
  348. color:#000000;
  349. font-weight: bold;
  350. }
  351. .tuan-product-l{
  352. width: 320rpx;
  353. height: 240rpx;
  354. border-radius: 16rpx;
  355. background: #F2F2F2;
  356. }
  357. .tuan-product-r{
  358. width: calc(100% - 320rpx);
  359. }
  360. .search-result {
  361. padding-top: 10px;
  362. padding-bottom: 20px;
  363. text-align: center;
  364. }
  365. .search-result-text {
  366. text-align: center;
  367. font-size: 14px;
  368. color:#666;
  369. }
  370. .example-body {
  371. /* #ifndef APP-NVUE */
  372. display: block;
  373. /* #endif */
  374. padding: 0px;
  375. }
  376. .uni-mt-10 {
  377. margin-top: 10px;
  378. }
  379. </style>