123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
-
- layui.use(function(){
-
- var layer = layui.layer
- ,laypage = layui.laypage
- ,laydate = layui.laydate
- ,table = layui.table
- ,carousel = layui.carousel
- ,upload = layui.upload
- ,element = layui.element
- ,slider = layui.slider
- ,dropdown = layui.dropdown
- ,$ = layui.$;
-
-
-
- function downFile(title,url){
- const filePath = url;
- const fileExt = filePath.substr(filePath.lastIndexOf('.') + 1);
- var title = title + '.' + fileExt;
-
-
- const fileStream = streamSaver.createWriteStream(title);
-
-
-
- fetch(url).then(res => {
- const readableStream = res.body
- if (window.WritableStream && readableStream.pipeTo) {
- return readableStream.pipeTo(fileStream)
- .then(() => console.log('完成写入'))
- }
-
-
- window.writer = fileStream.getWriter()
- const reader = res.body.getReader()
- const pump = () => reader.read()
- .then(res => res.done
- ? writer.close()
- : writer.write(res.value).then(pump)
- )
- pump()
- });
- }
-
-
- $('#down_btn').click(function (){
- layer.msg('正在处理');
- var aid = $(this).attr('aid');
- var title = $(this).attr('title');
- $.ajax({
- type: "POST",
- url: '/api/Ajax/get_user_download',
- data: {del_id:0,_ajax:1,aid:aid},
- dataType: 'json',
- success: function (data) {
- layer.closeAll();
- if(parseInt(data.code) == 1){
- layer.msg(data.msg, {icon: 1});
-
-
-
-
-
- window.open(data.data.down,"_blank");
- }else{
-
- layer.confirm(data.msg, {icon: 3,title:false}, function(){
- if(data.url != ''){
- window.open('https://www.zc10000.com/?m=user&c=Users&a=login', '_blank');
- }else{
- layer.closeAll();
- }
- }, function(){
-
- });
- }
- },
- error:function(e){
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- return false;
- });
-
-
- $('#like_btn').click(function (){
- layer.msg('正在处理');
- var aid = $(this).attr('aid');
- var title = $(this).attr('title');
- $.ajax({
- type: "POST",
- url: '/api/Ajax/get_user_like',
- data: {del_id:0,_ajax:1,aid:aid},
- dataType: 'json',
- success: function (data) {
- layer.closeAll();
- if(parseInt(data.code) == 1){
- layer.msg(data.msg, {icon: 1,title:false});
-
-
-
-
- $("#likecount").html(data.data.likecount);
-
- if(data.data.type == 1 || data.data.type == '1'){
- console.log('1111');
-
- $('.btn-e').addClass('btn-e-active');
- }else{
- $('.btn-e').removeClass('btn-e-active');
- }
- }else{
-
- layer.confirm(data.msg, {icon: 3}, function(){
- if(data.url != ''){
- window.open('https://www.zc10000.com/?m=user&c=Users&a=login', '_blank');
- }else{
- layer.closeAll();
- }
- }, function(){
-
- });
- }
- },
- error:function(e){
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- return false;
- });
-
-
- $('#collect_btn').click(function (){
- layer.msg('正在处理');
- var aid = $(this).attr('aid');
- var title = $(this).attr('title');
- $.ajax({
- type: "POST",
- url: '/api/Ajax/get_user_collect',
- data: {del_id:0,_ajax:1,aid:aid},
- dataType: 'json',
- success: function (data) {
- layer.closeAll();
- if(parseInt(data.code) == 1){
- layer.msg(data.msg, {icon: 1,title:false});
-
-
-
-
- $("#collection").html(data.data.collection);
-
- if(data.data.type == 1 || data.data.type == '1'){
- console.log('1111');
-
- $('.btn-d').addClass('btn-e-active');
- }else{
- $('.btn-d').removeClass('btn-e-active');
- }
- }else{
-
- layer.confirm(data.msg, {icon: 3}, function(){
- if(data.url != ''){
- window.open('https://www.zc10000.com/?m=user&c=Users&a=login', '_blank');
- }else{
- layer.closeAll();
- }
- }, function(){
-
- });
- }
- },
- error:function(e){
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- return false;
- });
-
-
- $('#share_btn').on('click',function (){
- $('#share-box').toggle();
- if ($(this).hasClass('btn-e-active')) {
-
- $('.btn-c').removeClass('btn-e-active');
- } else {
-
- $('.btn-c').addClass('btn-e-active');
- }
- });
- });
|