tj
2025-06-05 bba272999cc546f65781bf3d20245a3f819af67f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { movieList } from '../simulation/movie'
 
class Movie {
  getTop250(start = 0, count = 20) {
    const arr = []
    const tempList = movieList.slice()
    const currentList = tempList.splice(start, count)
    currentList.forEach((element, index) => {
      const tempCasts = []
      const tempDirectors = []
      element.casts.forEach(el => {
        tempCasts.push(el.name)
      })
      element.directors.forEach(el => {
        tempDirectors.push(el.name)
      })
 
      arr.push({
        title: element.title,
        originalTitle: element.original_title,
        year: element.year,
        rating: element.rating.average,
        casts: tempCasts.join('/'),
        directors: tempDirectors.join('/'),
        genres: element.genres.join('/'),
        rank: index + 1 + start,
        sorting: 50,
        recommend: 0,
        remark: '这是一部不错的电影',
        editFlag: false,
        thumb: element.thumb
          ? element.thumb
          : 'https://consumerminiaclprd01.blob.core.chinacloudapi.cn/miniappbackground/sfgmember/lin/270-400.png',
      })
    })
 
    return arr
  }
 
  getDataByQuery(query = '') {
    const arr = []
    for (let index = 0; index < movieList.length; index++) {
      const element = movieList[index]
 
      if (element.title.match(query)) {
        const tempCasts = []
        const tempDirectors = []
        element.casts.forEach(el => {
          tempCasts.push(el.name)
        })
        element.directors.forEach(el => {
          tempDirectors.push(el.name)
        })
 
        arr.push({
          title: element.title,
          originalTitle: element.original_title,
          year: element.year,
          rating: element.rating.average,
          casts: tempCasts.join('/'),
          directors: tempDirectors.join('/'),
          genres: element.genres.join('/'),
          rank: index + 1,
          sorting: 50,
          recommend: 0,
          remark: '这是一部不错的电影',
          editFlag: false,
          thumb: element.thumb
            ? element.thumb
            : 'https://consumerminiaclprd01.blob.core.chinacloudapi.cn/miniappbackground/sfgmember/lin/270-400.png',
        })
      }
    }
 
    return arr
  }
}
 
export default new Movie()