li.shaoyi 10 months ago
parent
commit
ad33b10c05

+ 1 - 1
oem/sjgj/config/appconfig.json

@@ -1,6 +1,6 @@
 {
   "appId": "com.muchinfo.sjgj",
-  "appName": "纯金网金银报价结算中心",
+  "appName": "纯金网金银报价结算中心订单管理系统",
   "version": "1.0.1",
   "versionCode": "100001",
   "apiUrl": "http://192.168.31.139:8080/cfg?key=test_139",

+ 1 - 1
src/packages/sjgj/assets/themes/default/default.less

@@ -8,7 +8,7 @@
 
     /* 颜色规范 */
     --color-default: #241512;
-    --color-primary: #ddb45d;
+    --color-primary: #dfc27b;
     --color-secondary: #04c786;
     --color-info: #999;
     --color-border: #eee;

+ 4 - 10
src/packages/sjgj/views/home/main/index.less

@@ -2,18 +2,12 @@
 
 .home-main {
     &__title {
-        display: flex;
-        flex-direction: column;
-        align-items: center;
+        .app-navbar__wrapper {
+            background: linear-gradient(180deg, #916d31, #ddc07a);
 
-        span {
-            &:first-child {
+            span {
                 font-size: 16px;
             }
-
-            &:last-child {
-                font-size: 14px;
-            }
         }
     }
 
@@ -24,7 +18,7 @@
         padding-bottom: 0;
 
         &::before {
-            content: '';
+            //content: '';
             width: 140%;
             height: 150px;
             position: absolute;

+ 11 - 14
src/packages/sjgj/views/home/main/index.vue

@@ -1,25 +1,14 @@
 <template>
   <app-view class="home-main">
     <template #header>
-      <app-navbar :show-back-button="false">
-        <div class="home-main__title">
-          <span>{{ globalStore.getSystemInfo('appName') }}</span>
-          <span>订单管理系统</span>
-        </div>
+      <app-navbar class="home-main__title" :show-back-button="false">
+        <span>{{ globalStore.getSystemInfo('appName') }}</span>
       </app-navbar>
     </template>
     <div class="home-main__banner">
       <Banner :data-list="topBanners" />
     </div>
     <PullRefresh class="home-main__container" v-model="refreshing" @refresh="onRefresh">
-      <app-block>
-        <Cell class="home-main__titlebar" title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link>
-          <template #title>
-            <span>{{ $t('routes.notice') }}</span>
-            <Badge :dot="noticeStore.unreadList.length > 0"></Badge>
-          </template>
-        </Cell>
-      </app-block>
       <app-block class="home-main__iconbar bg">
         <ul>
           <li @click="routerTo('order-list')">
@@ -40,9 +29,17 @@
           </li>
         </ul>
       </app-block>
+      <app-block>
+        <Cell class="home-main__titlebar" title="通知公告" value="更多" :to="{ name: 'notice-list' }" icon="volume" is-link>
+          <template #title>
+            <span>{{ $t('routes.notice') }}</span>
+            <Badge :dot="noticeStore.unreadList.length > 0"></Badge>
+          </template>
+        </Cell>
+      </app-block>
       <app-block class="home-main__news">
         <CellGroup class="article">
-          <Cell class="home-main__titlebar" title="业务公告" value="更多" icon="fire" @click="routerTo('news-list')"
+          <Cell class="home-main__titlebar" title="业务规则" value="更多" icon="fire" @click="routerTo('news-list')"
             is-link />
           <template v-for="(item, index) in newsList" :key="index">
             <Cell class="article-item" :title="item.title" :value="formatDate(item.publishdate, 'MM/DD')"

+ 1 - 1
src/packages/sjgj/views/user/login/index.less

@@ -1,6 +1,6 @@
 .login {
     &::before {
-        background: linear-gradient(180deg, #ddb45d, #ddb45d);
+        background: linear-gradient(180deg, #dfc27b, #dfc27b);
     }
 
     &-logo {

+ 2 - 1
src/packages/tss/views/user/login/index.less

@@ -1,8 +1,9 @@
 .login {
     display: flex;
     flex-direction: column;
-    background:#fff url(../../../assets/images/login-bg.png) no-repeat center top;
+    background: url(../../../assets/images/login-bg.png) no-repeat center top;
     background-size: 100% auto;
+    background-color: #fff !important;
 
     &-navback {
         >.van-icon {

+ 6 - 9
src/stores/modules/errorInfo.ts

@@ -1,4 +1,5 @@
 import { shallowRef } from 'vue'
+import { Language } from '@/constants/language'
 import { queryErrorInfos } from '@/services/api/common'
 import { defineStore } from '../store'
 import { sessionData } from '../storage'
@@ -29,18 +30,14 @@ export const useErrorInfoStore = defineStore(() => {
     const getErrorInfoByCode = (code: number) => {
         const error = errorInfos.value.find((e) => e.errorid === code)
         switch (i18n.global.locale) {
-            case 'zh-CN':
+            case Language.Simplified:
                 return error?.description
-                break;
-            case 'en-US':
-                return error?.descriptionen
-                break;
-            case 'zh-TW':
+            case Language.Thai:
+                return error?.descriptionth
+            case Language.Traditional:
                 return error?.descriptionzh_tw
-                break;
             default:
-                return error?.descriptionth
-                break;
+                return error?.descriptionen
         }
     }
 

+ 4 - 13
src/stores/modules/global.ts

@@ -59,19 +59,10 @@ export const useGlobalStore = defineStore(() => {
 
     // 获取系统配置项
     const getSystemConfig = async () => {
-        const filePath = './config/appconfig.json'
-        if (plus.hasPlus()) {
-            const res = await plus.getLocalFileContent(filePath)
-            state.systemInfo = {
-                ...state.systemInfo,
-                ...JSON.parse(res)
-            }
-        } else {
-            const res = await axios(filePath)
-            state.systemInfo = {
-                ...state.systemInfo,
-                ...res.data
-            }
+        const data = await plus.getLocalFileContent('./config/appconfig.json')
+        state.systemInfo = {
+            ...state.systemInfo,
+            ...data
         }
         return state.systemInfo
     }

+ 10 - 9
src/stores/modules/language.ts

@@ -1,4 +1,4 @@
-import axios from 'axios'
+import plus from '@/utils/h5plus'
 import zhCN from '@public/locales/zh-CN.json'
 import enUS from '@public/locales/en-US.json'
 import thTH from '@public/locales/th-TH.json'
@@ -18,18 +18,19 @@ export const i18n = createI18n({
     }
 })
 
-axios('./locales/extras/zh-CN.json').then((res) => {
-    i18n.global.mergeLocaleMessage(Language.Simplified, res.data)
+
+plus.getLocalFileContent('./locales/extras/zh-CN.json').then((data) => {
+    i18n.global.mergeLocaleMessage(Language.Simplified, data)
 })
 
-axios('./locales/extras/zh-TW.json').then((res) => {
-    i18n.global.mergeLocaleMessage(Language.Traditional, res.data)
+plus.getLocalFileContent('./locales/extras/zh-TW.json').then((data) => {
+    i18n.global.mergeLocaleMessage(Language.Traditional, data)
 })
 
-axios('./locales/extras/en-US.json').then((res) => {
-    i18n.global.mergeLocaleMessage(Language.English, res.data)
+plus.getLocalFileContent('./locales/extras/en-US.json').then((data) => {
+    i18n.global.mergeLocaleMessage(Language.English, data)
 })
 
-axios('./locales/extras/th-TH.json').then((res) => {
-    i18n.global.mergeLocaleMessage(Language.Thai, res.data)
+plus.getLocalFileContent('./locales/extras/th-TH.json').then((data) => {
+    i18n.global.mergeLocaleMessage(Language.Thai, data)
 })

+ 39 - 28
src/utils/h5plus/index.ts

@@ -24,11 +24,6 @@ export default new (class {
     })
 
     /**
-     * 网络请求对象
-     */
-    private xhr = new XMLHttpRequest()
-
-    /**
      * 当前下载进度任务
      */
     private progressTask = new Map()
@@ -46,7 +41,6 @@ export default new (class {
 
     constructor() {
         this.onPlusReady((plus) => {
-            this.xhr = new plus.net.XMLHttpRequest()
             this.systemInfo.os = plus.os.name
             this.systemInfo.statusBarHeight = plus.navigator.getStatusbarHeight()
 
@@ -63,7 +57,7 @@ export default new (class {
                     break
                 }
             }
-            
+
             plus.runtime.getProperty(plus.runtime.appid, (info: any) => {
                 this.systemInfo.version = info.version
                 this.systemInfo.versionCode = info.versionCode
@@ -194,30 +188,31 @@ export default new (class {
      * @returns 
      */
     httpRequest(config: HttpRequestConfig) {
+        const xhr = this.hasPlus() ? new window.plus.net.XMLHttpRequest() : new XMLHttpRequest()
         return new Promise<any>((resolve, reject) => {
-            this.xhr.responseType = config.responseType ?? 'json'
+            xhr.responseType = config.responseType ?? 'json'
             if (config.header) {
                 for (const key in config.header) {
-                    this.xhr.setRequestHeader(key, config.header[key])
+                    xhr.setRequestHeader(key, config.header[key])
                 }
             }
-            this.xhr.onreadystatechange = () => {
-                if (this.xhr.readyState === 4) {
-                    if (this.xhr.status == 200) {
+            xhr.onreadystatechange = () => {
+                if (xhr.readyState === 4) {
+                    if (xhr.status == 200) {
                         resolve({
                             code: 200,
-                            data: this.xhr.response
+                            data: xhr.response
                         })
                     } else {
                         reject({
-                            code: this.xhr.status,
-                            message: this.xhr.statusText
+                            code: xhr.status,
+                            message: xhr.statusText
                         })
                     }
                 }
             }
-            this.xhr.open(config.method ?? 'GET', config.url)
-            this.xhr.send()
+            xhr.open(config.method ?? 'GET', config.url)
+            xhr.send()
         })
     }
 
@@ -408,19 +403,35 @@ export default new (class {
      */
     getLocalFileContent(filePath: string) {
         return new Promise<any>((resolve, reject) => {
-            this.onPlusReady((plus) => {
-                plus.io.resolveLocalFileSystemURL('_www/' + filePath, (entry: any) => {
-                    entry.file((file: any) => {
-                        const fileReader = new plus.io.FileReader()
-                        fileReader.readAsText(file, 'utf-8')
-                        fileReader.onloadend = (evt: any) => {
-                            resolve(evt.target.result)
-                        }
+            if (this.hasPlus()) {
+                this.onPlusReady((plus) => {
+                    plus.io.resolveLocalFileSystemURL('_www/' + filePath, (entry: any) => {
+                        entry.file((file: any) => {
+                            const fileReader = new plus.io.FileReader()
+                            fileReader.readAsText(file, 'utf-8')
+                            fileReader.onloadend = (evt: any) => {
+                                const data = evt.target.result
+                                try {
+                                    // 尝试解析内容
+                                    resolve(JSON.parse(data))
+                                } catch (e) {
+                                    resolve(data)
+                                }
+                            }
+                        })
+                    }, (e: any) => {
+                        reject(e.message)
                     })
-                }, (e: any) => {
-                    reject(e.message)
                 })
-            })
+            } else {
+                this.httpRequest({
+                    url: filePath
+                }).then((res) => {
+                    resolve(res.data)
+                }).catch((res) => {
+                    reject(res.message)
+                })
+            }
         })
     }