Skip to content

Commit

Permalink
Merge pull request #216 from lkw199711/version/3.7.3
Browse files Browse the repository at this point in the history
feat: 3.7.3 媒体封面生成.
  • Loading branch information
lkw199711 authored Feb 14, 2025
2 parents 8fbd51d + 436464c commit 81d820c
Show file tree
Hide file tree
Showing 18 changed files with 264 additions and 86 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NODE_ENV=development
VUE_APP_WS_URL=ws://smanga-php.cc/websocketVUE_APP_PATH=/api
VUE_APP_PROXY_HTTP_URL=http://192.168.2.43:9798
# VUE_APP_PROXY_HTTP_URL=http://192.168.2.43:9798
VUE_APP_PROXY_HTTP_URL=http://127.0.0.1:9798
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smanga",
"version": "3.7.2",
"version": "3.7.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --no-eslint",
Expand Down
11 changes: 9 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,15 @@ async function set_bookmark() {
async function get_setting() {
const res = await userApi.get_user_config();
const configValue = JSON.parse(res);
let configValue = {};
if (typeof res === 'string') {
configValue = JSON.parse(res);
} else if (typeof res === 'object') {
configValue = res;
} else {
return false;
}
// 使用数据库用户设置,覆盖当前设置
Object.assign(userConfig, configValue.userConfig);
Expand Down
8 changes: 7 additions & 1 deletion src/api/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: lkw199711 lkw199711@163.com
* @Date: 2023-03-17 20:18:30
* @LastEditors: lkw199711 lkw199711@163.com
* @LastEditTime: 2024-08-05 23:44:33
* @LastEditTime: 2025-02-14 21:06:08
* @FilePath: \smanga\src\api\media.ts
*/
import {ajax} from './index';
Expand Down Expand Up @@ -56,6 +56,12 @@ const mediaApi = {
const resData = (await res).data;
return resData;
},

async create_cover(mediaId: number) {
const res = ajax.put(`media-cover/${mediaId}`);
const resData = (await res).data;
return resData.data;
},
};

export default mediaApi;
14 changes: 9 additions & 5 deletions src/language/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"directory": "directoryType:",
"removeFirst": "removeFirst:",
"direction": "direction:",
"autoScan": "auto scan"
"autoScan": "auto scan",
"cover": "meida cover"
},
"note": {
"name": "\"mediaName\": Required, cannot be blank",
Expand All @@ -105,7 +106,8 @@
"directory": "\"directoryType\": This option supports adding one more level of directory to the path. For example, you want to manage comics by year \"example/2022/manga/chapter/...\"",
"removeFirst": "\"removeFirst\": In the \"double page mode\", by temporarily removing the first page in reading, you can combine the left and right pages of the cartoon into a whole picture by removing the even number of page numbers. Please change this item after getting familiar with the page numbers of the cartoon. You can also change this item temporarily through the function menu in the browsing interface.",
"direction": "\"direction\": In the \"double page mode\", change the display order of the first and second pictures so that the left and right pages of the cartoon can be combined into a whole picture. You can also change this item temporarily through the function menu in the browsing interface.",
"autoScan": "When the folder sending changes, comics and chapters will be automatically added or deleted. Enabling this option will greatly increase the pressure on the server. Please be careful when opening multi-path media libraries"
"autoScan": "When the folder sending changes, comics and chapters will be automatically added or deleted. Enabling this option will greatly increase the pressure on the server. Please be careful when opening multi-path media libraries",
"cover": "The media library cover will be automatically generated after each scan. You can also upload it manually to manage the cover"
},
"place": {
"name": "please enter mediaName",
Expand Down Expand Up @@ -274,7 +276,8 @@
"double": "double",
"half": "falf-cut",
"model": "readModel",
"imgLoadError": "Image loading failed, click to reload"
"imgLoadError": "Image loading failed, click to reload",
"jumpPageTitle": "Please enter target page number"
},
"page": {
"before": "beforeChapter",
Expand Down Expand Up @@ -343,8 +346,9 @@
"rightSidebar": {
"editTags": "editTags",
"baseTagTitle": "Alternative tags",
"ckeckedTagTitle": "Current tag"
"ckeckedTagTitle": "Current tag",
"jumpPageText": "Jump page number"
},
"createTime": "createTime",
"updateTime": "updateTime"
}
}
12 changes: 8 additions & 4 deletions src/language/zh-Cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"directory": "文件夹结构:",
"removeFirst": "剔除首页:",
"direction": "翻页方向:",
"autoScan": "自动扫描"
"autoScan": "自动扫描",
"cover": "媒体库封面"
},
"note": {
"name": "\"媒体库名称\": 必填,不能为空",
Expand All @@ -105,7 +106,8 @@
"directory": "\"文件夹结构\": 此选项支持为路径多加一层目录,例如您希望通过年份来管理漫画 \"example/2022/manga/chapter/...\"",
"removeFirst": "\"剔除首页\": 在\"双页模式\"下,通过在阅读中暂时剔除首页,可对其偶数页码,使漫画左右两页合成一张整图,请熟悉漫画页码后更改此项.您也可以在浏览界面通过功能菜单来临时更改此项.",
"direction": "\"翻页方向\": 在\"双页模式\"下,更改第一与第二张图的展示顺序,使得漫画左右两页合成一张整图.您也可以在浏览界面通过功能菜单来临时更改此项.",
"autoScan": "当文件夹发送变化时,自动新增或删除漫画与章节.开启此选项会极大程度增加服务器压力,在多路径媒体库请谨慎开启."
"autoScan": "当文件夹发送变化时,自动新增或删除漫画与章节.开启此选项会极大程度增加服务器压力,在多路径媒体库请谨慎开启.",
"cover": "媒体库封面将会在每次扫描后自动生成,您也可以手动上传,管理封面."
},
"place": {
"name": "请输入媒体库名称",
Expand Down Expand Up @@ -274,7 +276,8 @@
"double": "双页模式",
"half": "对半裁剪",
"model": "阅读模式",
"imgLoadError": "图片加载失败,点击重新加载"
"imgLoadError": "图片加载失败,点击重新加载",
"jumpPageTitle": "请输入目标页码"
},
"page": {
"before": "上一章",
Expand Down Expand Up @@ -342,7 +345,8 @@
"rightSidebar": {
"editTags": "编辑标签",
"baseTagTitle": "备选标签",
"ckeckedTagTitle": "当前标签"
"ckeckedTagTitle": "当前标签",
"jumpPageText": "跳转页码"
},
"createTime": "创建时间",
"updateTime": "更新时间"
Expand Down
12 changes: 8 additions & 4 deletions src/language/zh-Tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@
"directory": "文件夾結構:",
"removeFirst": "剔除首頁:",
"direction": "翻頁方向:",
"autoScan": "自動掃描"
"autoScan": "自動掃描",
"cover": "媒體庫封面"
},
"note": {
"name": "\"媒體庫名稱\": 必填,不能為空",
Expand All @@ -105,7 +106,8 @@
"directory": "\"文件夾結構\": 此選項支持為路徑多加一層目錄,例如您希望通過年份來管理漫畫 \"example/2022/manga/chapter/...\"",
"removeFirst": "\"剔除首頁\": 在\"雙頁模式\"下,通過在閱讀中暫時剔除首頁,可對其偶數頁碼,使漫畫左右兩頁合成一張整圖,請熟悉漫畫頁碼後更改此項.您也可以在瀏覽界面通過功能菜單來臨時更改此項.",
"direction": "\"翻頁方向\": 在\"雙頁模式\"下,更改第一與第二張圖的展示順序,使得漫畫左右兩頁合成一張整圖.您也可以在瀏覽界面通過功能菜單來臨時更改此項.",
"autoScan": "當文件夾發送變化時,自動新增或刪除漫畫與章節.開啟此選項會極大程度增加服務器壓力,在多路徑媒體庫請謹慎開啟."
"autoScan": "當文件夾發送變化時,自動新增或刪除漫畫與章節.開啟此選項會極大程度增加服務器壓力,在多路徑媒體庫請謹慎開啟.",
"cover": "媒體庫封面將會在每次掃描後自動生成,您也可以手動上傳,管理封面."
},
"place": {
"name": "請輸入媒體庫名稱",
Expand Down Expand Up @@ -274,7 +276,8 @@
"double": "雙頁模式",
"half": "對半裁剪",
"model": "閱讀模式",
"imgLoadError": "圖片加載失敗,點擊重新加載"
"imgLoadError": "圖片加載失敗,點擊重新加載",
"jumpPageTitle": "請輸入目標頁碼"
},
"page": {
"before": "上一章",
Expand Down Expand Up @@ -342,7 +345,8 @@
"rightSidebar": {
"editTags": "編輯標簽",
"baseTagTitle": "備選標簽",
"ckeckedTagTitle": "當前標簽"
"ckeckedTagTitle": "當前標簽",
"jumpPageText": "頁碼跳轉"
},
"createTime": "創建時間",
"updateTime": "更新時間"
Expand Down
13 changes: 13 additions & 0 deletions src/style/public.less
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,16 @@ body {
// #nprogress .bar{
// background-color: @s-background;
// }

// 跳页的弹框在不同尺寸 展示不通的ui排列
@media only screen and (min-width: 1200px) {
.dialog-jump-page {
max-width: 120rem;
min-width: 80rem;
}
}
@media only screen and (max-width: 1199px) {
.dialog-jump-page {
width: 80%;
}
}
2 changes: 1 addition & 1 deletion src/style/table.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
width: 60rem;
margin: 10rem auto;
}
}
}
4 changes: 3 additions & 1 deletion src/type/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
* @Author: lkw199711 lkw199711@163.com
* @Date: 2023-10-08 15:38:53
* @LastEditors: lkw199711 lkw199711@163.com
* @LastEditTime: 2024-03-04 03:31:34
* @LastEditTime: 2025-02-15 01:21:19
* @FilePath: /smanga/src/type/media.ts
*/
type mediaType = {
mediaId: number;
mediaName: string;
author: string;
mediaType: number;
mediaCover: string;
mediaCoverLink: string;
createTime: string;
updateTime: string;
describe: string;
Expand Down
17 changes: 11 additions & 6 deletions src/views/browse-view/components/right-sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
<div class="right-sidebar">
<el-drawer v-model="drawer" size="auto" :with-header="false" :before-close="close_sidebar">
<!-- 安卓端顶部占位 -->
<div class="android-seat-top" v-if="config.android"/>
<div class="android-seat-top" v-if="config.android" />
<el-menu class="right-sidebar-menu" active-text-color="#ffd04b" background-color="#545c64" text-color="#fff"
@select="menu_select">
<el-menu-item v-if="idDouble" index="remove-first">{{
removeFirstTitle
}}</el-menu-item>
}}</el-menu-item>
<el-menu-item index="bookmark">{{ bookmarkTitle }}</el-menu-item>
<el-menu-item v-if="idDouble" index="direction">{{ $t('option.direction') }} ({{ directionTitle
}})</el-menu-item>
}})</el-menu-item>
<el-menu-item index="dwonload">{{
$t('option.dwonload')
}}</el-menu-item>
}}</el-menu-item>
<el-menu-item index="operation">{{ operationText }}</el-menu-item>
<el-menu-item index="jump">{{ $t('rightSidebar.jumpPageText') }}</el-menu-item>
</el-menu>
</el-drawer>
</div>
Expand All @@ -40,9 +41,10 @@ const emit = defineEmits([
'direction',
'removeFirst',
'dwonload',
'jumpPageNumber',
]);
const removeFirstTitle = computed(() => {
const removeFirstTitle = computed(() => {
return props.removeFirst
? t('option.recoveryFirst')
: t('option.removeFirst');
Expand Down Expand Up @@ -94,6 +96,9 @@ function menu_select(key: string) {
case 'operation':
config.enableOperation = !config.enableOperation;
break;
case 'jump':
emit('jumpPageNumber');
break;
}
close_sidebar();
}
Expand All @@ -104,7 +109,7 @@ async function bookmark() {
} else {
// 区分单双页
let page = Number(global_get('page'));
if (route.name === 'double') {
page = page * 2 - 1;
}
Expand Down
71 changes: 66 additions & 5 deletions src/views/browse-view/flow.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--
* @Author: lkw199711 lkw199711@163.com
* @Date: 2023-08-25 10:45:47
* @LastEditors: 梁楷文 lkw199711@163.com
* @LastEditTime: 2024-08-07 16:27:20
* @LastEditors: lkw199711 lkw199711@163.com
* @LastEditTime: 2025-02-13 23:51:47
* @FilePath: /smanga/src/views/browse-view/flow.vue
-->
<template>
Expand Down Expand Up @@ -31,14 +31,35 @@
</div>

<!-- 页码 -->
<page-number :page="currentPage" :count="imgPathList.length" />
<page-number :page="currentPage" :count="countPage" />

<!-- 功能菜单 -->
<right-sidebar @dwonload="dwonload_image" />
<right-sidebar @dwonload="dwonload_image" @jumpPageNumber="open_jump_dialog" />

<!-- 安卓端占位符 -->
<div class="bottom-seat" v-if="config.android"></div>
</div>

<el-dialog v-model="dialogJumpPage" :title="t('browse.jumpPageTitle')" class="dialog-jump-page">
<template v-if="!showSmallJumpPage">
<el-slider v-model="targetPage" show-input :min="1" :max="countPage" />
</template>
<template v-else>
<el-slider v-model="targetPage" :min="1" :max="countPage" />

<el-input-number v-model="targetPage" :min="1" :max="countPage" />
</template>
<div class="jump-page-tips">{{ targetPage }} / {{ countPage }}</div>

<template #footer>
<div class="dialog-footer">
<el-button @click="dialogJumpPage = false">{{ t('option.cancel') }}</el-button>
<el-button type="primary" @click="jump_page">
{{ t('option.confirm') }}
</el-button>
</div>
</template>
</el-dialog>
</template>

<script lang="ts">
Expand All @@ -54,7 +75,7 @@ import {
global_set_json,
window_go_top,
} from '@/utils';
import { ElMessage as msg } from 'element-plus';
import { ElMessage as msg, ElMessageBox } from 'element-plus';
import { config } from '@/store';
import historyApi from '@/api/history';
import i18n from '@/i18n';
Expand All @@ -72,6 +93,25 @@ const route = useRoute();
const router = useRouter();
const browseStore: any = useBrowseStore();

// 跳页弹框
let dialogJumpPage = ref(false)
// 跳页目标页码
let targetPage = ref(1)

const handleClose = (done: () => void) => {
ElMessageBox.confirm('Are you sure to close this dialog?')
.then(() => {
done()
})
.catch(() => {
// catch error
})
}

const showSmallJumpPage = computed(() => {
return ['mini', 'small'].includes(config.screenType)
})

// 图片文件列表
let imgFileList = ref<string[]>([]);
// 图片路径列表
Expand Down Expand Up @@ -123,6 +163,16 @@ let chapterInfo = reactive<chapterInfoType>({
// 正在浏览的页码
let currentPage = ref(1);

let countPage = ref(0);

watch(
() => imgPathList.value.length,
() => {
if (imgPathList.value.length === 0) return;
countPage.value = imgPathList.value.length;
}
)

// 在中途加载 前置没有加载的页面数量
let beforeBookMark = 0;

Expand Down Expand Up @@ -403,6 +453,17 @@ function dwonload_image() {
a.click();
}

function open_jump_dialog() {
// 初始化目标页码为当前页码
targetPage.value = currentPage.value;
// 打开跳转对话框
dialogJumpPage.value = true;
}
function jump_page() {
// return
reload_page(true, true, targetPage.value);
}

// 生命周期
onMounted(() => {
// 设置浏览模式
Expand Down
Loading

0 comments on commit 81d820c

Please sign in to comment.