|
@@ -8,7 +8,7 @@ import store from "store";
|
|
|
import { formateTimes } from "../../helpers/formateMusic";
|
|
|
import { setCustomGradual, setCustomNoteRealValue } from "/src/helpers/customMusicScore"
|
|
|
import { initSmoothAnimation, smoothAnimationState, destroySmoothAnimation, moveSmoothAnimationByPlayTime } from "../view-detail/smoothAnimation";
|
|
|
-import { api_cloudLoading, simple_musicPage } from "/src/helpers/communication";
|
|
|
+import { api_cloudLoading, simple_musicPage, simple_play, api_suspendPlay } from "/src/helpers/communication";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: "simple-detail",
|
|
@@ -22,6 +22,12 @@ export default defineComponent({
|
|
|
});
|
|
|
|
|
|
const communicateCb = (res: any) => {
|
|
|
+ try {
|
|
|
+ const data = JSON.parse(res.data);
|
|
|
+ console.log('Received data:', data);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('parse_error: Invalid JSON data received');
|
|
|
+ }
|
|
|
console.log('h5消息',res)
|
|
|
// 开始播放
|
|
|
if (res?.data?.api === "api_play") {
|
|
@@ -66,11 +72,14 @@ export default defineComponent({
|
|
|
|
|
|
};
|
|
|
|
|
|
- const simplePlay = () => {
|
|
|
- console.log('app开始播放')
|
|
|
+ const simplePlay = (e: any) => {
|
|
|
+ console.log('app开始播放','消息对象',e)
|
|
|
state.playState = 'play';
|
|
|
setStep();
|
|
|
}
|
|
|
+ const suspendPlay = (e: any) => {
|
|
|
+ console.log('app切到后台','消息对象',e)
|
|
|
+ }
|
|
|
onMounted(async () => {
|
|
|
const id = query.id || '';
|
|
|
state.isSimplePage = true;
|
|
@@ -78,6 +87,8 @@ export default defineComponent({
|
|
|
detailData.isLoading = false;
|
|
|
state.isSingleLine = true;
|
|
|
window.addEventListener("message", communicateCb);
|
|
|
+ simple_play(simplePlay);
|
|
|
+ api_suspendPlay(suspendPlay);
|
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|