Commit 017c7251 authored by 罗超's avatar 罗超

修改

parent a183c1a7
This diff is collapsed.
......@@ -50,25 +50,7 @@
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleEdit(scope.row)">修改</el-button>
<el-button type="text" size="small" style="color:#f56c6c;margin-right: 10px;" @click="handleDelete(scope.row)">删除</el-button>
<el-dropdown trigger="click" @command="(command) => handleCommand(command, scope.row)">
<el-button type="text" size="small">
更多<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="wechatH5" divided>
<i class="el-icon-document"></i> 微信H5行程书
</el-dropdown-item>
<el-dropdown-item command="pdfItinerary">
<i class="el-icon-document"></i> PDF行程书
</el-dropdown-item>
<el-dropdown-item command="webSchedule" divided>
<i class="el-icon-tickets"></i> Web行程单
</el-dropdown-item>
<el-dropdown-item command="pdfSchedule">
<i class="el-icon-tickets"></i> PDF行程单
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" size="small" @click="openPublishDialog(scope.row)">发布行程</el-button>
</template>
</el-table-column>
</el-table>
......@@ -95,6 +77,45 @@
</el-tabs>
</div>
</div>
<el-dialog
title="发布行程"
:visible.sync="publishDialogVisible"
width="400px"
@close="resetPublishDialog"
append-to-body
>
<div class="publish-options-grid">
<div
v-for="item in publishOptions"
:key="item.command"
class="publish-option-card"
:class="{ active: currentPublishOption === item.command }"
@click="handlePublishOption(item.command)"
>
<!-- <i :class="['el-icon', item.icon]" style="font-size: 28px; margin-bottom: 8px; color: #409EFF;" /> -->
<div class="option-label">{{ item.label }}</div>
</div>
</div>
<div class="qrcode-area" style="margin: 24px 0; text-align: center;" v-loading="createQrcode">
<div style="height: 100px; width: 100px; background: #f5f5f5; display: inline-block; border-radius: 8px; line-height: 100px;">
<!-- 这里放二维码图片 -->
<img :src="qrcodeUrl" style="width: 100%; height: 100%;" />
</div>
<div style="margin-top: 8px; color: #888; font-size: 12px;">扫码查看行程</div>
</div>
<el-input
v-model="publishShareLink"
readonly
placeholder="这里是分享链接"
style="width: 100%;"
v-if="currentPublishOption!='wechatH5'"
>
<template #append>
<el-button @click="copyPublishLink">复制</el-button>
</template>
</el-input>
<div style="height: 30px;"></div>
</el-dialog>
</el-drawer>
</template>
......@@ -102,6 +123,7 @@
import { requirementService } from '@/services/requirement';
import { itineraryService } from '@/services/itinerary';
import InfoCard from './InfoCard.vue';
import QRCode from 'qrcode'
export default {
name: 'RequirementDetail',
......@@ -124,7 +146,19 @@ export default {
activeTab: 'basic',
loading: false,
detail: this.getInitialDetailState(),
baseHref:'http://'+location.host+'/#'
baseHref:'http://'+location.host+'/#',
publishDialogVisible: false,
publishRow: null,
publishShareLink: '',
publishOptions: [
{ command: 'wechatH5', label: '小程序行程书', icon: 'el-icon-document' },
{ command: 'pdfItinerary', label: 'TD行程书', icon: 'el-icon-document' },
{ command: 'webSchedule', label: 'Web行程单', icon: 'el-icon-tickets' },
{ command: 'pdfSchedule', label: 'PDF行程单', icon: 'el-icon-tickets' }
],
currentPublishOption: 'wechatH5',
qrcodeUrl: '',
createQrcode: false
}
},
computed: {
......@@ -207,6 +241,15 @@ export default {
handleEdit(row) {
window.open(`${this.baseHref}/itinerary/edit/${row.id}`, '_blank');
},
async handleTravelPdf(id) {
try {
const response = await itineraryService.getPdfItinerary(id);
return response;
} catch (error) {
this.$message.error('获取行程PDF失败');
return null;
}
},
handleDelete(row) {
this.$confirm(`是否确认删除【${row.title}】?`, '提示', {
type: 'warning'
......@@ -220,26 +263,64 @@ export default {
}
}).catch(() => {});
},
handleCommand(command, row) {
openPublishDialog(row) {
this.publishRow = row;
this.publishDialogVisible = true;
// 默认分享链接,可根据实际需求生成
this.publishShareLink = '';
this.qrcodeUrl = '';
this.createQrcode = false;
this.currentPublishOption = 'wechatH5';
this.handlePublishOption(this.currentPublishOption);
},
resetPublishDialog() {
this.publishDialogVisible = false;
this.publishRow = null;
this.publishShareLink = '';
},
handlePublishOption(command) {
const row = this.publishRow;
switch (command) {
case 'wechatH5':
this.handleWechatH5(row);
this.currentPublishOption = 'wechatH5';
break;
case 'pdfItinerary':
this.handlePDFItinerary(row);
this.currentPublishOption = 'pdfItinerary';
break;
case 'webSchedule':
this.handleWebSchedule(row);
this.currentPublishOption = 'webSchedule';
break;
case 'pdfSchedule':
this.handlePDFSchedule(row);
this.currentPublishOption = 'pdfSchedule';
break;
}
},
copyPublishLink() {
if (navigator.clipboard) {
navigator.clipboard.writeText(this.publishShareLink).then(() => {
this.$message.success('复制成功');
});
} else {
const input = document.createElement('input');
input.value = this.publishShareLink;
document.body.appendChild(input);
input.select();
document.execCommand('copy');
document.body.removeChild(input);
this.$message.success('复制成功');
}
},
handleWechatH5(row) {
// 生成微信H5链接并打开
const url = `${this.baseHref}/itinerary/h5/${row.id}`;
window.open(url, '_blank');
// const url = `${this.baseHref}/itinerary/h5/${row.id}`;
// window.open(url, '_blank');
this.qrcodeUrl='';
this.createQrcode = true;
this.getMiniProgramQrcode(row.autoId);
},
handlePDFItinerary(row) {
// 下载PDF行程书
......@@ -247,11 +328,61 @@ export default {
},
handleWebSchedule(row) {
// 打开Web行程单页面
window.open(`${this.baseHref}/itinerary/detail/${row.id}`, '_blank');
// window.open(`${this.baseHref}/itinerary/detail/${row.id}`, '_blank');
this.createQrcode = true;
this.canvasQrCode(`${this.baseHref}/itinerary/detail/${row.id}`)
this.publishShareLink = `${this.baseHref}/itinerary/detail/${row.id}`;
},
handlePDFSchedule(row) {
async handlePDFSchedule(row) {
// 下载PDF行程单
window.open(`${this.baseHref}/api/itinerary/pdf/schedule/${row.id}`, '_blank');
//window.open(`${this.baseHref}/api/itinerary/pdf/schedule/${row.id}`, '_blank');
this.createQrcode = true;
let pdfName = await this.handleTravelPdf(row.id);
this.qrcodeUrl = '';
this.publishShareLink = '';
if (pdfName) {
pdfName = pdfName.replace('"', '');
const url = `https://imgfile.oytour.com/aipdf/${pdfName}`;
console.log(url);
this.canvasQrCode(url)
this.publishShareLink = url;
}
},
getMiniProgramQrcode(id) {
let urlObj = this.domainManager();
this.$http({
headers: {
'Content-Type': 'application/json'
},
method: 'post',
url: urlObj.DomainUrl + '/api/file/GetAiTravelInfo',
data: {
"msg": {
"id": id
}
}
}).then(res => {
if (res.data.resultCode === 1) {
this.qrcodeUrl = "data:image/png;base64,"+res.data.data
this.createQrcode = false;
}
}).catch(err => {
this.createQrcode = false;
this.$message.error('获取小程序二维码失败');
})
},
canvasQrCode(text) {
let that = this
QRCode.toDataURL(text, {
color: {
dark: "000",
light: "#fff"
}
}, function (err, url) {
that.qrcodeUrl = url
that.createQrcode = false;
})
},
getTimelineItemType(state) {
const typeMap = {
......@@ -316,4 +447,37 @@ export default {
color: #606266;
font-size: 13px;
}
.publish-options-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 18px 24px;
justify-items: center;
margin-bottom: 24px;
margin-top: 8px;
}
.publish-option-card {
width: 140px;
height: 60px;
background: #f7fafd;
border-radius: 12px;
box-shadow: 0 1px 4px rgba(64,158,255,0.06);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
transition: box-shadow 0.2s, background 0.2s;
border: 1px solid #e6f0fa;
}
.publish-option-card:hover,
.publish-option-card.active {
background: #e6f7ff;
box-shadow: 0 4px 16px rgba(64,158,255,0.12);
}
.option-label {
font-size: 14px;
color: #333;
font-weight: 500;
}
</style>
......@@ -122,7 +122,7 @@ export default {
let locationName = window.location.hostname;
let isOnline = 0; //0-本地测试,1-线上
let ocrUrl = "http://192.168.5.46:8888";
domainUrl = "http://192.168.5.46";
domainUrl = "http://reborn.oytour.com";
let crmLocalFileStreamDownLoadUrl = "";
crmLocalFileStreamDownLoadUrl = locationName.indexOf('oytour') !== -1 ? "http://crm.oytour.com" : "http://testcrm.oytour.com";
let javaUrldo = "";
......
......@@ -4,7 +4,7 @@ import axios from 'axios';
// 创建 axios 实例
const service = axios.create({
baseURL: process.env.NODE_ENV === 'production'?'http://rw.oytour.com/api/app':'http://rw.oytour.com/api/app',//'http://localhost:19001/api/app', // 通用前缀
timeout: 10000
timeout: 1000 * 60
});
// 请求拦截器:自动加 token
......
......@@ -28,6 +28,15 @@ export const itineraryService = {
return rwRequest.delete('/travel/'+id);
},
/**
* 获取行程PDF
* @param {string} id - 行程ID
* @returns {Promise} - API 响应
*/
getPdfItinerary: (id) => {
return rwRequest.get('/travel/'+id+"/pdf");
},
/**
* 更新行程
* @param {Object} data - 行程数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment