|
@@ -1,17 +1,32 @@
|
|
-import { defineComponent, onBeforeUnmount, reactive, ref, onMounted } from 'vue';
|
|
|
|
|
|
+import {
|
|
|
|
+ defineComponent,
|
|
|
|
+ onBeforeUnmount,
|
|
|
|
+ reactive,
|
|
|
|
+ ref,
|
|
|
|
+ onMounted
|
|
|
|
+} from 'vue';
|
|
import loginStyles from './images/login_styles.png';
|
|
import loginStyles from './images/login_styles.png';
|
|
import loginLeft from './images/login-left.png';
|
|
import loginLeft from './images/login-left.png';
|
|
import loginRight from './images/loginright.png';
|
|
import loginRight from './images/loginright.png';
|
|
import colLogo from './images/colLogo.png';
|
|
import colLogo from './images/colLogo.png';
|
|
import CodeLogin from './components/codeLogin';
|
|
import CodeLogin from './components/codeLogin';
|
|
import PwdLogin from './components/pwdLogin';
|
|
import PwdLogin from './components/pwdLogin';
|
|
-import { NTabs, NTabPane, useDialog, NModal, NButton, NSpace,NAlert, NImage } from 'naive-ui';
|
|
|
|
|
|
+import {
|
|
|
|
+ NTabs,
|
|
|
|
+ NTabPane,
|
|
|
|
+ useDialog,
|
|
|
|
+ NModal,
|
|
|
|
+ NButton,
|
|
|
|
+ NSpace,
|
|
|
|
+ NAlert,
|
|
|
|
+ NImage
|
|
|
|
+} from 'naive-ui';
|
|
import styles from './index.module.less';
|
|
import styles from './index.module.less';
|
|
import ForgotPassword from './components/forgotPassword';
|
|
import ForgotPassword from './components/forgotPassword';
|
|
-import moveTop from './images/moveTopBg.png'
|
|
|
|
-import dingPng from './images/ding.png'
|
|
|
|
-import closeAble from './images/closeAble.png'
|
|
|
|
-import infoIcon from './images/infoIcon.png'
|
|
|
|
|
|
+import moveTop from './images/moveTopBg.png';
|
|
|
|
+import dingPng from './images/ding.png';
|
|
|
|
+import closeAble from './images/closeAble.png';
|
|
|
|
+import infoIcon from './images/infoIcon.png';
|
|
import { state } from '/src/state';
|
|
import { state } from '/src/state';
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'login-page',
|
|
name: 'login-page',
|
|
@@ -20,14 +35,14 @@ export default defineComponent({
|
|
const NavsValue = ref('pwdLogin');
|
|
const NavsValue = ref('pwdLogin');
|
|
const pwdLoginRef = ref();
|
|
const pwdLoginRef = ref();
|
|
const forgotPasswordRef = ref();
|
|
const forgotPasswordRef = ref();
|
|
- const popEvent = ref()
|
|
|
|
|
|
+ const popEvent = ref();
|
|
const dialog = useDialog();
|
|
const dialog = useDialog();
|
|
- const showModalMask = ref(false)
|
|
|
|
|
|
+ const showModalMask = ref(false);
|
|
const checkInstall = async (event: any) => {
|
|
const checkInstall = async (event: any) => {
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
- console.log('checkInstall', event)
|
|
|
|
- popEvent.value = event
|
|
|
|
- console.log('beforeoutcome')
|
|
|
|
|
|
+ console.log('checkInstall', event);
|
|
|
|
+ popEvent.value = event;
|
|
|
|
+ console.log('beforeoutcome');
|
|
// const { outcome } = await event.userChoice;
|
|
// const { outcome } = await event.userChoice;
|
|
// console.log(outcome, 'outcome')
|
|
// console.log(outcome, 'outcome')
|
|
// setTimeout(async function () {
|
|
// setTimeout(async function () {
|
|
@@ -40,68 +55,74 @@ export default defineComponent({
|
|
|
|
|
|
// }, 2000)
|
|
// }, 2000)
|
|
|
|
|
|
-
|
|
|
|
if (window.matchMedia('(display-mode: standalone)').matches) {
|
|
if (window.matchMedia('(display-mode: standalone)').matches) {
|
|
- state.application = window.matchMedia('(display-mode: standalone)').matches
|
|
|
|
- console.log('应用内打开')
|
|
|
|
- }else{
|
|
|
|
- console.log(popEvent.value,'popEvent.value')
|
|
|
|
- if(popEvent.value){
|
|
|
|
- showModalMask.value = true;
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- const btn = document.querySelector('#submitBtn')
|
|
|
|
- console.log(btn)
|
|
|
|
- if(btn){
|
|
|
|
- btn.addEventListener('click', () => {
|
|
|
|
- showModalMask.value = false;
|
|
|
|
- if( !popEvent.value ) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- popEvent.value.prompt();
|
|
|
|
- popEvent.value.userChoice.then( (choiceResult:any) => {
|
|
|
|
- if (choiceResult.outcome === 'accepted') {
|
|
|
|
- console.log('用户已同意添加到桌面')
|
|
|
|
- showModalMask.value = false;
|
|
|
|
- } else {
|
|
|
|
- console.log('用户已取消添加到桌面')
|
|
|
|
- showModalMask.value = false;
|
|
|
|
|
|
+ state.application = window.matchMedia(
|
|
|
|
+ '(display-mode: standalone)'
|
|
|
|
+ ).matches;
|
|
|
|
+ console.log('应用内打开');
|
|
|
|
+ } else {
|
|
|
|
+ console.log(popEvent.value, 'popEvent.value');
|
|
|
|
+ if (popEvent.value) {
|
|
|
|
+ showModalMask.value = true;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ const btn = document.querySelector('#submitBtn');
|
|
|
|
+ console.log(btn);
|
|
|
|
+ if (btn) {
|
|
|
|
+ btn.addEventListener('click', () => {
|
|
|
|
+ showModalMask.value = false;
|
|
|
|
+ if (!popEvent.value) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- })
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },500)
|
|
|
|
-
|
|
|
|
|
|
+ popEvent.value.prompt();
|
|
|
|
+ popEvent.value.userChoice.then((choiceResult: any) => {
|
|
|
|
+ if (choiceResult.outcome === 'accepted') {
|
|
|
|
+ console.log('用户已同意添加到桌面');
|
|
|
|
+ showModalMask.value = false;
|
|
|
|
+ } else {
|
|
|
|
+ console.log('用户已取消添加到桌面');
|
|
|
|
+ showModalMask.value = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 500);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
-
|
|
|
|
- window.addEventListener('beforeinstallprompt', checkInstall, { once: true })
|
|
|
|
|
|
+ window.addEventListener('beforeinstallprompt', checkInstall, {
|
|
|
|
+ once: true
|
|
|
|
+ });
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
- window.removeEventListener('beforeinstallprompt', checkInstall)
|
|
|
|
- })
|
|
|
|
|
|
+ window.removeEventListener('beforeinstallprompt', checkInstall);
|
|
|
|
+ });
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
// const relatedApps = await navigator?.getInstalledRelatedApps();
|
|
// const relatedApps = await navigator?.getInstalledRelatedApps();
|
|
//
|
|
//
|
|
-
|
|
|
|
- })
|
|
|
|
- const downChrome = ()=>{
|
|
|
|
|
|
+ });
|
|
|
|
+ const downChrome = () => {
|
|
const agent = navigator.userAgent.toLowerCase();
|
|
const agent = navigator.userAgent.toLowerCase();
|
|
- const isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent); }();
|
|
|
|
- if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
|
|
|
|
- window.open('https://appstore.ks3-cn-beijing.ksyuncs.com/ChromeStandaloneSetup32.exe');
|
|
|
|
|
|
+ const isMac = (function () {
|
|
|
|
+ return /macintosh|mac os x/i.test(navigator.userAgent);
|
|
|
|
+ })();
|
|
|
|
+ if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
|
|
|
|
+ window.open(
|
|
|
|
+ 'https://appstore.ks3-cn-beijing.ksyuncs.com/ChromeStandaloneSetup32.exe'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
|
|
|
|
- window.open('https://appstore.ks3-cn-beijing.ksyuncs.com/ChromeStandaloneSetup64.exe');
|
|
|
|
|
|
+ if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
|
|
|
|
+ window.open(
|
|
|
|
+ 'https://appstore.ks3-cn-beijing.ksyuncs.com/ChromeStandaloneSetup64.exe'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
if (isMac) {
|
|
if (isMac) {
|
|
- window.open('https://appstore.ks3-cn-beijing.ksyuncs.com/googlechrome-mac.dmg');
|
|
|
|
|
|
+ window.open(
|
|
|
|
+ 'https://appstore.ks3-cn-beijing.ksyuncs.com/googlechrome-mac.dmg'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
return () => (
|
|
return () => (
|
|
<div class={styles['view-account']}>
|
|
<div class={styles['view-account']}>
|
|
@@ -151,18 +172,20 @@ export default defineComponent({
|
|
</NTabs>
|
|
</NTabs>
|
|
)}
|
|
)}
|
|
|
|
|
|
-
|
|
|
|
-<div class={styles.alertWrap}>
|
|
|
|
- <div class={styles.alertInfo}>
|
|
|
|
- <NImage src={infoIcon} class={styles.infoIcon} previewDisabled></NImage>
|
|
|
|
- 为了您更好的上课体验,推荐使用Chrome浏览器
|
|
|
|
|
|
+ <div class={styles.alertWrap}>
|
|
|
|
+ <div class={styles.alertInfo}>
|
|
|
|
+ <NImage
|
|
|
|
+ src={infoIcon}
|
|
|
|
+ class={styles.infoIcon}
|
|
|
|
+ previewDisabled></NImage>
|
|
|
|
+ 为了您更好的上课体验,推荐使用Chrome浏览器
|
|
|
|
+ </div>
|
|
|
|
+ <div class={styles.down} onClick={downChrome}>
|
|
|
|
+ 立即下载
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <div class={styles.down} onClick={downChrome}>立即下载</div>
|
|
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
- <NModal
|
|
|
|
- v-model:show={showModalMask.value}
|
|
|
|
- >
|
|
|
|
|
|
+ <NModal v-model:show={showModalMask.value}>
|
|
{/* <div
|
|
{/* <div
|
|
onClick={() => {
|
|
onClick={() => {
|
|
showModalTone.value = false;
|
|
showModalTone.value = false;
|
|
@@ -175,24 +198,28 @@ export default defineComponent({
|
|
<div class={styles.downMove}>
|
|
<div class={styles.downMove}>
|
|
<img src={dingPng} class={styles.dingPng} alt="" />
|
|
<img src={dingPng} class={styles.dingPng} alt="" />
|
|
<img src={moveTop} class={styles.downMoveBg} alt="" />
|
|
<img src={moveTop} class={styles.downMoveBg} alt="" />
|
|
- <img src={closeAble} class={styles.closeAble} onClick={()=>{
|
|
|
|
- showModalMask.value = false
|
|
|
|
- }} alt="" />
|
|
|
|
|
|
+ <img
|
|
|
|
+ src={closeAble}
|
|
|
|
+ class={styles.closeAble}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ showModalMask.value = false;
|
|
|
|
+ }}
|
|
|
|
+ alt=""
|
|
|
|
+ />
|
|
<h2>温馨提示</h2>
|
|
<h2>温馨提示</h2>
|
|
- <p>检测到您尚未安装“音乐数字课堂”应用程序,为了更好的使用体验,是否立即下载?</p>
|
|
|
|
|
|
+ <p>
|
|
|
|
+ 检测到您尚未安装“音乐数字课堂”应用程序,为了更好的使用体验,是否立即下载?
|
|
|
|
+ </p>
|
|
{/* <NButton>确定</NButton> */}
|
|
{/* <NButton>确定</NButton> */}
|
|
<NSpace style={{ padding: '25px 0 0 0' }} justify="center">
|
|
<NSpace style={{ padding: '25px 0 0 0' }} justify="center">
|
|
- <NButton
|
|
|
|
- {...{id
|
|
|
|
- :'submitBtn'}}
|
|
|
|
- class={styles.submitAppBtn}
|
|
|
|
- round
|
|
|
|
- type="primary"
|
|
|
|
-
|
|
|
|
- >
|
|
|
|
- 立即下载
|
|
|
|
- </NButton>
|
|
|
|
- </NSpace>
|
|
|
|
|
|
+ <NButton
|
|
|
|
+ {...{ id: 'submitBtn' }}
|
|
|
|
+ class={styles.submitAppBtn}
|
|
|
|
+ round
|
|
|
|
+ type="primary">
|
|
|
|
+ 立即下载
|
|
|
|
+ </NButton>
|
|
|
|
+ </NSpace>
|
|
</div>
|
|
</div>
|
|
</NModal>
|
|
</NModal>
|
|
</div>
|
|
</div>
|