Skip to content

Commit

Permalink
支持教育水印
Browse files Browse the repository at this point in the history
  • Loading branch information
supermap123 committed Mar 30, 2024
1 parent 4d3c0f8 commit def9156
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"liveServer.settings.port": 5502
"liveServer.settings.port": 5502
}
35 changes: 18 additions & 17 deletions SuperMap iEarth/public/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,23 +658,24 @@ const local_en = {
wireframeColor: "Wireframe Color",
chooseThenOffset: "Click to select the model, then offset it",
fillColor: "Fill Color",
tree_darg_tip:'Please drag and drop in the same level directory',
rename:'Rename',
bindMediaField:'Bind media fields', // 媒体字段(地图查询)- start
mediaField:'Media fields',
picture:'Picture',
video:'Video',
field:'Field',
title:'Title',
inputTitle:'Please enter a title',
customMediaLink:'Custom media links',
featureID:'Feature ID',
link:'Link',
inputOnlineImgLink:"Please enter the online image address",
inputOnlineVideoLink_iportal:"Please enter the video address (iportal only)", // 媒体字段(地图查询)- end
qxLayerDataUrl:'Please enter the data service URL for this layer',
qxLayerDataSource:'Please enter the data source corresponding to this layer',
qxLayerDataset:'Please enter the data set corresponding to this layer',
tree_darg_tip: 'Please drag and drop in the same level directory',
rename: 'Rename',
bindMediaField: 'Bind media fields', // 媒体字段(地图查询)- start
mediaField: 'Media fields',
picture: 'Picture',
video: 'Video',
field: 'Field',
title: 'Title',
inputTitle: 'Please enter a title',
customMediaLink: 'Custom media links',
featureID: 'Feature ID',
link: 'Link',
inputOnlineImgLink: "Please enter the online image address",
inputOnlineVideoLink_iportal: "Please enter the video address (iportal only)", // 媒体字段(地图查询)- end
qxLayerDataUrl: 'Please enter the data service URL for this layer',
qxLayerDataSource: 'Please enter the data source corresponding to this layer',
qxLayerDataset: 'Please enter the data set corresponding to this layer',
education: "SuperMap Education"
}

window.local_en = local_en;
35 changes: 18 additions & 17 deletions SuperMap iEarth/public/locale/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,23 +658,24 @@ const local_ja = {
wireframeColor: "ワイヤフレームカラー",
chooseThenOffset: "選択したモデルをクリックしてオフセットします",
fillColor: "じゅうてんカラー",
tree_darg_tip:'兄弟ディレクトリの下でドラッグしてください',
rename:'名前を変更',
bindMediaField:'メディアフィールドをバインドする', // 媒体字段(地图查询)- start
mediaField:'メディア分野',
picture:'写真',
video:'ビデオ',
field:'分野',
title:'タイトル',
inputTitle:'タイトルを入力してください',
customMediaLink:'カスタムメディアリンク',
featureID:'機能ID',
link:'リンク',
inputOnlineImgLink:"オンライン画像アドレスを入力してください",
inputOnlineVideoLink_iportal:"動画のアドレスを入力してください(のみ iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl:'このレイヤーのデータ サービス URL を入力してください',
qxLayerDataSource:'このレイヤーに対応するデータ ソースを入力してください',
qxLayerDataset:'このレイヤーに対応するデータセットを入力してください',
tree_darg_tip: '兄弟ディレクトリの下でドラッグしてください',
rename: '名前を変更',
bindMediaField: 'メディアフィールドをバインドする', // 媒体字段(地图查询)- start
mediaField: 'メディア分野',
picture: '写真',
video: 'ビデオ',
field: '分野',
title: 'タイトル',
inputTitle: 'タイトルを入力してください',
customMediaLink: 'カスタムメディアリンク',
featureID: '機能ID',
link: 'リンク',
inputOnlineImgLink: "オンライン画像アドレスを入力してください",
inputOnlineVideoLink_iportal: "動画のアドレスを入力してください(のみ iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl: 'このレイヤーのデータ サービス URL を入力してください',
qxLayerDataSource: 'このレイヤーに対応するデータ ソースを入力してください',
qxLayerDataset: 'このレイヤーに対応するデータセットを入力してください',
education: "教育版"
}

window.local_ja = local_ja;
37 changes: 19 additions & 18 deletions SuperMap iEarth/public/locale/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ const local_ru = {
recently: 'Недавние',
chooseField: 'Выбор поля',
filterFiledTip: 'Фильтрация полей атрибутов',

// 倾斜模型单体化
featrueID: "Элементы ID",
singleTip_waring: 'Введите соответствующий наклонному фотографическому слою: служба данных, источник данных, набор данных',
Expand Down Expand Up @@ -658,23 +658,24 @@ const local_ru = {
wireframeColor: "Цвет рамки",
chooseThenOffset: "Нажмите на выбранную модель, а затем переместите",
fillColor: "Цвет заполнения",
tree_darg_tip:'Перетащите в каталог того же уровня',
rename:'Переименовать',
bindMediaField:'Привязка медиа-полей', // 媒体字段(地图查询)- start
mediaField:'медиа-поля',
picture:'картина',
video:'видео',
field:'Поле',
title:'заголовок',
inputTitle:'Пожалуйста, введите название',
customMediaLink:'Пользовательские медиа-ссылки',
featureID:'элементы',
link:'Связь',
inputOnlineImgLink:"Пожалуйста, введите адрес онлайн-изображения",
inputOnlineVideoLink_iportal:"Пожалуйста, введите адрес видео(только iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl:'Введите URL-адрес службы данных для этого слоя.',
qxLayerDataSource:'Пожалуйста, введите источник данных, соответствующий этому слою',
qxLayerDataset:'Пожалуйста, введите набор данных, соответствующий этому слою',
tree_darg_tip: 'Перетащите в каталог того же уровня',
rename: 'Переименовать',
bindMediaField: 'Привязка медиа-полей', // 媒体字段(地图查询)- start
mediaField: 'медиа-поля',
picture: 'картина',
video: 'видео',
field: 'Поле',
title: 'заголовок',
inputTitle: 'Пожалуйста, введите название',
customMediaLink: 'Пользовательские медиа-ссылки',
featureID: 'элементы',
link: 'Связь',
inputOnlineImgLink: "Пожалуйста, введите адрес онлайн-изображения",
inputOnlineVideoLink_iportal: "Пожалуйста, введите адрес видео(только iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl: 'Введите URL-адрес службы данных для этого слоя.',
qxLayerDataSource: 'Пожалуйста, введите источник данных, соответствующий этому слою',
qxLayerDataset: 'Пожалуйста, введите набор данных, соответствующий этому слою',
education: "обучать"
}

window.local_ru = local_ru;
35 changes: 18 additions & 17 deletions SuperMap iEarth/public/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,23 +658,24 @@ const local_zh = {
wireframeColor: "线框颜色",
chooseThenOffset: "点击选中模型,再偏移",
fillColor: "填充颜色",
tree_darg_tip:'请在同级目录下拖拽',
rename:'重命名',
bindMediaField:'绑定媒体字段', // 媒体字段(地图查询)- start
mediaField:'媒体字段',
picture:'图片',
video:'视频',
field:'字段',
title:'标题',
inputTitle:'请输入标题',
customMediaLink:'自定义媒体链接',
featureID:'要素ID',
link:'链接',
inputOnlineImgLink:"请输入在线图片地址",
inputOnlineVideoLink_iportal:"请输入视频地址(仅限iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl:'请输入该图层的数据服务URL',
qxLayerDataSource:'请输入该图层对应的数据源',
qxLayerDataset:'请输入该图层对应的数据集',
tree_darg_tip: '请在同级目录下拖拽',
rename: '重命名',
bindMediaField: '绑定媒体字段', // 媒体字段(地图查询)- start
mediaField: '媒体字段',
picture: '图片',
video: '视频',
field: '字段',
title: '标题',
inputTitle: '请输入标题',
customMediaLink: '自定义媒体链接',
featureID: '要素ID',
link: '链接',
inputOnlineImgLink: "请输入在线图片地址",
inputOnlineVideoLink_iportal: "请输入视频地址(仅限iportal)", // 媒体字段(地图查询)- end
qxLayerDataUrl: '请输入该图层的数据服务URL',
qxLayerDataSource: '请输入该图层对应的数据源',
qxLayerDataset: '请输入该图层对应的数据集',
education: "教育版"
}

window.local_zh = local_zh;
76 changes: 76 additions & 0 deletions SuperMap iEarth/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<message-content></message-content>
<I18n></I18n>
<layout></layout>
<license-watermark
v-show="watermark.show"
:content="watermark.content"
:font-size="watermark.fontSize"
fullscreen
/>
</n-message-provider>
</n-notification-provider>
</n-dialog-provider>
Expand All @@ -22,17 +28,87 @@
</template>

<script lang="ts" setup>
import { reactive } from "vue";
import { I18n } from "@/components/I18n";
import { MessageContent } from "@/components/Plugins/MessageContent";
import { DialogContent } from "@/components/Plugins/DialogContent";
import { LoadingContent } from "@/components/Plugins/LoadingContent";
import { loadAsyncComponent } from "@/utils/index";
import { darkTheme } from "naive-ui";
import { useLocaleHook } from "@/tools/localHook";
import { licenseEnum } from "@/enums/licenseEnum";
import { getRootUrl } from "@/tools/iportal/portalTools";
const layout = loadAsyncComponent(() => import("@/layout/index.vue"));
const locale = useLocaleHook(); // 设置naiveUI组件国际化
// 水印
const LicenseWatermark = loadAsyncComponent(
() => import("@/components/LicenseWatermark/index.vue")
);
const watermark = reactive({
show: false,
content: "",
fontSize: 14,
});
// 验证许可
const checkLicenseInfo = () => {
let url = getRootUrl() + "manager/licenseInfo.json";
if (window.iEarthConsole) {
console.log("licenseUrl:", url);
}
return window.axios
.get(url)
.then(function (licenseInfo: any) {
if (window.iEarthConsole) {
console.log("licenseInfo:", licenseInfo);
}
let designerInfo = licenseInfo?.entryInfos.find((info: any) => {
return info.licenseID === 21034 || info.licenseID === 65400; //65400 iportal 试用许可
});
if (designerInfo) {
// 判断许可过期
let timeOut = new Date().getTime() - designerInfo.expireDate.time;
if (timeOut > 0) {
return licenseEnum.TIMEOUT;
}
// 判断许可类型 0 为试用许可 watermarkMode: 0:试用;1:正式;2:开发;3:教育;4:个人;5:员工
if (designerInfo.watermarkMode === 0) {
watermark.content = "SuperMap Trial Use";
watermark.fontSize = 20;
watermark.show = true;
return licenseEnum.TRIAL;
}
if (designerInfo.watermarkMode === 1) {
watermark.show = false;
return licenseEnum.FORMAL;
}
if (designerInfo.watermarkMode === 3) {
document.title = document.title + ` 「${$t("education")}」`;
watermark.show = false;
return licenseEnum.EDUCATION;
}
if (designerInfo.userTrademark !== "") {
watermark.content = designerInfo.userTrademark;
watermark.show = true;
}
return designerInfo.watermarkMode;
}
return licenseEnum.NULL;
})
.catch((e) => {
return licenseEnum.NULL;
});
};
if (location.href.indexOf("/apps") != -1) {
checkLicenseInfo().then((license: licenseEnum) => {
console.log("license:", license);
});
}
// 重写主题样式
const overridesTheme = {
common: {
Expand Down
3 changes: 3 additions & 0 deletions SuperMap iEarth/src/components/LicenseWatermark/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import LicenseWatermark from './index.vue';

export { LicenseWatermark };
4 changes: 4 additions & 0 deletions SuperMap iEarth/src/components/LicenseWatermark/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<template>
<n-watermark cross fullscreen :rotate="-15" :width="450" :height="325" font-color="rgba(136,136,136, 0.2)" :x-offset="0"
:y-offset="60"></n-watermark>
</template>
14 changes: 14 additions & 0 deletions SuperMap iEarth/src/enums/licenseEnum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @description: 许可返回值
*/
export enum licenseEnum {
TIMEOUT = -2, //过期
NULL = -1, //没有许可
TRIAL = 0, //试用许可
FORMAL = 1, //正式许可
DEV = 2, // 开发
EDUCATION = 3, //教育许可
INDIVI = 4, //个人
STAFF = 5, //员工

}

0 comments on commit def9156

Please sign in to comment.