开始整音乐播放器

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

View File

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

View File

@ -59,8 +59,12 @@ public class AnimationData {
} }
return -1; 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) { 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 @Component
@WebFilter @WebFilter
public class APIFilter implements Filter { public class APIFilter implements Filter {
private static boolean isDebug=true;
@Resource @Resource
UKeyDao keyDao; UKeyDao keyDao;
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
if(isDebug){
filterChain.doFilter(servletRequest, servletResponse);
return;
}
HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response= (HttpServletResponse) servletResponse; HttpServletResponse response= (HttpServletResponse) servletResponse;
String token = request.getParameter("token"); 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.alibaba.fastjson.JSONArray;
import com.yutou.tools.interfaces.DownloadInterface; import com.yutou.tools.interfaces.DownloadInterface;
import com.yutou.tools.nas.UpdateIp; 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 org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -258,4 +262,15 @@ public class Tools {
downloadInterface.onError(e); 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,339 +10,341 @@
<body> <body>
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="top: 100px; "> <div class="layui-body" style="top: 100px; ">
<div id="side"></div> <div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">番剧订阅器</span></blockquote> <blockquote class="layui-elem-quote"><span id="ip">番剧订阅器</span></blockquote>
<button type="button" id="addType" class="layui-btn layui-btn-normal">新增分类</button> <button type="button" id="addType" class="layui-btn layui-btn-normal">新增分类</button>
<div class="layui-tab" lay-filter="type" lay-allowclose="true"> <div class="layui-tab" lay-filter="type" lay-allowclose="true">
<ul class="layui-tab-title"> <ul class="layui-tab-title">
</ul> </ul>
<div class="layui-tab-content"> <div class="layui-tab-content">
</div>
</div>
<blockquote class="layui-elem-quote"><span id="ip">动漫花园RSS</span></blockquote>
<form class="layui-form" action="" lay-filter="formTest">
<div class="layui-form-item">
<label class="layui-form-label"><a type="text" id="search"
class="layui-btn layui-btn-normal">搜索</a></label>
<div class="layui-input-block" style="padding-top: 8px; width: 200px;">
<input type="text" name="title" id="title" required lay-verify="required" placeholder="请输入标题"
autocomplete="off" class="layui-input" style="width: 200px;">
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block" style="width: 200px;">
<select name="type" lay-verify="type" id="type">
<option value="0">全部</option>
<option value="2">動畫</option>
<option value="31">季度全集</option>
<option value="3">漫畫</option>
<option value="41">港台原版</option>
<option value="42">日文原版</option>
<option value="4">音樂</option>
<option value="43">動漫音樂</option>
<option value="44">同人音樂</option>
<option value="15">流行音樂</option>
<option value="6">日劇</option>
<option value="7"></option>
<option value="9">遊戲</option>
<option value="17">電腦遊戲</option>
<option value="18">電視遊戲</option>
<option value="19">掌機遊戲</option>
<option value="20">網絡遊戲</option>
<option value="21">遊戲周邊</option>
<option value="12">特攝</option>
<option value="1">其他</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">字幕组</label>
<div class="layui-input-block" style="width: 200px;">
<select name="team" lay-verify="team" id='team'>
<option value="0">全部</option>
<option value="117">動漫花園</option>
<option value="669">喵萌奶茶屋</option>
<option value="648">魔星字幕团</option>
<option value="185">极影字幕社</option>
<option value="619">桜都字幕组</option>
<option value="604">c.c动漫</option>
<option value="241">幻樱字幕组</option>
<option value="151">悠哈C9字幕社</option>
<option value="657">LoliHouse</option>
<option value="283">千夏字幕组</option>
<option value="755">GMTeam</option>
<option value="390">天使动漫</option>
<option value="731">星空字幕组</option>
<option value="303">动漫国字幕组</option>
<option value="563">花園壓制組</option>
<option value="37">雪飄工作室(FLsnow)</option>
<option value="47">爱恋字幕社</option>
<option value="710">咪梦动漫组</option>
<option value="88">动音漫影</option>
<option value="574">梦蓝字幕组</option>
<option value="504">LoveEcho!</option>
<option value="765">爱咕字幕组</option>
<option value="520">豌豆字幕组</option>
<option value="650">SweetSub</option>
<option value="430">幻之字幕组</option>
<option value="407">DHR動研字幕組</option>
<option value="321">轻之国度</option>
<option value="581">VCB-Studio</option>
<option value="703">届恋字幕组</option>
<option value="576">银色子弹字幕组</option>
<option value="454">风车字幕组</option>
<option value="485">天空树双语字幕组</option>
<option value="134">漫游字幕组</option>
<option value="434">风之圣殿</option>
<option value="630">枫叶字幕组</option>
<option value="228">KRL字幕组</option>
<option value="526">东京不够热</option>
<option value="592">未央阁联盟</option>
<option value="288">诸神kamigami字幕组</option>
<option value="767">天月動漫&amp;發佈組</option>
<option value="768">千歲字幕組</option>
<option value="423">漫貓字幕組</option>
<option value="562">129.3字幕組</option>
<option value="447">夢幻戀櫻</option>
<option value="680">Little字幕组</option>
<option value="641">冷番补完字幕组</option>
<option value="31">卡通空間</option>
<option value="649">云光字幕组</option>
<option value="701">狐狸小宮</option>
<option value="459">紫音動漫&amp;發佈組</option>
<option value="699">小花花同盟戰線</option>
<option value="626">驯兽师联盟</option>
<option value="58">澄空学园</option>
<option value="769">动漫萌</option>
<option value="734">TD-RAWS</option>
<option value="225">鈴風字幕組</option>
<option value="673">VRAINSTORM</option>
<option value="741">銀月字幕組</option>
<option value="675">AikatsuFans</option>
<option value="759">红鸟窝字幕组</option>
<option value="764">MCE汉化组</option>
<option value="391">ZERO字幕组</option>
<option value="561">钉铛字幕组</option>
<option value="727">2B4B</option>
<option value="104">动漫先锋</option>
<option value="567">雪梦字幕组</option>
<option value="573">Centaurea-Raws</option>
<option value="652">SFEO-Raws</option>
<option value="666">中肯字幕組</option>
<option value="754">BYYM发布组</option>
<option value="613">AI-Raws</option>
<option value="706">K&amp;W-RAWS</option>
<option value="732">肥猫压制</option>
<option value="424">TSDM字幕組</option>
<option value="739">Clarita 压制组</option>
<option value="432">自由字幕组</option>
<option value="217">AQUA工作室</option>
<option value="753">柠檬水字幕组</option>
<option value="763">光之家族字幕组</option>
<option value="332">CureSub</option>
<option value="537">NEO·QSW</option>
<option value="632">歐克勒亞</option>
<option value="548">Cornflower Studio</option>
<option value="638">LittleBakas!</option>
</select>
</div>
</div> </div>
</div> </div>
<blockquote class="layui-elem-quote"><span id="ip">动漫花园RSS</span></blockquote> </form>
<form class="layui-form" action="" lay-filter="formTest"> <table id="rss" lay-filter="rssTools"></table>
<div class="layui-form-item"> <div id="footer"></div>
<label class="layui-form-label"><a type="text" id="search" </div>
class="layui-btn layui-btn-normal">搜索</a></label> </div>
<div class="layui-input-block" style="padding-top: 8px; width: 200px;">
<input type="text" name="title" id="title" required lay-verify="required" placeholder="请输入标题"
autocomplete="off" class="layui-input" style="width: 200px;">
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block" style="width: 200px;">
<select name="type" lay-verify="type" id="type">
<option value="0">全部</option>
<option value="2">動畫</option>
<option value="31">季度全集</option>
<option value="3">漫畫</option>
<option value="41">港台原版</option>
<option value="42">日文原版</option>
<option value="4">音樂</option>
<option value="43">動漫音樂</option>
<option value="44">同人音樂</option>
<option value="15">流行音樂</option>
<option value="6">日劇</option>
<option value="7"></option>
<option value="9">遊戲</option>
<option value="17">電腦遊戲</option>
<option value="18">電視遊戲</option>
<option value="19">掌機遊戲</option>
<option value="20">網絡遊戲</option>
<option value="21">遊戲周邊</option>
<option value="12">特攝</option>
<option value="1">其他</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">字幕组</label>
<div class="layui-input-block" style="width: 200px;">
<select name="team" lay-verify="team" id='team'>
<option value="0">全部</option>
<option value="117">動漫花園</option>
<option value="669">喵萌奶茶屋</option>
<option value="648">魔星字幕团</option>
<option value="185">极影字幕社</option>
<option value="619">桜都字幕组</option>
<option value="604">c.c动漫</option>
<option value="241">幻樱字幕组</option>
<option value="151">悠哈C9字幕社</option>
<option value="657">LoliHouse</option>
<option value="283">千夏字幕组</option>
<option value="755">GMTeam</option>
<option value="390">天使动漫</option>
<option value="731">星空字幕组</option>
<option value="303">动漫国字幕组</option>
<option value="563">花園壓制組</option>
<option value="37">雪飄工作室(FLsnow)</option>
<option value="47">爱恋字幕社</option>
<option value="710">咪梦动漫组</option>
<option value="88">动音漫影</option>
<option value="574">梦蓝字幕组</option>
<option value="504">LoveEcho!</option>
<option value="765">爱咕字幕组</option>
<option value="520">豌豆字幕组</option>
<option value="650">SweetSub</option>
<option value="430">幻之字幕组</option>
<option value="407">DHR動研字幕組</option>
<option value="321">轻之国度</option>
<option value="581">VCB-Studio</option>
<option value="703">届恋字幕组</option>
<option value="576">银色子弹字幕组</option>
<option value="454">风车字幕组</option>
<option value="485">天空树双语字幕组</option>
<option value="134">漫游字幕组</option>
<option value="434">风之圣殿</option>
<option value="630">枫叶字幕组</option>
<option value="228">KRL字幕组</option>
<option value="526">东京不够热</option>
<option value="592">未央阁联盟</option>
<option value="288">诸神kamigami字幕组</option>
<option value="767">天月動漫&amp;發佈組</option>
<option value="768">千歲字幕組</option>
<option value="423">漫貓字幕組</option>
<option value="562">129.3字幕組</option>
<option value="447">夢幻戀櫻</option>
<option value="680">Little字幕组</option>
<option value="641">冷番补完字幕组</option>
<option value="31">卡通空間</option>
<option value="649">云光字幕组</option>
<option value="701">狐狸小宮</option>
<option value="459">紫音動漫&amp;發佈組</option>
<option value="699">小花花同盟戰線</option>
<option value="626">驯兽师联盟</option>
<option value="58">澄空学园</option>
<option value="769">动漫萌</option>
<option value="734">TD-RAWS</option>
<option value="225">鈴風字幕組</option>
<option value="673">VRAINSTORM</option>
<option value="741">銀月字幕組</option>
<option value="675">AikatsuFans</option>
<option value="759">红鸟窝字幕组</option>
<option value="764">MCE汉化组</option>
<option value="391">ZERO字幕组</option>
<option value="561">钉铛字幕组</option>
<option value="727">2B4B</option>
<option value="104">动漫先锋</option>
<option value="567">雪梦字幕组</option>
<option value="573">Centaurea-Raws</option>
<option value="652">SFEO-Raws</option>
<option value="666">中肯字幕組</option>
<option value="754">BYYM发布组</option>
<option value="613">AI-Raws</option>
<option value="706">K&amp;W-RAWS</option>
<option value="732">肥猫压制</option>
<option value="424">TSDM字幕組</option>
<option value="739">Clarita 压制组</option>
<option value="432">自由字幕组</option>
<option value="217">AQUA工作室</option>
<option value="753">柠檬水字幕组</option>
<option value="763">光之家族字幕组</option>
<option value="332">CureSub</option>
<option value="537">NEO·QSW</option>
<option value="632">歐克勒亞</option>
<option value="548">Cornflower Studio</option>
<option value="638">LittleBakas!</option>
</select>
</div>
</div>
</div>
</form>
<table id="rss" lay-filter="rssTools"></table>
<div id="footer"></div>
</div>
<script src="/layui/layui.js"></script> <script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script> <script src="/js/jquery-3.2.1.js"></script>
<script type="text/html" id="rssTopTools"> <script type="text/html" id="rssTopTools">
<a class="layui-btn layui-btn-xs" lay-event="addRss">订阅</a> <a class="layui-btn layui-btn-xs" lay-event="addRss">订阅</a>
</script> </script>
<script type="text/html" id="listTools"> <script type="text/html" id="listTools">
<a class="layui-btn layui-btn-xs" lay-event="edit">查看</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> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script> </script>
<script> <script>
$('#header').load("/html/header.html"); $('#header').load("/html/header.html");
$('#footer').load("/html/footer.html"); $('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html"); $('#side').load("/html/body/nas/side.html");
let tabid = -1; let tabid = -1;
$.get("/login/check.do", function (data) { $.get("/login/check.do", function (data) {
let json = JSON.parse(data); let json = JSON.parse(data);
if (json.code != 0) { if (json.code != 0) {
window.location.href = "/" window.location.href = "/"
}
})
layui.use(['layer', 'form', 'element', 'table'], function () {
var layer = layui.layer
, form = layui.form
, table = layui.table
, element = layui.element;
$.get("/anim/type/list.do", function (data) {
let json = JSON.parse(data);
if (json.code == 0) {
for (let index = 0; index < json.data.length; index++) {
const ret = json.data[index];
element.tabAdd('type', {
title: ret.title
, content: '<table id="passwordlist' + ret.id + '" lay-filter="listTools"></table>'
, id: ret.id
})
}
element.tabChange('type', '1');
}
});
let rssList = table.render({
elem: "#rss",
url: "/anim/rss/data.do?key=&type=" + form.val("formTest").type + "&team=" + form.val("formTest").team,
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'}
]]
})
form.render()
element.on('tab(type)', function (data) {
tabid = $(this).attr('lay-id')
table.render({
elem: "#passwordlist" + tabid
, 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'}
]]
});
})
element.on('tabDelete(type)', function (data) {
let name = $(data.elem.prevObject.prevObject[0]).text().replace("ဆ", "")
let id = $(data.elem.prevObject.prevObject[0]).attr('lay-id')
layer.open({
title: "警告"
, content: "确认删除 " + name
, btn: ['确认', '取消']
, yes: function (index) {
$.post('/anim/type/del.do', {id: id}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
})
layer.close(index)
}
, btn2: function (index) {
layer.close(index)
} }
}) })
layui.use(['layer', 'form', 'element', 'table'], function () { });
var layer = layui.layer
, form = layui.form table.on('tool(listTools)', function (obj) {
, table = layui.table if (obj.event === 'edit') {
, element = layui.element; $("#type").find("option:contains('" + obj.data.categories + "')").attr("selected", null);
$.get("/anim/type/list.do", function (data) { $("#team").find("option:contains('" + obj.data.author + "')").attr("selected", null);
let json = JSON.parse(data); $("#type").find("option:contains('" + obj.data.categories + "')").attr("selected", true);
if (json.code == 0) { $("#team").find("option:contains('" + obj.data.author + "')").attr("selected", true);
for (let index = 0; index < json.data.length; index++) { $('#title').val(obj.data.titlekey);
const ret = json.data[index];
element.tabAdd('type', { form.render("select", 'team');
title: ret.title form.render("select", 'type');
, content: '<table id="passwordlist' + ret.id + '" lay-filter="listTools"></table>' searchClick();
, id: ret.id
}) } else if (obj.event === 'del') {
} layer.open({
element.tabChange('type', '1'); title: "警告!"
} , content: "删除操作无法回滚,是否确认删除:" + obj.data.title
}); , btn: ['确认', '取消']
let rssList = table.render({ , yes: function (index) {
elem: "#rss", $.post('/anim/rss/del.do', {id: obj.data.id}, function (data) {
url: "/anim/rss/data.do?key=&type=" + form.val("formTest").type + "&team=" + form.val("formTest").team, let json = JSON.parse(data);
toolbar: true, layer.msg(json.msg)
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' }
]]
})
form.render()
element.on('tab(type)', function (data) {
tabid = $(this).attr('lay-id')
table.render({
elem: "#passwordlist" + tabid
, 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' }
]]
});
})
element.on('tabDelete(type)', function (data) {
let name = $(data.elem.prevObject.prevObject[0]).text().replace("ဆ", "")
let id = $(data.elem.prevObject.prevObject[0]).attr('lay-id')
layer.open({
title: "警告"
, content: "确认删除 " + name
, btn: ['确认', '取消']
, yes: function (index) {
$.post('/anim/type/del.do', { id: id }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg);
})
layer.close(index) layer.close(index)
}
, btn2: function (index) {
layer.close(index)
}
})
});
table.on('tool(listTools)', function (obj) {
if (obj.event === 'edit') {
$("#type").find("option:contains('" + obj.data.categories + "')").attr("selected", null);
$("#team").find("option:contains('" + obj.data.author + "')").attr("selected", null);
$("#type").find("option:contains('" + obj.data.categories + "')").attr("selected", true);
$("#team").find("option:contains('" + obj.data.author + "')").attr("selected", true);
$('#title').val(obj.data.titlekey);
form.render("select", 'team');
form.render("select", 'type');
searchClick();
} else if (obj.event === 'del') {
layer.open({
title: "警告!"
, content: "删除操作无法回滚,是否确认删除:" + obj.data.title
, btn: ['确认', '取消']
, yes: function (index) {
$.post('/anim/rss/del.do', { id: obj.data.id }, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
layer.close(index)
})
},
btn2: function (index) {
layer.close(index);
}
}) })
},
btn2: function (index) {
layer.close(index);
} }
}) })
table.on('tool(rssTools)', function (obj) { }
let data = obj.data; })
if (obj.event === 'addRss') { table.on('tool(rssTools)', function (obj) {
layer.prompt({ let data = obj.data;
formType: 2, if (obj.event === 'addRss') {
title: '订阅这个RSS结果,并加入到第' + tabid + '个分类中', layer.prompt({
value: data.title formType: 2,
}, function (value, index, elem) { title: '订阅这个RSS结果,并加入到第' + tabid + '个分类中',
$.post("/anim/rss/add.do", { value: data.title
title: value }, function (value, index, elem) {
, author: data.author $.post("/anim/rss/add.do", {
, categories: data.categories[0] title: value
, titleKey: $('#title').val() , author: data.author
, bid: tabid , categories: data.categories[0]
}, function (data) { , titleKey: $('#title').val()
let json = JSON.parse(data); , bid: tabid
layer.msg(json.msg) }, function (data) {
layer.close(index) let json = JSON.parse(data);
}) layer.msg(json.msg)
})
}
})
$('#addType').click(function () {
layer.prompt({
title: '新增分类'
}, function (value, index, elem) {
$.post('/anim/type/add.do', { title: value }, function (data) {
window.location.reload()
})
layer.close(index) layer.close(index)
}) })
}) })
$('#search').click(function () { }
searchClick() })
$('#addType').click(function () {
layer.prompt({
title: '新增分类'
}, function (value, index, elem) {
$.post('/anim/type/add.do', {title: value}, function (data) {
window.location.reload()
}) })
function searchClick() { layer.close(index)
rssList.reload({ })
where: { })
key: $('#title').val(), $('#search').click(function () {
type: form.val("formTest").type, searchClick()
team: form.val("formTest").team })
}
})
function searchClick() {
rssList.reload({
where: {
key: $('#title').val(),
type: form.val("formTest").type,
team: form.val("formTest").team
} }
}); })
$.ajax({ cache: false })
//let js="" ; $('#team option').each(function() { let value=$(this).val(); let text=$(this).text(); js+='{"'+value+'":"'+text+'"},'}) }
</script> });
$.ajax({cache: false})
//let js="" ; $('#team option').each(function() { let value=$(this).val(); let text=$(this).text(); js+='{"'+value+'":"'+text+'"},'})
</script>
</body> </body>
<style> <style>
#icon { #icon {
float: right; float: right;
} }
#rss+.layui-table-view tbody>tr>td>.layui-table-cell { #rss + .layui-table-view tbody > tr > td > .layui-table-cell {
height: 100px; height: 100px;
line-height: 100px; line-height: 100px;
} }

View File

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

View File

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

View File

@ -9,56 +9,57 @@
</head> </head>
<body> <body>
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="left: 200px;"> <div class="layui-body" style="left: 200px;">
<div id="side"></div> <div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">当前IP:</span></blockquote> <blockquote class="layui-elem-quote"><span id="ip">当前IP:</span></blockquote>
<div id="footer"></div> <div id="footer"></div>
</div> </div>
</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) {
window.location.href = "/"
}
})
layui.use(['layer', 'form', 'element'], function () {
var layer = layui.layer
, form = layui.form;
<script src="/layui/layui.js"></script> });
<script src="/js/jquery-3.2.1.js"></script> $.ajax({cache: false})
<script> $('#header').load("/html/header.html");
$.get("/login/check.do", function (data) { $('#footer').load("/html/footer.html");
let json = JSON.parse(data); $('#side').load("/html/body/nas/side.html");
if (json.code != 0) { $.post("/nas/getIp.do", function (data) {
window.location.href = "/" try {
} var json = JSON.parse(data);
}) } catch (error) {
layui.use(['layer', 'form', 'element'], function () { window.location.href = "/"
var layer = layui.layer return
, form = layui.form; }
}); if (json.code != 0) {
$.ajax({ cache: false }) $('#ip').html(json.msg);
$('#header').load("/html/header.html"); } else {
$('#footer').load("/html/footer.html"); $('#ip').html("当前服务器IP:" + json.data);
$('#side').load("/html/body/nas/side.html"); }
$.post("/nas/getIp.do", function (data) { })
try {
var json = JSON.parse(data);
} catch (error) {
window.location.href = "/"
return
}
if (json.code != 0) { </script>
$('#ip').html(json.msg); <style>
} else { #icon {
$('#ip').html("当前服务器IP:" + json.data); float: right;
} }
})
</script> .body {
<style> bottom: 0;
#icon { }
float: right; </style>
}
.body {
bottom: 0;
}
</style>
</body> </body>
</html> </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,74 +10,74 @@
<body> <body>
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="top: 100px; "> <div class="layui-body" style="top: 100px; ">
<div id="side"></div> <div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">SFTP</span></blockquote> <blockquote class="layui-elem-quote"><span id="ip">SFTP</span></blockquote>
<div id="sftp"></div> <div id="sftp"></div>
<div id="footer"></div> <div id="footer"></div>
</div> </div>
</div>
<script src="/layui/layui.js"></script> <script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script> <script src="/js/jquery-3.2.1.js"></script>
<script> <script>
$('#header').load("/html/header.html"); $('#header').load("/html/header.html");
$('#footer').load("/html/footer.html"); $('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html"); $('#side').load("/html/body/nas/side.html");
layui.use('tree', function () { layui.use('tree', function () {
var tree = layui.tree; let tree = layui.tree;
//渲染 //渲染
var inst1 = tree.render({ let inst1 = tree.render({
elem: '#sftp' //绑定元素 elem: '#sftp' //绑定元素
,edit: ['add', 'update', 'del'] //操作节点的图标 , edit: ['add', 'update', 'del'] //操作节点的图标
, data: [{ , data: [{
title: '江西' //一级菜单 title: '江西' //一级菜单
, children: [{ , children: [{
title: '南昌' //二级菜单 title: '南昌' //二级菜单
, children: [{ , children: [{
title: '高新区' //三级菜单 title: '高新区' //三级菜单
//…… //以此类推,可无限层级 //…… //以此类推,可无限层级
}]
}]
}, {
title: '陕西' //一级菜单
, children: [{
title: '西安' //二级菜单
}]
}] }]
,click:function(obj){ }]
console.log(obj.data) }, {
if(!obj.data.children){ title: '陕西' //一级菜单
obj.data={ , children: [{
"title":obj.data.title, title: '西安' //二级菜单
"children":[ }]
{"title":'a'} }]
] , click: function (obj) {
} console.log(obj.data)
inst1.reload({ if (!obj.data.children) {
data:obj.data, obj.data = {
}) "title": obj.data.title,
"children": [
} {"title": 'a'}
]
} }
}); inst1.reload({
}); data: obj.data,
$.ajax({ cache: false }) })
</script> }
}
});
});
$.ajax({cache: false})
</script>
</body> </body>
<style> <style>
#icon { #icon {
float: right; float: right;
} }
#rss+.layui-table-view tbody>tr>td>.layui-table-cell { #rss + .layui-table-view tbody > tr > td > .layui-table-cell {
height: 100px; height: 100px;
line-height: 100px; line-height: 100px;
} }

View File

@ -25,7 +25,7 @@
</div> </div>
<script> <script>
$(document).ready(function () { $(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) { if (mobile) {
$('#myside').removeClass('layui-side') $('#myside').removeClass('layui-side')
$('#myside_div').removeClass('layui-side-scroll') $('#myside_div').removeClass('layui-side-scroll')

View File

@ -9,146 +9,154 @@
</head> </head>
<body> <body>
<div class="layui-layout layui-layout-admin"> <div class="layui-layout layui-layout-admin">
<div id="header"></div> <div id="header"></div>
<div class="layui-body" style="left: 200px;"> <div class="layui-body" style="left: 200px;">
<div id="side"></div> <div id="side"></div>
<blockquote class="layui-elem-quote"><span id="ip">当前状态:</span></blockquote> <blockquote class="layui-elem-quote"><span id="ip">当前状态:</span></blockquote>
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<button type="button" id='add' class="layui-btn layui-btn-normal">新增</button> <button type="button" id='add' class="layui-btn layui-btn-normal">新增</button>
<div style="width: 30%; margin-top: 10px; display: none;" id="adddata"> <div style="width: 30%; margin-top: 10px; display: none;" id="adddata">
<form class="layui-form" action=""> <form class="layui-form" action="">
<input type="text" name="title" id="title" required lay-verify="required" placeholder="请输入标题" <input type="text" name="title" id="title" required lay-verify="required" placeholder="请输入标题"
autocomplete="off" class="layui-input"> autocomplete="off" class="layui-input">
<input type="text" name="url" id="url" required lay-verify="required" placeholder="请输入URL" <input type="text" name="url" id="url" required lay-verify="required" placeholder="请输入URL"
autocomplete="off" class="layui-input" style="margin-top: 10px;"> autocomplete="off" class="layui-input" style="margin-top: 10px;">
<input type="number" name="port" id="port" required lay-verify="required" placeholder="请输入端口" <input type="number" name="port" id="port" required lay-verify="required" placeholder="请输入端口"
autocomplete="off" class="layui-input" style="margin-top: 10px;"> autocomplete="off" class="layui-input" style="margin-top: 10px;">
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="formDemo" <button class="layui-btn" lay-submit lay-filter="formDemo"
style="margin-top: 10px;">立即提交</button> style="margin-top: 10px;">立即提交
<button type="reset" class="layui-btn layui-btn-primary" </button>
style="margin-top: 10px;">重置</button> <button type="reset" class="layui-btn layui-btn-primary"
</div> style="margin-top: 10px;">重置
</form> </button>
</div> </div>
<table id="address" lay-filter="listTools"></table> </form>
</div> </div>
<table id="address" lay-filter="listTools"></table>
<div id="footer"></div>
</div> </div>
<script src="/layui/layui.js"></script> <div id="footer"></div>
<script src="/js/jquery-3.2.1.js"></script> </div>
</div>
<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="set">设置</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</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> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script> </script>
<script> <script>
$('#header').load("/html/header.html"); $('#header').load("/html/header.html");
$('#footer').load("/html/footer.html"); $('#footer').load("/html/footer.html");
$('#side').load("/html/body/nas/side.html"); $('#side').load("/html/body/nas/side.html");
$.get("/login/check.do", function (data) { $.get("/login/check.do", function (data) {
let json = JSON.parse(data); let json = JSON.parse(data);
if (json.code != 0) { if (json.code != 0) {
window.location.href = "/" window.location.href = "/"
} }
}) })
let editModel = 'edit'; let editModel = 'edit';
let dataId = -1; let dataId = -1;
layui.use(['layer', 'form', 'element', 'table'], function () { layui.use(['layer', 'form', 'element', 'table'], function () {
var layer = layui.layer var layer = layui.layer
, form = layui.form , form = layui.form
, table = layui.table; , table = layui.table;
table.render({ table.render({
elem: "#address" elem: "#address"
, url: '/auth/nas/address/list.do' , url: '/auth/nas/address/list.do'
, page: true , page: true
, cols: [[ , cols: [[
{ field: "id", title: "id", width: 80, sort: true, fixed: 'left' } {field: "id", title: "id", width: 80, sort: true, fixed: 'left'}
, { field: 'title', title: '标题', width: 80 } , {field: 'title', title: '标题', width: 80}
, { field: 'url', title: 'url', width: 400 } , {field: 'url', title: 'url', width: 400}
, { field: 'port', title: '端口', width: 80 } , {field: 'port', title: '端口', width: 80}
, { field: "right", width: 200, toolbar: '#listTools' } , {field: "right", width: 200, toolbar: '#listTools'}
]] ]]
}); });
table.on('tool(listTools)', function (obj) { table.on('tool(listTools)', function (obj) {
let data = obj.data; let data = obj.data;
if (obj.event === 'set') { 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); let json = JSON.parse(deta);
layer.msg(json.msg) layer.msg(json.msg)
setTimeout(function () { setTimeout(function () {
table.reload('address')
}, 2000)
});
} else if (obj.event === 'edit') {
editModel = 'update';
dataId = data.id;
$('#title').val(data.title)
$('#url').val(data.url)
$('#port').val(data.port)
$('#adddata').css('display', '')
} else {
layer.open({
title: "删除提示"
, content: "确认删除?"
, btn: ['确认', '取消']
, yes: function (index, layero) {
$.post('/auth/nas/address/remove.do', { id: data.id }, function () {
table.reload('address')
});
layer.close(index)
},
btn2: function (index, layero) {
layer.close(index)
}
})
}
});
form.on('submit(formDemo)', function (data) {
//layer.msg(JSON.stringify(data.field));
$('#adddata').css("display", 'none')
let url = '/auth/nas/address/add.do'
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) {
let json = JSON.parse(data);
layer.msg(json.msg)
table.reload('address') table.reload('address')
}); }, 2000)
return false;
}); });
} else if (obj.event === 'edit') {
editModel = 'update';
dataId = data.id;
$('#title').val(data.title)
$('#url').val(data.url)
$('#port').val(data.port)
$('#adddata').css('display', '')
} else {
layer.open({
title: "删除提示"
, content: "确认删除?"
, btn: ['确认', '取消']
, yes: function (index, layero) {
$.post('/auth/nas/address/remove.do', {id: data.id}, function () {
table.reload('address')
});
layer.close(index)
},
btn2: function (index, layero) {
layer.close(index)
}
})
}
});
form.on('submit(formDemo)', function (data) {
//layer.msg(JSON.stringify(data.field));
$('#adddata').css("display", 'none')
let url = '/auth/nas/address/add.do'
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) {
let json = JSON.parse(data);
layer.msg(json.msg)
table.reload('address')
}); });
$.ajax({ cache: false }) return false;
$.get("/auth/nas/address/get.do", function (data) { });
var json = JSON.parse(data);
if (json.code != 0) { });
$('#ip').html(json.msg); $.ajax({cache: false})
} else { $.get("/auth/nas/address/get.do", function (data) {
$('#ip').html(json.msg); let json = JSON.parse(data);
} if (json.code !== 0) {
}) $('#ip').html(json.msg);
$('#add').click(function () { } else {
editModel = 'edit' $('#ip').html(json.msg);
$('#adddata').css("display", '') }
}) })
</script> $('#add').click(function () {
<style> editModel = 'edit'
#icon { $('#adddata').css("display", '')
float: right; })
} </script>
.body { <style>
bottom: 0; #icon {
} float: right;
</style> }
.body {
bottom: 0;
}
</style>
</body> </body>
</html> </html>

View File

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