Browse Source

显示引导显示

lex 11 months ago
parent
commit
a95b28f927
1 changed files with 39 additions and 22 deletions
  1. 39 22
      src/page-instrument/custom-plugins/guide-driver/index.tsx

+ 39 - 22
src/page-instrument/custom-plugins/guide-driver/index.tsx

@@ -16,6 +16,8 @@ const endGuide = (guideInfo: any) => {
  * 按钮状态
  */
 type ButtonStatus = {
+  /** 是否显示播放按钮 */
+  playBtnStatus?: Boolean;
   /** 声部状态 */
   subjectStatus?: Boolean;
   /** 练习模式 */
@@ -28,6 +30,8 @@ type ButtonStatus = {
   titleType?: String;
   /** 原声 true 范唱 false */
   originPlayType?: Boolean;
+  /** 是否显示原音 */
+  originBtnStatus?: Boolean;
 };
 
 /** 练习模式 */
@@ -54,6 +58,15 @@ export const PractiseDriver = defineComponent({
 
     const driverOptions = (): Config => {
       let length = 10;
+
+      if (!props.statusAll.playBtnStatus) {
+        length -= 1;
+      }
+
+      if (!props.statusAll.originBtnStatus) {
+        length -= 1;
+      }
+
       // 显示指法
       if (!state.setting.displayFingering) {
         length -= 1;
@@ -96,25 +109,27 @@ export const PractiseDriver = defineComponent({
         onHighlighted: () => {
           driverNextStatus.value = false;
         },
-        steps: [
-          {
-            element: ".driver-1",
-            popover: {
-              title: "",
-              description: "",
-              popoverClass: "popoverClass popoverClass1",
-              align: "end",
-              side: "top",
-              nextBtnText: `下一步 (1/${length})`,
-              showButtons: ["next"],
-              onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
-                options.config.stageRadius = 1000;
-                options.config.stagePadding = 0;
-              },
+        steps: [] as DriveStep[],
+      };
+
+      if (props.statusAll.playBtnStatus) {
+        options.steps?.push({
+          element: ".driver-1",
+          popover: {
+            title: "",
+            description: "",
+            popoverClass: "popoverClass popoverClass1",
+            align: "end",
+            side: "top",
+            nextBtnText: `下一步 (1/${length})`,
+            showButtons: ["next"],
+            onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
+              options.config.stageRadius = 1000;
+              options.config.stagePadding = 0;
             },
           },
-        ] as DriveStep[],
-      };
+        });
+      }
 
       if (props.statusAll.playType) {
         options.steps?.push({
@@ -134,8 +149,8 @@ export const PractiseDriver = defineComponent({
         });
       }
 
-      options.steps?.push(
-        {
+      if (props.statusAll.originBtnStatus) {
+        options.steps?.push({
           element: ".driver-3",
           popover: {
             title: "",
@@ -149,7 +164,9 @@ export const PractiseDriver = defineComponent({
               driverInitialPosition(popover, options);
             },
           },
-        },
+        });
+      }
+      options.steps?.push(
         {
           element: ".driver-4",
           popover: {
@@ -158,7 +175,7 @@ export const PractiseDriver = defineComponent({
             popoverClass: "popoverClass popoverClass4",
             align: "start",
             side: "top",
-            nextBtnText: `下一步 (${options.steps.length + 2}/${length})`,
+            nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
             showButtons: ["next"],
             onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
               driverInitialPosition(popover, options);
@@ -173,7 +190,7 @@ export const PractiseDriver = defineComponent({
             popoverClass: "popoverClass popoverClass5",
             align: "start",
             side: "top",
-            nextBtnText: `下一步 (${options.steps.length + 3}/${length})`,
+            nextBtnText: `下一步 (${options.steps.length + 2}/${length})`,
             showButtons: ["next"],
             onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
               driverInitialPosition(popover, options);