qwdqw
This commit is contained in:
@@ -1,35 +1,15 @@
|
||||
import { Component } from "react";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { View, Text, Image, Button } from "@tarojs/components";
|
||||
import { View, Text, Image, Button, Audio } from "@tarojs/components";
|
||||
import "./index.scss";
|
||||
import { AtTabBar } from "taro-ui";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { AtGrid } from "taro-ui";
|
||||
import { Swiper, SwiperItem } from "@tarojs/components";
|
||||
import { AtCard } from "taro-ui";
|
||||
import { AtImagePicker } from "taro-ui";
|
||||
import { AtButton } from "taro-ui";
|
||||
import { AtSearchBar } from "taro-ui";
|
||||
import { Picker } from "@tarojs/components";
|
||||
import { AtList, AtListItem, AtNavBar, AtTag, AtMessage } from "taro-ui";
|
||||
import {
|
||||
AtModal,
|
||||
AtModalHeader,
|
||||
AtModalContent,
|
||||
AtModalAction,
|
||||
AtAvatar,
|
||||
AtAccordion,
|
||||
} from "taro-ui";
|
||||
import { AtToast } from "taro-ui";
|
||||
import { AtIcon } from "taro-ui";
|
||||
import iphone from "../../images/iphone.jpg";
|
||||
|
||||
import gif11 from "../../images/11.gif";
|
||||
import confetti from "canvas-confetti";
|
||||
|
||||
import gif22 from "../../images/22.gif";
|
||||
import doro11 from "../../images/doro11.gif";
|
||||
|
||||
import testmpkv from "../../images/test.mp4";
|
||||
|
||||
import baby from "../../images/baby.mp3";
|
||||
|
||||
const Index = () => {
|
||||
// ws://(或者 wss:// 对于 HTTPS 环境
|
||||
@@ -67,7 +47,7 @@ const Index = () => {
|
||||
}
|
||||
}
|
||||
// TTS播放
|
||||
speak(event.data);
|
||||
// speak(event.data);
|
||||
setMessageArr((messageArr) => [event.data, ...messageArr]); // 更新消息数组
|
||||
};
|
||||
|
||||
@@ -123,6 +103,19 @@ const Index = () => {
|
||||
|
||||
useEffect(() => {
|
||||
// speak("欢迎使用"); // 语音播报
|
||||
|
||||
const innerAudioContext = Taro.createInnerAudioContext();
|
||||
innerAudioContext.src = baby;
|
||||
innerAudioContext.autoplay = true;
|
||||
|
||||
// 可选设置
|
||||
innerAudioContext.onPlay(() => {
|
||||
console.log("开始播放");
|
||||
});
|
||||
innerAudioContext.onError((res) => {
|
||||
console.log(res.errMsg);
|
||||
console.log(res.errCode);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// 在线测试地址
|
||||
@@ -130,11 +123,15 @@ const Index = () => {
|
||||
|
||||
return (
|
||||
<View className="index">
|
||||
<View>扣 <span style={{color:'green'}}>11</span> 变小新</View>
|
||||
<View>扣 <span style={{color:'green'}}>22</span> 娜娜子</View>
|
||||
<View>
|
||||
扣 <span style={{ color: "green" }}>11</span> 变小新
|
||||
</View>
|
||||
<View>
|
||||
扣 <span style={{ color: "green" }}>22</span> 娜娜子
|
||||
</View>
|
||||
|
||||
<View className="messageArr">
|
||||
{messageArr?.slice(0, 15)?.map((item, index) => (
|
||||
{messageArr?.slice(0, 5)?.map((item, index) => (
|
||||
<View
|
||||
key={index}
|
||||
className={index === 0 ? "message_item_first" : "message_item"}
|
||||
@@ -150,7 +147,7 @@ const Index = () => {
|
||||
<Image
|
||||
className="index_gif"
|
||||
mode={"scaleToFill"}
|
||||
src={status === "1" ? gif11 :status === "2" ?gif22:doro11}
|
||||
src={status === "1" ? gif11 : status === "2" ? gif22 : doro11}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user