可以对资源进行增删改

This commit is contained in:
limqhz
2022-05-07 01:52:25 +08:00
parent 69941133b8
commit e65206fa89
38 changed files with 922 additions and 189 deletions

View File

@@ -37,7 +37,7 @@ body {
.NotPage {
position: relative;
/*z-index: -10;*/
background: #000;
background: #4d4d4d;
height: 100vh;
overflow: hidden;
display: flex;

View File

@@ -49,8 +49,8 @@ try {
"www.fghrsh.net": ["FGHRSH 的论坛"]
},
"model_message": {
"1": ["来自 Potion Maker 的 Pio 酱 ~"],
"2": ["来自 Potion Maker 的 Tia 酱 ~"]
"1": ["来自 Pio 酱 ~"],
"2": ["来自 Tia 酱 ~"]
},
"hitokoto_api_message": {
"lwl12.com": ["干了这碗鸡汤,再来一碗?"],
@@ -90,7 +90,7 @@ try {
{ "selector": "c-player div.volume", "text": ["在这里可以调整<span style=\"color:#0099cc;\">音量</span>呢"] },
{ "selector": "c-player div.list-button", "text": ["<span style=\"color:#0099cc;\">播放列表</span>里都有什么呢"] },
{ "selector": "c-player div.lyric-button", "text": ["有<span style=\"color:#0099cc;\">歌词</span>的话就能跟着一起唱呢"] },
{ "selector": ".waifu #live2d", "text": ["干嘛呢你,快把手拿开", "鼠…鼠标放错地方了"] }
{ "selector": ".waifu #live2d", "text": ["要不~给我换个位置(ó﹏ò。)", "快…快把手拿开"] }
],
"click": [
{
@@ -132,7 +132,7 @@ try {
live2d_settings['screenshotCaptureName']= 'quinn.png';
live2d_settings['waifuEdgeSide'] = 'right:88'; // 看板娘贴边方向,例如 'left:0'(靠左 0px), 'right:30'(靠右 30px)
live2d_settings['waifuDraggable'] = 'unlimited'; // 拖拽样式,例如 'disable'(禁用), 'axis-x'(只能水平拖拽), 'unlimited'(自由拖拽)
live2d_settings['waifuDraggableRevert'] = true; // 松开鼠标还原拖拽位置,可选 true(真), false(假)
live2d_settings['waifuDraggableRevert'] = false; // 松开鼠标还原拖拽位置,可选 true(真), false(假)
initModel(modelJson);
}
});

View File

@@ -0,0 +1,85 @@
/* 如果使用该初始化方法请一定要在html放三个标签或者直接看代码修改内容
* <div id="editor-toolbar"></div>
* <div id="editor-text-area" style="height: 400px;border: 1px solid lightgrey"></div>
* <textarea id="content-textarea" name="content" style="display: none;"></textarea>
* 另外此方法依赖layer.js & axios.js 做遮罩弹框,
* 也可以重写 uploadImage:onFailed | onError 自定义提示
* */
const E = window.wangEditor
// 切换语言
const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
E.i18nChangeLanguage(LANG)
const editorConfig = {
placeholder: '请输入...',
scroll: true, // 禁止编辑器滚动
MENU_CONF: {
uploadImage: {
fieldName: 'your-fileName',
server: '#', // 可以配置上传应用的地址
base64LimitSize: 2 * 1024 * 1024, // 5M 以下插入 base64
// 单个文件的最大体积限制,默认为 2M
maxFileSize: 2 * 1024 * 1024,
// 单个文件上传失败
onFailed(file, res) {
console.log("文件过大")
$('#warn-text').html(res);
$('.toast').toast();
},
// 上传错误,或者触发 timeout 超时
onError(file, err, res) {
console.log("文件过大")
layer.open({
type: 1, //1:自定义内容 2:iframe
title: '图片大于2M',
// area: ['500px', '170px'],
content: '资源有限,大佬请使用网络图片╮(╯▽╰)╭',
btn: ['好吧穷鬼'],
skin: 'layui-layer-hui',
yes: function(){
layer.closeAll(); //关闭所有弹出框
},
cancel: function(){
//右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭
}
});
}
}
},
onChange(editor) {
// console.log(editor.getHtml())
// $('#content-textarea').value = editor.getHtml()
const content = editor.children
// const contentStr = JSON.stringify(content)
// document.getElementById('content-textarea').value = contentStr
const html = editor.getHtml()
$('#content-textarea').val(html)
}
}
// 先创建 editor
const editor = E.createEditor({
selector: '#editor-text-area',
// content: [],
html: $('#content-textarea').val(),
config: editorConfig
})
// 创建 toolbar
const toolbar = E.createToolbar({
editor,
selector: '#editor-toolbar',
config: {
excludeKeys: 'fullScreen,uploadVideo',
}
})
// 点击空白处 focus 编辑器
$('#editor-text-area')[0].addEventListener('click', e => {
if (e.target.id === 'editor-text-area') {
editor.blur()
editor.focus(true) // focus 到末尾
}
})