[fix]商户号管理页面优化

master
hellolujian 6 years ago
parent e26849f36b
commit 16d881bca1

@ -21,7 +21,9 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.toShow = false;
$scope.client_loading = true;
// 前端渲染的end索引
$scope.endIndexMap = {};
// 初始化索引是60
const initEndIndex = 60;
$scope.loadClient = function () {
$http.get('/sys/merchant_id').then(function (resp) {
@ -29,31 +31,44 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS
$scope.client_loading = false;
// 加入对应项的end索引值
for (var k in $scope.clientsMap) {
var length = $scope.clientsMap[k].length;
if (length <= initEndIndex) {
$scope.endIndexMap[k] = length;
}
else
$scope.endIndexMap[k] = initEndIndex;
// 如果数据小于60索引值为数据长度
// 否则设置为60
for (var key in $scope.clientsMap) {
$scope.endIndexMap[key] = initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
$scope.endIndexMap[key] = length;
}
});
};
$scope.loadClient();
/**
* 点击更多加载
* 判断加60后的索引是否超出数组长度
* @param key
*/
$scope.more = function(key) {
var endIndex = $scope.endIndexMap[key] + initEndIndex;
// 判断加60后的索引是否超出数组长度
$scope.endIndexMap[key] = endIndex;
if (endIndex > $scope.clientsMap[key].length) {
$scope.endIndexMap[key] = $scope.clientsMap[key].length;
}
else
$scope.endIndexMap[key] = endIndex;
};
/**
* 收起
* @param key
*/
$scope.packup = function(key) {
$scope.endIndexMap[key] = initEndIndex;
var length = $scope.clientsMap[key].length;
if (length <= initEndIndex)
$scope.endIndexMap[key] = length;
};
$scope.showClient = function (sub_merchant_id) {

Loading…
Cancel
Save