开始整音乐播放器

This commit is contained in:
yutou 2020-10-21 18:05:33 +08:00
parent 4e69d01c02
commit d46b1b15cc
20 changed files with 1029 additions and 574 deletions

12
pom.xml
View File

@ -17,7 +17,12 @@
<properties>
<java.version>1.8</java.version>
</properties>
<repositories>
<repository>
<id>jaudiotagger-repository</id>
<url>https://dl.bintray.com/ijabz/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -86,6 +91,11 @@
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>net.jthink</groupId>
<artifactId>jaudiotagger</artifactId>
<version>2.2.3</version>
</dependency>
</dependencies>
<build>

View File

@ -1,5 +1,6 @@
package com.yutou.tools;
import com.yutou.tools.utils.MusicTools;
import com.yutou.tools.utils.RedisTools;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -10,6 +11,7 @@ public class ToolsApplication {
public static void main(String[] args) {
SpringApplication.run(ToolsApplication.class, args);
RedisTools.initRedisPoolSub();
MusicTools.getInstance().scanMusic();
}
}

View File

@ -59,8 +59,12 @@ public class AnimationData {
}
return -1;
}
public static void initData(){
String url="https://share.dmhy.org/topics/advanced-search?team_id=0&sort_id=0&orderby=";
String data=Tools.get(url);
System.out.println(data);
}
public static void main(String[] args) {
System.out.println(BiliBiliLiveTools.getLiveUserName("59901"));
initData();
}
}

View File

@ -0,0 +1,40 @@
package com.yutou.tools.home.nas.Data;
import lombok.Data;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.audio.exceptions.CannotReadException;
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
import org.jaudiotagger.tag.Tag;
import org.jaudiotagger.tag.TagException;
import java.io.File;
import java.io.IOException;
@Data
public class MusicData {
private String artist;//艺术家
private String album;//专辑
private String title;//标题
private String comment;//评论
private String year;//年份
private String track;//音轨号
private String disc_no;//碟片编号
private String composer;//作曲
private String artist_sort;//分类
private File file;//音乐文件
public byte[] readImage() {
AudioFile audioFile = null;
try {
audioFile = AudioFileIO.read(file);
Tag tag = audioFile.getTag();
return tag.getFirstArtwork().getBinaryData();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,104 @@
package com.yutou.tools.home.nas;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yutou.tools.home.nas.Data.MusicData;
import com.yutou.tools.utils.MusicTools;
import com.yutou.tools.utils.Tools;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.File;
import java.util.Base64;
import java.util.List;
@Controller
@RequestMapping("/nas/music/")
public class MusicController {
private String defaultMusicPath="C:\\Users\\admin\\Music";
private String musicPath=defaultMusicPath;
@RequestMapping("all.do")
@ResponseBody
public String getAllMusicList() {
JSONObject json = new JSONObject();
JSONObject data = new JSONObject();
json.put("code", 1);
MusicTools tools = MusicTools.getInstance();
data.put("scan", tools.isScan());
data.put("size", tools.getLength());
data.put("list", JSONArray.toJSON(tools.getMusicList()));
json.put("data", data);
return json.toJSONString();
}
@RequestMapping("list.do")
@ResponseBody
public String getMusicListOfPath(String path){
if(StringUtils.isEmpty(path)){
return getAllMusicList();
}
path=path.replace(defaultMusicPath+File.separator,"");
JSONObject json=new JSONObject();
JSONObject data = new JSONObject();
json.put("code", 1);
MusicTools tools = MusicTools.getInstance();
tools.setMusicPath(defaultMusicPath+File.separator+path);
data.put("scan", tools.isScan());
data.put("size", tools.getLength());
data.put("list", JSONArray.toJSON(tools.getMusicPath()));
json.put("data", data);
return json.toJSONString();
}
@RequestMapping("image.do")
@ResponseBody
public String getImage(String fileName) {
JSONObject json = new JSONObject();
json.put("code", 1);
if (StringUtils.isEmpty(fileName)) {
json.put("msg", "文件为空");
json.put("code", 0);
json.put("data", "");
return json.toJSONString();
}
File file = new File(new String(Base64.getDecoder().decode(fileName.getBytes())));
if (file.exists()) {
json.put("msg", "ok");
json.put("code", 1);
json.put("data", MusicTools.getInstance().getMetadata(file).readImage());
} else {
json.put("msg", "文件不存在");
json.put("code", 0);
json.put("data", "");
}
return json.toJSONString();
}
@RequestMapping("play.do")
public ResponseEntity<FileSystemResource> play(String filePath,boolean random) {
if(!StringUtils.isEmpty(filePath)){
filePath=new String(Base64.getDecoder().decode(filePath.getBytes()));
}
if(random){
List<MusicData> list=MusicTools.getInstance().getMusicList();
MusicData data=list.get(Tools.randomCommon(0,list.size()-1,1)[0]);
if(data==null){
System.out.println("随机歌曲:"+data.getTitle());
return play(filePath, true);
}
filePath=data.getFile().getAbsolutePath();
}
File file = new File(filePath);
if (file.exists()) {
return Tools.getFile(file);
} else {
return null;
}
}
}

View File

@ -17,11 +17,16 @@ import java.util.Enumeration;
@Component
@WebFilter
public class APIFilter implements Filter {
private static boolean isDebug=true;
@Resource
UKeyDao keyDao;
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
if(isDebug){
filterChain.doFilter(servletRequest, servletResponse);
return;
}
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response= (HttpServletResponse) servletResponse;
String token = request.getParameter("token");

View File

@ -0,0 +1,161 @@
package com.yutou.tools.utils;
import com.yutou.tools.home.nas.Data.MusicData;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.tag.FieldKey;
import org.jaudiotagger.tag.Tag;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MusicTools {
public static final int FIND_TITLE = 1;
public static final int FIND_ARTIST = 2;
private static MusicTools tools;
private String musicPath = "C:\\Users\\admin\\Music";
private final List<MusicData> musicList = new ArrayList<>();
private boolean isScan = false;
public static MusicTools getInstance() {
if (tools == null) {
tools = new MusicTools();
}
return tools;
}
public MusicTools() {
scanMusic();
}
public void scanMusic() {
new Thread(() -> {
isScan = true;
scan(new File(musicPath));
isScan = false;
}).start();
}
public List<MusicData> scan(File path, boolean isScanDir) {
if (isScanDir) {
scan(path);
return musicList;
} else {
if (path.exists() && path.isDirectory()) {
List<MusicData> list = new ArrayList<>();
for (File file : path.listFiles()) {
list.add(getMetadata(file));
}
return list;
}
}
return null;
}
private void scan(File path) {
if (path.isFile()) {
add(path);
} else if (path.isDirectory()) {
for (File file : Objects.requireNonNull(path.listFiles())) {
if (file.isDirectory()) {
scan(file);
} else {
add(file);
}
}
}
}
private void add(File file) {
MusicData data = getMetadata(file);
if (data != null) {
musicList.add(data);
}
}
public MusicData getMetadata(File file) {
try {
AudioFile audioFile = AudioFileIO.read(file);
Tag tag = audioFile.getTag();
MusicData data = new MusicData();
data.setAlbum(tag.getFirst(FieldKey.ALBUM));
data.setArtist(tag.getFirst(FieldKey.ARTIST));
data.setArtist_sort(tag.getFirst(FieldKey.ARTIST_SORT));
data.setComment(tag.getFirst(FieldKey.COMMENT));
data.setComposer(tag.getFirst(FieldKey.COMPOSER));
data.setDisc_no(tag.getFirst(FieldKey.DISC_NO));
data.setTitle(tag.getFirst(FieldKey.TITLE));
data.setTrack(tag.getFirst(FieldKey.TRACK));
data.setYear(tag.getFirst(FieldKey.YEAR));
data.setFile(file);
return data;
} catch (Exception e) {
//e.printStackTrace();
}
return null;
}
public List<MusicData> findOfTitle(String title) {
return find(title, FIND_TITLE);
}
public List<MusicData> findOfArtist(String by) {
return find(by, FIND_ARTIST);
}
public List<MusicData> getMusicList() {
return musicList;
}
public int getLength() {
return tools.musicList.size();
}
public boolean isScan() {
return isScan;
}
private List<MusicData> find(String title, int type) {
List<MusicData> list = new ArrayList<>();
for (MusicData data : musicList) {
if (data.getTitle().contains(title)) {
list.add(data);
}
}
return list;
}
public String getMusicPath() {
return musicPath;
}
public void setMusicPath(String musicPath) {
this.musicPath = musicPath;
}
private void saveImage(MusicData data) {
try {
File file = new File(data.getTitle() + ".jpg");
if (!file.exists()) {
if (!file.createNewFile()) {
return;
}
}
OutputStream outputStream = new FileOutputStream(file);
outputStream.write(data.readImage());
outputStream.flush();
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
}
}

View File

@ -3,6 +3,10 @@ package com.yutou.tools.utils;
import com.alibaba.fastjson.JSONArray;
import com.yutou.tools.interfaces.DownloadInterface;
import com.yutou.tools.nas.UpdateIp;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -258,4 +262,15 @@ public class Tools {
downloadInterface.onError(e);
}
}
public static ResponseEntity<FileSystemResource> getFile(File file){
HttpHeaders headers = new HttpHeaders();
System.out.println(file.getName());
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
headers.add("Content-Disposition", "attachment; filename=" + file.getName());
headers.add("Pragma", "no-cache");
headers.add("Expires", "0");
headers.add("Last-Modified", new Date().toString());
headers.add("ETag", String.valueOf(System.currentTimeMillis()));
return ResponseEntity.ok().headers(headers).contentLength(file.length()).contentType(MediaType.parseMediaType("application/octet-stream")).body(new FileSystemResource(file));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

1
web/css/video-js.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="top: 100px; ">
@ -160,18 +160,19 @@
<table id="rss" lay-filter="rssTools"></table>
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="rssTopTools">
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="rssTopTools">
<a class="layui-btn layui-btn-xs" lay-event="addRss">订阅</a>
</script>
<script type="text/html" id="listTools">
</script>
<script type="text/html" id="listTools">
<a class="layui-btn layui-btn-xs" lay-event="edit">查看</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
</script>
<script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
@ -208,13 +209,13 @@
toolbar: true,
page: true,
cols: [[
{ field: "title", title: "标题", sort: true, fixed: 'left' }
, { field: 'author', title: '字幕组', }
, { field: 'categories', title: '类型', templet: '<div><label>{{d.categories[0]}}</label><div>' }
, { field: 'pubDate', title: '发布时间', }
, { field: 'thumbnail', title: '封面', templet: '<div><img src="{{d.thumbnail}}"/><div>' }
, { field: 'title', title: 'magnet', templet: '<div><label >{{d.enclosure.link}}</label ></div>' }
, { field: "right", toolbar: '#rssTopTools' }
{field: "title", title: "标题", sort: true, fixed: 'left'}
, {field: 'author', title: '字幕组',}
, {field: 'categories', title: '类型', templet: '<div><label>{{d.categories[0]}}</label><div>'}
, {field: 'pubDate', title: '发布时间',}
, {field: 'thumbnail', title: '封面', templet: '<div><img src="{{d.thumbnail}}"/><div>'}
, {field: 'title', title: 'magnet', templet: '<div><label >{{d.enclosure.link}}</label ></div>'}
, {field: "right", toolbar: '#rssTopTools'}
]]
})
form.render()
@ -225,12 +226,12 @@
, url: '/anim/rss/list.do?type=' + tabid
, page: true
, cols: [[
{ field: "id", title: "id", width: 80, sort: true, fixed: 'left' }
, { field: 'title', title: '标题' }
, { field: 'categories', title: '类型' }
, { field: 'author', title: '字幕组' }
, { field: 'titlekey', title: '搜索关键词' }
, { field: "right", toolbar: '#listTools' }
{field: "id", title: "id", width: 80, sort: true, fixed: 'left'}
, {field: 'title', title: '标题'}
, {field: 'categories', title: '类型'}
, {field: 'author', title: '字幕组'}
, {field: 'titlekey', title: '搜索关键词'}
, {field: "right", toolbar: '#listTools'}
]]
});
})
@ -242,7 +243,7 @@
, content: "确认删除 " + name
, btn: ['确认', '取消']
, yes: function (index) {
$.post('/anim/type/del.do', { id: id }, function (data) {
$.post('/anim/type/del.do', {id: id}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
})
@ -273,7 +274,7 @@
, content: "删除操作无法回滚,是否确认删除:" + obj.data.title
, btn: ['确认', '取消']
, yes: function (index) {
$.post('/anim/rss/del.do', { id: obj.data.id }, function (data) {
$.post('/anim/rss/del.do', {id: obj.data.id}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
layer.close(index)
@ -312,7 +313,7 @@
layer.prompt({
title: '新增分类'
}, function (value, index, elem) {
$.post('/anim/type/add.do', { title: value }, function (data) {
$.post('/anim/type/add.do', {title: value}, function (data) {
window.location.reload()
})
layer.close(index)
@ -321,6 +322,7 @@
$('#search').click(function () {
searchClick()
})
function searchClick() {
rssList.reload({
where: {
@ -332,17 +334,17 @@
}
});
$.ajax({ cache: false })
$.ajax({cache: false})
//let js="" ; $('#team option').each(function() { let value=$(this).val(); let text=$(this).text(); js+='{"'+value+'":"'+text+'"},'})
</script>
//let js="" ; $('#team option').each(function() { let value=$(this).val(); let text=$(this).text(); js+='{"'+value+'":"'+text+'"},'})
</script>
</body>
<style>
#icon {
float: right;
}
#rss+.layui-table-view tbody>tr>td>.layui-table-cell {
#rss + .layui-table-view tbody > tr > td > .layui-table-cell {
height: 100px;
line-height: 100px;
}

View File

@ -18,7 +18,7 @@
<table id="address" lay-filter="listTools"></table>
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="listTools">

View File

@ -9,35 +9,35 @@
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 0px;">
<div id="side"></div>
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
layui.use(['layer', 'form', 'element'], function () {
var layer = layui.layer
let layer = layui.layer
, form = layui.form;
});
$.ajax({ cache: false })
$.ajax({cache: false})
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code != 0) {
if (json.code !== 0) {
window.location.href = "/"
}
})
</script>
<style>
</script>
<style>
#icon {
float: right;
}
@ -45,7 +45,7 @@
.body {
bottom: 0;
}
</style>
</style>
</body>
</html>

View File

@ -9,17 +9,17 @@
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">当前IP:</span></blockquote>
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code != 0) {
@ -31,7 +31,7 @@
, form = layui.form;
});
$.ajax({ cache: false })
$.ajax({cache: false})
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
@ -50,15 +50,16 @@
}
})
</script>
<style>
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</style>
</body>
</html>

View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>来点Music~</title>
<link rel="stylesheet" href="/layui/css/layui.css">
</head>
<link href="/css/video-js.min.css" rel="stylesheet">
<body>
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
<div style="margin-left: 5%; margin-top: 5%;">
<div>
<img src="/assets/defaultPlayImg.jpg" id="img" style="height: 400px; width: 400px"/>
<div style="display:inline-block;">
<div>title</div>
<div>by</div>
<div>(0/0)</div>
<video id="my-video" loop='true' class="video-js" controls preload="auto" width="500" height="400"
poster="/assets/defaultPlayImg.jpg" data-setup="{}" autoplay="autoplay">
<source src="/nas/music/play.do?random=true" type="video/ogg">
<p class="vjs-no-js"> To view this video please enable JavaScript, and consider upgrading to a
web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports
HTML5 video</a></p>
</video>
</div>
</div>
<div style="margin-top: 20px;">
<div class="layui-col-md6 layui-col-md6">
<button type="button" class="layui-icon layui-icon-play"
style="width: 70px;height: 60px; font-size: 50px;"></button>
<button type="button" class="layui-icon layui-icon-triangle-r"
style="width: 70px;height: 60px; font-size: 50px;"></button>
</div>
</div>
</div>
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script src="/js/video.min.js"></script>
<script>
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code !== 0) {
window.location.href = "/"
}
})
$.ajax({cache: false})
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
$('#button').click(function () {
console.log("123")
$.get("/nas/music/image.do?fileName=QzpcXFVzZXJzXFxhZG1pblxcTXVzaWNcXDM0LeWlrui1t%2BOBruODiOODqeODs%2BODmuODg%2BODiC5mbGFj", function (data) {
let json = JSON.parse(data)
if (json.code === 1) {
$('#img').attr("src", "data:image/png;base64," + json.data)
} else {
layer.msg(json.msg)
}
})
})
</script>
<style>
</style>
</body>
</html>

View File

@ -10,7 +10,7 @@
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="top: 100px; ">
@ -20,22 +20,22 @@
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
layui.use('tree', function () {
var tree = layui.tree;
let tree = layui.tree;
//渲染
var inst1 = tree.render({
let inst1 = tree.render({
elem: '#sftp' //绑定元素
,edit: ['add', 'update', 'del'] //操作节点的图标
, edit: ['add', 'update', 'del'] //操作节点的图标
, data: [{
title: '江西' //一级菜单
, children: [{
@ -51,33 +51,33 @@
title: '西安' //二级菜单
}]
}]
,click:function(obj){
, click: function (obj) {
console.log(obj.data)
if(!obj.data.children){
obj.data={
"title":obj.data.title,
"children":[
{"title":'a'}
if (!obj.data.children) {
obj.data = {
"title": obj.data.title,
"children": [
{"title": 'a'}
]
}
inst1.reload({
data:obj.data,
data: obj.data,
})
}
}
});
});
$.ajax({ cache: false })
$.ajax({cache: false})
</script>
</script>
</body>
<style>
#icon {
float: right;
}
#rss+.layui-table-view tbody>tr>td>.layui-table-cell {
#rss + .layui-table-view tbody > tr > td > .layui-table-cell {
height: 100px;
line-height: 100px;
}

View File

@ -25,7 +25,7 @@
</div>
<script>
$(document).ready(function () {
let mobile = navigator.userAgent.toLowerCase().match(/android/i) == "android" || navigator.userAgent.toLowerCase().match(/iphone os/i) == "iphone os";
let mobile = navigator.userAgent.toLowerCase().match(/android/i) === "android" || navigator.userAgent.toLowerCase().match(/iphone os/i) === "iphone os";
if (mobile) {
$('#myside').removeClass('layui-side')
$('#myside_div').removeClass('layui-side-scroll')

View File

@ -9,7 +9,7 @@
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-layout layui-layout-admin">
<div id="header"></div>
<div class="layui-body" style="left: 200px;">
<div id="side"></div>
@ -26,9 +26,11 @@
autocomplete="off" class="layui-input" style="margin-top: 10px;">
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="formDemo"
style="margin-top: 10px;">立即提交</button>
style="margin-top: 10px;">立即提交
</button>
<button type="reset" class="layui-btn layui-btn-primary"
style="margin-top: 10px;">重置</button>
style="margin-top: 10px;">重置
</button>
</div>
</form>
</div>
@ -37,16 +39,16 @@
<div id="footer"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="listTools">
<script type="text/html" id="listTools">
<a class="layui-btn layui-btn-xs" lay-event="set">设置</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
</script>
<script>
$('#header').load("/html/header.html");
$('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html");
@ -68,17 +70,17 @@
, page: true
, cols: [[
{ field: "id", title: "id", width: 80, sort: true, fixed: 'left' }
, { field: 'title', title: '标题', width: 80 }
, { field: 'url', title: 'url', width: 400 }
, { field: 'port', title: '端口', width: 80 }
, { field: "right", width: 200, toolbar: '#listTools' }
{field: "id", title: "id", width: 80, sort: true, fixed: 'left'}
, {field: 'title', title: '标题', width: 80}
, {field: 'url', title: 'url', width: 400}
, {field: 'port', title: '端口', width: 80}
, {field: "right", width: 200, toolbar: '#listTools'}
]]
});
table.on('tool(listTools)', function (obj) {
let data = obj.data;
if (obj.event === 'set') {
$.post('/auth/nas/address/set.do', { id: data.id }, function (deta) {
$.post('/auth/nas/address/set.do', {id: data.id}, function (deta) {
let json = JSON.parse(deta);
layer.msg(json.msg)
setTimeout(function () {
@ -99,7 +101,7 @@
, content: "确认删除?"
, btn: ['确认', '取消']
, yes: function (index, layero) {
$.post('/auth/nas/address/remove.do', { id: data.id }, function () {
$.post('/auth/nas/address/remove.do', {id: data.id}, function () {
table.reload('address')
});
layer.close(index)
@ -118,7 +120,12 @@
if (editModel === 'update') {
url = '/auth/nas/address/update.do'
}
$.post(url, { title: data.field.title, url: data.field.url, port: data.field.port, id: dataId }, function (data) {
$.post(url, {
title: data.field.title,
url: data.field.url,
port: data.field.port,
id: dataId
}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
table.reload('address')
@ -127,10 +134,10 @@
});
});
$.ajax({ cache: false })
$.ajax({cache: false})
$.get("/auth/nas/address/get.do", function (data) {
var json = JSON.parse(data);
if (json.code != 0) {
let json = JSON.parse(data);
if (json.code !== 0) {
$('#ip').html(json.msg);
} else {
$('#ip').html(json.msg);
@ -140,15 +147,16 @@
editModel = 'edit'
$('#adddata').css("display", '')
})
</script>
<style>
</script>
<style>
#icon {
float: right;
}
.body {
bottom: 0;
}
</style>
</style>
</body>
</html>

View File

@ -40,7 +40,7 @@
</ul>
</div>
</body>
<script src="../js/qrcode.min.js"></script>
<script src="/js/qrcode.min.js"></script>
<script>
let loginStatus = false;
$.get("/login/check.do", function (data) {

25
web/js/video.min.js vendored Normal file

File diff suppressed because one or more lines are too long