summaryrefstree
path: root/usr/bin/qml/VR/HMIVR_Stock.qml
blob: 7434a77c362709d95dad4d7f0c56e49217e592f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
import QtQuick 2.0
import Label 2.0

import "../com/neusoft/auto/widgets"
import "../eventsList.js" as EventsList
import "../layoutList.js" as Layout
import "../windowsList.js" as WindowsList
import "./Func.js" as VrFunc

Item
{
    id:stock_main
    property string stock_title_text: ""
    property int stock_step: 0
	
    property int titlex: 30
    property int titley: 50	
    property int fontsize: VrFunc.FONT_SIZE
	property string userCmd: vrCtrl.vrSttText
	
    property string getStockDate: ""
    property string getStockName: ""
    property string getStockCode: ""
    property string getStockCurPrice: ""
    property string getStockOpePrice: ""
    property string getStockCloPrice: ""
    property string getStockRiseVal: ""
    property string getStockRiseRate: ""	
    property string getStockHighPrice: ""
    property string getStockLowPrice: ""

    Item{
        visible:(stock_step == VrFunc.STOCK_WEB_PROMPT)||
                (stock_step == VrFunc.STOCK_SHOW_WEBPIC)?true:false

        /* 股票显示 */
        HMILabel{
             id:titleText
             x:titlex
             y:titley
             width:540
             height:30
             text:stock_title_text + systemCtrl.emptyString//"你可以继续说话▪▪▪"
             verticalAlignment: Label.AlignVCenter
             horizontalAlignment: Label.AlignHCenter
             font.pixelSize:30//fontsize
             color: "white"
         }
    }

	Item
	{
        visible: stock_step == VrFunc.STOCK_SHOW_WEBPIC ? true : false
		Image{
			y:titley+60
			width:570
			height:700
			source:"qrc:MATERIAL/MATERIAL_M8X_LIST_78_W558_BG"+ bgImageStyle
		}
		Item
		{
			id:user_cmd
			x:titlex
			y:titley+120
			width: 528
			height: 74
			Text
			{
				id:fake_text
				font.pixelSize: 30
				visible:false
				text: userCmd
			}
			Image{
				x:fake_text.width>480? 0:(480-fake_text.width)
				width: fake_text.width>480? 528:(fake_text.width+48)
				height: 74
				source: userCmd != ""?"qrc:MATERIAL/MATERIAL_M8X_USER_BG"+bgImageStyle:""
				HMILabel
				{
					anchors.fill: parent
					text:userCmd
					color:"white"
					font.pixelSize:30
					//elide: Label.ElideRight
					wrapMode: Label.Wrap
				}
			}
		}			
	}	
	
    Item{
        id:stock_info
		y:titley+250
		width:558
		height:400
        visible:stock_step == VrFunc.STOCK_SHOW_WEBPIC ? true : false

        Item{
            x:20
            width: 530
            height: 354
			Image{
				id:uu
				x:0
				y:0
				source:"qrc:MATERIAL/MATERIAL_M8X_SPEECH_LIST_BG_U"+bgImageStyle		  
			}
			Image{
				id:aa
				x:0
				y:12
				source:"qrc:MATERIAL/MATERIAL_M8X_SPEECH_LIST_BG_A"+bgImageStyle	  
			}
			Image{
				id:cc
				x:0
				y:42
				height:300
				source:"qrc:MATERIAL/MATERIAL_M8X_SPEECH_LIST_BG_C"+bgImageStyle	  
			}
			Image{
				x:0
				y:cc.y+cc.height
				source:"qrc:MATERIAL/MATERIAL_M8X_SPEECH_LIST_BG_D"+bgImageStyle
			}			
        }
		
        HMILabel{
            id:stock_name
            x:50
            y:30
            width:420
            height:30
            text:getStockName+"("+getStockCode+")"//"科大讯飞"+"("+"002230"+")"
            horizontalAlignment:Text.AlignLeft
            font.pixelSize:30//fontsize
            color: "white"
            visible:true
        }
        //股票当前价格
        HMILabel{
            id:stockCurPrice
            x:50
            y:90
            width:330
            height:90
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:60
            text:getStockCurPrice + systemCtrl.emptyString  //"88.880"
            color:(getStockRiseVal.indexOf("-") < 0) ? ((getStockRiseVal == "0.0") ? "white" : "red") : "green"
        }

        //比率
        HMILabel{
            id:stockRiseVal
            x:390
            y:100
            width: 150
            height: 30
            font.pixelSize: 28
            horizontalAlignment:Text.AlignLeft
            text:getStockRiseVal + systemCtrl.emptyString // "+10.080"
            color:(getStockRiseVal.indexOf("-") < 0) ? ((getStockRiseVal == "0.0") ? "white" : "red") : "green"
        }
        HMILabel{
            id:stockRiseRate
            x:390
            y:140
            width: 150
            height: 30
            font.pixelSize: 28
            horizontalAlignment:Text.AlignLeft
            text:getStockRiseRate + systemCtrl.emptyString //"+10.000%"
            color:(getStockRiseVal.indexOf("-") < 0) ? ((getStockRiseVal == "0.0") ? "white" : "red") : "green"
        }

        Column{
            spacing: 25
            x:50
            y:250
            width: 64
            height: 75
            Repeater {
                id:price_ope_clo
                model: ["今开","昨收"]
                HMILabel{
                    width:64
                    height: 25
                    font.pixelSize: 24
                    horizontalAlignment:Text.AlignLeft
                    text:qsTr(modelData);
                }
            }
        }
        HMILabel{
            id:stockOpenPrice                                        //今开
            x:120
            y:250
            width:130
            height:25
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:24
            text:getStockOpePrice + systemCtrl.emptyString  //"80.080"
            color:"white"
        }
        HMILabel{
            id:stockClosePrice                                        //昨收
            x:120
            y:300
            width:130
            height:25
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:24
            text:getStockCloPrice + systemCtrl.emptyString// "30.050"
            color:"white"
        }
        Column{
            spacing: 25
            x:290
            y:250
            width: 64
            height: 72
            Repeater {
                id:stock_low_high
                model: ["最高","最低"]
                HMILabel{
                    width:64
                    height: 25
                    font.pixelSize: 24
                    text:qsTr(modelData);
                }
            }
        }

        HMILabel{
            id:stockHighPrice                                        //最高
            x:360
            y:250
            width:130
            height:25
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:24
            text:getStockHighPrice + systemCtrl.emptyString	//"30.050"
            color:"white"
        }
        HMILabel{
            id:stockLowPrice                                       //最低
            x:360
            y:300
            width:130
            height:25
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:24
            text:getStockLowPrice + systemCtrl.emptyString //"80.080"
            color:"white"
        }
        HMILabel{
            id:note_text                                       //备注说明
            x:25
            y:364
            width:558
            height:20
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignLeft
            font.pixelSize:20
            text:"数据由新浪网提供"+" 更新时间"+getStockDate//"2017-2-28"+"12:00"
            color:"gray"
        }
    }


    function stockExitVr()
    {
        systemCtrl.reqSource(Layout.HMI_SRC_VR,Layout.HMI_SRC_End,Layout.HMI_SRC_Front)
    }

    /*----------------------------------------------------------------------------*/
    /*----------------- JavaScript Function Declaration Section ------------------*/
    /*----------------------------------------------------------------------------*/

    function stockInfo(result1,result2)
    {
        //console.log()
        switch (result1)
        {
        case "show_webpic":
            vrCtrl.mtd_StockTtsRequest()
            vrmain.vrPageType = VrFunc.VR_DELAY2S_CLOSE
            stock_step = VrFunc.STOCK_SHOW_WEBPIC
			titleText.horizontalAlignment = Label.AlignHCenter
            stock_title_text = "股票"
            getStockDate = vrCtrl.getStockDate()
            getStockName = vrCtrl.getStockName()
            getStockCode = vrCtrl.getStockCode()
            getStockCurPrice = vrCtrl.getStockCurPrice()
            getStockOpePrice = vrCtrl.getStockOpePrice()
            getStockCloPrice = vrCtrl.getStockCloPrice()
            getStockRiseVal = vrCtrl.getStockRiseVal()
            getStockRiseRate = vrCtrl.getStockRiseRate()			
            getStockHighPrice = vrCtrl.getStockHighPrice()
            getStockLowPrice = vrCtrl.getStockLowPrice()
            break;
        case "web_prompt":
        case "show_weburl":		
        default:
            stock_step = VrFunc.STOCK_WEB_PROMPT
			titleText.horizontalAlignment = Label.AlignLeft
            stock_title_text = "您可以这样说查询华晨中国的股票,或者说查询600609的股票"
            vrCtrl.ttsSpeak(stock_title_text, VrFunc.LIBTTS_PB_MODE_REPLACE)
            vrmain.ttsFinishKind = VrFunc.VR_TTS_KIND_NORMAL
            vrmain.vrPageType = VrFunc.VR_ERROR_PAGE
            break;
        }
    }
}