From 59667b887e73fc41822b0612550d1f4983010db9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 16:55:45 +0000 Subject: [PATCH] style: format code with Prettier This commit fixes the style issues introduced in c660d0a according to the output from Prettier. Details: None --- .eslintrc.cjs | 86 +- CODE_OF_CONDUCT.md | 32 +- README.md | 7 + doc/pull_request_template.md | 14 +- index.html | 35 +- src/assets/scss/_reset.scss | 52 +- src/assets/scss/_variables.scss | 11 +- src/assets/scss/global.scss | 5 +- src/auto-imports.d.ts | 148 +- src/components.d.ts | 14 +- src/components/Home/index.vue | 2 +- src/components/NotFound.vue | 4 +- src/router/index.ts | 4 +- src/router/routes.ts | 34 +- src/store/modules/menu/index.ts | 6 +- src/store/modules/user/index.ts | 10 +- src/utils/http/axios.ts | 16 +- src/utils/http/index.ts | 6 +- src/utils/storage.ts | 2 +- src/views/Login/index.vue | 252 ++- src/vite-env.d.ts | 12 +- vite.config.ts | 116 +- xiaon_c5z3Cp/static/api.js | 40 +- xiaon_c5z3Cp/static/client.crisp.chat_l.js | 324 ++-- xiaon_c5z3Cp/static/crisp-loader.js | 14 +- xiaon_c5z3Cp/static/download.js | 41 +- xiaon_c5z3Cp/static/homepage.js | 325 ++-- xiaon_c5z3Cp/static/iframe.js | 202 +- xiaon_c5z3Cp/static/invite.js | 582 +++--- xiaon_c5z3Cp/static/jiazai.css | 122 +- xiaon_c5z3Cp/static/liteboardpc.css | 166 +- xiaon_c5z3Cp/static/liteboardwap.css | 348 ++-- xiaon_c5z3Cp/static/litestylepc.css | 222 ++- xiaon_c5z3Cp/static/litestylewap.css | 209 +- xiaon_c5z3Cp/static/liuliang.js | 345 ++-- xiaon_c5z3Cp/static/loginjs.js | 454 +++-- xiaon_c5z3Cp/static/node.js | 200 +- xiaon_c5z3Cp/static/order.js | 397 ++-- xiaon_c5z3Cp/static/order_detail.js | 900 +++++---- xiaon_c5z3Cp/static/outline.js | 314 ++- xiaon_c5z3Cp/static/qrcode.js | 2003 ++++++++++++++------ xiaon_c5z3Cp/static/sanfang.js | 287 +-- xiaon_c5z3Cp/static/setting.js | 427 ++--- xiaon_c5z3Cp/static/shop.js | 286 ++- xiaon_c5z3Cp/static/shop_peizhi.js | 236 ++- xiaon_c5z3Cp/static/ticket.js | 713 ++++--- 46 files changed, 5264 insertions(+), 4761 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f74f7c3..32a2eb4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,66 +1,66 @@ module.exports = { root: true, // 停止向上查找父级目录中的配置文件 - env : { + env: { browser: true, - es2021 : true, - node : true + es2021: true, + node: true, }, extends: [ './.eslintrc-auto-import.json', // 引入自动导入插件配置文件 'eslint:recommended', // ESLint 推荐规则 'plugin:vue/vue3-essential', // Vue3 推荐规则 'plugin:@typescript-eslint/recommended', // TypeScript 推荐规则 - 'plugin:prettier/recommended' // Prettier 推荐规则 + 'plugin:prettier/recommended', // Prettier 推荐规则 ], - parser : 'vue-eslint-parser', // 指定要使用的解析器 + parser: 'vue-eslint-parser', // 指定要使用的解析器 parserOptions: { ecmaVersion: 12, // 支持的 ES 版本,这里是 ECMAScript 2021 - sourceType : 'module', // 模块类型,默认为 script,我们设置为 module - parser : '@typescript-eslint/parser' // 使用 TypeScript 解析器 + sourceType: 'module', // 模块类型,默认为 script,我们设置为 module + parser: '@typescript-eslint/parser', // 使用 TypeScript 解析器 }, plugins: ['vue', '@typescript-eslint', 'prettier'], // 引用的插件列表 - rules : { - 'vue/multi-word-component-names' : 'off', // 关闭多词组件名检测 + rules: { + 'vue/multi-word-component-names': 'off', // 关闭多词组件名检测 '@typescript-eslint/no-var-requires': 'off', // 关闭 require 导入警告 - 'prettier/prettier' : [ + 'prettier/prettier': [ 'off', { - printWidth : 120, - tabWidth : 4, - useTabs : false, - semi : true, - singleQuote : true, - quoteProps : "as-needed", - jsxSingleQuote : false, - trailingComma : "all", - bracketSpacing : true, - jsxBracketSameLine : false, - arrowParens : "always", - requirePragma : false, - insertPragma : false, - proseWrap : "preserve", - htmlWhitespaceSensitivity: "css", - endOfLine : "auto" - } + printWidth: 120, + tabWidth: 4, + useTabs: false, + semi: true, + singleQuote: true, + quoteProps: 'as-needed', + jsxSingleQuote: false, + trailingComma: 'all', + bracketSpacing: true, + jsxBracketSameLine: false, + arrowParens: 'always', + requirePragma: false, + insertPragma: false, + proseWrap: 'preserve', + htmlWhitespaceSensitivity: 'css', + endOfLine: 'auto', + }, ], - "comma-dangle" : ["warn", "never"], - eqeqeq : "warn", - "arrow-parens" : 0, - "generator-star-spacing": 0, + 'comma-dangle': ['warn', 'never'], + eqeqeq: 'warn', + 'arrow-parens': 0, + 'generator-star-spacing': 0, - "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', - indent : [1, 4, { SwitchCase: 1 }], - "space-before-function-paren": ["warn", "never"], - "no-constant-condition" : ["warn"], - "no-empty" : ["off"], - "comma-spacing" : ["warn", { after: true }], - "key-spacing" : [ - "warn", + indent: [1, 4, { SwitchCase: 1 }], + 'space-before-function-paren': ['warn', 'never'], + 'no-constant-condition': ['warn'], + 'no-empty': ['off'], + 'comma-spacing': ['warn', { after: true }], + 'key-spacing': [ + 'warn', { singleLine: {}, - multiLine : { align: "colon" } - } - ] - } + multiLine: { align: 'colon' }, + }, + ], + }, }; diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index fd396c8..c560f2f 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,24 +17,24 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an +standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/README.md b/README.md index 2e9efa2..cb14fc0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # xiaon + @@ -100,19 +101,24 @@ npm run build 执行命令后会得到 dist 目录,可以放到自己的 web 服务器指定的路径下,然后访问即可。 或者运行: + ``` npm run preview ``` + 进行生产预览 --- + **注意事项:** 如果出现`"cygpath: command not found" when commiting to branch`错误,请添加你的Path环境变量:`C:\Program Files\Git\usr\bin`,更多信息请参考["cygpath: command not found" when commiting to branch #10326](https://github.com/desktop/desktop/issues/10326) --- + 又或者出现“Github Desktop提交commit时找不到node_modules\”错误,通过手动将 …/AppData/Roaming/npm/node_modules 复制到 …AppData\Local\GitHubDesktop\app-2.6.0\resources\app\git\ 中来完成这项工作文件夹,之后就可以正常提交了。 更多信息请参考[github desktop 提交commit时找不到node_modules\](https://blog.csdn.net/lh1234566/article/details/120180308) + ``` --- @@ -139,3 +145,4 @@ JavaScript 和 Web 开发人员的最佳选择,具有几乎可支持任何编 ## 使用许可 [Apache License 2.0](LICENSE) © Richard Littauer +``` diff --git a/doc/pull_request_template.md b/doc/pull_request_template.md index 9da6862..5a6de8a 100644 --- a/doc/pull_request_template.md +++ b/doc/pull_request_template.md @@ -1,15 +1,19 @@ ## 相关问题 + 请在此处链接相关的 issue。(可选) ## 截图 + 如果适用,请添加截图以帮助解释您的更改。(可选) ## 检查清单 -- [x] 我已阅读贡献指南。 -- [x] 我已遵循此项目的编码风格规范。 -- [x] 我的代码符合必要的文档要求。 -- [x] 我已添加了证明我的更改正常工作的测试。 -- [x] 我已更新必要的文档内容。 + +- [x] 我已阅读贡献指南。 +- [x] 我已遵循此项目的编码风格规范。 +- [x] 我的代码符合必要的文档要求。 +- [x] 我已添加了证明我的更改正常工作的测试。 +- [x] 我已更新必要的文档内容。 ## 其他信息 + 在此处添加任何其他上下文或信息,以提供有关这个拉取请求的更多详细信息。 diff --git a/index.html b/index.html index d59bff5..5265157 100644 --- a/index.html +++ b/index.html @@ -1,18 +1,21 @@ - + - - - - - - - - - - <%- VITE_APP_TITLE %> - - -
- - + + + + + + + + + + <%- VITE_APP_TITLE %> + + +
+ + diff --git a/src/assets/scss/_reset.scss b/src/assets/scss/_reset.scss index 79f6ba8..af55f6b 100644 --- a/src/assets/scss/_reset.scss +++ b/src/assets/scss/_reset.scss @@ -29,8 +29,8 @@ input, button, textarea, menu { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } header, footer, @@ -44,16 +44,16 @@ figure, figcaption, menu, details { - display: block; + display: block; } table { - border-collapse: collapse; - border-spacing: 0; + border-collapse: collapse; + border-spacing: 0; } caption, th { - text-align: left; - font-weight: normal; + text-align: left; + font-weight: normal; } html, body, @@ -61,7 +61,7 @@ fieldset, img, iframe, abbr { - border: 0; + border: 0; } i, cite, @@ -69,36 +69,36 @@ em, var, address, dfn { - font-style: normal; + font-style: normal; } [hidefocus], summary { - outline: 0; + outline: 0; } li { - list-style: none; + list-style: none; } sup, sub { - font-size: 83%; + font-size: 83%; } pre, code, kbd, samp { - font-family: inherit; + font-family: inherit; } textarea { - overflow: auto; - resize: none; + overflow: auto; + resize: none; } label, summary { - cursor: default; + cursor: default; } a, button { - cursor: pointer; + cursor: pointer; } h1, h2, @@ -109,7 +109,7 @@ h6, em, strong, b { - font-weight: bold; + font-weight: bold; } del, ins, @@ -117,7 +117,7 @@ u, s, a, a:hover { - text-decoration: none; + text-decoration: none; } body, textarea, @@ -126,14 +126,18 @@ button, select, keygen, legend { - font: 14px/1.14 arial, "Microsoft Yahei", "WenQuanYi Micro Hei", sans-serif; - color: #666; - outline: 0; + font: + 14px/1.14 arial, + 'Microsoft Yahei', + 'WenQuanYi Micro Hei', + sans-serif; + color: #666; + outline: 0; } body { - background: #fff; + background: #fff; } a, a:hover { - color: #666; + color: #666; } diff --git a/src/assets/scss/_variables.scss b/src/assets/scss/_variables.scss index 0aaeb82..86e43a3 100644 --- a/src/assets/scss/_variables.scss +++ b/src/assets/scss/_variables.scss @@ -1,11 +1,11 @@ -@import"../scss/color"; +@import '../scss/color'; $content-width: 1226px; $component-height: 32px; -$font-family-medium: 'PingFangSC-Medium', Helvetica, Tahoma, Arial, 'Microsoft YaHei', - 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif; -$font-family-regular: 'PingFangSC-Regular', Helvetica, Tahoma, Arial, 'Microsoft YaHei', - 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif; +$font-family-medium: 'PingFangSC-Medium', Helvetica, Tahoma, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', + 'WenQuanYi Micro Hei', sans-serif; +$font-family-regular: 'PingFangSC-Regular', Helvetica, Tahoma, Arial, 'Microsoft YaHei', 'Hiragino Sans GB', + 'WenQuanYi Micro Hei', sans-serif; @mixin font-class($fontFamily, $fontSize, $fontColor, $isBold) { font-family: $fontFamily; @@ -33,4 +33,3 @@ $font-family-regular: 'PingFangSC-Regular', Helvetica, Tahoma, Arial, 'Microsoft top: 50%; transform: translate(-50%, -50%); } - diff --git a/src/assets/scss/global.scss b/src/assets/scss/global.scss index feaec1a..27dc256 100644 --- a/src/assets/scss/global.scss +++ b/src/assets/scss/global.scss @@ -30,7 +30,8 @@ body { line-height: 1.375; } -.warp,.wrap { +.warp, +.wrap { width: $content-width; margin: 0 auto; } @@ -81,4 +82,4 @@ button { border-style: outset; border-color: buttonborder; border-image: initial; -} \ No newline at end of file +} diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index e054f5e..ab929d7 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -4,81 +4,81 @@ // Generated by unplugin-auto-import export {} declare global { - const EffectScope: typeof import('vue')['EffectScope'] - const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] - const axios: typeof import('./utils/http/axios')['default'] - const computed: typeof import('vue')['computed'] - const createApp: typeof import('vue')['createApp'] - const createPinia: typeof import('pinia')['createPinia'] - const customRef: typeof import('vue')['customRef'] - const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] - const defineComponent: typeof import('vue')['defineComponent'] - const defineStore: typeof import('pinia')['defineStore'] - const effectScope: typeof import('vue')['effectScope'] - const getActivePinia: typeof import('pinia')['getActivePinia'] - const getCurrentInstance: typeof import('vue')['getCurrentInstance'] - const getCurrentScope: typeof import('vue')['getCurrentScope'] - const h: typeof import('vue')['h'] - const http: typeof import('./utils/http/index')['default'] - const inject: typeof import('vue')['inject'] - const isProxy: typeof import('vue')['isProxy'] - const isReactive: typeof import('vue')['isReactive'] - const isReadonly: typeof import('vue')['isReadonly'] - const isRef: typeof import('vue')['isRef'] - const mapActions: typeof import('pinia')['mapActions'] - const mapGetters: typeof import('pinia')['mapGetters'] - const mapState: typeof import('pinia')['mapState'] - const mapStores: typeof import('pinia')['mapStores'] - const mapWritableState: typeof import('pinia')['mapWritableState'] - const markRaw: typeof import('vue')['markRaw'] - const nextTick: typeof import('vue')['nextTick'] - const onActivated: typeof import('vue')['onActivated'] - const onBeforeMount: typeof import('vue')['onBeforeMount'] - const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] - const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] - const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] - const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] - const onDeactivated: typeof import('vue')['onDeactivated'] - const onErrorCaptured: typeof import('vue')['onErrorCaptured'] - const onMounted: typeof import('vue')['onMounted'] - const onRenderTracked: typeof import('vue')['onRenderTracked'] - const onRenderTriggered: typeof import('vue')['onRenderTriggered'] - const onScopeDispose: typeof import('vue')['onScopeDispose'] - const onServerPrefetch: typeof import('vue')['onServerPrefetch'] - const onUnmounted: typeof import('vue')['onUnmounted'] - const onUpdated: typeof import('vue')['onUpdated'] - const provide: typeof import('vue')['provide'] - const reactive: typeof import('vue')['reactive'] - const readonly: typeof import('vue')['readonly'] - const ref: typeof import('vue')['ref'] - const request: typeof import('./utils/http/index')['request'] - const resolveComponent: typeof import('vue')['resolveComponent'] - const setActivePinia: typeof import('pinia')['setActivePinia'] - const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix'] - const shallowReactive: typeof import('vue')['shallowReactive'] - const shallowReadonly: typeof import('vue')['shallowReadonly'] - const shallowRef: typeof import('vue')['shallowRef'] - const storage: typeof import('./utils/storage')['storage'] - const storeToRefs: typeof import('pinia')['storeToRefs'] - const toRaw: typeof import('vue')['toRaw'] - const toRef: typeof import('vue')['toRef'] - const toRefs: typeof import('vue')['toRefs'] - const triggerRef: typeof import('vue')['triggerRef'] - const unref: typeof import('vue')['unref'] - const useAttrs: typeof import('vue')['useAttrs'] - const useCssModule: typeof import('vue')['useCssModule'] - const useCssVars: typeof import('vue')['useCssVars'] - const useLink: typeof import('vue-router')['useLink'] - const useRoute: typeof import('vue-router')['useRoute'] - const useRouter: typeof import('vue-router')['useRouter'] - const useSlots: typeof import('vue')['useSlots'] - const watch: typeof import('vue')['watch'] - const watchEffect: typeof import('vue')['watchEffect'] - const watchPostEffect: typeof import('vue')['watchPostEffect'] - const watchSyncEffect: typeof import('vue')['watchSyncEffect'] + const EffectScope: (typeof import('vue'))['EffectScope']; + const acceptHMRUpdate: (typeof import('pinia'))['acceptHMRUpdate']; + const axios: (typeof import('./utils/http/axios'))['default']; + const computed: (typeof import('vue'))['computed']; + const createApp: (typeof import('vue'))['createApp']; + const createPinia: (typeof import('pinia'))['createPinia']; + const customRef: (typeof import('vue'))['customRef']; + const defineAsyncComponent: (typeof import('vue'))['defineAsyncComponent']; + const defineComponent: (typeof import('vue'))['defineComponent']; + const defineStore: (typeof import('pinia'))['defineStore']; + const effectScope: (typeof import('vue'))['effectScope']; + const getActivePinia: (typeof import('pinia'))['getActivePinia']; + const getCurrentInstance: (typeof import('vue'))['getCurrentInstance']; + const getCurrentScope: (typeof import('vue'))['getCurrentScope']; + const h: (typeof import('vue'))['h']; + const http: (typeof import('./utils/http/index'))['default']; + const inject: (typeof import('vue'))['inject']; + const isProxy: (typeof import('vue'))['isProxy']; + const isReactive: (typeof import('vue'))['isReactive']; + const isReadonly: (typeof import('vue'))['isReadonly']; + const isRef: (typeof import('vue'))['isRef']; + const mapActions: (typeof import('pinia'))['mapActions']; + const mapGetters: (typeof import('pinia'))['mapGetters']; + const mapState: (typeof import('pinia'))['mapState']; + const mapStores: (typeof import('pinia'))['mapStores']; + const mapWritableState: (typeof import('pinia'))['mapWritableState']; + const markRaw: (typeof import('vue'))['markRaw']; + const nextTick: (typeof import('vue'))['nextTick']; + const onActivated: (typeof import('vue'))['onActivated']; + const onBeforeMount: (typeof import('vue'))['onBeforeMount']; + const onBeforeRouteLeave: (typeof import('vue-router'))['onBeforeRouteLeave']; + const onBeforeRouteUpdate: (typeof import('vue-router'))['onBeforeRouteUpdate']; + const onBeforeUnmount: (typeof import('vue'))['onBeforeUnmount']; + const onBeforeUpdate: (typeof import('vue'))['onBeforeUpdate']; + const onDeactivated: (typeof import('vue'))['onDeactivated']; + const onErrorCaptured: (typeof import('vue'))['onErrorCaptured']; + const onMounted: (typeof import('vue'))['onMounted']; + const onRenderTracked: (typeof import('vue'))['onRenderTracked']; + const onRenderTriggered: (typeof import('vue'))['onRenderTriggered']; + const onScopeDispose: (typeof import('vue'))['onScopeDispose']; + const onServerPrefetch: (typeof import('vue'))['onServerPrefetch']; + const onUnmounted: (typeof import('vue'))['onUnmounted']; + const onUpdated: (typeof import('vue'))['onUpdated']; + const provide: (typeof import('vue'))['provide']; + const reactive: (typeof import('vue'))['reactive']; + const readonly: (typeof import('vue'))['readonly']; + const ref: (typeof import('vue'))['ref']; + const request: (typeof import('./utils/http/index'))['request']; + const resolveComponent: (typeof import('vue'))['resolveComponent']; + const setActivePinia: (typeof import('pinia'))['setActivePinia']; + const setMapStoreSuffix: (typeof import('pinia'))['setMapStoreSuffix']; + const shallowReactive: (typeof import('vue'))['shallowReactive']; + const shallowReadonly: (typeof import('vue'))['shallowReadonly']; + const shallowRef: (typeof import('vue'))['shallowRef']; + const storage: (typeof import('./utils/storage'))['storage']; + const storeToRefs: (typeof import('pinia'))['storeToRefs']; + const toRaw: (typeof import('vue'))['toRaw']; + const toRef: (typeof import('vue'))['toRef']; + const toRefs: (typeof import('vue'))['toRefs']; + const triggerRef: (typeof import('vue'))['triggerRef']; + const unref: (typeof import('vue'))['unref']; + const useAttrs: (typeof import('vue'))['useAttrs']; + const useCssModule: (typeof import('vue'))['useCssModule']; + const useCssVars: (typeof import('vue'))['useCssVars']; + const useLink: (typeof import('vue-router'))['useLink']; + const useRoute: (typeof import('vue-router'))['useRoute']; + const useRouter: (typeof import('vue-router'))['useRouter']; + const useSlots: (typeof import('vue'))['useSlots']; + const watch: (typeof import('vue'))['watch']; + const watchEffect: (typeof import('vue'))['watchEffect']; + const watchPostEffect: (typeof import('vue'))['watchPostEffect']; + const watchSyncEffect: (typeof import('vue'))['watchSyncEffect']; } // for type re-export declare global { - // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue' + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'; } diff --git a/src/components.d.ts b/src/components.d.ts index 9135a6d..a698540 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -5,13 +5,13 @@ // Read more: https://github.com/vuejs/core/pull/3399 import '@vue/runtime-core' -export {} +export {}; declare module '@vue/runtime-core' { - export interface GlobalComponents { - Home: typeof import('./components/Home/index.vue')['default'] - NotFound: typeof import('./components/NotFound.vue')['default'] - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - } + export interface GlobalComponents { + Home: (typeof import('./components/Home/index.vue'))['default']; + NotFound: (typeof import('./components/NotFound.vue'))['default']; + RouterLink: (typeof import('vue-router'))['RouterLink']; + RouterView: (typeof import('vue-router'))['RouterView']; + } } diff --git a/src/components/Home/index.vue b/src/components/Home/index.vue index 8123883..27d9a81 100644 --- a/src/components/Home/index.vue +++ b/src/components/Home/index.vue @@ -1,5 +1,5 @@ diff --git a/src/components/NotFound.vue b/src/components/NotFound.vue index 4a58aed..66821f9 100644 --- a/src/components/NotFound.vue +++ b/src/components/NotFound.vue @@ -17,10 +17,10 @@ import { useUserStore } from '@/store/modules/user'; const userStore = useUserStore(); const userData = reactive({ username: 'beibei', - password: '1312' + password: '1312', }); console.log(userData.password, userData.username); -const onLogin = async() => { +const onLogin = async () => { // 使用 actions,当作函数一样直接调用 // login action 定义为了 async 函数,所以它返回一个 Promise await userStore.login(userData); diff --git a/src/router/index.ts b/src/router/index.ts index 9ad7095..08d9044 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -3,9 +3,9 @@ import { routes } from './routes'; const router = createRouter({ // 使用 `createWebHistory()` 创建路由历史时,如果没有传递 `base` 参数,则会默认使用 `/` 作为基础路径 - history : createWebHashHistory(process.env.BASE_URL), + history: createWebHashHistory(process.env.BASE_URL), routes, // scrollBehavior是一个函数,接收to和from两个路由对象作为参数,作用是在路由切换时,控制页面滚动行为 - scrollBehavior: () => ({ left: 0, top: 0 }) + scrollBehavior: () => ({ left: 0, top: 0 }), }); export default router; diff --git a/src/router/routes.ts b/src/router/routes.ts index 5a5751f..6f906f4 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -4,34 +4,34 @@ import { RouteRecordRaw } from 'vue-router'; export const routes: Array = [ // 重定向 { - path : '/', - redirect: '/login' + path: '/', + redirect: '/login', }, // 登录 // 登录 { - path : '/login', - name : 'login', - component: () => import('../views/Login/index.vue') + path: '/login', + name: 'login', + component: () => import('../views/Login/index.vue'), }, { // 主页 - path : '/home', - name : 'home', + path: '/home', + name: 'home', component: () => import('../components/Home/index.vue'), - children : [ + children: [ // 首页 { - path : '/index', - name : 'index', - component: () => import('../components/Home/index.vue') - } - ] + path: '/index', + name: 'index', + component: () => import('../components/Home/index.vue'), + }, + ], }, // 404 { - path : '/:pathMatch(.*)*', - name : 'not-found', - component: () => import('../components/NotFound.vue') - } + path: '/:pathMatch(.*)*', + name: 'not-found', + component: () => import('../components/NotFound.vue'), + }, ]; diff --git a/src/store/modules/menu/index.ts b/src/store/modules/menu/index.ts index 2d111bd..d247d7e 100644 --- a/src/store/modules/menu/index.ts +++ b/src/store/modules/menu/index.ts @@ -3,13 +3,13 @@ import { defineStore } from 'pinia'; export const useMenuStore = defineStore('menu', { state: () => { return { - isCollapse: true + isCollapse: true, }; }, getters: {}, actions: { updateCollapse() { this.isCollapse = !this.isCollapse; - } - } + }, + }, }); diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index d8b3a31..368bbe1 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -4,10 +4,10 @@ import UserLoginService, { UserState } from '@/api/user'; export const useUserStore = defineStore('user', { state: (): UserState => ({ username: '', - token : '' + token: '', }), getters: { - hello: (state): string => 'Hello!' + state.username + hello: (state): string => 'Hello!' + state.username, }, actions: { // 异步 action,一般用来处理异步逻辑 @@ -19,10 +19,10 @@ export const useUserStore = defineStore('user', { logout(): void { this.token = ''; this.username = ''; - } + }, }, // 开启数据缓存 persist: { - storage: sessionStorage - } + storage: sessionStorage, + }, }); diff --git a/src/utils/http/axios.ts b/src/utils/http/axios.ts index f2d27ab..41d7c6f 100644 --- a/src/utils/http/axios.ts +++ b/src/utils/http/axios.ts @@ -17,18 +17,18 @@ axios.defaults.timeout = 1000 * 10; */ const service = axios.create({ // 根据不同env设置不同的baseURL - baseURL : import.meta.env.VITE_APP_API_BASE_URL, - responseType : 'json', + baseURL: import.meta.env.VITE_APP_API_BASE_URL, + responseType: 'json', transformResponse: [ - function(data) { + function (data) { try { data = JSON.parse(data); } catch (e) { console.log(e); } return data; - } - ] + }, + ], }); /** @@ -39,7 +39,7 @@ const service = axios.create({ service.interceptors.request.use( (config: AxiosRequestConfig | any) => { config.headers = { - ...config.headers + ...config.headers, // ...auth.headers() // 自定义headers,如token等 }; @@ -47,7 +47,7 @@ service.interceptors.request.use( }, (error: AxiosError) => { return Promise.reject(error); - } + }, ); /** @@ -112,7 +112,7 @@ class DefaultErrorHandler implements ErrorHandler { const errorHandlers: Record = { 404: new DefaultErrorHandler(), 112: new TokenExpiredErrorHandler(), - 212: new NoPermissionErrorHandler() + 212: new NoPermissionErrorHandler(), }; /** diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index 8c63011..db44ab9 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -80,10 +80,10 @@ const http = { url, data, ...config, - method : 'POST', - headers: { 'Content-Type': 'multipart/form-data' } + method: 'POST', + headers: { 'Content-Type': 'multipart/form-data' }, }); - } + }, }; export default http; diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 5fc6362..25f4d13 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -31,5 +31,5 @@ export const storage = { clear() { localStorage.clear(); - } + }, }; diff --git a/src/views/Login/index.vue b/src/views/Login/index.vue index 3f19424..3e2787c 100644 --- a/src/views/Login/index.vue +++ b/src/views/Login/index.vue @@ -1,18 +1,18 @@ @@ -20,137 +20,135 @@ import { reactive, ref } from 'vue'; import { storeToRefs } from 'pinia'; import { useUserStore } from '@/store/modules/user'; - - diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index ecf2e2d..a43db67 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,12 +1,12 @@ /// interface ImportMetaEnv { - readonly VITE_APP_TITLE: string; - readonly VITE_APP_API_BASE_URL: string; - readonly VUE_APP_BASE_URL: string; - readonly VITE_BUILD_SOURCEMAP: string; - readonly VITE_BUILD_DROP_CONSOLE: string; + readonly VITE_APP_TITLE: string; + readonly VITE_APP_API_BASE_URL: string; + readonly VUE_APP_BASE_URL: string; + readonly VITE_BUILD_SOURCEMAP: string; + readonly VITE_BUILD_DROP_CONSOLE: string; } interface ImportMeta { - readonly env: ImportMetaEnv; + readonly env: ImportMetaEnv; } diff --git a/vite.config.ts b/vite.config.ts index 4759514..7b84461 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -33,21 +33,21 @@ function defineConfig({ command, mode }: DefineConfigOptions) { vue(), vueJsx(), AutoImport({ - imports : ['vue', 'vue-router', 'pinia'], + imports: ['vue', 'vue-router', 'pinia'], // 指定引入根目录下的 requests,config,utils 目录内的所有函数 - dirs : ['./src/requests/', './src/config/', './src/utils/**'], + dirs: ['./src/requests/', './src/config/', './src/utils/**'], // 指定生成的 d.ts 文件位置与文件名 - dts : './src/auto-imports.d.ts', + dts: './src/auto-imports.d.ts', // 配置开启 eslint - eslintrc : { enabled: true }, - resolvers: [ElementPlusResolver()] + eslintrc: { enabled: true }, + resolvers: [ElementPlusResolver()], }), Components({ // 指定组件位置,默认是src/components - dirs : ['src/components'], + dirs: ['src/components'], // 配置文件生成位置 - dts : 'src/components.d.ts', - resolvers: [NaiveUiResolver(), ElementPlusResolver()] + dts: 'src/components.d.ts', + resolvers: [NaiveUiResolver(), ElementPlusResolver()], }), // 默认会向 index.html 注入 .env 文件的内容,类似 vite 的 loadEnv函数 // 还可配置entry入口文件, inject自定义注入数据等 @@ -55,93 +55,93 @@ function defineConfig({ command, mode }: DefineConfigOptions) { // 开启gzip压缩 viteCompression({ // 配置压缩文件的大小>1kb - threshold: 1024 + threshold: 1024, }), // 打包分析 visualizer(), // mock viteMockServe({ //是否支持ts - supportTs : true, + supportTs: true, //是否打印日志 - logger : false, + logger: false, //mock文件夹路径 - mockPath : './src/mock', + mockPath: './src/mock', //是否开启本地mock - localEnabled: true + localEnabled: true, }), VitePWA({ includeAssets: ['favicon.svg'], - manifest : false, - registerType : 'autoUpdate', - workbox : { + manifest: false, + registerType: 'autoUpdate', + workbox: { runtimeCaching: [ { // 缓存所有接口 urlPattern: /\/api-dev\/|\/api-pro\//, - handler : 'CacheFirst', - options : { - cacheName: 'interface-cache' - } + handler: 'CacheFirst', + options: { + cacheName: 'interface-cache', + }, }, { urlPattern: /(.*?)\.(js|css|ts)/, // js /css /ts静态资源缓存 - handler : 'CacheFirst', - options : { - cacheName: 'js-css-cache' - } + handler: 'CacheFirst', + options: { + cacheName: 'js-css-cache', + }, }, { urlPattern: /(.*?)\.(png|jpe?g|svg|gif|bmp|psd|tiff|tga|eps)/, // 图片缓存 - handler : 'CacheFirst', - options : { - cacheName: 'image-cache' - } - } - ] - } + handler: 'CacheFirst', + options: { + cacheName: 'image-cache', + }, + }, + ], + }, }), - preload() + preload(), ], base: '/Vue3-project-template/', - css : { + css: { preprocessorOptions: { // 配置全局scss变量 scss: { - additionalData: '@import "./src/assets/scss/_color.scss";' - } - } + additionalData: '@import "./src/assets/scss/_color.scss";', + }, + }, }, server: { - host : '0.0.0.0', - port : 3000, + host: '0.0.0.0', + port: 3000, // 设为 true 时若端口已会被占用直接退出,而不是尝试下一个可用端口。 strictPort: false, - open : true, - proxy : { + open: true, + proxy: { '/api-dev': { - target : 'http://localhost:3000/', + target: 'http://localhost:3000/', changeOrigin: true, - rewrite : (path: string) => path.replace(/^\/api-dev/, '') + rewrite: (path: string) => path.replace(/^\/api-dev/, ''), }, '/api-pro': { - target : 'http://www.weather.com.cn', + target: 'http://www.weather.com.cn', changeOrigin: true, - rewrite : (path: string) => path.replace(/^\/api-pro/, '') - } - } + rewrite: (path: string) => path.replace(/^\/api-pro/, ''), + }, + }, }, // resolve是一个对象,里面有一个alias属性,用来配置路径别名,这里配置了@指向src目录 resolve: { alias: { '@': path.resolve(__dirname, 'src') } }, // 配置全局变量,这里配置了process.env.NODE_ENV,这样在代码中就可以直接使用process.env.NODE_ENV了 - define : { 'process.env': env }, + define: { 'process.env': env }, // build是一个对象,里面有一个outDir属性,用来配置打包后的文件夹名称 - build : { - outDir : 'dist', // 指定打包路径,默认为项目根目录下的 dist 目录 - sourcemap : env.VITE_BUILD_SOURCEMAP === 'true', + build: { + outDir: 'dist', // 指定打包路径,默认为项目根目录下的 dist 目录 + sourcemap: env.VITE_BUILD_SOURCEMAP === 'true', // minify默认esbuild,esbuild模式下terserOptions将失效 // vite3变化:Terser 现在是一个可选依赖,如果你使用的是 build.minify: 'terser',你需要手动安装它 `npm add -D terser` - minify : 'terser', + minify: 'terser', rollupOptions: { output: { manualChunks: (id: string) => { @@ -149,18 +149,18 @@ function defineConfig({ command, mode }: DefineConfigOptions) { if (id.includes('node_modules')) { return 'vendor'; } - } - } + }, + }, }, terserOptions: { compress: { keep_infinity: true, // 防止 Infinity 被压缩成 1/0,这可能会导致 Chrome 上的性能问题 - drop_console : isProduction && env.VITE_BUILD_DROP_CONSOLE === 'true', // 去除 console - drop_debugger: isProduction // 去除 debugger - } + drop_console: isProduction && env.VITE_BUILD_DROP_CONSOLE === 'true', // 去除 console + drop_debugger: isProduction, // 去除 debugger + }, }, - chunkSizeWarningLimit: 1500 // chunk 大小警告的限制(以 kbs 为单位) - } + chunkSizeWarningLimit: 1500, // chunk 大小警告的限制(以 kbs 为单位) + }, }; } diff --git a/xiaon_c5z3Cp/static/api.js b/xiaon_c5z3Cp/static/api.js index 74b2159..d04cb38 100644 --- a/xiaon_c5z3Cp/static/api.js +++ b/xiaon_c5z3Cp/static/api.js @@ -1,37 +1,35 @@ (function () { var w = window, - C = "___grecaptcha_cfg", + C = '___grecaptcha_cfg', cfg = (w[C] = w[C] || {}), - N = "grecaptcha"; + N = 'grecaptcha'; var gr = (w[N] = w[N] || {}); gr.ready = gr.ready || function (f) { - (cfg["fns"] = cfg["fns"] || []).push(f); + (cfg['fns'] = cfg['fns'] || []).push(f); }; - w["__recaptcha_api"] = "https://www.google.com/recaptcha/api2/"; - (cfg["render"] = cfg["render"] || []).push("explicit"); - (cfg["onload"] = cfg["onload"] || []).push("onloadCallback"); - w["__google_recaptcha_client"] = true; + w['__recaptcha_api'] = 'https://www.google.com/recaptcha/api2/'; + (cfg['render'] = cfg['render'] || []).push('explicit'); + (cfg['onload'] = cfg['onload'] || []).push('onloadCallback'); + w['__google_recaptcha_client'] = true; var d = document, - po = d.createElement("script"); - po.type = "text/javascript"; + po = d.createElement('script'); + po.type = 'text/javascript'; po.async = true; - var m = d.createElement("meta"); - m.httpEquiv = "origin-trial"; + var m = d.createElement('meta'); + m.httpEquiv = 'origin-trial'; m.content = - "Az520Inasey3TAyqLyojQa8MnmCALSEU29yQFW8dePZ7xQTvSt73pHazLFTK5f7SyLUJSo2uKLesEtEa9aUYcgMAAACPeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IkRpc2FibGVUaGlyZFBhcnR5U3RvcmFnZVBhcnRpdGlvbmluZyIsImV4cGlyeSI6MTcyNTQwNzk5OSwiaXNTdWJkb21haW4iOnRydWUsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0="; + 'Az520Inasey3TAyqLyojQa8MnmCALSEU29yQFW8dePZ7xQTvSt73pHazLFTK5f7SyLUJSo2uKLesEtEa9aUYcgMAAACPeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IkRpc2FibGVUaGlyZFBhcnR5U3RvcmFnZVBhcnRpdGlvbmluZyIsImV4cGlyeSI6MTcyNTQwNzk5OSwiaXNTdWJkb21haW4iOnRydWUsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0='; d.head.prepend(m); - po.src = - "https://www.gstatic.com/recaptcha/releases/0hCdE87LyjzAkFO5Ff-v7Hj1/recaptcha__zh_cn.js"; - po.crossOrigin = "anonymous"; - po.integrity = - "sha384-nvvERczED3KjSxZfEFFVT2H6DgamVMjw61V5MHFkDryTDTBoWFoG/24MiImPw34y"; - var e = d.querySelector("script[nonce]"), - n = e && (e["nonce"] || e.getAttribute("nonce")); + po.src = 'https://www.gstatic.com/recaptcha/releases/0hCdE87LyjzAkFO5Ff-v7Hj1/recaptcha__zh_cn.js'; + po.crossOrigin = 'anonymous'; + po.integrity = 'sha384-nvvERczED3KjSxZfEFFVT2H6DgamVMjw61V5MHFkDryTDTBoWFoG/24MiImPw34y'; + var e = d.querySelector('script[nonce]'), + n = e && (e['nonce'] || e.getAttribute('nonce')); if (n) { - po.setAttribute("nonce", n); + po.setAttribute('nonce', n); } - var s = d.getElementsByTagName("script")[0]; + var s = d.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); diff --git a/xiaon_c5z3Cp/static/client.crisp.chat_l.js b/xiaon_c5z3Cp/static/client.crisp.chat_l.js index 0d85d93..ec89f98 100644 --- a/xiaon_c5z3Cp/static/client.crisp.chat_l.js +++ b/xiaon_c5z3Cp/static/client.crisp.chat_l.js @@ -11,7 +11,7 @@ var t, i = this; try { - (this.ns = "CrispLoader"), + (this.ns = 'CrispLoader'), (this.n = { warn: function (t, i) {}, error: function (t, i) {}, @@ -20,64 +20,60 @@ debug: function (t, i) {}, }), (this.s = !1), - (this.f = "crisp-client"), - (this.w = "client.crisp.chat"), - (this.y = "client.relay.crisp.chat"), - (this.v = "stream.relay.crisp.chat"), - (this.x = "f2465fc"), - (this.on = "production"), - (this.fn = "https:"), - (this._n = "https://crisp.chat"), - (this.fs = "https://go.crisp.chat"), - (this.ws = "https://image.crisp.chat"), - (this.ms = "https://game.crisp.chat"), - (this.$s = "".concat(this.fn, "//").concat(this.y)), - (this._e = "".concat(this.fn, "//").concat(this.v)), - (this.io = "".concat(this.fn, "//").concat(this.w)), + (this.f = 'crisp-client'), + (this.w = 'client.crisp.chat'), + (this.y = 'client.relay.crisp.chat'), + (this.v = 'stream.relay.crisp.chat'), + (this.x = 'f2465fc'), + (this.on = 'production'), + (this.fn = 'https:'), + (this._n = 'https://crisp.chat'), + (this.fs = 'https://go.crisp.chat'), + (this.ws = 'https://image.crisp.chat'), + (this.ms = 'https://game.crisp.chat'), + (this.$s = ''.concat(this.fn, '//').concat(this.y)), + (this._e = ''.concat(this.fn, '//').concat(this.v)), + (this.io = ''.concat(this.fn, '//').concat(this.w)), (this.do = [ { - urls: [ - "stun:stun.media.crisp.chat:3478", - "stun:stun.media.crisp.chat:3479", - ], + urls: ['stun:stun.media.crisp.chat:3478', 'stun:stun.media.crisp.chat:3479'], }, { urls: [ - "turn:turn.media.crisp.chat:3478?transport=udp", - "turn:turn.media.crisp.chat:3478?transport=tcp", - "turn:turn.media.crisp.chat:3479?transport=udp", - "turn:turn.media.crisp.chat:3479?transport=tcp", - "turns:turn.media.crisp.chat:443?transport=tcp", + 'turn:turn.media.crisp.chat:3478?transport=udp', + 'turn:turn.media.crisp.chat:3478?transport=tcp', + 'turn:turn.media.crisp.chat:3479?transport=udp', + 'turn:turn.media.crisp.chat:3479?transport=tcp', + 'turns:turn.media.crisp.chat:443?transport=tcp', ], - username: "client_9F9kh", - credential: - "DPCEHTqUb7jiJ2mvnzcUmFV4mKK6c8jntUXo4gC8tYCbHTocuy9YJiCxpQ4tmG3p", + username: 'client_9F9kh', + credential: 'DPCEHTqUb7jiJ2mvnzcUmFV4mKK6c8jntUXo4gC8tYCbHTocuy9YJiCxpQ4tmG3p', }, ]), (this._a = !0), (this._f = { domains: [], agents: [ - "Trident", - "Googlebot", - "Bingbot", - "Slurp", - "DuckDuckBot", - "Baiduspider", - "YandexBot", - "GTmetrix", - "Lighthouse", - "Acunetix", - "Ahrefs", - "SemrushBot", - "SiteAuditBot", - "SplitSignalBot", + 'Trident', + 'Googlebot', + 'Bingbot', + 'Slurp', + 'DuckDuckBot', + 'Baiduspider', + 'YandexBot', + 'GTmetrix', + 'Lighthouse', + 'Acunetix', + 'Ahrefs', + 'SemrushBot', + 'SiteAuditBot', + 'SplitSignalBot', ], }), - (this.el = "static/javascripts"), - (this.pp = "static/stylesheets"), - (this._p = "$__CRISP_INSTANCE"), - (this.wp = "$__CRISP_INCLUDED"), + (this.el = 'static/javascripts'), + (this.pp = 'static/stylesheets'), + (this._p = '$__CRISP_INSTANCE'), + (this.wp = '$__CRISP_INCLUDED'), (this.mp = 100), (this.Ip = 3e4), (this.yp = 1e3), @@ -100,28 +96,19 @@ (this.Ep = /(?:http\:|https\:)?\/\/[^\/]+\/l\/([a-zA-Z0-9\-_]+)\.js/i), this.Sp(), !0 === window[this.wp] || - (void 0 !== window[this._p] && - "function" == typeof window[this._p].__init) || + (void 0 !== window[this._p] && 'function' == typeof window[this._p].__init) || !0 !== this.Pp() || ((window[this.wp] = !0), - "interactive" === document.readyState || - "complete" === document.readyState + 'interactive' === document.readyState || 'complete' === document.readyState ? this.init() - : ((t = - document.onreadystatechange || - function () {}), - window.addEventListener( - "DOMContentLoaded", - function () { - i.init(); - } - ), + : ((t = document.onreadystatechange || function () {}), + window.addEventListener('DOMContentLoaded', function () { + i.init(); + }), (document.onreadystatechange = function () { - "function" == typeof t && t(), - ("interactive" !== - document.readyState && - "complete" !== - document.readyState) || + 'function' == typeof t && t(), + ('interactive' !== document.readyState && + 'complete' !== document.readyState) || setTimeout(function () { i.init(); }, i.yp); @@ -135,38 +122,24 @@ var i, n, s = this, - e = "init"; + e = 'init'; try { this.Dp && !0 !== this.Op && ((this.Op = !0), - ((i = document.createElement("div")).id = - "crisp-loader"), - document - .getElementsByTagName("body")[0] - .appendChild(i), + ((i = document.createElement('div')).id = 'crisp-loader'), + document.getElementsByTagName('body')[0].appendChild(i), (n = function () { - return ( - "none" === - window - .getComputedStyle(i) - .getPropertyValue("display") - ); + return 'none' === window.getComputedStyle(i).getPropertyValue('display'); }), (function t() { s.Tp = setTimeout(function () { (s.Tp = null), (s.Np -= s.mp), void 0 !== window[s._p] && - "function" == - typeof window[s._p].__init && + 'function' == typeof window[s._p].__init && !0 === n() - ? (s.n.info( - "" - .concat(s.ns, ".") - .concat(e), - "Dependencies loaded" - ), + ? (s.n.info(''.concat(s.ns, '.').concat(e), 'Dependencies loaded'), i.parentNode.removeChild(i), window[s._p].__init({ dollar_crisp: window[s._p], @@ -200,75 +173,60 @@ }, })) : 0 < s.Np - ? t() - : s.n.error( - "" - .concat(s.ns, ".") - .concat(e), - "Could not load dependencies" - ); + ? t() + : s.n.error( + ''.concat(s.ns, '.').concat(e), + 'Could not load dependencies', + ); }, s.mp); })()); } catch (t) {} }), (i.reset = function () { try { - null !== this.Tp && clearTimeout(this.Tp), - this.Sp(), - this.init(); + null !== this.Tp && clearTimeout(this.Tp), this.Sp(), this.init(); } catch (t) {} }), (i.bp = function () { try { - this.Fp("dns-prefetch", this.$s), - this.Fp("preconnect", this.io), - this.Xp(), - this.zp(); + this.Fp('dns-prefetch', this.$s), this.Fp('preconnect', this.io), this.Xp(), this.zp(); } catch (t) {} }), (i.Fp = function (t, i) { try { - var n = document.createElement("link"); - n.setAttribute("href", i), - n.setAttribute("rel", t), - n.setAttribute("crossorigin", ""), + var n = document.createElement('link'); + n.setAttribute('href', i), + n.setAttribute('rel', t), + n.setAttribute('crossorigin', ''), this.Jp(n), - document - .getElementsByTagName("head")[0] - .appendChild(n); + document.getElementsByTagName('head')[0].appendChild(n); } catch (t) {} }), (i.Xp = function () { try { - var t = document.createElement("script"); - (t.src = [ - "".concat(this.io, "/"), - "".concat(this.el, "/"), - "client.js?".concat(this.x), - ].join("")), - (t.type = "text/javascript"), + var t = document.createElement('script'); + (t.src = [''.concat(this.io, '/'), ''.concat(this.el, '/'), 'client.js?'.concat(this.x)].join( + '', + )), + (t.type = 'text/javascript'), (t.async = !0), this.Jp(t), - document - .getElementsByTagName("head")[0] - .appendChild(t); + document.getElementsByTagName('head')[0].appendChild(t); } catch (t) {} }), (i.zp = function () { try { var t = this.Wp(), - i = document.createElement("link"); + i = document.createElement('link'); (i.href = [ - "".concat(this.io, "/"), - "".concat(this.pp, "/"), - "client_".concat(t, ".css?").concat(this.x), - ].join("")), - (i.type = "text/css"), - (i.rel = "stylesheet"), + ''.concat(this.io, '/'), + ''.concat(this.pp, '/'), + 'client_'.concat(t, '.css?').concat(this.x), + ].join('')), + (i.type = 'text/css'), + (i.rel = 'stylesheet'), this.Jp(i), - document - .getElementsByTagName("head")[0] - .appendChild(i); + document.getElementsByTagName('head')[0].appendChild(i); } catch (t) {} }), (i.Sp = function () { @@ -284,75 +242,58 @@ (this.Gp = window.navigator.userAgent), (this.xp = new Date().getTimezoneOffset()), (this.Lp = this.Qp()), - "string" == typeof CRISP_WEBSITE_ID && CRISP_WEBSITE_ID + 'string' == typeof CRISP_WEBSITE_ID && CRISP_WEBSITE_ID ? (this.Dp = CRISP_WEBSITE_ID) : (this.Dp = this.Vp()), - "string" == typeof CRISP_TOKEN_ID && CRISP_TOKEN_ID + 'string' == typeof CRISP_TOKEN_ID && CRISP_TOKEN_ID ? (this.Kp = CRISP_TOKEN_ID) - : "number" == typeof CRISP_TOKEN_ID && - CRISP_TOKEN_ID - ? (this.Kp = CRISP_TOKEN_ID.toString()) - : (this.Kp = null), - "number" == typeof CRISP_COOKIE_EXPIRE && - 0 < CRISP_COOKIE_EXPIRE + : 'number' == typeof CRISP_TOKEN_ID && CRISP_TOKEN_ID + ? (this.Kp = CRISP_TOKEN_ID.toString()) + : (this.Kp = null), + 'number' == typeof CRISP_COOKIE_EXPIRE && 0 < CRISP_COOKIE_EXPIRE ? (this.Pi = CRISP_COOKIE_EXPIRE) : (this.Pi = null), - "string" == typeof CRISP_COOKIE_DOMAIN && - CRISP_COOKIE_DOMAIN + 'string' == typeof CRISP_COOKIE_DOMAIN && CRISP_COOKIE_DOMAIN ? (this.Ap = CRISP_COOKIE_DOMAIN) : (this.Ap = null), - "function" == typeof CRISP_READY_TRIGGER - ? (this.Mp = CRISP_READY_TRIGGER) - : (this.Mp = {}), - "object" == typeof CRISP_RUNTIME_CONFIG - ? (this.Yp = CRISP_RUNTIME_CONFIG) - : (this.Yp = {}), - "object" == typeof CRISP_INCLUDE_ATTRS - ? (this.Zp = CRISP_INCLUDE_ATTRS) - : (this.Zp = {}); + 'function' == typeof CRISP_READY_TRIGGER ? (this.Mp = CRISP_READY_TRIGGER) : (this.Mp = {}), + 'object' == typeof CRISP_RUNTIME_CONFIG ? (this.Yp = CRISP_RUNTIME_CONFIG) : (this.Yp = {}), + 'object' == typeof CRISP_INCLUDE_ATTRS ? (this.Zp = CRISP_INCLUDE_ATTRS) : (this.Zp = {}); }), (i.$p = function () { try { (this.Up = []), - "function" == typeof window.MutationObserver && - "function" == typeof JSON.stringify && - this.Up.push("browsing"), - (("function" == typeof window.RTCPeerConnection && - "object" == typeof navigator.mediaDevices && - "https:" === document.location.protocol && + 'function' == typeof window.MutationObserver && + 'function' == typeof JSON.stringify && + this.Up.push('browsing'), + (('function' == typeof window.RTCPeerConnection && + 'object' == typeof navigator.mediaDevices && + 'https:' === document.location.protocol && (window.innerWidth || 0) >= this.Cp && (window.innerHeight || 0) >= this.gp) || !0 === this.s) && - this.Up.push("call"); + this.Up.push('call'); } catch (t) {} }), (i.qp = function () { var t; try { this.Yp.locale && - (-1 !== (t = this.Lp.indexOf(this.Yp.locale)) && - this.Lp.splice(t, 1), + (-1 !== (t = this.Lp.indexOf(this.Yp.locale)) && this.Lp.splice(t, 1), this.Lp.unshift(this.Yp.locale)); } catch (t) {} }), (i.Jp = function (t) { try { - for (var i in this.Zp) - this.Zp.hasOwnProperty(i) && - t.setAttribute(i, this.Zp[i]); + for (var i in this.Zp) this.Zp.hasOwnProperty(i) && t.setAttribute(i, this.Zp[i]); } catch (t) {} }), (i.Vp = function () { var t = null; try { - for ( - var i = document.querySelectorAll("script[src]"), - n = 0; - n < i.length; - n++ - ) { + for (var i = document.querySelectorAll('script[src]'), n = 0; n < i.length; n++) { var s = this.Ep.exec(i[n].src); - if (s && "string" == typeof s[1]) { + if (s && 'string' == typeof s[1]) { t = s[1]; break; } @@ -363,32 +304,28 @@ } }), (i.Wp = function () { - var t = "default"; + var t = 'default'; try { - var i = (navigator.userAgent || "").toLowerCase(), - n = (navigator.appVersion || "").toLowerCase(), + var i = (navigator.userAgent || '').toLowerCase(), + n = (navigator.appVersion || '').toLowerCase(), s = !1; if ( (!0 !== s && - ((-1 === i.indexOf("opera mini/") && - -1 === i.indexOf("msie") && - -1 === n.indexOf("trident/")) || + ((-1 === i.indexOf('opera mini/') && + -1 === i.indexOf('msie') && + -1 === n.indexOf('trident/')) || (s = !0)), !0 !== s) ) for (var e = 0; e < this.Rp.length; e++) { var r = this.Rp[e], o = i.match(r.pattern); - if ( - null != o && - o[1] && - parseInt(o[1], 10) <= r.version - ) { + if (null != o && o[1] && parseInt(o[1], 10) <= r.version) { s = !0; break; } } - !0 === s && (t = "legacy"); + !0 === s && (t = 'legacy'); } catch (t) { } finally { return t; @@ -402,8 +339,7 @@ !0 === this.i_(this.Bp) || !0 === this.n_(this.Gp) || !window.WebSocket || - (window.__nativePerformance && - window.__nativePromise)) && + (window.__nativePerformance && window.__nativePromise)) && (t = !1); } catch (t) { } finally { @@ -418,14 +354,11 @@ !0 === navigator.cookieEnabled ? (n = !0) : window.localStorage && - "function" == - typeof window.localStorage.setItem && - "function" == - typeof window.localStorage.getItem && - "function" == - typeof window.localStorage.removeItem && - ((t = "".concat(new Date().getTime())), - (i = "crisp-client/loader/storage/check"), + 'function' == typeof window.localStorage.setItem && + 'function' == typeof window.localStorage.getItem && + 'function' == typeof window.localStorage.removeItem && + ((t = ''.concat(new Date().getTime())), + (i = 'crisp-client/loader/storage/check'), window.localStorage.setItem(i, t), (n = window.localStorage.getItem(i) === t)); } catch (t) { @@ -434,16 +367,13 @@ } }), (i.i_ = function () { - var t = - 0 < arguments.length && void 0 !== arguments[0] - ? arguments[0] - : "", + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : '', i = !1; try { if (t) for (var n = 0; n < this._f.domains.length; n++) { var s = this._f.domains[n], - e = ".".concat(s); + e = '.'.concat(s); if (t === s || t.slice(-1 * e.length) === e) { i = !0; break; @@ -455,10 +385,7 @@ } }), (i.n_ = function () { - var t = - 0 < arguments.length && void 0 !== arguments[0] - ? arguments[0] - : "", + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : '', i = !1; try { if (t) @@ -478,16 +405,9 @@ for ( var i, n = - 0 < - (null === (i = navigator.languages) || - void 0 === i - ? void 0 - : i.length) + 0 < (null === (i = navigator.languages) || void 0 === i ? void 0 : i.length) ? navigator.languages - : [ - navigator.language || - navigator.userLanguage, - ], + : [navigator.language || navigator.userLanguage], s = 0; s < n.length; s++ diff --git a/xiaon_c5z3Cp/static/crisp-loader.js b/xiaon_c5z3Cp/static/crisp-loader.js index 5273bc1..fda30ec 100644 --- a/xiaon_c5z3Cp/static/crisp-loader.js +++ b/xiaon_c5z3Cp/static/crisp-loader.js @@ -1,11 +1,11 @@ // crisp-loader.js window.$crisp = []; -window.CRISP_WEBSITE_ID = "04ac09c4-860f-4476-aede-00bc119b2f6f"; +window.CRISP_WEBSITE_ID = '04ac09c4-860f-4476-aede-00bc119b2f6f'; (function () { - var d = document; - var s = d.createElement("script"); - s.src = "/static/client.crisp.chat_l.js"; - s.async = 1; - d.getElementsByTagName("head")[0].appendChild(s); -})(); \ No newline at end of file + var d = document; + var s = d.createElement('script'); + s.src = '/static/client.crisp.chat_l.js'; + s.async = 1; + d.getElementsByTagName('head')[0].appendChild(s); +})(); diff --git a/xiaon_c5z3Cp/static/download.js b/xiaon_c5z3Cp/static/download.js index ec92e74..a371b32 100644 --- a/xiaon_c5z3Cp/static/download.js +++ b/xiaon_c5z3Cp/static/download.js @@ -1,6 +1,6 @@ /*启动检测与页面初始化localStorage*/ function bootcheck() { - let a = localStorage.getItem("authorization"); + let a = localStorage.getItem('authorization'); if (a) { getinfo(); } else { @@ -8,20 +8,20 @@ function bootcheck() { } } -var domain = ""; +var domain = ''; /*网络请求*/ function jsonlink(mode, link, params, callback) { - var auth = localStorage.getItem("authorization"); + var auth = localStorage.getItem('authorization'); var xmlHttp = new XMLHttpRequest(); //let requesetjson; xmlHttp.open(mode, link, true); - if (mode == "POST") { - xmlHttp.setRequestHeader("content-type", "application/json"); - xmlHttp.setRequestHeader("authorization", auth); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(JSON.stringify(params)); } else { - xmlHttp.setRequestHeader("authorization", auth); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(); } xmlHttp.onreadystatechange = function () { @@ -34,43 +34,38 @@ function jsonlink(mode, link, params, callback) { } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 callback(xmlHttp.status, json); - } else if ( - xmlHttp.readyState != 4 && - xmlHttp.status != 500 && - xmlHttp.status != 200 && - xmlHttp.status != 422 - ) { + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 - callback(xmlHttp.status, "001"); + callback(xmlHttp.status, '001'); } }; } /*请求个人信息接口*/ function getinfo() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/info"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ function responseinfo(code, data) { - if (code == "200") { - let a = document.getElementById("logout_words"); + if (code == '200') { + let a = document.getElementById('logout_words'); a.innerHTML = JSON.parse(data).data.email; canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } function download() { - let a = document.createElement("a"); - a.setAttribute("href", "./1.txt"); - a.setAttribute("download", "./1.txt"); + let a = document.createElement('a'); + a.setAttribute('href', './1.txt'); + a.setAttribute('download', './1.txt'); a.click(); console.log(a); } diff --git a/xiaon_c5z3Cp/static/homepage.js b/xiaon_c5z3Cp/static/homepage.js index c036a24..47071b2 100644 --- a/xiaon_c5z3Cp/static/homepage.js +++ b/xiaon_c5z3Cp/static/homepage.js @@ -1,6 +1,6 @@ /*启动检测与页面初始化localStorage*/ function bootcheck() { - let a = localStorage.getItem("authorization"); + let a = localStorage.getItem('authorization'); if (a) { getgonggao(); getdingyue(); @@ -11,20 +11,20 @@ function bootcheck() { } } -var domain = ""; +var domain = ''; /*网络请求*/ function jsonlink(mode, link, params, callback) { - var auth = localStorage.getItem("authorization"); + var auth = localStorage.getItem('authorization'); var xmlHttp = new XMLHttpRequest(); //let requesetjson; xmlHttp.open(mode, link, true); - if (mode == "POST") { - xmlHttp.setRequestHeader("content-type", "application/json"); - xmlHttp.setRequestHeader("authorization", auth); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(JSON.stringify(params)); } else { - xmlHttp.setRequestHeader("authorization", auth); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(); } xmlHttp.onreadystatechange = function () { @@ -37,23 +37,18 @@ function jsonlink(mode, link, params, callback) { } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 callback(xmlHttp.status, json); - } else if ( - xmlHttp.readyState != 4 && - xmlHttp.status != 500 && - xmlHttp.status != 200 && - xmlHttp.status != 422 - ) { + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 - callback(xmlHttp.status, "001"); + callback(xmlHttp.status, '001'); } }; } /*请求公告接口*/ function getgonggao() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/notice/fetch"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/notice/fetch'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responsegonggao); } @@ -62,31 +57,31 @@ function getgonggao() { var gonggao = new Array(); function responsegonggao(code, data) { let dict = {}; - if (code == "200") { + if (code == '200') { let mes = JSON.parse(data).data; for (x in mes) { - dict["title"] = mes[x].title; - dict["content"] = mes[x].content; + dict['title'] = mes[x].title; + dict['content'] = mes[x].content; gonggao.push(dict); dict = {}; } - let a = document.getElementById("gonggao_connect"); + let a = document.getElementById('gonggao_connect'); a.innerHTML = gonggao[0].title; - let b = document.getElementById("gonggao_count"); - b.innerHTML = "1/" + gonggao.length; + let b = document.getElementById('gonggao_count'); + b.innerHTML = '1/' + gonggao.length; opengonggao(); canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } /*请求订阅接口*/ function getdingyue() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/getSubscribe"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/getSubscribe'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responsedingyue); } @@ -94,7 +89,7 @@ function getdingyue() { /*响应订阅接口*/ var dingyue = {}; function responsedingyue(code, data) { - if (code == "200") { + if (code == '200') { let d = JSON.parse(data).data.d; let u = JSON.parse(data).data.u; let expired_at = JSON.parse(data).data.expired_at; @@ -102,108 +97,79 @@ function responsedingyue(code, data) { let reset_day = JSON.parse(data).data.reset_day; let plan_id = JSON.parse(data).data.plan_id; let plan = JSON.parse(data).data.plan; - dingyue["d"] = d; - dingyue["u"] = u; - dingyue["expired_at"] = expired_at; - dingyue["transfer_enable"] = transfer_enable; - dingyue["reset_day"] = reset_day; - dingyue["plan_id"] = plan_id; - dingyue["plan"] = plan; + dingyue['d'] = d; + dingyue['u'] = u; + dingyue['expired_at'] = expired_at; + dingyue['transfer_enable'] = transfer_enable; + dingyue['reset_day'] = reset_day; + dingyue['plan_id'] = plan_id; + dingyue['plan'] = plan; - let a = document.getElementById("liuliang_title"); - let bb = document.getElementById("liuliang_button"); - let c = document.getElementById("liuliang_des"); - let dd = document.getElementById("liuliang_des_2"); - let e = document.getElementById("liuliang_line"); - let f = document.getElementById("liuliang_line_box"); + let a = document.getElementById('liuliang_title'); + let bb = document.getElementById('liuliang_button'); + let c = document.getElementById('liuliang_des'); + let dd = document.getElementById('liuliang_des_2'); + let e = document.getElementById('liuliang_line'); + let f = document.getElementById('liuliang_line_box'); let ts = Math.round(new Date().getTime() / 1000).toString(); if (plan == null && plan_id == null) { - a.innerHTML = "您暂未购买任何订阅"; - bb.innerHTML = "立即购买"; - c.innerHTML = "购买高级会员订阅,以获取最佳的网络访问速度"; - dd.innerHTML = "暂无可用流量"; - e.style.width = "0px"; - } else if ( - ts < expired_at && - expired_at != null && - u + d < transfer_enable - ) { + a.innerHTML = '您暂未购买任何订阅'; + bb.innerHTML = '立即购买'; + c.innerHTML = '购买高级会员订阅,以获取最佳的网络访问速度'; + dd.innerHTML = '暂无可用流量'; + e.style.width = '0px'; + } else if (ts < expired_at && expired_at != null && u + d < transfer_enable) { a.innerHTML = plan.name; - bb.innerHTML = "续费订阅"; - c.innerHTML = - "将于" + - getshijian(expired_at) + - "日过期,还有" + - reset_day + - "天重置流量"; - e.style.width = - Math.trunc(((u + d) / transfer_enable) * f.offsetWidth) + "px"; //设置进度条的宽度 + bb.innerHTML = '续费订阅'; + c.innerHTML = '将于' + getshijian(expired_at) + '日过期,还有' + reset_day + '天重置流量'; + e.style.width = Math.trunc(((u + d) / transfer_enable) * f.offsetWidth) + 'px'; //设置进度条的宽度 dd.innerHTML = - "已使用" + + '已使用' + Math.trunc((u + d) / 1024 / 1024 / 1024) + - "GB/" + + 'GB/' + Math.trunc(transfer_enable / 1024 / 1024 / 1024) + - "GB"; + 'GB'; } else if (ts > expired_at && expired_at != null) { a.innerHTML = plan.name; - bb.innerHTML = "续费订阅"; - c.innerHTML = - "已于" + - getshijian(expired_at) + - "日过期,请立即续费,以恢复使用"; - e.style.width = "0px"; //设置进度条的宽度 - dd.innerHTML = "已过期,无法使用,请立即续费"; - dd.style.color = "#E02020"; - } else if ( - ts < expired_at && - expired_at != null && - u + d > transfer_enable - ) { + bb.innerHTML = '续费订阅'; + c.innerHTML = '已于' + getshijian(expired_at) + '日过期,请立即续费,以恢复使用'; + e.style.width = '0px'; //设置进度条的宽度 + dd.innerHTML = '已过期,无法使用,请立即续费'; + dd.style.color = '#E02020'; + } else if (ts < expired_at && expired_at != null && u + d > transfer_enable) { a.innerHTML = plan.name; - bb.innerHTML = "重置流量"; - c.innerHTML = - "将于" + - getshijian(expired_at) + - "日过期,还有" + - reset_day + - "天重置流量"; - e.style.width = Math.trunc(f.offsetWidth) + "px"; //设置进度条的宽度 - e.style.borderRadius = "10px"; - dd.innerHTML = "流量已经用尽,请立即重置"; - dd.style.color = "#E02020"; - } else if ( - (expired_at == null || expired_at == 0) && - u + d < transfer_enable - ) { + bb.innerHTML = '重置流量'; + c.innerHTML = '将于' + getshijian(expired_at) + '日过期,还有' + reset_day + '天重置流量'; + e.style.width = Math.trunc(f.offsetWidth) + 'px'; //设置进度条的宽度 + e.style.borderRadius = '10px'; + dd.innerHTML = '流量已经用尽,请立即重置'; + dd.style.color = '#E02020'; + } else if ((expired_at == null || expired_at == 0) && u + d < transfer_enable) { a.innerHTML = plan.name; - bb.innerHTML = "重置流量"; - c.innerHTML = "当前订阅为一次性流量包"; - e.style.width = - Math.trunc(((u + d) / transfer_enable) * f.offsetWidth) + "px"; //设置进度条的宽度 + bb.innerHTML = '重置流量'; + c.innerHTML = '当前订阅为一次性流量包'; + e.style.width = Math.trunc(((u + d) / transfer_enable) * f.offsetWidth) + 'px'; //设置进度条的宽度 dd.innerHTML = - "已使用" + + '已使用' + Math.trunc((u + d) / 1024 / 1024 / 1024) + - "GB/" + + 'GB/' + Math.trunc(transfer_enable / 1024 / 1024 / 1024) + - "GB"; - } else if ( - (expired_at == null || expired_at == 0) && - u + d > transfer_enable - ) { + 'GB'; + } else if ((expired_at == null || expired_at == 0) && u + d > transfer_enable) { a.innerHTML = plan.name; - bb.innerHTML = "重置流量"; - c.innerHTML = "当前订阅为一次性流量包"; - e.style.width = Math.trunc(f.offsetWidth) + "px"; //设置进度条的宽度 - e.style.borderRadius = "10px"; - dd.innerHTML = "流量已经用尽,请立即重置"; - dd.style.color = "#E02020"; + bb.innerHTML = '重置流量'; + c.innerHTML = '当前订阅为一次性流量包'; + e.style.width = Math.trunc(f.offsetWidth) + 'px'; //设置进度条的宽度 + e.style.borderRadius = '10px'; + dd.innerHTML = '流量已经用尽,请立即重置'; + dd.style.color = '#E02020'; } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } @@ -213,106 +179,106 @@ function getshijian(time) { let date = new Date(parseInt(time) * 1000); let y = date.getFullYear(); let MM = date.getMonth() + 1; - MM = MM < 10 ? "0" + MM : MM; + MM = MM < 10 ? '0' + MM : MM; let d = date.getDate(); - d = d < 10 ? "0" + d : d; + d = d < 10 ? '0' + d : d; let h = date.getHours(); - h = h < 10 ? "0" + h : h; + h = h < 10 ? '0' + h : h; let m = date.getMinutes(); - m = m < 10 ? "0" + m : m; + m = m < 10 ? '0' + m : m; let s = date.getSeconds(); - s = s < 10 ? "0" + s : s; - return y + "-" + MM + "-" + d; + s = s < 10 ? '0' + s : s; + return y + '-' + MM + '-' + d; } /*请求个人信息接口*/ function getinfo() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/info"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ function responseinfo(code, data) { - if (code == "200") { - let a = document.getElementById("logout_words"); + if (code == '200') { + let a = document.getElementById('logout_words'); a.innerHTML = JSON.parse(data).data.email; canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } /*响应个人信息*/ function responseinfo(code, data) { - if (code == "200") { - let a = document.getElementById("logout_words"); + if (code == '200') { + let a = document.getElementById('logout_words'); a.innerHTML = JSON.parse(data).data.email; canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } //下一个公告 function nextgonggao() { - let a = document.getElementById("gonggao_count"); + let a = document.getElementById('gonggao_count'); let b = a.innerText[0]; let c = a.innerText[2]; - let d = document.getElementById("gonggao_connect"); - let e = document.getElementById("gonggao_count"); + let d = document.getElementById('gonggao_connect'); + let e = document.getElementById('gonggao_count'); if (b < c) { - d.innerHTML = gonggao[b]["title"]; - e.innerHTML = parseInt(b) + 1 + "/" + c; + d.innerHTML = gonggao[b]['title']; + e.innerHTML = parseInt(b) + 1 + '/' + c; } else { - d.innerHTML = gonggao[0]["title"]; - e.innerHTML = "1/" + c; + d.innerHTML = gonggao[0]['title']; + e.innerHTML = '1/' + c; } } //上一个公告 function shangyigegonggao() { - let a = document.getElementById("gonggao_count"); + let a = document.getElementById('gonggao_count'); let b = a.innerText[0]; let c = a.innerText[2]; - let d = document.getElementById("gonggao_connect"); - let e = document.getElementById("gonggao_count"); + let d = document.getElementById('gonggao_connect'); + let e = document.getElementById('gonggao_count'); if (b == 1) { - d.innerHTML = gonggao[parseInt(c) - 1]["title"]; - e.innerHTML = c + "/" + c; + d.innerHTML = gonggao[parseInt(c) - 1]['title']; + e.innerHTML = c + '/' + c; } else { - d.innerHTML = gonggao[parseInt(b) - 2]["title"]; - e.innerHTML = parseInt(b) - 1 + "/" + c; + d.innerHTML = gonggao[parseInt(b) - 2]['title']; + e.innerHTML = parseInt(b) - 1 + '/' + c; } } //查看公告 function view() { - let c = document.getElementById("tangonggao"); - c.style.display = "block"; + let c = document.getElementById('tangonggao'); + c.style.display = 'block'; } // 打开公告弹窗 function opengonggao() { - let a = document.getElementById("gonggao_count"); + let a = document.getElementById('gonggao_count'); let b = a.innerText[0]; - let c = document.getElementById("tangonggao"); - let d = document.getElementById("gonggao_tan_title"); - let e = document.getElementById("gonggao_tan_content"); - d.innerHTML = gonggao[parseInt(b) - 1]["title"]; - let f = gonggao[parseInt(b) - 1]["content"].split("\n"); - let g = ""; + let c = document.getElementById('tangonggao'); + let d = document.getElementById('gonggao_tan_title'); + let e = document.getElementById('gonggao_tan_content'); + d.innerHTML = gonggao[parseInt(b) - 1]['title']; + let f = gonggao[parseInt(b) - 1]['content'].split('\n'); + let g = ''; for (x in f) { - g = f[x] + "
" + g; + g = f[x] + '
' + g; } e.innerHTML = g; // 检查是否设置了暂时关闭通知的时间戳 - var temporaryClosedTime = localStorage.getItem("temporaryClosedTime"); + var temporaryClosedTime = localStorage.getItem('temporaryClosedTime'); var currentTime = Date.now(); // 如果设置了暂时关闭通知的时间戳,并且距离现在不到1小时 @@ -321,19 +287,19 @@ function opengonggao() { return; } - c.style.display = "block"; + c.style.display = 'block'; } // 关闭公告弹窗 function closegonggao() { - let c = document.getElementById("tangonggao"); - c.style.display = "none"; + let c = document.getElementById('tangonggao'); + c.style.display = 'none'; } // 暂时关闭通知 function temporarilyclosed() { var currentTime = Date.now(); - localStorage.setItem("temporaryClosedTime", currentTime); + localStorage.setItem('temporaryClosedTime', currentTime); // 关闭弹窗 closegonggao(); @@ -344,89 +310,84 @@ function xufeianniu() { let ts = Math.round(new Date().getTime() / 1000).toString(); if (dingyue.plan == null && dingyue.plan_id == null) { - window.location.href = "./shop.html"; + window.location.href = './shop.html'; } else if ( ts < dingyue.expired_at && dingyue.expired_at != null && dingyue.u + dingyue.d < dingyue.transfer_enable ) { - window.location.href = - "./shop_peizhi.html?type=xufei&planid=" + dingyue.plan_id; + window.location.href = './shop_peizhi.html?type=xufei&planid=' + dingyue.plan_id; } else if (ts > dingyue.expired_at && dingyue.expired_at != null) { - window.location.href = - "./shop_peizhi.html?type=xufei&planid=" + dingyue.plan_id; + window.location.href = './shop_peizhi.html?type=xufei&planid=' + dingyue.plan_id; } else if ( ts < dingyue.expired_at && dingyue.expired_at != null && dingyue.u + dingyue.d > dingyue.transfer_enable ) { - window.location.href = - "./shop_peizhi.html?type=chongzhi&planid=" + dingyue.plan_id; + window.location.href = './shop_peizhi.html?type=chongzhi&planid=' + dingyue.plan_id; } else if ( (dingyue.expired_at == null || dingyue.expired_at == 0) && dingyue.u + dingyue.d < dingyue.transfer_enable ) { - window.location.href = - "./shop_peizhi.html?type=chongzhi&planid=" + dingyue.plan_id; + window.location.href = './shop_peizhi.html?type=chongzhi&planid=' + dingyue.plan_id; } else if ( (dingyue.expired_at == null || dingyue.expired_at == 0) && dingyue.u + dingyue.d > dingyue.transfer_enable ) { - window.location.href = - "./shop_peizhi.html?type=chongzhi&planid=" + dingyue.plan_id; + window.location.href = './shop_peizhi.html?type=chongzhi&planid=' + dingyue.plan_id; } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); } } //打开下载 function opendownload() { - window.location.href = "./download.html"; + window.location.href = './download.html'; } //打开outline function openoutline() { - window.location.href = "./outline.html"; + window.location.href = './outline.html'; } //打开三方应用 function opensanfang() { - window.location.href = "./sanfang.html"; + window.location.href = './sanfang.html'; } //打开购买订阅 function openshop() { - window.location.href = "./shop.html"; + window.location.href = './shop.html'; } //使用教程 function openuse() { - window.location.href = "./use.html"; + window.location.href = './use.html'; } /*请求提示信息接口*/ function gettishi() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/getStat"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/getStat'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responsegettishi); } /*响应个人信息*/ function responsegettishi(code, data) { - if (code == "200") { - let a = document.getElementById("dingdantishi-box"); - let b = document.getElementById("gongdantishi-box"); + if (code == '200') { + let a = document.getElementById('dingdantishi-box'); + let b = document.getElementById('gongdantishi-box'); let c = JSON.parse(data).data; - if (c[0] == "1") { + if (c[0] == '1') { console.log(c[0]); - a.style.display = "flex"; + a.style.display = 'flex'; } - if (c[1] == "1") { - b.style.display = "flex"; + if (c[1] == '1') { + b.style.display = 'flex'; console.log(c[1]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } diff --git a/xiaon_c5z3Cp/static/iframe.js b/xiaon_c5z3Cp/static/iframe.js index 3aaf686..d4024b5 100644 --- a/xiaon_c5z3Cp/static/iframe.js +++ b/xiaon_c5z3Cp/static/iframe.js @@ -1,136 +1,128 @@ /*导航菜单开关*/ -function closemenu(){ - let a = document.getElementById('menulistul'); - let b = document.getElementById('closemenu'); - let c = document.getElementById('openmenu'); - a.style.display = 'none'; - b.style.display = 'none'; - c.style.display = 'block'; +function closemenu() { + let a = document.getElementById('menulistul'); + let b = document.getElementById('closemenu'); + let c = document.getElementById('openmenu'); + a.style.display = 'none'; + b.style.display = 'none'; + c.style.display = 'block'; } -function openmenu(){ - let a = document.getElementById('menulistul'); - let b = document.getElementById('closemenu'); - let c = document.getElementById('openmenu'); - a.style.display = 'block'; - b.style.display = 'block'; - c.style.display = 'none'; +function openmenu() { + let a = document.getElementById('menulistul'); + let b = document.getElementById('closemenu'); + let c = document.getElementById('openmenu'); + a.style.display = 'block'; + b.style.display = 'block'; + c.style.display = 'none'; } /*导航菜单开关结束*/ -document.addEventListener("DOMContentLoaded", function () { - const menuItems = [ - { id: "icon1", svgPath: "../img/icon1.svg" }, - { id: "icon2", svgPath: "./img/icon2.svg" }, - { id: "icon3", svgPath: "./img/icon3.svg" }, - { id: "icon4", svgPath: "./img/icon4.svg" }, - { id: "icon5", svgPath: "./img/icon5.svg" }, - { id: "icon6", svgPath: "./img/icon6.svg" }, - { id: "icon7", svgPath: "./img/icon7.svg" }, - { id: "icon8", svgPath: "./img/icon8.svg" }, - { id: "icon9", svgPath: "./img/icon9.svg" }, - { id: "icon10", svgPath: "./img/icon10.svg" }, - ]; - menuItems.forEach(item => { - const lilist = document.getElementById(item.id); - const li = document.createElement("li"); - li.classList.add("icon"); - const svg = document.createElement("img"); - svg.setAttribute("src", item.svgPath); - li.appendChild(svg); // 将SVG图标添加到div中 - lilist.insertBefore(li, lilist.firstChild); // 在li中的第一个子元素之前插入div - }); +document.addEventListener('DOMContentLoaded', function () { + const menuItems = [ + { id: 'icon1', svgPath: '../img/icon1.svg' }, + { id: 'icon2', svgPath: './img/icon2.svg' }, + { id: 'icon3', svgPath: './img/icon3.svg' }, + { id: 'icon4', svgPath: './img/icon4.svg' }, + { id: 'icon5', svgPath: './img/icon5.svg' }, + { id: 'icon6', svgPath: './img/icon6.svg' }, + { id: 'icon7', svgPath: './img/icon7.svg' }, + { id: 'icon8', svgPath: './img/icon8.svg' }, + { id: 'icon9', svgPath: './img/icon9.svg' }, + { id: 'icon10', svgPath: './img/icon10.svg' }, + ]; + menuItems.forEach((item) => { + const lilist = document.getElementById(item.id); + const li = document.createElement('li'); + li.classList.add('icon'); + const svg = document.createElement('img'); + svg.setAttribute('src', item.svgPath); + li.appendChild(svg); // 将SVG图标添加到div中 + lilist.insertBefore(li, lilist.firstChild); // 在li中的第一个子元素之前插入div + }); }); - /*提示信息弹窗*/ -function tan(mode,text){ - if(mode=='right'){ - let a = document.getElementById('tanright'); - a.setAttribute('style','!display:block'); - let b = document.createTextNode(text); - a.appendChild(b); - setTimeout(canceltan,1500,mode); - } - else { - let c = document.getElementById('tancuowu'); - c.setAttribute('style','!display:block'); - let d = document.createTextNode(text); - c.appendChild(d); - setTimeout(canceltan,1500,mode); - } +function tan(mode, text) { + if (mode == 'right') { + let a = document.getElementById('tanright'); + a.setAttribute('style', '!display:block'); + let b = document.createTextNode(text); + a.appendChild(b); + setTimeout(canceltan, 1500, mode); + } else { + let c = document.getElementById('tancuowu'); + c.setAttribute('style', '!display:block'); + let d = document.createTextNode(text); + c.appendChild(d); + setTimeout(canceltan, 1500, mode); + } } /*关闭信息弹窗*/ -function canceltan(mode){ -if(mode=='right'){ - let a = document.getElementById('tanright'); - a.style.display= 'none'; - a.innerHTML=''; - } - else { - let c = document.getElementById('tancuowu'); - c.style.display= 'none'; - c.innerHTML=''; - } -} +function canceltan(mode) { + if (mode == 'right') { + let a = document.getElementById('tanright'); + a.style.display = 'none'; + a.innerHTML = ''; + } else { + let c = document.getElementById('tancuowu'); + c.style.display = 'none'; + c.innerHTML = ''; + } +} /*加载信息弹窗*/ -function tanjiazai(){ - let a = document.getElementById('tanjiazai'); - a.setAttribute('style','!display:block') +function tanjiazai() { + let a = document.getElementById('tanjiazai'); + a.setAttribute('style', '!display:block'); } /*关闭加载信息弹窗*/ -function canceltanjiazai(){ - let a = document.getElementById('tanjiazai'); - a.style.display= 'none'; -} +function canceltanjiazai() { + let a = document.getElementById('tanjiazai'); + a.style.display = 'none'; +} /*显示退出窗口*/ -function openlogout(){ - let a = document.getElementById('tantuichu'); - a.style.display = 'block'; +function openlogout() { + let a = document.getElementById('tantuichu'); + a.style.display = 'block'; } /*显示关闭退出窗口*/ -function closelogout(){ - let a = document.getElementById('tantuichu'); - a.style.display = 'none'; +function closelogout() { + let a = document.getElementById('tantuichu'); + a.style.display = 'none'; } /*退出登录*/ -function exitlogout(){ - localStorage.clear(); - window.location.href='./index.html'; +function exitlogout() { + localStorage.clear(); + window.location.href = './index.html'; } - - - timer = null; kaiguan(); -function kaiguan(){ - let dom = document.getElementsByClassName('menutitle')[0]; - if (dom) { - let b = document.getElementById('closemenu'); - let c = document.getElementById('openmenu'); - b.removeAttribute('onclick'); - c.removeAttribute('onclick'); +function kaiguan() { + let dom = document.getElementsByClassName('menutitle')[0]; + if (dom) { + let b = document.getElementById('closemenu'); + let c = document.getElementById('openmenu'); + b.removeAttribute('onclick'); + c.removeAttribute('onclick'); - dom.addEventListener('click',dakaiguanbi); - if(!timer){ - clearTimeout(timer); + dom.addEventListener('click', dakaiguanbi); + if (!timer) { + clearTimeout(timer); + } + } else { + timer = setTimeout(kaiguan, 0); } - } - else { - timer = setTimeout(kaiguan,0); - } } -function dakaiguanbi(){ - let b = document.getElementById('closemenu'); - if(b.style.display == 'block'){ - closemenu(); - } - else{ - openmenu(); - } +function dakaiguanbi() { + let b = document.getElementById('closemenu'); + if (b.style.display == 'block') { + closemenu(); + } else { + openmenu(); + } } diff --git a/xiaon_c5z3Cp/static/invite.js b/xiaon_c5z3Cp/static/invite.js index f220a05..00521c2 100644 --- a/xiaon_c5z3Cp/static/invite.js +++ b/xiaon_c5z3Cp/static/invite.js @@ -1,378 +1,358 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getinvite(); - getconfig(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getinvite(); + getconfig(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - console.log(params); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + console.log(params); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求邀请数据*/ -function getinvite(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/invite/fetch'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinvite); +function getinvite() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/invite/fetch'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinvite); } /*响应邀请信息*/ -function responseinvite(code,data){ - if (code == '200') { - let a = document.getElementById('invite_big_amount'); - a.innerHTML = '¥'+JSON.parse(data).data.stat[4]/100; - let b = document.getElementById('invite_renshu'); - b.innerHTML = JSON.parse(data).data.stat[0]+'人'; - let c = document.getElementById('invite_yongjinbili'); - c.innerHTML = JSON.parse(data).data.stat[3]+'%'; - let d = document.getElementById('invite_querenzhong'); - d.innerHTML = '¥'+JSON.parse(data).data.stat[1]; - let e = document.getElementById('invite_leiji'); - e.innerHTML = '¥'+JSON.parse(data).data.stat[2]; - f = JSON.parse(data).data.codes; - let g = document.getElementById('inbutbutton_huazhua'); - g.setAttribute('value',JSON.parse(data).data.stat[4]/100); - let saoguang_box = document.getElementById('saoguang_box'); - saoguang_box.innerHTML = ''; - if (f == ''){ - console.log(a); - let queshengbox = document.createElement('div'); - let queshengtu = document.createElement('img'); - queshengbox.setAttribute('class','queshengtu-box'); - queshengtu.setAttribute('src','./img/queshengtu.png'); - queshengtu.setAttribute('class','queshengtu'); - let fatherdiv = document.getElementById('invite_codes'); - queshengbox.appendChild(queshengtu); - fatherdiv.appendChild(queshengbox); - } - for(x in f) { - let aa = document.createElement('div'); - aa.setAttribute('class','invite_code_down'); - let bb = document.createElement('div'); - bb.setAttribute('class','invite_code_words_groups'); - let cc = document.createElement('p'); - cc.setAttribute('class','invite_code'); - let dd = document.createElement('button'); - dd.setAttribute('class','invite_code_copy'); - dd.setAttribute('value',f[x].code); - dd.setAttribute('onclick','copylinkcode(this.value)'); - let ee = document.createElement('p'); - ee.setAttribute('class','invite_code_creattime'); - cc.innerHTML = f[x].code; - dd.innerHTML = '复制链接'; - ee.innerHTML = getshijian(f[x].updated_at); - let ff = document.getElementById('invite_codes'); - bb.appendChild(cc); - bb.appendChild(dd); - aa.appendChild(bb); - aa.appendChild(ee); - ff.appendChild(aa); +function responseinvite(code, data) { + if (code == '200') { + let a = document.getElementById('invite_big_amount'); + a.innerHTML = '¥' + JSON.parse(data).data.stat[4] / 100; + let b = document.getElementById('invite_renshu'); + b.innerHTML = JSON.parse(data).data.stat[0] + '人'; + let c = document.getElementById('invite_yongjinbili'); + c.innerHTML = JSON.parse(data).data.stat[3] + '%'; + let d = document.getElementById('invite_querenzhong'); + d.innerHTML = '¥' + JSON.parse(data).data.stat[1]; + let e = document.getElementById('invite_leiji'); + e.innerHTML = '¥' + JSON.parse(data).data.stat[2]; + f = JSON.parse(data).data.codes; + let g = document.getElementById('inbutbutton_huazhua'); + g.setAttribute('value', JSON.parse(data).data.stat[4] / 100); + let saoguang_box = document.getElementById('saoguang_box'); + saoguang_box.innerHTML = ''; + if (f == '') { + console.log(a); + let queshengbox = document.createElement('div'); + let queshengtu = document.createElement('img'); + queshengbox.setAttribute('class', 'queshengtu-box'); + queshengtu.setAttribute('src', './img/queshengtu.png'); + queshengtu.setAttribute('class', 'queshengtu'); + let fatherdiv = document.getElementById('invite_codes'); + queshengbox.appendChild(queshengtu); + fatherdiv.appendChild(queshengbox); + } + for (x in f) { + let aa = document.createElement('div'); + aa.setAttribute('class', 'invite_code_down'); + let bb = document.createElement('div'); + bb.setAttribute('class', 'invite_code_words_groups'); + let cc = document.createElement('p'); + cc.setAttribute('class', 'invite_code'); + let dd = document.createElement('button'); + dd.setAttribute('class', 'invite_code_copy'); + dd.setAttribute('value', f[x].code); + dd.setAttribute('onclick', 'copylinkcode(this.value)'); + let ee = document.createElement('p'); + ee.setAttribute('class', 'invite_code_creattime'); + cc.innerHTML = f[x].code; + dd.innerHTML = '复制链接'; + ee.innerHTML = getshijian(f[x].updated_at); + let ff = document.getElementById('invite_codes'); + bb.appendChild(cc); + bb.appendChild(dd); + aa.appendChild(bb); + aa.appendChild(ee); + ff.appendChild(aa); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } //时间戳转日期 function getshijian(time) { - let date = new Date(parseInt(time) * 1000); - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - return y + '/' + MM + '/' + d+' '+h+':'+m+':'+d; + let date = new Date(parseInt(time) * 1000); + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; + let d = date.getDate(); + d = d < 10 ? '0' + d : d; + let h = date.getHours(); + h = h < 10 ? '0' + h : h; + let m = date.getMinutes(); + m = m < 10 ? '0' + m : m; + let s = date.getSeconds(); + s = s < 10 ? '0' + s : s; + return y + '/' + MM + '/' + d + ' ' + h + ':' + m + ':' + d; } // 复制函数 -function copy (text) { - // text是复制文本 - // 创建input元素 - const el = document.createElement('input'); - // 给input元素赋值需要复制的文本 - el.setAttribute('value', text); - // 将input元素插入页面 - document.body.appendChild(el); - // 选中input元素的文本 - el.select(); - // 复制内容到剪贴板 - document.execCommand('copy'); - // 删除input元素 - document.body.removeChild(el); +function copy(text) { + // text是复制文本 + // 创建input元素 + const el = document.createElement('input'); + // 给input元素赋值需要复制的文本 + el.setAttribute('value', text); + // 将input元素插入页面 + document.body.appendChild(el); + // 选中input元素的文本 + el.select(); + // 复制内容到剪贴板 + document.execCommand('copy'); + // 删除input元素 + document.body.removeChild(el); } //复制链接 -function copylinkcode(code){ - let a = 'index.html?register='+code; - let b = window.location.href.replace('invite.html',''); - let c = b+a; - copy (c); - tan('right','复制成功请发送给好友'); +function copylinkcode(code) { + let a = 'index.html?register=' + code; + let b = window.location.href.replace('invite.html', ''); + let c = b + a; + copy(c); + tan('right', '复制成功请发送给好友'); } - /*请求添加邀请码*/ -function addinvitecode(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/invite/save'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseaddinvitecode); +function addinvitecode() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/invite/save'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseaddinvitecode); } /*响应邀请码*/ -function responseaddinvitecode(code,data){ - if (code == '200') { - tan('right','添加成功'); - window.location.reload(); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); +function responseaddinvitecode(code, data) { + if (code == '200') { + tan('right', '添加成功'); + window.location.reload(); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } //全部余额 function putall(price) { - let a = document.getElementById('huazhuaninput'); - //a.setAttribute('value',price); - a.value = price; + let a = document.getElementById('huazhuaninput'); + //a.setAttribute('value',price); + a.value = price; } //打开划转窗口 function openhuazhuanbox() { - let a = document.getElementById('tanhuazhuan'); - a.style.display = 'flex'; + let a = document.getElementById('tanhuazhuan'); + a.style.display = 'flex'; } //关闭划转窗口 function closehuazhuanbox() { - let a = document.getElementById('tanhuazhuan'); - a.style.display = 'none'; + let a = document.getElementById('tanhuazhuan'); + a.style.display = 'none'; } - - /*请求提交划转*/ -function addhuazhuan(){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/transfer'; - let a = document.getElementById('huazhuaninput'); - let params = { - transfer_amount : a.value * 100 - } - tanjiazai(); - jsonlink(mode,link,params,responseaddhuazhuan); +function addhuazhuan() { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/transfer'; + let a = document.getElementById('huazhuaninput'); + let params = { + transfer_amount: a.value * 100, + }; + tanjiazai(); + jsonlink(mode, link, params, responseaddhuazhuan); } /*响应划转*/ -function responseaddhuazhuan(code,data){ - if (code == '200') { - tan('right','划转成功请刷新页面'); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responseaddhuazhuan(code, data) { + if (code == '200') { + tan('right', '划转成功请刷新页面'); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } /*请求配置信息接口*/ -function getconfig(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/comm/config'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseconfig); +function getconfig() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/comm/config'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseconfig); } /*响应个人信息*/ -function responseconfig(code,data){ - if (code == '200') { - let a = JSON.parse(data).data.withdraw_close; - let b = JSON.parse(data).data.withdraw_methods; - if (a == '0'){ - let c = document.getElementById('invite_get_cash'); - c.style.display = 'block'; +function responseconfig(code, data) { + if (code == '200') { + let a = JSON.parse(data).data.withdraw_close; + let b = JSON.parse(data).data.withdraw_methods; + if (a == '0') { + let c = document.getElementById('invite_get_cash'); + c.style.display = 'block'; + } + for (x in b) { + let d = document.createElement('option'); + d.innerHTML = b[x]; + let e = document.getElementById('tixianlist'); + e.appendChild(d); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - for (x in b) { - let d = document.createElement('option'); - d.innerHTML = b[x]; - let e = document.getElementById('tixianlist'); - e.appendChild(d); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } //打开提现窗口 function opentixianbox() { - let a = document.getElementById('tantixian'); - a.style.display = 'flex'; + let a = document.getElementById('tantixian'); + a.style.display = 'flex'; } //关闭提现窗口 function closetixianbox() { - let a = document.getElementById('tantixian'); - a.style.display = 'none'; + let a = document.getElementById('tantixian'); + a.style.display = 'none'; } /*请求提交提现*/ -function addtixian(){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/withdraw'; - let a = document.getElementById('tixianlist'); - let b = a.selectedIndex ; - let c = a.options[b].text; - let d = document.getElementById('tiixaninput'); - let params = { - withdraw_account : d.value, - withdraw_method : c - } - tanjiazai(); - jsonlink(mode,link,params,responseaddtixian); +function addtixian() { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/withdraw'; + let a = document.getElementById('tixianlist'); + let b = a.selectedIndex; + let c = a.options[b].text; + let d = document.getElementById('tiixaninput'); + let params = { + withdraw_account: d.value, + withdraw_method: c, + }; + tanjiazai(); + jsonlink(mode, link, params, responseaddtixian); } /*响应划转*/ -function responseaddtixian(code,data){ - if (code == '200') { - tan('right','提现成功成功,请刷新页面'); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responseaddtixian(code, data) { + if (code == '200') { + tan('right', '提现成功成功,请刷新页面'); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/jiazai.css b/xiaon_c5z3Cp/static/jiazai.css index 4a1389c..11114cc 100644 --- a/xiaon_c5z3Cp/static/jiazai.css +++ b/xiaon_c5z3Cp/static/jiazai.css @@ -3,10 +3,11 @@ width: 2.5em; height: 2.5em; transform: rotate(165deg); - } - - .loader:before, .loader:after { - content: ""; +} + +.loader:before, +.loader:after { + content: ''; position: absolute; top: 50%; left: 50%; @@ -15,77 +16,88 @@ height: 0.5em; border-radius: 0.25em; transform: translate(-50%, -50%); - } +} - - .loader:before { +.loader:before { animation: before8 2s infinite; - } - - .loader:after { +} + +.loader:after { animation: after6 2s infinite; - } - - @keyframes before8 { +} + +@keyframes before8 { 0% { - width: 0.5em; - box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75); + width: 0.5em; + box-shadow: + 1em -0.5em rgba(225, 20, 98, 0.75), + -1em 0.5em rgba(111, 202, 220, 0.75); } - + 35% { - width: 2.5em; - box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75), 0 0.5em rgba(111, 202, 220, 0.75); + width: 2.5em; + box-shadow: + 0 -0.5em rgba(225, 20, 98, 0.75), + 0 0.5em rgba(111, 202, 220, 0.75); } - + 70% { - width: 0.5em; - box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75), 1em 0.5em rgba(111, 202, 220, 0.75); + width: 0.5em; + box-shadow: + -1em -0.5em rgba(225, 20, 98, 0.75), + 1em 0.5em rgba(111, 202, 220, 0.75); } - + 100% { - box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75); + box-shadow: + 1em -0.5em rgba(225, 20, 98, 0.75), + -1em 0.5em rgba(111, 202, 220, 0.75); } - } - - @keyframes after6 { +} + +@keyframes after6 { 0% { - height: 0.5em; - box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75); + height: 0.5em; + box-shadow: + 0.5em 1em rgba(61, 184, 143, 0.75), + -0.5em -1em rgba(233, 169, 32, 0.75); } - + 35% { - height: 2.5em; - box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75), -0.5em 0 rgba(233, 169, 32, 0.75); + height: 2.5em; + box-shadow: + 0.5em 0 rgba(61, 184, 143, 0.75), + -0.5em 0 rgba(233, 169, 32, 0.75); } - + 70% { - height: 0.5em; - box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75), -0.5em 1em rgba(233, 169, 32, 0.75); + height: 0.5em; + box-shadow: + 0.5em -1em rgba(61, 184, 143, 0.75), + -0.5em 1em rgba(233, 169, 32, 0.75); } - + 100% { - box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75); + box-shadow: + 0.5em 1em rgba(61, 184, 143, 0.75), + -0.5em -1em rgba(233, 169, 32, 0.75); } - } - - .loader { +} + +.loader { position: absolute; top: calc(50% - 1.25em); left: calc(50% - 1.25em); - } - - .toast { - display: flex; - flex-direction: row; - align-items: center; - } - .toast_words { - font-size: 14px; - color:#42435a; - margin-left: 2px; - margin-right: 2px; - } - - - +} +.toast { + display: flex; + flex-direction: row; + align-items: center; +} +.toast_words { + font-size: 14px; + color: #42435a; + margin-left: 2px; + margin-right: 2px; +} diff --git a/xiaon_c5z3Cp/static/liteboardpc.css b/xiaon_c5z3Cp/static/liteboardpc.css index 56b9158..b2975b3 100644 --- a/xiaon_c5z3Cp/static/liteboardpc.css +++ b/xiaon_c5z3Cp/static/liteboardpc.css @@ -1,4 +1,4 @@ -*{ +* { padding: 0; margin: 0; box-shadow: none; @@ -99,7 +99,7 @@ a:hover, .gary_p { font-size: 14px; - color: #20133A; + color: #20133a; margin-left: 16px; font-weight: 600; letter-spacing: -1.2px; @@ -155,7 +155,7 @@ a:hover, .des { font-size: 18px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -203,7 +203,7 @@ a:hover, font-size: 30px; } -.lilist>p { +.lilist > p { width: 100px; font-size: 16px; font-weight: 400; @@ -450,7 +450,7 @@ a:hover, color: #fff; } -.jdzt{ +.jdzt { display: flex; align-items: center; justify-content: space-between; @@ -464,28 +464,28 @@ a:hover, } .css-button-3d--rose { - min-width: 130px; - height: 40px; - color: #fff; - padding: 5px 10px; - font-weight: bold; - cursor: pointer; - transition: all 0.3s ease; - position: relative; - display: inline-block; - outline: none; - border-radius: 5px; - border: none; - background: #ff6392; - box-shadow: 0 5px #ff0a78; + min-width: 130px; + height: 40px; + color: #fff; + padding: 5px 10px; + font-weight: bold; + cursor: pointer; + transition: all 0.3s ease; + position: relative; + display: inline-block; + outline: none; + border-radius: 5px; + border: none; + background: #ff6392; + box-shadow: 0 5px #ff0a78; } .css-button-3d--rose:hover { - box-shadow: 0 3px #ff0a78; - top: 1px; + box-shadow: 0 3px #ff0a78; + top: 1px; } .css-button-3d--rose:active { - box-shadow: 0 0 #ff0a78; - top: 5px; + box-shadow: 0 0 #ff0a78; + top: 5px; } .liuliang_down { @@ -619,7 +619,7 @@ a:hover, } .tanbox-right { - background-color: #DFF0D8; + background-color: #dff0d8; position: fixed; left: 50%; top: 35%; @@ -627,18 +627,18 @@ a:hover, -ms-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); z-index: 200; - color: #3C763D; + color: #3c763d; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #D6E9C6; + border-color: #d6e9c6; border-width: 1px; } .tanbox-cuowu { - background-color: #F6E8E8; + background-color: #f6e8e8; position: fixed; left: 50%; top: 35%; @@ -646,13 +646,13 @@ a:hover, -ms-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); z-index: 200; - color: #C4807E; + color: #c4807e; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #F1DCE0; + border-color: #f1dce0; border-width: 1px; } @@ -786,7 +786,6 @@ a:hover, margin-left: 4px; } - .shop_down { width: 100%; height: auto; @@ -836,7 +835,7 @@ a:hover, .shop_title { font-size: 22px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -858,7 +857,7 @@ a:hover, .shop_content { font-size: 12px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -866,7 +865,7 @@ a:hover, text-align: justify; } -.shop_content>.alert { +.shop_content > .alert { padding: 0.75rem 1.25rem; text-align: center; } @@ -882,13 +881,13 @@ a:hover, flex: 1 0 auto; } -.v2board-plan-features>li { +.v2board-plan-features > li { padding: 6px 0; color: #7c8088; text-align: left; } -.v2board-plan-features>li:before { +.v2board-plan-features > li:before { background-image: url(../img/anq.svg); padding-right: 10px; color: #425b94; @@ -910,19 +909,18 @@ a:hover, -moz-user-select: none; -ms-user-select: none; user-select: none; - box-shadow: 0 5px 6px 0 rgba(73, 105, 230, .22); - background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%); + box-shadow: 0 5px 6px 0 rgba(73, 105, 230, 0.22); + background-image: linear-gradient(135deg, #3c8ce7 10%, #00eaff 100%); } .shop_meiyue { - color: #42414D; + color: #42414d; font-size: 14px; font-weight: 300; margin-top: 10px; margin-bottom: 2px; } - .outline_down { width: 100%; height: auto; @@ -1131,18 +1129,17 @@ a:hover, padding: 10px; /* 内边距,根据需要调整 */ width: 100%; height: 540px; - } - +} - .queshengtu-box { +.queshengtu-box { text-align: center; margin-top: 20px; /* 根据需要调整 */ - } +} - .queshengtu { +.queshengtu { width: 100px; /* 图片宽度,根据需要调整 */ height: 100px; /* 图片高度,根据需要调整 */ - } +} .order_box { display: inline-block; @@ -1174,7 +1171,6 @@ a:hover, font-size: 14px; font-weight: 400; color: #42435a; - } .order_box_zhuangtai { @@ -1373,8 +1369,8 @@ a:hover, } .tanbox-huazhuan-des { - background-color: #DFF0D8; - color: #3C763D; + background-color: #dff0d8; + color: #3c763d; margin-left: 10px; height: 40px; line-height: 40px; @@ -1409,9 +1405,9 @@ a:hover, border-left-style: solid; border-bottom-style: solid; border-right-style: none; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1430,7 +1426,7 @@ a:hover, border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #0360DF; + color: #0360df; } .huazhuan_button_group { @@ -1449,7 +1445,7 @@ a:hover, border-radius: 6px; border-style: none; background-color: #0060df; - color: #fff + color: #fff; } .huazhuan_tan_button_quxiao { @@ -1480,9 +1476,9 @@ a:hover, border-left-style: solid; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1499,9 +1495,9 @@ a:hover, border-color: #9e9e9e; border-image: none; border-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1551,7 +1547,7 @@ a:hover, height: 30px; border-style: none; border-radius: 6px; - background-color: #0360DF; + background-color: #0360df; color: #fff; } @@ -1621,7 +1617,7 @@ a:hover, font-size: 14px; margin-left: 10px; margin-right: 10px; - color: #0360DF; + color: #0360df; border-style: none; background-color: #fff; } @@ -1630,7 +1626,7 @@ a:hover, font-size: 14px; margin-left: 10px; margin-right: 10px; - color: #0360DF; + color: #0360df; width: 200px; background-color: #fff; border-style: none; @@ -1649,7 +1645,6 @@ a:hover, text-align: center; line-height: 24px; border-color: #00000017; - } .tanbox-gongdan-zhezhao { @@ -1697,22 +1692,19 @@ a:hover, .tanbox-gongdan-title { font-size: 20px; color: #20133a; - ; font-weight: 400; margin-top: 10px; margin-bottom: 10px; - } .gongdanzuo { font-size: 14px; color: #20133a; - ; font-weight: 400; margin-top: 2px; margin-bottom: 10px; margin-left: 10px; - background-color: #E5F7D2; + background-color: #e5f7d2; height: auto; width: 220px; padding: 10px; @@ -1723,7 +1715,6 @@ a:hover, .gongdanyou { font-size: 14px; color: #20133a; - ; font-weight: 400; margin-top: 2px; margin-bottom: 10px; @@ -1772,7 +1763,6 @@ a:hover, border-width: 1px; border-color: #00000028; background-color: #00000005; - } .gongdan_send { @@ -1787,7 +1777,7 @@ a:hover, border-top-style: none; border-right-style: solid; border-width: 1px; - background-color: #0360DF; + background-color: #0360df; color: #fff; } @@ -1871,7 +1861,7 @@ a:hover, .ticket_send { width: 85px; height: 35px; - background-color: #0360DF; + background-color: #0360df; border-style: none; border-radius: 6px; color: #fff; @@ -1932,7 +1922,7 @@ a:hover, padding: 0px; width: 88%; padding-left: 10px; - background-color: #21143B; + background-color: #21143b; border-top-left-radius: 6px; border-bottom-left-radius: 6px; color: #fff; @@ -1994,19 +1984,19 @@ a:hover, box-sizing: border-box; border-style: solid; border-width: 3px; - border-color: #0360DF; + border-color: #0360df; } .peizhi_jine_name { margin-left: 10px; font-size: 16px; - color: #21143B; + color: #21143b; } .peizhi_jine_price { margin-right: 10px; font-size: 16px; - color: #21143B; + color: #21143b; font-weight: 500; } @@ -2134,7 +2124,7 @@ a:hover, font-size: 14px; margin-bottom: 10px; margin-top: 0px; - color: #42414D; + color: #42414d; } .status_group { @@ -2175,19 +2165,19 @@ a:hover, padding: 20px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); border-radius: 8px; - } - - .webview-container { +} + +.webview-container { overflow: hidden; - } - - .iframe-wrapper { +} + +.iframe-wrapper { position: relative; padding-bottom: 56.25%; /* 16:9 aspect ratio */ height: 0; - } - - .iframe { +} + +.iframe { position: absolute; top: 0; left: 0; @@ -2195,7 +2185,7 @@ a:hover, height: 100%; border: none; border-radius: 8px; - } +} .sweep-light { position: absolute; @@ -2229,26 +2219,26 @@ a:hover, @-webkit-keyframes ball-scale { 0% { -webkit-transform: scale(0); - transform: scale(0) + transform: scale(0); } 100% { -webkit-transform: scale(1); transform: scale(1); - opacity: 0 + opacity: 0; } } @keyframes ball-scale { 0% { -webkit-transform: scale(0); - transform: scale(0) + transform: scale(0); } 100% { -webkit-transform: scale(1); transform: scale(1); - opacity: 0 + opacity: 0; } } @@ -2363,4 +2353,4 @@ a:hover, text-decoration: none; margin-left: 10px; color: #855c0d; -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/liteboardwap.css b/xiaon_c5z3Cp/static/liteboardwap.css index 66f914f..0983624 100644 --- a/xiaon_c5z3Cp/static/liteboardwap.css +++ b/xiaon_c5z3Cp/static/liteboardwap.css @@ -1,4 +1,4 @@ -*{ +* { padding: 0; margin: 0; box-shadow: none; @@ -31,14 +31,14 @@ width: 1200px; } -.head_box_img{ +.head_box_img { width: 154px; height: 100%; margin-left: 16px; } .head_img { - width: 80%; + width: 80%; } .head_sculpture { @@ -58,7 +58,7 @@ margin-bottom: 3px; } -.head_sculpture p{ +.head_sculpture p { width: 100%; font-size: 12px; margin: 0; @@ -68,7 +68,7 @@ .background_gary { width: 100%; height: 48px; - background-color: #F9F9FA; + background-color: #f9f9fa; display: flex; align-items: center; justify-content: flex-start; @@ -87,14 +87,14 @@ } .gary_p { font-size: 14px; - color: #20133A; + color: #20133a; margin-left: 16px; font-weight: 600; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .yewei { margin-top: 30px; - background-color: #F9F9FA; + background-color: #f9f9fa; width: 100%; display: flex; flex-direction: column; @@ -108,7 +108,7 @@ } .des { font-size: 16px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -135,8 +135,8 @@ color: #000; } .fatherbox { - background-size:100%; - background-repeat:no-repeat; + background-size: 100%; + background-repeat: no-repeat; width: 100%; display: flex; flex-direction: column; @@ -146,11 +146,11 @@ .menubox { width: 100%; } -.menubox_icon_xia{ +.menubox_icon_xia { width: 20px; margin-left: 10px; } -.menubox_icon_shang{ +.menubox_icon_shang { width: 20px; margin-left: 10px; display: none; @@ -186,7 +186,7 @@ height: 30px; font-size: 30px; } -.lilist>p{ +.lilist > p { width: 100px; font-size: 16px; font-weight: 400; @@ -198,7 +198,7 @@ height: 30px; } .menulist { - text-decoration:none; + text-decoration: none; color: #42435a; padding: 4px 8px; font-size: 16px; @@ -209,8 +209,8 @@ line-height: 24px; margin-left: 10px; } -.menulist-choose{ - text-decoration:none; +.menulist-choose { + text-decoration: none; color: #42435a; padding: 4px 8px; font-size: 16px; @@ -225,7 +225,7 @@ .menutitle { margin-left: 16px; font-size: 18px; - color: #20133A; + color: #20133a; font-weight: 400; margin-top: 20px; margin-bottom: 25px; @@ -279,7 +279,7 @@ margin-left: 10px; font-weight: 400; } -.gonggao_down{ +.gonggao_down { margin-top: 10px; margin-left: 10px; display: flex; @@ -331,11 +331,11 @@ top: 50%; width: 340px; height: auto; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 4px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 10px; @@ -383,7 +383,7 @@ align-items: flex-start; margin: 0 15px; } -.btn{ +.btn { display: flex; flex-direction: row; align-items: center; @@ -404,7 +404,7 @@ color: #fff; } -.jdzt{ +.jdzt { display: flex; align-items: center; justify-content: space-between; @@ -418,31 +418,30 @@ } .css-button-3d--rose { - min-width: 130px; - height: 40px; - color: #fff; - padding: 5px 10px; - font-weight: bold; - cursor: pointer; - transition: all 0.3s ease; - position: relative; - display: inline-block; - outline: none; - border-radius: 5px; - border: none; - background: #ff6392; - box-shadow: 0 5px #ff0a78; + min-width: 130px; + height: 40px; + color: #fff; + padding: 5px 10px; + font-weight: bold; + cursor: pointer; + transition: all 0.3s ease; + position: relative; + display: inline-block; + outline: none; + border-radius: 5px; + border: none; + background: #ff6392; + box-shadow: 0 5px #ff0a78; } .css-button-3d--rose:hover { - box-shadow: 0 3px #ff0a78; - top: 1px; + box-shadow: 0 3px #ff0a78; + top: 1px; } .css-button-3d--rose:active { - box-shadow: 0 0 #ff0a78; - top: 5px; + box-shadow: 0 0 #ff0a78; + top: 5px; } - .liuliang_down { width: 100%; height: auto; @@ -502,7 +501,7 @@ border-bottom-left-radius: 10px; } -.liuliang_des_2{ +.liuliang_des_2 { font-size: 14px; color: #20133a; font-weight: 600; @@ -548,14 +547,14 @@ border-radius: 100px; } -.kuaijie_item{ +.kuaijie_item { display: flex; flex-direction: row; justify-content: space-between; align-items: center; } -.kuaijie_item_line{ +.kuaijie_item_line { height: 20px; width: 100%; border-style: solid; @@ -571,40 +570,40 @@ } .tanbox-right { - background-color: #DFF0D8; + background-color: #dff0d8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#3C763D; + color: #3c763d; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #D6E9C6; + border-color: #d6e9c6; border-width: 1px; } .tanbox-cuowu { - background-color: #F6E8E8; + background-color: #f6e8e8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#C4807E; + color: #c4807e; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #F1DCE0; + border-color: #f1dce0; border-width: 1px; } @@ -615,11 +614,11 @@ top: 50%; width: 60px; height: 60px; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 10px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 10px; @@ -632,11 +631,11 @@ top: 50%; width: 320px; height: 220px; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 4px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; @@ -652,7 +651,7 @@ color: #000; margin-top: 10px; } -.logout_button_btn{ +.logout_button_btn { height: 80px; } .logout_button { @@ -667,8 +666,8 @@ .logout_button_quxiao { background-color: #0060dfc2; } - -.download_down{ + +.download_down { width: 100%; height: auto; border-radius: 4px; @@ -681,12 +680,12 @@ align-items: center; justify-content: flex-start; box-shadow: 2px 2px 8px #0000002d; - padding:12px; + padding: 12px; margin-right: 0px; margin-bottom: 10px; border-radius: 8px; width: 100%; - text-decoration:none; + text-decoration: none; } .download_box_tuijian { display: flex; @@ -694,16 +693,16 @@ align-items: center; justify-content: flex-start; box-shadow: 2px 2px 8px #0000002d; - padding:12px; + padding: 12px; margin-right: 0px; margin-bottom: 10px; border-radius: 8px; width: 100%; - text-decoration:none; + text-decoration: none; background-image: url('../img/downloadtuijian.svg'); background-repeat: no-repeat; background-position: top right; - background-size:50px 50px; + background-size: 50px 50px; } .download_logo { width: 50px; @@ -726,7 +725,7 @@ margin-left: 4px; } -.shop_down{ +.shop_down { width: 100%; height: auto; border-radius: 4px; @@ -740,7 +739,7 @@ justify-content: flex-start; box-shadow: 2px 2px 8px #0000002d; padding: 6px; - + margin-bottom: 20px; border-radius: 16px; width: 100%; @@ -767,12 +766,12 @@ border-color: #4176fa; box-sizing: border-box; background-image: url(../img/tuijian.svg); - background-repeat:no-repeat; - background-position:top right; + background-repeat: no-repeat; + background-position: top right; } .shop_title { font-size: 28px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -782,7 +781,7 @@ letter-spacing: -1.2px; } -.shop_price{ +.shop_price { color: #20133a; font-size: 40px; font-weight: 500; @@ -794,7 +793,7 @@ .shop_content { font-size: 16px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -812,14 +811,14 @@ border-radius: 4px; } .shop_meiyue { - color: #42414D; + color: #42414d; font-size: 14px; font-weight: 300; margin-top: 10px; margin-bottom: 2px; } -.outline_down{ +.outline_down { width: 100%; height: auto; border-radius: 4px; @@ -862,10 +861,10 @@ .outline_box_link { color: #0060df; margin-right: 15px; - text-decoration:none; + text-decoration: none; } -.sanfang_down{ +.sanfang_down { width: 100%; height: auto; border-radius: 4px; @@ -910,7 +909,7 @@ .sanfang_box_link { color: #0060df; margin-right: 10px; - text-decoration:none; + text-decoration: none; } .tan-qrcode { @@ -920,11 +919,11 @@ top: 50%; width: 256px; height: auto; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 400; - color:#fff; + color: #fff; padding: 4px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 20px; @@ -942,8 +941,7 @@ z-index: 200; } - -.node_down{ +.node_down { width: 100%; height: auto; border-radius: 4px; @@ -970,11 +968,11 @@ margin-left: 10px; width: 50%; } -.node_box_status{ +.node_box_status { width: 20px; } -.node_box_rate{ +.node_box_rate { font-size: 14px; font-weight: 300; color: #20133a; @@ -987,7 +985,7 @@ line-height: 24px; border-color: #00000017; } -.node_box_tag{ +.node_box_tag { font-size: 14px; font-weight: 300; color: #20133a; @@ -1003,7 +1001,7 @@ margin-right: 10px; } -.order_down{ +.order_down { width: 100%; height: auto; border-radius: 4px; @@ -1023,7 +1021,7 @@ width: 100%; } -.order_box_trade{ +.order_box_trade { font-size: 14px; font-weight: 400; color: #0060df; @@ -1044,7 +1042,7 @@ color: #42435a; margin-right: 10px; } -.order_box_zhouqi{ +.order_box_zhouqi { font-size: 14px; font-weight: 300; color: #20133a; @@ -1068,7 +1066,7 @@ border-style: none; } -.invite_down{ +.invite_down { width: 100%; height: auto; background-color: #ffffff; @@ -1118,7 +1116,7 @@ color: #42435a; } -.invite_des_group{ +.invite_des_group { display: flex; flex-direction: row; align-items: center; @@ -1196,9 +1194,9 @@ top: 50%; width: 350px; height: auto; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; @@ -1223,8 +1221,8 @@ } .tanbox-huazhuan-des { - background-color: #DFF0D8; - color:#3C763D; + background-color: #dff0d8; + color: #3c763d; margin-left: 10px; height: 40px; line-height: 40px; @@ -1258,9 +1256,9 @@ border-left-style: solid; border-bottom-style: solid; border-right-style: none; - color: #5F5F73; + color: #5f5f73; font-size: 14px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1279,7 +1277,7 @@ border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #0360DF; + color: #0360df; } .huazhuan_button_group { @@ -1298,7 +1296,7 @@ border-radius: 6px; border-style: none; background-color: #0060df; - color: #fff + color: #fff; } .huazhuan_tan_button_quxiao { @@ -1329,9 +1327,9 @@ border-left-style: solid; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1348,9 +1346,9 @@ border-color: #9e9e9e; border-image: none; border-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; margin-right: 0px; } @@ -1398,7 +1396,7 @@ height: 30px; border-style: none; border-radius: 6px; - background-color: #0360DF; + background-color: #0360df; color: #fff; } .chongzhi_dingyue { @@ -1420,7 +1418,7 @@ margin-bottom: 0px; font-weight: 400; } -.set_des_group{ +.set_des_group { display: flex; flex-direction: row; align-items: center; @@ -1440,32 +1438,32 @@ height: 45px; } -.ticket_box_id{ +.ticket_box_id { font-size: 14px; margin-left: 10px; margin-right: 10px; color: #20133a; display: none; } -.ticket_box_youxian{ +.ticket_box_youxian { font-size: 14px; margin-left: 10px; margin-right: 10px; color: #20133a; display: none; } -.ticket_box_shijian{ +.ticket_box_shijian { font-size: 14px; margin-left: 10px; margin-right: 10px; color: #20133a; display: none; } -.ticket_box_cancel{ +.ticket_box_cancel { font-size: 14px; margin-left: 10px; margin-right: 10px; - color: #0360DF; + color: #0360df; border-style: none; background-color: #fff; } @@ -1474,14 +1472,14 @@ font-size: 14px; margin-left: 10px; margin-right: 10px; - color: #0360DF; + color: #0360df; width: 190px; background-color: #fff; border-style: none; text-align: left; } -.ticket_box_zhuangtai{ +.ticket_box_zhuangtai { font-size: 14px; font-weight: 300; color: #20133a; @@ -1511,11 +1509,11 @@ top: 50%; width: 360px; height: auto; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 4px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 10px; @@ -1525,7 +1523,7 @@ align-items: center; } -.tanbox-gongdan-down{ +.tanbox-gongdan-down { border-style: solid; border-width: 1px; border-color: #00000015; @@ -1533,25 +1531,24 @@ height: 300px; border-top-right-radius: 6px; border-top-left-radius: 6px; - overflow-y:auto; + overflow-y: auto; } .tanbox-gongdan-title { font-size: 20px; - color: #20133a;; + color: #20133a; font-weight: 400; margin-top: 10px; margin-bottom: 10px; - } .gongdanzuo { font-size: 14px; - color: #20133a;; + color: #20133a; font-weight: 400; margin-top: 2px; margin-bottom: 10px; margin-left: 10px; - background-color: #E5F7D2; + background-color: #e5f7d2; height: auto; width: 220px; padding: 10px; @@ -1560,7 +1557,7 @@ } .gongdanyou { font-size: 14px; - color: #20133a;; + color: #20133a; font-weight: 400; margin-top: 2px; margin-bottom: 10px; @@ -1585,7 +1582,7 @@ align-items: flex-end; } -.gongdanshijian{ +.gongdanshijian { font-size: 12px; color: #00000027; margin-top: 0px; @@ -1609,7 +1606,6 @@ border-width: 1px; border-color: #00000028; background-color: #00000005; - } .gongdan_send { width: 68px; @@ -1623,7 +1619,7 @@ border-top-style: none; border-right-style: solid; border-width: 1px; - background-color: #0360DF; + background-color: #0360df; color: #fff; } .tickettitlegroup { @@ -1642,7 +1638,7 @@ color: #fff; } -.tanbox-ticket-down{ +.tanbox-ticket-down { border-style: none; width: 350px; height: 300px; @@ -1661,7 +1657,7 @@ font-size: 14px; } -.tanbox_select_text{ +.tanbox_select_text { width: 100%; height: 35px; padding: 0px; @@ -1680,7 +1676,7 @@ .tanbox_textarea_text { width: 100%; height: 190px; - padding:0px; + padding: 0px; padding-left: 10px; padding-top: 10px; box-sizing: border-box; @@ -1703,7 +1699,7 @@ .ticket_send { width: 85px; height: 35px; - background-color:#0360DF ; + background-color: #0360df; border-style: none; border-radius: 6px; color: #fff; @@ -1719,7 +1715,6 @@ border-radius: 6px; color: #20133a; margin-left: 5px; - } .shop_peizhi_down { width: 100%; @@ -1762,14 +1757,14 @@ padding: 0px; width: 88%; padding-left: 10px; - background-color: #21143B; - border-top-left-radius:6px; - border-bottom-left-radius:6px; + background-color: #21143b; + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; color: #fff; - -webkit-input-placeholder :#ffffffd5; - -moz-placeholder:#ffffffd5; - -moz-placeholder:#ffffffd5; - -ms-input-placeholder:#ffffffd5; + -webkit-input-placeholder: #ffffffd5; + -moz-placeholder: #ffffffd5; + -moz-placeholder: #ffffffd5; + -ms-input-placeholder: #ffffffd5; } .youhuiquanyanzheng { height: 50px; @@ -1777,8 +1772,8 @@ padding: 0px; width: 100px; background-color: #0060df; - border-top-right-radius:6px; - border-bottom-right-radius:6px; + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; margin: 0px; color: #fff; } @@ -1791,7 +1786,7 @@ flex-wrap: wrap; justify-content: flex-start; } -.peizhi_jine_option{ +.peizhi_jine_option { width: 48%; height: 60px; background-color: #fff; @@ -1805,7 +1800,7 @@ justify-content: space-between; border-radius: 6px; } -.peizhi_jine_option_choose{ +.peizhi_jine_option_choose { width: 48%; height: 60px; background-color: #fff; @@ -1821,23 +1816,23 @@ box-sizing: border-box; border-style: solid; border-width: 3px; - border-color: #0360DF; + border-color: #0360df; } .peizhi_jine_name { margin-left: 5px; font-size: 16px; - color: #21143B; + color: #21143b; } -.peizhi_jine_price{ +.peizhi_jine_price { margin-right: 5px; font-size: 16px; - color: #21143B; + color: #21143b; font-weight: 500; } .shop_peizhi_zongji { width: 100%; height: auto; - background-color:#fff; + background-color: #fff; box-shadow: 2px 2px 8px #00000023; margin-top: 10px; border-radius: 6px; @@ -1845,7 +1840,7 @@ padding-bottom: 10px; } -.zhekou_group_des{ +.zhekou_group_des { color: #42435a; font-size: 16px; margin-left: 10px; @@ -1913,7 +1908,7 @@ margin-right: 10px; } -.jiahuaneirong_des{ +.jiahuaneirong_des { color: #42435a; font-size: 16px; margin-left: 10px; @@ -1925,7 +1920,7 @@ line-height: 40px; } -.pay_img{ +.pay_img { width: 40px; margin-left: 10px; border-radius: 100px; @@ -1948,15 +1943,15 @@ font-size: 14px; margin-bottom: 10px; margin-top: 0px; - color: #42414D; + color: #42414d; } -.status_group{ +.status_group { display: flex; flex-direction: column; align-items: center; } -.saoguang_shop{ +.saoguang_shop { width: 100%; height: 200px; line-height: 40px; @@ -1968,7 +1963,7 @@ margin-bottom: 10px; box-shadow: 2px 2px 8px #0000002a; } -.saoguang_outline{ +.saoguang_outline { width: 100%; height: 60px; background: #ffffff; @@ -1980,7 +1975,7 @@ box-shadow: 2px 2px 8px #0000002a; } -.sweep-light{ +.sweep-light { position: absolute; left: 0; right: 0; @@ -2011,23 +2006,23 @@ @-webkit-keyframes ball-scale { 0% { -webkit-transform: scale(0); - transform: scale(0) + transform: scale(0); } 100% { -webkit-transform: scale(1); transform: scale(1); - opacity: 0 + opacity: 0; } } @keyframes ball-scale { 0% { -webkit-transform: scale(0); - transform: scale(0) + transform: scale(0); } 100% { -webkit-transform: scale(1); transform: scale(1); - opacity: 0 + opacity: 0; } } @@ -2065,18 +2060,17 @@ align-items: center; justify-content: flex-start; } -.video-box-title{ +.video-box-title { margin-top: 2px; margin-bottom: 2px; margin-left: 4px; font-size: 18px; color: #20133a; } -.hotway{ +.hotway { font-size: 16px; text-decoration: none; color: #0060df; - } .hotkeygroup { display: flex; @@ -2106,7 +2100,7 @@ flex-direction: row; align-items: center; } -.gongdantishi-box{ +.gongdantishi-box { width: 100%; height: 40px; background-color: #ffefd1; @@ -2116,13 +2110,13 @@ flex-direction: row; align-items: center; } -.tishi-words-1{ +.tishi-words-1 { text-decoration: none; margin-left: 10px; color: #74290e; } -.tishi-words-2{ +.tishi-words-2 { text-decoration: none; margin-left: 10px; color: #855c0d; -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/litestylepc.css b/xiaon_c5z3Cp/static/litestylepc.css index 9c845f9..0fbf3bc 100644 --- a/xiaon_c5z3Cp/static/litestylepc.css +++ b/xiaon_c5z3Cp/static/litestylepc.css @@ -1,13 +1,13 @@ :root { --component-bg5-color: rgba(255, 255, 255, 0.5); --component-bg-color: rgba(255, 255, 255, 0.7); - } +} .element { cursor: pointer; } .fatherbox { - background-size:100%; - background-repeat:no-repeat; + background-size: 100%; + background-repeat: no-repeat; width: 100%; display: flex; flex-direction: column; @@ -16,8 +16,8 @@ @media screen and (min-width: 1201px) { .fatherbox { - background-size:100%; - background-repeat:no-repeat; + background-size: 100%; + background-repeat: no-repeat; width: 1200px; display: flex; flex-direction: column; @@ -25,7 +25,7 @@ } } -#inviteforce{ +#inviteforce { display: none; } @@ -33,16 +33,16 @@ margin-top: 50px; } -.screen_one_img{ - height: 480px; +.screen_one_img { + height: 480px; margin-left: 60px; margin-right: 0px; margin-top: -480px; filter: drop-shadow(6px 6px 4px #00000064); } -.screen_one_bg{ - height: 500px; +.screen_one_bg { + height: 500px; margin-left: 60px; margin-right: 0px; } @@ -105,7 +105,7 @@ .background_gary { width: 100%; height: 48px; - background-color: #F9F9FA; + background-color: #f9f9fa; display: flex; flex-direction: row; align-items: center; @@ -114,10 +114,10 @@ .gary_p { font-size: 14px; - color: #20133A; + color: #20133a; margin-left: 16px; font-weight: 600; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .screen_one { @@ -146,7 +146,7 @@ .screen_one_title { font-size: 40px; - color: #20133A; + color: #20133a; margin-top: 2px; margin-left: 16px; margin-right: 16px; @@ -157,7 +157,7 @@ .des { font-size: 18px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -169,7 +169,7 @@ .download { width: 200px; height: 50px; - background-color: #0360DF; + background-color: #0360df; color: #ffffff; margin-left: 16px; margin-top: 40px; @@ -188,15 +188,15 @@ } .screen_two { - width: 100%; - display: flex; - flex-direction: column; - margin-top: 70px; + width: 100%; + display: flex; + flex-direction: column; + margin-top: 70px; } .title { font-size: 36px; - color: #20133A; + color: #20133a; margin-top: 50px; margin-left: 16px; margin-right: 16px; @@ -207,14 +207,14 @@ .subtitle { font-size: 28px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; margin-bottom: 2px; font-weight: 700; text-align: justify; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .left_right { @@ -261,10 +261,10 @@ .sheet_1 { border-style: solid; border-color: #fff; - background-color: #F4F4F5; + background-color: #f4f4f5; padding: 0px; font-size: 14px; - color: #42414D; + color: #42414d; border-spacing: 0px; padding-left: 6px; padding-right: 6px; @@ -279,7 +279,7 @@ background-color: #fff; padding: 0px; font-size: 12px; - color: #42414D; + color: #42414d; border-spacing: 0px; padding-left: 6px; padding-right: 6px; @@ -304,7 +304,7 @@ margin-top: 120px; align-items: center; justify-content: space-evenly; - } +} .screen_three_left { width: 500px; @@ -324,13 +324,13 @@ margin-top: 120px; align-items: center; justify-content: space-evenly; - } +} .screen_four_img { height: 46px; margin-left: 16px; margin-top: 10px; - } +} .screen_four_left { display: flex; @@ -338,13 +338,13 @@ flex-wrap: nowrap; align-items: flex-start; width: 500px; - } +} .screen_four_bg { width: 450px; margin-top: 30px; filter: drop-shadow(6px 6px 4px #00000064); - } +} .store { display: flex; @@ -366,7 +366,7 @@ flex-direction: column; margin-top: 100px; align-items: center; - } +} .screen_five_bg { width: 325px; @@ -376,7 +376,7 @@ margin-left: auto; margin-right: auto; text-align: center; - } +} .screen_five_left { text-align: center; @@ -392,7 +392,7 @@ .yewei { margin-top: 30px; - background-color: #F9F9FA; + background-color: #f9f9fa; width: 100%; display: flex; flex-direction: column; @@ -431,7 +431,7 @@ margin-left: 20px; margin-right: 10px; font-weight: 300; - line-height:20px; + line-height: 20px; height: 20px; } .sub_button { @@ -447,8 +447,6 @@ margin-top: 40px; } - - .videobox { background-color: rgb(255, 255, 255); width: 23%; @@ -456,8 +454,6 @@ margin-bottom: 15px; } - - .videocover { background-color: #000; width: 100%; @@ -469,8 +465,6 @@ align-items: center; } - - .videodown { display: flex; flex-direction: row; @@ -479,7 +473,6 @@ height: 70px; } - .touxiang { width: 40px; margin-left: 4px; @@ -517,7 +510,6 @@ height: 30px; line-height: 30px; font-size: 14px; - } .sheettitle_1 { width: 25%; @@ -560,7 +552,7 @@ .nodetitle { font-size: 36px; - color: #20133A; + color: #20133a; margin-top: 30px; margin-left: 16px; margin-right: 16px; @@ -569,8 +561,7 @@ text-align: center; } - -.pricelist{ +.pricelist { display: flex; width: 100%; flex-direction: row; @@ -590,7 +581,7 @@ flex-direction: column; align-items: center; } -.recolag{ +.recolag { width: 80%; background-image: url('../img/sellprice.svg'); background-repeat: no-repeat; @@ -624,25 +615,25 @@ flex-direction: column; align-items: flex-start; height: auto; - width : 100%; + width: 100%; margin-top: 10px; } .pricetitle { font-size: 28px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; margin-bottom: 2px; font-weight: 700; text-align: justify; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .pricesubtitle { font-size: 12px; - color: #42414D; + color: #42414d; margin-top: 0px; margin-left: 16px; margin-right: 16px; @@ -653,12 +644,12 @@ .huaxianprice { color: #ccd2d5; - text-decoration:line-through; + text-decoration: line-through; margin-top: 20px; margin-bottom: 2px; } .sellprice { - color: #0360DF; + color: #0360df; font-size: 40px; font-weight: 500; margin-top: 2px; @@ -667,16 +658,16 @@ height: 30px; } .meiyue { - color: #42414D; + color: #42414d; font-size: 12px; font-weight: 300; margin-top: 10px; margin-bottom: 2px; } -.pricedes{ +.pricedes { font-size: 12px; - color: #42414D; + color: #42414d; margin-top: 2px; margin-left: 16px; margin-right: 16px; @@ -695,10 +686,10 @@ border-radius: 4px; } -.toastlink{ +.toastlink { font-size: 14px; - color:#42414D; - text-decoration:none; + color: #42414d; + text-decoration: none; margin-right: 5px; } @@ -732,9 +723,9 @@ position: fixed; left: 50%; top: 50%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 100; border-radius: 16px; display: flex; @@ -765,34 +756,37 @@ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; } -input::-webkit-input-placeholder{ - color:#9CA3AF; +input::-webkit-input-placeholder { + color: #9ca3af; font-size: 16px; } -input::-moz-placeholder{ /* Mozilla Firefox 19+ */ - color:#9CA3AF; +input::-moz-placeholder { + /* Mozilla Firefox 19+ */ + color: #9ca3af; font-size: 16px; } -input:-moz-placeholder{ /* Mozilla Firefox 4 to 18 */ - color:#9CA3AF; +input:-moz-placeholder { + /* Mozilla Firefox 4 to 18 */ + color: #9ca3af; font-size: 16px; } -input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ - color:#9CA3AF; +input:-ms-input-placeholder { + /* Internet Explorer 10-11 */ + color: #9ca3af; font-size: 16px; } .loginbutton { width: 416px; height: 56px; - background-color: #0561DF; + background-color: #0561df; border-style: none; border-radius: 6px; font-size: 16px; @@ -822,15 +816,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: solid; border-bottom-style: solid; border-right-style: none; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-right: 0px; + outline-color: #0360df; + margin-right: 0px; } .inputbox-reg-no { @@ -845,15 +839,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: solid; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-right: 0px; + outline-color: #0360df; + margin-right: 0px; } .inputbox-reg-list { @@ -867,15 +861,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-left: 0px; + outline-color: #0360df; + margin-left: 0px; text-align: center; } @@ -902,8 +896,8 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ background-color: #fff; } -#hintContainer::after{ - content: ""; +#hintContainer::after { + content: ''; position: absolute; width: 0; height: 0; @@ -925,54 +919,54 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #0360DF; + color: #0360df; font-size: 16px; - outline-color: #0360DF; - margin-left: 0px; + outline-color: #0360df; + margin-left: 0px; text-align: center; background-color: #fff; } .tanbox-right { - background-color: #DFF0D8; + background-color: #dff0d8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#3C763D; + color: #3c763d; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #D6E9C6; + border-color: #d6e9c6; border-width: 1px; } .tanbox-cuowu { - background-color: #F6E8E8; + background-color: #f6e8e8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#C4807E; + color: #c4807e; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #F1DCE0; + border-color: #f1dce0; border-width: 1px; } @@ -983,11 +977,11 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ top: 50%; width: 50px; height: 50px; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 10px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 10px; @@ -1002,7 +996,7 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ width: 100%; height: 100%; z-index: 200; - color:#fff; + color: #fff; display: flex; align-items: center; justify-content: center; @@ -1031,10 +1025,10 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ margin-bottom: 0px; } -.paygohomepage{ +.paygohomepage { width: 90%; height: 56px; - background-color: #0561DF; + background-color: #0561df; border-style: none; border-radius: 6px; font-size: 16px; @@ -1050,13 +1044,13 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ .paygoapp1111 { width: 90%; height: 56px; - color: #0561DF !important; + color: #0561df !important; background-color: #ffffff !important; border-style: solid; border-radius: 6px; font-size: 16px; font-weight: 700; - border-color: #0561DF; + border-color: #0561df; margin-bottom: 10px; margin-top: 30px; display: flex; @@ -1064,4 +1058,4 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ align-items: center; justify-content: center; text-decoration: none; -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/litestylewap.css b/xiaon_c5z3Cp/static/litestylewap.css index 44d5dcd..468db37 100644 --- a/xiaon_c5z3Cp/static/litestylewap.css +++ b/xiaon_c5z3Cp/static/litestylewap.css @@ -1,20 +1,20 @@ .fatherbox { - background-size:100%; - background-repeat:no-repeat; + background-size: 100%; + background-repeat: no-repeat; width: 100%; display: flex; flex-direction: column; align-items: center; } -.screen_one_img{ +.screen_one_img { display: none; } .screen_one_bg { display: none; } -#inviteforce{ +#inviteforce { display: none; } @@ -73,7 +73,7 @@ .background_gary { width: 100%; height: 48px; - background-color: #F9F9FA; + background-color: #f9f9fa; display: flex; align-items: center; justify-content: flex-start; @@ -82,10 +82,10 @@ .gary_p { font-size: 14px; - color: #20133A; + color: #20133a; margin-left: 16px; font-weight: 600; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .screen_one { @@ -115,7 +115,7 @@ .screen_one_title { font-size: 30px; - color: #20133A; + color: #20133a; margin-top: 2px; margin-left: 16px; margin-right: 16px; @@ -126,7 +126,7 @@ .des { font-size: 16px; - color: #42414D; + color: #42414d; margin-top: 20px; margin-left: 16px; margin-right: 16px; @@ -138,7 +138,7 @@ .download { width: 150px; height: 46px; - background-color: #0360DF; + background-color: #0360df; color: #ffffff; margin-left: 16px; margin-top: 40px; @@ -157,15 +157,15 @@ } .screen_two { - width: 100%; - display: flex; - flex-direction: column; - margin-top: 70px; + width: 100%; + display: flex; + flex-direction: column; + margin-top: 70px; } .title { font-size: 30px; - color: #20133A; + color: #20133a; margin-top: 2px; margin-left: 16px; margin-right: 16px; @@ -176,14 +176,14 @@ .subtitle { font-size: 22px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; margin-bottom: 2px; font-weight: 700; text-align: justify; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .screen_two_right { @@ -202,7 +202,7 @@ margin-left: 16px; margin-right: 16px; background-color: #fff; - + margin-top: -200px; box-shadow: 0px 2px 2px 2px rgb(114 114 114 / 20%); border-radius: 4px; @@ -215,10 +215,10 @@ .sheet_1 { border-style: solid; border-color: #fff; - background-color: #F4F4F5; + background-color: #f4f4f5; padding: 0px; font-size: 12px; - color: #42414D; + color: #42414d; border-spacing: 0px; padding-left: 6px; padding-right: 6px; @@ -233,7 +233,7 @@ background-color: #fff; padding: 0px; font-size: 12px; - color: #42414D; + color: #42414d; border-spacing: 0px; padding-left: 6px; padding-right: 6px; @@ -257,7 +257,7 @@ flex-direction: column; margin-top: 70px; align-items: center; - } +} .screen_three_img { width: 326px; @@ -271,26 +271,26 @@ flex-direction: column; margin-top: 70px; align-items: center; - } +} .screen_four_img { height: 46px; margin-left: 16px; margin-top: 10px; - } +} .screen_four_left { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; - } +} .screen_four_bg { width: 315px; height: 325px; margin-top: 60px; - } +} .store { display: flex; @@ -306,14 +306,13 @@ flex-direction: column; } - .screen_five { width: 100%; display: flex; flex-direction: column; margin-top: 70px; align-items: center; - } +} .screen_five_bg { width: 325px; @@ -323,7 +322,7 @@ margin-left: auto; margin-right: auto; text-align: center; - } +} .screen_five_left { text-align: center; @@ -335,7 +334,7 @@ .yewei { margin-top: 30px; - background-color: #F9F9FA; + background-color: #f9f9fa; width: 100%; display: flex; flex-direction: column; @@ -376,7 +375,7 @@ margin-left: 20px; margin-top: 10px; font-weight: 300; - line-height:20px; + line-height: 20px; height: 20px; } @@ -426,7 +425,6 @@ align-items: center; } - .videodown { display: flex; flex-direction: row; @@ -465,7 +463,6 @@ .testsheet { width: 100%; margin-top: 40px; - } .sheettitle { @@ -517,7 +514,7 @@ .nodetitle { font-size: 36px; - color: #20133A; + color: #20133a; margin-top: 30px; margin-left: 16px; margin-right: 16px; @@ -526,7 +523,7 @@ text-align: center; } -.pricelist{ +.pricelist { display: flex; width: 100%; flex-direction: column; @@ -544,7 +541,6 @@ display: flex; flex-direction: column; align-items: center; - } .priceup { @@ -561,26 +557,25 @@ flex-direction: column; align-items: flex-start; height: auto; - width : 100%; + width: 100%; margin-top: 20px; - } .pricetitle { font-size: 28px; - color: #20133A; + color: #20133a; margin-top: 20px; margin-left: 16px; margin-right: 16px; margin-bottom: 2px; font-weight: 700; text-align: justify; - letter-spacing:-1.2px; + letter-spacing: -1.2px; } .pricesubtitle { font-size: 14px; - color: #42414D; + color: #42414d; margin-top: 0px; margin-left: 16px; margin-right: 16px; @@ -589,9 +584,9 @@ text-align: justify; } -.pricedes{ +.pricedes { font-size: 16px; - color: #42414D; + color: #42414d; margin-top: 2px; margin-left: 16px; margin-right: 16px; @@ -610,10 +605,10 @@ border-radius: 4px; } -.toastlink{ +.toastlink { font-size: 14px; - color:#42414D; - text-decoration:none; + color: #42414d; + text-decoration: none; margin-right: 5px; } @@ -634,7 +629,7 @@ box-sizing: border-box; } -.recolag{ +.recolag { width: 80%; background-image: url('../img/sellprice.svg'); background-repeat: no-repeat; @@ -651,12 +646,12 @@ .huaxianprice { color: #ccd2d5; - text-decoration:line-through; + text-decoration: line-through; margin-top: 20px; margin-bottom: 2px; } .sellprice { - color: #0360DF; + color: #0360df; font-size: 50px; font-weight: 500; margin-top: 2px; @@ -665,7 +660,7 @@ height: 30px; } .meiyue { - color: #42414D; + color: #42414d; font-size: 12px; font-weight: 300; margin-top: 10px; @@ -693,9 +688,9 @@ position: fixed; left: 50%; top: 50%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 100; border-radius: 16px; display: flex; @@ -726,34 +721,37 @@ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; + outline-color: #0360df; } -input::-webkit-input-placeholder{ - color:#9CA3AF; +input::-webkit-input-placeholder { + color: #9ca3af; font-size: 16px; } -input::-moz-placeholder{ /* Mozilla Firefox 19+ */ - color:#9CA3AF; +input::-moz-placeholder { + /* Mozilla Firefox 19+ */ + color: #9ca3af; font-size: 16px; } -input:-moz-placeholder{ /* Mozilla Firefox 4 to 18 */ - color:#9CA3AF; +input:-moz-placeholder { + /* Mozilla Firefox 4 to 18 */ + color: #9ca3af; font-size: 16px; } -input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ - color:#9CA3AF; +input:-ms-input-placeholder { + /* Internet Explorer 10-11 */ + color: #9ca3af; font-size: 16px; } .loginbutton { width: 90%; height: 56px; - background-color: #0561DF; + background-color: #0561df; border-style: none; border-radius: 6px; font-size: 16px; @@ -783,15 +781,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: solid; border-bottom-style: solid; border-right-style: none; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-right: 0px; + outline-color: #0360df; + margin-right: 0px; } .inputbox-reg-no { width: 100%; @@ -805,15 +803,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: solid; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-right: 0px; + outline-color: #0360df; + margin-right: 0px; } .inputbox-reg-list { @@ -827,15 +825,15 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #5F5F73; + color: #5f5f73; font-size: 16px; - outline-color: #0360DF; - margin-left: 0px; + outline-color: #0360df; + margin-left: 0px; text-align: center; } @@ -863,8 +861,8 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ background-color: #fff; } -#hintContainer::after{ - content: ""; +#hintContainer::after { + content: ''; position: absolute; width: 0; height: 0; @@ -875,7 +873,6 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ right: 2px; } - .inputbox-reg-mes { width: 40%; height: 58px; @@ -887,54 +884,54 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ border-width: 1px; margin-bottom: 10px; border-color: #9e9e9e; - border-image:none; + border-image: none; border-top-style: solid; border-left-style: none; border-bottom-style: solid; border-right-style: solid; - color: #0360DF; + color: #0360df; font-size: 16px; - outline-color: #0360DF; - margin-left: 0px; + outline-color: #0360df; + margin-left: 0px; text-align: center; background-color: #fff; } .tanbox-right { - background-color: #DFF0D8; + background-color: #dff0d8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#3C763D; + color: #3c763d; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #D6E9C6; + border-color: #d6e9c6; border-width: 1px; } .tanbox-cuowu { - background-color: #F6E8E8; + background-color: #f6e8e8; position: fixed; left: 50%; top: 35%; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#C4807E; + color: #c4807e; padding: 16px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 4px; text-align: center; border-style: solid; - border-color: #F1DCE0; + border-color: #f1dce0; border-width: 1px; } @@ -945,11 +942,11 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ top: 50%; width: 60px; height: 60px; - transform: translate(-50%,-50%); - -ms-transform: translate(-50%,-50%); - -webkit-transform: translate(-50%,-50%); + transform: translate(-50%, -50%); + -ms-transform: translate(-50%, -50%); + -webkit-transform: translate(-50%, -50%); z-index: 200; - color:#fff; + color: #fff; padding: 10px; box-shadow: 2px 2px 8px 4px rgba(153, 153, 153, 0.2); border-radius: 10px; @@ -963,7 +960,7 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ width: 100%; height: 100%; z-index: 200; - color:#fff; + color: #fff; display: flex; align-items: center; justify-content: center; @@ -992,10 +989,10 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ margin-bottom: 0px; } -.paygohomepage{ +.paygohomepage { width: 90%; height: 56px; - background-color: #0561DF; + background-color: #0561df; border-style: none; border-radius: 6px; font-size: 16px; @@ -1011,13 +1008,13 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ .paygoapp1111 { width: 90%; height: 56px; - color: #0561DF !important; + color: #0561df !important; background-color: #ffffff !important; border-style: solid; border-radius: 6px; font-size: 16px; font-weight: 700; - border-color: #0561DF; + border-color: #0561df; margin-bottom: 10px; margin-top: 30px; display: flex; @@ -1025,4 +1022,4 @@ input:-ms-input-placeholder{ /* Internet Explorer 10-11 */ align-items: center; justify-content: center; text-decoration: none; -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/liuliang.js b/xiaon_c5z3Cp/static/liuliang.js index 05b3f41..35a2457 100644 --- a/xiaon_c5z3Cp/static/liuliang.js +++ b/xiaon_c5z3Cp/static/liuliang.js @@ -1,85 +1,78 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getjilu(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getjilu(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - console.log(params); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + console.log(params); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求流量记录接口*/ -function getjilu(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/stat/getTrafficLog'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsegetjilu); +function getjilu() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/stat/getTrafficLog'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsegetjilu); } - /*响应订单接口*/ // function responsegetjilu(code,data){ // if (code == '200') { @@ -111,7 +104,7 @@ function getjilu(){ // f.setAttribute('class','order_box_name'); // let g = document.createElement('p'); // g.setAttribute('class','order_box_zhuangtai'); - + // c.innerHTML = getshijian(a[x].record_at); // d.innerHTML = '上行:'+(a[x].u/1024/1024/1024).toFixed(2)+'GB'; // e.innerHTML = a[x].server_rate+'X'; @@ -135,126 +128,114 @@ function getjilu(){ // } function responsegetjilu(code, data) { - if (code == '200') { - let a = JSON.parse(data).data; - let jj = document.getElementById('order_down'); - jj.innerHTML = ''; - - if (a == '') { - console.log(a); - let queshengbox = document.createElement('div'); - let queshengtu = document.createElement('img'); - queshengbox.setAttribute('class', 'queshengtu-box'); - queshengtu.setAttribute('src', './img/queshengtu.png'); - queshengtu.setAttribute('class', 'queshengtu'); - let fatherdiv = document.getElementById('order_down'); - queshengbox.appendChild(queshengtu); - fatherdiv.appendChild(queshengbox); - } - - if (a.length > 10) { - let scrollableBox = document.createElement('div'); - scrollableBox.setAttribute('class', 'scrollable-box'); - - for (x in a) { - let b = document.createElement('div'); - b.setAttribute('class', 'order_box'); - let c = document.createElement('a'); - c.setAttribute('class', 'order_box_trade'); - let d = document.createElement('p'); - d.setAttribute('class', 'order_box_name'); - let e = document.createElement('p'); - e.setAttribute('class', 'order_box_zhouqi'); - let f = document.createElement('p'); - f.setAttribute('class', 'order_box_name'); - let g = document.createElement('p'); - g.setAttribute('class', 'order_box_zhuangtai'); - - c.innerHTML = getshijian(a[x].record_at); - d.innerHTML = '上行:' + (a[x].u / 1024 / 1024 / 1024).toFixed(2) + 'GB'; - e.innerHTML = a[x].server_rate + 'X'; - f.innerHTML = '下行:' + (a[x].d / 1024 / 1024 / 1024).toFixed(2) + 'GB'; - g.innerHTML = - '合计:' + - ( - a[x].u / 1024 / 1024 / 1024 + - (a[x].d / 1024 / 1024 / 1024) * a[x].server_rate - ).toFixed(2) + - 'GB'; - - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - - scrollableBox.appendChild(b); - } - - jj.appendChild(scrollableBox); + if (code == '200') { + let a = JSON.parse(data).data; + let jj = document.getElementById('order_down'); + jj.innerHTML = ''; + + if (a == '') { + console.log(a); + let queshengbox = document.createElement('div'); + let queshengtu = document.createElement('img'); + queshengbox.setAttribute('class', 'queshengtu-box'); + queshengtu.setAttribute('src', './img/queshengtu.png'); + queshengtu.setAttribute('class', 'queshengtu'); + let fatherdiv = document.getElementById('order_down'); + queshengbox.appendChild(queshengtu); + fatherdiv.appendChild(queshengbox); + } + + if (a.length > 10) { + let scrollableBox = document.createElement('div'); + scrollableBox.setAttribute('class', 'scrollable-box'); + + for (x in a) { + let b = document.createElement('div'); + b.setAttribute('class', 'order_box'); + let c = document.createElement('a'); + c.setAttribute('class', 'order_box_trade'); + let d = document.createElement('p'); + d.setAttribute('class', 'order_box_name'); + let e = document.createElement('p'); + e.setAttribute('class', 'order_box_zhouqi'); + let f = document.createElement('p'); + f.setAttribute('class', 'order_box_name'); + let g = document.createElement('p'); + g.setAttribute('class', 'order_box_zhuangtai'); + + c.innerHTML = getshijian(a[x].record_at); + d.innerHTML = '上行:' + (a[x].u / 1024 / 1024 / 1024).toFixed(2) + 'GB'; + e.innerHTML = a[x].server_rate + 'X'; + f.innerHTML = '下行:' + (a[x].d / 1024 / 1024 / 1024).toFixed(2) + 'GB'; + g.innerHTML = + '合计:' + + (a[x].u / 1024 / 1024 / 1024 + (a[x].d / 1024 / 1024 / 1024) * a[x].server_rate).toFixed(2) + + 'GB'; + + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + + scrollableBox.appendChild(b); + } + + jj.appendChild(scrollableBox); + } else { + for (x in a) { + let b = document.createElement('div'); + b.setAttribute('class', 'order_box'); + let c = document.createElement('a'); + c.setAttribute('class', 'order_box_trade'); + let d = document.createElement('p'); + d.setAttribute('class', 'order_box_name'); + let e = document.createElement('p'); + e.setAttribute('class', 'order_box_zhouqi'); + let f = document.createElement('p'); + f.setAttribute('class', 'order_box_name'); + let g = document.createElement('p'); + g.setAttribute('class', 'order_box_zhuangtai'); + + c.innerHTML = getshijian(a[x].record_at); + d.innerHTML = '上行:' + (a[x].u / 1024 / 1024 / 1024).toFixed(2) + 'GB'; + e.innerHTML = a[x].server_rate + 'X'; + f.innerHTML = '下行:' + (a[x].d / 1024 / 1024 / 1024).toFixed(2) + 'GB'; + g.innerHTML = + '合计:' + + (a[x].u / 1024 / 1024 / 1024 + (a[x].d / 1024 / 1024 / 1024) * a[x].server_rate).toFixed(2) + + 'GB'; + + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + + jj.appendChild(b); + } + } + + canceltanjiazai(); } else { - for (x in a) { - let b = document.createElement('div'); - b.setAttribute('class', 'order_box'); - let c = document.createElement('a'); - c.setAttribute('class', 'order_box_trade'); - let d = document.createElement('p'); - d.setAttribute('class', 'order_box_name'); - let e = document.createElement('p'); - e.setAttribute('class', 'order_box_zhouqi'); - let f = document.createElement('p'); - f.setAttribute('class', 'order_box_name'); - let g = document.createElement('p'); - g.setAttribute('class', 'order_box_zhuangtai'); - - c.innerHTML = getshijian(a[x].record_at); - d.innerHTML = '上行:' + (a[x].u / 1024 / 1024 / 1024).toFixed(2) + 'GB'; - e.innerHTML = a[x].server_rate + 'X'; - f.innerHTML = '下行:' + (a[x].d / 1024 / 1024 / 1024).toFixed(2) + 'GB'; - g.innerHTML = - '合计:' + - ( - a[x].u / 1024 / 1024 / 1024 + - (a[x].d / 1024 / 1024 / 1024) * a[x].server_rate - ).toFixed(2) + - 'GB'; - - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - - jj.appendChild(b); - } + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - - canceltanjiazai(); - } else { - tan('cuowu', '当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } - - //时间戳转日期 function getshijian(time) { - let date = new Date(parseInt(time) * 1000); - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - return y + '/' + MM + '/' + d; + let date = new Date(parseInt(time) * 1000); + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; + let d = date.getDate(); + d = d < 10 ? '0' + d : d; + let h = date.getHours(); + h = h < 10 ? '0' + h : h; + let m = date.getMinutes(); + m = m < 10 ? '0' + m : m; + let s = date.getSeconds(); + s = s < 10 ? '0' + s : s; + return y + '/' + MM + '/' + d; } - - - - diff --git a/xiaon_c5z3Cp/static/loginjs.js b/xiaon_c5z3Cp/static/loginjs.js index b056999..c0a178b 100644 --- a/xiaon_c5z3Cp/static/loginjs.js +++ b/xiaon_c5z3Cp/static/loginjs.js @@ -1,50 +1,50 @@ function bootcheck() { - let a = localStorage.getItem("authorization"); + let a = localStorage.getItem('authorization'); let b = window.location.href; - let c = b.split("?"); + let c = b.split('?'); if (c[1]) { - let d = c[1].split("&"); + let d = c[1].split('&'); for (x in d) { - let e = d[x].split("="); + let e = d[x].split('='); canshu[e[0]] = e[1]; } } - if (canshu["register"]) { - let e = document.getElementById("inviteforce"); - e.value = canshu["register"]; - e.setAttribute("disabled", "disabled"); - gobox("regbox"); + if (canshu['register']) { + let e = document.getElementById('inviteforce'); + e.value = canshu['register']; + e.setAttribute('disabled', 'disabled'); + gobox('regbox'); buildrequest(); - } else if (canshu["out_trade_no"]) { + } else if (canshu['out_trade_no']) { getzhifu(); - let paybox = document.getElementById("payfinish"); - let loginbox = document.getElementById("loginbox"); - loginbox.style.display = "none"; - paybox.style.display = "flex"; + let paybox = document.getElementById('payfinish'); + let loginbox = document.getElementById('loginbox'); + loginbox.style.display = 'none'; + paybox.style.display = 'flex'; } else if (a) { - window.location.href = "./homepage.html"; + window.location.href = './homepage.html'; } console.log(canshu); } var canshu = {}; /*支付订单*/ function getzhifu() { - let a = document.getElementById("dingdanhao"); - a.innerHTML = canshu["out_trade_no"]; - let b = document.getElementById("dingdanjine"); - b.innerHTML = "¥" + canshu["money"]; + let a = document.getElementById('dingdanhao'); + a.innerHTML = canshu['out_trade_no']; + let b = document.getElementById('dingdanjine'); + b.innerHTML = '¥' + canshu['money']; } /*提示信息弹窗*/ function tan(mode, text) { - if (mode == "right") { - let a = document.getElementById("tanright"); - a.setAttribute("style", "!display:block"); + if (mode == 'right') { + let a = document.getElementById('tanright'); + a.setAttribute('style', '!display:block'); let b = document.createTextNode(text); a.appendChild(b); setTimeout(canceltan, 1500, mode); } else { - let c = document.getElementById("tancuowu"); - c.setAttribute("style", "!display:block"); + let c = document.getElementById('tancuowu'); + c.setAttribute('style', '!display:block'); let d = document.createTextNode(text); c.appendChild(d); setTimeout(canceltan, 1500, mode); @@ -52,59 +52,58 @@ function tan(mode, text) { } /*关闭信息弹窗*/ function canceltan(mode) { - if (mode == "right") { - let a = document.getElementById("tanright"); - a.style.display = "none"; - a.innerHTML = ""; + if (mode == 'right') { + let a = document.getElementById('tanright'); + a.style.display = 'none'; + a.innerHTML = ''; } else { - let c = document.getElementById("tancuowu"); - c.style.display = "none"; - c.innerHTML = ""; + let c = document.getElementById('tancuowu'); + c.style.display = 'none'; + c.innerHTML = ''; } } /*加载信息弹窗*/ function tanjiazai() { - let a = document.getElementById("tanjiazai"); - a.setAttribute("style", "!display:block"); + let a = document.getElementById('tanjiazai'); + a.setAttribute('style', '!display:block'); } /*关闭加载信息弹窗*/ function canceltanjiazai() { - let a = document.getElementById("tanjiazai"); - a.style.display = "none"; + let a = document.getElementById('tanjiazai'); + a.style.display = 'none'; } /*切换页面*/ function gobox(mode) { - let a = document.getElementById("loginbox"); - let b = document.getElementById("regbox"); - let c = document.getElementById("forgotbox"); - if (mode == "regbox") { - a.style.display = "none"; - b.style.display = "flex"; - c.style.display = "none"; - } else if (mode == "forgot") { - a.style.display = "none"; - b.style.display = "none"; - c.style.display = "flex"; + let a = document.getElementById('loginbox'); + let b = document.getElementById('regbox'); + let c = document.getElementById('forgotbox'); + if (mode == 'regbox') { + a.style.display = 'none'; + b.style.display = 'flex'; + c.style.display = 'none'; + } else if (mode == 'forgot') { + a.style.display = 'none'; + b.style.display = 'none'; + c.style.display = 'flex'; } else { - a.style.display = "flex"; - b.style.display = "none"; - c.style.display = "none"; + a.style.display = 'flex'; + b.style.display = 'none'; + c.style.display = 'none'; } } /*域名*/ -var domain = ""; +var domain = ''; /*请求登录接口*/ function regrequest() { - let mode = "POST"; - let link = domain + "https://ovc.xiaon.life/api/v1/passport/auth/login"; - a = document.getElementById("regusername"); - b = document.getElementById("regpassword"); - if (a.value == "" || b.value == "") { - tan("cuowu", "请完整输入邮箱与密码后,再点击登录"); - + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/passport/auth/login'; + a = document.getElementById('regusername'); + b = document.getElementById('regpassword'); + if (a.value == '' || b.value == '') { + tan('cuowu', '请完整输入邮箱与密码后,再点击登录'); } else { let params = { email: a.value, @@ -119,17 +118,17 @@ function regrequest() { /*登录接口操作*/ function regresonse(code, data) { var xx = JSON.parse(data).errors; - if (code == "200") { - tan("right", "登录成功"); + if (code == '200') { + tan('right', '登录成功'); canceltanjiazai(); console.log(JSON.parse(data).data.auth_data); - localStorage.setItem("authorization", JSON.parse(data).data.auth_data); - window.location.href = "./homepage.html"; - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + localStorage.setItem('authorization', JSON.parse(data).data.auth_data); + window.location.href = './homepage.html'; + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); console.log(JSON.parse(data).message); canceltanjiazai(); - } else if (code == "422") { + } else if (code == '422') { var errorname = new Array(); for (item in xx) { errorname.push(item); @@ -137,21 +136,21 @@ function regresonse(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } /*请求构建注册页接口*/ function buildrequest() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/guest/comm/config"; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/guest/comm/config'; console.log(link); - params1 = ""; + params1 = ''; jsonlink(mode, link, params1, buildregpage); tanjiazai(); } @@ -162,72 +161,71 @@ var is_recaptcha; //是否验证recaptcha var is_email_verify; //是否验证邮箱 var is_invite_force; //是否强制邀请 function buildregpage(code, data) { - if (code == "200") { + if (code == '200') { is_email_verify = JSON.parse(data).data.is_email_verify; is_invite_force = JSON.parse(data).data.is_invite_force; email_whitelist_suffix = JSON.parse(data).data.email_whitelist_suffix; is_recaptcha = JSON.parse(data).data.is_recaptcha; - a = document.getElementById("emailcode"); - b = document.getElementById("inviteforce"); - c = document.getElementById("emaillistbox"); - d = document.getElementById("emailinput"); - if (is_email_verify == "1") { - a.style.display = "flex"; + a = document.getElementById('emailcode'); + b = document.getElementById('inviteforce'); + c = document.getElementById('emaillistbox'); + d = document.getElementById('emailinput'); + if (is_email_verify == '1') { + a.style.display = 'flex'; } else { - a.style.display = "none"; + a.style.display = 'none'; } - if (is_invite_force == "1") { - b.setAttribute("placeholder", "请输入邀请码(必填)"); + if (is_invite_force == '1') { + b.setAttribute('placeholder', '请输入邀请码(必填)'); } else { - b.setAttribute("placeholder", "请输入邀请码(选填)"); + b.setAttribute('placeholder', '请输入邀请码(选填)'); } - if (email_whitelist_suffix != "0") { - c.style.display = "block"; - d.setAttribute("class", "inputbox-reg"); - c.innerHTML = ""; + if (email_whitelist_suffix != '0') { + c.style.display = 'block'; + d.setAttribute('class', 'inputbox-reg'); + c.innerHTML = ''; for (x in email_whitelist_suffix) { console.log(email_whitelist_suffix[x]); - c_child = document.createElement("option"); - c_child.innerHTML = "@" + email_whitelist_suffix[x]; + c_child = document.createElement('option'); + c_child.innerHTML = '@' + email_whitelist_suffix[x]; c.appendChild(c_child); - is_email_whitelist_force = "1"; //代表强制白名单 + is_email_whitelist_force = '1'; //代表强制白名单 } - } else if (email_whitelist_suffix == "0") { - c.style.display = "none"; - d.setAttribute("class", "inputbox-reg-no"); - is_email_whitelist_force = "0"; //代表不强制 + } else if (email_whitelist_suffix == '0') { + c.style.display = 'none'; + d.setAttribute('class', 'inputbox-reg-no'); + is_email_whitelist_force = '0'; //代表不强制 } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } /*请求获取验证码*/ function emailrequest() { - let mode = "POST"; - let link = - domain + "https://ovc.xiaon.life/api/v1/passport/comm/sendEmailVerify"; - let a = document.getElementById("emailinput"); - let b = document.getElementById("tanrecaptcha_email"); + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/passport/comm/sendEmailVerify'; + let a = document.getElementById('emailinput'); + let b = document.getElementById('tanrecaptcha_email'); - if (a.value == "") { - tan("cuowu", "请输入邮箱后再获取验证码"); - } else if (is_already_onload_recaptcha == null && is_recaptcha == "1") { - tan("cuowu", "请等待页面加载完毕 或 刷新页面后重试"); - } else if (is_recaptcha == "1" && recaptcha_token_email == null) { - b.style.display = "flex"; + if (a.value == '') { + tan('cuowu', '请输入邮箱后再获取验证码'); + } else if (is_already_onload_recaptcha == null && is_recaptcha == '1') { + tan('cuowu', '请等待页面加载完毕 或 刷新页面后重试'); + } else if (is_recaptcha == '1' && recaptcha_token_email == null) { + b.style.display = 'flex'; } else { let params = new Object(); params = { email: a.value }; - if (is_email_whitelist_force == "1") { - let c = document.getElementById("emaillistbox"); + if (is_email_whitelist_force == '1') { + let c = document.getElementById('emaillistbox'); let index = c.selectedIndex; let d = c.options[index].text; params.email = a.value + d; } - if (is_recaptcha == "1") { + if (is_recaptcha == '1') { params.recaptcha_data = recaptcha_token_email; } console.log(params); @@ -239,18 +237,18 @@ function emailrequest() { /*验证码响应操作*/ function emailresponse(code, data) { let xx = JSON.parse(data).errors; - if (code == "200") { - tan("right", "请前往邮箱查看验证码"); + if (code == '200') { + tan('right', '请前往邮箱查看验证码'); canceltanjiazai(); yanzhengtime(); grecaptcha.reset(widgetId1); recaptcha_token_email = null; - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); canceltanjiazai(); grecaptcha.reset(widgetId1); recaptcha_token_email = null; - } else if (code == "422") { + } else if (code == '422') { var errorname = new Array(); for (item in xx) { errorname.push(item); @@ -258,13 +256,13 @@ function emailresponse(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); grecaptcha.reset(widgetId1); recaptcha_token_email = null; } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); grecaptcha.reset(widgetId1); recaptcha_token_email = null; @@ -276,8 +274,8 @@ function jsonlink(mode, link, params, callback) { var xmlHttp = new XMLHttpRequest(); //let requesetjson; xmlHttp.open(mode, link, true); - if (mode == "POST") { - xmlHttp.setRequestHeader("content-type", "application/json"); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); xmlHttp.send(JSON.stringify(params)); } else { xmlHttp.send(); @@ -292,14 +290,9 @@ function jsonlink(mode, link, params, callback) { } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 callback(xmlHttp.status, json); - } else if ( - xmlHttp.readyState != 4 && - xmlHttp.status != 500 && - xmlHttp.status != 200 && - xmlHttp.status != 422 - ) { + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 - callback(xmlHttp.status, "001"); + callback(xmlHttp.status, '001'); } }; } @@ -310,25 +303,25 @@ var jishi = null; var hintContainer = null; var hintElement = null; function yanzhengtime() { - let a = document.getElementById("emailbutton"); + let a = document.getElementById('emailbutton'); if (emailtime > 0) { - a.innerHTML = emailtime + "S"; + a.innerHTML = emailtime + 'S'; if (emailtime === 55) { - hintContainer = document.createElement("div"); - hintContainer.id = "hintContainer"; - hintElement = document.createElement("p"); - hintElement.textContent = "没收到验证码?去邮件垃圾箱看看"; - hintElement.id = "hintText"; + hintContainer = document.createElement('div'); + hintContainer.id = 'hintContainer'; + hintElement = document.createElement('p'); + hintElement.textContent = '没收到验证码?去邮件垃圾箱看看'; + hintElement.id = 'hintText'; hintContainer.appendChild(hintElement); a.parentNode.insertBefore(hintContainer, a); // 在邮箱按钮之前插入 hintContainer } emailtime = emailtime - 1; - a.setAttribute("onclick", ""); + a.setAttribute('onclick', ''); jishi = setTimeout(yanzhengtime, 1000); } else { - a.innerHTML = "获取验证码"; + a.innerHTML = '获取验证码'; emailtime = 60; - a.setAttribute("onclick", "emailrequest()"); + a.setAttribute('onclick', 'emailrequest()'); clearTimeout(jishi); if (hintContainer && hintContainer.parentNode) { hintContainer.parentNode.removeChild(hintContainer); // 删除 hintContainer @@ -338,42 +331,42 @@ function yanzhengtime() { /*请求注册接口*/ function zhucerequest() { - let mode = "POST"; - let link = domain + "https://ovc.xiaon.life/api/v1/passport/auth/register"; - let a = document.getElementById("emailinput"); - let b = document.getElementById("emailverify"); - let c = document.getElementById("regpd"); - let d = document.getElementById("reregpd"); - let e = document.getElementById("inviteforce"); - let f = document.getElementById("tanrecaptcha_reg"); + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/passport/auth/register'; + let a = document.getElementById('emailinput'); + let b = document.getElementById('emailverify'); + let c = document.getElementById('regpd'); + let d = document.getElementById('reregpd'); + let e = document.getElementById('inviteforce'); + let f = document.getElementById('tanrecaptcha_reg'); - if (a.value == "" || c.value == "" || d.value == "") { - tan("cuowu", "请完整输入全部信息,再点击注册"); - } else if (is_email_verify == "1" && b == "") { - tan("cuowu", "请输入验证码再注册"); - } else if (is_invite_force == "1" && e == "") { - tan("cuowu", "请输入邀请码再注册"); + if (a.value == '' || c.value == '' || d.value == '') { + tan('cuowu', '请完整输入全部信息,再点击注册'); + } else if (is_email_verify == '1' && b == '') { + tan('cuowu', '请输入验证码再注册'); + } else if (is_invite_force == '1' && e == '') { + tan('cuowu', '请输入邀请码再注册'); } else if (c.value != d.value) { - tan("cuowu", "两次输入的密码不一致"); - } else if (is_recaptcha == "1" && recaptcha_token_reg == null) { - f.style.display = "flex"; + tan('cuowu', '两次输入的密码不一致'); + } else if (is_recaptcha == '1' && recaptcha_token_reg == null) { + f.style.display = 'flex'; } else { let params = new Object(); params = { email: a.value, password: c.value, }; - if (is_email_verify == "1") { + if (is_email_verify == '1') { params.email_code = b.value; } - if (is_invite_force == "1") { + if (is_invite_force == '1') { params.invite_code = e.value; } - if (is_recaptcha == "1") { + if (is_recaptcha == '1') { params.recaptcha_data = recaptcha_token_reg; } - if (is_email_whitelist_force == "1") { - let aa = document.getElementById("emaillistbox"); + if (is_email_whitelist_force == '1') { + let aa = document.getElementById('emaillistbox'); let index = aa.selectedIndex; let dd = aa.options[index].text; params.email = a.value + dd; @@ -387,20 +380,20 @@ function zhucerequest() { /*注册接口响应*/ function zhucerespons(code, data) { let xx = JSON.parse(data).errors; - if (code == "200") { - tan("right", "注册成功"); + if (code == '200') { + tan('right', '注册成功'); canceltanjiazai(); grecaptcha.reset(widgetId2); recaptcha_token_reg = null; console.log(JSON.parse(data).data.auth_data); - localStorage.setItem("authorization", JSON.parse(data).data.auth_data); - window.location.href = "./homepage.html"; - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + localStorage.setItem('authorization', JSON.parse(data).data.auth_data); + window.location.href = './homepage.html'; + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); canceltanjiazai(); grecaptcha.reset(widgetId2); recaptcha_token_reg = null; - } else if (code == "422") { + } else if (code == '422') { var errorname = new Array(); for (item in xx) { errorname.push(item); @@ -408,13 +401,13 @@ function zhucerespons(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); grecaptcha.reset(widgetId2); recaptcha_token_reg = null; } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); grecaptcha.reset(widgetId2); recaptcha_token_reg = null; @@ -427,19 +420,19 @@ var widgetId2; var widgetId3; var is_already_onload_recaptcha = null; var onloadCallback = function () { - widgetId1 = grecaptcha.render("recap1", { - sitekey: "6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw", + widgetId1 = grecaptcha.render('recap1', { + sitekey: '6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw', callback: verifyCallback_email, }); - widgetId2 = grecaptcha.render("recap2", { - sitekey: "6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw", + widgetId2 = grecaptcha.render('recap2', { + sitekey: '6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw', callback: verifyCallback_reg, }); - widgetId3 = grecaptcha.render("recap3", { - sitekey: "6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw", + widgetId3 = grecaptcha.render('recap3', { + sitekey: '6LfaHFojAAAAAEE8dC-H2mfn-W4MAr2mVFvlQ0Cw', callback: verifyCallback_forgot, }); - console.log("加载完毕被回调了"); + console.log('加载完毕被回调了'); is_already_onload_recaptcha = 1; }; @@ -447,63 +440,62 @@ var onloadCallback = function () { var recaptcha_token_email = null; var verifyCallback_email = function (response) { recaptcha_token_email = response; - console.log("已经赋值给token了"); + console.log('已经赋值给token了'); emailrequest(); - var a = document.getElementById("tanrecaptcha_email"); - a.style.display = "none"; + var a = document.getElementById('tanrecaptcha_email'); + a.style.display = 'none'; }; /* 创建 recaptcha 注册*/ var recaptcha_token_reg = null; var verifyCallback_reg = function (response) { recaptcha_token_reg = response; - console.log("已经赋值给token了"); + console.log('已经赋值给token了'); zhucerequest(); - var a = document.getElementById("tanrecaptcha_reg"); - a.style.display = "none"; + var a = document.getElementById('tanrecaptcha_reg'); + a.style.display = 'none'; }; /* 创建 recaptcha 忘记密码*/ var recaptcha_token_forgot = null; var verifyCallback_forgot = function (response) { recaptcha_token_forgot = response; - console.log("已经赋值给token了"); + console.log('已经赋值给token了'); emailrequest_forgot(); - var a = document.getElementById("tanrecaptcha_email_forgot"); - a.style.display = "none"; + var a = document.getElementById('tanrecaptcha_email_forgot'); + a.style.display = 'none'; }; function closeemail() { - let a = document.getElementById("tanrecaptcha_email"); - a.style.display = "none"; + let a = document.getElementById('tanrecaptcha_email'); + a.style.display = 'none'; } function closereg() { - let a = document.getElementById("tanrecaptcha_reg"); - a.style.display = "none"; + let a = document.getElementById('tanrecaptcha_reg'); + a.style.display = 'none'; } function closeforgot() { - let a = document.getElementById("tanrecaptcha_email_forgot"); - a.style.display = "none"; + let a = document.getElementById('tanrecaptcha_email_forgot'); + a.style.display = 'none'; } /*请求获取验证码-忘记密码*/ function emailrequest_forgot() { - let mode = "POST"; - let link = - domain + "https://ovc.xiaon.life/api/v1/passport/comm/sendEmailVerify"; - let a = document.getElementById("forgotemail"); - let b = document.getElementById("tanrecaptcha_email_forgot"); + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/passport/comm/sendEmailVerify'; + let a = document.getElementById('forgotemail'); + let b = document.getElementById('tanrecaptcha_email_forgot'); - if (a.value == "") { - tan("cuowu", "请输入邮箱后再获取验证码"); - } else if (is_already_onload_recaptcha == null && is_recaptcha == "1") { - tan("cuowu", "请等待页面加载完毕 或 刷新页面后重试"); - } else if (is_recaptcha == "1" && recaptcha_token_forgot == null) { - b.style.display = "flex"; + if (a.value == '') { + tan('cuowu', '请输入邮箱后再获取验证码'); + } else if (is_already_onload_recaptcha == null && is_recaptcha == '1') { + tan('cuowu', '请等待页面加载完毕 或 刷新页面后重试'); + } else if (is_recaptcha == '1' && recaptcha_token_forgot == null) { + b.style.display = 'flex'; } else { let params = new Object(); params = { email: a.value }; - if (is_recaptcha == "1") { + if (is_recaptcha == '1') { params.recaptcha_data = recaptcha_token_forgot; } console.log(params); @@ -515,18 +507,18 @@ function emailrequest_forgot() { /*响应获取验证码-忘记密码*/ function emailresponse_forgot(code, data) { let xx = JSON.parse(data).errors; - if (code == "200") { - tan("right", "请前往邮箱查看验证码"); + if (code == '200') { + tan('right', '请前往邮箱查看验证码'); canceltanjiazai(); yanzhengtime_forgot(); grecaptcha.reset(widgetId3); recaptcha_token_forgot = null; - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); canceltanjiazai(); grecaptcha.reset(widgetId3); recaptcha_token_forgot = null; - } else if (code == "422") { + } else if (code == '422') { var errorname = new Array(); for (item in xx) { errorname.push(item); @@ -534,13 +526,13 @@ function emailresponse_forgot(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); grecaptcha.reset(widgetId3); recaptcha_token_forgot = null; } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); grecaptcha.reset(widgetId3); recaptcha_token_forgot = null; @@ -549,46 +541,46 @@ function emailresponse_forgot(code, data) { /*验证码到计时忘记密码界面*/ function yanzhengtime_forgot() { - let a = document.getElementById("forgotemailbutton"); - let hintContainer = document.getElementById("hintContainer"); + let a = document.getElementById('forgotemailbutton'); + let hintContainer = document.getElementById('hintContainer'); if (emailtime > 0) { - a.innerHTML = emailtime + "S"; + a.innerHTML = emailtime + 'S'; emailtime = emailtime - 1; - a.setAttribute("onclick", ""); + a.setAttribute('onclick', ''); if (emailtime === 55) { - hintContainer = document.createElement("div"); - hintContainer.id = "hintContainer"; - let hintText = document.createElement("p"); - hintText.innerHTML = "没收到验证码?去邮件垃圾箱看看"; + hintContainer = document.createElement('div'); + hintContainer.id = 'hintContainer'; + let hintText = document.createElement('p'); + hintText.innerHTML = '没收到验证码?去邮件垃圾箱看看'; hintContainer.appendChild(hintText); a.parentNode.insertBefore(hintContainer, a.nextSibling); } jishi = setTimeout(yanzhengtime_forgot, 1000); } else { - a.innerHTML = "获取验证码"; + a.innerHTML = '获取验证码'; emailtime = 60; - a.setAttribute("onclick", "emailrequest_forgot()"); + a.setAttribute('onclick', 'emailrequest_forgot()'); if (hintContainer) { hintContainer.parentNode.removeChild(hintContainer); } clearTimeout(jishi); - console.log("执行到了这里验证吗"); + console.log('执行到了这里验证吗'); } } /*请求重置密码的接口*/ function forgotrequest() { - let mode = "POST"; - let link = domain + "https://ovc.xiaon.life/api/v1/passport/auth/forget"; - let a = document.getElementById("forgotemail"); - let b = document.getElementById("forgotemailcode"); - let c = document.getElementById("forgotemailpd"); - let d = document.getElementById("forgotemailrepd"); + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/passport/auth/forget'; + let a = document.getElementById('forgotemail'); + let b = document.getElementById('forgotemailcode'); + let c = document.getElementById('forgotemailpd'); + let d = document.getElementById('forgotemailrepd'); - if (a.value == "" || c.value == "" || d.value == "" || b.value == "") { - tan("cuowu", "请完整输入全部信息,再点击重置"); + if (a.value == '' || c.value == '' || d.value == '' || b.value == '') { + tan('cuowu', '请完整输入全部信息,再点击重置'); } else if (c.value != d.value) { - tan("cuowu", "两次输入的密码不一致"); + tan('cuowu', '两次输入的密码不一致'); } else { let params = new Object(); params = { @@ -605,13 +597,13 @@ function forgotrequest() { /*响应重置密码的接口*/ function forgotrespons(code, data) { let xx = JSON.parse(data).errors; - if (code == "200") { - tan("right", "重置密码成功,请返回登录"); + if (code == '200') { + tan('right', '重置密码成功,请返回登录'); canceltanjiazai(); - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); canceltanjiazai(); - } else if (code == "422") { + } else if (code == '422') { var errorname = new Array(); for (item in xx) { errorname.push(item); @@ -619,11 +611,11 @@ function forgotrespons(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } diff --git a/xiaon_c5z3Cp/static/node.js b/xiaon_c5z3Cp/static/node.js index 3f6c0d0..a85571c 100644 --- a/xiaon_c5z3Cp/static/node.js +++ b/xiaon_c5z3Cp/static/node.js @@ -1,132 +1,130 @@ /*启动检测与页面初始化localStorage*/ function bootcheck() { - let a = localStorage.getItem('authorization'); - if (a) { - getinfo(); - getserver(); - } - else { - exitlogout(); - } + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getserver(); + } else { + exitlogout(); + } } function toggleView() { - const nodeDown = document.getElementById('node_down'); - const wrapper = document.getElementById('wrapper'); + const nodeDown = document.getElementById('node_down'); + const wrapper = document.getElementById('wrapper'); - if (nodeDown.style.display !== 'none') { - nodeDown.style.display = 'none'; - wrapper.style.display = 'block'; - } else { - nodeDown.style.display = 'block'; - wrapper.style.display = 'none'; - } + if (nodeDown.style.display !== 'none') { + nodeDown.style.display = 'none'; + wrapper.style.display = 'block'; + } else { + nodeDown.style.display = 'block'; + wrapper.style.display = 'none'; + } } -const domain = ""; +const domain = ''; // 封装通用的网络请求函数 async function jsonlink(mode, link, params, callback) { - try { - const auth = localStorage.getItem('authorization'); - const response = await fetch(`${domain}${link}`, { - method: mode, - headers: { - 'Content-Type': 'application/json', - 'Authorization': auth - }, - body: mode === 'POST' ? JSON.stringify(params) : undefined - }); - - const data = await response.json(); - callback(response.status, data); - } catch (error) { - console.error(error); - callback(500, 'Error occurred during the request'); - } + try { + const auth = localStorage.getItem('authorization'); + const response = await fetch(`${domain}${link}`, { + method: mode, + headers: { + 'Content-Type': 'application/json', + Authorization: auth, + }, + body: mode === 'POST' ? JSON.stringify(params) : undefined, + }); + + const data = await response.json(); + callback(response.status, data); + } catch (error) { + console.error(error); + callback(500, 'Error occurred during the request'); + } } // 请求个人信息接口 async function getinfo() { - const mode = 'GET'; - const link = 'https://ovc.xiaon.life/api/v1/user/info'; - tanjiazai(); - jsonlink(mode, link, null, responseinfo); + const mode = 'GET'; + const link = 'https://ovc.xiaon.life/api/v1/user/info'; + tanjiazai(); + jsonlink(mode, link, null, responseinfo); } // 处理个人信息响应 function responseinfo(code, data) { - const logoutWords = document.getElementById('logout_words'); - if (code === 200) { - logoutWords.innerHTML = data.data.email; - } else { - tan('cuowu', '当前网络不稳定,请刷新页面重试'); - } - canceltanjiazai(); + const logoutWords = document.getElementById('logout_words'); + if (code === 200) { + logoutWords.innerHTML = data.data.email; + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + } + canceltanjiazai(); } // 请求节点信息接口 async function getserver() { - const mode = 'GET'; - const link = 'https://ovc.xiaon.life/api/v1/user/server/fetch'; - tanjiazai(); - jsonlink(mode, link, null, responseserver); + const mode = 'GET'; + const link = 'https://ovc.xiaon.life/api/v1/user/server/fetch'; + tanjiazai(); + jsonlink(mode, link, null, responseserver); } // 处理节点信息响应 function responseserver(code, data) { - const nodeDown = document.getElementById('node_down'); - nodeDown.innerHTML = ''; - - if (code === 200) { - const servers = data.data; - - if (!servers || servers.length === 0) { - const queshengbox = document.createElement('div'); - const queshengtu = document.createElement('img'); - queshengbox.classList.add('queshengtu-box'); - queshengtu.src = './img/queshengtu.png'; - queshengtu.classList.add('queshengtu'); - queshengbox.appendChild(queshengtu); - nodeDown.appendChild(queshengbox); - } else { - const fragment = document.createDocumentFragment(); - - servers.forEach(server => { - const b = document.createElement('div'); - b.classList.add('node_box'); - const c = document.createElement('p'); - c.classList.add('node_box_title'); - const d = document.createElement('img'); - d.classList.add('node_box_status'); - const e = document.createElement('p'); - e.classList.add('node_box_rate'); - const f = document.createElement('p'); - f.classList.add('node_box_tag'); - c.innerHTML = server.name; - e.innerHTML = `${server.rate}X`; - f.innerHTML = server.tags; - - const ts = Math.round(new Date().getTime() / 1000); - if (ts - server.last_check_at < 300) { - d.src = `./img/zhengchang.svg`; + const nodeDown = document.getElementById('node_down'); + nodeDown.innerHTML = ''; + + if (code === 200) { + const servers = data.data; + + if (!servers || servers.length === 0) { + const queshengbox = document.createElement('div'); + const queshengtu = document.createElement('img'); + queshengbox.classList.add('queshengtu-box'); + queshengtu.src = './img/queshengtu.png'; + queshengtu.classList.add('queshengtu'); + queshengbox.appendChild(queshengtu); + nodeDown.appendChild(queshengbox); } else { - d.src = './img/cuowu.svg'; + const fragment = document.createDocumentFragment(); + + servers.forEach((server) => { + const b = document.createElement('div'); + b.classList.add('node_box'); + const c = document.createElement('p'); + c.classList.add('node_box_title'); + const d = document.createElement('img'); + d.classList.add('node_box_status'); + const e = document.createElement('p'); + e.classList.add('node_box_rate'); + const f = document.createElement('p'); + f.classList.add('node_box_tag'); + c.innerHTML = server.name; + e.innerHTML = `${server.rate}X`; + f.innerHTML = server.tags; + + const ts = Math.round(new Date().getTime() / 1000); + if (ts - server.last_check_at < 300) { + d.src = `./img/zhengchang.svg`; + } else { + d.src = './img/cuowu.svg'; + } + + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + fragment.appendChild(b); + }); + + nodeDown.appendChild(fragment); } - - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - fragment.appendChild(b); - }); - - nodeDown.appendChild(fragment); + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } else { - tan('cuowu', '当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } - diff --git a/xiaon_c5z3Cp/static/order.js b/xiaon_c5z3Cp/static/order.js index 7950d3b..836d2f1 100644 --- a/xiaon_c5z3Cp/static/order.js +++ b/xiaon_c5z3Cp/static/order.js @@ -1,243 +1,224 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getorder(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getorder(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - console.log(params); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + console.log(params); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求订单接口*/ -function getorder(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/fetch'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseorder); +function getorder() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/fetch'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseorder); } var zhouqi = { - 'month_price':'月付', - 'quarter_price':'季付', - 'half_year_price':'半年付', - 'year_price':'年付', - 'two_year_price':'两年付', - 'three_year_price':'三年付', - 'onetime_price':'一次性', - 'reset_price':'重置' + month_price: '月付', + quarter_price: '季付', + half_year_price: '半年付', + year_price: '年付', + two_year_price: '两年付', + three_year_price: '三年付', + onetime_price: '一次性', + reset_price: '重置', }; var zhuangtai = { - '1':'开通中', - '2':'已取消', - '3':'已支付', - '4':'已折抵', - '0':'未支付' + 1: '开通中', + 2: '已取消', + 3: '已支付', + 4: '已折抵', + 0: '未支付', }; /*响应订单接口*/ -function responseorder(code,data){ - if (code == '200') { - let aaa = document.getElementById('order_down'); - aaa.innerHTML = ''; - let a = JSON.parse(data).data; - var j = document.getElementById('order_down'); - j.innerHTML = ''; - if (a == ''){ - console.log(a); - let queshengbox = document.createElement('div'); - let queshengtu = document.createElement('img'); - queshengbox.setAttribute('class','queshengtu-box'); - queshengtu.setAttribute('src','./img/queshengtu.png'); - queshengtu.setAttribute('class','queshengtu'); - let fatherdiv = document.getElementById('order_down'); - queshengbox.appendChild(queshengtu); - fatherdiv.appendChild(queshengbox); - } - - for (x in a ){ - let b = document.createElement('div'); - b.setAttribute('class','order_box'); - let c = document.createElement('a'); - c.setAttribute('class','order_box_trade'); - let d = document.createElement('p'); - d.setAttribute('class','order_box_name'); - let e = document.createElement('p'); - e.setAttribute('class','order_box_zhouqi'); - let f = document.createElement('p'); - f.setAttribute('class','order_box_name'); - let g = document.createElement('p'); - g.setAttribute('class','order_box_zhuangtai'); - let h = document.createElement('p'); - h.setAttribute('class','order_box_name'); - let i = document.createElement('button'); - i.setAttribute('class','order_box_cancel'); - c.innerHTML = a[x].trade_no; - c.setAttribute('href','./order_detail.html?orderid='+a[x].trade_no); - d.innerHTML = a[x].plan.name; - d.style.width = '100px'; - e.innerHTML = zhouqi[a[x].period]; - f.innerHTML = '¥'+a[x].total_amount/100; - f.style.width = '40px'; - g.innerHTML = zhuangtai[a[x].status]; - h.innerHTML = getshijian(a[x].created_at); - i.innerHTML = '取消'; - if(a[x].status == '0'){ - i.setAttribute('onclick','cancelorder(this.value)'); - i.setAttribute('value',a[x].trade_no); - } - else - { - i.style.color = '#D8D8D8'; - } - if (a[x].status == '0'){ - g.style.color = '#E02020'; - } - else if (a[x].status == '2'){ - g.style.color = '#D8D8D8'; - } - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - b.appendChild(h); - b.appendChild(i); - - j.appendChild(b); +function responseorder(code, data) { + if (code == '200') { + let aaa = document.getElementById('order_down'); + aaa.innerHTML = ''; + let a = JSON.parse(data).data; + var j = document.getElementById('order_down'); + j.innerHTML = ''; + if (a == '') { + console.log(a); + let queshengbox = document.createElement('div'); + let queshengtu = document.createElement('img'); + queshengbox.setAttribute('class', 'queshengtu-box'); + queshengtu.setAttribute('src', './img/queshengtu.png'); + queshengtu.setAttribute('class', 'queshengtu'); + let fatherdiv = document.getElementById('order_down'); + queshengbox.appendChild(queshengtu); + fatherdiv.appendChild(queshengbox); + } + + for (x in a) { + let b = document.createElement('div'); + b.setAttribute('class', 'order_box'); + let c = document.createElement('a'); + c.setAttribute('class', 'order_box_trade'); + let d = document.createElement('p'); + d.setAttribute('class', 'order_box_name'); + let e = document.createElement('p'); + e.setAttribute('class', 'order_box_zhouqi'); + let f = document.createElement('p'); + f.setAttribute('class', 'order_box_name'); + let g = document.createElement('p'); + g.setAttribute('class', 'order_box_zhuangtai'); + let h = document.createElement('p'); + h.setAttribute('class', 'order_box_name'); + let i = document.createElement('button'); + i.setAttribute('class', 'order_box_cancel'); + c.innerHTML = a[x].trade_no; + c.setAttribute('href', './order_detail.html?orderid=' + a[x].trade_no); + d.innerHTML = a[x].plan.name; + d.style.width = '100px'; + e.innerHTML = zhouqi[a[x].period]; + f.innerHTML = '¥' + a[x].total_amount / 100; + f.style.width = '40px'; + g.innerHTML = zhuangtai[a[x].status]; + h.innerHTML = getshijian(a[x].created_at); + i.innerHTML = '取消'; + if (a[x].status == '0') { + i.setAttribute('onclick', 'cancelorder(this.value)'); + i.setAttribute('value', a[x].trade_no); + } else { + i.style.color = '#D8D8D8'; + } + if (a[x].status == '0') { + g.style.color = '#E02020'; + } else if (a[x].status == '2') { + g.style.color = '#D8D8D8'; + } + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + b.appendChild(h); + b.appendChild(i); + + j.appendChild(b); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } - - - //时间戳转日期 function getshijian(time) { - let date = new Date(parseInt(time) * 1000); - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - return y + '/' + MM + '/' + d+' '+h+':'+m+':'+d; + let date = new Date(parseInt(time) * 1000); + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; + let d = date.getDate(); + d = d < 10 ? '0' + d : d; + let h = date.getHours(); + h = h < 10 ? '0' + h : h; + let m = date.getMinutes(); + m = m < 10 ? '0' + m : m; + let s = date.getSeconds(); + s = s < 10 ? '0' + s : s; + return y + '/' + MM + '/' + d + ' ' + h + ':' + m + ':' + d; } - - /*取消订单接口*/ -function cancelorder(ordernumber){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/cancel'; - console.log(ordernumber); - let params = { - trade_no : ordernumber - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responsecancelorder); +function cancelorder(ordernumber) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/cancel'; + console.log(ordernumber); + let params = { + trade_no: ordernumber, + }; + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responsecancelorder); } /*响应取消订单接口*/ -function responsecancelorder(code,data){ - if (code == '200') { - tan('right','取消成功'); - getorder(); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); +function responsecancelorder(code, data) { + if (code == '200') { + tan('right', '取消成功'); + getorder(); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } - diff --git a/xiaon_c5z3Cp/static/order_detail.js b/xiaon_c5z3Cp/static/order_detail.js index 6be6f27..59aeb17 100644 --- a/xiaon_c5z3Cp/static/order_detail.js +++ b/xiaon_c5z3Cp/static/order_detail.js @@ -1,546 +1,506 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - chushihua(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + chushihua(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - //xmlHttp.setRequestHeader('content-type','application/x-www-form-urlencoded'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + //xmlHttp.setRequestHeader('content-type','application/x-www-form-urlencoded'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*网络请求*/ -function jsonlinkform(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - //xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('content-type','application/x-www-form-urlencoded'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlinkform(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + //xmlHttp.setRequestHeader('content-type','application/json'); + xmlHttp.setRequestHeader('content-type', 'application/x-www-form-urlencoded'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求订单详情接口*/ -function getdingdandetail(planid){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/detail?trade_no='+planid; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsegetdingdandetail); +function getdingdandetail(planid) { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/detail?trade_no=' + planid; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsegetdingdandetail); } /*响应订单详情信息*/ -function responsegetdingdandetail(code,data){ - if (code == '200') { - let a = document.getElementById('jihuamingcheng'); - a.innerHTML = JSON.parse(data).data.plan.name; - let b = document.getElementById('jihuazhouqileixing'); - b.innerHTML = zhouqi[JSON.parse(data).data.period]; - let c = document.getElementById('jihualiuliang'); - c.innerHTML = JSON.parse(data).data.plan.transfer_enable + 'GB'; - let d = document.getElementById('jiahuadingdanhao'); - d.innerHTML = JSON.parse(data).data.trade_no; - let e = document.getElementById('jiahuachuangjianshijian'); - e.innerHTML = getshijian(JSON.parse(data).data.created_at); - let f = document.getElementById('tijiaozongjine'); - f.innerHTML = '¥'+(JSON.parse(data).data.total_amount/100).toFixed(2); - let aa = document.getElementById('jiagewushouxufei'); - aa.innerHTML = '¥'+(JSON.parse(data).data.total_amount/100).toFixed(2); - - var price_group = { - handling_amount : JSON.parse(data).data.handling_amount, - discount_amount : JSON.parse(data).data.discount_amount, - surplus_amount : JSON.parse(data).data.surplus_amount, - balance_amount : JSON.parse(data).data.balance_amount, - refund_amount : JSON.parse(data).data.refund_amount - } - - for (x in price_group) { - if (price_group[x] != null){ - let g = document.createElement('div'); - g.setAttribute('class','jiahuaneirong_group'); - let h = document.createElement('p'); - h.setAttribute('class','jiahuaneirong_des'); - h.innerHTML = jinemingcheng[x]; - let i = document.createElement('p'); - i.setAttribute('class','jiahuaneirong_des'); - i.innerHTML = '¥'+(price_group[x]/100).toFixed(2); - i.setAttribute('id',x); - g.appendChild(h); - g.appendChild(i); - console.log(g); - let j = document.getElementById('zhifujine_group'); - let k = document.getElementById('zhifujine_zongji'); - j.insertBefore(g,k); - } +function responsegetdingdandetail(code, data) { + if (code == '200') { + let a = document.getElementById('jihuamingcheng'); + a.innerHTML = JSON.parse(data).data.plan.name; + let b = document.getElementById('jihuazhouqileixing'); + b.innerHTML = zhouqi[JSON.parse(data).data.period]; + let c = document.getElementById('jihualiuliang'); + c.innerHTML = JSON.parse(data).data.plan.transfer_enable + 'GB'; + let d = document.getElementById('jiahuadingdanhao'); + d.innerHTML = JSON.parse(data).data.trade_no; + let e = document.getElementById('jiahuachuangjianshijian'); + e.innerHTML = getshijian(JSON.parse(data).data.created_at); + let f = document.getElementById('tijiaozongjine'); + f.innerHTML = '¥' + (JSON.parse(data).data.total_amount / 100).toFixed(2); + let aa = document.getElementById('jiagewushouxufei'); + aa.innerHTML = '¥' + (JSON.parse(data).data.total_amount / 100).toFixed(2); + + var price_group = { + handling_amount: JSON.parse(data).data.handling_amount, + discount_amount: JSON.parse(data).data.discount_amount, + surplus_amount: JSON.parse(data).data.surplus_amount, + balance_amount: JSON.parse(data).data.balance_amount, + refund_amount: JSON.parse(data).data.refund_amount, + }; + + for (x in price_group) { + if (price_group[x] != null) { + let g = document.createElement('div'); + g.setAttribute('class', 'jiahuaneirong_group'); + let h = document.createElement('p'); + h.setAttribute('class', 'jiahuaneirong_des'); + h.innerHTML = jinemingcheng[x]; + let i = document.createElement('p'); + i.setAttribute('class', 'jiahuaneirong_des'); + i.innerHTML = '¥' + (price_group[x] / 100).toFixed(2); + i.setAttribute('id', x); + g.appendChild(h); + g.appendChild(i); + console.log(g); + let j = document.getElementById('zhifujine_group'); + let k = document.getElementById('zhifujine_zongji'); + j.insertBefore(g, k); + } + } + + let bb = document.getElementById('closeorder'); + bb.setAttribute('value', JSON.parse(data).data.trade_no); + let cc = JSON.parse(data).data.status; + let dd = document.getElementById('gotopaybutton'); + let ee = document.getElementById('status_group_id'); + let ff = document.getElementById('status_1'); + let gg = document.getElementById('status_2'); + let hh = document.getElementById('status_3'); + let ii = document.getElementById('status_4'); + if (cc == '0') { + bb.style.display = 'block'; + huoquzhifu(); + trade_no_for_check = JSON.parse(data).data.trade_no; + setInterval(checkstatus, 5000); + } else if (cc == '1') { + ee.style.display = 'block'; + ff.style.display = 'flex'; + bb.style.display = 'none'; + dd.style.display = 'none'; + } else if (cc == '2') { + ee.style.display = 'block'; + gg.style.display = 'flex'; + bb.style.display = 'none'; + dd.style.display = 'none'; + } else if (cc == '3') { + ee.style.display = 'block'; + hh.style.display = 'flex'; + bb.style.display = 'none'; + dd.style.display = 'none'; + } else { + ee.style.display = 'block'; + ii.style.display = 'flex'; + bb.style.display = 'none'; + dd.style.display = 'none'; + } + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - - let bb = document.getElementById('closeorder'); - bb.setAttribute('value',JSON.parse(data).data.trade_no); - let cc = JSON.parse(data).data.status; - let dd = document.getElementById('gotopaybutton'); - let ee = document.getElementById('status_group_id'); - let ff = document.getElementById('status_1'); - let gg = document.getElementById('status_2'); - let hh = document.getElementById('status_3'); - let ii = document.getElementById('status_4'); - if (cc == '0') { - bb.style.display = 'block'; - huoquzhifu(); - trade_no_for_check =JSON.parse(data).data.trade_no; - setInterval(checkstatus, 5000); - } - else if(cc == '1'){ - ee.style.display = 'block'; - ff.style.display = 'flex'; - bb.style.display = 'none'; - dd.style.display = 'none'; - } - else if(cc == '2'){ - ee.style.display = 'block'; - gg.style.display = 'flex'; - bb.style.display = 'none'; - dd.style.display = 'none'; - } - else if(cc == '3'){ - ee.style.display = 'block'; - hh.style.display = 'flex'; - bb.style.display = 'none'; - dd.style.display = 'none'; - } - else { - ee.style.display = 'block'; - ii.style.display = 'flex'; - bb.style.display = 'none'; - dd.style.display = 'none'; - } - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } //时间戳转日期 function getshijian(time) { - let date = new Date(parseInt(time) * 1000); - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - return y + '-' + MM + '-' + d +' '+ h + ':' +m +':'+s; + let date = new Date(parseInt(time) * 1000); + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; + let d = date.getDate(); + d = d < 10 ? '0' + d : d; + let h = date.getHours(); + h = h < 10 ? '0' + h : h; + let m = date.getMinutes(); + m = m < 10 ? '0' + m : m; + let s = date.getSeconds(); + s = s < 10 ? '0' + s : s; + return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; } var jinemingcheng = { - 'handling_amount':'支付手续费', - 'discount_amount':'优惠金额', - 'surplus_amount':'折抵金额', - 'balance_amount':'余额支付', - 'refund_amount':'退款金额' + handling_amount: '支付手续费', + discount_amount: '优惠金额', + surplus_amount: '折抵金额', + balance_amount: '余额支付', + refund_amount: '退款金额', }; var zhouqi = { - 'month_price':'月付', - 'quarter_price':'季付', - 'half_year_price':'半年付', - 'year_price':'年付', - 'two_year_price':'两年付', - 'three_year_price':'三年付', - 'onetime_price':'一次性', - 'reset_price':'重置' + month_price: '月付', + quarter_price: '季付', + half_year_price: '半年付', + year_price: '年付', + two_year_price: '两年付', + three_year_price: '三年付', + onetime_price: '一次性', + reset_price: '重置', }; //初始化页面 var qidongcanshu = {}; -function chushihua(){ - let a = window.location.href; - let b = a.split('?'); - if(b[1] != null ) { - let d = b[1].split('='); - qidongcanshu[d[0]]=d[1]; - } - else { - console.log('没有状态'); - } - getdingdandetail(qidongcanshu['orderid']); - tijiaocanshu['trade_no'] = qidongcanshu['orderid']; +function chushihua() { + let a = window.location.href; + let b = a.split('?'); + if (b[1] != null) { + let d = b[1].split('='); + qidongcanshu[d[0]] = d[1]; + } else { + console.log('没有状态'); + } + getdingdandetail(qidongcanshu['orderid']); + tijiaocanshu['trade_no'] = qidongcanshu['orderid']; } - - - - - /*请求支付方式*/ -function huoquzhifu(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/getPaymentMethod'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsehuoquzhifu); +function huoquzhifu() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/getPaymentMethod'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsehuoquzhifu); } /*响应支付方式信息*/ -function responsehuoquzhifu(code,data){ - if (code == '200') { - let a = JSON.parse(data).data; - for (x in a){ - let b = document.createElement('div'); - b.setAttribute('class','peizhi_jine_option'); - b.setAttribute('id',a[x].id); - b.setAttribute('onclick','switchchoose(this.id)'); - let c = document.createElement('img'); - c.setAttribute('class','pay_img'); - c.setAttribute('src',a[x].icon); - let d = document.createElement('p'); - d.setAttribute('class','peizhi_jine_price'); - d.innerHTML = a[x].name; - let f = document.createElement('p'); - f.style.display = 'none'; - f.innerHTML = a[x].handling_fee_fixed; - let g = document.createElement('p'); - g.innerHTML = a[x].handling_fee_percent; - g.style.display = 'none'; - let e = document.getElementById('shop_peizhi_jine'); - b.appendChild(c); - b.appendChild(d); - b.appendChild(f); - b.appendChild(g); - e.appendChild(b); - } - switchchoose(a[0].id); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsehuoquzhifu(code, data) { + if (code == '200') { + let a = JSON.parse(data).data; + for (x in a) { + let b = document.createElement('div'); + b.setAttribute('class', 'peizhi_jine_option'); + b.setAttribute('id', a[x].id); + b.setAttribute('onclick', 'switchchoose(this.id)'); + let c = document.createElement('img'); + c.setAttribute('class', 'pay_img'); + c.setAttribute('src', a[x].icon); + let d = document.createElement('p'); + d.setAttribute('class', 'peizhi_jine_price'); + d.innerHTML = a[x].name; + let f = document.createElement('p'); + f.style.display = 'none'; + f.innerHTML = a[x].handling_fee_fixed; + let g = document.createElement('p'); + g.innerHTML = a[x].handling_fee_percent; + g.style.display = 'none'; + let e = document.getElementById('shop_peizhi_jine'); + b.appendChild(c); + b.appendChild(d); + b.appendChild(f); + b.appendChild(g); + e.appendChild(b); + } + switchchoose(a[0].id); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } var zhifufangshi = []; +function switchchoose(data) { + let paymentgroup_notchoose = document.getElementsByClassName('peizhi_jine_option'); + let paymentgroup_choose = document.getElementsByClassName('peizhi_jine_option_choose'); + for (x in paymentgroup_notchoose) { + if (typeof paymentgroup_notchoose[x] == 'object') { + paymentgroup_notchoose[x].setAttribute('class', 'peizhi_jine_option'); + } + } + if (paymentgroup_choose[0] != null) { + paymentgroup_choose[0].setAttribute('class', 'peizhi_jine_option'); + } + let a = document.getElementById(data); + tijiaocanshu['method'] = data; + a.setAttribute('class', 'peizhi_jine_option_choose'); + let b = document.getElementById('zhifu_shouxufei'); + let j = document.getElementById('zhifujine_group'); + if (b != null) { + j.removeChild(b); + } - - -function switchchoose(data){ - let paymentgroup_notchoose = document.getElementsByClassName('peizhi_jine_option'); - let paymentgroup_choose = document.getElementsByClassName('peizhi_jine_option_choose'); - for (x in paymentgroup_notchoose){ - if(typeof paymentgroup_notchoose[x] == 'object') - { - paymentgroup_notchoose[x].setAttribute('class','peizhi_jine_option'); + let total_amount = document.getElementById('jiagewushouxufei').textContent.split('¥')[1]; + console.log(total_amount); + let shouxufei = (a.children[2].textContent / 100 + total_amount * (a.children[3].textContent / 100)).toFixed(2); + console.log(shouxufei); + let l = document.getElementById('tijiaozongjine'); + console.log(total_amount); + if (total_amount === '0.00') { + l.innerHTML = '¥0.00'; + } else { + l.innerHTML = '¥' + (parseFloat(total_amount) + parseFloat(shouxufei)).toFixed(2); } - } - if(paymentgroup_choose[0] != null){ - paymentgroup_choose[0].setAttribute('class','peizhi_jine_option'); - } - let a = document.getElementById(data); - tijiaocanshu['method'] = data; - a.setAttribute('class','peizhi_jine_option_choose'); - let b = document.getElementById('zhifu_shouxufei'); - let j = document.getElementById('zhifujine_group'); - if (b != null){ - j.removeChild(b); - } - let total_amount = document.getElementById('jiagewushouxufei').textContent.split('¥')[1]; - console.log(total_amount); - let shouxufei = (a.children[2].textContent/100+(total_amount*(a.children[3].textContent/100))).toFixed(2); - console.log(shouxufei); - let l = document.getElementById('tijiaozongjine'); - console.log(total_amount); - if (total_amount === '0.00'){ - l.innerHTML = '¥0.00'; - } - else{ - l.innerHTML = '¥'+(parseFloat(total_amount)+parseFloat(shouxufei)).toFixed(2); - } - - let g = document.createElement('div'); - g.setAttribute('class','jiahuaneirong_group'); - g.setAttribute('id','zhifu_shouxufei'); - let h = document.createElement('p'); - h.innerHTML = '支付手续费'; - h.setAttribute('class','jiahuaneirong_des'); - let i = document.createElement('p'); - i.innerHTML = '¥'+shouxufei; - i.setAttribute('class','jiahuaneirong_des'); - g.appendChild(h); - g.appendChild(i); - let k = document.getElementById('zhifujine_zongji'); - j.insertBefore(g,k); + let g = document.createElement('div'); + g.setAttribute('class', 'jiahuaneirong_group'); + g.setAttribute('id', 'zhifu_shouxufei'); + let h = document.createElement('p'); + h.innerHTML = '支付手续费'; + h.setAttribute('class', 'jiahuaneirong_des'); + let i = document.createElement('p'); + i.innerHTML = '¥' + shouxufei; + i.setAttribute('class', 'jiahuaneirong_des'); + g.appendChild(h); + g.appendChild(i); + let k = document.getElementById('zhifujine_zongji'); + j.insertBefore(g, k); } - - /*取消订单接口*/ -function cancelorder(ordernumber){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/cancel'; - console.log(ordernumber); - let params = { - trade_no : ordernumber - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responsecancelorder); +function cancelorder(ordernumber) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/cancel'; + console.log(ordernumber); + let params = { + trade_no: ordernumber, + }; + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responsecancelorder); } /*响应取消订单接口*/ -function responsecancelorder(code,data){ - if (code == '200') { - tan('right','取消成功'); - window.location.href = './order.html'; - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsecancelorder(code, data) { + if (code == '200') { + tan('right', '取消成功'); + window.location.href = './order.html'; + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } //请求参数 var tijiaocanshu = { - 'method':'', - 'trade_no':'' + method: '', + trade_no: '', }; /*提交支付*/ -function gotopay(){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/checkout?trade_no='+tijiaocanshu['trade_no']+'&method='+tijiaocanshu['method']; - let params = ''; - tanjiazai(); - jsonlinkform(mode,link,params,responsegotopay); +function gotopay() { + let mode = 'POST'; + let link = + domain + + 'https://ovc.xiaon.life/api/v1/user/order/checkout?trade_no=' + + tijiaocanshu['trade_no'] + + '&method=' + + tijiaocanshu['method']; + let params = ''; + tanjiazai(); + jsonlinkform(mode, link, params, responsegotopay); } /*响应支付*/ -function responsegotopay(code,data){ - console.log(data); - if (code == '200') { - if(JSON.parse(data).type == -1) - { - tan('right','购买成功'); - window.location.href = './order.html'; - } - if(JSON.parse(data).type == 1) - { - tan('right','正在前往收银台'); - window.location.href = JSON.parse(data).data; - } - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); +function responsegotopay(code, data) { + console.log(data); + if (code == '200') { + if (JSON.parse(data).type == -1) { + tan('right', '购买成功'); + window.location.href = './order.html'; + } + if (JSON.parse(data).type == 1) { + tan('right', '正在前往收银台'); + window.location.href = JSON.parse(data).data; + } + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } - -var trade_no_for_check =null; +var trade_no_for_check = null; /*定时任务check*/ -function checkstatus(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/order/check?trade_no='+trade_no_for_check; - let params = ''; - jsonlink(mode,link,params,responsecheckstatus); +function checkstatus() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/check?trade_no=' + trade_no_for_check; + let params = ''; + jsonlink(mode, link, params, responsecheckstatus); } /*响应支付*/ -function responsecheckstatus(code,data){ - console.log(data); - if (code == '200') { - let a =JSON.parse(data).data; - if (a != '0'){ - location.reload(); - } - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); +function responsecheckstatus(code, data) { + console.log(data); + if (code == '200') { + let a = JSON.parse(data).data; + if (a != '0') { + location.reload(); + } + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); - } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } -} \ No newline at end of file +} diff --git a/xiaon_c5z3Cp/static/outline.js b/xiaon_c5z3Cp/static/outline.js index 8b2b10f..8f7a079 100644 --- a/xiaon_c5z3Cp/static/outline.js +++ b/xiaon_c5z3Cp/static/outline.js @@ -1,193 +1,189 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getSubscribe(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getSubscribe(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求订阅地址接口*/ -function getSubscribe(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/getSubscribe'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseSubscribe); +function getSubscribe() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/getSubscribe'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseSubscribe); } /*响应订阅地址信息*/ -function responseSubscribe(code,data){ - if (code == '200') { - canceltanjiazai(); - getbase64(JSON.parse(data).data.subscribe_url); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseSubscribe(code, data) { + if (code == '200') { + canceltanjiazai(); + getbase64(JSON.parse(data).data.subscribe_url); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*获取Base64*/ -function getbase64(url){ - let mode = 'GET'; - let link = url; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsebase64); +function getbase64(url) { + let mode = 'GET'; + let link = url; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsebase64); } /*解析BASE信息*/ -function responsebase64(code,data){ - if (code == '200') { - let aa = document.getElementById('outline_down'); - aa.innerHTML = ''; - canceltanjiazai(); - let a = Base64.decode(data); - let b = a.split('\n'); - b.pop(); - if (b == ''){ - let queshengbox = document.createElement('div'); - let queshengtu = document.createElement('img'); - queshengbox.setAttribute('class','queshengtu-box'); - queshengtu.setAttribute('src','./img/queshengtu.png'); - queshengtu.setAttribute('class','queshengtu'); - let fatherdiv = document.getElementById('outline_down'); - queshengbox.appendChild(queshengtu); - fatherdiv.appendChild(queshengbox); - } - for (x in b) { - let c = document.createElement('div'); - c.setAttribute('class','outline_box'); - let d = document.createElement('p'); - d.setAttribute('class','download_box_title'); - d.innerHTML = decodeURIComponent(b[x].split('#')[1]); - let e = document.createElement('div'); - e.setAttribute('class','outline_box_right'); - let f = document.createElement('img'); - f.setAttribute('class','outline_box_img'); - f.setAttribute('src','./img/xinhao.svg'); - let g = document.createElement('p'); - g.setAttribute('class','outline_box_content'); - g.innerHTML = '空闲'; - let h = document.createElement('a'); - h.setAttribute('class','outline_box_link'); - //h.setAttribute('href',b[x].split('#')[0]); - h.setAttribute('href',b[x]); - h.setAttribute('onclick',"copyhref(this.href)"); - h.innerHTML = '复制链接'; - c.appendChild(d); - e.appendChild(f); - e.appendChild(g); - e.appendChild(h); - c.appendChild(e); - i = document.getElementById('outline_down'); - i.appendChild(c); +function responsebase64(code, data) { + if (code == '200') { + let aa = document.getElementById('outline_down'); + aa.innerHTML = ''; + canceltanjiazai(); + let a = Base64.decode(data); + let b = a.split('\n'); + b.pop(); + if (b == '') { + let queshengbox = document.createElement('div'); + let queshengtu = document.createElement('img'); + queshengbox.setAttribute('class', 'queshengtu-box'); + queshengtu.setAttribute('src', './img/queshengtu.png'); + queshengtu.setAttribute('class', 'queshengtu'); + let fatherdiv = document.getElementById('outline_down'); + queshengbox.appendChild(queshengtu); + fatherdiv.appendChild(queshengbox); + } + for (x in b) { + let c = document.createElement('div'); + c.setAttribute('class', 'outline_box'); + let d = document.createElement('p'); + d.setAttribute('class', 'download_box_title'); + d.innerHTML = decodeURIComponent(b[x].split('#')[1]); + let e = document.createElement('div'); + e.setAttribute('class', 'outline_box_right'); + let f = document.createElement('img'); + f.setAttribute('class', 'outline_box_img'); + f.setAttribute('src', './img/xinhao.svg'); + let g = document.createElement('p'); + g.setAttribute('class', 'outline_box_content'); + g.innerHTML = '空闲'; + let h = document.createElement('a'); + h.setAttribute('class', 'outline_box_link'); + //h.setAttribute('href',b[x].split('#')[0]); + h.setAttribute('href', b[x]); + h.setAttribute('onclick', 'copyhref(this.href)'); + h.innerHTML = '复制链接'; + c.appendChild(d); + e.appendChild(f); + e.appendChild(g); + e.appendChild(h); + c.appendChild(e); + i = document.getElementById('outline_down'); + i.appendChild(c); + } + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } // Base64 编解码 let Base64 = { -encode(str) { - return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, - function toSolidBytes(match, p1) { - return String.fromCharCode('0x' + p1); - })); -}, -decode(str) { - // Going backwards: from bytestream, to percent-encoding, to original string. - return decodeURIComponent(atob(str).split('').map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); -} -} + encode(str) { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) { + return String.fromCharCode('0x' + p1); + }), + ); + }, + decode(str) { + // Going backwards: from bytestream, to percent-encoding, to original string. + return decodeURIComponent( + atob(str) + .split('') + .map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }) + .join(''), + ); + }, +}; -function copyhref(href){ - copy(href); +function copyhref(href) { + copy(href); } // 复制函数 -function copy (text) { - // text是复制文本 - // 创建input元素 - const el = document.createElement('input'); - // 给input元素赋值需要复制的文本 - el.setAttribute('value', text); - // 将input元素插入页面 - document.body.appendChild(el); - // 选中input元素的文本 - el.select(); - // 复制内容到剪贴板 - document.execCommand('copy'); - // 删除input元素 - document.body.removeChild(el); - +function copy(text) { + // text是复制文本 + // 创建input元素 + const el = document.createElement('input'); + // 给input元素赋值需要复制的文本 + el.setAttribute('value', text); + // 将input元素插入页面 + document.body.appendChild(el); + // 选中input元素的文本 + el.select(); + // 复制内容到剪贴板 + document.execCommand('copy'); + // 删除input元素 + document.body.removeChild(el); } diff --git a/xiaon_c5z3Cp/static/qrcode.js b/xiaon_c5z3Cp/static/qrcode.js index 5fda21c..cbf9e36 100644 --- a/xiaon_c5z3Cp/static/qrcode.js +++ b/xiaon_c5z3Cp/static/qrcode.js @@ -3,7 +3,7 @@ * - Using the 'QRCode for Javascript library' * - Fixed dataset of 'QRCode for Javascript library' for support full-spec. * - this library has no dependencies. - * + * * @author davidshimjs * @see http://www.d-project.com/ * @see http://jeromeetienne.github.com/jquery-qrcode/ @@ -11,604 +11,1421 @@ var QRCode; (function () { - //--------------------------------------------------------------------- - // QRCode for JavaScript - // - // Copyright (c) 2009 Kazuhiko Arase - // - // URL: http://www.d-project.com/ - // - // Licensed under the MIT license: - // http://www.opensource.org/licenses/mit-license.php - // - // The word "QR Code" is registered trademark of - // DENSO WAVE INCORPORATED - // http://www.denso-wave.com/qrcode/faqpatent-e.html - // - //--------------------------------------------------------------------- - function QR8bitByte(data) { - this.mode = QRMode.MODE_8BIT_BYTE; - this.data = data; - this.parsedData = []; - - // Added to support UTF-8 Characters - for (var i = 0, l = this.data.length; i < l; i++) { - var byteArray = []; - var code = this.data.charCodeAt(i); - - if (code > 0x10000) { - byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18); - byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12); - byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6); - byteArray[3] = 0x80 | (code & 0x3F); - } else if (code > 0x800) { - byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12); - byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6); - byteArray[2] = 0x80 | (code & 0x3F); - } else if (code > 0x80) { - byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6); - byteArray[1] = 0x80 | (code & 0x3F); - } else { - byteArray[0] = code; - } - - this.parsedData.push(byteArray); - } - - this.parsedData = Array.prototype.concat.apply([], this.parsedData); - - if (this.parsedData.length != this.data.length) { - this.parsedData.unshift(191); - this.parsedData.unshift(187); - this.parsedData.unshift(239); - } - } - - QR8bitByte.prototype = { - getLength: function (buffer) { - return this.parsedData.length; - }, - write: function (buffer) { - for (var i = 0, l = this.parsedData.length; i < l; i++) { - buffer.put(this.parsedData[i], 8); - } - } - }; - - function QRCodeModel(typeNumber, errorCorrectLevel) { - this.typeNumber = typeNumber; - this.errorCorrectLevel = errorCorrectLevel; - this.modules = null; - this.moduleCount = 0; - this.dataCache = null; - this.dataList = []; - } - - QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);} - return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row=7){this.setupTypeNumber(test);} - if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);} - this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}} - return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;} - for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}} - for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}} - this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex>>bitIndex)&1)==1);} - var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;} - this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}} - row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;itotalDataCount*8){throw new Error("code length overflow. (" - +buffer.getLengthInBits() - +">" - +totalDataCount*8 - +")");} - if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);} - while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);} - while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;} - buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;} - buffer.put(QRCodeModel.PAD1,8);} - return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r=0)?modPoly.get(modIndex):0;}} - var totalCodeCount=0;for(var i=0;i=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));} - return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));} - return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;} - return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i5){lostPoint+=(3+sameCount-5);}}} - for(var row=0;row=256){n-=255;} - return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);} - if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));} - this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]]; - - function _isSupportCanvas() { - return typeof CanvasRenderingContext2D != "undefined"; - } - - // android 2.x doesn't support Data-URI spec - function _getAndroid() { - var android = false; - var sAgent = navigator.userAgent; - - if (/android/i.test(sAgent)) { // android - android = true; - var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); - - if (aMat && aMat[1]) { - android = parseFloat(aMat[1]); - } - } - - return android; - } - - var svgDrawer = (function() { - - var Drawing = function (el, htOption) { - this._el = el; - this._htOption = htOption; - }; - - Drawing.prototype.draw = function (oQRCode) { - var _htOption = this._htOption; - var _el = this._el; - var nCount = oQRCode.getModuleCount(); - var nWidth = Math.floor(_htOption.width / nCount); - var nHeight = Math.floor(_htOption.height / nCount); - - this.clear(); - - function makeSVG(tag, attrs) { - var el = document.createElementNS('http://www.w3.org/2000/svg', tag); - for (var k in attrs) - if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); - return el; - } - - var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight}); - svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"); - _el.appendChild(svg); - - svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"})); - svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"})); - - for (var row = 0; row < nCount; row++) { - for (var col = 0; col < nCount; col++) { - if (oQRCode.isDark(row, col)) { - var child = makeSVG("use", {"x": String(col), "y": String(row)}); - child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template") - svg.appendChild(child); - } - } - } - }; - Drawing.prototype.clear = function () { - while (this._el.hasChildNodes()) - this._el.removeChild(this._el.lastChild); - }; - return Drawing; - })(); - - var useSVG = document.documentElement.tagName.toLowerCase() === "svg"; - - // Drawing in DOM by using Table tag - var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () { - var Drawing = function (el, htOption) { - this._el = el; - this._htOption = htOption; - }; - - /** - * Draw the QRCode - * - * @param {QRCode} oQRCode - */ - Drawing.prototype.draw = function (oQRCode) { + //--------------------------------------------------------------------- + // QRCode for JavaScript + // + // Copyright (c) 2009 Kazuhiko Arase + // + // URL: http://www.d-project.com/ + // + // Licensed under the MIT license: + // http://www.opensource.org/licenses/mit-license.php + // + // The word "QR Code" is registered trademark of + // DENSO WAVE INCORPORATED + // http://www.denso-wave.com/qrcode/faqpatent-e.html + // + //--------------------------------------------------------------------- + function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; + this.parsedData = []; + + // Added to support UTF-8 Characters + for (var i = 0, l = this.data.length; i < l; i++) { + var byteArray = []; + var code = this.data.charCodeAt(i); + + if (code > 0x10000) { + byteArray[0] = 0xf0 | ((code & 0x1c0000) >>> 18); + byteArray[1] = 0x80 | ((code & 0x3f000) >>> 12); + byteArray[2] = 0x80 | ((code & 0xfc0) >>> 6); + byteArray[3] = 0x80 | (code & 0x3f); + } else if (code > 0x800) { + byteArray[0] = 0xe0 | ((code & 0xf000) >>> 12); + byteArray[1] = 0x80 | ((code & 0xfc0) >>> 6); + byteArray[2] = 0x80 | (code & 0x3f); + } else if (code > 0x80) { + byteArray[0] = 0xc0 | ((code & 0x7c0) >>> 6); + byteArray[1] = 0x80 | (code & 0x3f); + } else { + byteArray[0] = code; + } + + this.parsedData.push(byteArray); + } + + this.parsedData = Array.prototype.concat.apply([], this.parsedData); + + if (this.parsedData.length != this.data.length) { + this.parsedData.unshift(191); + this.parsedData.unshift(187); + this.parsedData.unshift(239); + } + } + + QR8bitByte.prototype = { + getLength: function (buffer) { + return this.parsedData.length; + }, + write: function (buffer) { + for (var i = 0, l = this.parsedData.length; i < l; i++) { + buffer.put(this.parsedData[i], 8); + } + }, + }; + + function QRCodeModel(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; + } + + QRCodeModel.prototype = { + addData: function (data) { + var newData = new QR8bitByte(data); + this.dataList.push(newData); + this.dataCache = null; + }, + isDark: function (row, col) { + if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { + throw new Error(row + ',' + col); + } + return this.modules[row][col]; + }, + getModuleCount: function () { + return this.moduleCount; + }, + make: function () { + this.makeImpl(false, this.getBestMaskPattern()); + }, + makeImpl: function (test, maskPattern) { + this.moduleCount = this.typeNumber * 4 + 17; + this.modules = new Array(this.moduleCount); + for (var row = 0; row < this.moduleCount; row++) { + this.modules[row] = new Array(this.moduleCount); + for (var col = 0; col < this.moduleCount; col++) { + this.modules[row][col] = null; + } + } + this.setupPositionProbePattern(0, 0); + this.setupPositionProbePattern(this.moduleCount - 7, 0); + this.setupPositionProbePattern(0, this.moduleCount - 7); + this.setupPositionAdjustPattern(); + this.setupTimingPattern(); + this.setupTypeInfo(test, maskPattern); + if (this.typeNumber >= 7) { + this.setupTypeNumber(test); + } + if (this.dataCache == null) { + this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); + } + this.mapData(this.dataCache, maskPattern); + }, + setupPositionProbePattern: function (row, col) { + for (var r = -1; r <= 7; r++) { + if (row + r <= -1 || this.moduleCount <= row + r) continue; + for (var c = -1; c <= 7; c++) { + if (col + c <= -1 || this.moduleCount <= col + c) continue; + if ( + (0 <= r && r <= 6 && (c == 0 || c == 6)) || + (0 <= c && c <= 6 && (r == 0 || r == 6)) || + (2 <= r && r <= 4 && 2 <= c && c <= 4) + ) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + }, + getBestMaskPattern: function () { + var minLostPoint = 0; + var pattern = 0; + for (var i = 0; i < 8; i++) { + this.makeImpl(true, i); + var lostPoint = QRUtil.getLostPoint(this); + if (i == 0 || minLostPoint > lostPoint) { + minLostPoint = lostPoint; + pattern = i; + } + } + return pattern; + }, + createMovieClip: function (target_mc, instance_name, depth) { + var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); + var cs = 1; + this.make(); + for (var row = 0; row < this.modules.length; row++) { + var y = row * cs; + for (var col = 0; col < this.modules[row].length; col++) { + var x = col * cs; + var dark = this.modules[row][col]; + if (dark) { + qr_mc.beginFill(0, 100); + qr_mc.moveTo(x, y); + qr_mc.lineTo(x + cs, y); + qr_mc.lineTo(x + cs, y + cs); + qr_mc.lineTo(x, y + cs); + qr_mc.endFill(); + } + } + } + return qr_mc; + }, + setupTimingPattern: function () { + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] != null) { + continue; + } + this.modules[r][6] = r % 2 == 0; + } + for (var c = 8; c < this.moduleCount - 8; c++) { + if (this.modules[6][c] != null) { + continue; + } + this.modules[6][c] = c % 2 == 0; + } + }, + setupPositionAdjustPattern: function () { + var pos = QRUtil.getPatternPosition(this.typeNumber); + for (var i = 0; i < pos.length; i++) { + for (var j = 0; j < pos.length; j++) { + var row = pos[i]; + var col = pos[j]; + if (this.modules[row][col] != null) { + continue; + } + for (var r = -2; r <= 2; r++) { + for (var c = -2; c <= 2; c++) { + if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + } + } + }, + setupTypeNumber: function (test) { + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); + for (var i = 0; i < 18; i++) { + var mod = !test && ((bits >> i) & 1) == 1; + this.modules[Math.floor(i / 3)][(i % 3) + this.moduleCount - 8 - 3] = mod; + } + for (var i = 0; i < 18; i++) { + var mod = !test && ((bits >> i) & 1) == 1; + this.modules[(i % 3) + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; + } + }, + setupTypeInfo: function (test, maskPattern) { + var data = (this.errorCorrectLevel << 3) | maskPattern; + var bits = QRUtil.getBCHTypeInfo(data); + for (var i = 0; i < 15; i++) { + var mod = !test && ((bits >> i) & 1) == 1; + if (i < 6) { + this.modules[i][8] = mod; + } else if (i < 8) { + this.modules[i + 1][8] = mod; + } else { + this.modules[this.moduleCount - 15 + i][8] = mod; + } + } + for (var i = 0; i < 15; i++) { + var mod = !test && ((bits >> i) & 1) == 1; + if (i < 8) { + this.modules[8][this.moduleCount - i - 1] = mod; + } else if (i < 9) { + this.modules[8][15 - i - 1 + 1] = mod; + } else { + this.modules[8][15 - i - 1] = mod; + } + } + this.modules[this.moduleCount - 8][8] = !test; + }, + mapData: function (data, maskPattern) { + var inc = -1; + var row = this.moduleCount - 1; + var bitIndex = 7; + var byteIndex = 0; + for (var col = this.moduleCount - 1; col > 0; col -= 2) { + if (col == 6) col--; + while (true) { + for (var c = 0; c < 2; c++) { + if (this.modules[row][col - c] == null) { + var dark = false; + if (byteIndex < data.length) { + dark = ((data[byteIndex] >>> bitIndex) & 1) == 1; + } + var mask = QRUtil.getMask(maskPattern, row, col - c); + if (mask) { + dark = !dark; + } + this.modules[row][col - c] = dark; + bitIndex--; + if (bitIndex == -1) { + byteIndex++; + bitIndex = 7; + } + } + } + row += inc; + if (row < 0 || this.moduleCount <= row) { + row -= inc; + inc = -inc; + break; + } + } + } + }, + }; + QRCodeModel.PAD0 = 0xec; + QRCodeModel.PAD1 = 0x11; + QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) { + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); + var buffer = new QRBitBuffer(); + for (var i = 0; i < dataList.length; i++) { + var data = dataList[i]; + buffer.put(data.mode, 4); + buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); + data.write(buffer); + } + var totalDataCount = 0; + for (var i = 0; i < rsBlocks.length; i++) { + totalDataCount += rsBlocks[i].dataCount; + } + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error('code length overflow. (' + buffer.getLengthInBits() + '>' + totalDataCount * 8 + ')'); + } + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { + buffer.put(0, 4); + } + while (buffer.getLengthInBits() % 8 != 0) { + buffer.putBit(false); + } + while (true) { + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(QRCodeModel.PAD0, 8); + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(QRCodeModel.PAD1, 8); + } + return QRCodeModel.createBytes(buffer, rsBlocks); + }; + QRCodeModel.createBytes = function (buffer, rsBlocks) { + var offset = 0; + var maxDcCount = 0; + var maxEcCount = 0; + var dcdata = new Array(rsBlocks.length); + var ecdata = new Array(rsBlocks.length); + for (var r = 0; r < rsBlocks.length; r++) { + var dcCount = rsBlocks[r].dataCount; + var ecCount = rsBlocks[r].totalCount - dcCount; + maxDcCount = Math.max(maxDcCount, dcCount); + maxEcCount = Math.max(maxEcCount, ecCount); + dcdata[r] = new Array(dcCount); + for (var i = 0; i < dcdata[r].length; i++) { + dcdata[r][i] = 0xff & buffer.buffer[i + offset]; + } + offset += dcCount; + var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); + var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); + var modPoly = rawPoly.mod(rsPoly); + ecdata[r] = new Array(rsPoly.getLength() - 1); + for (var i = 0; i < ecdata[r].length; i++) { + var modIndex = i + modPoly.getLength() - ecdata[r].length; + ecdata[r][i] = modIndex >= 0 ? modPoly.get(modIndex) : 0; + } + } + var totalCodeCount = 0; + for (var i = 0; i < rsBlocks.length; i++) { + totalCodeCount += rsBlocks[i].totalCount; + } + var data = new Array(totalCodeCount); + var index = 0; + for (var i = 0; i < maxDcCount; i++) { + for (var r = 0; r < rsBlocks.length; r++) { + if (i < dcdata[r].length) { + data[index++] = dcdata[r][i]; + } + } + } + for (var i = 0; i < maxEcCount; i++) { + for (var r = 0; r < rsBlocks.length; r++) { + if (i < ecdata[r].length) { + data[index++] = ecdata[r][i]; + } + } + } + return data; + }; + var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; + var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; + var QRMaskPattern = { + PATTERN000: 0, + PATTERN001: 1, + PATTERN010: 2, + PATTERN011: 3, + PATTERN100: 4, + PATTERN101: 5, + PATTERN110: 6, + PATTERN111: 7, + }; + var QRUtil = { + PATTERN_POSITION_TABLE: [ + [], + [6, 18], + [6, 22], + [6, 26], + [6, 30], + [6, 34], + [6, 22, 38], + [6, 24, 42], + [6, 26, 46], + [6, 28, 50], + [6, 30, 54], + [6, 32, 58], + [6, 34, 62], + [6, 26, 46, 66], + [6, 26, 48, 70], + [6, 26, 50, 74], + [6, 30, 54, 78], + [6, 30, 56, 82], + [6, 30, 58, 86], + [6, 34, 62, 90], + [6, 28, 50, 72, 94], + [6, 26, 50, 74, 98], + [6, 30, 54, 78, 102], + [6, 28, 54, 80, 106], + [6, 32, 58, 84, 110], + [6, 30, 58, 86, 114], + [6, 34, 62, 90, 118], + [6, 26, 50, 74, 98, 122], + [6, 30, 54, 78, 102, 126], + [6, 26, 52, 78, 104, 130], + [6, 30, 56, 82, 108, 134], + [6, 34, 60, 86, 112, 138], + [6, 30, 58, 86, 114, 142], + [6, 34, 62, 90, 118, 146], + [6, 30, 54, 78, 102, 126, 150], + [6, 24, 50, 76, 102, 128, 154], + [6, 28, 54, 80, 106, 132, 158], + [6, 32, 58, 84, 110, 136, 162], + [6, 26, 54, 82, 110, 138, 166], + [6, 30, 58, 86, 114, 142, 170], + ], + G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), + G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), + G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), + getBCHTypeInfo: function (data) { + var d = data << 10; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { + d ^= QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)); + } + return ((data << 10) | d) ^ QRUtil.G15_MASK; + }, + getBCHTypeNumber: function (data) { + var d = data << 12; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { + d ^= QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)); + } + return (data << 12) | d; + }, + getBCHDigit: function (data) { + var digit = 0; + while (data != 0) { + digit++; + data >>>= 1; + } + return digit; + }, + getPatternPosition: function (typeNumber) { + return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; + }, + getMask: function (maskPattern, i, j) { + switch (maskPattern) { + case QRMaskPattern.PATTERN000: + return (i + j) % 2 == 0; + case QRMaskPattern.PATTERN001: + return i % 2 == 0; + case QRMaskPattern.PATTERN010: + return j % 3 == 0; + case QRMaskPattern.PATTERN011: + return (i + j) % 3 == 0; + case QRMaskPattern.PATTERN100: + return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; + case QRMaskPattern.PATTERN101: + return ((i * j) % 2) + ((i * j) % 3) == 0; + case QRMaskPattern.PATTERN110: + return (((i * j) % 2) + ((i * j) % 3)) % 2 == 0; + case QRMaskPattern.PATTERN111: + return (((i * j) % 3) + ((i + j) % 2)) % 2 == 0; + default: + throw new Error('bad maskPattern:' + maskPattern); + } + }, + getErrorCorrectPolynomial: function (errorCorrectLength) { + var a = new QRPolynomial([1], 0); + for (var i = 0; i < errorCorrectLength; i++) { + a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); + } + return a; + }, + getLengthInBits: function (mode, type) { + if (1 <= type && type < 10) { + switch (mode) { + case QRMode.MODE_NUMBER: + return 10; + case QRMode.MODE_ALPHA_NUM: + return 9; + case QRMode.MODE_8BIT_BYTE: + return 8; + case QRMode.MODE_KANJI: + return 8; + default: + throw new Error('mode:' + mode); + } + } else if (type < 27) { + switch (mode) { + case QRMode.MODE_NUMBER: + return 12; + case QRMode.MODE_ALPHA_NUM: + return 11; + case QRMode.MODE_8BIT_BYTE: + return 16; + case QRMode.MODE_KANJI: + return 10; + default: + throw new Error('mode:' + mode); + } + } else if (type < 41) { + switch (mode) { + case QRMode.MODE_NUMBER: + return 14; + case QRMode.MODE_ALPHA_NUM: + return 13; + case QRMode.MODE_8BIT_BYTE: + return 16; + case QRMode.MODE_KANJI: + return 12; + default: + throw new Error('mode:' + mode); + } + } else { + throw new Error('type:' + type); + } + }, + getLostPoint: function (qrCode) { + var moduleCount = qrCode.getModuleCount(); + var lostPoint = 0; + for (var row = 0; row < moduleCount; row++) { + for (var col = 0; col < moduleCount; col++) { + var sameCount = 0; + var dark = qrCode.isDark(row, col); + for (var r = -1; r <= 1; r++) { + if (row + r < 0 || moduleCount <= row + r) { + continue; + } + for (var c = -1; c <= 1; c++) { + if (col + c < 0 || moduleCount <= col + c) { + continue; + } + if (r == 0 && c == 0) { + continue; + } + if (dark == qrCode.isDark(row + r, col + c)) { + sameCount++; + } + } + } + if (sameCount > 5) { + lostPoint += 3 + sameCount - 5; + } + } + } + for (var row = 0; row < moduleCount - 1; row++) { + for (var col = 0; col < moduleCount - 1; col++) { + var count = 0; + if (qrCode.isDark(row, col)) count++; + if (qrCode.isDark(row + 1, col)) count++; + if (qrCode.isDark(row, col + 1)) count++; + if (qrCode.isDark(row + 1, col + 1)) count++; + if (count == 0 || count == 4) { + lostPoint += 3; + } + } + } + for (var row = 0; row < moduleCount; row++) { + for (var col = 0; col < moduleCount - 6; col++) { + if ( + qrCode.isDark(row, col) && + !qrCode.isDark(row, col + 1) && + qrCode.isDark(row, col + 2) && + qrCode.isDark(row, col + 3) && + qrCode.isDark(row, col + 4) && + !qrCode.isDark(row, col + 5) && + qrCode.isDark(row, col + 6) + ) { + lostPoint += 40; + } + } + } + for (var col = 0; col < moduleCount; col++) { + for (var row = 0; row < moduleCount - 6; row++) { + if ( + qrCode.isDark(row, col) && + !qrCode.isDark(row + 1, col) && + qrCode.isDark(row + 2, col) && + qrCode.isDark(row + 3, col) && + qrCode.isDark(row + 4, col) && + !qrCode.isDark(row + 5, col) && + qrCode.isDark(row + 6, col) + ) { + lostPoint += 40; + } + } + } + var darkCount = 0; + for (var col = 0; col < moduleCount; col++) { + for (var row = 0; row < moduleCount; row++) { + if (qrCode.isDark(row, col)) { + darkCount++; + } + } + } + var ratio = Math.abs((100 * darkCount) / moduleCount / moduleCount - 50) / 5; + lostPoint += ratio * 10; + return lostPoint; + }, + }; + var QRMath = { + glog: function (n) { + if (n < 1) { + throw new Error('glog(' + n + ')'); + } + return QRMath.LOG_TABLE[n]; + }, + gexp: function (n) { + while (n < 0) { + n += 255; + } + while (n >= 256) { + n -= 255; + } + return QRMath.EXP_TABLE[n]; + }, + EXP_TABLE: new Array(256), + LOG_TABLE: new Array(256), + }; + for (var i = 0; i < 8; i++) { + QRMath.EXP_TABLE[i] = 1 << i; + } + for (var i = 8; i < 256; i++) { + QRMath.EXP_TABLE[i] = + QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; + } + for (var i = 0; i < 255; i++) { + QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; + } + function QRPolynomial(num, shift) { + if (num.length == undefined) { + throw new Error(num.length + '/' + shift); + } + var offset = 0; + while (offset < num.length && num[offset] == 0) { + offset++; + } + this.num = new Array(num.length - offset + shift); + for (var i = 0; i < num.length - offset; i++) { + this.num[i] = num[i + offset]; + } + } + QRPolynomial.prototype = { + get: function (index) { + return this.num[index]; + }, + getLength: function () { + return this.num.length; + }, + multiply: function (e) { + var num = new Array(this.getLength() + e.getLength() - 1); + for (var i = 0; i < this.getLength(); i++) { + for (var j = 0; j < e.getLength(); j++) { + num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); + } + } + return new QRPolynomial(num, 0); + }, + mod: function (e) { + if (this.getLength() - e.getLength() < 0) { + return this; + } + var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); + var num = new Array(this.getLength()); + for (var i = 0; i < this.getLength(); i++) { + num[i] = this.get(i); + } + for (var i = 0; i < e.getLength(); i++) { + num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); + } + return new QRPolynomial(num, 0).mod(e); + }, + }; + function QRRSBlock(totalCount, dataCount) { + this.totalCount = totalCount; + this.dataCount = dataCount; + } + QRRSBlock.RS_BLOCK_TABLE = [ + [1, 26, 19], + [1, 26, 16], + [1, 26, 13], + [1, 26, 9], + [1, 44, 34], + [1, 44, 28], + [1, 44, 22], + [1, 44, 16], + [1, 70, 55], + [1, 70, 44], + [2, 35, 17], + [2, 35, 13], + [1, 100, 80], + [2, 50, 32], + [2, 50, 24], + [4, 25, 9], + [1, 134, 108], + [2, 67, 43], + [2, 33, 15, 2, 34, 16], + [2, 33, 11, 2, 34, 12], + [2, 86, 68], + [4, 43, 27], + [4, 43, 19], + [4, 43, 15], + [2, 98, 78], + [4, 49, 31], + [2, 32, 14, 4, 33, 15], + [4, 39, 13, 1, 40, 14], + [2, 121, 97], + [2, 60, 38, 2, 61, 39], + [4, 40, 18, 2, 41, 19], + [4, 40, 14, 2, 41, 15], + [2, 146, 116], + [3, 58, 36, 2, 59, 37], + [4, 36, 16, 4, 37, 17], + [4, 36, 12, 4, 37, 13], + [2, 86, 68, 2, 87, 69], + [4, 69, 43, 1, 70, 44], + [6, 43, 19, 2, 44, 20], + [6, 43, 15, 2, 44, 16], + [4, 101, 81], + [1, 80, 50, 4, 81, 51], + [4, 50, 22, 4, 51, 23], + [3, 36, 12, 8, 37, 13], + [2, 116, 92, 2, 117, 93], + [6, 58, 36, 2, 59, 37], + [4, 46, 20, 6, 47, 21], + [7, 42, 14, 4, 43, 15], + [4, 133, 107], + [8, 59, 37, 1, 60, 38], + [8, 44, 20, 4, 45, 21], + [12, 33, 11, 4, 34, 12], + [3, 145, 115, 1, 146, 116], + [4, 64, 40, 5, 65, 41], + [11, 36, 16, 5, 37, 17], + [11, 36, 12, 5, 37, 13], + [5, 109, 87, 1, 110, 88], + [5, 65, 41, 5, 66, 42], + [5, 54, 24, 7, 55, 25], + [11, 36, 12], + [5, 122, 98, 1, 123, 99], + [7, 73, 45, 3, 74, 46], + [15, 43, 19, 2, 44, 20], + [3, 45, 15, 13, 46, 16], + [1, 135, 107, 5, 136, 108], + [10, 74, 46, 1, 75, 47], + [1, 50, 22, 15, 51, 23], + [2, 42, 14, 17, 43, 15], + [5, 150, 120, 1, 151, 121], + [9, 69, 43, 4, 70, 44], + [17, 50, 22, 1, 51, 23], + [2, 42, 14, 19, 43, 15], + [3, 141, 113, 4, 142, 114], + [3, 70, 44, 11, 71, 45], + [17, 47, 21, 4, 48, 22], + [9, 39, 13, 16, 40, 14], + [3, 135, 107, 5, 136, 108], + [3, 67, 41, 13, 68, 42], + [15, 54, 24, 5, 55, 25], + [15, 43, 15, 10, 44, 16], + [4, 144, 116, 4, 145, 117], + [17, 68, 42], + [17, 50, 22, 6, 51, 23], + [19, 46, 16, 6, 47, 17], + [2, 139, 111, 7, 140, 112], + [17, 74, 46], + [7, 54, 24, 16, 55, 25], + [34, 37, 13], + [4, 151, 121, 5, 152, 122], + [4, 75, 47, 14, 76, 48], + [11, 54, 24, 14, 55, 25], + [16, 45, 15, 14, 46, 16], + [6, 147, 117, 4, 148, 118], + [6, 73, 45, 14, 74, 46], + [11, 54, 24, 16, 55, 25], + [30, 46, 16, 2, 47, 17], + [8, 132, 106, 4, 133, 107], + [8, 75, 47, 13, 76, 48], + [7, 54, 24, 22, 55, 25], + [22, 45, 15, 13, 46, 16], + [10, 142, 114, 2, 143, 115], + [19, 74, 46, 4, 75, 47], + [28, 50, 22, 6, 51, 23], + [33, 46, 16, 4, 47, 17], + [8, 152, 122, 4, 153, 123], + [22, 73, 45, 3, 74, 46], + [8, 53, 23, 26, 54, 24], + [12, 45, 15, 28, 46, 16], + [3, 147, 117, 10, 148, 118], + [3, 73, 45, 23, 74, 46], + [4, 54, 24, 31, 55, 25], + [11, 45, 15, 31, 46, 16], + [7, 146, 116, 7, 147, 117], + [21, 73, 45, 7, 74, 46], + [1, 53, 23, 37, 54, 24], + [19, 45, 15, 26, 46, 16], + [5, 145, 115, 10, 146, 116], + [19, 75, 47, 10, 76, 48], + [15, 54, 24, 25, 55, 25], + [23, 45, 15, 25, 46, 16], + [13, 145, 115, 3, 146, 116], + [2, 74, 46, 29, 75, 47], + [42, 54, 24, 1, 55, 25], + [23, 45, 15, 28, 46, 16], + [17, 145, 115], + [10, 74, 46, 23, 75, 47], + [10, 54, 24, 35, 55, 25], + [19, 45, 15, 35, 46, 16], + [17, 145, 115, 1, 146, 116], + [14, 74, 46, 21, 75, 47], + [29, 54, 24, 19, 55, 25], + [11, 45, 15, 46, 46, 16], + [13, 145, 115, 6, 146, 116], + [14, 74, 46, 23, 75, 47], + [44, 54, 24, 7, 55, 25], + [59, 46, 16, 1, 47, 17], + [12, 151, 121, 7, 152, 122], + [12, 75, 47, 26, 76, 48], + [39, 54, 24, 14, 55, 25], + [22, 45, 15, 41, 46, 16], + [6, 151, 121, 14, 152, 122], + [6, 75, 47, 34, 76, 48], + [46, 54, 24, 10, 55, 25], + [2, 45, 15, 64, 46, 16], + [17, 152, 122, 4, 153, 123], + [29, 74, 46, 14, 75, 47], + [49, 54, 24, 10, 55, 25], + [24, 45, 15, 46, 46, 16], + [4, 152, 122, 18, 153, 123], + [13, 74, 46, 32, 75, 47], + [48, 54, 24, 14, 55, 25], + [42, 45, 15, 32, 46, 16], + [20, 147, 117, 4, 148, 118], + [40, 75, 47, 7, 76, 48], + [43, 54, 24, 22, 55, 25], + [10, 45, 15, 67, 46, 16], + [19, 148, 118, 6, 149, 119], + [18, 75, 47, 31, 76, 48], + [34, 54, 24, 34, 55, 25], + [20, 45, 15, 61, 46, 16], + ]; + QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) { + var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); + if (rsBlock == undefined) { + throw new Error('bad rs block @ typeNumber:' + typeNumber + '/errorCorrectLevel:' + errorCorrectLevel); + } + var length = rsBlock.length / 3; + var list = []; + for (var i = 0; i < length; i++) { + var count = rsBlock[i * 3 + 0]; + var totalCount = rsBlock[i * 3 + 1]; + var dataCount = rsBlock[i * 3 + 2]; + for (var j = 0; j < count; j++) { + list.push(new QRRSBlock(totalCount, dataCount)); + } + } + return list; + }; + QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { + switch (errorCorrectLevel) { + case QRErrorCorrectLevel.L: + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; + case QRErrorCorrectLevel.M: + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; + case QRErrorCorrectLevel.Q: + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; + case QRErrorCorrectLevel.H: + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; + default: + return undefined; + } + }; + function QRBitBuffer() { + this.buffer = []; + this.length = 0; + } + QRBitBuffer.prototype = { + get: function (index) { + var bufIndex = Math.floor(index / 8); + return ((this.buffer[bufIndex] >>> (7 - (index % 8))) & 1) == 1; + }, + put: function (num, length) { + for (var i = 0; i < length; i++) { + this.putBit(((num >>> (length - i - 1)) & 1) == 1); + } + }, + getLengthInBits: function () { + return this.length; + }, + putBit: function (bit) { + var bufIndex = Math.floor(this.length / 8); + if (this.buffer.length <= bufIndex) { + this.buffer.push(0); + } + if (bit) { + this.buffer[bufIndex] |= 0x80 >>> this.length % 8; + } + this.length++; + }, + }; + var QRCodeLimitLength = [ + [17, 14, 11, 7], + [32, 26, 20, 14], + [53, 42, 32, 24], + [78, 62, 46, 34], + [106, 84, 60, 44], + [134, 106, 74, 58], + [154, 122, 86, 64], + [192, 152, 108, 84], + [230, 180, 130, 98], + [271, 213, 151, 119], + [321, 251, 177, 137], + [367, 287, 203, 155], + [425, 331, 241, 177], + [458, 362, 258, 194], + [520, 412, 292, 220], + [586, 450, 322, 250], + [644, 504, 364, 280], + [718, 560, 394, 310], + [792, 624, 442, 338], + [858, 666, 482, 382], + [929, 711, 509, 403], + [1003, 779, 565, 439], + [1091, 857, 611, 461], + [1171, 911, 661, 511], + [1273, 997, 715, 535], + [1367, 1059, 751, 593], + [1465, 1125, 805, 625], + [1528, 1190, 868, 658], + [1628, 1264, 908, 698], + [1732, 1370, 982, 742], + [1840, 1452, 1030, 790], + [1952, 1538, 1112, 842], + [2068, 1628, 1168, 898], + [2188, 1722, 1228, 958], + [2303, 1809, 1283, 983], + [2431, 1911, 1351, 1051], + [2563, 1989, 1423, 1093], + [2699, 2099, 1499, 1139], + [2809, 2213, 1579, 1219], + [2953, 2331, 1663, 1273], + ]; + + function _isSupportCanvas() { + return typeof CanvasRenderingContext2D != 'undefined'; + } + + // android 2.x doesn't support Data-URI spec + function _getAndroid() { + var android = false; + var sAgent = navigator.userAgent; + + if (/android/i.test(sAgent)) { + // android + android = true; + var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); + + if (aMat && aMat[1]) { + android = parseFloat(aMat[1]); + } + } + + return android; + } + + var svgDrawer = (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + Drawing.prototype.draw = function (oQRCode) { var _htOption = this._htOption; var _el = this._el; - var nCount = oQRCode.getModuleCount(); - var nWidth = Math.floor(_htOption.width / nCount); - var nHeight = Math.floor(_htOption.height / nCount); - var aHTML = ['']; - - for (var row = 0; row < nCount; row++) { - aHTML.push(''); - - for (var col = 0; col < nCount; col++) { - aHTML.push(''); - } - - aHTML.push(''); - } - - aHTML.push('
'); - _el.innerHTML = aHTML.join(''); - - // Fix the margin values as real size. - var elTable = _el.childNodes[0]; - var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; - var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; - - if (nLeftMarginTable > 0 && nTopMarginTable > 0) { - elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px"; - } - }; - - /** - * Clear the QRCode - */ - Drawing.prototype.clear = function () { - this._el.innerHTML = ''; - }; - - return Drawing; - })() : (function () { // Drawing in Canvas - function _onMakeImage() { - this._elImage.src = this._elCanvas.toDataURL("image/png"); - this._elImage.style.display = "block"; - this._elCanvas.style.display = "none"; - } - - // Android 2.1 bug workaround - // http://code.google.com/p/android/issues/detail?id=5141 - if (this._android && this._android <= 2.1) { - var factor = 1 / window.devicePixelRatio; - var drawImage = CanvasRenderingContext2D.prototype.drawImage; - CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { - if (("nodeName" in image) && /img/i.test(image.nodeName)) { - for (var i = arguments.length - 1; i >= 1; i--) { - arguments[i] = arguments[i] * factor; - } - } else if (typeof dw == "undefined") { - arguments[1] *= factor; - arguments[2] *= factor; - arguments[3] *= factor; - arguments[4] *= factor; - } - - drawImage.apply(this, arguments); - }; - } - - /** - * Check whether the user's browser supports Data URI or not - * - * @private - * @param {Function} fSuccess Occurs if it supports Data URI - * @param {Function} fFail Occurs if it doesn't support Data URI - */ - function _safeSetDataURI(fSuccess, fFail) { - var self = this; - self._fFail = fFail; - self._fSuccess = fSuccess; - - // Check it just once - if (self._bSupportDataURI === null) { - var el = document.createElement("img"); - var fOnError = function() { - self._bSupportDataURI = false; - - if (self._fFail) { - self._fFail.call(self); + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + + this.clear(); + + function makeSVG(tag, attrs) { + var el = document.createElementNS('http://www.w3.org/2000/svg', tag); + for (var k in attrs) if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); + return el; + } + + var svg = makeSVG('svg', { + viewBox: '0 0 ' + String(nCount) + ' ' + String(nCount), + width: '100%', + height: '100%', + fill: _htOption.colorLight, + }); + svg.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink'); + _el.appendChild(svg); + + svg.appendChild(makeSVG('rect', { fill: _htOption.colorLight, width: '100%', height: '100%' })); + svg.appendChild(makeSVG('rect', { fill: _htOption.colorDark, width: '1', height: '1', id: 'template' })); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + if (oQRCode.isDark(row, col)) { + var child = makeSVG('use', { x: String(col), y: String(row) }); + child.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#template'); + svg.appendChild(child); + } + } + } + }; + Drawing.prototype.clear = function () { + while (this._el.hasChildNodes()) this._el.removeChild(this._el.lastChild); + }; + return Drawing; + })(); + + var useSVG = document.documentElement.tagName.toLowerCase() === 'svg'; + + // Drawing in DOM by using Table tag + var Drawing = useSVG + ? svgDrawer + : !_isSupportCanvas() + ? (function () { + var Drawing = function (el, htOption) { + this._el = el; + this._htOption = htOption; + }; + + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _htOption = this._htOption; + var _el = this._el; + var nCount = oQRCode.getModuleCount(); + var nWidth = Math.floor(_htOption.width / nCount); + var nHeight = Math.floor(_htOption.height / nCount); + var aHTML = ['']; + + for (var row = 0; row < nCount; row++) { + aHTML.push(''); + + for (var col = 0; col < nCount; col++) { + aHTML.push( + '', + ); + } + + aHTML.push(''); + } + + aHTML.push('
'); + _el.innerHTML = aHTML.join(''); + + // Fix the margin values as real size. + var elTable = _el.childNodes[0]; + var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2; + var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2; + + if (nLeftMarginTable > 0 && nTopMarginTable > 0) { + elTable.style.margin = nTopMarginTable + 'px ' + nLeftMarginTable + 'px'; } }; - var fOnSuccess = function() { - self._bSupportDataURI = true; - if (self._fSuccess) { + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._el.innerHTML = ''; + }; + + return Drawing; + })() + : (function () { + // Drawing in Canvas + function _onMakeImage() { + this._elImage.src = this._elCanvas.toDataURL('image/png'); + this._elImage.style.display = 'block'; + this._elCanvas.style.display = 'none'; + } + + // Android 2.1 bug workaround + // http://code.google.com/p/android/issues/detail?id=5141 + if (this._android && this._android <= 2.1) { + var factor = 1 / window.devicePixelRatio; + var drawImage = CanvasRenderingContext2D.prototype.drawImage; + CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) { + if ('nodeName' in image && /img/i.test(image.nodeName)) { + for (var i = arguments.length - 1; i >= 1; i--) { + arguments[i] = arguments[i] * factor; + } + } else if (typeof dw == 'undefined') { + arguments[1] *= factor; + arguments[2] *= factor; + arguments[3] *= factor; + arguments[4] *= factor; + } + + drawImage.apply(this, arguments); + }; + } + + /** + * Check whether the user's browser supports Data URI or not + * + * @private + * @param {Function} fSuccess Occurs if it supports Data URI + * @param {Function} fFail Occurs if it doesn't support Data URI + */ + function _safeSetDataURI(fSuccess, fFail) { + var self = this; + self._fFail = fFail; + self._fSuccess = fSuccess; + + // Check it just once + if (self._bSupportDataURI === null) { + var el = document.createElement('img'); + var fOnError = function () { + self._bSupportDataURI = false; + + if (self._fFail) { + self._fFail.call(self); + } + }; + var fOnSuccess = function () { + self._bSupportDataURI = true; + + if (self._fSuccess) { + self._fSuccess.call(self); + } + }; + + el.onabort = fOnError; + el.onerror = fOnError; + el.onload = fOnSuccess; + el.src = + 'data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='; // the Image contains 1px data. + return; + } else if (self._bSupportDataURI === true && self._fSuccess) { self._fSuccess.call(self); + } else if (self._bSupportDataURI === false && self._fFail) { + self._fFail.call(self); } + } + + /** + * Drawing QRCode by using canvas + * + * @constructor + * @param {HTMLElement} el + * @param {Object} htOption QRCode Options + */ + var Drawing = function (el, htOption) { + this._bIsPainted = false; + this._android = _getAndroid(); + + this._htOption = htOption; + this._elCanvas = document.createElement('canvas'); + this._elCanvas.width = htOption.width; + this._elCanvas.height = htOption.height; + el.appendChild(this._elCanvas); + this._el = el; + this._oContext = this._elCanvas.getContext('2d'); + this._bIsPainted = false; + this._elImage = document.createElement('img'); + this._elImage.alt = 'Scan me!'; + this._elImage.style.display = 'none'; + this._el.appendChild(this._elImage); + this._bSupportDataURI = null; }; - el.onabort = fOnError; - el.onerror = fOnError; - el.onload = fOnSuccess; - el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data. - return; - } else if (self._bSupportDataURI === true && self._fSuccess) { - self._fSuccess.call(self); - } else if (self._bSupportDataURI === false && self._fFail) { - self._fFail.call(self); - } - }; - - /** - * Drawing QRCode by using canvas - * - * @constructor - * @param {HTMLElement} el - * @param {Object} htOption QRCode Options - */ - var Drawing = function (el, htOption) { - this._bIsPainted = false; - this._android = _getAndroid(); - - this._htOption = htOption; - this._elCanvas = document.createElement("canvas"); - this._elCanvas.width = htOption.width; - this._elCanvas.height = htOption.height; - el.appendChild(this._elCanvas); - this._el = el; - this._oContext = this._elCanvas.getContext("2d"); - this._bIsPainted = false; - this._elImage = document.createElement("img"); - this._elImage.alt = "Scan me!"; - this._elImage.style.display = "none"; - this._el.appendChild(this._elImage); - this._bSupportDataURI = null; - }; - - /** - * Draw the QRCode - * - * @param {QRCode} oQRCode - */ - Drawing.prototype.draw = function (oQRCode) { - var _elImage = this._elImage; - var _oContext = this._oContext; - var _htOption = this._htOption; - - var nCount = oQRCode.getModuleCount(); - var nWidth = _htOption.width / nCount; - var nHeight = _htOption.height / nCount; - var nRoundedWidth = Math.round(nWidth); - var nRoundedHeight = Math.round(nHeight); - - _elImage.style.display = "none"; - this.clear(); - - for (var row = 0; row < nCount; row++) { - for (var col = 0; col < nCount; col++) { - var bIsDark = oQRCode.isDark(row, col); - var nLeft = col * nWidth; - var nTop = row * nHeight; - _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; - _oContext.lineWidth = 1; - _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; - _oContext.fillRect(nLeft, nTop, nWidth, nHeight); - - // 안티 앨리어싱 방지 처리 - _oContext.strokeRect( - Math.floor(nLeft) + 0.5, - Math.floor(nTop) + 0.5, - nRoundedWidth, - nRoundedHeight - ); - - _oContext.strokeRect( - Math.ceil(nLeft) - 0.5, - Math.ceil(nTop) - 0.5, - nRoundedWidth, - nRoundedHeight - ); - } - } - - this._bIsPainted = true; - }; - - /** - * Make the image from Canvas if the browser supports Data URI. - */ - Drawing.prototype.makeImage = function () { - if (this._bIsPainted) { - _safeSetDataURI.call(this, _onMakeImage); - } - }; - - /** - * Return whether the QRCode is painted or not - * - * @return {Boolean} - */ - Drawing.prototype.isPainted = function () { - return this._bIsPainted; - }; - - /** - * Clear the QRCode - */ - Drawing.prototype.clear = function () { - this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); - this._bIsPainted = false; - }; - - /** - * @private - * @param {Number} nNumber - */ - Drawing.prototype.round = function (nNumber) { - if (!nNumber) { - return nNumber; - } - - return Math.floor(nNumber * 1000) / 1000; - }; - - return Drawing; - })(); - - /** - * Get the type by string length - * - * @private - * @param {String} sText - * @param {Number} nCorrectLevel - * @return {Number} type - */ - function _getTypeNumber(sText, nCorrectLevel) { - var nType = 1; - var length = _getUTF8Length(sText); - - for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { - var nLimit = 0; - - switch (nCorrectLevel) { - case QRErrorCorrectLevel.L : - nLimit = QRCodeLimitLength[i][0]; - break; - case QRErrorCorrectLevel.M : - nLimit = QRCodeLimitLength[i][1]; - break; - case QRErrorCorrectLevel.Q : - nLimit = QRCodeLimitLength[i][2]; - break; - case QRErrorCorrectLevel.H : - nLimit = QRCodeLimitLength[i][3]; - break; - } - - if (length <= nLimit) { - break; - } else { - nType++; - } - } - - if (nType > QRCodeLimitLength.length) { - throw new Error("Too long data"); - } - - return nType; - } - - function _getUTF8Length(sText) { - var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); - return replacedText.length + (replacedText.length != sText ? 3 : 0); - } - - /** - * @class QRCode - * @constructor - * @example - * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); - * - * @example - * var oQRCode = new QRCode("test", { - * text : "http://naver.com", - * width : 128, - * height : 128 - * }); - * - * oQRCode.clear(); // Clear the QRCode. - * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. - * - * @param {HTMLElement|String} el target element or 'id' attribute of element. - * @param {Object|String} vOption - * @param {String} vOption.text QRCode link data - * @param {Number} [vOption.width=256] - * @param {Number} [vOption.height=256] - * @param {String} [vOption.colorDark="#000000"] - * @param {String} [vOption.colorLight="#ffffff"] - * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] - */ - QRCode = function (el, vOption) { - this._htOption = { - width : 256, - height : 256, - typeNumber : 4, - colorDark : "#000000", - colorLight : "#ffffff", - correctLevel : QRErrorCorrectLevel.H - }; - - if (typeof vOption === 'string') { - vOption = { - text : vOption - }; - } - - // Overwrites options - if (vOption) { - for (var i in vOption) { - this._htOption[i] = vOption[i]; - } - } - - if (typeof el == "string") { - el = document.getElementById(el); - } - - if (this._htOption.useSVG) { - Drawing = svgDrawer; - } - - this._android = _getAndroid(); - this._el = el; - this._oQRCode = null; - this._oDrawing = new Drawing(this._el, this._htOption); - - if (this._htOption.text) { - this.makeCode(this._htOption.text); - } - }; - - /** - * Make the QRCode - * - * @param {String} sText link data - */ - QRCode.prototype.makeCode = function (sText) { - this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel); - this._oQRCode.addData(sText); - this._oQRCode.make(); - this._el.title = sText; - this._oDrawing.draw(this._oQRCode); - this.makeImage(); - }; - - /** - * Make the Image from Canvas element - * - It occurs automatically - * - Android below 3 doesn't support Data-URI spec. - * - * @private - */ - QRCode.prototype.makeImage = function () { - if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) { - this._oDrawing.makeImage(); - } - }; - - /** - * Clear the QRCode - */ - QRCode.prototype.clear = function () { - this._oDrawing.clear(); - }; - - /** - * @name QRCode.CorrectLevel - */ - QRCode.CorrectLevel = QRErrorCorrectLevel; -})(); \ No newline at end of file + /** + * Draw the QRCode + * + * @param {QRCode} oQRCode + */ + Drawing.prototype.draw = function (oQRCode) { + var _elImage = this._elImage; + var _oContext = this._oContext; + var _htOption = this._htOption; + + var nCount = oQRCode.getModuleCount(); + var nWidth = _htOption.width / nCount; + var nHeight = _htOption.height / nCount; + var nRoundedWidth = Math.round(nWidth); + var nRoundedHeight = Math.round(nHeight); + + _elImage.style.display = 'none'; + this.clear(); + + for (var row = 0; row < nCount; row++) { + for (var col = 0; col < nCount; col++) { + var bIsDark = oQRCode.isDark(row, col); + var nLeft = col * nWidth; + var nTop = row * nHeight; + _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.lineWidth = 1; + _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight; + _oContext.fillRect(nLeft, nTop, nWidth, nHeight); + + // 안티 앨리어싱 방지 처리 + _oContext.strokeRect( + Math.floor(nLeft) + 0.5, + Math.floor(nTop) + 0.5, + nRoundedWidth, + nRoundedHeight, + ); + + _oContext.strokeRect( + Math.ceil(nLeft) - 0.5, + Math.ceil(nTop) - 0.5, + nRoundedWidth, + nRoundedHeight, + ); + } + } + + this._bIsPainted = true; + }; + + /** + * Make the image from Canvas if the browser supports Data URI. + */ + Drawing.prototype.makeImage = function () { + if (this._bIsPainted) { + _safeSetDataURI.call(this, _onMakeImage); + } + }; + + /** + * Return whether the QRCode is painted or not + * + * @return {Boolean} + */ + Drawing.prototype.isPainted = function () { + return this._bIsPainted; + }; + + /** + * Clear the QRCode + */ + Drawing.prototype.clear = function () { + this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height); + this._bIsPainted = false; + }; + + /** + * @private + * @param {Number} nNumber + */ + Drawing.prototype.round = function (nNumber) { + if (!nNumber) { + return nNumber; + } + + return Math.floor(nNumber * 1000) / 1000; + }; + + return Drawing; + })(); + + /** + * Get the type by string length + * + * @private + * @param {String} sText + * @param {Number} nCorrectLevel + * @return {Number} type + */ + function _getTypeNumber(sText, nCorrectLevel) { + var nType = 1; + var length = _getUTF8Length(sText); + + for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { + var nLimit = 0; + + switch (nCorrectLevel) { + case QRErrorCorrectLevel.L: + nLimit = QRCodeLimitLength[i][0]; + break; + case QRErrorCorrectLevel.M: + nLimit = QRCodeLimitLength[i][1]; + break; + case QRErrorCorrectLevel.Q: + nLimit = QRCodeLimitLength[i][2]; + break; + case QRErrorCorrectLevel.H: + nLimit = QRCodeLimitLength[i][3]; + break; + } + + if (length <= nLimit) { + break; + } else { + nType++; + } + } + + if (nType > QRCodeLimitLength.length) { + throw new Error('Too long data'); + } + + return nType; + } + + function _getUTF8Length(sText) { + var replacedText = encodeURI(sText) + .toString() + .replace(/\%[0-9a-fA-F]{2}/g, 'a'); + return replacedText.length + (replacedText.length != sText ? 3 : 0); + } + + /** + * @class QRCode + * @constructor + * @example + * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie"); + * + * @example + * var oQRCode = new QRCode("test", { + * text : "http://naver.com", + * width : 128, + * height : 128 + * }); + * + * oQRCode.clear(); // Clear the QRCode. + * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode. + * + * @param {HTMLElement|String} el target element or 'id' attribute of element. + * @param {Object|String} vOption + * @param {String} vOption.text QRCode link data + * @param {Number} [vOption.width=256] + * @param {Number} [vOption.height=256] + * @param {String} [vOption.colorDark="#000000"] + * @param {String} [vOption.colorLight="#ffffff"] + * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H] + */ + QRCode = function (el, vOption) { + this._htOption = { + width: 256, + height: 256, + typeNumber: 4, + colorDark: '#000000', + colorLight: '#ffffff', + correctLevel: QRErrorCorrectLevel.H, + }; + + if (typeof vOption === 'string') { + vOption = { + text: vOption, + }; + } + + // Overwrites options + if (vOption) { + for (var i in vOption) { + this._htOption[i] = vOption[i]; + } + } + + if (typeof el == 'string') { + el = document.getElementById(el); + } + + if (this._htOption.useSVG) { + Drawing = svgDrawer; + } + + this._android = _getAndroid(); + this._el = el; + this._oQRCode = null; + this._oDrawing = new Drawing(this._el, this._htOption); + + if (this._htOption.text) { + this.makeCode(this._htOption.text); + } + }; + + /** + * Make the QRCode + * + * @param {String} sText link data + */ + QRCode.prototype.makeCode = function (sText) { + this._oQRCode = new QRCodeModel( + _getTypeNumber(sText, this._htOption.correctLevel), + this._htOption.correctLevel, + ); + this._oQRCode.addData(sText); + this._oQRCode.make(); + this._el.title = sText; + this._oDrawing.draw(this._oQRCode); + this.makeImage(); + }; + + /** + * Make the Image from Canvas element + * - It occurs automatically + * - Android below 3 doesn't support Data-URI spec. + * + * @private + */ + QRCode.prototype.makeImage = function () { + if (typeof this._oDrawing.makeImage == 'function' && (!this._android || this._android >= 3)) { + this._oDrawing.makeImage(); + } + }; + + /** + * Clear the QRCode + */ + QRCode.prototype.clear = function () { + this._oDrawing.clear(); + }; + + /** + * @name QRCode.CorrectLevel + */ + QRCode.CorrectLevel = QRErrorCorrectLevel; +})(); diff --git a/xiaon_c5z3Cp/static/sanfang.js b/xiaon_c5z3Cp/static/sanfang.js index cd9cacb..694af85 100644 --- a/xiaon_c5z3Cp/static/sanfang.js +++ b/xiaon_c5z3Cp/static/sanfang.js @@ -1,179 +1,180 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getSubscribe() - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getSubscribe(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求订阅地址接口*/ -function getSubscribe(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/getSubscribe'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseSubscribe); +function getSubscribe() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/getSubscribe'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseSubscribe); } /*响应订阅地址信息*/ var subscribe_dict = {}; -function responseSubscribe(code,data){ - if (code == '200') { - console.log(JSON.parse(data).data.subscribe_url); - let a = JSON.parse(data).data.subscribe_url; - let aa = encodeURIComponent(JSON.parse(data).data.subscribe_url);//URLencode的地址 - let b = 'XIAON机场'; - let bb = encodeURIComponent('XIAON机场'); - let c = 'clash://install-config?url='+a+'&name='+b; //ClashX - let d = 'clash://install-config?url='+aa+'&name='+bb; //clash for windows - let e = 'clash://install-config?url='+aa+'&name='+bb; //clash for android - let f = 'surge:///install-config?url='+aa+'&name='+bb; //surfboard for android - let g = 'surge:///install-config?url='+aa+'&name='+bb; //surge for ios - let h = 'stash://install-config?url='+aa+'&name='+bb; //stash for ios - let i = 'quantumult-x:///update-configuration?remote-resource=%7B%22server_remote%22%3A%5B%22'+a+'%2C%20tag%3D'+bb+'%22%5D%7D';//QX for ios - let j = Base64.encode(a+'&flag=shadowrocket'); - let k = 'shadowrocket://add/sub://'+j+'?remark='+bb; //小火箭 - subscribe_dict['clashx'] = c; - subscribe_dict['clashwindows'] = d; - subscribe_dict['clashandroid'] = e; - subscribe_dict['surfboard'] = f; - subscribe_dict['surge'] = g; - subscribe_dict['stash'] = h; - subscribe_dict['qx'] = i; - subscribe_dict['shadowsrocket'] = k; - subscribe_dict['base64'] = a; - console.log(subscribe_dict); - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseSubscribe(code, data) { + if (code == '200') { + console.log(JSON.parse(data).data.subscribe_url); + let a = JSON.parse(data).data.subscribe_url; + let aa = encodeURIComponent(JSON.parse(data).data.subscribe_url); //URLencode的地址 + let b = 'XIAON机场'; + let bb = encodeURIComponent('XIAON机场'); + let c = 'clash://install-config?url=' + a + '&name=' + b; //ClashX + let d = 'clash://install-config?url=' + aa + '&name=' + bb; //clash for windows + let e = 'clash://install-config?url=' + aa + '&name=' + bb; //clash for android + let f = 'surge:///install-config?url=' + aa + '&name=' + bb; //surfboard for android + let g = 'surge:///install-config?url=' + aa + '&name=' + bb; //surge for ios + let h = 'stash://install-config?url=' + aa + '&name=' + bb; //stash for ios + let i = + 'quantumult-x:///update-configuration?remote-resource=%7B%22server_remote%22%3A%5B%22' + + a + + '%2C%20tag%3D' + + bb + + '%22%5D%7D'; //QX for ios + let j = Base64.encode(a + '&flag=shadowrocket'); + let k = 'shadowrocket://add/sub://' + j + '?remark=' + bb; //小火箭 + subscribe_dict['clashx'] = c; + subscribe_dict['clashwindows'] = d; + subscribe_dict['clashandroid'] = e; + subscribe_dict['surfboard'] = f; + subscribe_dict['surge'] = g; + subscribe_dict['stash'] = h; + subscribe_dict['qx'] = i; + subscribe_dict['shadowsrocket'] = k; + subscribe_dict['base64'] = a; + console.log(subscribe_dict); + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } - - // Base64 编解码 let Base64 = { -encode(str) { - return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, - function toSolidBytes(match, p1) { - return String.fromCharCode('0x' + p1); - })); -}, -decode(str) { - // Going backwards: from bytestream, to percent-encoding, to original string. - return decodeURIComponent(atob(str).split('').map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); -} -} + encode(str) { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) { + return String.fromCharCode('0x' + p1); + }), + ); + }, + decode(str) { + // Going backwards: from bytestream, to percent-encoding, to original string. + return decodeURIComponent( + atob(str) + .split('') + .map(function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + }) + .join(''), + ); + }, +}; // 复制函数 -function copy (text) { - // text是复制文本 - // 创建input元素 - const el = document.createElement('input'); - // 给input元素赋值需要复制的文本 - el.setAttribute('value', text); - // 将input元素插入页面 - document.body.appendChild(el); - // 选中input元素的文本 - el.select(); - // 复制内容到剪贴板 - document.execCommand('copy'); - // 删除input元素 - document.body.removeChild(el); - +function copy(text) { + // text是复制文本 + // 创建input元素 + const el = document.createElement('input'); + // 给input元素赋值需要复制的文本 + el.setAttribute('value', text); + // 将input元素插入页面 + document.body.appendChild(el); + // 选中input元素的文本 + el.select(); + // 复制内容到剪贴板 + document.execCommand('copy'); + // 删除input元素 + document.body.removeChild(el); } //复制base64 -function copybase64(appname){ - let a = subscribe_dict[appname]; - copy (a); - tan('right','已复制成功'); +function copybase64(appname) { + let a = subscribe_dict[appname]; + copy(a); + tan('right', '已复制成功'); } //打开qrcode -function openqrcode(){ - console.log('daoh'); - new QRCode(document.getElementById('qrcode'), subscribe_dict['base64']); - let a = document.getElementById('tan-qrcode-zhezhao'); - a.style.display = 'block'; +function openqrcode() { + console.log('daoh'); + new QRCode(document.getElementById('qrcode'), subscribe_dict['base64']); + let a = document.getElementById('tan-qrcode-zhezhao'); + a.style.display = 'block'; } //隐藏qrcode -function closeqrcode(){ - let a = document.getElementById('tan-qrcode-zhezhao'); - a.style.display = 'none'; - let b = document.getElementById('qrcode'); - b.innerHTML = ''; +function closeqrcode() { + let a = document.getElementById('tan-qrcode-zhezhao'); + a.style.display = 'none'; + let b = document.getElementById('qrcode'); + b.innerHTML = ''; } //导入三方应用base64 -function daoruapp(appname){ - let a = subscribe_dict[appname]; - window.location.href = a; -} \ No newline at end of file +function daoruapp(appname) { + let a = subscribe_dict[appname]; + window.location.href = a; +} diff --git a/xiaon_c5z3Cp/static/setting.js b/xiaon_c5z3Cp/static/setting.js index 9d62556..35174d9 100644 --- a/xiaon_c5z3Cp/static/setting.js +++ b/xiaon_c5z3Cp/static/setting.js @@ -1,282 +1,259 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getconfig() - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getconfig(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - console.log(params); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + console.log(params); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ var kaiguan_status = { - remind_expire : '1', - remind_traffic : '1' -} -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - let b = document.getElementById('set_big_price'); - a.innerHTML = JSON.parse(data).data.email; - b.innerHTML = '¥'+JSON.parse(data).data.balance/100; - let c = JSON.parse(data).data.remind_expire; - let d = JSON.parse(data).data.remind_traffic; - kaiguan_status['remind_expire'] = c; - kaiguan_status['remind_traffic'] = d; - kaiguan('remind_expire',c); - kaiguan('remind_traffic',d); - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } + remind_expire: '1', + remind_traffic: '1', +}; +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + let b = document.getElementById('set_big_price'); + a.innerHTML = JSON.parse(data).data.email; + b.innerHTML = '¥' + JSON.parse(data).data.balance / 100; + let c = JSON.parse(data).data.remind_expire; + let d = JSON.parse(data).data.remind_traffic; + kaiguan_status['remind_expire'] = c; + kaiguan_status['remind_traffic'] = d; + kaiguan('remind_expire', c); + kaiguan('remind_traffic', d); + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求配置信息接口*/ -function getconfig(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/comm/config'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseconfig); +function getconfig() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/comm/config'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseconfig); } /*响应个人信息*/ function responseconfig(code, data) { - if (code == '200') { - let a = JSON.parse(data).data.telegram_discuss_link; - let b = document.getElementById('jiaru_telegram'); - if (a === null || a === "null") { - // 如果 a 为 null 或 "null",则移除 onclick 属性 - b.removeAttribute('onclick'); - let linkElement = document.querySelector('.set_des_group a'); - if (linkElement) { - let linkHref = linkElement.getAttribute('href'); - if (linkHref !== null) { - b.addEventListener('click', function() { - window.location.href = linkHref; - }); + if (code == '200') { + let a = JSON.parse(data).data.telegram_discuss_link; + let b = document.getElementById('jiaru_telegram'); + if (a === null || a === 'null') { + // 如果 a 为 null 或 "null",则移除 onclick 属性 + b.removeAttribute('onclick'); + let linkElement = document.querySelector('.set_des_group a'); + if (linkElement) { + let linkHref = linkElement.getAttribute('href'); + if (linkHref !== null) { + b.addEventListener('click', function () { + window.location.href = linkHref; + }); + } + } + } else { + // 如果 a 不为 null 或 "null",则设置 onclick 为 a 的值 + b.setAttribute('onclick', 'window.location.href = "' + a + '"'); } - } + canceltanjiazai(); } else { - // 如果 a 不为 null 或 "null",则设置 onclick 为 a 的值 - b.setAttribute('onclick', 'window.location.href = "' + a + '"'); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } else { - tan('cuowu', '当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } - //设置开关函数 -function kaiguan(id,type) { - let a = document.getElementById(id); - if(type == '0'){ - a.setAttribute('class','geren_kaiguan_guan'); - console.log(a.childNodes); - a.childNodes[1].setAttribute('class','geren_kaiguan_qiu_guan'); - } - else { - a.setAttribute('class','geren_kaiguan'); - console.log(a.childNodes); - a.childNodes[1].setAttribute('class','geren_kaiguan_qiu'); - } +function kaiguan(id, type) { + let a = document.getElementById(id); + if (type == '0') { + a.setAttribute('class', 'geren_kaiguan_guan'); + console.log(a.childNodes); + a.childNodes[1].setAttribute('class', 'geren_kaiguan_qiu_guan'); + } else { + a.setAttribute('class', 'geren_kaiguan'); + console.log(a.childNodes); + a.childNodes[1].setAttribute('class', 'geren_kaiguan_qiu'); + } } - /*提交切换开关*/ -function qiehuankaiguan(zhi){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/update'; - var params = {}; - if (zhi == 'remind_expire'){ - if(kaiguan_status[zhi]=='0'){ - params = {remind_expire : '1'} - } - else { - params = {remind_expire : '0'} - } - } - if (zhi == 'remind_traffic'){ - console.log('流量开关'); - if(kaiguan_status[zhi]=='0'){ - params = {remind_traffic : '1'} +function qiehuankaiguan(zhi) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/update'; + var params = {}; + if (zhi == 'remind_expire') { + if (kaiguan_status[zhi] == '0') { + params = { remind_expire: '1' }; + } else { + params = { remind_expire: '0' }; + } } - else { - params = {remind_traffic : '0'} + if (zhi == 'remind_traffic') { + console.log('流量开关'); + if (kaiguan_status[zhi] == '0') { + params = { remind_traffic: '1' }; + } else { + params = { remind_traffic: '0' }; + } } - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responseqiehuankaiguan); - + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responseqiehuankaiguan); } /*响应切换开关*/ -function responseqiehuankaiguan(code,data){ - if (code == '200') { - tan('right','操作成功'); - getinfo(); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responseqiehuankaiguan(code, data) { + if (code == '200') { + tan('right', '操作成功'); + getinfo(); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } - /*请求重置接口*/ -function resetconfig(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/resetSecurity'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseresetconfig); +function resetconfig() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/resetSecurity'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseresetconfig); } /*响应个人信息*/ -function responseresetconfig(code,data){ - if (code == '200') { - tan('right','重置成功'); - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseresetconfig(code, data) { + if (code == '200') { + tan('right', '重置成功'); + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } //打开密码窗口 function openmima() { - let a = document.getElementById('xiugaimima'); - a.style.display = 'flex'; + let a = document.getElementById('xiugaimima'); + a.style.display = 'flex'; } //关闭密码窗口 function closemima() { - let a = document.getElementById('xiugaimima'); - a.style.display = 'none'; + let a = document.getElementById('xiugaimima'); + a.style.display = 'none'; } - - /*确认修改密码*/ -function querenxiugai(zhi){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/changePassword'; - var a = document.getElementById('oldmima'); - var b = document.getElementById('newmima'); - var c = document.getElementById('repetnewmima'); - if ( b.value != c.value) { - tan('cuowu','两次输入的密码不一致'); - } - else { - let params = { - old_password : a.value, - new_password : b.value +function querenxiugai(zhi) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/changePassword'; + var a = document.getElementById('oldmima'); + var b = document.getElementById('newmima'); + var c = document.getElementById('repetnewmima'); + if (b.value != c.value) { + tan('cuowu', '两次输入的密码不一致'); + } else { + let params = { + old_password: a.value, + new_password: b.value, + }; + tanjiazai(); + jsonlink(mode, link, params, responsequerenxiugai); } - tanjiazai(); - jsonlink(mode,link,params,responsequerenxiugai); - } } /*响应修改密码*/ -function responsequerenxiugai(code,data){ - if (code == '200') { - tan('right','密码修改成功'); - closemima(); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsequerenxiugai(code, data) { + if (code == '200') { + tan('right', '密码修改成功'); + closemima(); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } diff --git a/xiaon_c5z3Cp/static/shop.js b/xiaon_c5z3Cp/static/shop.js index 3d6e167..9104610 100644 --- a/xiaon_c5z3Cp/static/shop.js +++ b/xiaon_c5z3Cp/static/shop.js @@ -1,171 +1,161 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getdingyue(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getdingyue(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); - } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求订阅信息接口*/ -function getdingyue(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/plan/fetch'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsedingyue); +function getdingyue() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/plan/fetch'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsedingyue); } /*响应个人信息*/ -function responsedingyue(code,data){ - if (code == '200') { - let a = JSON.parse(data).data; - let aa = document.getElementById('shop_timepay'); - let bb = document.getElementById('shop_onetimepay'); - aa.innerHTML = ''; - bb.innerHTML = ''; +function responsedingyue(code, data) { + if (code == '200') { + let a = JSON.parse(data).data; + let aa = document.getElementById('shop_timepay'); + let bb = document.getElementById('shop_onetimepay'); + aa.innerHTML = ''; + bb.innerHTML = ''; - for(x in a) { - if (a[x].onetime_price == null){ - let b = document.createElement('div'); - let c = document.createElement('div'); - c.setAttribute('class','shop_title'); - let d = document.createElement('div'); - d.setAttribute('class','shop_price'); - let e = document.createElement('div'); - e.setAttribute('class','shop_meiyue'); - let f = document.createElement('button'); - f.setAttribute('class','shop_button'); - let g = document.createElement('div'); - g.setAttribute('class','shop_content'); - let h = document.getElementById('shop_timepay'); - - if(a[x].content.slice(0,4)=='年付特惠'){ - b.setAttribute('class','shop_box_tehui'); - d.innerHTML = '¥'+(a[x].year_price/100/12).toFixed(2); - d.style.color = '#0360df'; - } - else { - b.setAttribute('class','shop_box'); - d.innerHTML = '¥'+(a[x].month_price/100).toFixed(2); + for (x in a) { + if (a[x].onetime_price == null) { + let b = document.createElement('div'); + let c = document.createElement('div'); + c.setAttribute('class', 'shop_title'); + let d = document.createElement('div'); + d.setAttribute('class', 'shop_price'); + let e = document.createElement('div'); + e.setAttribute('class', 'shop_meiyue'); + let f = document.createElement('button'); + f.setAttribute('class', 'shop_button'); + let g = document.createElement('div'); + g.setAttribute('class', 'shop_content'); + let h = document.getElementById('shop_timepay'); + + if (a[x].content.slice(0, 4) == '年付特惠') { + b.setAttribute('class', 'shop_box_tehui'); + d.innerHTML = '¥' + (a[x].year_price / 100 / 12).toFixed(2); + d.style.color = '#0360df'; + } else { + b.setAttribute('class', 'shop_box'); + d.innerHTML = '¥' + (a[x].month_price / 100).toFixed(2); + } + + c.innerHTML = a[x].name; + e.innerHTML = '每月'; + f.setAttribute('value', a[x].id); + f.innerHTML = '立即购买'; + f.setAttribute('onclick', 'godingyuepeizhi(this.value)'); + g.innerHTML = a[x].content; + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + h.appendChild(b); + console.log('月' + x); + } else { + let b = document.createElement('div'); + b.setAttribute('class', 'shop_box'); + let c = document.createElement('div'); + c.setAttribute('class', 'shop_title'); + let d = document.createElement('div'); + d.setAttribute('class', 'shop_price'); + let e = document.createElement('div'); + e.setAttribute('class', 'shop_meiyue'); + let f = document.createElement('button'); + f.setAttribute('class', 'shop_button'); + let g = document.createElement('div'); + g.setAttribute('class', 'shop_content'); + + let i = document.getElementById('shop_onetimepay'); + c.innerHTML = a[x].name; + d.innerHTML = '$' + (a[x].onetime_price / 100 / 7).toFixed(2); + e.innerHTML = '一次性'; + f.setAttribute('value', a[x].id); + f.innerHTML = '立即购买'; + f.setAttribute('onclick', 'godingyuepeizhi(this.value)'); + g.innerHTML = a[x].content; + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + i.appendChild(b); + console.log('次' + x); + } } - - c.innerHTML = a[x].name; - e.innerHTML = '每月'; - f.setAttribute('value',a[x].id); - f.innerHTML = '立即购买'; - f.setAttribute('onclick','godingyuepeizhi(this.value)'); - g.innerHTML =a[x].content; - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - h.appendChild(b); - console.log('月'+x); - } - else { - let b = document.createElement('div'); - b.setAttribute('class','shop_box'); - let c = document.createElement('div'); - c.setAttribute('class','shop_title'); - let d = document.createElement('div'); - d.setAttribute('class','shop_price'); - let e = document.createElement('div'); - e.setAttribute('class','shop_meiyue'); - let f = document.createElement('button'); - f.setAttribute('class','shop_button'); - let g = document.createElement('div'); - g.setAttribute('class','shop_content'); - - let i = document.getElementById('shop_onetimepay'); - c.innerHTML = a[x].name; - d.innerHTML = '$'+(a[x].onetime_price/100/7).toFixed(2); - e.innerHTML = '一次性'; - f.setAttribute('value',a[x].id); - f.innerHTML = '立即购买'; - f.setAttribute('onclick','godingyuepeizhi(this.value)'); - g.innerHTML =a[x].content; - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - i.appendChild(b); - console.log('次'+x); - } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } - //进入到订阅配置页面 -function godingyuepeizhi(planid){ - window.location.href='./shop_peizhi.html?planid='+planid; -} \ No newline at end of file +function godingyuepeizhi(planid) { + window.location.href = './shop_peizhi.html?planid=' + planid; +} diff --git a/xiaon_c5z3Cp/static/shop_peizhi.js b/xiaon_c5z3Cp/static/shop_peizhi.js index 77a90a1..ac0bba4 100644 --- a/xiaon_c5z3Cp/static/shop_peizhi.js +++ b/xiaon_c5z3Cp/static/shop_peizhi.js @@ -1,6 +1,6 @@ /*启动检测与页面初始化localStorage*/ function bootcheck() { - let a = localStorage.getItem("authorization"); + let a = localStorage.getItem('authorization'); if (a) { getinfo(); //getdingyue(); @@ -10,20 +10,20 @@ function bootcheck() { } } -var domain = ""; +var domain = ''; /*网络请求*/ function jsonlink(mode, link, params, callback) { - var auth = localStorage.getItem("authorization"); + var auth = localStorage.getItem('authorization'); var xmlHttp = new XMLHttpRequest(); //let requesetjson; xmlHttp.open(mode, link, true); - if (mode == "POST") { - xmlHttp.setRequestHeader("content-type", "application/json"); - xmlHttp.setRequestHeader("authorization", auth); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(JSON.stringify(params)); } else { - xmlHttp.setRequestHeader("authorization", auth); + xmlHttp.setRequestHeader('authorization', auth); xmlHttp.send(); } xmlHttp.onreadystatechange = function () { @@ -36,129 +36,116 @@ function jsonlink(mode, link, params, callback) { } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 callback(xmlHttp.status, json); - } else if ( - xmlHttp.readyState != 4 && - xmlHttp.status != 500 && - xmlHttp.status != 200 && - xmlHttp.status != 422 - ) { + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { var json = xmlHttp.responseText; //获取到服务端返回的数据 - callback(xmlHttp.status, "001"); + callback(xmlHttp.status, '001'); } }; } /*请求个人信息接口*/ function getinfo() { - let mode = "GET"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/info"; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ function responseinfo(code, data) { - if (code == "200") { - let a = document.getElementById("logout_words"); + if (code == '200') { + let a = document.getElementById('logout_words'); a.innerHTML = JSON.parse(data).data.email; canceltanjiazai(); } else { - tan("cuowu", "当前网络不稳定,请刷新页面重试"); + tan('cuowu', '当前网络不稳定,请刷新页面重试'); canceltanjiazai(); } } /*请求订阅信息接口*/ function getdingyue(planid) { - let mode = "GET"; - let link = - domain + "https://ovc.xiaon.life/api/v1/user/plan/fetch?id=" + planid; - let params = ""; + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/plan/fetch?id=' + planid; + let params = ''; tanjiazai(); jsonlink(mode, link, params, responsedingyue); } /*响应订阅信息*/ function responsedingyue(code, data) { - if (code == "200") { - let a = document.getElementById("shop_peizhi_title"); + if (code == '200') { + let a = document.getElementById('shop_peizhi_title'); a.innerHTML = JSON.parse(data).data.name; - let b = document.getElementById("shop_peizhi_des"); + let b = document.getElementById('shop_peizhi_des'); b.innerHTML = JSON.parse(data).data.content; - let jihuamingcheng = document.getElementById("jihuamingcheng"); + let jihuamingcheng = document.getElementById('jihuamingcheng'); jihuamingcheng.innerHTML = JSON.parse(data).data.name; let price_group = {}; if (JSON.parse(data).data.month_price != null) { - price_group["month_price"] = JSON.parse(data).data.month_price; + price_group['month_price'] = JSON.parse(data).data.month_price; } if (JSON.parse(data).data.quarter_price != null) { - price_group["quarter_price"] = JSON.parse(data).data.quarter_price; + price_group['quarter_price'] = JSON.parse(data).data.quarter_price; } if (JSON.parse(data).data.half_year_price != null) { - price_group["half_year_price"] = JSON.parse( - data - ).data.half_year_price; + price_group['half_year_price'] = JSON.parse(data).data.half_year_price; } if (JSON.parse(data).data.year_price != null) { - price_group["year_price"] = JSON.parse(data).data.year_price; + price_group['year_price'] = JSON.parse(data).data.year_price; } if (JSON.parse(data).data.two_year_price != null) { - price_group["two_year_price"] = JSON.parse( - data - ).data.two_year_price; + price_group['two_year_price'] = JSON.parse(data).data.two_year_price; } if (JSON.parse(data).data.three_year_price != null) { - price_group["three_year_price"] = JSON.parse( - data - ).data.three_year_price; + price_group['three_year_price'] = JSON.parse(data).data.three_year_price; } if (JSON.parse(data).data.onetime_price != null) { - price_group["onetime_price"] = JSON.parse(data).data.onetime_price; + price_group['onetime_price'] = JSON.parse(data).data.onetime_price; } - let c = document.getElementById("shop_peizhi_jine"); - if (qidongcanshu["type"] == "chongzhi") { - let d = document.createElement("div"); - d.setAttribute("class", "peizhi_jine_option"); - d.setAttribute("id", "reset_price"); - d.setAttribute("onclick", "switchchoose(this.id)"); - let e = document.createElement("p"); - e.setAttribute("class", "peizhi_jine_name"); - let f = document.createElement("p"); - f.setAttribute("class", "peizhi_jine_price"); - e.innerHTML = zhouqi["reset_price"]; - f.innerHTML = - "¥" + (JSON.parse(data).data.reset_price / 100).toFixed(2); + let c = document.getElementById('shop_peizhi_jine'); + if (qidongcanshu['type'] == 'chongzhi') { + let d = document.createElement('div'); + d.setAttribute('class', 'peizhi_jine_option'); + d.setAttribute('id', 'reset_price'); + d.setAttribute('onclick', 'switchchoose(this.id)'); + let e = document.createElement('p'); + e.setAttribute('class', 'peizhi_jine_name'); + let f = document.createElement('p'); + f.setAttribute('class', 'peizhi_jine_price'); + e.innerHTML = zhouqi['reset_price']; + f.innerHTML = '¥' + (JSON.parse(data).data.reset_price / 100).toFixed(2); d.appendChild(e); d.appendChild(f); c.appendChild(d); } else { for (var x in price_group) { - let d = document.createElement("div"); - d.setAttribute("class", "peizhi_jine_option"); - d.setAttribute("id", x); - d.setAttribute("onclick", "switchchoose(this.id)"); - let e = document.createElement("p"); - e.setAttribute("class", "peizhi_jine_name"); - let f = document.createElement("p"); - f.setAttribute("class", "peizhi_jine_price"); + let d = document.createElement('div'); + d.setAttribute('class', 'peizhi_jine_option'); + d.setAttribute('id', x); + d.setAttribute('onclick', 'switchchoose(this.id)'); + let e = document.createElement('p'); + e.setAttribute('class', 'peizhi_jine_name'); + let f = document.createElement('p'); + f.setAttribute('class', 'peizhi_jine_price'); e.innerHTML = zhouqi[x]; - f.innerHTML = "¥" + (price_group[x] / 100).toFixed(2); + f.innerHTML = '¥' + (price_group[x] / 100).toFixed(2); d.appendChild(e); d.appendChild(f); c.appendChild(d); } } - let dianji = document.getElementsByClassName("peizhi_jine_option")[0]; + let dianji = document.getElementsByClassName('peizhi_jine_option')[0]; dianji.click(); canceltanjiazai(); - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); console.log(JSON.parse(data).message); canceltanjiazai(); - } else if (code == "422") { + } else if (code == '422') { var xx = JSON.parse(data).errors; var errorname = new Array(); for (item in xx) { @@ -167,11 +154,11 @@ function responsedingyue(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } @@ -180,32 +167,32 @@ function responsedingyue(code, data) { var qidongcanshu = {}; var zhouqi = { - month_price: "月付", - quarter_price: "季付", - half_year_price: "半年付", - year_price: "年付", - two_year_price: "两年付", - three_year_price: "三年付", - onetime_price: "一次性", - reset_price: "重置", + month_price: '月付', + quarter_price: '季付', + half_year_price: '半年付', + year_price: '年付', + two_year_price: '两年付', + three_year_price: '三年付', + onetime_price: '一次性', + reset_price: '重置', }; //初始化页面 function chushihua() { let a = window.location.href; - let b = a.split("?"); + let b = a.split('?'); if (b[1] != null) { - let c = b[1].split("&"); + let c = b[1].split('&'); for (x in c) { - let d = c[x].split("="); + let d = c[x].split('='); qidongcanshu[d[0]] = d[1]; } console.log(qidongcanshu); } else { - console.log("没有状态"); + console.log('没有状态'); } - getdingyue(qidongcanshu["planid"]); - tijiaocanshu["plan_id"] = qidongcanshu["planid"]; + getdingyue(qidongcanshu['planid']); + tijiaocanshu['plan_id'] = qidongcanshu['planid']; } //切换选中项 @@ -219,34 +206,33 @@ function switchchoose(data) { for (x in zhouqi) { let b = document.getElementById(x); if (b != null) { - b.setAttribute("class", "peizhi_jine_option"); + b.setAttribute('class', 'peizhi_jine_option'); } } let a = document.getElementById(data); - a.setAttribute("class", "peizhi_jine_option_choose"); - let b = a.children[1].textContent.split("¥")[1]; - tijiaocanshu["period"] = data; - let c = document.getElementById("fukuanzhouqi"); - c.innerHTML = "¥" + b; + a.setAttribute('class', 'peizhi_jine_option_choose'); + let b = a.children[1].textContent.split('¥')[1]; + tijiaocanshu['period'] = data; + let c = document.getElementById('fukuanzhouqi'); + c.innerHTML = '¥' + b; - let d = document.getElementById("zongjijinebig"); - if (youhuiquan["type"] == "1") { - d.innerHTML = "¥" + (b - youhuiquan["value"] / 100).toFixed(2); - } else if (youhuiquan["type"] == "2") { - d.innerHTML = - "¥" + (b * ((100 - youhuiquan["value"]) / 100)).toFixed(2); + let d = document.getElementById('zongjijinebig'); + if (youhuiquan['type'] == '1') { + d.innerHTML = '¥' + (b - youhuiquan['value'] / 100).toFixed(2); + } else if (youhuiquan['type'] == '2') { + d.innerHTML = '¥' + (b * ((100 - youhuiquan['value']) / 100)).toFixed(2); } else { - d.innerHTML = "¥" + b; + d.innerHTML = '¥' + b; } } /*请求检查优惠券信息接口*/ function checkyouhui() { - let mode = "POST"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/coupon/check"; - let a = document.getElementById("youhuiquaninput"); + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/coupon/check'; + let a = document.getElementById('youhuiquaninput'); let params = { - plan_id: tijiaocanshu["plan_id"], + plan_id: tijiaocanshu['plan_id'], code: a.value, }; tanjiazai(); @@ -260,28 +246,28 @@ var youhuiquan = { }; function responsecheckyouhui(code, data) { - if (code == "200") { - tan("right", "优惠券有效"); - let a = document.getElementById("zhekoushuzihuobili"); + if (code == '200') { + tan('right', '优惠券有效'); + let a = document.getElementById('zhekoushuzihuobili'); let b = JSON.parse(data).data.type; let c = JSON.parse(data).data.value; - if (b == "1") { - a.innerHTML = "-¥" + (c / 100).toFixed(2); + if (b == '1') { + a.innerHTML = '-¥' + (c / 100).toFixed(2); } else { - a.innerHTML = c + "%"; + a.innerHTML = c + '%'; } - youhuiquan["type"] = b; - youhuiquan["value"] = c; - let dianji = document.getElementById(tijiaocanshu["period"]); + youhuiquan['type'] = b; + youhuiquan['value'] = c; + let dianji = document.getElementById(tijiaocanshu['period']); console.log(dianji); dianji.click(); - tijiaocanshu["coupon_code"] = JSON.parse(data).data.code; + tijiaocanshu['coupon_code'] = JSON.parse(data).data.code; canceltanjiazai(); - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); console.log(JSON.parse(data).message); canceltanjiazai(); - } else if (code == "422") { + } else if (code == '422') { var xx = JSON.parse(data).errors; var errorname = new Array(); for (item in xx) { @@ -290,19 +276,19 @@ function responsecheckyouhui(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } /*提交订单*/ function tijiaodingdan() { - let mode = "POST"; - let link = domain + "https://ovc.xiaon.life/api/v1/user/order/save"; + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/order/save'; let params = tijiaocanshu; tanjiazai(); jsonlink(mode, link, params, responsetijiaodingdan); @@ -311,17 +297,17 @@ function tijiaodingdan() { /*响应提交订单*/ function responsetijiaodingdan(code, data) { - if (code == "200") { - tan("right", "提交成功"); + if (code == '200') { + tan('right', '提交成功'); let a = JSON.parse(data).data; - window.location.href = "./order_detail.html?orderid=" + a; + window.location.href = './order_detail.html?orderid=' + a; canceltanjiazai(); - } else if (code == "500") { - tan("cuowu", JSON.parse(data).message); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); console.log(JSON.parse(data).message); canceltanjiazai(); - } else if (code == "422") { + } else if (code == '422') { var xx = JSON.parse(data).errors; var errorname = new Array(); for (item in xx) { @@ -330,11 +316,11 @@ function responsetijiaodingdan(code, data) { for (mes in errorname) { abc = errorname[mes]; console.log(xx[abc][0]); - tan("cuowu", xx[abc][0]); + tan('cuowu', xx[abc][0]); } canceltanjiazai(); } else { - tan("cuowu", "当前网络不佳请您刷新页面后重试"); + tan('cuowu', '当前网络不佳请您刷新页面后重试'); canceltanjiazai(); } } diff --git a/xiaon_c5z3Cp/static/ticket.js b/xiaon_c5z3Cp/static/ticket.js index bdfef3f..cddfea0 100644 --- a/xiaon_c5z3Cp/static/ticket.js +++ b/xiaon_c5z3Cp/static/ticket.js @@ -1,450 +1,425 @@ /*启动检测与页面初始化localStorage*/ -function bootcheck(){ - let a = localStorage.getItem('authorization'); - if(a) { - getinfo(); - getticket(); - bindevent(); - } - else { - exitlogout(); - } +function bootcheck() { + let a = localStorage.getItem('authorization'); + if (a) { + getinfo(); + getticket(); + bindevent(); + } else { + exitlogout(); + } } - var domain = ""; +var domain = ''; /*网络请求*/ -function jsonlink(mode,link,params,callback){ - var auth = localStorage.getItem('authorization'); - var xmlHttp = new XMLHttpRequest; - //let requesetjson; - xmlHttp.open(mode,link,true); - if(mode == 'POST'){ - xmlHttp.setRequestHeader('content-type','application/json'); - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(JSON.stringify(params)); - console.log(params); - } - else { - xmlHttp.setRequestHeader('authorization',auth); - xmlHttp.send(); +function jsonlink(mode, link, params, callback) { + var auth = localStorage.getItem('authorization'); + var xmlHttp = new XMLHttpRequest(); + //let requesetjson; + xmlHttp.open(mode, link, true); + if (mode == 'POST') { + xmlHttp.setRequestHeader('content-type', 'application/json'); + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(JSON.stringify(params)); + console.log(params); + } else { + xmlHttp.setRequestHeader('authorization', auth); + xmlHttp.send(); } - xmlHttp.onreadystatechange = function(){ - if (xmlHttp.readyState ==4 && xmlHttp.status ==200){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==500){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState ==4 && xmlHttp.status ==422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,json); - } - else if (xmlHttp.readyState !=4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422){ - var json = xmlHttp.responseText;//获取到服务端返回的数据 - callback(xmlHttp.status,'001'); - } - } + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 500) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState == 4 && xmlHttp.status == 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, json); + } else if (xmlHttp.readyState != 4 && xmlHttp.status != 500 && xmlHttp.status != 200 && xmlHttp.status != 422) { + var json = xmlHttp.responseText; //获取到服务端返回的数据 + callback(xmlHttp.status, '001'); + } + }; } /*请求个人信息接口*/ -function getinfo(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/info'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responseinfo); +function getinfo() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/info'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responseinfo); } /*响应个人信息*/ -function responseinfo(code,data){ - if (code == '200') { - let a = document.getElementById('logout_words'); - a.innerHTML = JSON.parse(data).data.email; - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } +function responseinfo(code, data) { + if (code == '200') { + let a = document.getElementById('logout_words'); + a.innerHTML = JSON.parse(data).data.email; + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); + } } /*请求工单接口*/ -function getticket(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/fetch'; - let params = ''; - tanjiazai(); - jsonlink(mode,link,params,responsegetticket); +function getticket() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/fetch'; + let params = ''; + tanjiazai(); + jsonlink(mode, link, params, responsegetticket); } var youxian = { - 0:'低', - 1:'中', - 2:'高' -} + 0: '低', + 1: '中', + 2: '高', +}; /*响应订单接口*/ -function responsegetticket(code,data){ - var j = document.getElementById('ticket_down'); - j.innerHTML = ''; - if (code == '200') { - let a = JSON.parse(data).data; - if (a == ''){ - console.log(a); - let queshengbox = document.createElement('div'); - let queshengtu = document.createElement('img'); - queshengbox.setAttribute('class','queshengtu-box'); - queshengtu.setAttribute('src','./img/queshengtu.png'); - queshengtu.setAttribute('class','queshengtu'); - let fatherdiv = document.getElementById('ticket_down'); - queshengbox.appendChild(queshengtu); - fatherdiv.appendChild(queshengbox); - } - for (x in a ){ - let b = document.createElement('div'); - b.setAttribute('class','ticket_box'); +function responsegetticket(code, data) { + var j = document.getElementById('ticket_down'); + j.innerHTML = ''; + if (code == '200') { + let a = JSON.parse(data).data; + if (a == '') { + console.log(a); + let queshengbox = document.createElement('div'); + let queshengtu = document.createElement('img'); + queshengbox.setAttribute('class', 'queshengtu-box'); + queshengtu.setAttribute('src', './img/queshengtu.png'); + queshengtu.setAttribute('class', 'queshengtu'); + let fatherdiv = document.getElementById('ticket_down'); + queshengbox.appendChild(queshengtu); + fatherdiv.appendChild(queshengbox); + } + for (x in a) { + let b = document.createElement('div'); + b.setAttribute('class', 'ticket_box'); - let c = document.createElement('p'); - c.setAttribute('class','ticket_box_id'); + let c = document.createElement('p'); + c.setAttribute('class', 'ticket_box_id'); - let d = document.createElement('button'); - d.setAttribute('class','ticket_box_title'); + let d = document.createElement('button'); + d.setAttribute('class', 'ticket_box_title'); - let e = document.createElement('p'); - e.setAttribute('class','ticket_box_youxian'); + let e = document.createElement('p'); + e.setAttribute('class', 'ticket_box_youxian'); - let f = document.createElement('p'); - f.setAttribute('class','ticket_box_zhuangtai'); + let f = document.createElement('p'); + f.setAttribute('class', 'ticket_box_zhuangtai'); - let g = document.createElement('p'); - g.setAttribute('class','ticket_box_shijian'); + let g = document.createElement('p'); + g.setAttribute('class', 'ticket_box_shijian'); - let h = document.createElement('button'); - h.setAttribute('class','ticket_box_cancel'); + let h = document.createElement('button'); + h.setAttribute('class', 'ticket_box_cancel'); - c.innerHTML = a[x].id; - d.innerHTML = a[x].subject; - d.setAttribute('value',a[x].id); - d.setAttribute('onclick','xunhuan(this.value)'); - e.innerHTML = youxian[a[x].level]; - h.innerHTML = '关闭'; - if(a[x].status == '1'){ - f.innerHTML = '已关闭'; - f.style.color = '#6DD400'; - h.style.color = '#D9D9D9'; - h.setAttribute('value',a[x].id); - } - else { - if(a[x].reply_status == '0'){ - f.innerHTML = '已回复'; - f.style.color = '#0091FF'; - h.setAttribute('value',a[x].id); - h.setAttribute('onclick','closeticket(this.value)'); - } - else { - f.innerHTML = '待回复'; - f.style.color = '#E02020'; - h.setAttribute('value',a[x].id); - h.setAttribute('onclick','closeticket(this.value)'); + c.innerHTML = a[x].id; + d.innerHTML = a[x].subject; + d.setAttribute('value', a[x].id); + d.setAttribute('onclick', 'xunhuan(this.value)'); + e.innerHTML = youxian[a[x].level]; + h.innerHTML = '关闭'; + if (a[x].status == '1') { + f.innerHTML = '已关闭'; + f.style.color = '#6DD400'; + h.style.color = '#D9D9D9'; + h.setAttribute('value', a[x].id); + } else { + if (a[x].reply_status == '0') { + f.innerHTML = '已回复'; + f.style.color = '#0091FF'; + h.setAttribute('value', a[x].id); + h.setAttribute('onclick', 'closeticket(this.value)'); + } else { + f.innerHTML = '待回复'; + f.style.color = '#E02020'; + h.setAttribute('value', a[x].id); + h.setAttribute('onclick', 'closeticket(this.value)'); + } + } + g.innerHTML = getshijian(a[x].updated_at); + + b.appendChild(c); + b.appendChild(d); + b.appendChild(e); + b.appendChild(f); + b.appendChild(g); + b.appendChild(h); + + let j = document.getElementById('ticket_down'); + j.appendChild(b); } - } - g.innerHTML = getshijian(a[x].updated_at); - - b.appendChild(c); - b.appendChild(d); - b.appendChild(e); - b.appendChild(f); - b.appendChild(g); - b.appendChild(h); - - let j = document.getElementById('ticket_down'); - j.appendChild(b); + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不稳定,请刷新页面重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不稳定,请刷新页面重试'); - canceltanjiazai(); - } } //时间戳转日期 function getshijian(time) { - let date = new Date(parseInt(time) * 1000); - let y = date.getFullYear(); - let MM = date.getMonth() + 1; - MM = MM < 10 ? ('0' + MM) : MM; - let d = date.getDate(); - d = d < 10 ? ('0' + d) : d; - let h = date.getHours(); - h = h < 10 ? ('0' + h) : h; - let m = date.getMinutes(); - m = m < 10 ? ('0' + m) : m; - let s = date.getSeconds(); - s = s < 10 ? ('0' + s) : s; - return y + '/' + MM + '/' + d+' '+h+':'+m+':'+d; + let date = new Date(parseInt(time) * 1000); + let y = date.getFullYear(); + let MM = date.getMonth() + 1; + MM = MM < 10 ? '0' + MM : MM; + let d = date.getDate(); + d = d < 10 ? '0' + d : d; + let h = date.getHours(); + h = h < 10 ? '0' + h : h; + let m = date.getMinutes(); + m = m < 10 ? '0' + m : m; + let s = date.getSeconds(); + s = s < 10 ? '0' + s : s; + return y + '/' + MM + '/' + d + ' ' + h + ':' + m + ':' + d; } - - /*关闭工单接口*/ -function closeticket(ticketid){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/close'; - let params = { - id : ticketid - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responsecloseticket); +function closeticket(ticketid) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/close'; + let params = { + id: ticketid, + }; + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responsecloseticket); } /*响应关闭工单接口*/ -function responsecloseticket(code,data){ - if (code == '200') { - tan('right','关闭成功'); - canceltanjiazai(); - getticket(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsecloseticket(code, data) { + if (code == '200') { + tan('right', '关闭成功'); + canceltanjiazai(); + getticket(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } /*打开工单详情*/ var ticketid_quanju = null; -function detailticket(){ - let mode = 'GET'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/fetch?id='+ticketid_quanju; - let params = ''; - console.log(params); - jsonlink(mode,link,params,responsedetailticket); - tan('right','数据请求中'); +function detailticket() { + let mode = 'GET'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/fetch?id=' + ticketid_quanju; + let params = ''; + console.log(params); + jsonlink(mode, link, params, responsedetailticket); + tan('right', '数据请求中'); } /*响应工单详情*/ -function responsedetailticket(code,data){ - if (code == '200') { - let user_id = JSON.parse(data).data.user_id; - let subject = JSON.parse(data).data.subject; - let a = document.getElementById('tanbox-gongdan-title'); - a.innerHTML = subject; - let f = document.getElementById('tanbox-gongdan-down'); - f.innerHTML = ''; - let h = document.getElementById('gongdan_send'); - h.setAttribute('value',JSON.parse(data).data.id); - let message = JSON.parse(data).data.message; - for (x in message){ - var b = document.createElement('div'); - var c = document.createElement('p'); - var d = document.createElement('p'); - if (user_id != message[x].user_id){ - b.setAttribute('class','gongdanneirongbox_zuo'); - c.setAttribute('class','gongdanshijian'); - d.setAttribute('class','gongdanzuo'); - } - else - { - b.setAttribute('class','gongdanneirongbox_you'); - c.setAttribute('class','gongdanshijian'); - d.setAttribute('class','gongdanyou'); - } - d.innerHTML = message[x].message; - c.innerHTML = getshijian(message[x].updated_at); - b.appendChild(c); - b.appendChild(d); - f.appendChild(b); - } - let g = document.getElementById('chakangongdan'); - g.style.display = 'flex'; - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsedetailticket(code, data) { + if (code == '200') { + let user_id = JSON.parse(data).data.user_id; + let subject = JSON.parse(data).data.subject; + let a = document.getElementById('tanbox-gongdan-title'); + a.innerHTML = subject; + let f = document.getElementById('tanbox-gongdan-down'); + f.innerHTML = ''; + let h = document.getElementById('gongdan_send'); + h.setAttribute('value', JSON.parse(data).data.id); + let message = JSON.parse(data).data.message; + for (x in message) { + var b = document.createElement('div'); + var c = document.createElement('p'); + var d = document.createElement('p'); + if (user_id != message[x].user_id) { + b.setAttribute('class', 'gongdanneirongbox_zuo'); + c.setAttribute('class', 'gongdanshijian'); + d.setAttribute('class', 'gongdanzuo'); + } else { + b.setAttribute('class', 'gongdanneirongbox_you'); + c.setAttribute('class', 'gongdanshijian'); + d.setAttribute('class', 'gongdanyou'); + } + d.innerHTML = message[x].message; + c.innerHTML = getshijian(message[x].updated_at); + b.appendChild(c); + b.appendChild(d); + f.appendChild(b); + } + let g = document.getElementById('chakangongdan'); + g.style.display = 'flex'; + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } //循环更新数据 var mytimer = null; -function xunhuan(ticketid){ - ticketid_quanju = ticketid; - detailticket(); - mytimer = setInterval(detailticket, 5000); +function xunhuan(ticketid) { + ticketid_quanju = ticketid; + detailticket(); + mytimer = setInterval(detailticket, 5000); } //停止循环数据 -function stopxunhua(){ - let g = document.getElementById('chakangongdan'); - g.style.display = 'none'; - clearInterval(mytimer); - ticketid_quanju = null; +function stopxunhua() { + let g = document.getElementById('chakangongdan'); + g.style.display = 'none'; + clearInterval(mytimer); + ticketid_quanju = null; } /*发送内容接口*/ -function sendmessage(ticketid){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/reply'; - let a = document.getElementById('tanbox_gongdan_text'); - let params = { - id : ticketid, - message :a.value - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responsesendmessage); +function sendmessage(ticketid) { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/reply'; + let a = document.getElementById('tanbox_gongdan_text'); + let params = { + id: ticketid, + message: a.value, + }; + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responsesendmessage); } /*响应发送内容接口*/ -function responsesendmessage(code,data){ - if (code == '200') { - tan('right','发送成功'); - let a = document.getElementById('tanbox_gongdan_text'); - a.value = ''; - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsesendmessage(code, data) { + if (code == '200') { + tan('right', '发送成功'); + let a = document.getElementById('tanbox_gongdan_text'); + a.value = ''; + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } } //这段代码是用来处理输入文本框默认提示的 -function bindevent(){ - let a = document.getElementById('tanbox_textarea_text'); - a.addEventListener('focus',qingkongtishi); - a.addEventListener('blur',huifutishi); +function bindevent() { + let a = document.getElementById('tanbox_textarea_text'); + a.addEventListener('focus', qingkongtishi); + a.addEventListener('blur', huifutishi); } -function qingkongtishi(){ - let a = document.getElementById('tanbox_textarea_text'); - if(a.value =='请输入工单内容'){ - a.value = ''; - } +function qingkongtishi() { + let a = document.getElementById('tanbox_textarea_text'); + if (a.value == '请输入工单内容') { + a.value = ''; + } } -function huifutishi(){ - let a = document.getElementById('tanbox_textarea_text'); - if(a.value ==''){ - a.value = '请输入工单内容'; - } +function huifutishi() { + let a = document.getElementById('tanbox_textarea_text'); + if (a.value == '') { + a.value = '请输入工单内容'; + } } //打开发送新工单的弹窗 -function opensendticket(){ - let a = document.getElementById('fabuxingongdan'); - a.style.display = 'block'; +function opensendticket() { + let a = document.getElementById('fabuxingongdan'); + a.style.display = 'block'; } //关闭发送新工单的弹窗 -function closesendticket(){ - let a = document.getElementById('fabuxingongdan'); - a.style.display = 'none'; +function closesendticket() { + let a = document.getElementById('fabuxingongdan'); + a.style.display = 'none'; } /*发送工单接口*/ -function sendticket(){ - let mode = 'POST'; - let link = domain+'https://ovc.xiaon.life/api/v1/user/ticket/save'; - let a = document.getElementById('tanbox_ticket_text'); - let b = document.getElementById('tanbox_select_text'); - let c = document.getElementById('tanbox_textarea_text'); - let d = b.selectedIndex; - let params = { - subject : a.value, - message : c.value, - level : b.options[d].value - } - console.log(params); - tanjiazai(); - jsonlink(mode,link,params,responsesendticket); +function sendticket() { + let mode = 'POST'; + let link = domain + 'https://ovc.xiaon.life/api/v1/user/ticket/save'; + let a = document.getElementById('tanbox_ticket_text'); + let b = document.getElementById('tanbox_select_text'); + let c = document.getElementById('tanbox_textarea_text'); + let d = b.selectedIndex; + let params = { + subject: a.value, + message: c.value, + level: b.options[d].value, + }; + console.log(params); + tanjiazai(); + jsonlink(mode, link, params, responsesendticket); } /*响应发送工单接口*/ -function responsesendticket(code,data){ - if (code == '200') { - tan('right','发送成功'); - getticket(); - closesendticket(); - canceltanjiazai(); - } - else if(code == '500'){ - tan('cuowu',JSON.parse(data).message); - console.log(JSON.parse(data).message); - canceltanjiazai(); - } - else if(code == '422'){ - var xx = JSON.parse(data).errors; - var errorname = new Array(); - for (item in xx){ - errorname.push(item); - } - for (mes in errorname){ - abc = errorname[mes]; - console.log(xx[abc][0]); - tan('cuowu',xx[abc][0]); +function responsesendticket(code, data) { + if (code == '200') { + tan('right', '发送成功'); + getticket(); + closesendticket(); + canceltanjiazai(); + } else if (code == '500') { + tan('cuowu', JSON.parse(data).message); + console.log(JSON.parse(data).message); + canceltanjiazai(); + } else if (code == '422') { + var xx = JSON.parse(data).errors; + var errorname = new Array(); + for (item in xx) { + errorname.push(item); + } + for (mes in errorname) { + abc = errorname[mes]; + console.log(xx[abc][0]); + tan('cuowu', xx[abc][0]); + } + canceltanjiazai(); + } else { + tan('cuowu', '当前网络不佳请您刷新页面后重试'); + canceltanjiazai(); } - canceltanjiazai(); - } - else { - tan('cuowu','当前网络不佳请您刷新页面后重试'); - canceltanjiazai(); - } -} \ No newline at end of file +}