Explorar o código

feat:element-ui css引入方式修改

yf_zhb %!s(int64=2) %!d(string=hai) anos
pai
achega
cd8638151c
Modificáronse 2 ficheiros con 57 adicións e 64 borrados
  1. 1 5
      pingpu_vue/index.html
  2. 56 59
      pingpu_vue/src/main.js

+ 1 - 5
pingpu_vue/index.html

@@ -4,10 +4,6 @@
     <meta charset="utf-8" />
     <meta name="viewport" content="width=device-width,initial-scale=1.0" />
     <title>农业数字化管理服务平台</title>
-    <link
-      rel="stylesheet"
-      href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"
-    />
   </head>
   <style>
     .el-select-dropdown__item.selected {
@@ -46,7 +42,7 @@
     <!-- built files will be auto injected -->
     <script>
       window._AMapSecurityConfig = {
-        securityJsCode: "948c53e498c3188cb404ccdaf71be16c",
+        securityJsCode: "948c53e498c3188cb404ccdaf71be16c"
       };
     </script>
     <script src="https://webapi.amap.com/maps?v=2.0&key=c907b4265ae043cbdbf64304f1f80b2b&plugin=AMap.PolygonEditor,AMap.MarkerClusterer,AMap.DistrictSearch"></script>

+ 56 - 59
pingpu_vue/src/main.js

@@ -1,62 +1,61 @@
 // The Vue build version to load with the `import` command
 // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
-import Vue from 'vue'
-import App from './App'
-import router from './router'
-import "@/assets/fonts/iconfont.css"
-Vue.config.productionTip = false
+import Vue from "vue";
+import App from "./App";
+import router from "./router";
+import "@/assets/fonts/iconfont.css"; // 全局注册,使用方法为:this.$axios
+import "./util/http.js";
+// 格式化时间戳
+import "./util/formatTime";
+import "element-ui/lib/theme-chalk/index.css";
 
-const axios = require('axios')
-const Qs = require('qs')
+import VueLazyLoad from "vue-lazyload";
 
-Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios
-import './util/http.js'
-//格式化时间戳
-import './util/formatTime'
+import { VueJsonp } from "vue-jsonp";
+
+import VueHighcharts from "vue-highcharts";
+import Viewer from "v-viewer";
+import "viewerjs/dist/viewer.css";
+Vue.config.productionTip = false;
+
+const axios = require("axios");
+const Qs = require("qs");
+
+Vue.prototype.$axios = axios;
 // import qs from 'qs'
-Vue.prototype.qs = Qs //全局注册,使用方法为:this.qs
-Vue.prototype.$http = "http://106.119.196.18:10004"
+Vue.prototype.qs = Qs; // 全局注册,使用方法为:this.qs
+Vue.prototype.$http = "http://106.119.196.18:10004";
 /* eslint-disable no-new */
-const ElementUI = require('element-ui')
+const ElementUI = require("element-ui");
 Vue.use(ElementUI);
-
-import VueLazyLoad from 'vue-lazyload'
 Vue.use(VueLazyLoad, {
   preLoad: 1,
   // error: require('./assets/images/noimage.png'),
-  error: require('./assets/images/newImg/noimage.png'),
+  error: require("./assets/images/newImg/noimage.png"),
   // loading: require('./assets/images/shot-1.gif'),
-  loading: require('./assets/images/newImg/shot-1.gif'),
-  attempt: 2,
-})
-
-import {
-  VueJsonp
-} from 'vue-jsonp' //解决百度地图跨域
-Vue.use(VueJsonp)
-
-import VueHighcharts from 'vue-highcharts';
+  loading: require("./assets/images/newImg/shot-1.gif"),
+  attempt: 2
+}); // 解决百度地图跨域
+Vue.use(VueJsonp);
 Vue.use(VueHighcharts);
-import Viewer from 'v-viewer'
 Vue.use(Viewer, {
   defaultOptions: {
-    "zIndex": 99999999,
+    zIndex: 99999999
   }
-})
-import 'viewerjs/dist/viewer.css'
+});
 // Vue.prototype.$imghost = 'http://8.136.98.49:8002' // 线上图片服务器路径常量
 
 router.beforeEach(async (to, from, next) => {
-  console.log(to)
-  console.log(this)
-  var tokens = localStorage.getItem("keys")
+  console.log(to);
+  console.log(this);
+  var tokens = localStorage.getItem("keys");
   if (to.path == "/login") {
     if (tokens) {
       next({
-        path: '/index/home'
-      })
+        path: "/index/home"
+      });
     } else {
-      next()
+      next();
     }
   } else {
     if (to.query.token) {
@@ -65,8 +64,8 @@ router.beforeEach(async (to, from, next) => {
         url: "/api/api_gateway?method=user.login.zg_login_user",
         data: Qs.stringify({
           pp_token: to.query.token
-        }),
-      }).then((res) => {
+        })
+      }).then(res => {
         if (res.data.message == "") {
           console.log(res.data.data.data);
           var data = res.data.data.data.children;
@@ -74,49 +73,47 @@ router.beforeEach(async (to, from, next) => {
           for (let i = 0; i < data.length; i++) {
             menuList1.push(data[i]);
           }
-          localStorage.setItem("zg_keys",to.query.token)
+          localStorage.setItem("zg_keys", to.query.token);
           localStorage.setItem("menu", JSON.stringify(menuList1));
           var key = res.data.data.session_key;
           localStorage.setItem("keys", key);
           localStorage.setItem("username", res.data.data.data.username);
           localStorage.setItem("myuid", res.data.data.data.myuid);
-          next()
+          next();
         } else {
           next({
-            path: '/login'
-          })
+            path: "/login"
+          });
         }
       });
     } else {
       if (tokens) {
-        next()
+        next();
       } else {
         next({
-          path: '/login'
-        })
+          path: "/login"
+        });
         // next()
       }
     }
   }
-
-
-})
+});
 
 function throttle() {
-  let prev = 0
-  Vue.prototype.$throttle = function (func, wait) {
-    let now = Date.now()
+  let prev = 0;
+  Vue.prototype.$throttle = function(func, wait) {
+    let now = Date.now();
     if (now - prev > wait) {
-      func.apply(this)
-      prev = now
+      func.apply(this);
+      prev = now;
     }
-  }
+  };
 }
-throttle()
+throttle();
 
 new Vue({
-  el: '#app',
+  el: "#app",
   router,
   components: { App },
-  template: '<App/>'
-})
+  template: "<App/>"
+});