PanelWindow.qml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. import QtQuick
  2. import QtQuick.Controls 2.5
  3. import QtQuick.Layouts 1.3
  4. import "backend.js" as Backend
  5. Item {
  6. property string back_content: "ask content";
  7. property string move_content: "";
  8. property int uid: 0
  9. property string strArea:""
  10. property string strNo:""
  11. width: 1920
  12. height: 1080
  13. visible: true
  14. FontLoader {
  15. id: alibaba
  16. source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf"
  17. }
  18. FontLoader {
  19. id: fontawesome
  20. source: "qrc:/components/font/fontawesome-webfont.ttf"
  21. }
  22. signal loginSuccess(var userName, var password)
  23. function loginUser(uname, pword) {
  24. var ret = Backend.validateUserCredentials(uname, pword)
  25. var message = ""
  26. if (ret) {
  27. message = "用户名或密码输入错误"
  28. subPopup.popMessage = message
  29. subPopup.open()
  30. return
  31. }
  32. appModel.userLogin(uname, pword);
  33. page_car.visible = true
  34. page_car.stack = stack
  35. stack.push(page_car)
  36. }
  37. function carManage(){
  38. stack.pop()
  39. }
  40. function workManage(){
  41. page_work.visible=true;
  42. page_work.stack=stack;
  43. stack.push(page_work)
  44. }
  45. function carSelect(id) {
  46. appModel.connectCar(id)
  47. }
  48. function track()
  49. {
  50. // appModel.track()
  51. }
  52. function unTrack()
  53. {
  54. console.log('1111111');
  55. appModel.leaveCar()
  56. appModel.ready = false
  57. stack.pop()
  58. page_detail.update()
  59. stack.pop()
  60. }
  61. Popup {
  62. id: subPopup
  63. property alias popMessage: message.text
  64. background: Rectangle {
  65. id: subPopupBg
  66. implicitWidth: 1920
  67. implicitHeight: 60
  68. color: popupBgColorErr
  69. }
  70. y: (parent.height - 60)
  71. modal: true
  72. focus: true
  73. closePolicy: Popup.CloseOnPressOutside
  74. Text {
  75. id: message
  76. anchors.centerIn: parent
  77. font.pointSize: 12
  78. color: popupTextColor
  79. font.family: alibaba.name
  80. }
  81. onOpened: subPopupClose.start()
  82. }
  83. Timer {
  84. id: subPopupClose
  85. interval: 3000
  86. onTriggered: subPopup.close()
  87. }
  88. Rectangle {
  89. anchors.fill: parent
  90. Image {
  91. fillMode: Image.PreserveAspectFit
  92. source: 'qrc:/images/bg.png'
  93. }
  94. color: 'transparent'
  95. }
  96. Rectangle {
  97. width: parent.width
  98. height: 80
  99. color: 'transparent'
  100. z: 99
  101. Image {
  102. anchors.horizontalCenter: parent.horizontalCenter
  103. fillMode: Image.PreserveAspectFit
  104. source: 'qrc:/images/banner.png'
  105. }
  106. Text {
  107. anchors.horizontalCenter: parent.horizontalCenter
  108. anchors.verticalCenter: parent.verticalCenter
  109. text: textTitle
  110. font.family: alibaba.name
  111. font.pointSize: 24
  112. color: mainTextColor
  113. }
  114. }
  115. StackView {
  116. id: stack
  117. initialItem: page_login
  118. anchors.fill: parent
  119. }
  120. LoginPage {
  121. id: page_login
  122. visible: false
  123. }
  124. CarPage {
  125. id: page_car
  126. visible: false
  127. }
  128. WorkPage
  129. {
  130. id: page_work
  131. visible:false
  132. }
  133. DetailPage {
  134. id: page_detail
  135. visible: false
  136. }
  137. Dialog {
  138. id: backDialog
  139. visible: false
  140. modal: true
  141. x: (parent.width - width) / 2
  142. y: (parent.height - height) / 2
  143. closePolicy: Popup.NoAutoClose
  144. implicitWidth: 600
  145. implicitHeight: 300
  146. Text {
  147. text: back_content
  148. font.pointSize: 24
  149. font.family: alibaba.name
  150. color: '#000000'
  151. anchors.horizontalCenter: parent.horizontalCenter
  152. y: 100
  153. }
  154. Row {
  155. height: parent.height
  156. anchors.horizontalCenter: parent.horizontalCenter
  157. y: 200
  158. CButton {
  159. id: quitButton
  160. textHeight: 50
  161. fontHeight: 0.4
  162. width: 150
  163. height: 50
  164. color: pressed ? textClickedColor : mainAppColor
  165. text: "确定"
  166. onClicked: {
  167. appModel.controlCar(uid);
  168. backDialog.visible = false;
  169. // videoWindow.close()
  170. // rootItem.qmlSignalQuit()
  171. }
  172. }
  173. spacing: 50
  174. CButton {
  175. id: cancelBtn
  176. textHeight: 50
  177. fontHeight: 0.4
  178. width: 150
  179. height: 50
  180. color: pressed ? textClickedColor : mainAppColor
  181. text: "取消"
  182. onClicked: {
  183. appModel.cancelControl()
  184. backDialog.visible = false
  185. }
  186. }
  187. }
  188. }
  189. Dialog {
  190. id: trackDialog
  191. visible: false
  192. modal: true
  193. x: (parent.width - width) / 2
  194. y: (parent.height - height) / 2
  195. closePolicy: Popup.NoAutoClose
  196. implicitWidth: 600
  197. implicitHeight: 300
  198. Text {
  199. text: back_content
  200. font.pointSize: 24
  201. font.family: alibaba.name
  202. color: '#000000'
  203. anchors.horizontalCenter: parent.horizontalCenter
  204. y: 100
  205. }
  206. Row {
  207. height: parent.height
  208. anchors.horizontalCenter: parent.horizontalCenter
  209. y: 200
  210. CButton {
  211. id: yesBtn
  212. textHeight: 50
  213. fontHeight: 0.4
  214. width: 150
  215. height: 50
  216. color: pressed ? textClickedColor : mainAppColor
  217. text: "是"
  218. onClicked: {
  219. track();
  220. trackDialog.visible = false;
  221. // videoWindow.close()
  222. // rootItem.qmlSignalQuit()
  223. }
  224. }
  225. spacing: 50
  226. CButton {
  227. id: noBtn
  228. textHeight: 50
  229. fontHeight: 0.4
  230. width: 150
  231. height: 50
  232. color: pressed ? textClickedColor : mainAppColor
  233. text: "否"
  234. onClicked: {
  235. unTrack();
  236. trackDialog.visible = false
  237. }
  238. }
  239. }
  240. }
  241. Dialog {
  242. id: moveErrorDlg
  243. visible: false
  244. modal: true
  245. x: (parent.width - width) / 2
  246. y: (parent.height - height) / 2
  247. closePolicy: Popup.NoAutoClose
  248. implicitWidth: 600
  249. implicitHeight: 300
  250. Text {
  251. text: move_content
  252. font.pointSize: 24
  253. font.family: alibaba.name
  254. color: '#000000'
  255. anchors.horizontalCenter: parent.horizontalCenter
  256. y: 100
  257. }
  258. Row {
  259. height: parent.height
  260. anchors.horizontalCenter: parent.horizontalCenter
  261. y: 200
  262. CButton {
  263. id: exbutton
  264. textHeight: 50
  265. fontHeight: 0.4
  266. width: 150
  267. height: 50
  268. color: pressed ? textClickedColor : mainAppColor
  269. text: "确定"
  270. onClicked: {
  271. appModel.controlCar(uid);
  272. backDialog.visible = false;
  273. // videoWindow.close()
  274. // rootItem.qmlSignalQuit()
  275. }
  276. }
  277. }
  278. }
  279. }