|
@@ -19,6 +19,10 @@
|
|
|
var deviveWidth = document.documentElement.clientWidth;
|
|
|
document.documentElement.style.fontSize = deviveWidth / 7.5 + 'px';
|
|
|
</script>
|
|
|
+ <script>
|
|
|
+ toastr.options.positionClass = 'toast-center-center';
|
|
|
+ // toastr.options.timeOut = '1500';
|
|
|
+ </script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="container">
|
|
@@ -33,17 +37,23 @@
|
|
|
</div>
|
|
|
<div class="tag-wrap"></div>
|
|
|
</div>
|
|
|
- <div class="download-wrap"></div>
|
|
|
+ <div class="download-wrap">
|
|
|
+ <div class="download-content"></div>
|
|
|
+ <div class="loading"></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<script type="text/javascript">
|
|
|
let title = decodeURIComponent(GetRequest().plateName);
|
|
|
let timer,flag = true;
|
|
|
- let labelId = '', pageNum = 1, pageSize = 10, index = 0;
|
|
|
+ let labelId = '', pageNum = 1, pageSize = 10, index = 0, recordFlag = true, total = 0, nowlength = 0;
|
|
|
$('.title').eq(0).text(title);
|
|
|
(function(){
|
|
|
init();
|
|
|
})();
|
|
|
function init(){
|
|
|
+ if(nowlength === 0) {
|
|
|
+ toastr.error('加载中...');
|
|
|
+ }
|
|
|
$.ajax({
|
|
|
url: `${baseUrl}/api/public/v1/browserLabel/client/query/${GetRequest().plateId}`,
|
|
|
type: 'get',
|
|
@@ -62,69 +72,95 @@
|
|
|
}
|
|
|
})
|
|
|
};
|
|
|
+ function getType() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ $.ajax({
|
|
|
+ url: `http://192.168.211.215:9000/getType`,
|
|
|
+ type: 'get',
|
|
|
+ contentType:"application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ if(res.code === 200){
|
|
|
+ let cardType = res.data.devType;
|
|
|
+ let phoneObj = {
|
|
|
+ 'RK_3399': 'SVIP'
|
|
|
+ }
|
|
|
+ phoneType = phoneObj[cardType];
|
|
|
+ resolve(phoneType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
function rankingGet(){
|
|
|
- // $.ajax({
|
|
|
- // url: `http://192.168.211.215:9000/getType`,
|
|
|
- // type: 'get',
|
|
|
- // contentType:"application/json",
|
|
|
- // dataType: 'json',
|
|
|
- // cache: false,
|
|
|
- // success: function (res) {
|
|
|
- // console.log(res)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // return
|
|
|
- $.ajax({
|
|
|
- url: `${baseUrl}/api/public/v1/ranking/client/get`,
|
|
|
- type: 'post',
|
|
|
- data: JSON.stringify({
|
|
|
- labelId: labelId,
|
|
|
- phoneType: 'SVIP',
|
|
|
- pageNum: pageNum,
|
|
|
- pageSize: pageSize
|
|
|
- }),
|
|
|
- contentType:"application/json",
|
|
|
- dataType: 'json',
|
|
|
- cache: false,
|
|
|
- success: function (res) {
|
|
|
- if(res.status === 0){
|
|
|
- let list = res.data.records;
|
|
|
- let node = '';
|
|
|
- for(let i=0; i < list.length; i++){
|
|
|
- node += `<div class="download-item">
|
|
|
- <div class="main-wrap">
|
|
|
- <img class="app-icon" src=${fileCenterApi}/document/newFile/download/0/3dn9b4585511476691c6?fileKey=${list[i].iconKey} />
|
|
|
- <div class="app-wrap">
|
|
|
- <div class="app-title">${list[i].appName}</div>
|
|
|
- <div class="app-description">${list[i].introduction}</div>
|
|
|
+ getType().then((phoneType) => {
|
|
|
+ $.ajax({
|
|
|
+ url: `${baseUrl}/api/public/v1/ranking/client/get`,
|
|
|
+ type: 'post',
|
|
|
+ data: JSON.stringify({
|
|
|
+ labelId: +labelId,
|
|
|
+ phoneType: phoneType,
|
|
|
+ pageNum: pageNum,
|
|
|
+ pageSize: pageSize
|
|
|
+ }),
|
|
|
+ contentType:"application/json",
|
|
|
+ dataType: 'json',
|
|
|
+ cache: false,
|
|
|
+ success: function (res) {
|
|
|
+ if(res.status === 0){
|
|
|
+ let list = res.data.records;
|
|
|
+ nowlength += list.length;
|
|
|
+ total = res.data.total;
|
|
|
+ recordFlag = true;
|
|
|
+ let node = '';
|
|
|
+ for(let i=0; i < list.length; i++){
|
|
|
+ node += `<div class="download-item">
|
|
|
+ <div class="main-wrap">
|
|
|
+ <img class="app-icon" src=${fileCenterApi}/document/newFile/download/0/3dn9b4585511476691c6?fileKey=${list[i].iconKey} />
|
|
|
+ <div class="app-wrap">
|
|
|
+ <div class="app-title">${list[i].appName}</div>
|
|
|
+ <div class="app-description">${list[i].introduction}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="btn-wrap" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}">
|
|
|
- <div class="progress" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}"></div>
|
|
|
- <text class="text" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}">下载</text>
|
|
|
- </div>
|
|
|
- </div>`
|
|
|
- }
|
|
|
- if(list.length === 0){
|
|
|
- node = `<div class="none-wrap">
|
|
|
- <img class="none-img" src="../static/img/browser/none.png" />
|
|
|
- <div class="none-text">没有更多内容哦~</div>
|
|
|
- </div>`
|
|
|
+ <div class="btn-wrap" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}">
|
|
|
+ <div class="progress" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}"></div>
|
|
|
+ <text class="text" data-key="${list[i].fileKey}" data-id="${list[i].id}" data-index="${i}" data-md5="${list[i].md5}">下载</text>
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+ if(nowlength !== total){
|
|
|
+ $('.loading').eq(0).text('正在努力加载中...');
|
|
|
+ } else {
|
|
|
+ $('.loading').eq(0).text('已加载全部内容');
|
|
|
+ }
|
|
|
+ if(list.length === 0){
|
|
|
+ node = `<div class="none-wrap">
|
|
|
+ <img class="none-img" src="../static/img/browser/none.png" />
|
|
|
+ <div class="none-text">没有更多内容哦~</div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+ $('.download-content').eq(0).append(node);
|
|
|
+ }else{
|
|
|
+ stopManyClick(() => {
|
|
|
+ toastr.error(res.msg);
|
|
|
+ })
|
|
|
}
|
|
|
- $('.download-wrap').eq(0).append(node);
|
|
|
- }else{
|
|
|
- stopManyClick(() => {
|
|
|
- toastr.error(res.msg);
|
|
|
- })
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
})
|
|
|
};
|
|
|
+ //点击切换
|
|
|
$('.tag-wrap')[0].addEventListener('click',(e)=>{
|
|
|
labelId = e.target.dataset.id;
|
|
|
let className = e.target.className;
|
|
|
if(className.includes('tag-item')){
|
|
|
- $('.download-wrap').eq(0).text('');
|
|
|
+ pageNum = 1;
|
|
|
+ nowlength = 0;
|
|
|
+ total = 0;
|
|
|
+ toastr.error('加载中...');
|
|
|
+ $('.loading').eq(0).text('');
|
|
|
+ $('.download-content').eq(0).text('');
|
|
|
$('.tag-item')[index].className = 'tag-item';
|
|
|
index = e.target.dataset.index;
|
|
|
$('.tag-item')[index].className = 'tag-item active';
|
|
@@ -197,6 +233,19 @@
|
|
|
$('.left-arrow')[0].addEventListener('click',()=>{
|
|
|
location.href = './browser.html'
|
|
|
},false);
|
|
|
+ //数据下拉加载
|
|
|
+ $('.download-wrap')[0].addEventListener('scroll',function () {
|
|
|
+ let scrollTop = $('.download-wrap')[0].scrollTop;
|
|
|
+ let clientHeight = $('.download-wrap')[0].clientHeight;
|
|
|
+ let scrollHeight = $('.download-wrap')[0].scrollHeight;
|
|
|
+ if(scrollTop + clientHeight + 10 > scrollHeight){
|
|
|
+ if(recordFlag && nowlength < total && total > 0){
|
|
|
+ recordFlag = false;
|
|
|
+ pageNum++;
|
|
|
+ rankingGet();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
//防止提示一秒内重复显示
|
|
|
function stopManyClick(fn) {
|
|
|
if (flag) {
|