App.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div id="app">
  3. <Header/>
  4. <div class="scrollbar_style">
  5. <router-view></router-view>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. Number.prototype.formatNumberRgx = function() {
  11. var parts = this.toString().split(".");
  12. parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  13. return parts.join(".");
  14. };
  15. import Header from './components/header.vue'
  16. import { mapGetters } from 'vuex'
  17. import allUel from './api/allUel.js'
  18. export default {
  19. name: 'App',
  20. computed:{
  21. ...mapGetters({
  22. token:'token',
  23. client_key:'client_key',
  24. username:'username',
  25. version:'version',
  26. routerStr:'routerStr',
  27. avatar:'avatar',
  28. }),
  29. },
  30. components: {
  31. Header
  32. },
  33. created(){
  34. let linkTypeArr = window.location.href.split("/");
  35. let linkType = linkTypeArr[linkTypeArr.length-1];
  36. this.$store.commit('ROUTERSTRFUN',{
  37. routerStr:'/'+linkType
  38. })
  39. document.title = 'inHealth-'+linkType
  40. this.$router.beforeEach((to, from, next) => {
  41. // console.log(to.path,'--------')
  42. if(to.path == '/login'||to.path == '/retrievePassword'){
  43. this.headersShow = false
  44. }else{
  45. this.headersShow = true
  46. }
  47. console.log(this.headersShow)
  48. this.$store.commit('ROUTERSTRFUN',{
  49. routerStr:to.path
  50. })
  51. next();
  52. })
  53. },
  54. mounted(){
  55. let this_ = this;
  56. let width = document.body.offsetWidth;
  57. if(width >= 1920){
  58. $('html').css({'font-size':'95.01%'})
  59. this.$store.commit('REMRATIOFUN',{
  60. remRatio:0.9501*16,
  61. })
  62. }else{
  63. $('html').css({'font-size':width*62.5/1200+'%'})
  64. this.$store.commit('REMRATIOFUN',{
  65. remRatio:width*62.5/1200/100*16,
  66. })
  67. }
  68. window.onresize = function(){
  69. width = document.body.offsetWidth;
  70. // console.log(width)
  71. if(width >= 1920){
  72. $('html').css({'font-size':'95.01%'})
  73. this_.$store.commit('REMRATIOFUN',{
  74. remRatio:0.9501*16,
  75. })
  76. }else{
  77. $('html').css({'font-size':width*62.5/1200+'%'})
  78. this_.$store.commit('REMRATIOFUN',{
  79. remRatio:width*62.5/1200/100*16,
  80. })
  81. }
  82. this_.$store.commit('UPDATEREMRATIOFUN',{
  83. updateRemRatio:this_.updateRemRatio+1,
  84. })
  85. }
  86. // var storage = window.localStorage;
  87. // var url = window.location.hash.split("?")[1]; //获取url中"?"符后的字串
  88. // var theRequest = new Object();
  89. var street = window.location.href.split("/")[2];
  90. let protocolStr = document.location.protocol;
  91. let subStrT = new RegExp('https:');//创建正则表达式对象
  92. if(street == 'localhost:8080' || street == '127.0.0.1:8080'){
  93. // street = 'newtest.solar-iot.com'
  94. street = 'new.solar-iot.com'
  95. // street = '10.0.0.123';
  96. this.webType = 2;
  97. protocolStr = 'http:';
  98. // this.webType = 1;
  99. }else if(street == 'solar.iotena.com'){
  100. street = 'new.solar-iot.com'
  101. }else if(street == 'www.gammausa.solar-iot.com'){
  102. /*en*/
  103. this.webType = 2;
  104. }else if(street == 'www.solar.flyingsmart.net'){
  105. /*正翔科技*/
  106. this.webType = 1;
  107. }
  108. for(let i in allUel){
  109. for(let key in allUel[i]){
  110. if(i == 'websocket'){
  111. allUel[i][key]=allUel[i][key].replace(new RegExp('ws:'),subStrW);
  112. }else{
  113. allUel[i][key]=allUel[i][key].replace(subStrT,protocolStr);
  114. }
  115. }
  116. }
  117. let subStr=new RegExp('newtest.solar-iot.com');//创建正则表达式对象
  118. for(let i in allUel){
  119. for(let key in allUel[i]){
  120. allUel[i][key]=allUel[i][key].replace(subStr,street);
  121. }
  122. }
  123. }
  124. }
  125. </script>
  126. <style type="text/css" lang="less">
  127. @font-face {
  128. font-family: 'PingFang-SC-Heavy';
  129. src: url('./style/font-pf/PingFangHeavy.eot');
  130. src:
  131. url('./style/font-pf/PingFangHeavy.eot?#font-spider') format('embedded-opentype'),
  132. url('./style/font-pf/PingFangHeavy.woff') format('woff'),
  133. url('./style/font-pf/PingFangHeavy.ttf') format('truetype'),
  134. url('./style/font-pf/PingFangHeavy.svg') format('svg');
  135. font-weight: normal;
  136. font-style: normal;
  137. }
  138. @font-face {
  139. font-family: 'PingFangSC-Medium';
  140. src: url('./style/font-pf/PingFangMedium.ttf');
  141. font-weight: normal;
  142. font-style: normal;
  143. }
  144. @font-face {
  145. font-family: 'AlibabaPuHuiTiR';
  146. src: url('./style/font-al/Alibaba-PuHuiTi-Regular.eot');
  147. src:
  148. url('./style/font-al/Alibaba-PuHuiTi-Regular.eot?#font-spider') format('embedded-opentype'),
  149. url('./style/font-al/Alibaba-PuHuiTi-Regular.woff') format('woff'),
  150. url('./style/font-al/Alibaba-PuHuiTi-Regular.ttf') format('truetype'),
  151. url('./style/font-al/Alibaba-PuHuiTi-Regular.svg') format('svg');
  152. font-weight: normal;
  153. font-style: normal;
  154. }
  155. @font-face {
  156. font-family: 'AlibabaPuHuiTiH';
  157. src: url('./style/font-al/Alibaba-PuHuiTi-Heavy.ttf');
  158. src:
  159. url('./style/font-al/Alibaba-PuHuiTi-Heavy.eot?#font-spider') format('embedded-opentype'),
  160. url('./style/font-al/Alibaba-PuHuiTi-Heavy.woff') format('woff'),
  161. url('./style/font-al/Alibaba-PuHuiTi-Heavy.ttf') format('truetype'),
  162. url('./style/font-al/Alibaba-PuHuiTi-Heavy.svg') format('svg');
  163. font-weight: normal;
  164. font-style: normal;
  165. }
  166. @font-face {
  167. font-family: 'AlibabaPuHuiTiB';
  168. src: url('./style/font-al/Alibaba-PuHuiTi-Bold.ttf');
  169. src:
  170. url('./style/font-al/Alibaba-PuHuiTi-Bold.eot?#font-spider') format('embedded-opentype'),
  171. url('./style/font-al/Alibaba-PuHuiTi-Bold.woff') format('woff'),
  172. url('./style/font-al/Alibaba-PuHuiTi-Bold.ttf') format('truetype'),
  173. url('./style/font-al/Alibaba-PuHuiTi-Bold.svg') format('svg');
  174. font-weight: normal;
  175. font-style: normal;
  176. }
  177. @font-face {
  178. font-family: 'AlibabaPuHuiTiL';
  179. src: url('./style/font-al/Alibaba-PuHuiTi-Light.ttf');
  180. src:
  181. url('./style/font-al/Alibaba-PuHuiTi-Light.eot?#font-spider') format('embedded-opentype'),
  182. url('./style/font-al/Alibaba-PuHuiTi-Light.woff') format('woff'),
  183. url('./style/font-al/Alibaba-PuHuiTi-Light.ttf') format('truetype'),
  184. url('./style/font-al/Alibaba-PuHuiTi-Light.svg') format('svg');
  185. font-weight: normal;
  186. font-style: normal;
  187. }
  188. @font-face {
  189. font-family: 'AlibabaPuHuiTiM';
  190. src: url('./style/font-al/Alibaba-PuHuiTi-Medium.ttf');
  191. src:
  192. url('./style/font-al/Alibaba-PuHuiTi-Medium.eot?#font-spider') format('embedded-opentype'),
  193. url('./style/font-al/Alibaba-PuHuiTi-Medium.woff') format('woff'),
  194. url('./style/font-al/Alibaba-PuHuiTi-Medium.ttf') format('truetype'),
  195. url('./style/font-al/Alibaba-PuHuiTi-Medium.svg') format('svg');
  196. font-weight: normal;
  197. font-style: normal;
  198. }
  199. // @font-face {
  200. // font-family: 'bodoni-MT';
  201. // src: url('./style/bodoniMT/bodoniMT.ttf');
  202. // }
  203. html,body,p,h1,h2,h3,h4,h5,ul,li{
  204. margin: 0px;
  205. padding: 0px;
  206. }
  207. html,body,#app{
  208. height: 100%;
  209. width:100%;
  210. }
  211. li{
  212. list-style:none;/*li去点*/
  213. box-sizing: border-box;
  214. }
  215. a{
  216. text-decoration: none;
  217. box-sizing: border-box;
  218. }
  219. i{
  220. font-style: inherit;
  221. }
  222. input{
  223. padding:0;
  224. outline-style: none;
  225. box-sizing: border-box;
  226. }
  227. div{
  228. box-sizing: border-box; //border、padding并入宽度。
  229. }
  230. /*滚动条样式*/
  231. .el-table__body-wrapper::-webkit-scrollbar {/*滚动条整体样式*/
  232. width: 3px; /*高宽分别对应横竖滚动条的尺寸*/
  233. height: 5px;
  234. }
  235. .el-table__body-wrapper::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
  236. border-radius: 3px;
  237. background: #DAE6E0;
  238. }
  239. .el-table__body-wrapper::-webkit-scrollbar-track {/*滚动条里面轨道*/
  240. background: #F6F8F7;
  241. }
  242. .el-table{
  243. th>.cell,td>.cell{
  244. padding: 0;
  245. }
  246. .el-table__body-wrapper{
  247. width: calc(100% - 8px);
  248. margin-right: 8px;
  249. }
  250. }
  251. .scrollbar_style{
  252. // margin-right: 8px;
  253. overflow: auto;
  254. }
  255. /*.scrollbar_style::-webkit-scrollbar-button{
  256. width: 10px;
  257. height: 10px;
  258. }*/
  259. .scrollbar_style::-webkit-scrollbar {/*滚动条整体样式*/
  260. width: 3px; /*高宽分别对应横竖滚动条的尺寸*/
  261. height: 5px;
  262. }
  263. .scrollbar_style::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
  264. border-radius: 3px;
  265. background: #DAE6E0;
  266. }
  267. .scrollbar_style::-webkit-scrollbar-track {/*滚动条里面轨道*/
  268. background: #F6F8F7;
  269. }
  270. #app{
  271. >.scrollbar_style{
  272. // width: calc(100% - 8px);
  273. width: calc(100%);
  274. height: calc(100% - 4.1rem);
  275. &.padding{
  276. padding-top: 4.2rem;
  277. }
  278. }
  279. }
  280. .el-dropdown-menu__item:focus, .el-dropdown-menu__item:not(.is-disabled):hover{
  281. color: initial;
  282. background-color: #f5f7fa;
  283. }
  284. .el-dropdown-menu{
  285. max-height: 360px;
  286. .el-dropdown-menu__item{
  287. &.select{
  288. color: #409eff;
  289. font-weight: 700;
  290. }
  291. }
  292. }
  293. /*弹框样式*/
  294. .solar_dialig{
  295. .el-dialog__header{
  296. border-bottom: 1px solid #E8E8E8;
  297. span{
  298. color: #444444;
  299. }
  300. }
  301. .el-dialog__headerbtn {
  302. top: 13px;
  303. font-size: 30px;
  304. }
  305. .el-dialog__body{
  306. .dialog_foot{
  307. text-align:center;padding: 60px 0 20px 0;
  308. .el-button{
  309. width:320px;
  310. height:60px;
  311. border-radius: 6px;
  312. font-size:16px;
  313. }
  314. }
  315. }
  316. }
  317. </style>