Commit 5c7aba38 authored by 罗超's avatar 罗超

修复文件上传和批量设置字体信息

parent 36b794e4
......@@ -24,7 +24,7 @@ const replaceSCSSVariable = (names) => {
console.error(errs)
process.exit(1)
}
console.log('自动生成自定义字体列表完成')
//console.log('自动生成自定义字体列表完成')
})
})
}
......
......@@ -257,7 +257,6 @@ const GetTripConfig = async (ConfigId) =>{
TempIdStore.setTempId(dataObj.TempId)
}
} catch (error) {
console.log("triptemplate_GetTripConfig", error);
}
}
userLoginHandler()
......
......@@ -118,12 +118,10 @@ const updateLineStyle = (lineObj:any)=>{
lineObj.children.getIndex(0).tensionX = attrs.tensionX
lineObj.children.getIndex(0).tensionY = attrs.tensionY
lineObj.strokeDasharray = `${attrs.strokeDasharray},${attrs.strokeDasharray}`
console.log(attrs.strokeDasharray)
}
const updateLinePoint = (t:number,isReload:boolean=false)=>{
if(t==attrs.arrow && !isReload) t=-1
console.log(t)
for (let i = 0; i < splineSeries.value?.mapLines.length!; i++) {
let element = splineSeries.value?.mapLines.getIndex(i);
if(element?.uid==current.value.uid || updateAllLineStatus.value){
......@@ -147,7 +145,6 @@ const updateLinePoint = (t:number,isReload:boolean=false)=>{
const createPoint = (point:number,lineObj:any)=>{
console.log(lineObj.lineObjects)
let rotation = point == 0?270:90
let bullet = lineObj.lineObjects.create();
bullet.position = point;
......
......@@ -88,7 +88,6 @@ const querySearchAsync = async (
cb(response);
};
const citySelectHandler = (item: Record<string, any>, i: number) => {
console.log(item);
attrs.cities[i].data = item;
};
const createNewCity = (index = -1) => {
......@@ -133,7 +132,6 @@ const finishHandler = ()=>{
countries:attrs.selectedCountries,
cities:attrs.cities
}
console.log(r)
emit('finish',r)
}
loading.value=false
......
......@@ -61,7 +61,6 @@ export default (MapDOM: Ref<HTMLElement | undefined>, loadingStatus: Ref<boolean
})
worldSeries.events.on('ready', (e) => {
console.log('ready.........')
loadingStatus.value = false
})
......@@ -111,7 +110,6 @@ export default (MapDOM: Ref<HTMLElement | undefined>, loadingStatus: Ref<boolean
const exportPng = (): Promise<string> => {
const tt = map.config
console.log(tt)
countrySeries.exporting.getJSON("json").then(async r=>{
r = decodeURIComponent(r.replace('data:application/json;charset=utf-8,',''))
......@@ -542,7 +540,6 @@ export default (MapDOM: Ref<HTMLElement | undefined>, loadingStatus: Ref<boolean
//@ts-ignore
line.children.getIndex(0).tensionY = 2
line.events.on("hit", (e) => {
console.log(e)
eventName.value = 'lineEvent'
mapStore.setCurrent(e.target)
})
......@@ -662,7 +659,6 @@ export default (MapDOM: Ref<HTMLElement | undefined>, loadingStatus: Ref<boolean
}
if(!lab){
let labelChildren = mark.mapImages.create();
console.log(mark.data)
labelChildren.latitude = mark.data[0].latitude;
labelChildren.longitude = mark.data[0].longitude;
......
......@@ -201,7 +201,7 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
uploadingIndex.value=-1
return
}
const url = await FileService.uploadToFontServerAsync(uploadFile?.raw)
let url = await FileService.uploadToFontServerAsync(uploadFile?.raw)
if(url && url!=''){
if(url.indexOf('"')!=-1) url = url.replaceAll('"','')
let label=uploadFile.name.split('.')[0],reduceName='',reduceUrl=''
......@@ -212,7 +212,6 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
reduceUrl = await AliyunUpload.UploadAsync(info.file,"tripfont/"+info.file.name)
}
} catch (error) {
console.log('发生异常',error)
}
//添加字体
//uploadFinishFont.value.push(fontName)
......@@ -239,7 +238,6 @@ const uploadFontHandler = async (uploadFile:any, uploadFiles:any, fontName:strin
})
}
} catch (error) {
console.log("上传异常",error)
}
uploadingIndex.value=-1
}
......@@ -253,10 +251,9 @@ const removeFontHandler = (fontName:any)=>{
fonts.value?.splice(fonts.value.findIndex(x=>x.fontFamily==fontName),1)
}
})
.catch((error) => { console.log("catch",error)})
.catch((error) => { })
}
const handleExceed: UploadProps['onExceed'] = (files) => {
console.log('执行clear')
upload.value!.clearFiles()
const file = files[0] as UploadRawFile
upload.value!.handleStart(file)
......
......@@ -5,28 +5,28 @@ import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
// console.log(
// 'App is being served from cache by a service worker.\n' +
// 'For more details, visit https://goo.gl/AFskqB'
// )
},
registered() {
console.log('Service worker has been registered.')
//console.log('Service worker has been registered.')
},
cached() {
console.log('Content has been cached for offline use.')
//console.log('Content has been cached for offline use.')
},
updatefound() {
console.log('New content is downloading.')
//console.log('New content is downloading.')
},
updated() {
console.log('New content is available; please refresh.')
//console.log('New content is available; please refresh.')
},
offline() {
console.log('No internet connection found. App is running in offline mode.')
//console.log('No internet connection found. App is running in offline mode.')
},
error(error) {
console.error('Error during service worker registration:', error)
//console.error('Error during service worker registration:', error)
}
})
}
......@@ -31,7 +31,6 @@ class FileService {
return false
}
} catch (error) {
console.log(error)
return false
}
}
......
......@@ -66,7 +66,6 @@ export const useFontStore = defineStore('fonts',{
}
} catch (error) {
console.log('初始化字体信息失败')
}
},
async loadAllReduceFont(index:number=-1){
......@@ -111,7 +110,6 @@ export const useFontStore = defineStore('fonts',{
await fontFace.load();
} catch (error) {
console.log('加载字体报错',error)
}
document.fonts.add(fontFace)
this.loaded.push(item.fontFamily)
......
......@@ -25,14 +25,12 @@ const randomString = (e:number) => {
export const reduceFont = async (fontFile: File) => {
const buff = await fontFile.arrayBuffer()
console.log(buff)
let fontb = opentype.parse(buff)
let saveWords = fontb.names.fontFamily.zh??fontb.names.fontFamily.en
saveWords ="A"+saveWords
let savePosition:any[] = []
for (let i = 0; i < saveWords.length; i++) {
let g=fontb.encoding.charToGlyphIndex(saveWords[i]);
console.log(g)
if (g>=0){
savePosition.push(fontb.glyphs.get(g))
}
......
export const ResolveFonts = (item: any): any[] => {
const ignore = ['AdobeInvisFont','AdobeHeitiStd-Regular']
const ignore = 'Adobe'
let f = item.layer.typeTool().export()
const { font } = f
const { names } = font
let fonts = names.filter((x:any)=>ignore.indexOf(x)==-1)
return fonts
let fonts = names.filter((x:any)=>x.indexOf(ignore)==-1)
if(fonts && fonts.length>0){
for (let i = 0; i < fonts.length; i++) {
let x = fonts[i];
if(/^\d+/.test(x)){
x=x.replace(/[0-9]/ig,"")
x=x.replace('-','')
}
fonts[i]=x
}
}
return fonts && fonts.length>0 ? [fonts[0]] :[]
}
\ No newline at end of file
......@@ -34,7 +34,6 @@ export const ResolveLayer = async (item: any, index: number,offsetLeft:number,of
return element
} catch (error) {
console.log("执行出错",item)
return null
}
}
\ No newline at end of file
......@@ -89,7 +89,17 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
domTop -= 10+((leading-1)*fontSize/2)
}
let fontName = names.filter((x:any)=>x.indexOf('Adobe')==-1)
if(fontName && fontName.length>0){
for (let i = 0; i < fontName.length; i++) {
let x = fontName[i];
if(/^\d+/.test(x)){
x=x.replace(/[0-9]/ig,"")
x=x.replace('-','')
}
fontName[i]=x
}
}
let element: PPTTextElement = {
id: "text_" + index,
type: 'text',
......@@ -100,7 +110,7 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
rotate: transformRotate,
opacity,
content,
defaultFontName: names.join(','),
defaultFontName: fontName && fontName.length>0 ? fontName[0]:'',
defaultColor: color,
fill: background,
lineHeight: leading<1?1:leading,
......
......@@ -25,7 +25,6 @@ class AliyunUpload {
let result = await oss.put(name,file,{headers})
return 'https://im.oytour.com/'+name//result.url
} catch (error) {
console.log('上传发生异常:',error)
return ''
}
}
......
......@@ -154,7 +154,6 @@ const { handleElement, handleElementId } = storeToRefs(mainStore)
const handleImageElement = handleElement as Ref<PPTImageElement>
const handleSizeChange = (val: number) => {
console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
datas.queryMsg.pageIndex = val
......
......@@ -243,7 +243,6 @@ const goBack = (type:any) =>{
}
// 返回是否清空数据
const setNewDatas = (type,i) => {
console.log(type,i)
let list = [
{
id: 'test-slide-1',
......@@ -407,7 +406,6 @@ const uploadImageHandler = async ()=>{
}
const thumbnails = useSlidesStore().getThumbnails
console.log('console thumbnails',thumbnails)
if(thumbnails && thumbnails.length>0){
loadingInstance.value.text='正在上传模板缩略图'
queryObj.value.PageImage=[]
......
......@@ -144,7 +144,7 @@ const beginDownload = async ()=>{
}
fileUrl.value = `https://fileservice.oytour.com/api/img/${searchData.value.sellId}/${rangeArray.join(',')}/${format.value=='png'?'png':'jpg'}/${quality.value}/${useSellTemplateStore().SaleHashCode}` //https://fileservice.oytour.com
console.log(fileUrl.value)
nextTick(()=>{
downloadLink.value.click()
})
......
......@@ -286,7 +286,6 @@ const GetTripFiledData = async () =>{
y.fixedRatio = true
} catch (error) {
console.log(error)
y.fixedRatio = false
}
y.src = value[0]
......@@ -306,7 +305,6 @@ const GetTripFiledData = async () =>{
slidesStore.setSlides(slidesData)
}
} catch (error) {
console.log("triptemplateGetTripFiledData", error);
}
loadingObj.close()
}
......@@ -486,7 +484,6 @@ const GetTripTemplate = async () =>{
}
} catch (error) {
console.log("GetTripTemplateSlide", error);
}
}
......
......@@ -50,7 +50,35 @@
<Divider />
<SelectGroup class="row">
<SelectGroup class="row formatFontsBox">
<span class="selectText">
<el-select v-model="richTextAttrs.fontname" placeholder="" filterable
@change="updateFontStyle('fontname', richTextAttrs.fontname)">
<el-option
v-for="item in formatFonts"
:key="item.value"
:label="item.label"
:value="item.value"
:style="{'font-family':item.reduce!=''?item.reduce:item.label}"
/>
</el-select>
</span>
<span class="selectTextInput">
<el-autocomplete
v-model="fontsize"
:fetch-suggestions="(queryString: string, cb: any)=>querySearchFont(queryString,cb)"
class="inline-input w-50"
placeholder="字号"
@select="handleSelect"
@blur="handleSelect"
@keyup.enter="handleSelect">
<template #suffix>
<IconAddText />
</template>
</el-autocomplete>
</span>
</SelectGroup>
<!-- <SelectGroup class="row">
<Select
style="width: 60%;;"
:value="richTextAttrs.fontname"
......@@ -76,7 +104,7 @@
<IconAddText />
</template>
</Select>
</SelectGroup>
</SelectGroup> -->
<ButtonGroup class="row" passive>
<Popover trigger="click" style="width: 30%;">
<template #content>
......@@ -130,7 +158,7 @@
<script lang="ts" setup>
import { ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useMainStore, useSlidesStore } from '@/store'
import { useFontStore, useMainStore, useSlidesStore } from '@/store'
import type { PPTElement, PPTElementOutline, TableCell } from '@/types/slides'
import emitter, { EmitterEvents } from '@/utils/emitter'
import { WEB_FONTS } from '@/configs/font'
......@@ -151,6 +179,7 @@ import Popover from '@/components/Popover.vue'
const slidesStore = useSlidesStore()
const { richTextAttrs, availableFonts, activeElementList } = storeToRefs(useMainStore())
const { formatFonts } = storeToRefs(useFontStore())
const { addHistorySnapshot } = useHistorySnapshot()
......@@ -164,6 +193,15 @@ const fontSizeOptions = [
'36px', '40px', '44px', '48px', '54px', '60px', '66px', '72px', '76px',
'80px', '88px', '96px', '104px', '112px', '120px',
]
const fontSizes = ref<{label:string,value:string}[]>([])
for(let i=0;i<fontSizeOptions.length;i++){
let value = fontSizeOptions[i].split('px')
let obj = {
label: value[0],
value: value[0],
}
fontSizes.value.push(obj)
}
const fill = ref('#fff')
const outline = ref<PPTElementOutline>({
......@@ -171,6 +209,7 @@ const outline = ref<PPTElementOutline>({
color: '#fff',
style: 'solid',
})
const fontsize = ref<string>(richTextAttrs.value.fontsize.replace('px',''))
// 批量修改填充色(表格元素为单元格填充、音频元素为图标颜色)
const updateFill = (value: string) => {
......@@ -222,6 +261,9 @@ const updateOutline = (outlineProps: Partial<PPTElementOutline>) => {
const updateFontStyle = (command: string, value: string) => {
for (const el of activeElementList.value) {
if (el.type === 'text' || (el.type === 'shape' && el.text?.content)) {
if(command=='fontname' && value){
useFontStore().loadFontToDocument([value])
}
emitter.emit(EmitterEvents.RICH_TEXT_COMMAND, { target: el.id, action: { command, value } })
}
if (el.type === 'table') {
......@@ -239,6 +281,25 @@ const updateFontStyle = (command: string, value: string) => {
}
}
}
const handleSelect = () => {
let value = fontsize.value+'px'
updateFontStyle('fontsize', value as string)
}
const querySearchFont = (queryString: string, cb: any) => {
let results = queryString? fontSizes.value.filter(createFilter(queryString)) : fontSizes.value
cb(results)
}
const createFilter = (queryString: string) => {
return (restaurant:any) => {
return (
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
)
}
}
</script>
<style lang="scss" scoped>
......@@ -251,4 +312,13 @@ const updateFontStyle = (command: string, value: string) => {
.font-size-btn {
padding: 0;
}
.formatFontsBox{
position: relative;
}
.formatFontsBox::v-deep(.el-input__wrapper):hover{
border: 0;
}
.formatFontsBox::v-deep(.el-input__wrapper){
border-radius: 0px !important;
}
</style>
\ No newline at end of file
......@@ -442,7 +442,6 @@
onLineChangeHandler()
}
} catch (error) {
console.log("GetLineListAsync", error);
}
}
......@@ -468,7 +467,6 @@
Series.value = response.data.data;
}
} catch (error) {
console.log("GetSeriesListAsync", error);
}
}
......@@ -482,7 +480,6 @@
dispositionObj.value = response.data.data;
}
} catch (error) {
console.log("GetTemplateConfigData", error);
}
}
GetTemplateConfigDatas()
......
......@@ -430,7 +430,6 @@ const applyBackgroundAllSlide = () => {
// 设置主题
const updateTheme = (themeProps: Partial<SlideTheme>) => {
console.log(themeProps)
slidesStore.setTheme(themeProps)
}
......
......@@ -145,7 +145,6 @@ watch(viewportRatio, reload())
const getDomeWH = async () => {
if(refThumbnails.value){
let height = await refThumbnails.value.offsetHeight;
console.log(height,'-------行程特色高')
window.parent.postMessage(`行程特色高-${height}`, `${domainManager().notificationUrl}`);
}
}
......@@ -172,7 +171,6 @@ const GetTripFiled = async () =>{
TempDataSourceStore.setTemplateDataSource(TemplateRes.data.data)
}
} catch (error) {
console.log("TemplateGetTripFiled", error);
}
}
if(searchData.value.TemplateType!=2&&!query().ViewSlideshow) GetTripFiled()
......
......@@ -457,7 +457,7 @@
lines.value = response.data.data;
}
} catch (error) {
console.log("getLinesHandler", error);
}
}
......@@ -508,7 +508,7 @@
// }
}
} catch (error) {
console.log("getTemplateQuery", error);
}
}
const scrollingHandler = () =>{
......
......@@ -89,7 +89,6 @@ const showElementHandler= (items:any)=>{
let leading = (Math.round((lineHeight * transform.yy) * 100) * 0.01) / fontSize
let objectEFFFects = x.layer.objectEffects?x.layer.objectEffects():null
var div = document.createElement("div");
console.log(f,x,objectEFFFects)
div.innerText = value
div.style.top = x.coords.top+"px"
div.style.right = x.coords.right+"px"
......@@ -212,7 +211,6 @@ const getGradient=(obj:any)=>{
})
linear+=")"
console.log(GrFl)
return linear;
}
const getFillColor = (node:any) => {
......
......@@ -53,10 +53,6 @@ const loadSliders = async ()=>{
viewportRatio.value = h.value/w.value
if(viewportRatio.value>=1) VIEWPORT_VER_SIZE.Value=w.value
if(viewportRatio.value<1) VIEWPORT_SIZE.Value=w.value
console.log(viewportRatio.value,VIEWPORT_SIZE.Value,VIEWPORT_VER_SIZE.Value)
console.log(viewportRatio.value < 1
? VIEWPORT_SIZE.Value
: VIEWPORT_VER_SIZE.Value)
}else{
viewportRatio.value = dataObj.TempType==1? 0.7069:1.414
}
......
......@@ -142,7 +142,6 @@
}
})
const setTemplateType = (Id:number) => {
console.log(Id)
queryObj.TemplateType = Id
searchData.value.SellTemplateType = Id
queryObj.pageIndex = 1
......
......@@ -155,7 +155,6 @@ const backInquireHandler = () => {
else breadPeelingInquire(0, 0);
};
const breadPeelingInquire = (FileId: number, index: number) => {
console.log(FileId,index)
selectAll.value = false;
selectedDatas.value = [];
navigations.value.splice(index + 1, navigations.value.length - 1);
......@@ -305,7 +304,6 @@ const checkPositionHandler = (n:any)=>{
}
}
const tableScrollHandler = ()=>{
console.log('share 通知到底底部')
if(pageCount.value>queryObj.pageIndex){
queryObj.pageIndex++
getDocumentData()
......
......@@ -83,7 +83,6 @@ const searchHandler = ()=>{
if(searchKey.value!=''){
lastKeyword.value = searchKey.value
let task:any[] = []
console.log(searchType)
if(searchType.value=='0'||searchType.value=='1') task.push(searchByType(1,searchType.value=='0'?3:1000))
if(searchType.value=='0'||searchType.value=='2') task.push(searchByType(2,searchType.value=='0'?3:1000))
Promise.all(task).then(r=>{
......@@ -98,7 +97,6 @@ const searchHandler = ()=>{
}
loading.value = false
}).catch(()=>{
console.log('异常')
loading.value = false
})
}else{
......
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