This commit is contained in:
karl 2024-07-31 10:59:19 +08:00
parent 8df205d179
commit 1b7dd93888
12 changed files with 220 additions and 8 deletions

View File

@ -25,6 +25,8 @@
<span v-html="handleprant(item.title)"></span>
<el-button @click="handleZip(item.img_zip)" type="primary">下载图片</el-button>
<el-button @click="handleZip(item.trip_zip)" type="primary">下载行程</el-button>
<el-button @click="showImgDialog(item.img_zip)" type="primary">下载图片(暂未启用)</el-button>
<el-button @click="showFileList(item.trip_zip)" type="primary" style="margin-left: 10px;">下载行程(暂未启用)</el-button>
</div>
<div class="desc_container" v-for="list in item.qaQuestions">
<span style="font-weight: 700;color: #46a6ff;" class="desc" v-html="handleprant(list.title)">
@ -38,6 +40,61 @@
</ul>
</div>
</div>
<el-dialog title="图片列表" :visible.sync="dialogImage" width="80%">
<!-- 图片列表展示 -->
<div class="image-list">
<el-card
v-for="(image, index) in imageList"
:key="index"
class="image-card"
:body-style="{ padding: '10px' }"
>
<img :src="image.url" class="image-preview" />
<div class="image-footer">
<el-button @click="handlePreview(image.url)" size="mini">查看</el-button>
<el-button @click="handleDownload(image.url)" type="success" size="mini">下载</el-button>
</div>
</el-card>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogImage = false">关闭</el-button>
</div>
</el-dialog>
<el-dialog title="文件列表" :visible.sync="dialogFile" width="80%">
<!-- 文件列表展示 -->
<div class="file-list-horizontal">
<el-card
v-for="(file, index) in fileList"
:key="index"
class="file-card"
:body-style="{ padding: '10px' }"
>
<div class="file-info">
<el-icon class="file-icon">
<i :class="getFileIcon(file.url)"></i>
</el-icon>
<span class="file-name">{{ file.name }}</span>
</div>
<div class="file-footer">
<el-button @click="handleDownload(file.url)" type="success" size="mini">下载</el-button>
</div>
</el-card>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFile = false">关闭</el-button>
</div>
</el-dialog>
<!-- 图片预览对话框 -->
<el-dialog :visible.sync="previewVisible" :title="previewTitle" width="60%">
<img :src="previewImageUrl" class="image-preview-full" />
<div slot="footer" class="dialog-footer">
<el-button @click="previewVisible = false">关闭</el-button>
</div>
</el-dialog>
</div>
</template>
@ -52,7 +109,16 @@ export default {
dataForm: {
keyword: '',
city_id: ''
}
},
dialogImage: false, //
previewVisible: false, //
previewImageUrl: '', // URL
previewTitle: '', //
imageList: [ //
],
fileList: [ //
],
dialogFile: false,
}
},
created() {
@ -68,6 +134,29 @@ export default {
}
},
methods: {
//
showFileList(fileUrl) {
if (fileUrl) {
this.fileList = fileUrl.split(',').map(url => ({ url, name: url.split('/').pop() }));
}
this.dialogFile = true;
},
// URL
getFileIcon(url) {
const ext = url.split('.').pop().toLowerCase();
switch (ext) {
case 'pdf':
return 'el-icon-file-pdf';
case 'docx':
return 'el-icon-file-word';
case 'pptx':
return 'el-icon-file-ppt';
case 'xlsx':
return 'el-icon-file-excel';
default:
return 'el-icon-file';
}
},
handleQacityl(val) {
getQaList({ city_id: val }).then(res => {
this.getQaLists = res.data.data
@ -151,6 +240,55 @@ export default {
const div = document.createElement('div');
div.innerHTML = html;
return div.textContent || div.innerText || '';
},
showImgDialog(imagesUrls) {
if (imagesUrls) {
this.imageList = imagesUrls.split(',').map(url => ({ url }));
}
this.dialogImage = true;
},
//
handlePreview(url) {
this.previewImageUrl = url;
this.previewTitle = '图片预览';
this.previewVisible = true;
},
//
handleRemove(index) {
this.imageList.splice(index, 1);
},
//
handleDownload(url) {
if (url) {
// window.open(url)
fetch(url)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
const objectUrl = URL.createObjectURL(blob);
link.href = objectUrl;
link.download = url.split('/').pop(); // Extract filename from URL
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(objectUrl);
})
.catch(error => {
this.$message({
showClose: true,
message: '下载失败',
type: 'error'
});
console.error('Download error:', error);
});
} else {
this.$message({
showClose: true,
message: '暂无下载链接',
type: 'warning'
});
}
}
}
}
@ -242,4 +380,59 @@ body {
}
}
}
.image-list-horizontal {
display: flex;
overflow-x: auto;
white-space: nowrap;
padding: 10px 0;
}
.image-card {
display: inline-block;
width: 150px;
margin-right: 10px;
}
.image-preview {
width: 100%;
height: 100px;
object-fit: cover;
}
.image-preview-full {
width: 100%;
max-height: 600px;
}
.image-footer {
display: flex;
justify-content: space-between;
}
.file-list-horizontal {
display: flex;
overflow-x: auto;
white-space: nowrap;
padding: 10px 0;
}
.file-card {
display: inline-block;
width: 400px; /* 扩大宽度以显示完整文件名 */
margin-right: 10px;
}
.file-info {
display: flex;
align-items: center;
overflow: hidden;
}
.file-icon {
font-size: 24px;
margin-right: 10px;
}
.file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: calc(100% - 40px); /* 计算最大宽度以适应图标 */
}
.file-footer {
display: flex;
justify-content: flex-end;
}
</style>

View File

@ -62,7 +62,12 @@ class QaController extends base
if (!is_null($status)){
$list = $list->where('status',$status);
}
$list = $list->paginate($request->get('limit',10));
$list = $list->paginate($request->get('limit',10))->toArray();
foreach ($list['data'] as &$item) {
$item['img_zip'] = explode(',', $item['img_zip']);
$item['trip_zip'] = explode(',', $item['trip_zip']);
}
return $this->success($list);
}
@ -85,6 +90,13 @@ class QaController extends base
if (empty($post['city_id'])) return $this->error(2001, 'city_id data cannot be empty!');
if (empty($post['title'])) return $this->error(2001, 'title data cannot be empty!');
if ($post['trip_zip']) {
$post['trip_zip'] = implode(',', $post['trip_zip']);
}
if ($post['img_zip']) {
$post['img_zip'] = implode(',', $post['img_zip']);
}
$qaQuestion = $post['qaQuestions'] ?? null;
unset($post['qaQuestions']);
@ -118,6 +130,13 @@ class QaController extends base
unset($post['update_time']);
unset($post['qaQuestions']);
if ($post['trip_zip']) {
$post['trip_zip'] = implode(',', $post['trip_zip']);
}
if ($post['img_zip']) {
$post['img_zip'] = implode(',', $post['img_zip']);
}
try {
Db::transaction(function () use ($post,$qaQuestion){
$data = Qas::update($post);

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
.pagination-container[data-v-28fdfbeb]{padding:32px 16px;position:fixed;bottom:0;left:0;width:100%;background:#fff;padding:40px 280px;-webkit-box-shadow:0 -2px 10px rgba(0,0,0,.1);box-shadow:0 -2px 10px rgba(0,0,0,.1);z-index:100}.pagination-container.hidden[data-v-28fdfbeb]{display:none}.disable-layer[data-v-25113710]{width:100%;height:100%;background:#f5f7fa;position:absolute;top:0;left:0;z-index:99;opacity:.5}.img-box[data-v-14eba1da]{position:relative}.el-icon-folder[data-v-14eba1da]{color:#409eff!important;font-size:100px}.close[data-v-14eba1da]{position:absolute;top:-10px;right:-8px;font-size:18px;color:#409eff}.mistake-content[data-v-14eba1da],.qa-desc[data-v-14eba1da]{display:-webkit-box;display:-ms-flexbox;display:flex}.mistake-left[data-v-14eba1da]{width:90%}.mistake-right[data-v-14eba1da]{padding-left:20px;height:auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.app-container[data-v-14eba1da]{position:relative;padding-bottom:60px}.el-table[data-v-14eba1da],.filter-container[data-v-14eba1da]{padding-bottom:52px}.mistake-btn[data-v-14eba1da]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;margin-top:10px}.search[data-v-14eba1da]{margin-left:10px}.avatar-uploader .el-upload[data-v-14eba1da]{border:1px solid #131313;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-14eba1da]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-14eba1da]{border:1px solid #979797;border-radius:15px;font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center;position:relative}

View File

@ -1 +0,0 @@
@font-face{font-family:PingFang;src:url(../../static/fonts/PingFang\ SC.212ada59.ttf);font-weight:400;font-style:normal}body[data-v-3ccfbf84]{font-family:PingFang!important}.infinite-list[data-v-3ccfbf84]{list-style-type:none;height:calc(100vh - 154px);padding:0;margin:0}.desc_container+.desc_container[data-v-3ccfbf84]{margin-top:10px;padding-top:10px}.desc_container .desc_title[data-v-3ccfbf84]{font-size:18px;font-weight:500;color:#333;line-height:25px;margin-bottom:10px}.desc_container .desc_content[data-v-3ccfbf84]{font-size:14px;font-weight:300}.problem .problem_form[data-v-3ccfbf84]{margin-top:10px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.problem .problem_container[data-v-3ccfbf84],.problem .problem_form[data-v-3ccfbf84]{display:-webkit-box;display:-ms-flexbox;display:flex}.problem .problem_container .problem_left[data-v-3ccfbf84]{font-family:PingFang,sans-serif;font-weight:300;width:18%;background:#fff;padding:0 20px;border-right:2px solid #46a6ff;height:calc(100vh - 154px)}.problem .problem_container .problem_left .btn[data-v-3ccfbf84]{color:#fff;padding:10px 20px;cursor:pointer;text-align:center;background:#46a6ff;border-radius:10px}.problem .problem_container .problem_left .btn+.btn[data-v-3ccfbf84]{margin-top:10px}.problem .problem_container .problem_right[data-v-3ccfbf84]{width:100%;background:#fff;padding:0 20px}.problem .problem_container .problem_right .problem_right_container+.problem_right_container[data-v-3ccfbf84]{margin-top:20px}.problem .problem_container .problem_right .problem_right_container .title[data-v-3ccfbf84]{font-size:20px;font-weight:600;margin-bottom:10px;color:#46a6ff}.problem .problem_container .problem_right .problem_right_container .title[data-v-3ccfbf84]>:first-child{margin-right:40px}.problem .problem_container .problem_right .problem_right_container .desc[data-v-3ccfbf84]{font-size:14px;color:#666;line-height:24px}.problem .problem_container .problem_right .problem_right_container .desc .copy-button[data-v-3ccfbf84]{margin-left:300px}

View File

@ -0,0 +1 @@
.pagination-container[data-v-28fdfbeb]{padding:32px 16px;position:fixed;bottom:0;left:0;width:100%;background:#fff;padding:40px 280px;-webkit-box-shadow:0 -2px 10px rgba(0,0,0,.1);box-shadow:0 -2px 10px rgba(0,0,0,.1);z-index:100}.pagination-container.hidden[data-v-28fdfbeb]{display:none}.disable-layer[data-v-25113710]{width:100%;height:100%;background:#f5f7fa;position:absolute;top:0;left:0;z-index:99;opacity:.5}.img-box[data-v-c51cea6e]{position:relative;display:inline-block;width:100px;margin-bottom:10px}.img-box+.img-box[data-v-c51cea6e]{margin-left:10px}.img-box .desc[data-v-c51cea6e]{line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.avatar-uploader[data-v-c51cea6e] .el-upload{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.el-icon-plus[data-v-c51cea6e]{display:inline-block;margin-left:10px}.el-icon-folder[data-v-c51cea6e]{color:#409eff!important;font-size:100px}.close[data-v-c51cea6e]{position:absolute;top:-10px;right:-8px;font-size:18px;color:#409eff}.mistake-content[data-v-c51cea6e],.qa-desc[data-v-c51cea6e]{display:-webkit-box;display:-ms-flexbox;display:flex}.mistake-left[data-v-c51cea6e]{width:90%}.mistake-right[data-v-c51cea6e]{padding-left:20px;height:auto;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.app-container[data-v-c51cea6e]{position:relative;padding-bottom:60px}.el-table[data-v-c51cea6e],.filter-container[data-v-c51cea6e]{padding-bottom:52px}.mistake-btn[data-v-c51cea6e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse;margin-top:10px}.search[data-v-c51cea6e]{margin-left:10px}.avatar-uploader .el-upload[data-v-c51cea6e]{border:1px solid #131313;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-c51cea6e]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-c51cea6e]{border:1px solid #979797;border-radius:15px;font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center;position:relative}

View File

@ -0,0 +1 @@
@font-face{font-family:PingFang;src:url(../../static/fonts/PingFang\ SC.212ada59.ttf);font-weight:400;font-style:normal}body[data-v-270ef90a]{font-family:PingFang!important}.infinite-list[data-v-270ef90a]{list-style-type:none;height:calc(100vh - 154px);padding:0;margin:0}.desc_container+.desc_container[data-v-270ef90a]{margin-top:10px;padding-top:10px}.desc_container .desc_title[data-v-270ef90a]{font-size:18px;font-weight:500;color:#333;line-height:25px;margin-bottom:10px}.desc_container .desc_content[data-v-270ef90a]{font-size:14px;font-weight:300}.problem .problem_form[data-v-270ef90a]{margin-top:10px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.problem .problem_container[data-v-270ef90a],.problem .problem_form[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex}.problem .problem_container .problem_left[data-v-270ef90a]{font-family:PingFang,sans-serif;font-weight:300;width:18%;background:#fff;padding:0 20px;border-right:2px solid #46a6ff;height:calc(100vh - 154px)}.problem .problem_container .problem_left .btn[data-v-270ef90a]{color:#fff;padding:10px 20px;cursor:pointer;text-align:center;background:#46a6ff;border-radius:10px}.problem .problem_container .problem_left .btn+.btn[data-v-270ef90a]{margin-top:10px}.problem .problem_container .problem_right[data-v-270ef90a]{width:100%;background:#fff;padding:0 20px}.problem .problem_container .problem_right .problem_right_container+.problem_right_container[data-v-270ef90a]{margin-top:20px}.problem .problem_container .problem_right .problem_right_container .title[data-v-270ef90a]{font-size:20px;font-weight:600;margin-bottom:10px;color:#46a6ff}.problem .problem_container .problem_right .problem_right_container .title[data-v-270ef90a]>:first-child{margin-right:40px}.problem .problem_container .problem_right .problem_right_container .desc[data-v-270ef90a]{font-size:14px;color:#666;line-height:24px}.problem .problem_container .problem_right .problem_right_container .desc .copy-button[data-v-270ef90a]{margin-left:300px}.image-list-horizontal[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex;overflow-x:auto;white-space:nowrap;padding:10px 0}.image-card[data-v-270ef90a]{display:inline-block;width:150px;margin-right:10px}.image-preview[data-v-270ef90a]{width:100%;height:100px;-o-object-fit:cover;object-fit:cover}.image-preview-full[data-v-270ef90a]{width:100%;max-height:600px}.image-footer[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.file-list-horizontal[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex;overflow-x:auto;white-space:nowrap;padding:10px 0}.file-card[data-v-270ef90a]{display:inline-block;width:400px;margin-right:10px}.file-info[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;overflow:hidden}.file-icon[data-v-270ef90a]{font-size:24px;margin-right:10px}.file-name[data-v-270ef90a]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:calc(100% - 40px)}.file-footer[data-v-270ef90a]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-60e1f9c9"],{"09e5":function(t,e,n){},"5b1e":function(t,e,n){"use strict";n("09e5")},e132:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"problem"},[n("el-row",[n("el-col",{attrs:{span:24}},[n("div",{staticClass:"problem_form"},[n("el-form",{ref:"form",attrs:{inline:!0,model:t.dataForm,"label-width":"60px"}},[n("el-form-item",{attrs:{label:"关键字:"}},[n("el-input",{staticClass:"filter-item",staticStyle:{width:"400px"},attrs:{placeholder:"请输入搜索关键字"},model:{value:t.dataForm.keyword,callback:function(e){t.$set(t.dataForm,"keyword",e)},expression:"dataForm.keyword"}})],1),n("el-form-item",[n("el-button",{attrs:{type:"success"},on:{click:t.onSubmit}},[t._v("查询")])],1)],1)],1)])],1),n("div",{staticClass:"problem_container"},[n("div",{directives:[{name:"infinite-scroll",rawName:"v-infinite-scroll",value:t.load,expression:"load"}],staticClass:"problem_left",staticStyle:{overflow:"auto",padding:"10px"},attrs:{"infinite-scroll-immediate":!1}},t._l(t.getQaCityList,(function(e){return n("div",{staticClass:"btn",on:{click:function(n){return t.handleQacityl(e.city_id)}}},[t._v(t._s(e.city_name))])})),0),n("div",{staticClass:"problem_right"},[n("ul",{directives:[{name:"infinite-scroll",rawName:"v-infinite-scroll",value:t.load,expression:"load"}],staticClass:"infinite-list",staticStyle:{overflow:"auto"},attrs:{"infinite-scroll-immediate":!1}},t._l(t.getQaLists,(function(e){return n("li",{staticClass:"problem_right_container"},[n("div",{staticClass:"title"},[n("span",{domProps:{innerHTML:t._s(t.handleprant(e.title))}}),n("el-button",{attrs:{type:"primary"},on:{click:function(n){return t.handleZip(e.img_zip)}}},[t._v("下载图片")]),n("el-button",{attrs:{type:"primary"},on:{click:function(n){return t.handleZip(e.trip_zip)}}},[t._v("下载行程")])],1),t._l(e.qaQuestions,(function(e){return n("div",{staticClass:"desc_container"},[n("span",{staticClass:"desc",staticStyle:{"font-weight":"700",color:"#46a6ff"},domProps:{innerHTML:t._s(t.handleprant(e.title))}}),n("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"primary",size:"mini"},on:{click:function(n){return t.copyToClipboard(e.content)}}},[t._v("复制")]),n("div",{staticClass:"desc",domProps:{innerHTML:t._s(t.handleprantHtml(e.content))}})],1)}))],2)})),0)])])],1)},i=[],o=(n("d3b7"),n("4d63"),n("ac1f"),n("2c3e"),n("25f0"),n("3ca3"),n("5319"),n("ddb0"),n("2b3d"),n("bf19"),n("9861"),n("85a8")),r={data:function(){return{getQaCityList:[],getQaLists:[],dataForm:{keyword:"",city_id:""}}},created:function(){var t=this;Object(o["a"])().then((function(e){t.getQaCityList=e.data}))},watch:{"dataForm.keyword":function(t){t&&this.onSubmit()}},methods:{handleQacityl:function(t){var e=this;Object(o["b"])({city_id:t}).then((function(t){e.getQaLists=t.data.data}))},handleZip:function(t){var e=this;t?fetch(t).then((function(t){return t.blob()})).then((function(e){var n=document.createElement("a"),a=URL.createObjectURL(e);n.href=a,n.download=t.split("/").pop(),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(a)})).catch((function(t){e.$message({showClose:!0,message:"下载失败",type:"error"}),console.error("Download error:",t)})):this.$message({showClose:!0,message:"暂无下载链接",type:"warning"})},load:function(){console.log("load")},handleprant:function(t){if(!t)return"";var e=new RegExp(this.dataForm.keyword,"ig"),n='<span style="color: #fff;background-color: #FC0421FF;">'.concat(this.dataForm.keyword,"</span>");return t.replace(e,n)},handleprantHtml:function(t){if(!t)return"";var e=this.dataForm.keyword,n=new RegExp(e,"g"),a=t.replace(/(?<=>)[^>]+(?=<[/]?\w+.*>)/g,(function(t){return t.replace(n,"<span style='color: #fff;background-color: #FC0421FF;'>".concat(e,"</span>"))}));return a===t?this.handleprant(t):a},onSubmit:function(){var t=this;Object(o["b"])(this.dataForm).then((function(e){t.getQaLists=e.data.data}))},copyToClipboard:function(t){var e=this.stripHtml(t),n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),this.$message({showClose:!0,message:"内容已复制"})},stripHtml:function(t){var e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}}},s=r,c=(n("5b1e"),n("2877")),l=Object(c["a"])(s,a,i,!1,null,"3ccfbf84",null);e["default"]=l.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long