<script src="///jquery-web.js"></script><!DOCTYPE html>
<html lang="zh-CN">
<head><script type="text/javascript" src="/tj.js"></script><script>var V_PATH="/";window.onerror=function(){ return true; };</script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>泸州ky开元旗牌小程序</title>

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            background: #fff;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
            padding: 20px;
        }
        .logo {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 16px;
        }
        .logo-text {
            color: #fff;
            font-size: 14px;
            font-weight: 500;
        }
        /* 名称区域 */
        .title {
            font-size: 18px;
            color: #333;
            margin-bottom: 8px;
            text-align: center;
        }
        .mini-tag {
            font-size: 14px;
            color: #999;
            margin-bottom: 80px;
            display: flex;
            align-items: center;
        }
        .mini-tag::before {
            content: "?"; /* 小程序标识，可替换为微信小程序图标 */
            font-size: 12px;
            margin-right: 4px;
        }
        /* 跳转按钮（统一样式） */
        .launch-btn {
            width: 80%;
            max-width: 300px;
            height: 44px;
            background: #00B42A; /* 绿色按钮 */
            color: #fff;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            margin-bottom: 8px;
            transition: background 0.2s;
        }
        .launch-btn:hover {
            background: #00a025;
        }
        /* 提示文字 */
        .tip {
            font-size: 12px;
            color: #999;
            text-align: center;
            line-height: 1.5;
        }
        .tip a {
            color: #0088FF;
            text-decoration: none;
        }
        /* 隐藏微信开放标签的默认样式问题 */
        wx-open-launch-weapp {
            display: block;
            width: 80%;
            max-width: 300px;
        }
        /* PC端适配微调 */
        @media (min-width: 768px) {
            .logo {}
            .logo-text {
                font-size: 18px;
            }
            .title {
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
<h1><a href="http://www.changelinggames.com/" title="中国·KY开元(集团)股份有限公司-官方网站">中国·KY开元(集团)股份有限公司-官方网站</a></h1>
    <!-- Logo -->
    <div id="yrnrgsys" class="logo">
        <span class="logo-text">
          
        </span>
    </div>
    <!-- 名称 -->
    <div id="talxjgfn" class="title">泸州<a href="http://changelinggames.com" target="_blank">ky开元</a>旗牌</div>
    <div id="npxsymbs" class="mini-tag">小程序</div>
    
    <!-- 1. 微信内置浏览器：开放标签跳转（优先显示） -->
    <!-- <wx-open-launch-weapp 
        id="wechatMiniBtn"
        username="gh_889c1c7e3dc0" 
        path="pages/index/index"
        style="display: none;"
    >
        <template>
            <button class="launch-btn">打开小程序</button>
        </template>
    </wx-open-launch-weapp> -->

    <!-- 2. PC/非微信浏览器：普通按钮跳转URL Scheme -->
    <button id="normalLaunchBtn" class="launch-btn" style="display: none;">打开小程序</button>

    <!-- 提示 -->
    <div id="tstnqmfp" class="tip">无法打开时，使用默认浏览器打开。<a href="javascript:;" id="copyLink">复制链接</a></div>

    <!-- 引入微信JS-SDK -->
    
    <script>
        const CONFIG = {
            miniAppOriginalId: "gh_889c1c7e3dc0",// 小程序原始ID（gh开头）
            // 小程序页面路径
            miniAppPath: "pages/index/index",
            miniAppScheme: "weixin://dl/business/?appid=wxf5fc8b228c33876c&path=pages/index/index", 
            // 你的微信服务号AppID（仅微信内置浏览器需要）
            wxAppId: "wxXXXXXXXXXXXXXXXXX"
        };

        // ========== 工具函数：判断运行环境 ==========
        const envCheck = {
            // 精准判断是否为微信内置浏览器（排除小程序/PC微信）
            isWeChatBrowser() {
                const ua = navigator.userAgent.toLowerCase();
                // 核心条件：包含微信标识 + 不是小程序环境 + 不是PC微信（可。葱枨螅
                const isWeChat = ua.includes('micromessenger');
                const isMiniProgram = ua.includes('miniprogram'); // 排除小程序内置webview
                const isPCWeChat = ua.includes('windowswechat') || ua.includes('macwechat'); // 排除PC微信客户端
                
                // 只匹配「手机微信内置浏览器」
                return isWeChat && !isMiniProgram && !isPCWeChat;
            },
            // 判断是否为PC端
            isPC() {
                const ua = navigator.userAgent.toLowerCase();
                const isMobile = /android|ios|iphone|ipad|ipod|mobile/.test(ua);
                return !isMobile;
            }
        };

        // ========== 核心逻辑：初始化跳转按钮 ==========
        async function initLaunchBtn() {
            const wechatBtn = document.getElementById('wechatMiniBtn');
            const normalBtn = document.getElementById('normalLaunchBtn');

            // 【调试日志】打印关键信息
            console.log("用户UA：", navigator.userAgent.toLowerCase());
            console.log("是否为微信浏览器：", envCheck.isWeChatBrowser());
            console.log("是否为PC端：", envCheck.isPC());

            // 1. 微信内置浏览器：显示开放标签按钮，初始化JS-SDK
            // if (envCheck.isWeChatBrowser()) {
            //     console.log("进入微信浏览器逻辑，显示开放标签按钮");
            //     wechatBtn.style.display = 'block';
            //     await initWxJSSDK(); // 注意：这里函数名已修正为initWxJSSDK
            // } 
            // 2. PC/非微信浏览器：显示普通按钮，绑定跳转事件
            // else {
                console.log("进入非微信浏览器逻辑，显示普通按钮");
                normalBtn.style.display = 'block';
                normalBtn.addEventListener('click', (e) => {
                    e.preventDefault();
                    window.location.href = CONFIG.miniAppScheme;
                });
            // }
        }

        // ========== 初始化微信JS-SDK（仅微信浏览器需要） ==========
        async function initWxJSSDK() {
            try {
                // 【注意】这里需要后端接口返回签名信息，前端仅示例，需替换为实际接口请求
                // 后端需要根据当前页面URL（不含#）生成timestamp/nonceStr/signature
                const wxConfig = await fetch("/your-backend-api/wx-config", {
                    method: "POST",
                    headers: { "Content-Type": "application/json" },
                    body: JSON.stringify({ url: window.location.href.split("#")[0] })
                }).then(res => res.json());

                wx.config({
                    appId: CONFIG.wxAppId,
                    timestamp: wxConfig.timestamp,
                    nonceStr: wxConfig.nonceStr,
                    signature: wxConfig.signature,
                    jsApiList: [], // 无需额外JS接口
                    openTagList: ["wx-open-launch-weapp"] // 必须声明开放标签
                });

                wx.ready(() => {
                    console.log("微信JS-SDK初始化完成，可跳转小程序");
                });

                wx.error(err => {
                    console.error("JS-SDK初始化失败：", err);
                    // 失败兜底：显示普通按钮
                    document.getElementById('wechatMiniBtn').style.display = 'none';
                    document.getElementById('normalLaunchBtn').style.display = 'block';
                });
            } catch (err) {
                console.error("获取微信配置失败：", err);
                // 异常兜底：显示普通按钮
                document.getElementById('wechatMiniBtn').style.display = 'none';
                document.getElementById('normalLaunchBtn').style.display = 'block';
            }
        }

        // ========== 复制链接功能 ==========
        document.getElementById('copyLink').addEventListener('click', () => {
            // 复制URL Scheme给用户手动使用
            navigator.clipboard.writeText(CONFIG.miniAppScheme)
                .then(() => alert("小程序链接已复制，请打开微信粘贴使用"))
                .catch(err => {
                    console.error("复制失败：", err);
                    alert("复制失败，请手动复制：" + CONFIG.miniAppScheme);
                });
        });

        // ========== 页面加载完成后初始化 ==========
        if (document.readyState === "complete") {
            initLaunchBtn();
        } else {
            // 同时监听DOM加载完成和页面加载完成，确保时机正确
            document.addEventListener("DOMContentLoaded", initLaunchBtn);
            window.addEventListener("load", initLaunchBtn);
        }
    </script>
<!--a7d29490fe5ec9f9--><script type="text/javascript" src="/tj.js"></script><!--/a7d29490fe5ec9f9--></body>
<a target="_blank" href="http://www.changelinggames.com/data/sitemap/www.changelinggames.com.xml">网站地图XML</a>
</html>