<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
           height:300px;
            margin: 0;
            padding: 0;
            overflow: hidden;
            background: rgba(238, 235, 235, 0.5);
            background-image: url('./xlfs_jm_bg.png');
            background-size:100% 100%;
            background-repeat: no-repeat;

        }

        .loadP {
            margin-top:0px;
            margin-bottom:20px;
            font-size: 16px;
            text-align: center;
            color: rgb(254, 254, 254);

        }
        .jueming{
            font-size: 30px;
            text-align: center;
            color: rgb(254, 254, 254);

        }
        .loadRe{
            text-align: center;
            font-size: 14px;
            color:#ffffff ;
        }
        .logo{
            display: block;
            text-align: left;
            margin-top:10px
        }
        .progressBox{
            flex: 1;
          padding-top: 0.3rem;
          padding-right: 0.2rem;
          position: relative;
        }
        .progress {
            height: 0.3rem;
            overflow: hidden;
            background: -webkit-repeating-linear-gradient(
              0deg,
              #e9e9e9 0,
              #e9e9e9 4px,
              #ffffff 4px,
              #ffffff 8px
            );
          }
          .progress_bar {
            height: 0.3rem;
            background: -webkit-repeating-linear-gradient(
              0deg,
              #3071fd 0,
              #3071fd 4px,
              #ffffff 4px,
              #ffffff 8px
            );
            position: absolute;
            left: 0;
            top: 0.3rem;
          }
          .progress-bar {
            margin-top: 120px;
            width: 100%;
            height: 2px;
            overflow: hidden;
            box-sizing: border-box;
            border-radius: 24px;
            background-color: rgba(180, 160, 120, .2);
            position: relative;
        }

        .progress-bg {
            width: 20%;
            height: 100%;
            overflow: hidden;
            box-sizing: border-box;
            /* background-image:  #00BFFF 25%; */
            background-image: linear-gradient(135deg, #36B1D1 25%, #36B1D1 0, #36B1D1 50%, #36B1D1 0, #36B1D1 75%, #36B1D1 0);
            animation: panoramic 20s linear infinite;
            background-size: 32px 100%;
        }

        @keyframes panoramic {
            to {
                background-position: 200% 0;
            }
        }
        .company {
            text-align: right;
            margin-top: 20px;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #FEFEFE;
            line-height: 15px;
            opacity: 0.8;
            margin-bottom: 2px;
        }
        .website {
            margin-top: 2px;
            text-align: right;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #FEFEFE;
            line-height: 15px;
            opacity: 0.6;
        }
    </style>
</head>

<body>
    <div class="logo">&nbsp;&nbsp;<img src="./logo_icon.png"></div>
    <p class="loadP"><span>自助式心理健康评估与认知行为干预系统</span></p>
    <!-- <p><div class="progressBox">
        <div class="progress"></div>
        <div class="progress_bar" style=" width: 40%" ></div>
     </div>
    </p> -->
    <p class="loadRe"> <span id="dian"></span><span id="dianFor"></span></p>
    
    <div class="progress-bar">
        <div class="progress-bg" id="pro"></div>
    </div>
    <!-- <p class="jimigou" id="jimigou">检测到加密狗,软件启动中</p> -->
    <!-- <p class="company">北京决明科技有限公司&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <p class="website">www.jue-ming.com&nbsp;&nbsp;&nbsp;&nbsp;</p> -->

    <p class="company">&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <p class="website">&nbsp;&nbsp;&nbsp;&nbsp;</p>
    
    <!-- <img width="400px";height='300px' src="./xlfs_jm_bg.png" alt="" srcset=""> -->
</body>

</html>
<script>
      let dian = document.getElementById('dian')
    let dianNum = ''
    let dianFor=document.getElementById('dianFor')
    let dianForNum=''
    let count=0
    const { ipcRenderer } = window.require('electron');
    function startserve(val) {
        ipcRenderer.send("main-windows-python-exe", {
            type: val,
        });
    };
    function showMainWindows() {
        ipcRenderer.send("close-loading-window", {
            isClose: true,
        });
    };
    ipcRenderer.on("main-windows-python-exe-run", (event, arg) => {
        console.log(arg)
        if (arg.type === "exe") {
            dian.innerHTML = "python服务启动完成";
            startserve("dbInit");
            dian.innerHTML = "数据库正在初始化";
            let qq = document.getElementById('pro')
                qq.style.width = '40%'
        }
        if (arg.type === "dbInit") {
            dian.innerHTML = "数据库初始化完成";
            startserve("startDb");
            dian.innerHTML = "数据库启动中";
            let qq = document.getElementById('pro')
                qq.style.width = '60%'
        }
        if (arg.type === "startDb") {
            dian.innerHTML = "数据库启动完成";
            startserve("startJar");
            dian.innerHTML = "后台服务启动中";
            let qq = document.getElementById('pro')
                qq.style.width = '90%'
        }
        if (arg.type === "startJar") {
            let qq = document.getElementById('pro')
                qq.style.width = '100%'
            dian.innerHTML = "后台服务启动完成";
          //this.startserve("webGlobal");
          showMainWindows()
        }
        // if (arg.type === "webGlobal") {
        //   //可以关闭动画,打开mainwindows
        //   this.showMainWindows();
        // }
    });
    window.onload = function () {
        startserve("exe");
        dian.innerHTML = "python服务正在启动中";
        setInterval(() => {
            count = count + 1
            dianForNum = dianForNum + '.'
            dianFor.innerHTML = dianForNum;
            if (count == 4) {
            dianForNum = ''
            count=0;
        }
        }, 1000);
    }



    // function startserve(val) {
    //     ipcRenderer.send("main-windows-python-exe", {
    //         type: val,
    //     });
    // };
    // function showMainWindows() {
    //     ipcRenderer.send("close-loading-window", {
    //         isClose: true,
    //     });
    // };










  
    // let count = 0;
    // let time = setInterval(() => {
    //     count = count + 1
    //     dianNum = dianNum + '.'
    //     dian.innerHTML = dianNum;
    //     if (count == 4) {
    //         dianNum = ''
    //     }
    //     if (count == 6) {
    //         clearInterval(time)
    //     }
    // }, 500);

    // console.log(ipcRenderer.sendSync('test3', '我是渲染进程')); // prints "我是主进程"

    // ipcRenderer.on('test2', function (event, arg) {
    //     console.log(arg); // prints "我是主进程的test1"
    // });
    // ipcRenderer.send('test1', '我是渲染进程的test2');


</script>