wdxh.vue 7.1 KB

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