mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
chore: code format
This commit is contained in:
@@ -10,6 +10,10 @@ import { cloneDeep, debounce as lodashDebounce } from "lodash-es";
|
||||
import { initWorkers } from "./workers";
|
||||
import { importJavascriptContribution, importJsonContribution, importMonacoYaml, importYamlContribution } from "./async-import";
|
||||
|
||||
defineOptions({
|
||||
name: "CodeEditor",
|
||||
});
|
||||
|
||||
/**
|
||||
* config:
|
||||
* value: '', // 编辑器初始文本
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PiContainer"
|
||||
name: "PiContainer",
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
<template>
|
||||
<div class="cron-editor">
|
||||
<div class="flex-o">
|
||||
<cron-light :disabled="disabled" :readonly="readonly" :period="period" class="flex-o cron-ant"
|
||||
locale="zh-CN" format="quartz" :model-value="modelValue" @update:model-value="onUpdate"
|
||||
@error="onError" />
|
||||
</div>
|
||||
<div class="mt-5 flex">
|
||||
<a-input :disabled="true" :readonly="readonly" :value="modelValue" @change="onChange"></a-input>
|
||||
<fs-icon icon="ion:close-circle" class="pointer fs-16 ml-5 color-gray" :title="t('certd.cron.clearTip')"
|
||||
@click="onClear"></fs-icon>
|
||||
</div>
|
||||
<div class="helper">{{ t('certd.cron.nextTrigger') }}:{{ nextTime }}</div>
|
||||
<div class="fs-helper">{{ errorMessage }}</div>
|
||||
</div>
|
||||
<div class="cron-editor">
|
||||
<div class="flex-o">
|
||||
<cron-light :disabled="disabled" :readonly="readonly" :period="period" class="flex-o cron-ant" locale="zh-CN" format="quartz" :model-value="modelValue" @update:model-value="onUpdate" @error="onError" />
|
||||
</div>
|
||||
<div class="mt-5 flex">
|
||||
<a-input :disabled="true" :readonly="readonly" :value="modelValue" @change="onChange"></a-input>
|
||||
<fs-icon icon="ion:close-circle" class="pointer fs-16 ml-5 color-gray" :title="t('certd.cron.clearTip')" @click="onClear"></fs-icon>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.cron.nextTrigger") }}:{{ nextTime }}</div>
|
||||
<div class="fs-helper">{{ errorMessage }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import parser from "cron-parser";
|
||||
import { computed, ref } from "vue";
|
||||
@@ -25,108 +21,107 @@ import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
import { getCronNextTimes } from "/@/components/cron-editor/utils";
|
||||
defineOptions({
|
||||
name: "CronEditor",
|
||||
name: "CronEditor",
|
||||
});
|
||||
const props = defineProps<{
|
||||
modelValue?: string;
|
||||
disabled?: boolean;
|
||||
readonly?: boolean;
|
||||
allowEveryMin?: boolean;
|
||||
modelValue?: string;
|
||||
disabled?: boolean;
|
||||
readonly?: boolean;
|
||||
allowEveryMin?: boolean;
|
||||
}>();
|
||||
|
||||
const period = ref<string>("");
|
||||
if (props.modelValue == null || props.modelValue.endsWith("* * *")) {
|
||||
period.value = "day";
|
||||
period.value = "day";
|
||||
} else if (props.modelValue.endsWith("* *")) {
|
||||
period.value = "month";
|
||||
period.value = "month";
|
||||
} else if (props.modelValue.endsWith("*")) {
|
||||
period.value = "year";
|
||||
period.value = "year";
|
||||
}
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": any;
|
||||
change: any;
|
||||
"update:modelValue": any;
|
||||
change: any;
|
||||
}>();
|
||||
|
||||
const errorMessage = ref<string | null>(null);
|
||||
|
||||
const onUpdate = (value: string) => {
|
||||
if (value === props.modelValue) {
|
||||
return;
|
||||
}
|
||||
const arr: string[] = value.split(" ");
|
||||
if (arr[0] === "*") {
|
||||
arr[0] = "0";
|
||||
}
|
||||
if (!props.allowEveryMin) {
|
||||
if (arr[1] === "*") {
|
||||
arr[1] = "0";
|
||||
}
|
||||
}
|
||||
if (value === props.modelValue) {
|
||||
return;
|
||||
}
|
||||
const arr: string[] = value.split(" ");
|
||||
if (arr[0] === "*") {
|
||||
arr[0] = "0";
|
||||
}
|
||||
if (!props.allowEveryMin) {
|
||||
if (arr[1] === "*") {
|
||||
arr[1] = "0";
|
||||
}
|
||||
}
|
||||
|
||||
value = arr.join(" ");
|
||||
value = arr.join(" ");
|
||||
|
||||
emit("update:modelValue", value);
|
||||
errorMessage.value = undefined;
|
||||
emit("update:modelValue", value);
|
||||
errorMessage.value = undefined;
|
||||
};
|
||||
|
||||
const onPeriod = (value: string) => {
|
||||
period.value = value;
|
||||
period.value = value;
|
||||
};
|
||||
|
||||
const onChange = (e: any) => {
|
||||
const value = e.target.value;
|
||||
onUpdate(value);
|
||||
const value = e.target.value;
|
||||
onUpdate(value);
|
||||
};
|
||||
const onError = (error: any) => {
|
||||
errorMessage.value = error;
|
||||
errorMessage.value = error;
|
||||
};
|
||||
|
||||
const onClear = () => {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
onUpdate("");
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
onUpdate("");
|
||||
};
|
||||
|
||||
const nextTime = computed(() => {
|
||||
if (props.modelValue == null) {
|
||||
return t("certd.cron.tip");
|
||||
}
|
||||
if (props.modelValue == null) {
|
||||
return t("certd.cron.tip");
|
||||
}
|
||||
|
||||
try {
|
||||
const nextTimes = getCronNextTimes(props.modelValue, 2);
|
||||
return nextTimes.join(",");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return t("certd.cron.tip");
|
||||
}
|
||||
try {
|
||||
const nextTimes = getCronNextTimes(props.modelValue, 2);
|
||||
return nextTimes.join(",");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return t("certd.cron.tip");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.cron-editor {
|
||||
.cron-ant {
|
||||
flex-wrap: wrap;
|
||||
.cron-ant {
|
||||
flex-wrap: wrap;
|
||||
|
||||
&*> {
|
||||
margin-bottom: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
&* > {
|
||||
margin-bottom: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.vcron-select-list {
|
||||
min-width: 56px;
|
||||
}
|
||||
.vcron-select-list {
|
||||
min-width: 56px;
|
||||
}
|
||||
|
||||
.vcron-select-input {
|
||||
min-height: 22px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.vcron-select-input {
|
||||
min-height: 22px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.vcron-select-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.vcron-select-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
import { defineComponent, onMounted, ref } from "vue";
|
||||
import * as api from "./api";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
|
||||
defineOptions({
|
||||
name: "EmailEditor",
|
||||
});
|
||||
const props = defineProps<{}>();
|
||||
const VNodes = defineComponent({
|
||||
props: {
|
||||
|
||||
@@ -16,7 +16,7 @@ import dayjs from "dayjs";
|
||||
import { computed } from "vue";
|
||||
|
||||
defineOptions({
|
||||
name: "ExpiresTimeText"
|
||||
name: "ExpiresTimeText",
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -15,7 +15,7 @@ Author: Pedro Oliveira <kanytu@gmail . com>
|
||||
.hljs-literal,
|
||||
.hljs-symbol,
|
||||
.hljs-bullet {
|
||||
color: #6897BB;
|
||||
color: #6897bb;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
@@ -42,7 +42,7 @@ Author: Pedro Oliveira <kanytu@gmail . com>
|
||||
.hljs-string,
|
||||
.hljs-attribute,
|
||||
.hljs-addition {
|
||||
color: #6A8759;
|
||||
color: #6a8759;
|
||||
}
|
||||
|
||||
.hljs-section,
|
||||
|
||||
@@ -8,7 +8,7 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #FFFFFF;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.hljs,
|
||||
@@ -21,7 +21,7 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
.hljs-selector-tag,
|
||||
.hljs-doctag,
|
||||
.hljs-name {
|
||||
color: #00979D;
|
||||
color: #00979d;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
@@ -29,7 +29,7 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
.hljs-bullet,
|
||||
.hljs-code,
|
||||
.hljs-addition {
|
||||
color: #D35400;
|
||||
color: #d35400;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
@@ -39,7 +39,7 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
.hljs-link,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color: #00979D;
|
||||
color: #00979d;
|
||||
}
|
||||
|
||||
.hljs-type,
|
||||
@@ -49,7 +49,7 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
.hljs-quote,
|
||||
.hljs-template-tag,
|
||||
.hljs-deletion {
|
||||
color: #005C5F;
|
||||
color: #005c5f;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
@@ -59,15 +59,15 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
}
|
||||
|
||||
.hljs-comment {
|
||||
color: rgba(149,165,166,.8);
|
||||
color: rgba(149, 165, 166, 0.8);
|
||||
}
|
||||
|
||||
.hljs-meta-keyword {
|
||||
color: #728E00;
|
||||
color: #728e00;
|
||||
}
|
||||
|
||||
.hljs-meta {
|
||||
color: #728E00;
|
||||
color: #728e00;
|
||||
color: #434f54;
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ Arduino® Light Theme - Stefania Mellai <s.mellai@arduino.cc>
|
||||
}
|
||||
|
||||
.hljs-function {
|
||||
color: #728E00;
|
||||
color: #728e00;
|
||||
}
|
||||
|
||||
.hljs-number {
|
||||
color: #8A7B52;
|
||||
color: #8a7b52;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ Brown Paper style from goldblog.com.ua (c) Zaripov Yura <yur4ik7@ukr.net>
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background:#b7a68e url(./brown-papersq.png);
|
||||
background: #b7a68e url(./brown-papersq.png);
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-literal {
|
||||
color:#005599;
|
||||
font-weight:bold;
|
||||
color: #005599;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs,
|
||||
|
||||
@@ -45,8 +45,6 @@ Ported by Fabrício Tavares de Oliveira
|
||||
color: #88f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-title,
|
||||
|
||||
@@ -4,7 +4,6 @@ Darcula color scheme from the JetBrains family of IDEs
|
||||
|
||||
*/
|
||||
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
Please use darcula.css instead.
|
||||
*/
|
||||
|
||||
@import url('darcula.css');
|
||||
@import url("darcula.css");
|
||||
|
||||
@@ -8,10 +8,9 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #F0F0F0;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
|
||||
/* Base color: saturation 0; */
|
||||
|
||||
.hljs,
|
||||
@@ -32,7 +31,6 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/* User color: hue: 0 */
|
||||
|
||||
.hljs-type,
|
||||
@@ -59,14 +57,13 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
.hljs-link,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color: #BC6060;
|
||||
color: #bc6060;
|
||||
}
|
||||
|
||||
|
||||
/* Language color: hue: 90; */
|
||||
|
||||
.hljs-literal {
|
||||
color: #78A960;
|
||||
color: #78a960;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
@@ -76,7 +73,6 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
color: #397300;
|
||||
}
|
||||
|
||||
|
||||
/* Meta color: hue: 200 */
|
||||
|
||||
.hljs-meta {
|
||||
@@ -87,7 +83,6 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
color: #4d99bf;
|
||||
}
|
||||
|
||||
|
||||
/* Misc effects */
|
||||
|
||||
.hljs-emphasis {
|
||||
|
||||
@@ -10,7 +10,8 @@ Date: 2013-04-02
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #eee; color: black;
|
||||
background: #eee;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.hljs-link,
|
||||
|
||||
@@ -68,7 +68,7 @@ Google Code style (c) Aahan Krish <geekpanth3r@gmail.com>
|
||||
|
||||
.hljs-selector-id,
|
||||
.hljs-selector-class {
|
||||
color: #9B703F
|
||||
color: #9b703f;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
|
||||
@@ -60,8 +60,8 @@ grayscale style (c) MY Sun <simonmysun@gmail.com>
|
||||
}
|
||||
|
||||
.hljs-regexp {
|
||||
color: #333;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat;
|
||||
color: #333;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
@@ -84,7 +84,7 @@ grayscale style (c) MY Sun <simonmysun@gmail.com>
|
||||
|
||||
.hljs-deletion {
|
||||
color: #fff;
|
||||
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
|
||||
@@ -47,7 +47,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
|
||||
.hljs-literal,
|
||||
.hljs-deletion,
|
||||
.hljs-link {
|
||||
color: #cc6666
|
||||
color: #cc6666;
|
||||
}
|
||||
|
||||
/*color: fg_green*/
|
||||
@@ -64,7 +64,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
|
||||
.hljs-attribute,
|
||||
.hljs-code,
|
||||
.hljs-selector-id {
|
||||
color: #b294bb;
|
||||
color: #b294bb;
|
||||
}
|
||||
|
||||
/*color: fg_blue*/
|
||||
@@ -72,7 +72,7 @@ vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
|
||||
.hljs-selector-tag,
|
||||
.hljs-bullet,
|
||||
.hljs-tag {
|
||||
color: #81a2be;
|
||||
color: #81a2be;
|
||||
}
|
||||
|
||||
/*color: fg_aqua*/
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
.hljs-number,
|
||||
.hljs-deletion {
|
||||
color:#ff73fd;
|
||||
color: #ff73fd;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
|
||||
@@ -6,7 +6,8 @@ Monokai style - ported by Luigi Maselli - http://grigio.org
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #272822; color: #ddd;
|
||||
background: #272822;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
.hljs-selector-class {
|
||||
color: #A082BD
|
||||
color: #a082bd;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
|
||||
@@ -21,12 +21,13 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on
|
||||
http://chir.ag/projects/name-that-color
|
||||
*/
|
||||
|
||||
.hljs { /* Common set of rules required by highlight.js (don'r remove!) */
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #FFFFDF; /* Half and Half (approx.) */
|
||||
/* --- Uncomment to add PureBASIC native IDE styled font!
|
||||
.hljs {
|
||||
/* Common set of rules required by highlight.js (don'r remove!) */
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #ffffdf; /* Half and Half (approx.) */
|
||||
/* --- Uncomment to add PureBASIC native IDE styled font!
|
||||
font-family: Consolas;
|
||||
*/
|
||||
}
|
||||
@@ -39,7 +40,7 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on
|
||||
.hljs-attr,
|
||||
.hljs-params,
|
||||
.hljs-subst {
|
||||
color: #000000; /* Black */
|
||||
color: #000000; /* Black */
|
||||
}
|
||||
|
||||
.hljs-comment, /* --- used for PureBASIC Comments --- */
|
||||
@@ -47,14 +48,14 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on
|
||||
.hljs-section,
|
||||
.hljs-selector-pseudo,
|
||||
.hljs-addition {
|
||||
color: #00AAAA; /* Persian Green (approx.) */
|
||||
color: #00aaaa; /* Persian Green (approx.) */
|
||||
}
|
||||
|
||||
.hljs-title, /* --- used for PureBASIC Procedures Names --- */
|
||||
.hljs-tag,
|
||||
.hljs-variable,
|
||||
.hljs-code {
|
||||
color: #006666; /* Blue Stone (approx.) */
|
||||
.hljs-code {
|
||||
color: #006666; /* Blue Stone (approx.) */
|
||||
}
|
||||
|
||||
.hljs-keyword, /* --- used for PureBASIC Keywords --- */
|
||||
@@ -63,34 +64,34 @@ NOTE_2: Color names provided in comments were derived using "Name that Color" on
|
||||
.hljs-selector-class,
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name {
|
||||
color: #006666; /* Blue Stone (approx.) */
|
||||
font-weight: bold;
|
||||
color: #006666; /* Blue Stone (approx.) */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-string, /* --- used for PureBASIC Strings --- */
|
||||
.hljs-selector-attr {
|
||||
color: #0080FF; /* Azure Radiance (approx.) */
|
||||
color: #0080ff; /* Azure Radiance (approx.) */
|
||||
}
|
||||
|
||||
.hljs-symbol, /* --- used for PureBASIC Constants --- */
|
||||
.hljs-link,
|
||||
.hljs-deletion,
|
||||
.hljs-attribute {
|
||||
color: #924B72; /* Cannon Pink (approx.) */
|
||||
color: #924b72; /* Cannon Pink (approx.) */
|
||||
}
|
||||
|
||||
.hljs-meta,
|
||||
.hljs-literal,
|
||||
.hljs-selector-id {
|
||||
color: #924B72; /* Cannon Pink (approx.) */
|
||||
font-weight: bold;
|
||||
color: #924b72; /* Cannon Pink (approx.) */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-strong,
|
||||
.hljs-name {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ Qt Creator dark color scheme
|
||||
|
||||
*/
|
||||
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
@@ -32,8 +31,7 @@ Qt Creator dark color scheme
|
||||
color: #ff55ff;
|
||||
}
|
||||
|
||||
.hljs-code
|
||||
.hljs-selector-class {
|
||||
.hljs-code .hljs-selector-class {
|
||||
color: #aaaaff;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ Qt Creator light color scheme
|
||||
|
||||
*/
|
||||
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
@@ -32,8 +31,7 @@ Qt Creator light color scheme
|
||||
color: #000080;
|
||||
}
|
||||
|
||||
.hljs-code
|
||||
.hljs-selector-class {
|
||||
.hljs-code .hljs-selector-class {
|
||||
color: #800080;
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ Qt Creator light color scheme
|
||||
.hljs-variable,
|
||||
.hljs-params,
|
||||
.hljs-class .hljs-title {
|
||||
color: #0055AF;
|
||||
color: #0055af;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
|
||||
@@ -44,7 +44,6 @@ Railscasts-like style (c) Visoft, Inc. (Damien White)
|
||||
color: #da4939;
|
||||
}
|
||||
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-bullet,
|
||||
.hljs-built_in,
|
||||
|
||||
@@ -12,7 +12,6 @@ Style with support for rainbow parens
|
||||
color: #d1d9e1;
|
||||
}
|
||||
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #969896;
|
||||
@@ -50,7 +49,7 @@ Style with support for rainbow parens
|
||||
.hljs-template-variable,
|
||||
.hljs-selector-id,
|
||||
.hljs-class .hljs-title {
|
||||
color: #ffcc66;
|
||||
color: #ffcc66;
|
||||
}
|
||||
|
||||
.hljs-section,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #F0F0F0;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
/* Base color: saturation 0; */
|
||||
@@ -31,15 +31,15 @@
|
||||
}
|
||||
|
||||
.hljs-attribute {
|
||||
color: #0E9A00;
|
||||
}
|
||||
color: #0e9a00;
|
||||
}
|
||||
|
||||
.hljs-function {
|
||||
color: #99069A;
|
||||
color: #99069a;
|
||||
}
|
||||
|
||||
.hljs-builtin-name {
|
||||
color: #99069A;
|
||||
color: #99069a;
|
||||
}
|
||||
|
||||
/* User color: hue: 0 */
|
||||
@@ -68,24 +68,22 @@
|
||||
.hljs-link,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color: #BC6060;
|
||||
color: #bc6060;
|
||||
}
|
||||
|
||||
|
||||
/* Language color: hue: 90; */
|
||||
|
||||
.hljs-literal {
|
||||
color: #78A960;
|
||||
color: #78a960;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-bullet,
|
||||
.hljs-code,
|
||||
.hljs-addition {
|
||||
color: #0C9A9A;
|
||||
color: #0c9a9a;
|
||||
}
|
||||
|
||||
|
||||
/* Meta color: hue: 200 */
|
||||
|
||||
.hljs-meta {
|
||||
@@ -96,7 +94,6 @@
|
||||
color: #4d99bf;
|
||||
}
|
||||
|
||||
|
||||
/* Misc effects */
|
||||
|
||||
.hljs-emphasis {
|
||||
|
||||
@@ -9,11 +9,11 @@ School Book style from goldblog.com.ua (c) Zaripov Yura <yur4ik7@ukr.net>
|
||||
overflow-x: auto;
|
||||
padding: 15px 0.5em 0.5em 30px;
|
||||
font-size: 11px;
|
||||
line-height:16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
pre{
|
||||
background:#f6f6ae url(./school-book.png);
|
||||
pre {
|
||||
background: #f6f6ae url(./school-book.png);
|
||||
border-top: solid 2px #d2e8b9;
|
||||
border-bottom: solid 1px #d2e8b9;
|
||||
}
|
||||
@@ -21,8 +21,8 @@ pre{
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-literal {
|
||||
color:#005599;
|
||||
font-weight:bold;
|
||||
color: #005599;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs,
|
||||
|
||||
@@ -58,7 +58,6 @@ Visual Studio-like style based on original C# coloring by Jason Diamond <jason@d
|
||||
color: #00b0e8;
|
||||
}
|
||||
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -7,39 +7,39 @@
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #1E1E1E;
|
||||
color: #DCDCDC;
|
||||
background: #1e1e1e;
|
||||
color: #dcdcdc;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-literal,
|
||||
.hljs-symbol,
|
||||
.hljs-name {
|
||||
color: #569CD6;
|
||||
color: #569cd6;
|
||||
}
|
||||
.hljs-link {
|
||||
color: #569CD6;
|
||||
color: #569cd6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-type {
|
||||
color: #4EC9B0;
|
||||
color: #4ec9b0;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-class {
|
||||
color: #B8D7A3;
|
||||
color: #b8d7a3;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-meta-string {
|
||||
color: #D69D85;
|
||||
color: #d69d85;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-template-tag {
|
||||
color: #9A5334;
|
||||
color: #9a5334;
|
||||
}
|
||||
|
||||
.hljs-subst,
|
||||
@@ -47,34 +47,34 @@
|
||||
.hljs-title,
|
||||
.hljs-params,
|
||||
.hljs-formula {
|
||||
color: #DCDCDC;
|
||||
color: #dcdcdc;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #57A64A;
|
||||
color: #57a64a;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-doctag {
|
||||
color: #608B4E;
|
||||
color: #608b4e;
|
||||
}
|
||||
|
||||
.hljs-meta,
|
||||
.hljs-meta-keyword,
|
||||
.hljs-tag {
|
||||
color: #9B9B9B;
|
||||
color: #9b9b9b;
|
||||
}
|
||||
|
||||
.hljs-variable,
|
||||
.hljs-template-variable {
|
||||
color: #BD63C5;
|
||||
color: #bd63c5;
|
||||
}
|
||||
|
||||
.hljs-attr,
|
||||
.hljs-attribute,
|
||||
.hljs-builtin-name {
|
||||
color: #9CDCFE;
|
||||
color: #9cdcfe;
|
||||
}
|
||||
|
||||
.hljs-section {
|
||||
@@ -99,7 +99,7 @@
|
||||
.hljs-selector-class,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color: #D7BA7D;
|
||||
color: #d7ba7d;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
xt256.css
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ based on dark.css by Ivan Sagalaev
|
||||
color: #7f9f7f;
|
||||
}
|
||||
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -18,18 +18,18 @@ export default defineComponent({
|
||||
code: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ""
|
||||
default: "",
|
||||
},
|
||||
formatHtml: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
lang: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: ""
|
||||
}
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup(props: any, ctx: any) {
|
||||
const highlightHTMLRef: Ref = ref("");
|
||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
||||
doHighlight();
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -52,9 +52,9 @@ export default defineComponent({
|
||||
}
|
||||
return {
|
||||
highlightHTMLRef,
|
||||
doHighlight
|
||||
doHighlight,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,40 +3,40 @@
|
||||
// 功能
|
||||
// 将HTML字符串格式化
|
||||
|
||||
const format = (function() {
|
||||
const format = (function () {
|
||||
function style_html(html_source, indent_size, indent_character, max_char) {
|
||||
var Parser, multi_parser;
|
||||
function Parser() {
|
||||
this.pos = 0;
|
||||
this.token = '';
|
||||
this.current_mode = 'CONTENT';
|
||||
this.token = "";
|
||||
this.current_mode = "CONTENT";
|
||||
this.tags = {
|
||||
parent: 'parent1',
|
||||
parent: "parent1",
|
||||
parentcount: 1,
|
||||
parent1: ''
|
||||
parent1: "",
|
||||
};
|
||||
this.tag_type = '';
|
||||
this.token_text = this.last_token = this.last_text = this.token_type = '';
|
||||
this.tag_type = "";
|
||||
this.token_text = this.last_token = this.last_text = this.token_type = "";
|
||||
this.Utils = {
|
||||
whitespace: "\n\r\t ".split(''),
|
||||
single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed'.split(','),
|
||||
extra_liners: 'head,body,/html'.split(','),
|
||||
in_array: function(what, arr) {
|
||||
whitespace: "\n\r\t ".split(""),
|
||||
single_token: "br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed".split(","),
|
||||
extra_liners: "head,body,/html".split(","),
|
||||
in_array: function (what, arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (what === arr[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.get_content = function() {
|
||||
var char = '';
|
||||
},
|
||||
};
|
||||
this.get_content = function () {
|
||||
var char = "";
|
||||
var content = [];
|
||||
var space = false;
|
||||
while (this.input.charAt(this.pos) !== '<') {
|
||||
while (this.input.charAt(this.pos) !== "<") {
|
||||
if (this.pos >= this.input.length) {
|
||||
return content.length ? content.join('') : ['', 'TK_EOF'];
|
||||
return content.length ? content.join("") : ["", "TK_EOF"];
|
||||
}
|
||||
char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
@@ -49,78 +49,78 @@ const format = (function() {
|
||||
continue;
|
||||
} else if (space) {
|
||||
if (this.line_char_count >= this.max_char) {
|
||||
content.push('\n');
|
||||
content.push("\n");
|
||||
for (var i = 0; i < this.indent_level; i++) {
|
||||
content.push(this.indent_string);
|
||||
}
|
||||
this.line_char_count = 0;
|
||||
} else {
|
||||
content.push(' ');
|
||||
content.push(" ");
|
||||
this.line_char_count++;
|
||||
}
|
||||
space = false;
|
||||
}
|
||||
content.push(char);
|
||||
}
|
||||
return content.length ? content.join('') : '';
|
||||
}
|
||||
this.get_script = function() {
|
||||
var char = '';
|
||||
return content.length ? content.join("") : "";
|
||||
};
|
||||
this.get_script = function () {
|
||||
var char = "";
|
||||
var content = [];
|
||||
var reg_match = new RegExp('\<\/script' + '\>', 'igm');
|
||||
var reg_match = new RegExp("</script" + ">", "igm");
|
||||
reg_match.lastIndex = this.pos;
|
||||
var reg_array = reg_match.exec(this.input);
|
||||
var end_script = reg_array ? reg_array.index: this.input.length;
|
||||
var end_script = reg_array ? reg_array.index : this.input.length;
|
||||
while (this.pos < end_script) {
|
||||
if (this.pos >= this.input.length) {
|
||||
return content.length ? content.join('') : ['', 'TK_EOF'];
|
||||
return content.length ? content.join("") : ["", "TK_EOF"];
|
||||
}
|
||||
char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
content.push(char);
|
||||
}
|
||||
return content.length ? content.join('') : '';
|
||||
}
|
||||
this.record_tag = function(tag) {
|
||||
if (this.tags[tag + 'count']) {
|
||||
this.tags[tag + 'count']++;
|
||||
this.tags[tag + this.tags[tag + 'count']] = this.indent_level;
|
||||
return content.length ? content.join("") : "";
|
||||
};
|
||||
this.record_tag = function (tag) {
|
||||
if (this.tags[tag + "count"]) {
|
||||
this.tags[tag + "count"]++;
|
||||
this.tags[tag + this.tags[tag + "count"]] = this.indent_level;
|
||||
} else {
|
||||
this.tags[tag + 'count'] = 1;
|
||||
this.tags[tag + this.tags[tag + 'count']] = this.indent_level;
|
||||
this.tags[tag + "count"] = 1;
|
||||
this.tags[tag + this.tags[tag + "count"]] = this.indent_level;
|
||||
}
|
||||
this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent;
|
||||
this.tags.parent = tag + this.tags[tag + 'count'];
|
||||
}
|
||||
this.retrieve_tag = function(tag) {
|
||||
if (this.tags[tag + 'count']) {
|
||||
this.tags[tag + this.tags[tag + "count"] + "parent"] = this.tags.parent;
|
||||
this.tags.parent = tag + this.tags[tag + "count"];
|
||||
};
|
||||
this.retrieve_tag = function (tag) {
|
||||
if (this.tags[tag + "count"]) {
|
||||
var temp_parent = this.tags.parent;
|
||||
while (temp_parent) {
|
||||
if (tag + this.tags[tag + 'count'] === temp_parent) {
|
||||
if (tag + this.tags[tag + "count"] === temp_parent) {
|
||||
break;
|
||||
}
|
||||
temp_parent = this.tags[temp_parent + 'parent'];
|
||||
temp_parent = this.tags[temp_parent + "parent"];
|
||||
}
|
||||
if (temp_parent) {
|
||||
this.indent_level = this.tags[tag + this.tags[tag + 'count']];
|
||||
this.tags.parent = this.tags[temp_parent + 'parent'];
|
||||
this.indent_level = this.tags[tag + this.tags[tag + "count"]];
|
||||
this.tags.parent = this.tags[temp_parent + "parent"];
|
||||
}
|
||||
delete this.tags[tag + this.tags[tag + 'count'] + 'parent'];
|
||||
delete this.tags[tag + this.tags[tag + 'count']];
|
||||
if (this.tags[tag + 'count'] == 1) {
|
||||
delete this.tags[tag + 'count'];
|
||||
delete this.tags[tag + this.tags[tag + "count"] + "parent"];
|
||||
delete this.tags[tag + this.tags[tag + "count"]];
|
||||
if (this.tags[tag + "count"] == 1) {
|
||||
delete this.tags[tag + "count"];
|
||||
} else {
|
||||
this.tags[tag + 'count']--;
|
||||
this.tags[tag + "count"]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.get_tag = function() {
|
||||
var char = '';
|
||||
};
|
||||
this.get_tag = function () {
|
||||
var char = "";
|
||||
var content = [];
|
||||
var space = false;
|
||||
do {
|
||||
if (this.pos >= this.input.length) {
|
||||
return content.length ? content.join('') : ['', 'TK_EOF'];
|
||||
return content.length ? content.join("") : ["", "TK_EOF"];
|
||||
}
|
||||
char = this.input.charAt(this.pos);
|
||||
this.pos++;
|
||||
@@ -131,92 +131,92 @@ const format = (function() {
|
||||
continue;
|
||||
}
|
||||
if (char === "'" || char === '"') {
|
||||
if (!content[1] || content[1] !== '!') {
|
||||
if (!content[1] || content[1] !== "!") {
|
||||
char += this.get_unformatted(char);
|
||||
space = true;
|
||||
}
|
||||
}
|
||||
if (char === '=') {
|
||||
if (char === "=") {
|
||||
space = false;
|
||||
}
|
||||
if (content.length && content[content.length - 1] !== '=' && char !== '>' && space) {
|
||||
if (content.length && content[content.length - 1] !== "=" && char !== ">" && space) {
|
||||
if (this.line_char_count >= this.max_char) {
|
||||
this.print_newline(false, content);
|
||||
this.line_char_count = 0;
|
||||
} else {
|
||||
content.push(' ');
|
||||
content.push(" ");
|
||||
this.line_char_count++;
|
||||
}
|
||||
space = false;
|
||||
}
|
||||
content.push(char);
|
||||
} while ( char !== '>');
|
||||
var tag_complete = content.join('');
|
||||
} while (char !== ">");
|
||||
var tag_complete = content.join("");
|
||||
var tag_index;
|
||||
if (tag_complete.indexOf(' ') != -1) {
|
||||
tag_index = tag_complete.indexOf(' ');
|
||||
if (tag_complete.indexOf(" ") != -1) {
|
||||
tag_index = tag_complete.indexOf(" ");
|
||||
} else {
|
||||
tag_index = tag_complete.indexOf('>');
|
||||
tag_index = tag_complete.indexOf(">");
|
||||
}
|
||||
var tag_check = tag_complete.substring(1, tag_index).toLowerCase();
|
||||
if (tag_complete.charAt(tag_complete.length - 2) === '/' || this.Utils.in_array(tag_check, this.Utils.single_token)) {
|
||||
this.tag_type = 'SINGLE';
|
||||
} else if (tag_check === 'script') {
|
||||
if (tag_complete.charAt(tag_complete.length - 2) === "/" || this.Utils.in_array(tag_check, this.Utils.single_token)) {
|
||||
this.tag_type = "SINGLE";
|
||||
} else if (tag_check === "script") {
|
||||
this.record_tag(tag_check);
|
||||
this.tag_type = 'SCRIPT';
|
||||
} else if (tag_check === 'style') {
|
||||
this.tag_type = "SCRIPT";
|
||||
} else if (tag_check === "style") {
|
||||
this.record_tag(tag_check);
|
||||
this.tag_type = 'STYLE';
|
||||
} else if (tag_check.charAt(0) === '!') {
|
||||
if (tag_check.indexOf('[if') != -1) {
|
||||
if (tag_complete.indexOf('!IE') != -1) {
|
||||
var comment = this.get_unformatted('-->', tag_complete);
|
||||
this.tag_type = "STYLE";
|
||||
} else if (tag_check.charAt(0) === "!") {
|
||||
if (tag_check.indexOf("[if") != -1) {
|
||||
if (tag_complete.indexOf("!IE") != -1) {
|
||||
var comment = this.get_unformatted("-->", tag_complete);
|
||||
content.push(comment);
|
||||
}
|
||||
this.tag_type = 'START';
|
||||
} else if (tag_check.indexOf('[endif') != -1) {
|
||||
this.tag_type = 'END';
|
||||
this.tag_type = "START";
|
||||
} else if (tag_check.indexOf("[endif") != -1) {
|
||||
this.tag_type = "END";
|
||||
this.unindent();
|
||||
} else if (tag_check.indexOf('[cdata[') != -1) {
|
||||
var comment = this.get_unformatted(']]>', tag_complete);
|
||||
} else if (tag_check.indexOf("[cdata[") != -1) {
|
||||
var comment = this.get_unformatted("]]>", tag_complete);
|
||||
content.push(comment);
|
||||
this.tag_type = 'SINGLE';
|
||||
this.tag_type = "SINGLE";
|
||||
} else {
|
||||
var comment = this.get_unformatted('-->', tag_complete);
|
||||
var comment = this.get_unformatted("-->", tag_complete);
|
||||
content.push(comment);
|
||||
this.tag_type = 'SINGLE';
|
||||
this.tag_type = "SINGLE";
|
||||
}
|
||||
} else {
|
||||
if (tag_check.charAt(0) === '/') {
|
||||
if (tag_check.charAt(0) === "/") {
|
||||
this.retrieve_tag(tag_check.substring(1));
|
||||
this.tag_type = 'END';
|
||||
this.tag_type = "END";
|
||||
} else {
|
||||
this.record_tag(tag_check);
|
||||
this.tag_type = 'START';
|
||||
this.tag_type = "START";
|
||||
}
|
||||
if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) {
|
||||
this.print_newline(true, this.output);
|
||||
}
|
||||
}
|
||||
return content.join('');
|
||||
}
|
||||
this.get_unformatted = function(delimiter, orig_tag) {
|
||||
return content.join("");
|
||||
};
|
||||
this.get_unformatted = function (delimiter, orig_tag) {
|
||||
if (orig_tag && orig_tag.indexOf(delimiter) != -1) {
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
var char = '';
|
||||
var content = '';
|
||||
var char = "";
|
||||
var content = "";
|
||||
var space = true;
|
||||
do {
|
||||
char = this.input.charAt(this.pos);
|
||||
this.pos++
|
||||
this.pos++;
|
||||
if (this.Utils.in_array(char, this.Utils.whitespace)) {
|
||||
if (!space) {
|
||||
this.line_char_count--;
|
||||
continue;
|
||||
}
|
||||
if (char === '\n' || char === '\r') {
|
||||
content += '\n';
|
||||
if (char === "\n" || char === "\r") {
|
||||
content += "\n";
|
||||
for (var i = 0; i < this.indent_level; i++) {
|
||||
content += this.indent_string;
|
||||
}
|
||||
@@ -228,44 +228,43 @@ const format = (function() {
|
||||
content += char;
|
||||
this.line_char_count++;
|
||||
space = true;
|
||||
|
||||
} while ( content . indexOf ( delimiter ) == -1);
|
||||
} while (content.indexOf(delimiter) == -1);
|
||||
return content;
|
||||
}
|
||||
this.get_token = function() {
|
||||
};
|
||||
this.get_token = function () {
|
||||
var token;
|
||||
if (this.last_token === 'TK_TAG_SCRIPT') {
|
||||
if (this.last_token === "TK_TAG_SCRIPT") {
|
||||
var temp_token = this.get_script();
|
||||
if (typeof temp_token !== 'string') {
|
||||
if (typeof temp_token !== "string") {
|
||||
return temp_token;
|
||||
}
|
||||
//token = js_beautify(temp_token, this.indent_size, this.indent_character, this.indent_level);
|
||||
//return [token, 'TK_CONTENT'];
|
||||
return [temp_token, 'TK_CONTENT'];
|
||||
return [temp_token, "TK_CONTENT"];
|
||||
}
|
||||
if (this.current_mode === 'CONTENT') {
|
||||
if (this.current_mode === "CONTENT") {
|
||||
token = this.get_content();
|
||||
if (typeof token !== 'string') {
|
||||
if (typeof token !== "string") {
|
||||
return token;
|
||||
} else {
|
||||
return [token, 'TK_CONTENT'];
|
||||
return [token, "TK_CONTENT"];
|
||||
}
|
||||
}
|
||||
if (this.current_mode === 'TAG') {
|
||||
if (this.current_mode === "TAG") {
|
||||
token = this.get_tag();
|
||||
if (typeof token !== 'string') {
|
||||
if (typeof token !== "string") {
|
||||
return token;
|
||||
} else {
|
||||
var tag_name_type = 'TK_TAG_' + this.tag_type;
|
||||
var tag_name_type = "TK_TAG_" + this.tag_type;
|
||||
return [token, tag_name_type];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.printer = function(js_source, indent_character, indent_size, max_char) {
|
||||
this.input = js_source || '';
|
||||
};
|
||||
this.printer = function (js_source, indent_character, indent_size, max_char) {
|
||||
this.input = js_source || "";
|
||||
this.output = [];
|
||||
this.indent_character = indent_character || ' ';
|
||||
this.indent_string = '';
|
||||
this.indent_character = indent_character || " ";
|
||||
this.indent_string = "";
|
||||
this.indent_size = indent_size || 2;
|
||||
this.indent_level = 0;
|
||||
this.max_char = max_char || 70;
|
||||
@@ -273,7 +272,7 @@ const format = (function() {
|
||||
for (var i = 0; i < this.indent_size; i++) {
|
||||
this.indent_string += this.indent_character;
|
||||
}
|
||||
this.print_newline = function(ignore, arr) {
|
||||
this.print_newline = function (ignore, arr) {
|
||||
this.line_char_count = 0;
|
||||
if (!arr || !arr.length) {
|
||||
return;
|
||||
@@ -283,23 +282,23 @@ const format = (function() {
|
||||
arr.pop();
|
||||
}
|
||||
}
|
||||
arr.push('\n');
|
||||
arr.push("\n");
|
||||
for (var i = 0; i < this.indent_level; i++) {
|
||||
arr.push(this.indent_string);
|
||||
}
|
||||
}
|
||||
this.print_token = function(text) {
|
||||
};
|
||||
this.print_token = function (text) {
|
||||
this.output.push(text);
|
||||
}
|
||||
this.indent = function() {
|
||||
};
|
||||
this.indent = function () {
|
||||
this.indent_level++;
|
||||
}
|
||||
this.unindent = function() {
|
||||
};
|
||||
this.unindent = function () {
|
||||
if (this.indent_level > 0) {
|
||||
this.indent_level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
return this;
|
||||
}
|
||||
multi_parser = new Parser();
|
||||
@@ -308,58 +307,56 @@ const format = (function() {
|
||||
var t = multi_parser.get_token();
|
||||
multi_parser.token_text = t[0];
|
||||
multi_parser.token_type = t[1];
|
||||
if (multi_parser.token_type === 'TK_EOF') {
|
||||
if (multi_parser.token_type === "TK_EOF") {
|
||||
break;
|
||||
}
|
||||
switch (multi_parser.token_type) {
|
||||
case 'TK_TAG_START':
|
||||
case 'TK_TAG_SCRIPT':
|
||||
case 'TK_TAG_STYLE':
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.indent();
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_TAG_END':
|
||||
multi_parser.print_newline(true, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_TAG_SINGLE':
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = 'CONTENT';
|
||||
break;
|
||||
case 'TK_CONTENT':
|
||||
if (multi_parser.token_text !== '') {
|
||||
case "TK_TAG_START":
|
||||
case "TK_TAG_SCRIPT":
|
||||
case "TK_TAG_STYLE":
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
}
|
||||
multi_parser.current_mode = 'TAG';
|
||||
break;
|
||||
multi_parser.indent();
|
||||
multi_parser.current_mode = "CONTENT";
|
||||
break;
|
||||
case "TK_TAG_END":
|
||||
multi_parser.print_newline(true, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = "CONTENT";
|
||||
break;
|
||||
case "TK_TAG_SINGLE":
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
multi_parser.current_mode = "CONTENT";
|
||||
break;
|
||||
case "TK_CONTENT":
|
||||
if (multi_parser.token_text !== "") {
|
||||
multi_parser.print_newline(false, multi_parser.output);
|
||||
multi_parser.print_token(multi_parser.token_text);
|
||||
}
|
||||
multi_parser.current_mode = "TAG";
|
||||
break;
|
||||
}
|
||||
multi_parser.last_token = multi_parser.token_type;
|
||||
multi_parser.last_text = multi_parser.token_text;
|
||||
}
|
||||
return multi_parser.output.join('');
|
||||
return multi_parser.output.join("");
|
||||
}
|
||||
return function(data) {
|
||||
var dataHolder = ['__dataHolder_', [Math.random(), Math.random(), Math.random(), Math.random()].join('_').replace(/[^0-9]/g, '_'), '_'].join('_');
|
||||
return function (data) {
|
||||
var dataHolder = ["__dataHolder_", [Math.random(), Math.random(), Math.random(), Math.random()].join("_").replace(/[^0-9]/g, "_"), "_"].join("_");
|
||||
var dataHolders = {};
|
||||
var index = 0;
|
||||
data = data.replace(/(\")(data:[^\"]*)(\")/g,
|
||||
function($0, $1, $2, $3) {
|
||||
data = data.replace(/(\")(data:[^\"]*)(\")/g, function ($0, $1, $2, $3) {
|
||||
var name = dataHolder + index++;
|
||||
dataHolders[name] = $2;
|
||||
return $1 + name + $3;
|
||||
})
|
||||
data = style_html(data, 2, ' ', 0x10000000);
|
||||
data = data.replace(new RegExp(dataHolder + '[0-9]+', 'g'),
|
||||
function($0) {
|
||||
});
|
||||
data = style_html(data, 2, " ", 0x10000000);
|
||||
data = data.replace(new RegExp(dataHolder + "[0-9]+", "g"), function ($0) {
|
||||
return dataHolders[$0];
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
export default format
|
||||
export default format;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<a-select>
|
||||
<a-select-option v-for="item of options" :keu="item.value" :value="item.value" :label="item.label">
|
||||
<a-select-option v-for="item of options" :key="item.value" :value="item.value" :label="item.label">
|
||||
<span class="flex-o">
|
||||
<fs-icon :icon="item.icon" class="fs-16 color-blue mr-5" />
|
||||
{{ item.label }}
|
||||
|
||||
@@ -10,12 +10,12 @@ export default {
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: undefined
|
||||
default: undefined,
|
||||
},
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
from: {
|
||||
type: [String, Array]
|
||||
}
|
||||
type: [String, Array],
|
||||
},
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
setup(props: any, ctx: any) {
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
currentStageIndex: currentStageIndex.value,
|
||||
currentTaskIndex: currentTaskIndex.value,
|
||||
currentStepIndex: currentStepIndex.value,
|
||||
currentTask: currentTask.value
|
||||
currentTask: currentTask.value,
|
||||
});
|
||||
if (props.from) {
|
||||
if (typeof props.from === "string") {
|
||||
@@ -73,9 +73,9 @@ export default {
|
||||
}
|
||||
return {
|
||||
options,
|
||||
onChanged
|
||||
onChanged,
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
import { ref } from "vue";
|
||||
import TutorialSteps from "/@/components/tutorial/tutorial-steps.vue";
|
||||
|
||||
defineOptions({
|
||||
name: "TutorialModal",
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
showIcon?: boolean;
|
||||
}>();
|
||||
@@ -16,23 +20,18 @@ const slots = defineSlots();
|
||||
<template>
|
||||
<div class="tutorial-button pointer" @click="open">
|
||||
<template v-if="!slots.default">
|
||||
<fs-icon
|
||||
v-if="showIcon === false"
|
||||
icon="ant-design:question-circle-outlined"
|
||||
class="mr-0.5"
|
||||
></fs-icon>
|
||||
<div class="hidden md:block">{{$t('tutorial.title')}}</div>
|
||||
<fs-icon v-if="showIcon === false" icon="ant-design:question-circle-outlined" class="mr-0.5"></fs-icon>
|
||||
<div class="hidden md:block">{{ $t("tutorial.title") }}</div>
|
||||
</template>
|
||||
<slot></slot>
|
||||
<a-modal v-model:open="openedRef" class="tutorial-modal" width="90%">
|
||||
<template #title>{{$t('tutorial.title')}}</template>
|
||||
<template #title>{{ $t("tutorial.title") }}</template>
|
||||
<tutorial-steps v-if="openedRef" />
|
||||
<template #footer></template>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="less">
|
||||
.tutorial-modal {
|
||||
top: 50px;
|
||||
|
||||
@@ -15,11 +15,7 @@ type Step = {
|
||||
|
||||
import { ref } from "vue";
|
||||
|
||||
const steps = ref<Step[]>([
|
||||
{ title: t('certd.steps.createPipeline') },
|
||||
{ title: t('certd.steps.addTask') },
|
||||
{ title: t('certd.steps.scheduledRun') }
|
||||
]);
|
||||
const steps = ref<Step[]>([{ title: t("certd.steps.createPipeline") }, { title: t("certd.steps.addTask") }, { title: t("certd.steps.scheduledRun") }]);
|
||||
|
||||
const router = useRouter();
|
||||
function goPipeline() {
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
</div>
|
||||
|
||||
<div class="flex-center actions">
|
||||
<fs-button class="m-10" icon="ion:arrow-back-outline" @click="prev()">{{ t('guide.buttons.prev') }}</fs-button>
|
||||
<fs-button class="m-10" type="primary" icon-right="ion:arrow-forward-outline" @click="next()">{{ t('guide.buttons.next') }}</fs-button>
|
||||
<fs-button class="m-10" icon="ion:arrow-back-outline" @click="prev()">{{ t("guide.buttons.prev") }}</fs-button>
|
||||
<fs-button class="m-10" type="primary" icon-right="ion:arrow-forward-outline" @click="next()">{{ t("guide.buttons.next") }}</fs-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -49,16 +48,13 @@ type StepItems = {
|
||||
import { computed, nextTick, ref } from "vue";
|
||||
|
||||
const steps = ref<Step[]>([
|
||||
{
|
||||
{
|
||||
title: t("guide.createCertPipeline.title"),
|
||||
description: t("guide.createCertPipeline.description"),
|
||||
items: [
|
||||
{
|
||||
title: t("guide.createCertPipeline.items.tutorialTitle"),
|
||||
descriptions: [
|
||||
t("guide.createCertPipeline.items.tutorialDesc1"),
|
||||
t("guide.createCertPipeline.items.tutorialDesc2"),
|
||||
],
|
||||
descriptions: [t("guide.createCertPipeline.items.tutorialDesc1"), t("guide.createCertPipeline.items.tutorialDesc2")],
|
||||
body: () => {
|
||||
return <SimpleSteps></SimpleSteps>;
|
||||
},
|
||||
@@ -86,26 +82,17 @@ const steps = ref<Step[]>([
|
||||
{
|
||||
image: "/static/doc/images/5-1-add-host.png",
|
||||
title: t("guide.addDeployTask.items.addTaskTitle"),
|
||||
descriptions: [
|
||||
t("guide.addDeployTask.items.addTaskDesc1"),
|
||||
t("guide.addDeployTask.items.addTaskDesc2"),
|
||||
],
|
||||
descriptions: [t("guide.addDeployTask.items.addTaskDesc1"), t("guide.addDeployTask.items.addTaskDesc2")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/5-2-add-host.png",
|
||||
title: t("guide.addDeployTask.items.fillParamsTitle"),
|
||||
descriptions: [
|
||||
t("guide.addDeployTask.items.fillParamsDesc1"),
|
||||
t("guide.addDeployTask.items.fillParamsDesc2"),
|
||||
],
|
||||
descriptions: [t("guide.addDeployTask.items.fillParamsDesc1"), t("guide.addDeployTask.items.fillParamsDesc2")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/5-3-add-host.png",
|
||||
title: t("guide.addDeployTask.items.activateCertTitle"),
|
||||
descriptions: [
|
||||
t("guide.addDeployTask.items.activateCertDesc1"),
|
||||
t("guide.addDeployTask.items.activateCertDesc2"),
|
||||
],
|
||||
descriptions: [t("guide.addDeployTask.items.activateCertDesc1"), t("guide.addDeployTask.items.activateCertDesc2")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/5-4-add-host.png",
|
||||
@@ -119,81 +106,72 @@ const steps = ref<Step[]>([
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('guide.runAndTestTask.runAndTestTitle'),
|
||||
description: t('guide.runAndTestTask.runAndTestDescription'),
|
||||
items: [
|
||||
{
|
||||
image: "/static/doc/images/9-start.png",
|
||||
title: t('guide.runAndTestTask.runTestOnce'),
|
||||
descriptions: [t('guide.runAndTestTask.clickManualTriggerToTest')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/10-1-log.png",
|
||||
title: t('guide.runAndTestTask.viewLogs'),
|
||||
descriptions: [t('guide.runAndTestTask.clickTaskToViewStatusAndLogs')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/11-1-error.png",
|
||||
title: t('guide.runAndTestTask.howToTroubleshootFailure'),
|
||||
descriptions: [t('guide.runAndTestTask.viewErrorLogs')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/11-2-error.png",
|
||||
title: t('guide.runAndTestTask.howToTroubleshootFailure'),
|
||||
descriptions: [
|
||||
t('guide.runAndTestTask.viewErrorLogs'),
|
||||
t('guide.runAndTestTask.nginxContainerNotExistFix'),
|
||||
],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/12-1-log-success.png",
|
||||
title: t('guide.runAndTestTask.executionSuccess'),
|
||||
descriptions: [t('guide.runAndTestTask.retryAfterFix')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/12-2-skip-log.png",
|
||||
title: t('guide.runAndTestTask.autoSkipAfterSuccess'),
|
||||
descriptions: [t('guide.runAndTestTask.successSkipExplanation')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/13-1-result.png",
|
||||
title: t('guide.runAndTestTask.viewCertDeploymentSuccess'),
|
||||
descriptions: [t('guide.runAndTestTask.visitNginxToSeeCert')],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/13-3-download.png",
|
||||
title: t('guide.runAndTestTask.downloadCertManualDeploy'),
|
||||
descriptions: [t('guide.runAndTestTask.downloadIfNoAutoDeployPlugin')],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('guide.scheduleAndEmailTask.title'),
|
||||
description: t('guide.scheduleAndEmailTask.description'),
|
||||
items: [
|
||||
{
|
||||
image: "/static/doc/images/14-timer.png",
|
||||
title: t('guide.scheduleAndEmailTask.setSchedule'),
|
||||
descriptions: [
|
||||
t('guide.scheduleAndEmailTask.pipelineSuccessThenSchedule'),
|
||||
t('guide.scheduleAndEmailTask.recommendDailyRun'),
|
||||
],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/15-1-email.png",
|
||||
title: t('guide.scheduleAndEmailTask.setEmailNotification'),
|
||||
descriptions: [
|
||||
t('guide.scheduleAndEmailTask.suggestErrorAndRecoveryEmails'),
|
||||
t('guide.scheduleAndEmailTask.basicVersionNeedsMailServer'),
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t('guide.scheduleAndEmailTask.tutorialEndTitle'),
|
||||
descriptions: [t('guide.scheduleAndEmailTask.thanksForWatching')],
|
||||
},
|
||||
],
|
||||
}
|
||||
{
|
||||
title: t("guide.runAndTestTask.runAndTestTitle"),
|
||||
description: t("guide.runAndTestTask.runAndTestDescription"),
|
||||
items: [
|
||||
{
|
||||
image: "/static/doc/images/9-start.png",
|
||||
title: t("guide.runAndTestTask.runTestOnce"),
|
||||
descriptions: [t("guide.runAndTestTask.clickManualTriggerToTest")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/10-1-log.png",
|
||||
title: t("guide.runAndTestTask.viewLogs"),
|
||||
descriptions: [t("guide.runAndTestTask.clickTaskToViewStatusAndLogs")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/11-1-error.png",
|
||||
title: t("guide.runAndTestTask.howToTroubleshootFailure"),
|
||||
descriptions: [t("guide.runAndTestTask.viewErrorLogs")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/11-2-error.png",
|
||||
title: t("guide.runAndTestTask.howToTroubleshootFailure"),
|
||||
descriptions: [t("guide.runAndTestTask.viewErrorLogs"), t("guide.runAndTestTask.nginxContainerNotExistFix")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/12-1-log-success.png",
|
||||
title: t("guide.runAndTestTask.executionSuccess"),
|
||||
descriptions: [t("guide.runAndTestTask.retryAfterFix")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/12-2-skip-log.png",
|
||||
title: t("guide.runAndTestTask.autoSkipAfterSuccess"),
|
||||
descriptions: [t("guide.runAndTestTask.successSkipExplanation")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/13-1-result.png",
|
||||
title: t("guide.runAndTestTask.viewCertDeploymentSuccess"),
|
||||
descriptions: [t("guide.runAndTestTask.visitNginxToSeeCert")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/13-3-download.png",
|
||||
title: t("guide.runAndTestTask.downloadCertManualDeploy"),
|
||||
descriptions: [t("guide.runAndTestTask.downloadIfNoAutoDeployPlugin")],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: t("guide.scheduleAndEmailTask.title"),
|
||||
description: t("guide.scheduleAndEmailTask.description"),
|
||||
items: [
|
||||
{
|
||||
image: "/static/doc/images/14-timer.png",
|
||||
title: t("guide.scheduleAndEmailTask.setSchedule"),
|
||||
descriptions: [t("guide.scheduleAndEmailTask.pipelineSuccessThenSchedule"), t("guide.scheduleAndEmailTask.recommendDailyRun")],
|
||||
},
|
||||
{
|
||||
image: "/static/doc/images/15-1-email.png",
|
||||
title: t("guide.scheduleAndEmailTask.setEmailNotification"),
|
||||
descriptions: [t("guide.scheduleAndEmailTask.suggestErrorAndRecoveryEmails"), t("guide.scheduleAndEmailTask.basicVersionNeedsMailServer")],
|
||||
},
|
||||
{
|
||||
title: t("guide.scheduleAndEmailTask.tutorialEndTitle"),
|
||||
descriptions: [t("guide.scheduleAndEmailTask.thanksForWatching")],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const current = ref(0);
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
function checkPlus() {
|
||||
// 事件处理代码
|
||||
notification.warn({
|
||||
message: "此为专业版功能,请升级到专业版"
|
||||
message: "此为专业版功能,请升级到专业版",
|
||||
});
|
||||
}
|
||||
el.addEventListener("click", function (event: any) {
|
||||
@@ -20,5 +20,5 @@ export default {
|
||||
checkPlus();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<div v-if="!settingStore.isComm || userStore.isAdmin" class="layout-vip isPlus" @click="openUpgrade">
|
||||
<contextHolder />
|
||||
<fs-icon icon="mingcute:vip-1-line" :title="text.title" />
|
||||
<div v-if="!settingStore.isComm || userStore.isAdmin" class="layout-vip isPlus" @click="openUpgrade">
|
||||
<contextHolder />
|
||||
<fs-icon icon="mingcute:vip-1-line" :title="text.title" />
|
||||
|
||||
<div v-if="mode !== 'icon'" class="text hidden md:block ml-0.5">
|
||||
<a-tooltip>
|
||||
<template #title> {{ text.title }}</template>
|
||||
<span class="">{{ text.name }}</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="mode !== 'icon'" class="text hidden md:block ml-0.5">
|
||||
<a-tooltip>
|
||||
<template #title> {{ text.title }}</template>
|
||||
<span class="">{{ text.name }}</span>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="tsx" setup>
|
||||
import { computed, onMounted, reactive } from "vue";
|
||||
@@ -104,7 +104,6 @@ const text = computed<Text>(() => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const expireTime = computed(() => {
|
||||
if (settingStore.isPlus) {
|
||||
return dayjs(settingStore.plusInfo.expireTime).format("YYYY-MM-DD");
|
||||
@@ -157,7 +156,6 @@ async function doActive() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const computedSiteId = computed(() => settingStore.installInfo?.siteId);
|
||||
const [modal, contextHolder] = Modal.useModal();
|
||||
const userStore = useUserStore();
|
||||
@@ -169,17 +167,16 @@ function goAccount() {
|
||||
|
||||
async function getVipTrial() {
|
||||
const res = await api.getVipTrial();
|
||||
message.success(t('vip.congratulations_vip_trial', { duration: res.duration }));
|
||||
message.success(t("vip.congratulations_vip_trial", { duration: res.duration }));
|
||||
await settingStore.init();
|
||||
}
|
||||
|
||||
|
||||
function openTrialModal() {
|
||||
Modal.destroyAll();
|
||||
|
||||
modal.confirm({
|
||||
title: t('vip.trial_modal_title'),
|
||||
okText: t('vip.trial_modal_ok_text'),
|
||||
title: t("vip.trial_modal_title"),
|
||||
okText: t("vip.trial_modal_ok_text"),
|
||||
onOk() {
|
||||
getVipTrial();
|
||||
},
|
||||
@@ -187,15 +184,14 @@ function openTrialModal() {
|
||||
content: () => {
|
||||
return (
|
||||
<div class="flex-col mt-10 mb-10">
|
||||
<div>{t('vip.trial_modal_thanks')}</div>
|
||||
<div>{t('vip.trial_modal_click_confirm')}</div>
|
||||
<div>{t("vip.trial_modal_thanks")}</div>
|
||||
<div>{t("vip.trial_modal_click_confirm")}</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function openStarModal() {
|
||||
Modal.destroyAll();
|
||||
const goGithub = () => {
|
||||
@@ -221,207 +217,176 @@ function openStarModal() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function openUpgrade() {
|
||||
if (!userStore.isAdmin) {
|
||||
message.info(t("vip.admin_only_operation"));
|
||||
return;
|
||||
}
|
||||
const placeholder = t("vip.enter_activation_code");
|
||||
const isPlus = settingStore.isPlus;
|
||||
let title = t("vip.activate_pro_business");
|
||||
if (settingStore.isComm) {
|
||||
title = t("vip.renew_business");
|
||||
} else if (settingStore.isPlus) {
|
||||
title = t("vip.renew_pro_upgrade_business");
|
||||
}
|
||||
if (!userStore.isAdmin) {
|
||||
message.info(t("vip.admin_only_operation"));
|
||||
return;
|
||||
}
|
||||
const placeholder = t("vip.enter_activation_code");
|
||||
const isPlus = settingStore.isPlus;
|
||||
let title = t("vip.activate_pro_business");
|
||||
if (settingStore.isComm) {
|
||||
title = t("vip.renew_business");
|
||||
} else if (settingStore.isPlus) {
|
||||
title = t("vip.renew_pro_upgrade_business");
|
||||
}
|
||||
|
||||
|
||||
const productInfo = settingStore.productInfo;
|
||||
const vipTypeDefine = {
|
||||
free: {
|
||||
title: t("vip.basic_edition"),
|
||||
desc: t("vip.community_free_version"),
|
||||
type: "free",
|
||||
icon: "lucide:package-open",
|
||||
privilege: [
|
||||
t("vip.unlimited_certificate_application"),
|
||||
t("vip.unlimited_domain_count"),
|
||||
t("vip.unlimited_certificate_pipelines"),
|
||||
t("vip.common_deployment_plugins"),
|
||||
t("vip.email_webhook_notifications"),
|
||||
],
|
||||
},
|
||||
plus: {
|
||||
title: t("vip.professional_edition"),
|
||||
desc: t("vip.open_source_support"),
|
||||
type: "plus",
|
||||
privilege: [
|
||||
t("vip.vip_group_priority"),
|
||||
t("vip.unlimited_site_certificate_monitoring"),
|
||||
t("vip.more_notification_methods"),
|
||||
t("vip.plugins_fully_open"),
|
||||
],
|
||||
trial: {
|
||||
title: t("vip.click_to_get_7_day_trial"),
|
||||
click: () => {
|
||||
openStarModal();
|
||||
const productInfo = settingStore.productInfo;
|
||||
const vipTypeDefine = {
|
||||
free: {
|
||||
title: t("vip.basic_edition"),
|
||||
desc: t("vip.community_free_version"),
|
||||
type: "free",
|
||||
icon: "lucide:package-open",
|
||||
privilege: [t("vip.unlimited_certificate_application"), t("vip.unlimited_domain_count"), t("vip.unlimited_certificate_pipelines"), t("vip.common_deployment_plugins"), t("vip.email_webhook_notifications")],
|
||||
},
|
||||
plus: {
|
||||
title: t("vip.professional_edition"),
|
||||
desc: t("vip.open_source_support"),
|
||||
type: "plus",
|
||||
privilege: [t("vip.vip_group_priority"), t("vip.unlimited_site_certificate_monitoring"), t("vip.more_notification_methods"), t("vip.plugins_fully_open")],
|
||||
trial: {
|
||||
title: t("vip.click_to_get_7_day_trial"),
|
||||
click: () => {
|
||||
openStarModal();
|
||||
},
|
||||
},
|
||||
icon: "stash:thumb-up",
|
||||
price: productInfo.plus.price,
|
||||
price3: `¥${productInfo.plus.price3}/3${t("vip.years")}`,
|
||||
tooltip: productInfo.plus.tooltip,
|
||||
get() {
|
||||
return (
|
||||
<a-tooltip title={t("vip.afdian_support_vip")}>
|
||||
<a-button size="small" type="primary" href="https://afdian.com/a/greper" target="_blank">
|
||||
{t("vip.get_after_support")}
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
icon: "stash:thumb-up",
|
||||
price: productInfo.plus.price,
|
||||
price3: `¥${productInfo.plus.price3}/3${t("vip.years")}`,
|
||||
tooltip: productInfo.plus.tooltip,
|
||||
get() {
|
||||
return (
|
||||
<a-tooltip title={t("vip.afdian_support_vip")}>
|
||||
<a-button size="small" type="primary" href="https://afdian.com/a/greper" target="_blank">
|
||||
{t("vip.get_after_support")}
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
comm: {
|
||||
title: t("vip.business_edition"),
|
||||
desc: t("vip.commercial_license"),
|
||||
type: "comm",
|
||||
icon: "vaadin:handshake",
|
||||
privilege: [t("vip.all_pro_privileges"), t("vip.allow_commercial_use_modify_logo_title"), t("vip.data_statistics"), t("vip.plugin_management"), t("vip.unlimited_multi_users"), t("vip.support_user_payment")],
|
||||
price: productInfo.comm.price,
|
||||
price3: `¥${productInfo.comm.price3}/3${t("vip.years")}`,
|
||||
tooltip: productInfo.comm.tooltip,
|
||||
get() {
|
||||
return <a-button size="small">{t("vip.contact_author_for_trial")}</a-button>;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const modalRef = modal.confirm({
|
||||
title,
|
||||
async onOk() {
|
||||
return await doActive();
|
||||
},
|
||||
maskClosable: true,
|
||||
okText: t("vip.activate"),
|
||||
width: 1000,
|
||||
content: () => {
|
||||
let activationCodeGetWay = (
|
||||
<span>
|
||||
<a href="https://afdian.com/a/greper" target="_blank">
|
||||
{t("vip.get_pro_code_after_support")}
|
||||
</a>
|
||||
<span> {t("vip.business_contact_author")}</span>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
comm: {
|
||||
title: t("vip.business_edition"),
|
||||
desc: t("vip.commercial_license"),
|
||||
type: "comm",
|
||||
icon: "vaadin:handshake",
|
||||
privilege: [
|
||||
t("vip.all_pro_privileges"),
|
||||
t("vip.allow_commercial_use_modify_logo_title"),
|
||||
t("vip.data_statistics"),
|
||||
t("vip.plugin_management"),
|
||||
t("vip.unlimited_multi_users"),
|
||||
t("vip.support_user_payment"),
|
||||
],
|
||||
price: productInfo.comm.price,
|
||||
price3: `¥${productInfo.comm.price3}/3${t("vip.years")}`,
|
||||
tooltip: productInfo.comm.tooltip,
|
||||
get() {
|
||||
return <a-button size="small">{t("vip.contact_author_for_trial")}</a-button>;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const modalRef = modal.confirm({
|
||||
title,
|
||||
async onOk() {
|
||||
return await doActive();
|
||||
},
|
||||
maskClosable: true,
|
||||
okText: t("vip.activate"),
|
||||
width: 1000,
|
||||
content: () => {
|
||||
let activationCodeGetWay = (
|
||||
<span>
|
||||
<a href="https://afdian.com/a/greper" target="_blank">
|
||||
{t("vip.get_pro_code_after_support")}
|
||||
</a>
|
||||
<span> {t("vip.business_contact_author")}</span>
|
||||
</span>
|
||||
);
|
||||
const vipLabel = settingStore.vipLabel;
|
||||
const slots = [];
|
||||
for (const key in vipTypeDefine) {
|
||||
// @ts-ignore
|
||||
const item = vipTypeDefine[key];
|
||||
const vipBlockClass = `vip-block ${key === settingStore.plusInfo.vipType ? "current" : ""}`;
|
||||
slots.push(
|
||||
<a-col span={8}>
|
||||
<div class={vipBlockClass}>
|
||||
<h3 class="block-header ">
|
||||
<span class="flex-o">{item.title}</span>
|
||||
{item.trial && (
|
||||
<span class="trial">
|
||||
<a-tooltip title={item.trial.message}>
|
||||
<a onClick={item.trial.click}>{item.trial.title}</a>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<div style="color:green" class="flex-o">
|
||||
<fs-icon icon={item.icon} class="fs-16 flex-o" />
|
||||
{item.desc}
|
||||
</div>
|
||||
<ul class="flex-1 privilege">
|
||||
{item.privilege.map((p: string) => (
|
||||
<li class="flex-baseline">
|
||||
<fs-icon class="color-green" icon="ion:checkmark-sharp" />
|
||||
{p}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div class="footer flex-between flex-vc">
|
||||
<div class="price-show">
|
||||
{item.price && (
|
||||
<span class="flex">
|
||||
<span class="-text">¥{item.price}</span>
|
||||
<span>/</span>
|
||||
{t("vip.year")}
|
||||
<a-tooltip class="ml-5" title={item.price3}>
|
||||
<fs-icon class="pointer color-red" icon="ic:outline-discount"></fs-icon>
|
||||
const vipLabel = settingStore.vipLabel;
|
||||
const slots = [];
|
||||
for (const key in vipTypeDefine) {
|
||||
// @ts-ignore
|
||||
const item = vipTypeDefine[key];
|
||||
const vipBlockClass = `vip-block ${key === settingStore.plusInfo.vipType ? "current" : ""}`;
|
||||
slots.push(
|
||||
<a-col span={8}>
|
||||
<div class={vipBlockClass}>
|
||||
<h3 class="block-header ">
|
||||
<span class="flex-o">{item.title}</span>
|
||||
{item.trial && (
|
||||
<span class="trial">
|
||||
<a-tooltip title={item.trial.message}>
|
||||
<a onClick={item.trial.click}>{item.trial.title}</a>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
)}
|
||||
{!item.price && (
|
||||
<span>
|
||||
<span class="price-text">{t("vip.freee")}</span>
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<div style="color:green" class="flex-o">
|
||||
<fs-icon icon={item.icon} class="fs-16 flex-o" />
|
||||
{item.desc}
|
||||
</div>
|
||||
<div class="get-show">{item.get && <div>{item.get()}</div>}</div>
|
||||
<ul class="flex-1 privilege">
|
||||
{item.privilege.map((p: string) => (
|
||||
<li class="flex-baseline">
|
||||
<fs-icon class="color-green" icon="ion:checkmark-sharp" />
|
||||
{p}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<div class="footer flex-between flex-vc">
|
||||
<div class="price-show">
|
||||
{item.price && (
|
||||
<span class="flex">
|
||||
<span class="-text">¥{item.price}</span>
|
||||
<span>/</span>
|
||||
{t("vip.year")}
|
||||
<a-tooltip class="ml-5" title={item.price3}>
|
||||
<fs-icon class="pointer color-red" icon="ic:outline-discount"></fs-icon>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
)}
|
||||
{!item.price && (
|
||||
<span>
|
||||
<span class="price-text">{t("vip.freee")}</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div class="get-show">{item.get && <div>{item.get()}</div>}</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div class="mt-10 mb-10 vip-active-modal">
|
||||
{productInfo.notice && (
|
||||
<div class="mb-10">
|
||||
<a-alert type="error" message={productInfo.notice}></a-alert>
|
||||
</div>
|
||||
)}
|
||||
<div class="vip-type-vs">
|
||||
<a-row gutter={20}>{slots}</a-row>
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
<h3 class="block-header">{isPlus ? t("vip.renew") : t("vip.activate_immediately")}</h3>
|
||||
<div>{isPlus ? `${t("vip.current")} ${vipLabel} ${t("vip.activated_expire_time")}` + dayjs(settingStore.plusInfo.expireTime).format("YYYY-MM-DD") : ""}</div>
|
||||
<div class="mt-10">
|
||||
<div class="flex-o w-100">
|
||||
<span>{t("vip.site_id")}:</span>
|
||||
<fs-copyable class="flex-1" v-model={computedSiteId.value}></fs-copyable>
|
||||
</div>
|
||||
<a-input class="mt-10" v-model:value={formState.code} placeholder={placeholder} />
|
||||
<a-input class="mt-10" v-model:value={formState.inviteCode} placeholder={t("vip.invite_code_optional")} />
|
||||
</div>
|
||||
|
||||
<div class="mt-10">
|
||||
{t("vip.no_activation_code")}
|
||||
{activationCodeGetWay}
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
{t("vip.activation_code_one_use")}
|
||||
<a onClick={goAccount}>{t("vip.bind_account")}</a>,{t("vip.transfer_vip")}
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div class="mt-10 mb-10 vip-active-modal">
|
||||
{productInfo.notice && (
|
||||
<div class="mb-10">
|
||||
<a-alert type="error" message={productInfo.notice}></a-alert>
|
||||
</div>
|
||||
)}
|
||||
<div class="vip-type-vs">
|
||||
<a-row gutter={20}>{slots}</a-row>
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
<h3 class="block-header">{isPlus ? t("vip.renew") : t("vip.activate_immediately")}</h3>
|
||||
<div>
|
||||
{isPlus
|
||||
? `${t("vip.current")} ${vipLabel} ${t("vip.activated_expire_time")}` +
|
||||
dayjs(settingStore.plusInfo.expireTime).format("YYYY-MM-DD")
|
||||
: ""}
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
<div class="flex-o w-100">
|
||||
<span>{t("vip.site_id")}:</span>
|
||||
<fs-copyable class="flex-1" v-model={computedSiteId.value}></fs-copyable>
|
||||
</div>
|
||||
<a-input class="mt-10" v-model:value={formState.code} placeholder={placeholder} />
|
||||
<a-input
|
||||
class="mt-10"
|
||||
v-model:value={formState.inviteCode}
|
||||
placeholder={t("vip.invite_code_optional")}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-10">
|
||||
{t("vip.no_activation_code")}
|
||||
{activationCodeGetWay}
|
||||
</div>
|
||||
<div class="mt-10">
|
||||
{t("vip.activation_code_one_use")}<a onClick={goAccount}>{t("vip.bind_account")}</a>
|
||||
,{t("vip.transfer_vip")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
mitter.on("openVipModal", () => {
|
||||
@@ -434,75 +399,76 @@ onMounted(() => {
|
||||
|
||||
<style lang="less">
|
||||
.layout-vip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
|
||||
&.isPlus {
|
||||
color: #c5913f;
|
||||
}
|
||||
&.isPlus {
|
||||
color: #c5913f;
|
||||
}
|
||||
|
||||
.text {}
|
||||
.text {
|
||||
}
|
||||
}
|
||||
|
||||
.vip-active-modal {
|
||||
.vip-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 5px;
|
||||
height: 250px;
|
||||
.vip-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 5px;
|
||||
height: 250px;
|
||||
|
||||
//background-color: rgba(250, 237, 167, 0.79);
|
||||
&.current {
|
||||
border-color: green;
|
||||
}
|
||||
//background-color: rgba(250, 237, 167, 0.79);
|
||||
&.current {
|
||||
border-color: green;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
padding: 0px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.block-header {
|
||||
padding: 0px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.trial {
|
||||
font-size: 12px;
|
||||
font-wight: 400;
|
||||
}
|
||||
}
|
||||
.trial {
|
||||
font-size: 12px;
|
||||
font-wight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding-top: 5px;
|
||||
margin-top: 0px;
|
||||
border-top: 1px solid #eee;
|
||||
.footer {
|
||||
padding-top: 5px;
|
||||
margin-top: 0px;
|
||||
border-top: 1px solid #eee;
|
||||
|
||||
.price-text {
|
||||
font-size: 18px;
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
.price-text {
|
||||
font-size: 18px;
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: unset;
|
||||
margin-left: 0px;
|
||||
padding: 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: unset;
|
||||
margin-left: 0px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.color-green {
|
||||
color: green;
|
||||
}
|
||||
.color-green {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.vip-type-vs {
|
||||
.privilege {
|
||||
.fs-icon {
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
.vip-type-vs {
|
||||
.privilege {
|
||||
.fs-icon {
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
|
||||
.fs-icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.fs-icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user