图书 文物

master
lion 1 year ago
parent 82a37e0d12
commit f6ae181668

@ -2,7 +2,7 @@
ENV = 'development'
# base api
VUE_APP_BASE_API = 'https://gb-test.ali251.langye.net'
#VUE_APP_BASE_API = 'https://gb-test.ali251.langye.net'
#VUE_APP_BASE_API = 'https://gbyuyue.szgmbwg.org.cn'
VUE_APP_BASE_API = 'https://gbyuyue.szgmbwg.org.cn'

@ -3,5 +3,5 @@ ENV = 'production'
# base api
VUE_APP_BASE_API = 'https://gb-test.ali251.langye.net'
#VUE_APP_BASE_API = 'https://gbyuyue.szgmbwg.org.cn'
#VUE_APP_BASE_API = 'https://gb-test.ali251.langye.net'
VUE_APP_BASE_API = 'https://gbyuyue.szgmbwg.org.cn'

@ -0,0 +1,42 @@
import request from '@/utils/request'
export function index(params) {
return request({
url: '/api/admin/cultural-relic2/index',
method: 'get',
params: params
})
}
export function store(data) {
return request({
url: '/api/admin/cultural-relic2/store',
method: 'post',
data
})
}
export function save(data) {
return request({
url: '/api/admin/cultural-relic2/save',
method: 'post',
data
})
}
export function show(params) {
return request({
url: '/api/admin/cultural-relic2/show',
method: 'get',
params
})
}
export function destroy(params) {
return request({
url: '/api/admin/cultural-relic2/destroy',
method: 'get',
params
})
}

@ -121,7 +121,7 @@
<template v-slot:fbx_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>obj文件
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>fbx文件
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="fbxList" style="width:600px" :limit="1"

@ -0,0 +1,608 @@
<template>
<div>
<xy-dialog ref="dialog" :is-show.sync="isShow" type="form" :title="type === 'add' ? '新增文物' : '编辑文物'" :form="form"
:rules="rules" @submit="submit">
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>名称
</div>
<div class="xy-table-item-content">
<el-input v-model="form.name" placeholder="请输入文物名称" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:release_time>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>发布时间
</div>
<div class="xy-table-item-content">
<el-date-picker style="width: 300px;" v-model="form.release_time" value-format="yyyy-MM-dd HH:mm:ss"
type="datetime" placeholder="选择发布时间">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:source>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>来源
</div>
<div class="xy-table-item-content">
<el-input v-model="form.source" placeholder="请输入来源" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:link_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>关联文物
</div>
<div class="xy-table-item-content">
<el-select v-model="form.link_id" placeholder="请选择">
<el-option v-for="item in relicList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-date-picker>
</div>
</div>
</template>
<template v-slot:show_list>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>列表显示
</div>
<div class="xy-table-item-content">
<el-radio-group v-model="form.show_list">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">不显示</el-radio>
</el-radio-group>
</div>
</div>
</template>
<!-- <template v-slot:history_time>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>文物年限
</div>
<div class="xy-table-item-content">
<el-date-picker style="width: 300px;" v-model="form.history_time" value-format="yyyy" type="year"
placeholder="选择文物年限">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:contain>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>文物组成
</div>
<div class="xy-table-item-content">
<el-input v-model="form.contain" placeholder="请输入文物组成" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:grade>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>文物等级
</div>
<div class="xy-table-item-content">
<el-input v-model="form.grade" placeholder="请输入文物等级" clearable style="width: 300px;"></el-input>
</div>
</div>
</template> -->
<template v-slot:url_3d>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>fbx别名
</div>
<div class="xy-table-item-content">
<el-input v-model="form.url_3d" placeholder="请输入fbx别名" clearable style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:threed_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>3D图
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="threedList" style="width:600px" :limit="1"
:auto-upload="true" :data="uploadOther"
:on-success="(response, file, fileList)=>{handlesuccessVoice(response, file, fileList,'threed')}"
:on-remove="(file,fileList,type)=>{handleRemoveVoice(file,fileList,'threed')}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:fbx_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>fbx文件
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="fbxList" style="width:600px" :limit="1"
:auto-upload="true" :data="uploadOther"
:on-success="(response, file, fileList)=>{handlesuccessVoice(response, file, fileList,'fbx')}"
:on-remove="(file,fileList,type)=>{handleRemoveVoice(file,fileList,'fbx')}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:jpg_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>jpg文件
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="jpgList" style="width:600px" :limit="1"
:auto-upload="true" :data="uploadOther"
:on-success="(response, file, fileList)=>{handlesuccessVoice(response, file, fileList,'jpg')}"
:on-remove="(file,fileList,type)=>{handleRemoveVoice(file,fileList,'jpg')}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:jpg2_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>jpg文件2
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="jpg2List" style="width:600px" :limit="1"
:auto-upload="true" :data="uploadOther"
:on-success="(response, file, fileList)=>{handlesuccessVoice(response, file, fileList,'jpg2')}"
:on-remove="(file,fileList,type)=>{handleRemoveVoice(file,fileList,'jpg2')}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:voice>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>语音文件
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class="upload-demo" :file-list="voiceList" style="width:600px" :limit="1"
:auto-upload="true" :data="uploadOther"
:on-success="(response, file, fileList)=>{handlesuccessVoice(response, file, fileList,'voice')}"
:on-remove="(file,fileList,type)=>{handleRemoveVoice(file,fileList,'voice')}">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:head_picture>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>关联头图
</div>
<div class="xy-table-item-content">
<el-upload :action="action" :file-list="headPictureList" list-type="picture-card" style="width:600px"
:limit="1" :auto-upload="true" :data="uploadOther" :on-success="handlesuccess"
:on-preview="handlePictureCardPreview" :on-remove="handleRemove">
<i slot="default" class="el-icon-plus"></i>
</el-upload>
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label">
内容:
</div>
<div class="xy-table-item-content" style="width:680px">
<xyTinymce v-if="isShow" v-model="form.content"></xyTinymce>
</div>
</div>
</template>
</xy-dialog>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script>
import xyTinymce from "@/components/XyTinymce/index.vue";
import {
store,
show,
save,
index
} from "@/api/relic2"
import {
Message
} from 'element-ui'
import {
getToken
} from '@/utils/auth'
export default {
components: {
xyTinymce
},
data() {
return {
isShow: false,
type: 'add',
id: '',
dialogVisible: false,
dialogImageUrl: '',
relicList: [],
form: {
name: '',
release_time: '',
source: '',
link_id: '',
show_list: 1,
url_3d: '',
threed_id: '',
fbx_id: '',
jpg_id: '',
voice: '',
head_picture: '',
content: '',
history_time: '',
contain: '',
grade: '',
},
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_BASE_API}/api/admin/upload-file`,
headPictureList: [],
threedList: [],
fbxList: [],
jpgList: [],
jpg2List: [],
voiceList: [],
rules: {
name: [{
required: true,
message: '请输入文物名称'
}],
release_time: [{
required: true,
message: '请选择发布时间'
}],
source: [{
required: true,
message: '请输入来源'
}]
}
}
},
created() {
this.uploadOther.token = getToken();
this.getRelic()
},
methods: {
async getRelic() {
const res = await index({
page_size: 999,
page: 1,
name: '',
sort_name: 'release_time',
sort_type: "DESC",
})
this.relicList = res.data
},
getDatetimeValue() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
const hour = now.getHours();
const minute = now.getMinutes();
const second = now.getSeconds();
const currentTime =
`${year}-${month >= 10 ? month : '0' + month}-${day >= 10 ? day : '0' + day} ${hour >= 10 ? hour : '0' + hour}:${minute >= 10 ? minute : '0' + minute}:${second >= 10 ? second : '0' + second}`;
return currentTime;
},
async getDetail() {
const res = await show({
id: this.id
})
this.form = {
name: res?.name,
release_time: res.release_time ? res.release_time : this.getDatetimeValue(),
source: res.source ? res.source : '苏州革命博物馆',
link_id: res?.link_id,
show_list: res.show_list===0 ? 0 : 1,
url_3d: res?.url_3d,
threed_id: res?.threed_id,
fbx_id: res?.fbx_id,
jpg_id: res?.jpg_id,
jpg2_id: res?.jpg_id,
voice: res?.voice,
head_picture: res?.head_picture,
content: res?.content,
history_time: res?.history_time,
contain: res?.contain,
grade: res?.grade,
}
res.head_upload ? this.headPictureList.push(res.head_upload) : ''
res.voice_upload ? this.voiceList.push({
id: res.voice_upload.id,
name: res.voice_upload.original_name,
url: res.voice_upload.url
}) : ''
res.threed ? this.threedList.push({
id: res.threed.id,
name: res.threed.original_name,
url: res.threed.url
}) : ''
res.fbx ? this.fbxList.push({
id: res.fbx.id,
name: res.fbx.original_name,
url: res.fbx.url
}) : ''
res.jpg ? this.jpgList.push({
id: res.jpg.id,
name: res.jpg.original_name,
url: res.jpg.url
}) : ''
res.jpg2 ? this.jpg2List.push({
id: res.jpg2.id,
name: res.jpg2.original_name,
url: res.jpg2.url
}) : ''
},
submit() {
if (this.headPictureList.length > 0) {
for (var h of this.headPictureList) {
if (h.response) {
this.form.head_picture = h.response.id
} else {
this.form.head_picture = h.id
}
}
} else {
this.form.head_picture = ''
}
if (this.voiceList.length > 0) {
for (var h of this.voiceList) {
if (h.response) {
this.form.voice = h.response.id
} else {
this.form.voice = h.id
}
}
} else {
this.form.voice = ''
}
if (this.threedList.length > 0) {
for (var h of this.threedList) {
if (h.response) {
this.form.threed_id = h.response.id
} else {
this.form.threed_id = h.id
}
}
} else {
this.form.threed_id = ''
}
if (this.fbxList.length > 0) {
for (var h of this.fbxList) {
if (h.response) {
this.form.fbx_id = h.response.id
} else {
this.form.fbx_id = h.id
}
}
} else {
this.form.fbx_id = ''
}
if (this.jpgList.length > 0) {
for (var h of this.jpgList) {
if (h.response) {
this.form.jpg_id = h.response.id
} else {
this.form.jpg_id = h.id
}
}
} else {
this.form.jpg_id = ''
}
if (this.jpg2List.length > 0) {
for (var h of this.jpg2List) {
if (h.response) {
this.form.jpg2_id = h.response.id
} else {
this.form.jpg2_id = h.id
}
}
} else {
this.form.jpg2_id = ''
}
console.log(this.form)
// return
if (this.type === 'add') {
store({
...this.form
}).then(res => {
Message({
type: 'success',
message: '新增文物成功'
})
this.isShow = false
this.$emit('refresh')
})
return
}
if (this.type === 'editor') {
save({
id: this.id,
...this.form
}).then(res => {
Message({
type: 'success',
message: '编辑文物成功'
})
this.isShow = false
this.$emit('refresh')
})
}
},
handleRemove(file, fileList) {
this.headPictureList = fileList
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handlesuccess(response, file, fileList) {
this.headPictureList = fileList
},
handleRemoveVoice(file, fileList, type) {
console.log(file, fileList, type)
switch (type) {
case 'voice':
this.voiceList = fileList
break;
case 'threed':
this.threedList = fileList
break;
case 'fbx':
this.fbxList = fileList
break;
case 'jpg':
this.jpgList = fileList
break;
case 'jpg2':
this.jpg2List = fileList
break;
default:
break;
}
},
handlesuccessVoice(response, file, fileList, type) {
console.log(response, file, fileList, type)
switch (type) {
case 'voice':
this.voiceList = fileList
break;
case 'threed':
this.threedList = fileList
break;
case 'fbx':
this.fbxList = fileList
break;
case 'jpg':
this.jpgList = fileList
break;
case 'jpg2':
this.jpg2List = fileList
break;
default:
break;
}
},
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
} else {
this.form.source = '苏州革命博物馆'
this.form.release_time = this.getDatetimeValue()
}
} else {
this.id = ''
this.type = ''
this.headPictureList = []
this.voiceList = []
this.threedList = []
this.fbxList = []
this.jpgList = []
this.jpg2List = []
this.$refs['dialog'].reset()
}
}
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label {
width: 160px;
}
.img__delete {
transform: scale(0.8, 0.8);
position: absolute;
top: 4px;
right: 4px;
}
::v-deep .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
::v-deep .avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
::v-deep .el-upload--picture-card {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px !important;
height: 80px !important;
line-height: 80px !important;
text-align: center;
}
::v-deep .avatar {
width: 80px !important;
display: block;
border-radius: 6px;
}
::v-deep .xy-table-item-label {
width: 160px !important;
}
::v-deep .el-date-editor .el-range-separator {
width: auto !important;
}
::v-deep .el-input-number .el-input__inner {
text-align: left !important;
}
.searchCompanys {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
.el-input {
width: 80%
}
}
</style>

@ -0,0 +1,142 @@
<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" text="文物馆藏2" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<Input v-model="select.name" style="width: 200px;margin-right: 10px;" placeholder="关键字搜索" />
<Button type="primary" @click="getRelic"></Button>
<Button icon="ios-add" type="primary" style="margin-left: 10px;" @click="$refs['addRelic'].isShow = true,$refs['addRelic'].type = 'add'">添加</Button>
</div>
</slot>
</lx-header>
</div>
<xy-table
:list="list"
:total="total"
@pageSizeChange="e => select.pageSize = e"
@pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
<template slot-scope="scope">
<Button type="primary" size="small" @click="editorActivity(scope.row.id,'editor')"></Button>
<Poptip
transfer
confirm
title="确认要删除吗?"
@on-ok="deleteActivity(scope.row)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</template>
</el-table-column>
</template>
</xy-table>
<addRelic ref="addRelic" @refresh="getRelic"></addRelic>
</div>
</template>
<script>
import {index,destroy} from "@/api/relic2"
import addRelic from '@/views/relic2/component/addRelic'
import { Message } from 'element-ui'
export default {
components:{
addRelic
},
data() {
return {
select:{
pageSize:10,
pageIndex:1,
name:""
},
total:0,
list:[],
table:[
{
label:"名称",
prop:'name',
align:'left',
// width:240,
fixed:'left'
},
{
label:"列表显示",
prop:'show_list',
align:'center',
width:100,
},
// {
// label:"",
// prop:'grade',
// align:'center',
// width:100,
// },
// {
// label:"",
// prop:'contain',
// align:'center',
// width:240,
// },
// {
// label:"",
// prop:'history_time',
// align:'center',
// width:120,
// },
{
label:"发布时间",
prop:'release_time',
align:'center',
width:180,
},
]
}
},
mounted() {
this.getRelic()
},
methods: {
async getRelic(){
const res = await index({
page_size:this.select.pageSize,
page:this.select.pageIndex,
name:this.select.name,
sort_name:'release_time',
sort_type:"DESC",
})
this.list = res.data
this.total = res.total
},
pageChange(e){
this.select.pageIndex = e
this.getRelic()
},
deleteActivity(row){
destroy({id:row.id}).then(res => {
Message({
type:'success',
message:'删除文物成功'
})
this.getRelic()
})
},
editorActivity(id,type){
this.$refs['addRelic'].id = id
this.$refs['addRelic'].type = type
this.$refs['addRelic'].isShow = true
},
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save