goodsAllList.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. // goodsAllList.js
  2. //获取应用实例
  3. var app = getApp();
  4. // 列表
  5. var contentList = [];
  6. var conditionTab = [
  7. { id: 31, scene_name: 'For her' },
  8. { id: 32, scene_name: 'For him' },
  9. { id: -2, scene_name: 'New' },
  10. { id: -3, scene_name: 'SALE' }
  11. ];
  12. Page({
  13. data: {
  14. conditionTab: conditionTab,
  15. contentList: contentList,
  16. winHeight: "",//窗口高度
  17. loadingHidden: false,
  18. searchPageNum: 0, // 设置加载的第几次,默认是第一次
  19. limt: 10,
  20. callbackcount: 15, //返回数据的个数
  21. searchLoading: false, //"上拉加载"的变量,默认false,隐藏
  22. searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏
  23. kindId: '', //当前页面 - 礼物盒ID
  24. selectId : -1,
  25. objectId : -1 , //默认送礼对象的id
  26. filtrateId : 0 , //默认筛选条件【价钱1-2、销量3-4、起订量5-6、定制周期7-8 的 由高到低 还是 由低到高】
  27. priceIcon: '/images/sort_icon_default.png', //价钱icon默认
  28. priceId: 0, //价钱默认id
  29. countIcon: '/images/sort_icon_default.png', //销量icon默认
  30. countId: 0, //销量默认id
  31. orderIcon: '/images/sort_icon_default.png', //起订量icon默认
  32. orderId: 0, //起订量默认id
  33. cycleIcon: '/images/sort_icon_default.png', //定制周期icon默认
  34. cycleId: 0, //定制周期默认id
  35. },
  36. onLoad: function (options) {
  37. var that = this;
  38. var host = getApp().globalData.servsers;
  39. //全部商品
  40. wx.request({
  41. url: host +"commodityapi/findAllforNewproduct",
  42. data: {
  43. offset: 0,
  44. limit: 10
  45. },
  46. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  47. header: {
  48. 'Accept': 'application/json'
  49. },
  50. success: function (res) {
  51. that.setData({
  52. contentList: res.data.rows,
  53. searchPageNum: 0, //第一次加载,设置1
  54. searchSongList: [], //放置返回数据的数组,设为空
  55. isFromSearch: true, //第一次加载,设置true
  56. searchLoading: true, //把"上拉加载"的变量设为true,显示
  57. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  58. });
  59. if (res.data.rows.length < 10) {
  60. that.setData({
  61. searchPageNum: 0, //第一次加载,设置1
  62. searchSongList: [], //放置返回数据的数组,设为空
  63. isFromSearch: true, //第一次加载,设置true
  64. searchLoading: false, //把"上拉加载"的变量设为true,显示
  65. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  66. });
  67. }
  68. if (res == null || res.data == null) {
  69. console.error('网络请求失败');
  70. return;
  71. }
  72. }
  73. });
  74. // 高度自适应
  75. wx.getSystemInfo({
  76. success: function (res) {
  77. var clientHeight = res.windowHeight,
  78. clientWidth = res.windowWidth,
  79. rpxR = 750 / clientWidth;
  80. var calc = clientHeight * rpxR;
  81. that.setData({
  82. winHeight: calc
  83. });
  84. }
  85. });
  86. },
  87. fetchSearchList: function () {//加载更多
  88. var that = this;
  89. var host = getApp().globalData.servsers;
  90. var objectId = that.data.objectId;//筛选条件第一行选择
  91. var filtrateId = that.data.filtrateId;//筛选排序
  92. if (objectId>0){
  93. wx.request({
  94. url: host + "commodityapi/findAllforNewproduct",
  95. data: {
  96. commodity_object: objectId,
  97. sort_type: filtrateId,
  98. offset: parseInt(that.data.searchPageNum) * 10
  99. },
  100. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  101. header: {
  102. 'Accept': 'application/json'
  103. },
  104. success: function (res) {
  105. if (res.data.rows.length != 0) {
  106. let contentList = [];
  107. //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加
  108. that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
  109. that.setData({
  110. contentList: contentList, //获取数据数组
  111. searchLoading: true //把"上拉加载"的变量设为false,显示
  112. });
  113. //没有数据了,把“没有数据”显示,把“上拉加载”隐藏
  114. } else {
  115. console.log(22);
  116. that.setData({
  117. searchLoadingComplete: true, //把“没有数据”设为true,显示
  118. searchLoading: false //把"上拉加载"的变量设为false,隐藏
  119. });
  120. }
  121. if (res == null || res.data == null) {
  122. console.error('网络请求失败');
  123. return;
  124. }
  125. wx.hideNavigationBarLoading(
  126. that.setData({
  127. hidden: 'hidden'
  128. })
  129. )
  130. }
  131. });
  132. } else if (objectId == -2) {//点击的是推荐类型 - New[新品]
  133. wx.request({
  134. url: host + "commodityapi/findAllforNewproduct",
  135. data: {
  136. commodity_recommend: '1',
  137. sort_type: filtrateId,
  138. offset: parseInt(that.data.searchPageNum) * 10
  139. },
  140. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  141. header: {
  142. 'Accept': 'application/json'
  143. },
  144. success: function (res) {
  145. if (res.data.rows.length != 0) {
  146. let contentList = [];
  147. //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加
  148. that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
  149. that.setData({
  150. contentList: contentList, //获取数据数组
  151. searchLoading: true //把"上拉加载"的变量设为false,显示
  152. });
  153. //没有数据了,把“没有数据”显示,把“上拉加载”隐藏
  154. } else {
  155. console.log(22);
  156. that.setData({
  157. searchLoadingComplete: true, //把“没有数据”设为true,显示
  158. searchLoading: false //把"上拉加载"的变量设为false,隐藏
  159. });
  160. }
  161. if (res == null || res.data == null) {
  162. console.error('网络请求失败');
  163. return;
  164. }
  165. wx.hideNavigationBarLoading(
  166. that.setData({
  167. hidden: 'hidden'
  168. })
  169. )
  170. }
  171. });
  172. } else if (objectId == -3) {//点击的是推荐类型 - SALE[打折品]
  173. wx.request({
  174. url: host + "commodityapi/findAllforNewproduct",
  175. data: {
  176. commodity_recommend: '3',
  177. sort_type: filtrateId,
  178. offset: parseInt(that.data.searchPageNum) * 10
  179. },
  180. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  181. header: {
  182. 'Accept': 'application/json'
  183. },
  184. success: function (res) {
  185. if (res.data.rows.length != 0) {
  186. let contentList = [];
  187. //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加
  188. that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
  189. that.setData({
  190. contentList: contentList, //获取数据数组
  191. searchLoading: true //把"上拉加载"的变量设为false,显示
  192. });
  193. //没有数据了,把“没有数据”显示,把“上拉加载”隐藏
  194. } else {
  195. that.setData({
  196. searchLoadingComplete: true, //把“没有数据”设为true,显示
  197. searchLoading: false //把"上拉加载"的变量设为false,隐藏
  198. });
  199. }
  200. if (res == null || res.data == null) {
  201. console.error('网络请求失败');
  202. return;
  203. }
  204. wx.hideNavigationBarLoading(
  205. that.setData({
  206. hidden: 'hidden'
  207. })
  208. )
  209. }
  210. });
  211. }else{
  212. wx.request({
  213. url: host + "commodityapi/findAllforNewproduct",
  214. data: {
  215. offset: parseInt(that.data.searchPageNum) * 10
  216. },
  217. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  218. header: {
  219. 'Accept': 'application/json'
  220. },
  221. success: function (res) {
  222. if (res.data.rows.length != 0) {
  223. let contentList = [];
  224. //如果isFromSearch是true从data中取出数据,否则先从原来的数据继续添加
  225. that.data.isFromSearch ? contentList = res.data.rows : contentList = that.data.contentList.concat(res.data.rows)
  226. that.setData({
  227. contentList: contentList, //获取数据数组
  228. searchLoading: true //把"上拉加载"的变量设为false,显示
  229. });
  230. //没有数据了,把“没有数据”显示,把“上拉加载”隐藏
  231. } else {
  232. that.setData({
  233. searchLoadingComplete: true, //把“没有数据”设为true,显示
  234. searchLoading: false //把"上拉加载"的变量设为false,隐藏
  235. });
  236. }
  237. if (res == null || res.data == null) {
  238. console.error('网络请求失败');
  239. return;
  240. }
  241. wx.hideNavigationBarLoading(
  242. that.setData({
  243. hidden: 'hidden'
  244. })
  245. )
  246. }
  247. });
  248. }
  249. },
  250. //滚动到底部触发事件
  251. searchScrollLower: function () {
  252. var that = this;
  253. if (that.data.searchLoading && !that.data.searchLoadingComplete) {
  254. that.setData({
  255. searchPageNum: that.data.searchPageNum + 1, //每次触发上拉事件,把searchPageNum+1
  256. isFromSearch: false //触发到上拉事件,把isFromSearch设为为false
  257. });
  258. that.fetchSearchList();
  259. }
  260. } ,
  261. //送礼对象 - 筛选
  262. objectType:function(e){
  263. var that = this;
  264. var host = getApp().globalData.servsers;
  265. var id = e.currentTarget.dataset.id;
  266. var objectId = e.currentTarget.dataset.flagid;//查询id
  267. var filtrateId = that.data.filtrateId;//筛选排序
  268. if (objectId > 0){//点击的是选礼对象
  269. wx.request({
  270. url: host + "commodityapi/findAllforNewproduct",
  271. data: {
  272. commodity_object: objectId,
  273. sort_type: filtrateId,
  274. offset: 0,
  275. limit: 10
  276. },
  277. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  278. header: {
  279. 'Accept': 'application/json'
  280. },
  281. success: function (res) {
  282. that.setData({
  283. contentList: res.data.rows,
  284. objectId: objectId,
  285. selectId : id,
  286. searchPageNum: 0, //第一次加载,设置1
  287. searchSongList: [], //放置返回数据的数组,设为空
  288. isFromSearch: true, //第一次加载,设置true
  289. searchLoading: true, //把"上拉加载"的变量设为true,显示
  290. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  291. });
  292. if (res.data.rows.length < 10) {
  293. that.setData({
  294. searchPageNum: 0, //第一次加载,设置1
  295. searchSongList: [], //放置返回数据的数组,设为空
  296. isFromSearch: true, //第一次加载,设置true
  297. searchLoading: false, //把"上拉加载"的变量设为true,显示
  298. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  299. });
  300. }
  301. if (res == null || res.data == null) {
  302. console.error('网络请求失败');
  303. return;
  304. }
  305. }
  306. });
  307. } else if (objectId == -2){//点击的是推荐类型 - New[新品]
  308. wx.request({
  309. url: host + "commodityapi/findAllforNewproduct",
  310. data: {
  311. commodity_recommend: '1',
  312. sort_type: filtrateId,
  313. offset: 0,
  314. limit: 10
  315. },
  316. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  317. header: {
  318. 'Accept': 'application/json'
  319. },
  320. success: function (res) {
  321. that.setData({
  322. contentList: res.data.rows,
  323. objectId: objectId,
  324. selectId: id,
  325. searchPageNum: 0, //第一次加载,设置1
  326. searchSongList: [], //放置返回数据的数组,设为空
  327. isFromSearch: true, //第一次加载,设置true
  328. searchLoading: true, //把"上拉加载"的变量设为true,显示
  329. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  330. });
  331. if (res.data.rows.length < 10) {
  332. that.setData({
  333. searchPageNum: 0, //第一次加载,设置1
  334. searchSongList: [], //放置返回数据的数组,设为空
  335. isFromSearch: true, //第一次加载,设置true
  336. searchLoading: false, //把"上拉加载"的变量设为true,显示
  337. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  338. });
  339. }
  340. if (res == null || res.data == null) {
  341. console.error('网络请求失败');
  342. return;
  343. }
  344. }
  345. });
  346. } else if (objectId == -3) {//点击的是推荐类型 - SALE[打折品]
  347. wx.request({
  348. url: host + "commodityapi/findAllforNewproduct",
  349. data: {
  350. commodity_recommend: '3',
  351. sort_type: filtrateId,
  352. offset: 0,
  353. limit: 10
  354. },
  355. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  356. header: {
  357. 'Accept': 'application/json'
  358. },
  359. success: function (res) {
  360. that.setData({
  361. contentList: res.data.rows,
  362. objectId: objectId,
  363. selectId: id,
  364. searchPageNum: 0, //第一次加载,设置1
  365. searchSongList: [], //放置返回数据的数组,设为空
  366. isFromSearch: true, //第一次加载,设置true
  367. searchLoading: true, //把"上拉加载"的变量设为true,显示
  368. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  369. });
  370. if (res.data.rows.length < 10) {
  371. that.setData({
  372. searchPageNum: 0, //第一次加载,设置1
  373. searchSongList: [], //放置返回数据的数组,设为空
  374. isFromSearch: true, //第一次加载,设置true
  375. searchLoading: false, //把"上拉加载"的变量设为true,显示
  376. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  377. });
  378. }
  379. if (res == null || res.data == null) {
  380. console.error('网络请求失败');
  381. return;
  382. }
  383. }
  384. });
  385. }
  386. },
  387. //排序 先升序[箭头向上],后降序[箭头向下]
  388. priceChange:function(e){
  389. var that = this;
  390. var host = getApp().globalData.servsers;
  391. var objectId = that.data.objectId;//查询id
  392. var flag = e.currentTarget.dataset.flag;//当前排序类型
  393. var priceIcon = that.data.priceIcon;
  394. var countIcon = that.data.countIcon;
  395. var orderIcon = that.data.orderIcon;
  396. var cycleIcon = that.data.cycleIcon;
  397. var filtrateId = that.data.filtrateId;//当前排序值
  398. if (flag == 1){//价格
  399. if (filtrateId == 2){
  400. filtrateId = 1;
  401. priceIcon = '/images/sort_icon_descending.png';
  402. } else{
  403. filtrateId = 2;
  404. priceIcon = '/images/sort_icon_ascending.png';
  405. }
  406. countIcon = '/images/sort_icon_default.png';
  407. orderIcon = '/images/sort_icon_default.png';
  408. cycleIcon = '/images/sort_icon_default.png';
  409. }
  410. else if (flag == 2){//综合
  411. if (filtrateId == 4) {
  412. filtrateId = 3;
  413. countIcon = '/images/sort_icon_descending.png';
  414. } else{
  415. filtrateId = 4;
  416. countIcon = '/images/sort_icon_ascending.png';
  417. }
  418. priceIcon = '/images/sort_icon_default.png';
  419. orderIcon = '/images/sort_icon_default.png';
  420. cycleIcon = '/images/sort_icon_default.png';
  421. }
  422. else if (flag == 3) {//起订量
  423. if(filtrateId == 6) {
  424. filtrateId = 5;
  425. orderIcon = '/images/sort_icon_descending.png';
  426. } else {
  427. filtrateId = 6;
  428. orderIcon = '/images/sort_icon_ascending.png';
  429. }
  430. priceIcon = '/images/sort_icon_default.png';
  431. countIcon = '/images/sort_icon_default.png';
  432. cycleIcon = '/images/sort_icon_default.png';
  433. }
  434. else if (flag == 4) {//定制周期
  435. if (filtrateId == 8) {
  436. filtrateId = 7;
  437. cycleIcon = '/images/sort_icon_descending.png';
  438. } else{
  439. filtrateId = 8;
  440. cycleIcon = '/images/sort_icon_ascending.png';
  441. }
  442. priceIcon = '/images/sort_icon_default.png';
  443. countIcon = '/images/sort_icon_default.png';
  444. orderIcon = '/images/sort_icon_default.png';
  445. }
  446. if (objectId > 0) {//点击的是选礼对象
  447. wx.request({
  448. url: host + "commodityapi/findAllforNewproduct",
  449. data: {
  450. commodity_object: objectId,
  451. sort_type: filtrateId,
  452. offset: 0,
  453. limit: 10
  454. },
  455. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  456. header: {
  457. 'Accept': 'application/json'
  458. },
  459. success: function (res) {
  460. that.setData({
  461. contentList: res.data.rows,
  462. filtrateId: filtrateId,
  463. priceIcon: priceIcon,
  464. countIcon: countIcon,
  465. orderIcon: orderIcon,
  466. cycleIcon: cycleIcon,
  467. searchPageNum: 0, //第一次加载,设置1
  468. searchSongList: [], //放置返回数据的数组,设为空
  469. isFromSearch: true, //第一次加载,设置true
  470. searchLoading: true, //把"上拉加载"的变量设为true,显示
  471. searchLoadingComplete: false, //把“没有数据”设为false,隐藏
  472. });
  473. if (res.data.rows.length < 10) {
  474. that.setData({
  475. searchPageNum: 0, //第一次加载,设置1
  476. searchSongList: [], //放置返回数据的数组,设为空
  477. isFromSearch: true, //第一次加载,设置true
  478. searchLoading: false, //把"上拉加载"的变量设为true,显示
  479. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  480. });
  481. }
  482. if (res == null || res.data == null) {
  483. console.error('网络请求失败');
  484. return;
  485. }
  486. }
  487. });
  488. } else if (objectId == -2) {//点击的是推荐类型 - New[新品]
  489. wx.request({
  490. url: host + "commodityapi/findAllforNewproduct",
  491. data: {
  492. commodity_recommend: '1',
  493. sort_type: filtrateId,
  494. offset: 0,
  495. limit: 10
  496. },
  497. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  498. header: {
  499. 'Accept': 'application/json'
  500. },
  501. success: function (res) {
  502. that.setData({
  503. contentList: res.data.rows,
  504. filtrateId: filtrateId,
  505. priceIcon: priceIcon,
  506. countIcon: countIcon,
  507. orderIcon: orderIcon,
  508. cycleIcon: cycleIcon,
  509. searchPageNum: 0, //第一次加载,设置1
  510. searchSongList: [], //放置返回数据的数组,设为空
  511. isFromSearch: true, //第一次加载,设置true
  512. searchLoading: true, //把"上拉加载"的变量设为true,显示
  513. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  514. });
  515. if (res.data.rows.length < 10) {
  516. that.setData({
  517. searchPageNum: 0, //第一次加载,设置1
  518. searchSongList: [], //放置返回数据的数组,设为空
  519. isFromSearch: true, //第一次加载,设置true
  520. searchLoading: false, //把"上拉加载"的变量设为true,显示
  521. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  522. });
  523. }
  524. if (res == null || res.data == null) {
  525. console.error('网络请求失败');
  526. return;
  527. }
  528. }
  529. });
  530. } else if (objectId == -3) {//点击的是推荐类型 - SALE[打折品]
  531. wx.request({
  532. url: host + "commodityapi/findAllforNewproduct",
  533. data: {
  534. commodity_recommend: '3',
  535. sort_type: filtrateId,
  536. offset: 0,
  537. limit: 10
  538. },
  539. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  540. header: {
  541. 'Accept': 'application/json'
  542. },
  543. success: function (res) {
  544. that.setData({
  545. contentList: res.data.rows,
  546. filtrateId: filtrateId,
  547. priceIcon: priceIcon,
  548. countIcon: countIcon,
  549. orderIcon: orderIcon,
  550. cycleIcon: cycleIcon,
  551. searchPageNum: 0, //第一次加载,设置1
  552. searchSongList: [], //放置返回数据的数组,设为空
  553. isFromSearch: true, //第一次加载,设置true
  554. searchLoading: true, //把"上拉加载"的变量设为true,显示
  555. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  556. });
  557. if (res.data.rows.length < 10) {
  558. that.setData({
  559. searchPageNum: 0, //第一次加载,设置1
  560. searchSongList: [], //放置返回数据的数组,设为空
  561. isFromSearch: true, //第一次加载,设置true
  562. searchLoading: false, //把"上拉加载"的变量设为true,显示
  563. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  564. });
  565. }
  566. if (res == null || res.data == null) {
  567. console.error('网络请求失败');
  568. return;
  569. }
  570. }
  571. });
  572. }else{
  573. wx.request({
  574. url: host + "commodityapi/findAllforNewproduct",
  575. data: {
  576. sort_type: filtrateId,
  577. offset: 0,
  578. limit: 10
  579. },
  580. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  581. header: {
  582. 'Accept': 'application/json'
  583. },
  584. success: function (res) {
  585. that.setData({
  586. contentList: res.data.rows,
  587. filtrateId: filtrateId,
  588. priceIcon: priceIcon,
  589. countIcon: countIcon,
  590. orderIcon: orderIcon,
  591. cycleIcon: cycleIcon,
  592. searchPageNum: 0, //第一次加载,设置1
  593. searchSongList: [], //放置返回数据的数组,设为空
  594. isFromSearch: true, //第一次加载,设置true
  595. searchLoading: true, //把"上拉加载"的变量设为true,显示
  596. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  597. });
  598. if (res.data.rows.length < 10) {
  599. that.setData({
  600. searchPageNum: 0, //第一次加载,设置1
  601. searchSongList: [], //放置返回数据的数组,设为空
  602. isFromSearch: true, //第一次加载,设置true
  603. searchLoading: false, //把"上拉加载"的变量设为true,显示
  604. searchLoadingComplete: false //把“没有数据”设为false,隐藏
  605. });
  606. }
  607. if (res == null || res.data == null) {
  608. console.error('网络请求失败');
  609. return;
  610. }
  611. }
  612. });
  613. }
  614. },
  615. })
  616. var that;
  617. var Util = require('../../utils/util.js');