9090 @click-left-icon =" showIconPopup"
9191 />
9292 </nut-form-item >
93- <nut-form-item
94- required
95- :label =" $t(`specificWord.type`)"
96- prop =" type"
97- >
98- <div class =" radio-wrapper" >
99- <nut-radiogroup direction =" horizontal" v-model =" form.type" >
100- <nut-radio shape =" button" label =" mihomoProfile" >
101- {{ $t(`filePage.type.mihomoProfile`) }}
102- </nut-radio >
103- <nut-radio shape =" button" label =" file" >
104- {{ $t(`specificWord.file`) }}
105- </nut-radio >
106- </nut-radiogroup >
107- </div >
108- </nut-form-item >
93+ <nut-form-item required :label =" $t(`specificWord.type`)" prop =" type" >
94+ <div class =" radio-wrapper" >
95+ <nut-radiogroup v-model =" form.type" direction =" horizontal" >
96+ <nut-radio shape =" button" label =" mihomoProfile" >
97+ {{ $t(`filePage.type.mihomoProfile`) }}
98+ </nut-radio >
99+ <nut-radio shape =" button" label =" file" >
100+ {{ $t(`specificWord.file`) }}
101+ </nut-radio >
102+ </nut-radiogroup >
103+ </div >
104+ </nut-form-item >
109105 <template v-if =" form .type === ' mihomoProfile' " >
110106 <nut-form-item
111107 required
112108 :label =" $t(`editorPage.subConfig.basic.source.label`)"
113109 prop =" source"
114110 >
115111 <div class =" radio-wrapper" >
116- <nut-radiogroup direction =" horizontal" v-model =" form.sourceType" >
112+ <nut-radiogroup
113+ v-model =" form.sourceType"
114+ direction =" horizontal"
115+ @change =" handleTypeChange"
116+ >
117117 <nut-radio shape =" button" label =" subscription" >
118118 {{ $t(`specificWord.singleSub`) }}
119119 </nut-radio >
134134 },
135135 ]"
136136 >
137- <input
137+ <nut- input
138138 class =" nut-input-text"
139+ :border =" false"
139140 data-1p-ignore
140141 @blur =" customerBlurValidate('name')"
142+ input-align =" right"
141143 v-model.trim =" form.sourceName"
142144 :placeholder =" (form.sourceType === 'subscription' ? $t(`specificWord.singleSub`) : $t(`specificWord.collectionSub`))+$t(`editorPage.subConfig.basic.name.label`)"
143145 type =" text"
146+ right-icon =" rect-right"
147+ @click-right-icon =" showSourceName"
144148 />
145149 </nut-form-item >
146150 </template >
353357 />
354358 <icon-popup v-model:visible =" iconPopupVisible" ref =" iconPopupRef" @setIcon =" setIcon" >
355359 </icon-popup >
360+ <!-- 订阅名称 -->
361+ <nut-picker
362+ :key =" sourceNameColumns.length"
363+ v-model =" selectSourceName"
364+ v-model:visible =" showSourceNamePicker"
365+ :columns =" sourceNameColumns"
366+ :title =" $t(`editorPage.subConfig.sourceNamePicker.title`)"
367+ :cancel-text =" $t(`editorPage.subConfig.sourceNamePicker.cancel`)"
368+ :ok-text =" $t(`editorPage.subConfig.sourceNamePicker.confirm`)"
369+ @confirm =" handleSourceNameConfirm"
370+ >
371+ <div v-if =" !sourceNameColumns.length" class =" empty-tips" @click =" goAddSub" >
372+ <p >{{ t(`editorPage.subConfig.sourceNamePicker.emptyTips`) }}</p >
373+ </div >
374+ </nut-picker >
356375</template >
357376
358377<script lang="ts" setup>
@@ -404,6 +423,7 @@ const { showNotify } = useAppNotifyStore();
404423const globalStore = useGlobalStore ();
405424const settingsStore = useSettingsStore ();
406425const { bottomSafeArea } = storeToRefs (globalStore );
426+ const { subs, collections } = storeToRefs (subsStore );
407427const { appearanceSetting } = storeToRefs (settingsStore );
408428const padding = bottomSafeArea .value + " px" ;
409429
@@ -426,13 +446,44 @@ const form = reactive<any>({
426446 icon: " " ,
427447 source: " local" ,
428448 sourceType: " collection" ,
449+ sourceName: " " ,
429450 process: [],
430451 type: configName === ' UNTITLED-mihomoProfile' ? ' mihomoProfile' : ' file' ,
431452});
432453provide (" form" , form );
433454// 排除非动作卡片
434455const ignoreList = [" Quick Setting Operator" ];
435-
456+ // 订阅名称
457+ const showSourceNamePicker = ref (false );
458+ const selectSourceName = computed (() => [form .sourceName ]);
459+ const sourceNameColumns = computed (() => {
460+ const list =
461+ form .sourceType === " collection" ? subsStore .collections : subsStore .subs ;
462+ if (! list || list .length === 0 ) {
463+ return [];
464+ }
465+ return list .map ((item ) => {
466+ return {
467+ text: item .displayName ? ` ${item .displayName } ` : item .name ,
468+ value: item .name ,
469+ };
470+ });
471+ });
472+ const handleTypeChange = (val ) => {
473+ form .sourceName = " " ;
474+ };
475+ const showSourceName = () => {
476+ showSourceNamePicker .value = true ;
477+ };
478+ const handleSourceNameConfirm = ({ selectedValue , selectedOptions }) => {
479+ if (selectedValue [0 ]) {
480+ form .sourceName = selectedValue [0 ];
481+ }
482+ showSourceNamePicker .value = false ;
483+ };
484+ const goAddSub = () => {
485+ router .push (" /subs" );
486+ };
436487watch (
437488 () => cmStore .EditCode [" FileEditer" ],
438489 (newCode ) => {
@@ -499,6 +550,7 @@ watchEffect(() => {
499550 }
500551 // 标记 加载完成
501552 isInit .value = true ;
553+ console .log (' form' , form );
502554 return ;
503555 }
504556});
@@ -810,6 +862,16 @@ const handleEditGlobalClick = () => {
810862 }
811863 }
812864 }
865+ :deep(.nut-form-item__label ) {
866+ width : auto ;
867+ }
868+ :deep(.nut-input-text ){
869+ .nut-input-inner {
870+ .nut-input-right-icon {
871+ margin-left : 10px ;
872+ }
873+ }
874+ }
813875}
814876.actions-title-wrapper {
815877 display : flex ;
@@ -818,7 +880,6 @@ const handleEditGlobalClick = () => {
818880 color : var (--comment-text-color );
819881 .doc {
820882 margin-left : 4px ;
821-
822883 color : var (--primary-text-color );
823884 }
824885}
@@ -924,4 +985,18 @@ const handleEditGlobalClick = () => {
924985 }
925986 }
926987}
988+
989+ .empty-tips {
990+ padding : 40px 20px ;
991+ display : flex ;
992+ align-items : center ;
993+ justify-content : center ;
994+ background : var (--background-color );
995+ p {
996+ // color: var(--primary-text-color);
997+ color : var (--comment-text-color );
998+ font-size : 14px ;
999+ text-align : center ;
1000+ }
1001+ }
9271002 </style >
0 commit comments