li.shaoyi %!s(int64=2) %!d(string=hai) anos
pai
achega
505b9349c1

+ 1 - 1
public/config/appconfig.json

@@ -3,7 +3,7 @@
   "appName": "多元世纪交易中心",
   "version": "1.0.5",
   "versionCode": "10005",
-  "apiUrl": "http://192.168.31.132:8080/cfg?key=test_132",
+  "apiUrl": "http://192.168.31.204:8080/cfg?key=test_204",
   "tradeChannel": "ws",
   "modules": [
     "register",

+ 2 - 2
public/manifest.json

@@ -2,7 +2,7 @@
     "@platforms" : [ "android", "iPhone", "iPad" ],
     "id" : "H5E4A9458",
     /*应用的标识*/
-    "name" : "多元世纪",
+    "name" : "多元世纪演示版",
     /*应用名称,程序桌面图标名称*/
     "version" : {
         "name" : "1.0.0",
@@ -155,7 +155,7 @@
                 ],
                 "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
                 "autoSdkPermissions" : false,
-                "minSdkVersion" : 30
+                "minSdkVersion" : 29
             },
             /*使用Native.js调用原生安卓API需要使用到的系统权限*/
             "orientation" : [ "portrait-primary" ],

+ 17 - 17
src/hooks/hqchart/candlestick/dataset.ts

@@ -24,21 +24,9 @@ export function useDataset(goodsCode: string, cycleType = ChartCycleType.Minutes
         data.PreventDefault = true
         switch (data.Name) {
             case networkProtocol.historyData:
-                getHistoryData().then(() => {
-                    callback({
-                        symbol: state.symbol,
-                        data: handleChartData(networkProtocol.historyData, cache.value)
-                    })
-                })
-                break
             case networkProtocol.historyMinuteData:
                 state.symbol = data.Request.Data.symbol
-                getHistoryData().then(() => {
-                    callback({
-                        symbol: state.symbol,
-                        data: handleChartData(networkProtocol.historyMinuteData, cache.value)
-                    })
-                })
+                getHistoryData(data.Name, data, callback)
                 break
             default:
                 callback({ symbol: state.symbol, data: [] })
@@ -46,16 +34,28 @@ export function useDataset(goodsCode: string, cycleType = ChartCycleType.Minutes
     }
 
     // 获取历史行情
-    const getHistoryData = async () => {
-        const res = await queryHistoryDatas({
+    const getHistoryData = (protocol: string, data: NetworkFilterData, callback: NetworkFilterCallback) => {
+        queryHistoryDatas({
             data: {
                 cycleType: state.cycleType,
                 goodsCode,
                 count: 1440,
             }
+        }).then((res) => {
+            cache.value = res.data.sort((a, b) => moment(a.ts).valueOf() - moment(b.ts).valueOf())
+        }).finally(() => {
+            if (cache.value.length) {
+                callback({
+                    symbol: state.symbol,
+                    data: handleChartData(protocol, cache.value)
+                })
+            } else {
+                data.Self.EnableSplashScreen({
+                    Title: '暂无数据',
+                    Draw: true,
+                })
+            }
         })
-        const data = res.data.sort((a, b) => moment(a.ts).valueOf() - moment(b.ts).valueOf())
-        cache.value = data
     }
 
     // 处理图表数据

+ 4 - 0
src/hooks/hqchart/candlestick/types.ts

@@ -12,6 +12,10 @@ export interface NetworkFilterData {
             period: number;
             right: number;
         }
+    },
+    Self: {
+        // https://blog.csdn.net/jones2000/article/details/117524401
+        EnableSplashScreen: (opton: { Title: string; Draw: boolean }) => void
     }
 }
 

+ 12 - 7
src/hooks/hqchart/timeline/dataset.ts

@@ -79,19 +79,21 @@ export function useDataset(goodsCode: string) {
     const networkFilter = (data: NetworkFilterData, callback: NetworkFilterCallback) => {
         data.PreventDefault = true
         if (data.Name === 'MinuteChartContainer::RequestMinuteData') {
+            state.symbol = data.Request.Data.symbol[0]
             getTSDataAsync.then((res) => {
-                if (res.data.historyDatas.length) {
-                    const [lastItem] = res.data.historyDatas.slice(-1)
-                    cache.value = res.data
-                    state.symbol = data.Request.Data.symbol[0]
+                cache.value = res.data
+            }).finally(() => {
+                const { preSettle = 0, historyDatas = [] } = cache.value ?? {}
+                if (historyDatas.length) {
+                    const [lastItem] = historyDatas.slice(-1)
                     callback({
                         stock: [
                             {
                                 symbol: state.symbol,
-                                yclose: res.data.preSettle,
+                                yclose: preSettle,
                                 date: Number(moment(lastItem.ts).format('YYYYMMDD')),
                                 time: Number(moment(lastItem.ts).format('HHmm')),
-                                minute: res.data.historyDatas.map((e) => ({
+                                minute: historyDatas.map((e) => ({
                                     price: e.c,
                                     open: e.o || null,
                                     high: e.h || null,
@@ -105,7 +107,10 @@ export function useDataset(goodsCode: string) {
                         ]
                     })
                 } else {
-                    callback({ stock: [] })
+                    data.Self.EnableSplashScreen({
+                        Title: '暂无数据',
+                        Draw: true,
+                    })
                 }
             })
         } else {

+ 4 - 0
src/hooks/hqchart/timeline/types.ts

@@ -12,6 +12,10 @@ export interface NetworkFilterData {
             period: number;
             right: number;
         }
+    },
+    Self: {
+        // https://blog.csdn.net/jones2000/article/details/117524401
+        EnableSplashScreen: (opton: { Title: string; Draw: boolean }) => void
     }
 }
 

+ 6 - 2
src/packages/mobile/components/layouts/login/index.vue

@@ -29,8 +29,8 @@
         <Checkbox shape="square" icon-size=".32rem" v-model="checked">我已阅读并同意</Checkbox>
         <span @click="routerTo('rules-zcxy')">《用户注册协议》</span>
         <span>、</span>
-        <span @click="routerTo('rules-yhkhfxgzs')">《用户开户风险告知书》</span>
-        <span>、</span>
+        <span @click="routerTo('rules-yhkhfxgzs')" v-if="showYhkhfxgzs">《用户开户风险告知书》</span>
+        <span v-if="showYhkhfxgzs">、</span>
         <span @click="routerTo('rules-yszc')">《隐私政策》</span>
       </div>
       <div class="login-footer__version">
@@ -55,6 +55,10 @@ defineProps({
   logoSrc: {
     type: String,
     default: logoImage
+  },
+  showYhkhfxgzs: {
+    type: Boolean,
+    default: true
   }
 })
 

+ 1 - 1
src/packages/mobile/components/modules/hqchart/candlestick/index.less

@@ -17,7 +17,7 @@
             border: 1px solid #f6f6f6;
             border-left: 0;
             border-right: 0;
-            padding: .1rem;
+            padding:.12rem .1rem;
 
             &-item {
                 flex: 1;

+ 9 - 8
src/packages/mobile/components/modules/hqchart/candlestick/index.vue

@@ -8,7 +8,7 @@
 <script lang="ts" setup>
 import { shallowRef, watch, computed } from 'vue'
 import { Chart } from 'hqchart'
-import { changeUnit } from '@/filters'
+import { changeUnit, handleNumberValue } from '@/filters'
 import { ChartCycleType } from '@/constants/chart'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from '@/hooks/hqchart/candlestick/dataset'
@@ -82,8 +82,8 @@ const chartOption = {
     NetworkFilter: (data: NetworkFilterData, callback: NetworkFilterCallback) => networkFilter(data, callback),
     // https://blog.csdn.net/jones2000/article/details/102928907
     Windows: [
-        { Index: 'MA', Change: false },
-        { Index: 'VOL', Close: false }
+        { Index: 'MA', Change: false, Modify: false },
+        { Index: 'VOL', Change: false, Modify: false, Close: false }
     ],
     IsCorssOnlyDrawKLine: true,  // 十字光标只能在K线上
     CorssCursorTouchEnd: true, // 手指离开屏幕 隐藏十字光标
@@ -96,7 +96,7 @@ const chartOption = {
     Border: {
         Left: 0,
         Right: 0,
-        Top: 30,
+        Top: 36,
         Bottom: 25,
         AutoLeft: { Blank: 15, MinWidth: 30 },
         AutoRight: { Blank: 15, MinWidth: 30 },
@@ -112,6 +112,7 @@ const chartOption = {
         RightSpaceCount: 1,
         // https://blog.csdn.net/jones2000/article/details/104443471
         IsShowTooltip: false,
+        KLineDoubleClick: false
     },
     KLineTitle:
     {
@@ -141,10 +142,10 @@ const chartOption = {
                 const { Open, High, Low, Close, Vol, YClose } = data.Data
                 return {
                     AryText: [
-                        { Text: '开:' + Open, Color: paint.GetColor(Open, YClose) },
-                        { Text: '高:' + High, Color: paint.GetColor(High, YClose) },
-                        { Text: '低:' + Low, Color: paint.GetColor(Low, YClose) },
-                        { Text: '收:' + Close, Color: paint.GetColor(Close, YClose) },
+                        { Text: '开:' + handleNumberValue(Open), Color: paint.GetColor(Open, YClose) },
+                        { Text: '高:' + handleNumberValue(High), Color: paint.GetColor(High, YClose) },
+                        { Text: '低:' + handleNumberValue(Low), Color: paint.GetColor(Low, YClose) },
+                        { Text: '收:' + handleNumberValue(Close), Color: paint.GetColor(Close, YClose) },
                         { Text: '量:' + changeUnit(Vol), Color: paint.VolColor }
                     ]
                 }

+ 17 - 5
src/packages/mobile/components/modules/hqchart/index.less

@@ -1,6 +1,18 @@
-.app-chart{
-    display: flex;
-    flex-direction: column;
-    height: 100%;
-    background-color: #000;
+.app-quote-chart {
+    background-color: #fff;
+    margin-top: .2rem;
+
+    &__header {
+        display: flex;
+        align-items: center;
+        border-bottom: 1px solid #eee;
+
+        .van-tabs {
+            flex: 1;
+
+            &__nav {
+                background-color: transparent;
+            }
+        }
+    }
 }

+ 88 - 12
src/packages/mobile/components/modules/hqchart/index.vue

@@ -1,17 +1,32 @@
 <template>
-    <div class="app-chart">
-        <Tabs class="app-tabs--info" :data-list="dataList" @change="changePeriod" />
-        <MLine v-bind="{ symbol, goodsCode }" v-if="cycleType === ChartCycleType.Time" />
+    <div class="app-quote-chart">
+        <div class="app-quote-chart__header">
+            <Tabs v-model:active="tabIndex" :before-change="onTabChange">
+                <Tab title="分时" />
+                <Tab>
+                    <template #title>
+                        <Popover :actions="actions" @select="onPopoverSelect">
+                            <template #reference>{{ selectedText || '分钟' }}</template>
+                        </Popover>
+                    </template>
+                </Tab>
+                <Tab title="日线" />
+                <Tab title="周线" />
+                <Tab title="月线" />
+            </Tabs>
+            <Icon name="setting-o" style="padding: 0 .32rem;" v-if="false" />
+        </div>
+        <MLine v-bind="{ symbol, goodsCode }" v-if="tabIndex === 0" />
         <KLine v-bind="{ symbol, goodsCode, cycleType }" v-else />
     </div>
 </template>
 
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
-import { ChartCycleType, getChartCycleTypeList } from '@/constants/chart'
-import Tabs from '@/components/base/tabs/index.vue'
-import KLine from './candlestick/index.vue'
+import { Tab, Tabs, Popover, Icon, PopoverAction } from 'vant'
+import { ChartCycleType } from '@/constants/chart'
 import MLine from './timeline/index.vue'
+import KLine from './candlestick/index.vue'
 
 defineProps({
     goodsCode: {
@@ -20,13 +35,74 @@ defineProps({
     }
 })
 
-const symbol = '600000.sh' // 股票代码
-const cycleType = shallowRef(ChartCycleType.Time) // 图表周期类型
-const dataList = getChartCycleTypeList()
+const symbol = '000000.et' // https://blog.csdn.net/jones2000/article/details/104457569
+const tabIndex = shallowRef(0) // 当前选中的标签
+const selectedText = shallowRef('') // 当前选中的分钟线
+const cycleType = shallowRef(ChartCycleType.Minutes) // 图表周期类型
+
+const actions = [
+    { text: '1分钟' },
+    { text: '5分钟', },
+    { text: '30分钟', },
+    { text: '60分钟', },
+    { text: '4小时', }
+]
+
+// 切换图表
+const onTabChange = (index: number) => {
+    switch (index) {
+        case 1: {
+            return false
+        }
+        case 2: {
+            cycleType.value = ChartCycleType.Day
+            return true
+        }
+        case 3: {
+            cycleType.value = ChartCycleType.Week
+            return true
+        }
+        case 4: {
+            cycleType.value = ChartCycleType.Month
+            return true
+        }
+        default: {
+            return true
+        }
+    }
+}
 
-// 切换周期
-const changePeriod = (index: number) => {
-    cycleType.value = dataList[index].value
+// 切换分钟
+const onPopoverSelect = (action: PopoverAction) => {
+    tabIndex.value = 1
+    selectedText.value = action.text
+
+    switch (action.text) {
+        case '1分钟': {
+            cycleType.value = ChartCycleType.Minutes
+            break
+        }
+        case '5分钟': {
+            cycleType.value = ChartCycleType.Minutes5
+            break
+        }
+        case '30分钟': {
+            cycleType.value = ChartCycleType.Minutes30
+            break
+        }
+        case '60分钟': {
+            cycleType.value = ChartCycleType.Minutes60
+            break
+        }
+        case '2小时': {
+            cycleType.value = ChartCycleType.Hours2
+            break
+        }
+        case '4小时': {
+            cycleType.value = ChartCycleType.Hours4
+            break
+        }
+    }
 }
 </script>
 

+ 1 - 1
src/packages/mobile/components/modules/hqchart/timeline/index.vue

@@ -49,7 +49,7 @@ const chartOption = {
     Border: {
         Left: 0,
         Right: 0,
-        Top: 30,
+        Top: 36,
         Bottom: 25,
         AutoLeft: { Blank: 15, MinWidth: 30 },
         AutoRight: { Blank: 15, MinWidth: 30 },

+ 2 - 5
src/packages/mobile/components/modules/quote/chart/index.vue

@@ -16,8 +16,8 @@
             </Tabs>
             <Icon name="setting-o" style="padding: 0 .32rem;" v-if="false" />
         </div>
-        <TimeLine v-bind="{ symbol, goodsCode }" v-if="tabIndex === 0" />
-        <KLine v-bind="{ symbol, goodsCode, cycleType }" v-else />
+        <TimeLine v-bind="{ goodsCode }" v-if="tabIndex === 0" />
+        <KLine v-bind="{ goodsCode, cycleType }" v-else />
     </div>
 </template>
 
@@ -27,8 +27,6 @@ import { Tab, Tabs, Popover, Icon, PopoverAction } from 'vant'
 import { ChartCycleType } from '@/constants/chart'
 import TimeLine from './timeline/index.vue'
 import KLine from './kline/index.vue'
-import MLine from '../../hqchart/timeline/index.vue'
-//import KLine from '../../hqchart/candlestick/index.vue'
 
 defineProps({
     goodsCode: {
@@ -37,7 +35,6 @@ defineProps({
     }
 })
 
-const symbol = '000000.et' // https://blog.csdn.net/jones2000/article/details/104457569
 const tabIndex = shallowRef(0) // 当前选中的标签
 const selectedText = shallowRef('') // 当前选中的分钟线
 const cycleType = shallowRef(ChartCycleType.Minutes) // 图表周期类型

+ 1 - 0
src/packages/mobile/main.ts

@@ -6,6 +6,7 @@ import router from './router'
 import directives from '@/directives' // 自定义指令集
 //import 'default-passive-events'
 import '@/utils/h5plus' // 加载html5+
+import 'hqchart/src/jscommon/umychart.resource/font/iconfont.css'
 import layouts from './components/layouts' // 全局布局组件
 import 'vant/lib/index.css'
 import './assets/themes/style.less' // 主题样式

+ 1 - 1
src/packages/mobile/views/goods/detail/Index.vue

@@ -34,7 +34,7 @@ defineProps({
 })
 
 const Price = defineAsyncComponent(() => import('@mobile/components/modules/quote/price/index.vue'))
-const Chart = defineAsyncComponent(() => import('@mobile/components/modules/quote/chart/index.vue'))
+const Chart = defineAsyncComponent(() => import('@mobile/components/modules/hqchart/index.vue'))
 const Forex = defineAsyncComponent(() => import('@mobile/components/modules/quote/forex/index.vue'))
 const Tik = defineAsyncComponent(() => import('@mobile/components/modules/quote/tik/index.vue'))
 

+ 1 - 1
src/packages/mobile/views/market/detail/Index.vue

@@ -15,7 +15,7 @@ import { useNavigation } from '@mobile/router/navigation'
 import { useFuturesStore } from '@/stores'
 
 const Price = defineAsyncComponent(() => import('@mobile/components/modules/quote/price/index.vue'))
-const Chart = defineAsyncComponent(() => import('@mobile/components/modules/quote/chart/index.vue'))
+const Chart = defineAsyncComponent(() => import('@mobile/components/modules/hqchart/index.vue'))
 const Tik = defineAsyncComponent(() => import('@mobile/components/modules/quote/tik/index.vue'))
 
 const { getQueryString } = useNavigation()

+ 1 - 1
src/packages/pc/components/modules/goods-detail/chart/index.vue

@@ -13,7 +13,7 @@
 
 <script lang="ts" setup>
 import Price from '@pc/components/modules/quote/price/index.vue'
-import Chart from '@pc/components/modules/quote/chart/index.vue'
+import Chart from '@pc/components/modules/hqchart/index.vue'
 import Forex from '@pc/components/modules/quote/forex/index.vue'
 import Tik from '@pc/components/modules/quote/tik/index.vue'
 

+ 11 - 3
src/packages/pc/components/modules/hqchart/candlestick/index.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="app-candlestick">
         <HQChart default-theme="Dark" @ready="onReady" />
-        <Tabs class="app-tabs--indicator" :data-list="tabs" @change="changeIndex" />
+        <Tabs class="app-tabs--indicator" :data-list="tabs" @change="changeIndex" v-if="showIndex" />
     </div>
 </template>
 
@@ -27,6 +27,11 @@ const props = defineProps({
     cycleType: {
         type: Number,
         required: true
+    },
+    // 是否显示指标数据
+    showIndex: {
+        type: Boolean,
+        default: true
     }
 })
 
@@ -79,8 +84,7 @@ const chartOption = {
     NetworkFilter: (data: NetworkFilterData, callback: NetworkFilterCallback) => networkFilter(data, callback),
     // https://blog.csdn.net/jones2000/article/details/102928907
     Windows: [
-        { Index: 'MA', Change: false },
-        { Index: 'VOL', Close: false }
+        { Index: 'MA', Change: false, Close: false }
     ],
     IsCorssOnlyDrawKLine: true,  // 十字光标只能在K线上
     IsShowCorssCursorInfo: true,
@@ -108,6 +112,7 @@ const chartOption = {
         RightSpaceCount: 1,
         // https://blog.csdn.net/jones2000/article/details/104443471
         IsShowTooltip: true,
+        KLineDoubleClick: false
     },
     KLineTitle:
     {
@@ -137,6 +142,9 @@ const changeIndex = (index: number) => {
 }
 
 const onReady = (chart: unknown) => {
+    if (props.showIndex) {
+        chartOption.Windows.push({ Index: 'VOL', Change: true, Close: false })
+    }
     chartInstance.value = chart
     chartInstance.value.SetOption(chartOption)
 }

+ 1 - 1
src/packages/pc/components/modules/quote/tik/index.vue

@@ -11,7 +11,7 @@
                     <span :class="handlePriceColor(item.PE, quoteDay.presettle)">
                         {{ handleNumberValue(formatDecimal(item.PE, quoteDay.decimalplace)) }}
                     </span>
-                    <span quoteDay?.marketid != 99201>{{ handleNumberValue(item.Vol) }}</span>
+                    <span v-if="quoteDay?.marketid != 99201">{{ handleNumberValue(item.Vol) }}</span>
                 </li>
             </ul>
         </div>

+ 1 - 1
src/packages/tjmd/views/user/login/Index.vue

@@ -1,5 +1,5 @@
 <template>
-  <AppLogin :logo-src="logoImage" />
+  <AppLogin :logo-src="logoImage" :show-yhkhfxgzs="false" />
 </template>
 
 <script lang="ts" setup>