songlin3 3 anni fa
parent
commit
f71ef74171

+ 1 - 2
2020/trail/aiot/package.json

@ -18,7 +18,6 @@
18 18
    "less-loader": "^5.0.0",
19 19
    "node-sass": "^4.14.1",
20 20
    "qs": "^6.9.4",
21
    "salteen": "^1.0.0",
22 21
    "sass-loader": "^7.3.0",
23 22
    "stylus": "^0.54.7",
24 23
    "stylus-loader": "^3.0.2",
@ -36,7 +35,7 @@
36 35
    "babel-plugin-transform-remove-console": "^6.9.4",
37 36
    "eslint": "^5.16.0",
38 37
    "eslint-plugin-vue": "^5.0.0",
39
    "postcss-pxtorem": "^4.0.1",
38
    "postcss-px2rem": "^4.0.1",
40 39
    "style-loader": "^3.2.1",
41 40
    "vue-cli-plugin-element": "^1.0.1",
42 41
    "vue-template-compiler": "^2.6.10"

+ 44 - 0
2020/trail/aiot/src/common/flexible.js

@ -0,0 +1,44 @@
1
(function flexible (window, document) {
2
  var docEl = document.documentElement
3
  var dpr = window.devicePixelRatio || 1
4
5
  // adjust body font size
6
  function setBodyFontSize () {
7
    if (document.body) {
8
      document.body.style.fontSize = (12 * dpr) + 'px'
9
    }
10
    else {
11
      document.addEventListener('DOMContentLoaded', setBodyFontSize)
12
    }
13
  }
14
  setBodyFontSize();
15
16
  // set 1rem = viewWidth / 10
17
  function setRemUnit () {
18
    var rem = docEl.clientWidth / 65
19
    docEl.style.fontSize = rem + 'px'
20
  }
21
22
  setRemUnit()
23
24
  // reset rem unit on page resize
25
  window.addEventListener('resize', setRemUnit)
26
  window.addEventListener('pageshow', function (e) {
27
    if (e.persisted) {
28
      setRemUnit()
29
    }
30
  })
31
32
  // detect 0.5px supports
33
  if (dpr >= 2) {
34
    var fakeBody = document.createElement('body')
35
    var testElement = document.createElement('div')
36
    testElement.style.border = '.5px solid transparent'
37
    fakeBody.appendChild(testElement)
38
    docEl.appendChild(fakeBody)
39
    if (testElement.offsetHeight === 1) {
40
      docEl.classList.add('hairlines')
41
    }
42
    docEl.removeChild(fakeBody)
43
  }
44
}(window, document))

+ 1 - 4
2020/trail/aiot/src/main.js

@ -3,20 +3,17 @@ import App from './App.vue'
3 3
import router from './router'
4 4
import ElementUI from 'element-ui'
5 5
import './plugins/element.js'
6
import './common/rem.js'
6
import './common/flexible'
7 7
import './style/reset.css'
8 8
import axios from 'axios'
9 9
import qs from 'qs'
10 10
import md5  from 'js-md5'
11 11
import VueCookies from 'vue-cookies'
12
import {encrypt, decrypt} from 'salteen'
13 12
Vue.prototype.$http = axios
14 13
Vue.prototype.$qs = qs
15 14
Vue.prototype.$md5 = md5
16 15
Vue.use(VueCookies)
17 16
Vue.use(ElementUI)
18
Vue.prototype.$encypt = encrypt
19
Vue.prototype.$decrypt = decrypt
20 17
Vue.config.productionTip = false
21 18
// axios.defaults.baseURL=location.protocol + '//' + location.host +"/api"  // 本地连服务器后台开发用
22 19
// axios.defaults.baseURL='http://121.42.183.206:9085/website-server/' // nginx打包用

+ 2 - 2
2020/trail/aiot/src/style/reset.css

@ -71,8 +71,8 @@ html {
71 71
  margin-left: -1px;
72 72
  }
73 73
  hr {
74
  border-bottom: 1pxsolid#FFFFFF;
75
  border-top: 1pxsolid#E4E4E4;
74
  border-bottom: 1px solid#FFFFFF;
75
  border-top: 1px solid#E4E4E4;
76 76
  border-width: 1px0;
77 77
  clear: both;
78 78
  height: 2px;

+ 3 - 2
2020/trail/aiot/src/views/iot-portal/home.vue

@ -50,9 +50,10 @@ export default{
50 50
</script>
51 51
<style lang="scss" scoped>
52 52
.home{
53
  width:1920px;
53
  // width:1920px;
54
  width:100%;
54 55
  height:1280px;
55
  overflow:auto;
56
  // overflow:auto;
56 57
}
57 58
img{
58 59
  height: 40px;