章节管理新增语言切换和上传并拆分文章附件的功能

This commit is contained in:
liuyuan
2025-01-26 09:38:37 +08:00
parent e50b0ef678
commit ccffb7be6b
12 changed files with 205 additions and 31 deletions

19
.babelrc Normal file
View File

@@ -0,0 +1,19 @@
{
"presets": [
["env", {
"modules": false
}],
"stage-2"
],
"plugins": ["transform-runtime", ["component", [
{
"libraryName": "element-ui"
}
]]],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}

9
.editorconfig Normal file
View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

6
.eslintignore Normal file
View File

@@ -0,0 +1,6 @@
/build/
/config/
/dist/
/*.js
/test/unit/coverage/
/src/icons/iconfont.js

25
.eslintrc.js Normal file
View File

@@ -0,0 +1,25 @@
// https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}

22
.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
.DS_Store
node_modules/
dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/coverage/
/test/e2e/reports/
selenium-debug.log
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
# common
common/common.vue
/src/views/common/common.vue

9
.postcssrc.js Normal file
View File

@@ -0,0 +1,9 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
// to edit target browsers: use "browserslist" field in package.json
"postcss-import": {},
"autoprefixer": {}
}
}

BIN
dist.zip

Binary file not shown.

View File

@@ -158,13 +158,13 @@
<!-- <el-form-item label="出版商名称" prop="publisherId"> <!-- <el-form-item label="出版商名称" prop="publisherId">
<el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input> <el-input v-model="dataForm.publisherId" placeholder="出版商名称"></el-input>
</el-form-item> --> </el-form-item> -->
<el-form-item label="文件上传" prop="novel"> <!-- <el-form-item label="文件上传" prop="novel">
<el-upload class="upload-demo" :action="baseUrl + '/oss/fileoss'" :on-preview="handlePreview" <el-upload class="upload-demo" :action="baseUrl + '/oss/fileoss'" :on-preview="handlePreview"
:on-remove="handleRemoveNovel" :before-remove="beforeRemove" :on-success="handleNovelSuccess" multiple :on-remove="handleRemoveNovel" :before-remove="beforeRemove" :on-success="handleNovelSuccess" multiple
:limit="3" :on-exceed="handleExceed" :file-list="fileListNovel"> :limit="3" :on-exceed="handleExceed" :file-list="fileListNovel">
<el-button size="small" type="primary">点击上传</el-button> <el-button size="small" type="primary">点击上传</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item> -->
<el-form-item label="插图" prop="images"> <el-form-item label="插图" prop="images">
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview" <el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
:file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove"> :file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">

View File

@@ -67,7 +67,7 @@
</el-table-column> --> </el-table-column> -->
<!-- <el-table-column prop="publisherName" header-align="center" align="center" label="出版商名称"> <!-- <el-table-column prop="publisherName" header-align="center" align="center" label="出版商名称">
</el-table-column> --> </el-table-column> -->
<el-table-column prop="chapterStatus" header-align="center" align="center" label="章节拆分" width="160"> <!-- <el-table-column prop="chapterStatus" header-align="center" align="center" label="章节拆分" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<p style="margin: 0;"> <span v-if="scope.row.chapterStatus == '成功'" style="color:blue">{{scope.row.chapterStatus}}</span> <p style="margin: 0;"> <span v-if="scope.row.chapterStatus == '成功'" style="color:blue">{{scope.row.chapterStatus}}</span>
<span v-if="scope.row.chapterStatus == '失败'" style="color: red">{{scope.row.chapterStatus}}</span> <span v-if="scope.row.chapterStatus == '失败'" style="color: red">{{scope.row.chapterStatus}}</span>
@@ -79,7 +79,7 @@
</template> </template>
</el-table-column> </el-table-column> -->
<!-- <el-table-column prop="contentStatus" header-align="center" align="center" label="单句拆分"> <!-- <el-table-column prop="contentStatus" header-align="center" align="center" label="单句拆分">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.contentStatus == '成功'" style="color:blue">{{scope.row.contentStatus}}</span> <span v-if="scope.row.contentStatus == '成功'" style="color:blue">{{scope.row.contentStatus}}</span>

View File

@@ -1,12 +1,26 @@
<template> <template>
<div class="mod-config"> <div class="mod-config" v-loading="fileLoading">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm">
<el-form-item v-if="languageList.length>0">
<el-select v-model="language" placeholder="选择语言" @change="changeLanguage">
<el-option :label="item" :value="item" v-for="(item,index) in languageList" :key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-upload :limit="1" class="el-uploadvideo"
:action= "baseUrl + '/oss/fileoss'"
:file-list="fileList" accept=".docx" :on-remove="handleRemove" :http-request="handleRequest"
:show-file-list="true">
<el-button slot="trigger" size="small" type="primary">上传并拆分</el-button>
</el-upload>
</el-form-item>
<br>
<el-form-item> <el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input> <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList(language)">查询</el-button>
<el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">新增章节</el-button> <el-button v-if="isAuth('book:bookchapter:save')" type="primary" @click="addOrUpdateHandle()">新增章节</el-button>
<!-- <el-button v-if="isAuth('book:bookchapter:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> --> <!-- <el-button v-if="isAuth('book:bookchapter:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
<!-- <router-link :to="{path: 'book-book' , query:{ upPageIndex } }"> <!-- <router-link :to="{path: 'book-book' , query:{ upPageIndex } }">
@@ -115,15 +129,19 @@
layout="total, sizes, prev, pager, next, jumper"> layout="total, sizes, prev, pager, next, jumper">
</el-pagination> </el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList(language)"></add-or-update>
</div> </div>
</template> </template>
<script> <script>
import AddOrUpdate from './bookchapter-add-or-update' import AddOrUpdate from './bookchapter-add-or-update'
import global from '../../common/common.vue' //引入共用组间
import axios from "axios";
import { Loading } from 'element-ui';
export default { export default {
data () { data () {
return { return {
baseUrl: global.baseUrl,
dataForm: { dataForm: {
key: '' key: ''
}, },
@@ -137,6 +155,11 @@
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
bookInfo:{}, bookInfo:{},
//显示多语言下拉
languageList: [],
language: '',
fileList: [],
fileLoading: false
} }
}, },
components: { components: {
@@ -149,13 +172,13 @@
console.log(this.pageIndex) console.log(this.pageIndex)
} }
this.upPageIndex = this.$route.query.pageIndex; this.upPageIndex = this.$route.query.pageIndex;
console.log(this.bookid) this.getInfo();
this.getDataList() this.fileList = [];
this.getInfo() this.getEbookLanguageList();
}, },
methods: { methods: {
// 获取数据列表 // 获取数据列表
getDataList () { getDataList (language) {
this.dataListLoading = true this.dataListLoading = true
this.$http({ this.$http({
url: this.$http.adornUrl('/book/bookchapter/list'), url: this.$http.adornUrl('/book/bookchapter/list'),
@@ -164,7 +187,8 @@
'page': this.pageIndex, 'page': this.pageIndex,
'limit': this.pageSize, 'limit': this.pageSize,
'key': this.dataForm.key, 'key': this.dataForm.key,
'bookid' : this.bookid 'bookid' : this.bookid,
'language': language
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@@ -179,27 +203,23 @@
}, },
// 获取数据列表 // 获取数据列表
getInfo () { getInfo () {
this.$http({ this.$http({
url: this.$http.adornUrl(`/book/book/info/${this.$route.query.id}`), url: this.$http.adornUrl(`/book/book/info/${this.$route.query.id}`),
method: 'post', method: 'post'
}).then(({data}) => { }).then(({data}) => {
console.log('data at line 182:', data)
this.bookInfo=data.book this.bookInfo=data.book
}) })
}, },
// 每页数 // 每页数
sizeChangeHandle (val) { sizeChangeHandle (val) {
this.pageSize = val this.pageSize = val
this.pageIndex = 1 this.pageIndex = 1
this.getDataList() this.getDataList(this.language)
}, },
// 当前页 // 当前页
currentChangeHandle (val) { currentChangeHandle (val) {
this.pageIndex = val this.pageIndex = val
this.getDataList() this.getDataList(this.language)
}, },
// 多选 // 多选
selectionChangeHandle (val) { selectionChangeHandle (val) {
@@ -235,7 +255,7 @@
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.getDataList() this.getDataList(this.language)
} }
}) })
} else { } else {
@@ -243,7 +263,74 @@
} }
}) })
}) })
},
// 获取数据列表
getEbookLanguageList () {
var parms = {bookId: this.bookid}
this.$http({
url: this.$http.adornUrl('/book/book/getEbookLanguageList'),
method: 'post',
data: parms
}).then(({data}) => {
if (data && data.code === 0) {
this.languageList = data.list;
//默认请求数据
this.language = this.languageList[0];
this.getDataList(this.language);
} }
})
},
//下拉筛选数据
changeLanguage(e){
this.language = e;
this.getDataList(e);
},
//上传文件
handleRequest(option) {
let formdata = new FormData();
formdata.append("file", option.file);
formdata.append("bookId", this.bookid);
let name = option.file.name; //文件名称判断显示下拉的值
this.fileLoading = true;
this.$http({
url: this.$http.adornUrl('/book/book/uploadEbookAndSplit'),
method: 'post',
data: formdata
}).then(({data}) => {
this.fileLoading = false;
if (data && data.code == 0) {
this.$message({
message: '上传成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList(this.language)
}
})
//根据文件名称判断显示
if(name.includes('English')||name.includes('english')){
this.language = 'English';
}else if(name.includes('Spanish')||name.includes('spanish')){
this.language = 'Spanish';
}
this.getDataList(this.language);
} else {
this.$message.error("上传失败");
}
})
},
handleRemove(file) {
this.fileList = []
},
} }
} }
</script> </script>
<style lang="less" scoped>
/deep/ .el-uploadvideo{
display: flex;
}
/deep/ .el-uploadvideo .el-upload-list--text{
margin-left: 20px;
}
</style>

View File

@@ -5,8 +5,8 @@
window.SITE_CONFIG = {}; window.SITE_CONFIG = {};
// api接口请求地址 // api接口请求地址
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9100/pb'; //window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9300/pb'; //zcc
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; window.SITE_CONFIG['baseUrl'] = 'https://global.nuttyreading.com';
// cdn地址 = 域名 + 版本号 // cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './'; // 域名 window.SITE_CONFIG['domain'] = './'; // 域名

View File

@@ -5,13 +5,10 @@
window.SITE_CONFIG = {}; window.SITE_CONFIG = {};
// api接口请求地址 // api接口请求地址
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';//张川川 //window.SITE_CONFIG['baseUrl'] = 'https://testapi.nuttyreading.com'; // 线上测试环境11
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb'; window.SITE_CONFIG['baseUrl'] = 'https://global.nuttyreading.com'; //线上
// window.SITE_CONFIG['baseUrl'] = 'https://testapi.nuttyreading.com'; // 线上测试环境11 //window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; //线上正式环境
window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境 //window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9300/pb'; //zcc
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.110:9200/pb';//磊哥
// window.SITE_CONFIG['baseUrl'] = 'http://59.110.212.44:9200/pb';
// window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb';
// cdn地址 = 域名 + 版本号 // cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './'; // 域名 window.SITE_CONFIG['domain'] = './'; // 域名