Files
2026-01-26 18:04:27 +08:00

2 lines
17 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var __defProp=Object.defineProperty,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__publicField=(e,t,a)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,a),a);if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((a=>t.resolve(e()).then((()=>a))),(a=>t.resolve(e()).then((()=>{throw a}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e,t,...a){uni.__log__?uni.__log__(e,t,...a):console[e].apply(console,[...a,t])}const a="/static/logo.png";async function o(e={}){const a={sourcePath:"/static/apk/com.android.chrome.apk",targetDir:"yxd",targetFileName:"com.android.chrome.apk",...e};return t("log","at utils/fileUtils.js:52","开始移动APK文件配置:",a),new Promise(((e,o)=>{try{const l=`_www${a.sourcePath}`;t("log","at utils/fileUtils.js:58","源文件路径:",l);const r="file:///storage/emulated/0/";t("log","at utils/fileUtils.js:62","尝试使用内部存储目录:",r),plus.io.resolveLocalFileSystemURL(l,(l=>{t("log","at utils/fileUtils.js:65","找到源文件:",l.fullPath),plus.io.resolveLocalFileSystemURL(r,(r=>{t("log","at utils/fileUtils.js:68","找到内部存储根目录:",r.fullPath),r.getDirectory(a.targetDir,{create:!0},(r=>{t("log","at utils/fileUtils.js:71","创建/找到目标目录:",r.fullPath),l.copyTo(r,a.targetFileName,(a=>{t("log","at utils/fileUtils.js:74","文件复制成功:",a.fullPath),function(e){if("android"!==uni.getSystemInfoSync().platform)return;try{t("log","at utils/fileUtils.js:104","开始扫描文件:",e);const a=plus.android.importClass("android.content.Intent"),o=plus.android.importClass("android.net.Uri"),l=plus.android.importClass("java.io.File"),r=plus.android.runtimeMainActivity(),n=new a(a.ACTION_MEDIA_SCANNER_SCAN_FILE);n.setData(o.fromFile(new l(e))),r.sendBroadcast(n),t("log","at utils/fileUtils.js:112","文件扫描成功")}catch(a){t("error","at utils/fileUtils.js:114","文件扫描失败:",a)}}(a.fullPath),e(a)}),(e=>{t("error","at utils/fileUtils.js:79","复制失败:",e),o(`复制失败: ${JSON.stringify(e)}`)}))}),(e=>{t("error","at utils/fileUtils.js:83","创建目标目录失败:",e),o(`创建目标目录失败: ${JSON.stringify(e)}`)}))}),(e=>{t("error","at utils/fileUtils.js:87","访问内部存储根目录失败:",e),o(`访问内部存储根目录失败: ${JSON.stringify(e)}`)}))}),(e=>{t("error","at utils/fileUtils.js:91","访问源文件失败:",e),o(`访问源文件失败: ${JSON.stringify(e)}`)}))}catch(l){t("error","at utils/fileUtils.js:95","执行过程中发生异常:",l),o(`执行过程中发生异常: ${l}`)}}))}"undefined"==typeof setTimeout&&(t("log","at utils/fileUtils.js:12","setTimeout 未定义,添加 polyfill"),global.setTimeout=function(e,t){e()});class l{static async openUrl(e){return e?new Promise(((a,o)=>{plus.runtime.openURL(e,(async o=>{if(o){t("log","at utils/chrome-browser.js:36","检测失败Chrome 可能未安装:",o);try{const t=await this.installAndOpen(e);a(t)}catch(l){t("error","at utils/chrome-browser.js:42","installAndOpen 失败:",l),a(!1)}}else a(!0)}),"com.android.chrome")})):(t("error","at utils/chrome-browser.js:29","ChromeBrowser: URL为空"),!1)}static openWithChrome(e){return plus.runtime.openURL(e,{pname:"Chrome"}),!0}static async installAndOpen(e){try{if(!(await this.showInstallConfirm()))return plus.runtime.openURL(e),!1;return await this.initWorkflow()?(this.hasChrome=!0,uni.setStorageSync("has_chrome_browser",!0),setTimeout((()=>{this.openWithChrome(e)}),1e3),!0):(plus.runtime.openURL(e),!1)}catch(a){return t("error","at utils/chrome-browser.js:102","ChromeBrowser: 安装流程失败:",a),plus.runtime.openURL(e),!1}}static showInstallConfirm(){return new Promise((e=>{uni.showModal({title:"安装谷歌浏览器",content:"检测到您未安装谷歌浏览器\n\n建议安装谷歌浏览器以获得最佳体验\n是否现在安装",confirmText:"立即安装",cancelText:"使用其他浏览器",success:t=>{e(t.confirm)}})}))}static async initWorkflow(){return new Promise((async e=>{try{if(!(await this.requestAndroidPermission("android.permission.WRITE_EXTERNAL_STORAGE")))return void uni.showModal({title:"提示",content:"请授予存储权限以保存安装包",showCancel:!1});uni.showLoading({title:"正在准备资源..."});const t=await o();uni.hideLoading(),uni.showModal({title:"就绪",content:`安装包已保存至Downloads/${t.name}`,confirmText:"去安装",success:a=>{a.confirm?this.installApk(t.fullPath,e):e(!1)}})}catch(a){uni.hideLoading(),t("error","at utils/chrome-browser.js:165","流程失败:",a),uni.showToast({title:"操作失败: "+a,icon:"none"})}}))}static requestAndroidPermission(e){return new Promise((a=>{plus.android.requestPermissions([e],(e=>{e.granted.length>0?a(!0):a(!1)}),(e=>{t("error","at utils/chrome-browser.js:187","权限请求错误:",e),a(!1)}))}))}static downloadAndInstall(e){uni.showLoading({title:"正在下载...\n约十分钟",mask:!0});const a=`_downloads/chrome_${Date.now()}.apk`;plus.downloader.createDownload("https://database.yuxindazhineng.com/user-file//690c72a6b8ffa329af2d5607/avatar/com.android.chrome.apk",{filename:a},((a,o)=>{uni.hideLoading(),200===o?(t("log","at utils/chrome-browser.js:217","ChromeBrowser: 下载成功,开始安装"),this.installApk(a.filename,e)):(t("error","at utils/chrome-browser.js:220","ChromeBrowser: 下载失败,状态码:",o),this.showDownloadError(),e(!1))})).start()}static installApk(e,a){uni.showLoading({title:"正在安装...",mask:!0}),plus.runtime.install(e,{force:!1},(()=>{uni.hideLoading(),t("log","at utils/chrome-browser.js:247","ChromeBrowser: 安装成功"),uni.showToast({title:"安装成功",icon:"success",duration:1500}),a(!0)}),(o=>{uni.hideLoading(),t("error","at utils/chrome-browser.js:257","ChromeBrowser: 安装失败:",o),uni.removeStorageSync("chrome_apk_path"),this.showInstallError(e),a(!1)}))}static showDownloadError(){uni.showModal({title:"下载失败",content:"无法下载谷歌浏览器\n请检查网络连接后重试",showCancel:!1})}static showInstallError(e){uni.showModal({title:"安装失败",content:"自动安装失败\n请在文件管理中手动安装\n或退出应用后台重新进入下载",confirmText:"查看文件",success:t=>{t.confirm&&e&&plus.runtime.openFile(e)}})}static async forceCheck(){return t("log","at utils/chrome-browser.js:299","ChromeBrowser: 强制重新检查"),this.hasChrome=null,await this.init()}static getStatus(){return{hasChrome:this.hasChrome,apkDownloaded:this.apkDownloaded,apkPath:this.apkPath,cachedHasChrome:uni.getStorageSync("has_chrome_browser"),cachedApkPath:uni.getStorageSync("chrome_apk_path")}}}__publicField(l,"hasChrome",null),__publicField(l,"apkDownloaded",!1),__publicField(l,"apkPath",null);const r=(e,t)=>{const a=e.__vccOpts||e;for(const[o,l]of t)a[o]=l;return a},n=r({__name:"light-theme",setup(o){const r=e.ref(""),n=e.ref(""),s=e.ref(!1),i=e.ref(!1),c=e.ref(!1),u=e.ref("");e.ref(!1);const m=e.ref(""),d=e.ref(""),p=e.ref(""),h=()=>{s.value=!s.value},v=e=>{"username"===e?m.value="":"password"===e&&(d.value=""),p.value=""},g=async()=>{if((()=>{let e=!0;return m.value="",d.value="",r.value.trim()||(m.value="请输入账号",e=!1),n.value?n.value.length<6&&(d.value="密码至少6位字符",e=!1):(d.value="请输入密码",e=!1),e})()){c.value=!0,p.value="";try{const e=await uni.request({url:"http://cloud.yuxindazhineng.com/cloud_api/app/verify_domain",method:"POST",header:{"Content-Type":"application/json"},data:{username:r.value,password:n.value}});if(200!==e.statusCode)throw new Error(`接口请求失败,状态码:${e.statusCode}`);const a=e.data;if(t("log","at pages/light-theme/light-theme.vue:176",a),!a.success)throw new Error(a.message||"登录失败,请检查账号密码");{s.value?uni.setStorageSync("yxd_username",r.value):uni.removeStorageSync("yxd_username");const e=a.data;t("log","at pages/light-theme/light-theme.vue:189","完整域名:",e.full_domain),t("log","at pages/light-theme/light-theme.vue:190","域名前缀:",e.domain_prefix),u.value=`http://${e.full_domain}`,setTimeout((()=>{f()}),1e3)}}catch(e){p.value=e.message||"登录失败,请检查账号密码"}finally{c.value=!1}}},f=()=>{u.value&&(l.openUrl(u.value),setTimeout((()=>{u.value=null}),1e3))};return e.onMounted((()=>{const e=uni.getStorageSync("yxd_username");e&&(r.value=e,s.value=!0),t("log","at pages/light-theme/light-theme.vue:259","登录组件已挂载")})),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"main-view"},[e.createElementVNode("div",{class:"container"},[e.createElementVNode("div",{class:"logo"},[e.createElementVNode("image",{src:a,alt:"YXD"})]),e.createElementVNode("h1",null,"登录 YXD 智能应用"),e.createElementVNode("div",{class:"login-form"},[e.createElementVNode("div",{class:"form-group"},[e.createElementVNode("label",{for:"username"},"账号"),e.withDirectives(e.createElementVNode("input",{id:"username","onUpdate:modelValue":o[0]||(o[0]=e=>r.value=e),type:"text",placeholder:"请输入账号/邮箱/手机号",class:e.normalizeClass({error:m.value}),onInput:o[1]||(o[1]=e=>v("username"))},null,34),[[e.vModelText,r.value]]),m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error-message"},e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"form-group"},[e.createElementVNode("label",{for:"password"},"密码"),e.createElementVNode("div",{class:"password-input"},[e.withDirectives(e.createElementVNode("input",{id:"password","onUpdate:modelValue":o[2]||(o[2]=e=>n.value=e),type:i.value?"text":"password",placeholder:"请输入密码",class:e.normalizeClass({error:d.value}),onInput:o[3]||(o[3]=e=>v("password")),onKeyup:e.withKeys(g,["enter"])},null,42,["type"]),[[e.vModelDynamic,n.value]]),e.createElementVNode("button",{type:"button",class:"toggle-password",onClick:o[4]||(o[4]=e=>i.value=!i.value)},[i.value?(e.openBlock(),e.createElementBlock("span",{key:0},"🙈")):(e.openBlock(),e.createElementBlock("span",{key:1},"👁️"))])]),d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error-message"},e.toDisplayString(d.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"form-options"},[e.createElementVNode("label",{class:"remember-me",onClick:h},[e.createElementVNode("div",{class:"custom-checkbox-wrapper"},[e.createElementVNode("div",{class:e.normalizeClass(["custom-checkbox",{checked:s.value}])},[s.value?(e.openBlock(),e.createElementBlock("span",{key:0},"✓")):e.createCommentVNode("",!0)],2)]),e.createElementVNode("span",null,"记住账号")])]),e.createElementVNode("button",{class:"login-btn",onClick:g,disabled:c.value},[c.value?(e.openBlock(),e.createElementBlock("span",{key:0},"⏳")):(e.openBlock(),e.createElementBlock("span",{key:1},"🔑")),e.createTextVNode(" "+e.toDisplayString(c.value?"登录中...":"立即登录"),1)],8,["disabled"]),p.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"login-error"},[e.createElementVNode("span",{class:"error-icon"},"⚠"),e.createTextVNode(" "+e.toDisplayString(p.value),1)])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"redirect-section"},[e.createElementVNode("div",{class:"success-message"},[e.createElementVNode("span",{class:"success-icon"},"✅"),e.createTextVNode(" 登录成功!正在为您跳转... ")])])):e.createCommentVNode("",!0)])])]))}},[["__scopeId","data-v-490fbd28"]]),s=r({__name:"index",setup(o){const l=e.ref("https://ws.yuxindazhineng.com");function r(){plus.runtime.openURL(l.value)}return e.onMounted((()=>{t("log","at pages/index/index.vue:79","组件已挂载DOM元素可用")})),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"main-view"},[e.createElementVNode("div",{class:"container"},[e.createElementVNode("div",{class:"logo"},[e.createElementVNode("image",{src:a,alt:"YXD"})]),e.createElementVNode("h1",null,"访问 YXD 智能应用"),e.createElementVNode("p",{class:"description"},"点击下方按钮跳转至浏览器访问 YXD 智能应用平台,体验智能服务。"),e.createElementVNode("div",{class:"url-display"},[e.createElementVNode("input",{placeholder:"请输入网址",value:l.value},null,8,["value"])]),e.createElementVNode("button",{class:"access-btn",ref:"accessButton",onClick:r},[e.createElementVNode("i",{class:"fas fa-external-link-alt"}),e.createTextVNode(" 立即访问 ")],512)])]))}},[["__scopeId","data-v-dd386fb8"]]),i=r({__name:"night-theme",setup(o){const l=e.ref(""),r=e.ref(""),n=e.ref(!1),s=e.ref(!1),i=e.ref(!1),c=e.ref("");e.ref(!1);const u=e.ref(""),m=e.ref(""),d=e.ref(""),p=()=>{n.value=!n.value,t("log","at pages/night-theme/night-theme.vue:109","触发toggleRememberMe")},h=e=>{"username"===e?u.value="":"password"===e&&(m.value=""),d.value=""},v=async()=>{if((()=>{let e=!0;return u.value="",m.value="",l.value.trim()||(u.value="请输入账号",e=!1),r.value?r.value.length<6&&(m.value="密码至少6位字符",e=!1):(m.value="请输入密码",e=!1),e})()){i.value=!0,d.value="";try{const a=await(e=l.value,t=r.value,new Promise(((a,o)=>{setTimeout((()=>{e&&t?a({success:!0,redirectUrl:"https://ws.yuxindazhineng.com/",userInfo:{username:e,name:"用户"+e.substring(0,3)}}):o({success:!1,message:"账号或密码错误"})}),1500)})));a.success&&(n.value?uni.setStorageSync("yxd_username",l.value):uni.removeStorageSync("yxd_username"),c.value=a.redirectUrl,setTimeout((()=>{!function(){if(!c.value)return;plus.runtime.openURL(c.value)}()}),2e3))}catch(a){d.value=a.message||"登录失败,请检查账号密码"}finally{i.value=!1}var e,t}};return e.onMounted((()=>{const e=uni.getStorageSync("yxd_username");e&&(l.value=e,n.value=!0),t("log","at pages/night-theme/night-theme.vue:267","登录组件已挂载")})),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:"main-view"},[e.createElementVNode("div",{class:"container"},[e.createElementVNode("div",{class:"logo"},[e.createElementVNode("image",{src:a,alt:"YXD"})]),e.createElementVNode("h1",null,"登录 YXD 智能应用"),e.createElementVNode("div",{class:"login-form"},[e.createElementVNode("div",{class:"form-group"},[e.createElementVNode("label",{for:"username"},"账号"),e.withDirectives(e.createElementVNode("input",{id:"username","onUpdate:modelValue":o[0]||(o[0]=e=>l.value=e),type:"text",placeholder:"请输入账号/邮箱/手机号",class:e.normalizeClass({error:u.value}),onInput:o[1]||(o[1]=e=>h("username"))},null,34),[[e.vModelText,l.value]]),u.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error-message"},e.toDisplayString(u.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"form-group"},[e.createElementVNode("label",{for:"password"},"密码"),e.createElementVNode("div",{class:"password-input"},[e.withDirectives(e.createElementVNode("input",{id:"password","onUpdate:modelValue":o[2]||(o[2]=e=>r.value=e),type:s.value?"text":"password",placeholder:"请输入密码",class:e.normalizeClass({error:m.value}),onInput:o[3]||(o[3]=e=>h("password")),onKeyup:e.withKeys(v,["enter"])},null,42,["type"]),[[e.vModelDynamic,r.value]]),e.createElementVNode("button",{type:"button",class:"toggle-password",onClick:o[4]||(o[4]=e=>s.value=!s.value)},[s.value?(e.openBlock(),e.createElementBlock("span",{key:0},"🙈")):(e.openBlock(),e.createElementBlock("span",{key:1},"👁️"))])]),m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error-message"},e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"form-options"},[e.createElementVNode("label",{class:"remember-me",onClick:p},[e.createElementVNode("div",{class:"custom-checkbox-wrapper"},[e.createElementVNode("div",{class:e.normalizeClass(["custom-checkbox",{checked:n.value}])},[n.value?(e.openBlock(),e.createElementBlock("span",{key:0},"✓")):e.createCommentVNode("",!0)],2)]),e.createElementVNode("span",null,"记住账号")])]),e.createElementVNode("button",{class:"login-btn",onClick:v,disabled:i.value},[i.value?(e.openBlock(),e.createElementBlock("span",{key:0},"⏳")):(e.openBlock(),e.createElementBlock("span",{key:1},"🔑")),e.createTextVNode(" "+e.toDisplayString(i.value?"登录中...":"立即登录"),1)],8,["disabled"]),d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"login-error"},[e.createElementVNode("span",null,"⚠️"),e.createTextVNode(" "+e.toDisplayString(d.value),1)])):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"redirect-section"},[e.createElementVNode("div",{class:"success-message"},[e.createElementVNode("span",null,"✅"),e.createTextVNode(" 登录成功!正在为您跳转... ")])])):e.createCommentVNode("",!0)])])]))}},[["__scopeId","data-v-9c090945"]]);__definePage("pages/light-theme/light-theme",n),__definePage("pages/index/index",s),__definePage("pages/night-theme/night-theme",i);const c={onLaunch:function(){t("log","at App.vue:5","App Launch")},onShow:function(){t("log","at App.vue:8","App Show")},onHide:function(){t("log","at App.vue:11","App Hide")}};const{app:u,Vuex:m,Pinia:d}={app:e.createVueApp(c)};uni.Vuex=m,uni.Pinia=d,u.provide("__globalStyles",__uniConfig.styles),u._component.mpType="app",u._component.render=()=>{},u.mount("#app")}(Vue);