index.tsx 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417
  1. import { PropType, Teleport, defineComponent, nextTick, onMounted, onUnmounted, ref } from "vue";
  2. import { Config, DriveStep, PopoverDOM, State, driver } from "driver.js";
  3. import "driver.js/dist/driver.css";
  4. import state, { IPlatform } from "/src/state";
  5. import { getGuidance, setGuidance } from "../guide-page/api";
  6. const endGuide = (guideInfo: any) => {
  7. try {
  8. // setGuidance({ guideTag: "guideInfo", guideValue: JSON.stringify(guideInfo) });
  9. localStorage.setItem("guideInfo", JSON.stringify(guideInfo));
  10. } catch (e) {
  11. console.log(e);
  12. }
  13. };
  14. /**
  15. * 按钮状态
  16. */
  17. type ButtonStatus = {
  18. /** 是否显示播放按钮 */
  19. playBtnStatus?: Boolean;
  20. /** 声部状态 */
  21. subjectStatus?: Boolean;
  22. /** 练习模式 */
  23. modelTypeStatus?: Boolean;
  24. /** 播放模式 演唱 演奏 */
  25. playType?: Boolean;
  26. /** 返回和标题 */
  27. backTitle?: Boolean;
  28. /** 返回显示的标题类型 文本 TEXT 按钮 IMG */
  29. titleType?: String;
  30. /** 原声 true 范唱 false */
  31. originPlayType?: Boolean;
  32. /** 是否显示原音 */
  33. originBtnStatus?: Boolean;
  34. };
  35. /** 练习模式 */
  36. export const PractiseDriver = defineComponent({
  37. name: "PractiseDriver",
  38. props: {
  39. // 按钮状态
  40. statusAll: {
  41. type: Object as PropType<ButtonStatus>,
  42. default: () => {},
  43. },
  44. },
  45. setup(props) {
  46. const driverNextStatus = ref(false);
  47. // 初始化部分引导位置
  48. const driverInitialPosition = (popover: PopoverDOM, options: { config: Config; state: State }) => {
  49. options.config.stageRadius = 5;
  50. options.config.stagePadding = 8;
  51. try {
  52. const rect = options.state.activeElement?.getBoundingClientRect();
  53. popover.wrapper.style.marginLeft = -(rect?.width || 0) / 2 + 4 + "px";
  54. } catch {}
  55. };
  56. const driverOptions = (): Config => {
  57. let length = 10;
  58. if (!props.statusAll.playBtnStatus) {
  59. length -= 1;
  60. }
  61. if (!props.statusAll.originBtnStatus) {
  62. length -= 1;
  63. }
  64. // 显示指法
  65. if (!state.setting.displayFingering) {
  66. length -= 1;
  67. }
  68. // 声部
  69. if (!props.statusAll.subjectStatus) {
  70. length -= 1;
  71. }
  72. if (!props.statusAll.playType) {
  73. length -= 1;
  74. }
  75. // pc端不显示标题和模式切换引导
  76. if (state.platform === IPlatform.PC) {
  77. length -= 2;
  78. } else {
  79. // 判断是否有标题
  80. if (!props.statusAll.backTitle || props.statusAll.titleType === "NONE") {
  81. length -= 1;
  82. }
  83. // 练习模式
  84. if (!props.statusAll.modelTypeStatus) {
  85. length -= 1;
  86. }
  87. }
  88. console.log(props.statusAll, "statusAll", length, state.setting.displayFingering);
  89. let options: Config = {
  90. showProgress: false,
  91. allowClose: false,
  92. popoverOffset: 3,
  93. disableActiveInteraction: true,
  94. onCloseClick: () => {
  95. onDriverClose();
  96. },
  97. onHighlightStarted: () => {
  98. driverNextStatus.value = true;
  99. },
  100. onHighlighted: () => {
  101. driverNextStatus.value = false;
  102. },
  103. steps: [] as DriveStep[],
  104. };
  105. if (props.statusAll.playBtnStatus) {
  106. options.steps?.push({
  107. element: ".driver-1",
  108. popover: {
  109. title: "",
  110. description: "",
  111. popoverClass: "popoverClass popoverClass1",
  112. align: "end",
  113. side: "top",
  114. nextBtnText: `下一步 (1/${length})`,
  115. showButtons: ["next"],
  116. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  117. options.config.stageRadius = 1000;
  118. options.config.stagePadding = 0;
  119. },
  120. },
  121. });
  122. }
  123. options.steps?.push({
  124. element: ".driver-9",
  125. popover: {
  126. title: "",
  127. description: "",
  128. popoverClass: "popoverClass popoverClass9",
  129. align: "end",
  130. side: "bottom",
  131. nextBtnText: `下一步 (2/${length})`,
  132. showButtons: ["next"],
  133. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  134. driverInitialPosition(popover, options);
  135. },
  136. },
  137. });
  138. if (props.statusAll.playType) {
  139. options.steps?.push({
  140. element: ".driver-2",
  141. popover: {
  142. title: "",
  143. description: "",
  144. popoverClass: "popoverClass popoverClass2",
  145. align: "start",
  146. side: "top",
  147. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
  148. showButtons: ["next"],
  149. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  150. driverInitialPosition(popover, options);
  151. },
  152. },
  153. });
  154. }
  155. if (props.statusAll.originBtnStatus) {
  156. options.steps?.push({
  157. element: ".driver-3",
  158. popover: {
  159. title: "",
  160. description: "",
  161. popoverClass: props.statusAll.originPlayType ? "popoverClass popoverClass3" : "popoverClass popoverClass11",
  162. align: "end",
  163. side: "bottom",
  164. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
  165. showButtons: ["next"],
  166. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  167. driverInitialPosition(popover, options);
  168. },
  169. },
  170. });
  171. }
  172. options.steps?.push(
  173. {
  174. element: ".driver-4",
  175. popover: {
  176. title: "",
  177. description: "",
  178. popoverClass: "popoverClass popoverClass4",
  179. align: "end",
  180. side: "bottom",
  181. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
  182. showButtons: ["next"],
  183. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  184. driverInitialPosition(popover, options);
  185. },
  186. },
  187. },
  188. {
  189. element: ".driver-5",
  190. popover: {
  191. title: "",
  192. description: "",
  193. popoverClass: "popoverClass popoverClass5",
  194. align: "end",
  195. side: "bottom",
  196. nextBtnText: `下一步 (${options.steps.length + 2}/${length})`,
  197. showButtons: ["next"],
  198. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  199. driverInitialPosition(popover, options);
  200. },
  201. },
  202. }
  203. );
  204. if (props.statusAll.subjectStatus) {
  205. options.steps?.push({
  206. element: ".driver-10",
  207. popover: {
  208. title: "",
  209. description: "",
  210. popoverClass: "popoverClass popoverClass10",
  211. align: "end",
  212. side: "bottom",
  213. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
  214. showButtons: ["next"],
  215. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  216. driverInitialPosition(popover, options);
  217. },
  218. },
  219. });
  220. }
  221. options.steps?.push({
  222. element: ".driver-5-1",
  223. popover: {
  224. title: "",
  225. description: "",
  226. popoverClass: "popoverClass popoverClass5-1",
  227. align: "end",
  228. side: "bottom",
  229. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`,
  230. showButtons: ["next"],
  231. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  232. driverInitialPosition(popover, options);
  233. },
  234. },
  235. });
  236. if (state.platform === IPlatform.PC) {
  237. options.steps?.push({
  238. element: ".driver-6",
  239. popover: {
  240. title: "",
  241. description: "",
  242. popoverClass: "popoverClass popoverClass6",
  243. align: "end",
  244. side: "bottom",
  245. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`, //"下一步6/" + length,
  246. showButtons: ["next"],
  247. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  248. driverInitialPosition(popover, options);
  249. },
  250. },
  251. });
  252. } else {
  253. // 判断设置之后是否还有引导
  254. if (!state.setting.displayFingering && !props.statusAll.backTitle && !props.statusAll.modelTypeStatus) {
  255. options.steps?.push({
  256. element: ".driver-6",
  257. popover: {
  258. title: "",
  259. description: "",
  260. popoverClass: "popoverClass popoverClass6 popoverClose",
  261. align: "start",
  262. side: "top",
  263. prevBtnText: "再看一遍",
  264. doneBtnText: "完成",
  265. showButtons: ["next", "previous"],
  266. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  267. driverInitialPosition(popover, options);
  268. },
  269. onPrevClick: () => {
  270. driverObj.drive(0);
  271. },
  272. onNextClick: () => {
  273. onDriverClose();
  274. },
  275. },
  276. });
  277. } else if (state.setting.displayFingering && !props.statusAll.backTitle && !props.statusAll.modelTypeStatus) {
  278. options.steps?.push({
  279. element: ".driver-6",
  280. popover: {
  281. title: "",
  282. description: "",
  283. popoverClass: "popoverClass popoverClass6",
  284. align: "end",
  285. side: "bottom",
  286. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`, //"下一步6/" + length,
  287. showButtons: ["next"],
  288. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  289. driverInitialPosition(popover, options);
  290. },
  291. },
  292. });
  293. } else if (props.statusAll.backTitle && !props.statusAll.modelTypeStatus) {
  294. options.steps?.push({
  295. element: ".driver-6",
  296. popover: {
  297. title: "",
  298. description: "",
  299. popoverClass: "popoverClass popoverClass6",
  300. align: "end",
  301. side: "bottom",
  302. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`, //"下一步6/" + length,
  303. showButtons: ["next"],
  304. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  305. driverInitialPosition(popover, options);
  306. },
  307. },
  308. });
  309. options.steps?.push({
  310. //props.statusAll.titleType === "TEXT" ? ".driver-8 .van-notice-bar__content" :
  311. element: ".driver-8",
  312. popover: {
  313. title: "",
  314. description: "",
  315. popoverClass: "popoverClass popoverClass8 popoverClose",
  316. align: "start",
  317. side: "bottom",
  318. prevBtnText: "再看一遍",
  319. doneBtnText: "完成",
  320. showButtons: ["next", "previous"],
  321. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  322. driverInitialPosition(popover, options);
  323. const rect = options.state.activeElement?.getBoundingClientRect();
  324. popover.wrapper.style.marginLeft = (rect?.width || 0) / 2 + 4 + "px";
  325. },
  326. onPrevClick: () => {
  327. driverObj.drive(0);
  328. },
  329. onNextClick: () => {
  330. onDriverClose();
  331. },
  332. },
  333. });
  334. } else {
  335. options.steps?.push({
  336. element: ".driver-6",
  337. popover: {
  338. title: "",
  339. description: "",
  340. popoverClass: "popoverClass popoverClass6",
  341. align: "end",
  342. side: "bottom",
  343. nextBtnText: `下一步 (${options.steps.length + 1}/${length})`, //"下一步6/" + length,
  344. showButtons: ["next"],
  345. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  346. driverInitialPosition(popover, options);
  347. },
  348. },
  349. });
  350. if (props.statusAll.backTitle) {
  351. options.steps?.push({
  352. // .van-notice-bar__content
  353. // element: ".driver-8 .van-notice-bar__content",
  354. // props.statusAll.titleType === "TEXT" ? ".driver-8 .van-notice-bar__content" :
  355. element: ".driver-8",
  356. popover: {
  357. title: "",
  358. description: "",
  359. popoverClass: "popoverClass popoverClass8 popoverClose",
  360. align: "start",
  361. side: "bottom",
  362. prevBtnText: "再看一遍",
  363. doneBtnText: "完成",
  364. showButtons: ["next", "previous"],
  365. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  366. driverInitialPosition(popover, options);
  367. const rect = options.state.activeElement?.getBoundingClientRect();
  368. popover.wrapper.style.marginLeft = (rect?.width || 0) / 2 + 4 + "px";
  369. },
  370. onPrevClick: () => {
  371. driverObj.drive(0);
  372. },
  373. onNextClick: () => {
  374. onDriverClose();
  375. },
  376. },
  377. });
  378. }
  379. }
  380. }
  381. return options;
  382. };
  383. let driverObj: any;
  384. const handleClickOutside = (event: any) => {
  385. // 如果高亮没有结束则下进行下一步
  386. if (driverNextStatus.value) return;
  387. if (driverObj.isActive() && (event.target.nodeName === "path" || event.target.classList.contains("driver-popover") || event.target.classList.contains("driver-overlay"))) {
  388. if (driverObj.isLastStep()) {
  389. onDriverClose();
  390. } else {
  391. driverObj.moveNext(); // 跳转到下一步
  392. }
  393. }
  394. };
  395. const guideInfo = ref({} as any);
  396. const showCloseBtn = ref(false);
  397. const getAllGuidance = async () => {
  398. try {
  399. // const res = await getGuidance({ guideTag: "guideInfo" });
  400. const res = localStorage.getItem("guideInfo");
  401. if (res) {
  402. guideInfo.value = JSON.parse(res) || null;
  403. } else {
  404. guideInfo.value = {};
  405. }
  406. if (!(guideInfo.value && guideInfo.value.practiseDriver)) {
  407. document.addEventListener("click", handleClickOutside, true);
  408. driverObj = driver(driverOptions());
  409. nextTick(() => {
  410. driverObj.drive();
  411. showCloseBtn.value = true;
  412. state.hasDriverPop = true;
  413. });
  414. }
  415. } catch (e) {
  416. console.log(e);
  417. }
  418. };
  419. getAllGuidance();
  420. // 结束关闭弹窗
  421. const onDriverClose = () => {
  422. if (!guideInfo.value) {
  423. guideInfo.value = { practiseDriver: true };
  424. } else {
  425. guideInfo.value.practiseDriver = true;
  426. }
  427. endGuide(guideInfo.value);
  428. driverObj.destroy();
  429. document.querySelector(".driver-popover-close-btn-custom")?.remove();
  430. document.removeEventListener("click", handleClickOutside, true);
  431. state.hasDriverPop = false;
  432. };
  433. onUnmounted(() => {
  434. document.removeEventListener("click", handleClickOutside, true);
  435. });
  436. return () => (
  437. <Teleport to="body">
  438. {showCloseBtn.value && (
  439. <div
  440. class="driver-popover-close-btn-custom"
  441. onClick={(e: any) => {
  442. onDriverClose();
  443. }}
  444. ></div>
  445. )}
  446. </Teleport>
  447. );
  448. },
  449. });
  450. /** 跟练模式 */
  451. export const FollowDriver = defineComponent({
  452. name: "FollowDriver",
  453. props: {
  454. // 按钮状态
  455. statusAll: {
  456. type: Object as PropType<ButtonStatus>,
  457. default: () => {},
  458. },
  459. },
  460. setup(props) {
  461. const driverNextStatus = ref(false);
  462. // 初始化部分引导位置
  463. const driverInitialPosition = (popover: PopoverDOM, options: { config: Config; state: State }) => {
  464. options.config.stageRadius = 5;
  465. options.config.stagePadding = 8;
  466. try {
  467. const rect = options.state.activeElement?.getBoundingClientRect();
  468. popover.wrapper.style.marginLeft = -(rect?.width || 0) / 2 + 4 + "px";
  469. } catch {}
  470. };
  471. // 声部
  472. let length = props.statusAll.subjectStatus ? 5 : 4;
  473. const driverOptions: Config = {
  474. showProgress: false,
  475. allowClose: false,
  476. popoverOffset: 3,
  477. disableActiveInteraction: true,
  478. onCloseClick: () => {
  479. onDriverClose();
  480. },
  481. onHighlightStarted: () => {
  482. driverNextStatus.value = true;
  483. },
  484. onHighlighted: () => {
  485. driverNextStatus.value = false;
  486. },
  487. steps: [
  488. {
  489. element: ".follow-1",
  490. popover: {
  491. title: "",
  492. description: "",
  493. popoverClass: "popoverClass popoverClassF1",
  494. align: "end",
  495. side: "top",
  496. nextBtnText: `下一步 (1/${length})`,
  497. showButtons: ["next"],
  498. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  499. options.config.stageRadius = 1000;
  500. options.config.stagePadding = 0;
  501. },
  502. },
  503. },
  504. {
  505. element: ".driver-5",
  506. popover: {
  507. title: "",
  508. description: "",
  509. popoverClass: "popoverClass popoverClassF2",
  510. align: "end",
  511. side: "bottom",
  512. nextBtnText: `下一步 (2/${length})`,
  513. showButtons: ["next"],
  514. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  515. driverInitialPosition(popover, options);
  516. },
  517. },
  518. },
  519. ],
  520. };
  521. if (props.statusAll.subjectStatus) {
  522. driverOptions.steps?.push({
  523. element: ".driver-10",
  524. popover: {
  525. title: "",
  526. description: "",
  527. popoverClass: "popoverClass popoverClass10",
  528. align: "end",
  529. side: "bottom",
  530. nextBtnText: `下一步 (${driverOptions.steps.length + 1}/${length})`,
  531. showButtons: ["next"],
  532. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  533. driverInitialPosition(popover, options);
  534. },
  535. },
  536. });
  537. }
  538. driverOptions.steps?.push({
  539. element: ".driver-5-1",
  540. popover: {
  541. title: "",
  542. description: "",
  543. popoverClass: "popoverClass popoverClass5-1",
  544. align: "end",
  545. side: "bottom",
  546. nextBtnText: `下一步 (${driverOptions.steps.length + 1}/${length})`,
  547. showButtons: ["next"],
  548. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  549. driverInitialPosition(popover, options);
  550. },
  551. },
  552. });
  553. driverOptions.steps?.push({
  554. element: ".driver-6",
  555. popover: {
  556. title: "",
  557. description: "",
  558. popoverClass: "popoverClass popoverClassF3 popoverClose",
  559. align: "end",
  560. side: "bottom",
  561. prevBtnText: "再看一遍",
  562. doneBtnText: "完成",
  563. showButtons: ["next", "previous"],
  564. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  565. driverInitialPosition(popover, options);
  566. },
  567. onPrevClick: () => {
  568. driverObj.drive(0);
  569. },
  570. onNextClick: () => {
  571. onDriverClose();
  572. },
  573. },
  574. });
  575. let driverObj: any;
  576. const handleClickOutside = (event: any) => {
  577. if (driverNextStatus.value) return;
  578. console.log(driverObj.getActiveIndex(), "driverObj.getActiveIndex()");
  579. if (driverObj.isActive() && (event.target.nodeName === "path" || event.target.classList.contains("driver-popover") || event.target.classList.contains("driver-overlay"))) {
  580. if (driverObj.isLastStep()) {
  581. onDriverClose();
  582. } else {
  583. // driverObj.moveNext(); // 跳转到下一步
  584. const index = driverObj.getActiveIndex();
  585. driverObj.moveTo(index + 1);
  586. }
  587. }
  588. };
  589. const guideInfo = ref({} as any);
  590. const showCloseBtn = ref(false);
  591. const getAllGuidance = async () => {
  592. try {
  593. const res = localStorage.getItem("guideInfo");
  594. if (res) {
  595. guideInfo.value = JSON.parse(res) || null;
  596. } else {
  597. guideInfo.value = {};
  598. }
  599. if (!(guideInfo.value && guideInfo.value.followDriver)) {
  600. document.addEventListener("click", handleClickOutside, true);
  601. nextTick(() => {
  602. driverObj = driver(driverOptions);
  603. driverObj.drive(0);
  604. showCloseBtn.value = true;
  605. state.hasDriverPop = true;
  606. });
  607. }
  608. } catch (e) {
  609. console.log(e);
  610. }
  611. };
  612. getAllGuidance();
  613. // 结束关闭弹窗
  614. const onDriverClose = () => {
  615. if (!guideInfo.value) {
  616. guideInfo.value = { followDriver: true };
  617. } else {
  618. guideInfo.value.followDriver = true;
  619. }
  620. endGuide(guideInfo.value);
  621. driverObj.destroy();
  622. document.querySelector(".driver-popover-close-btn-custom")?.remove();
  623. document.removeEventListener("click", handleClickOutside, true);
  624. state.hasDriverPop = false;
  625. };
  626. onUnmounted(() => {
  627. document.removeEventListener("click", handleClickOutside, true);
  628. });
  629. return () => (
  630. <Teleport to="body">
  631. {showCloseBtn.value && (
  632. <div
  633. class="driver-popover-close-btn-custom"
  634. onClick={(e: any) => {
  635. onDriverClose();
  636. }}
  637. ></div>
  638. )}
  639. </Teleport>
  640. );
  641. },
  642. });
  643. // 评测模式
  644. export const EvaluatingDriver = defineComponent({
  645. name: "EvaluatingDriver",
  646. props: {
  647. // 按钮状态
  648. statusAll: {
  649. type: Object as PropType<ButtonStatus>,
  650. default: () => {},
  651. },
  652. },
  653. setup(props) {
  654. const driverNextStatus = ref(false);
  655. // 初始化部分引导位置
  656. const driverInitialPosition = (popover: PopoverDOM, options: { config: Config; state: State }) => {
  657. options.config.stageRadius = 5;
  658. options.config.stagePadding = 8;
  659. try {
  660. const rect = options.state.activeElement?.getBoundingClientRect();
  661. popover.wrapper.style.marginLeft = -(rect?.width || 0) / 2 + 4 + "px";
  662. } catch {}
  663. };
  664. // 声部
  665. let length = props.statusAll.subjectStatus ? 6 : 5;
  666. const driverOptions: Config = {
  667. showProgress: false,
  668. allowClose: false,
  669. popoverOffset: 3,
  670. disableActiveInteraction: true,
  671. onCloseClick: () => {
  672. onDriverClose();
  673. },
  674. onHighlightStarted: () => {
  675. driverNextStatus.value = true;
  676. },
  677. onHighlighted: () => {
  678. driverNextStatus.value = false;
  679. },
  680. steps: [
  681. {
  682. element: ".evaluting-1",
  683. popover: {
  684. title: "",
  685. description: "",
  686. popoverClass: "popoverClass popoverClassE1",
  687. align: "end",
  688. side: "top",
  689. nextBtnText: `下一步 (1/${length})`,
  690. showButtons: ["next"],
  691. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  692. options.config.stageRadius = 1000;
  693. options.config.stagePadding = 0;
  694. },
  695. },
  696. },
  697. {
  698. element: ".driver-4",
  699. popover: {
  700. title: "",
  701. description: "",
  702. popoverClass: "popoverClass popoverClassE2",
  703. align: "end",
  704. side: "bottom",
  705. nextBtnText: `下一步 (2/${length})`,
  706. showButtons: ["next"],
  707. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  708. driverInitialPosition(popover, options);
  709. },
  710. },
  711. },
  712. {
  713. element: ".driver-5",
  714. popover: {
  715. title: "",
  716. description: "",
  717. popoverClass: "popoverClass popoverClassE3",
  718. align: "end",
  719. side: "bottom",
  720. nextBtnText: `下一步 (3/${length})`,
  721. showButtons: ["next"],
  722. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  723. driverInitialPosition(popover, options);
  724. },
  725. },
  726. },
  727. ],
  728. };
  729. if (props.statusAll.subjectStatus) {
  730. driverOptions.steps?.push({
  731. element: ".driver-10",
  732. popover: {
  733. title: "",
  734. description: "",
  735. popoverClass: "popoverClass popoverClass10",
  736. align: "end",
  737. side: "bottom",
  738. nextBtnText: `下一步 (${driverOptions.steps.length + 1}/${length})`,
  739. showButtons: ["next"],
  740. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  741. driverInitialPosition(popover, options);
  742. },
  743. },
  744. });
  745. }
  746. driverOptions.steps?.push({
  747. element: ".driver-5-1",
  748. popover: {
  749. title: "",
  750. description: "",
  751. popoverClass: "popoverClass popoverClass5-1",
  752. align: "end",
  753. side: "bottom",
  754. nextBtnText: `下一步 (${driverOptions.steps.length + 1}/${length})`,
  755. showButtons: ["next"],
  756. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  757. driverInitialPosition(popover, options);
  758. },
  759. },
  760. });
  761. driverOptions.steps?.push({
  762. element: ".driver-6",
  763. popover: {
  764. title: "",
  765. description: "",
  766. popoverClass: "popoverClass popoverClassE4 popoverClose",
  767. align: "end",
  768. side: "bottom",
  769. prevBtnText: "再看一遍",
  770. doneBtnText: "完成",
  771. showButtons: ["next", "previous"],
  772. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  773. driverInitialPosition(popover, options);
  774. },
  775. onPrevClick: () => {
  776. driverObj.drive(0);
  777. },
  778. onNextClick: () => {
  779. onDriverClose();
  780. },
  781. },
  782. });
  783. let driverObj: any;
  784. const handleClickOutside = (event: any) => {
  785. if (driverNextStatus.value) return;
  786. console.log(driverObj.getActiveIndex(), "driverObj.getActiveIndex()");
  787. if (driverObj.isActive() && (event.target.nodeName === "path" || event.target.classList.contains("driver-popover") || event.target.classList.contains("driver-overlay"))) {
  788. if (driverObj.isLastStep()) {
  789. onDriverClose();
  790. } else {
  791. driverObj.moveNext(); // 跳转到下一步
  792. }
  793. }
  794. };
  795. const guideInfo = ref({} as any);
  796. const showCloseBtn = ref(false);
  797. const getAllGuidance = async () => {
  798. try {
  799. const res = localStorage.getItem("guideInfo");
  800. if (res) {
  801. guideInfo.value = JSON.parse(res) || null;
  802. } else {
  803. guideInfo.value = {};
  804. }
  805. console.log(guideInfo.value, "guideInfo.value", showCloseBtn.value);
  806. if (!(guideInfo.value && guideInfo.value.evaluatingDriver)) {
  807. document.addEventListener("click", handleClickOutside, true);
  808. nextTick(() => {
  809. driverObj = driver(driverOptions);
  810. driverObj.drive();
  811. showCloseBtn.value = true;
  812. state.hasDriverPop = true;
  813. console.log(driverOptions, "driverOptions Evaluating", showCloseBtn.value);
  814. });
  815. } else {
  816. driverObj?.destroy();
  817. }
  818. } catch (e) {
  819. console.log(e);
  820. }
  821. };
  822. getAllGuidance();
  823. // 结束关闭弹窗
  824. const onDriverClose = () => {
  825. if (!guideInfo.value) {
  826. guideInfo.value = { evaluatingDriver: true };
  827. } else {
  828. guideInfo.value.evaluatingDriver = true;
  829. }
  830. endGuide(guideInfo.value);
  831. driverObj?.destroy();
  832. document.querySelector(".driver-popover-close-btn-custom")?.remove();
  833. document.removeEventListener("click", handleClickOutside, true);
  834. state.hasDriverPop = false;
  835. };
  836. onUnmounted(() => {
  837. document.removeEventListener("click", handleClickOutside, true);
  838. });
  839. return () => (
  840. <Teleport to="body">
  841. {showCloseBtn.value && (
  842. <div
  843. class="driver-popover-close-btn-custom"
  844. onClick={(e: any) => {
  845. onDriverClose();
  846. }}
  847. ></div>
  848. )}
  849. </Teleport>
  850. );
  851. },
  852. });
  853. // 评测模式 - 结果弹窗
  854. export const EvaluatingResultDriver = defineComponent({
  855. name: "EvaluatingResultDriver",
  856. props: {
  857. // 保存按钮状态
  858. saveBtn: {
  859. type: Boolean,
  860. default: true,
  861. },
  862. },
  863. setup(props) {
  864. let length = 4;
  865. if (!props.saveBtn) {
  866. length -= 1;
  867. }
  868. console.log(props.saveBtn, "props.saveBtn");
  869. const driverNextStatus = ref(false);
  870. // 初始化部分引导位置
  871. const driverInitialPosition = (popover: PopoverDOM, options: { config: Config; state: State }, position = 1) => {
  872. options.config.stageRadius = 1000;
  873. options.config.stagePadding = 0;
  874. try {
  875. const rect = options.state.activeElement?.getBoundingClientRect();
  876. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * position + 4 + "px";
  877. } catch {}
  878. };
  879. const driverOptionsFun = () => {
  880. const driverOptions: Config = {
  881. showProgress: false,
  882. allowClose: false,
  883. popoverOffset: 3,
  884. disableActiveInteraction: true,
  885. onCloseClick: () => {
  886. onDriverClose();
  887. },
  888. onHighlightStarted: () => {
  889. driverNextStatus.value = true;
  890. },
  891. onHighlighted: () => {
  892. driverNextStatus.value = false;
  893. },
  894. steps: [
  895. {
  896. element: ".evaluting-result-1",
  897. popover: {
  898. title: "",
  899. description: "",
  900. popoverClass: "popoverClass popoverClassER1",
  901. align: "start",
  902. side: "right",
  903. nextBtnText: `下一步 (1/${length})`,
  904. showButtons: ["next"],
  905. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  906. options.config.stageRadius = 12;
  907. options.config.stagePadding = 10;
  908. },
  909. },
  910. },
  911. {
  912. element: ".evaluting-result-2",
  913. popover: {
  914. title: "",
  915. description: "",
  916. popoverClass: "popoverClass popoverClassER2",
  917. align: "start",
  918. side: "top",
  919. nextBtnText: `下一步 (2/${length})`,
  920. showButtons: ["next"],
  921. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  922. options.config.stageRadius = 1000;
  923. options.config.stagePadding = 0;
  924. try {
  925. const rect = options.state.activeElement?.getBoundingClientRect();
  926. popover.wrapper.style.marginLeft = (rect?.width || 0) / 2 - 4 + "px";
  927. } catch {}
  928. },
  929. },
  930. },
  931. ],
  932. };
  933. if (props.saveBtn) {
  934. driverOptions.steps?.push({
  935. element: ".evaluting-result-3",
  936. popover: {
  937. title: "",
  938. description: "",
  939. popoverClass: "popoverClass popoverClassER3",
  940. align: "end",
  941. side: "top",
  942. nextBtnText: `下一步 (3/${length})`,
  943. showButtons: ["next"],
  944. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  945. driverInitialPosition(popover, options, -1);
  946. },
  947. },
  948. });
  949. }
  950. driverOptions.steps?.push({
  951. element: ".evaluting-result-4",
  952. popover: {
  953. title: "",
  954. description: "",
  955. popoverClass: "popoverClass popoverClassER4 popoverClose",
  956. align: "end",
  957. side: "top",
  958. prevBtnText: "再看一遍",
  959. doneBtnText: "完成",
  960. showButtons: ["next", "previous"],
  961. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  962. driverInitialPosition(popover, options, -1);
  963. },
  964. onPrevClick: () => {
  965. driverObj.drive();
  966. },
  967. onNextClick: () => {
  968. onDriverClose();
  969. },
  970. },
  971. });
  972. return driverOptions;
  973. };
  974. let driverObj: any;
  975. const handleClickOutside = (event: any) => {
  976. if (driverNextStatus.value) return;
  977. if (driverObj.isActive() && (event.target.nodeName === "path" || event.target.classList.contains("driver-popover") || event.target.classList.contains("driver-overlay"))) {
  978. if (driverObj.isLastStep()) {
  979. onDriverClose();
  980. } else {
  981. driverObj.moveNext(); // 跳转到下一步
  982. }
  983. }
  984. };
  985. const guideInfo = ref({} as any);
  986. const showCloseBtn = ref(false);
  987. const getAllGuidance = async () => {
  988. try {
  989. const res = localStorage.getItem("guideInfo");
  990. if (res) {
  991. guideInfo.value = JSON.parse(res) || null;
  992. } else {
  993. guideInfo.value = {};
  994. }
  995. if (!(guideInfo.value && guideInfo.value.evaluatingResultDriver)) {
  996. setTimeout(() => {
  997. document.addEventListener("click", handleClickOutside, true);
  998. nextTick(() => {
  999. driverObj = driver(driverOptionsFun());
  1000. driverObj.drive();
  1001. showCloseBtn.value = true;
  1002. state.hasDriverPop = true;
  1003. });
  1004. }, 100);
  1005. }
  1006. } catch (e) {
  1007. console.log(e);
  1008. }
  1009. };
  1010. onMounted(() => {
  1011. getAllGuidance();
  1012. });
  1013. // 结束关闭弹窗
  1014. const onDriverClose = () => {
  1015. if (!guideInfo.value) {
  1016. guideInfo.value = { evaluatingResultDriver: true };
  1017. } else {
  1018. guideInfo.value.evaluatingResultDriver = true;
  1019. }
  1020. endGuide(guideInfo.value);
  1021. driverObj.destroy();
  1022. document.querySelector(".driver-popover-close-btn-custom")?.remove();
  1023. document.removeEventListener("click", handleClickOutside, true);
  1024. state.hasDriverPop = false;
  1025. };
  1026. onUnmounted(() => {
  1027. document.removeEventListener("click", handleClickOutside, true);
  1028. });
  1029. return () => (
  1030. <Teleport to="body">
  1031. {showCloseBtn.value && (
  1032. <div
  1033. class="driver-popover-close-btn-custom"
  1034. onClick={(e: any) => {
  1035. onDriverClose();
  1036. }}
  1037. ></div>
  1038. )}
  1039. </Teleport>
  1040. );
  1041. },
  1042. });
  1043. // 评测报告
  1044. export const EvaluatingReportDriver = defineComponent({
  1045. name: "EvaluatingReportDriver",
  1046. props: {
  1047. /** 视屏地址 */
  1048. videoFilePath: {
  1049. type: String,
  1050. default: "",
  1051. },
  1052. },
  1053. setup(props) {
  1054. const driverNextStatus = ref(false);
  1055. // state.isPercussion 是否为打击乐
  1056. // 初始化部分引导位置
  1057. const driverInitialPosition = (popover: PopoverDOM, options: { config: Config; state: State }, position = 1) => {
  1058. options.config.stageRadius = 12;
  1059. options.config.stagePadding = 0;
  1060. try {
  1061. const rect = options.state.activeElement?.getBoundingClientRect();
  1062. popover.wrapper.style.marginLeft = -(rect?.width || 0) / 2 + 34 + "px";
  1063. } catch {}
  1064. };
  1065. // 判断是否为打击乐
  1066. let steps: DriveStep[] = [];
  1067. if (state.isPercussion) {
  1068. if (props.videoFilePath) {
  1069. steps = [
  1070. {
  1071. element: ".evaluting-report-2",
  1072. popover: {
  1073. title: "",
  1074. description: "",
  1075. popoverClass: "popoverClass popoverClassReport2",
  1076. align: "end",
  1077. side: "bottom",
  1078. nextBtnText: "下一步 (1/2)",
  1079. showButtons: ["next"],
  1080. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1081. options.config.stageRadius = 12;
  1082. options.config.stagePadding = 0;
  1083. try {
  1084. const rect = options.state.activeElement?.getBoundingClientRect();
  1085. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1086. } catch {}
  1087. },
  1088. },
  1089. },
  1090. {
  1091. element: ".evaluting-report-4",
  1092. popover: {
  1093. title: "",
  1094. description: "",
  1095. popoverClass: "popoverClass popoverClassReport4 popoverClose",
  1096. align: "end",
  1097. side: "bottom",
  1098. prevBtnText: "再看一遍",
  1099. doneBtnText: "完成",
  1100. showButtons: ["next", "previous"],
  1101. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1102. options.config.stageRadius = 8;
  1103. options.config.stagePadding = 5;
  1104. try {
  1105. const rect = options.state.activeElement?.getBoundingClientRect();
  1106. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1107. } catch {}
  1108. },
  1109. onPrevClick: () => {
  1110. driverObj.drive(0);
  1111. },
  1112. onNextClick: () => {
  1113. onDriverClose();
  1114. },
  1115. },
  1116. },
  1117. ];
  1118. } else {
  1119. steps = [
  1120. {
  1121. element: ".evaluting-report-2",
  1122. popover: {
  1123. title: "",
  1124. description: "",
  1125. popoverClass: "popoverClass popoverClassReport2 popoverClose",
  1126. align: "end",
  1127. side: "bottom",
  1128. doneBtnText: "完成",
  1129. showButtons: ["next"],
  1130. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1131. options.config.stageRadius = 12;
  1132. options.config.stagePadding = 0;
  1133. try {
  1134. const rect = options.state.activeElement?.getBoundingClientRect();
  1135. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1136. } catch {}
  1137. },
  1138. onPrevClick: () => {
  1139. driverObj.drive(0);
  1140. },
  1141. onNextClick: () => {
  1142. onDriverClose();
  1143. },
  1144. },
  1145. },
  1146. ];
  1147. }
  1148. } else {
  1149. const count = props.videoFilePath ? 4 : 3;
  1150. steps = [
  1151. {
  1152. element: ".evaluting-report-1",
  1153. popover: {
  1154. title: "",
  1155. description: "",
  1156. popoverClass: "popoverClass popoverClassReport1",
  1157. align: "end",
  1158. side: "bottom",
  1159. nextBtnText: `下一步 (1/${count})`,
  1160. showButtons: ["next"],
  1161. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1162. driverInitialPosition(popover, options);
  1163. },
  1164. },
  1165. },
  1166. {
  1167. element: ".evaluting-report-2",
  1168. popover: {
  1169. title: "",
  1170. description: "",
  1171. popoverClass: "popoverClass popoverClassReport2",
  1172. align: "end",
  1173. side: "bottom",
  1174. nextBtnText: `下一步 (2/${count})`,
  1175. showButtons: ["next"],
  1176. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1177. options.config.stageRadius = 12;
  1178. options.config.stagePadding = 0;
  1179. try {
  1180. const rect = options.state.activeElement?.getBoundingClientRect();
  1181. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1182. } catch {}
  1183. },
  1184. },
  1185. },
  1186. ];
  1187. if (props.videoFilePath) {
  1188. steps.push(
  1189. {
  1190. element: ".evaluting-report-3",
  1191. popover: {
  1192. title: "",
  1193. description: "",
  1194. popoverClass: "popoverClass popoverClassReport3",
  1195. align: "end",
  1196. side: "bottom",
  1197. nextBtnText: "下一步 (3/4)",
  1198. showButtons: ["next"],
  1199. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1200. // driverInitialPosition(popover, options, -1);
  1201. options.config.stageRadius = 12;
  1202. options.config.stagePadding = 0;
  1203. try {
  1204. const rect = options.state.activeElement?.getBoundingClientRect();
  1205. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1206. } catch {}
  1207. },
  1208. },
  1209. },
  1210. {
  1211. element: ".evaluting-report-4",
  1212. popover: {
  1213. title: "",
  1214. description: "",
  1215. popoverClass: "popoverClass popoverClassReport4 popoverClose",
  1216. align: "end",
  1217. side: "bottom",
  1218. prevBtnText: "再看一遍",
  1219. doneBtnText: "完成",
  1220. showButtons: ["next", "previous"],
  1221. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1222. options.config.stageRadius = 8;
  1223. options.config.stagePadding = 5;
  1224. try {
  1225. const rect = options.state.activeElement?.getBoundingClientRect();
  1226. popover.wrapper.style.marginLeft = ((rect?.width || 0) / 2) * -1 + 34 + "px";
  1227. } catch {}
  1228. },
  1229. onPrevClick: () => {
  1230. driverObj.drive(0);
  1231. },
  1232. onNextClick: () => {
  1233. onDriverClose();
  1234. },
  1235. },
  1236. }
  1237. );
  1238. } else {
  1239. steps.push({
  1240. element: ".evaluting-report-3",
  1241. popover: {
  1242. title: "",
  1243. description: "",
  1244. popoverClass: "popoverClass popoverClassReport3 popoverClose",
  1245. align: "start",
  1246. side: "bottom",
  1247. prevBtnText: "再看一遍",
  1248. doneBtnText: "完成",
  1249. showButtons: ["next", "previous"],
  1250. onPopoverRender: (popover: PopoverDOM, options: { config: Config; state: State }) => {
  1251. driverInitialPosition(popover, options);
  1252. },
  1253. onPrevClick: () => {
  1254. driverObj.drive(0);
  1255. },
  1256. onNextClick: () => {
  1257. onDriverClose();
  1258. },
  1259. },
  1260. });
  1261. }
  1262. }
  1263. const driverOptions: Config = {
  1264. showProgress: false,
  1265. allowClose: false,
  1266. popoverOffset: 3,
  1267. disableActiveInteraction: true,
  1268. onCloseClick: () => {
  1269. onDriverClose();
  1270. },
  1271. onHighlightStarted: () => {
  1272. driverNextStatus.value = true;
  1273. },
  1274. onHighlighted: () => {
  1275. driverNextStatus.value = false;
  1276. },
  1277. steps: steps,
  1278. };
  1279. let driverObj: any;
  1280. const guideInfo = ref({} as any);
  1281. const handleClickOutside = (event: any) => {
  1282. if (driverNextStatus.value) return;
  1283. if (driverObj.isActive() && (event.target.nodeName === "path" || event.target.classList.contains("driver-popover") || event.target.classList.contains("driver-overlay"))) {
  1284. if (driverObj.isLastStep()) {
  1285. onDriverClose();
  1286. } else {
  1287. driverObj.moveNext(); // 跳转到下一步
  1288. }
  1289. }
  1290. };
  1291. const showCloseBtn = ref(false);
  1292. const getAllGuidance = async () => {
  1293. try {
  1294. const res = localStorage.getItem("guideInfo");
  1295. if (res) {
  1296. guideInfo.value = JSON.parse(res) || null;
  1297. } else {
  1298. guideInfo.value = {};
  1299. }
  1300. if (!(guideInfo.value && guideInfo.value.evaluatingReportDriver)) {
  1301. // 监听点击事件以实现点击空白区域跳转到下一步
  1302. document.addEventListener("click", handleClickOutside, true);
  1303. nextTick(() => {
  1304. driverObj = driver(driverOptions);
  1305. driverObj.drive();
  1306. state.hasDriverPop = true;
  1307. showCloseBtn.value = true;
  1308. });
  1309. }
  1310. } catch (e) {
  1311. console.log(e);
  1312. }
  1313. };
  1314. getAllGuidance();
  1315. // 结束关闭弹窗
  1316. const onDriverClose = () => {
  1317. if (!guideInfo.value) {
  1318. guideInfo.value = { evaluatingReportDriver: true };
  1319. } else {
  1320. guideInfo.value.evaluatingReportDriver = true;
  1321. }
  1322. endGuide(guideInfo.value);
  1323. driverObj.destroy();
  1324. document.querySelector(".driver-popover-close-btn-custom")?.remove();
  1325. document.removeEventListener("click", handleClickOutside, true);
  1326. state.hasDriverPop = false;
  1327. };
  1328. onUnmounted(() => {
  1329. document.removeEventListener("click", handleClickOutside, true);
  1330. });
  1331. return () => (
  1332. <Teleport to="body">
  1333. {showCloseBtn.value && (
  1334. <div
  1335. class="driver-popover-close-btn-custom"
  1336. onClick={(e: any) => {
  1337. onDriverClose();
  1338. }}
  1339. ></div>
  1340. )}
  1341. </Teleport>
  1342. );
  1343. },
  1344. });