list.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const API = require("./API");
  2. var api = API(cookie);
  3. module.exports = {
  4. type: 'list',
  5. title: '微博视频号 - 播放列表',
  6. beforeCreate() {
  7. getCookie()
  8. api = API(cookie)
  9. },
  10. async fetch() {
  11. var data = [], style = $storage.get('style')
  12. if (style) {
  13. data.push({
  14. style: 'category',
  15. title: '全部视频,分类视频,点赞过的视频',
  16. action: {
  17. title: '切换样式',
  18. onClick: () => {
  19. $storage.put('style', !style)
  20. $ui.toast("切换成功")
  21. }
  22. }
  23. })
  24. }
  25. UID.forEach(f => {
  26. json = {
  27. style: 'category',
  28. title: f.name
  29. }
  30. if (data.length == 0) {
  31. json.action = {
  32. title: '切换样式',
  33. onClick: () => {
  34. $storage.put('style', !style)
  35. $ui.toast("切换成功")
  36. }
  37. }
  38. }
  39. if (!style) {
  40. data.push(json)
  41. }
  42. data.push({
  43. style: 'icon',
  44. title: style ? f.name : "全部视频",
  45. summary: "全部视频",
  46. thumb: f.avatar,
  47. spanCount: 4,
  48. onClick: () => {
  49. $router.to($route('list/alllist', f))
  50. }
  51. })
  52. data.push({
  53. style: 'icon',
  54. title: style ? f.name : "分类视频",
  55. summary: "分类视频",
  56. thumb: f.avatar,
  57. spanCount: 4,
  58. onClick: () => {
  59. if (top) {
  60. $router.to($route('list/taglistTop', f))
  61. } else {
  62. $router.to($route('list/taglist', f))
  63. }
  64. }
  65. })
  66. data.push({
  67. style: 'icon',
  68. title: style ? f.name : "点赞过的视频",
  69. summary: "点赞过的视频",
  70. thumb: f.avatar,
  71. spanCount: 4,
  72. onClick: () => {
  73. $router.to($route('list/likelist', f))
  74. }
  75. })
  76. })
  77. return data
  78. }
  79. }