import { defineComponent, ref } from "vue";
import styles from "./index.module.less";
import iconBack from "../icons/icon-right-back.png";
import { Icon, ImagePreview, Tab, Tabs } from "vant";

export default defineComponent({
	name: "screenModel",
	emits: ["close"],
	setup(props, { emit }) {
		const getTvIconUrl = () => {
			if (location.origin.indexOf("test") > -1) {
				return "https://test.gym.lexiaoya.cn/mteacher/#/guide";
			} else if (location.origin.indexOf("dev") > -1) {
				return "http://test.gym.lexiaoya.cn/mteacher/#/guide";
			}
			return "https://gym.lexiaoya.cn/mteacher/#/guide";
		};
		const getEnvHostname = () => {
			if (location.origin.indexOf("test") > -1) {
				return "https://test.gym.lexiaoya.cn/mdaya";
			} else if (location.origin.indexOf("dev") > -1) {
				return "http://test.gym.lexiaoya.cn/mdaya";
			}
			return "https://gym.lexiaoya.cn/mdaya";
		};
		return () => (
			<>
				<img class={styles.closeBtn} src={iconBack} onClick={() => emit("close")} />
				<div class={styles.container}>
					<Tabs swipeable animated>
						<Tab name="投屏" title="投屏">
							<iframe src={getTvIconUrl()} />
						</Tab>
						<Tab name="帮助" title="帮助">
							<iframe src={getEnvHostname() + '/#/KeepRepaire?mode=accompany'}/>
						</Tab>
					</Tabs>
				</div>
			</>
		);
	},
});
