...
|
...
|
@@ -41,10 +41,95 @@ class familyModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 列表排序
|
|
|
*/
|
|
|
_sourceSort(source) {
|
|
|
return function(a, b) {
|
|
|
let value1 = a[source],
|
|
|
value2 = b[source];
|
|
|
|
|
|
return value1 - value2;
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取APP列表
|
|
|
*/
|
|
|
_getAppList() {
|
|
|
let result = {
|
|
|
code: 200,
|
|
|
data: [
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/02412723632a13bd6ad1eef8fe580095a5.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'yoho',
|
|
|
source: 1,
|
|
|
login: false
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img13.static.yhbimg.com/article/2017/08/23/10/0222be3d6a9d8a1617b89fcf35357a3593.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'now',
|
|
|
source: 2,
|
|
|
login: false
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/02fe755abdc5d390252cf6df25c01dffae.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'mars',
|
|
|
source: 3,
|
|
|
login: false
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img11.static.yhbimg.com/article/2017/08/23/10/0112f200ab5ae424173fa2df7a490c80bf.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'green',
|
|
|
source: 4,
|
|
|
login: false
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img12.static.yhbimg.com/article/2017/08/23/10/022279d464ee6bd9ef86089c60e2832210.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'coffee',
|
|
|
source: 5,
|
|
|
login: false
|
|
|
},
|
|
|
{
|
|
|
uid: null,
|
|
|
iconUrl: 'http://img10.static.yhbimg.com/article/2017/08/23/10/01a1704bc87316008d769443a8ae50ad7e.png?imageView/{mode}/w/{width}/h/{height}',
|
|
|
sourceName: 'life',
|
|
|
source: 6,
|
|
|
login: false
|
|
|
}
|
|
|
]
|
|
|
};
|
|
|
|
|
|
let loginList = [];
|
|
|
let noLoginList = [];
|
|
|
let appList = [];
|
|
|
|
|
|
_.forEach(result.data, value => {
|
|
|
if (value.login === true) {
|
|
|
loginList.push(value);
|
|
|
} else {
|
|
|
noLoginList.push(value);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
loginList.sort(this._sourceSort('source'));
|
|
|
noLoginList.sort(this._sourceSort('source'));
|
|
|
|
|
|
appList = loginList.concat(noLoginList);
|
|
|
|
|
|
return appList;
|
|
|
}
|
|
|
|
|
|
familyIndex(uid) {
|
|
|
return Promise.all([
|
|
|
this._userData(uid),
|
|
|
this._getCode(uid)
|
|
|
this._getCode(uid),
|
|
|
this._getAppList()
|
|
|
]).then((result) => {
|
|
|
let familyIndexData = {};
|
|
|
|
...
|
...
|
@@ -61,6 +146,10 @@ class familyModel extends global.yoho.BaseModel { |
|
|
familyIndexData = _.assign(familyIndexData, result[1].data);
|
|
|
}
|
|
|
|
|
|
if (result[2]) {
|
|
|
familyIndexData.appList = result[2];
|
|
|
}
|
|
|
|
|
|
return familyIndexData;
|
|
|
});
|
|
|
}
|
...
|
...
|
|