mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
feat: 添加自定义测试上下文和更新模板设置
- 在 AutoActionEditor 和 TemplateSettings 组件中添加 customTestContext 属性 - 更新 CheckInSettings 组件以使用 customTestContext - 移除 TemplateEditor 中的操作按钮部分
This commit is contained in:
@@ -26,6 +26,10 @@ const props = defineProps({
|
||||
hideEnabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
customTestContext: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,7 +62,7 @@ const TriggerSettings = getTriggerSettings();
|
||||
<div class="auto-action-editor">
|
||||
<NSpace vertical>
|
||||
<!-- 模板设置 - 移到最上面 -->
|
||||
<TemplateSettings :action="action" />
|
||||
<TemplateSettings :action="action" :custom-test-context="customTestContext" />
|
||||
|
||||
<!-- 基本设置 -->
|
||||
<BasicSettings
|
||||
|
||||
@@ -380,21 +380,6 @@ function insertExample(template: string) {
|
||||
</transition>
|
||||
</NFlex>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<NFlex
|
||||
justify="end"
|
||||
:size="12"
|
||||
>
|
||||
<NButton
|
||||
type="default"
|
||||
size="small"
|
||||
class="btn-with-transition"
|
||||
@click="convertPlaceholders"
|
||||
>
|
||||
占位符转表达式
|
||||
</NButton>
|
||||
</NFlex>
|
||||
|
||||
<!-- 模板示例 -->
|
||||
<NCollapse
|
||||
class="template-examples"
|
||||
|
||||
@@ -188,23 +188,25 @@
|
||||
</template>
|
||||
</NAlert>
|
||||
</div>
|
||||
<NDivider title-placement="left">
|
||||
签到成功回复
|
||||
</NDivider>
|
||||
<AutoActionEditor
|
||||
:action="config.successAction"
|
||||
:hide-name="true"
|
||||
:hide-enabled="true"
|
||||
:custom-test-context="customTestContext"
|
||||
/>
|
||||
|
||||
<!-- 使用 AutoActionEditor 编辑 action 配置 -->
|
||||
<NFormItem label="签到成功回复">
|
||||
<AutoActionEditor
|
||||
:action="config.successAction"
|
||||
:hide-name="true"
|
||||
:hide-enabled="true"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
||||
<NFormItem label="签到冷却回复">
|
||||
<AutoActionEditor
|
||||
:action="config.cooldownAction"
|
||||
:hide-name="true"
|
||||
:hide-enabled="true"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NDivider title-placement="left">
|
||||
签到冷却回复
|
||||
</NDivider>
|
||||
<AutoActionEditor
|
||||
:action="config.cooldownAction"
|
||||
:hide-name="true"
|
||||
:hide-enabled="true"
|
||||
:custom-test-context="customTestContext"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<NFormItem>
|
||||
@@ -398,6 +400,15 @@ const config = autoActionStore.checkInModule.checkInConfig;
|
||||
const accountInfo = useAccount();
|
||||
const isLoading = ref(false);
|
||||
|
||||
const customTestContext = ref({
|
||||
checkin: {
|
||||
points: 0,
|
||||
consecutiveDays: 0,
|
||||
todayRank: 0,
|
||||
time: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
// 签到模板的特定占位符
|
||||
const checkInPlaceholders = [
|
||||
{ name: '{{checkin.points}}', description: '获得的总积分' },
|
||||
|
||||
@@ -8,6 +8,10 @@ const props = defineProps({
|
||||
action: {
|
||||
type: Object as () => AutoActionItem,
|
||||
required: true
|
||||
},
|
||||
customTestContext: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
}
|
||||
});
|
||||
|
||||
@@ -61,6 +65,7 @@ function handleTemplateUpdate(payload: { index: number, value: string }) {
|
||||
:title="templateTitle"
|
||||
:description="templateDescription"
|
||||
:check-length="action.actionType === ActionType.SEND_DANMAKU"
|
||||
:custom-test-context="customTestContext"
|
||||
class="template-editor"
|
||||
@update:template="handleTemplateUpdate"
|
||||
/>
|
||||
|
||||
1
src/components.d.ts
vendored
1
src/components.d.ts
vendored
@@ -22,6 +22,7 @@ declare module 'vue' {
|
||||
NAvatar: typeof import('naive-ui')['NAvatar']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCard: typeof import('naive-ui')['NCard']
|
||||
NDi: typeof import('naive-ui')['NDi']
|
||||
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||
NFlex: typeof import('naive-ui')['NFlex']
|
||||
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
|
||||
|
||||
Reference in New Issue
Block a user