john 9 months ago
parent
commit
baf4bd9b6b
7 changed files with 76 additions and 80 deletions
  1. 6 6
      .eslintrc.js
  2. 12 12
      src/main.js
  3. 17 20
      src/router/index.js
  4. 21 21
      src/views/2020_5_6.vue
  5. 2 2
      src/views/About.vue
  6. 8 9
      src/views/printView.vue
  7. 10 10
      vue.config.js

+ 6 - 6
.eslintrc.js

@@ -1,18 +1,18 @@
 module.exports = {
   root: true,
   env: {
-    node: true
+    node: true,
   },
-  extends: ["plugin:vue/essential", "@vue/airbnb"],
+  extends: ['plugin:vue/essential', '@vue/airbnb'],
 
   parserOptions: {
-    parser: "babel-eslint"
+    parser: 'babel-eslint',
   },
 
   rules: {
-    "no-console": "off",
-    "no-debugger": "off"
+    'no-console': 'off',
+    'no-debugger': 'off',
   },
 
-  extends: ["plugin:vue/essential", "@vue/airbnb"]
+  extends: ['plugin:vue/essential', '@vue/airbnb'],
 };

+ 12 - 12
src/main.js

@@ -1,9 +1,9 @@
-import Vue from "vue";
-import * as Sentry from "@sentry/browser";
-import { Vue as VueIntegration } from "@sentry/integrations";
-import App from "./App.vue";
-import router from "./router";
-import store from "./store";
+import Vue from 'vue';
+import * as Sentry from '@sentry/browser';
+import { Vue as VueIntegration } from '@sentry/integrations';
+import App from './App.vue';
+import router from './router';
+import store from './store';
 
 // if (process.env.NODE_ENV === "production") {
 //   Sentry.init({
@@ -17,10 +17,10 @@ import store from "./store";
 // }
 
 // 在生产环境中让sentry报错
-process.env.NODE_ENV === "production" &&
-  Sentry.init({
-    dsn: "http://3a6d0bf34c8e48e79771449a1ef487db@localhost:9000/2",
-    integrations: [new VueIntegration({ Vue, attachProps: true })]
+process.env.NODE_ENV === 'production'
+  && Sentry.init({
+    dsn: 'http://3a6d0bf34c8e48e79771449a1ef487db@localhost:9000/2',
+    integrations: [new VueIntegration({ Vue, attachProps: true })],
   });
 
 Vue.config.productionTip = false;
@@ -28,5 +28,5 @@ Vue.config.productionTip = false;
 new Vue({
   router,
   store,
-  render: h => h(App)
-}).$mount("#app");
+  render: (h) => h(App),
+}).$mount('#app');

+ 17 - 20
src/router/index.js

@@ -1,46 +1,43 @@
-import Vue from "vue";
-import VueRouter from "vue-router";
-import Home from "../views/Home.vue";
+import Vue from 'vue';
+import VueRouter from 'vue-router';
+import Home from '../views/Home.vue';
 
 Vue.use(VueRouter);
 
 const routes = [
   {
-    path: "/",
-    name: "Home",
-    component: Home
+    path: '/',
+    name: 'Home',
+    component: Home,
   },
   {
-    path: "/about",
-    name: "About",
+    path: '/about',
+    name: 'About',
     // route level code-splitting
     // this generates a separate chunk (about.[hash].js) for this route
     // which is lazy-loaded when the route is visited.
-    component: () =>
-      import(/* webpackChunkName: "about" */ "../views/About.vue")
+    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
   },
   {
-    path: "/2020_5_6",
-    name: "2020_5_6",
+    path: '/2020_5_6',
+    name: '2020_5_6',
     // route level code-splitting
     // this generates a separate chunk (about.[hash].js) for this route
     // which is lazy-loaded when the route is visited.
-    component: () =>
-      import(/* webpackChunkName: "2020_5_6" */ "../views/2020_5_6.vue")
+    component: () => import(/* webpackChunkName: "2020_5_6" */ '../views/2020_5_6.vue'),
   },
   {
-    path: "/printView",
-    name: "printView",
+    path: '/printView',
+    name: 'printView',
     // route level code-splitting
     // this generates a separate chunk (about.[hash].js) for this route
     // which is lazy-loaded when the route is visited.
-    component: () =>
-      import(/* webpackChunkName: "printView" */ "../views/printView.vue")
-  }
+    component: () => import(/* webpackChunkName: "printView" */ '../views/printView.vue'),
+  },
 ];
 
 const router = new VueRouter({
-  routes
+  routes,
 });
 
 export default router;

+ 21 - 21
src/views/2020_5_6.vue

@@ -22,7 +22,7 @@ export default {
       let start = -1;
       let end = -1;
       for (let i = 0; i < nums.length; i++) {
-        let item = nums[i];
+        const item = nums[i];
         const newArray = nums.slice(i + 1);
         newArray.forEach((element, index) => {
           if (item + element === target) {
@@ -39,34 +39,34 @@ export default {
       原因:342 + 465 = 807
     */
     addTwoNumbers(l1, l2) {
-      const setArr = arr => {
-        let newArr = [];
+      const setArr = (arr) => {
+        const newArr = [];
         for (let i = arr.length - 1; i > -1; i--) {
           newArr.push(arr[i]);
         }
-        return Number.parseInt(JSON.stringify(newArr).replace(/,|\[|\]/g, ""));
+        return Number.parseInt(JSON.stringify(newArr).replace(/,|\[|\]/g, ''));
       };
       const l1Num = setArr(l1);
       const l2Num = setArr(l2);
       const sun = l1Num + l2Num;
       const arrStr = sun.toString();
 
-      let arrNum = [];
+      const arrNum = [];
       for (let i = 0; i < arrStr.length; i++) {
         arrNum.push(Number.parseInt(arrStr[i]));
       }
       return arrNum;
     },
     test() {
-      let node = new ListNode("head");
-      let temp = node; //哑结点
-      let add = 0; //是否进一
-      let sum = 0; //新链表当前未取余的值 = 链表1值 + 链表2值 + add;
+      const node = new ListNode('head');
+      let temp = node; // 哑结点
+      let add = 0; // 是否进一
+      let sum = 0; // 新链表当前未取余的值 = 链表1值 + 链表2值 + add;
 
-      //遍历,直到最长的都为空
+      // 遍历,直到最长的都为空
       while (l1 || l2) {
         sum = (l1 ? l1.val : 0) + (l2 ? l2.val : 0) + add;
-        temp.next = new ListNode(sum % 10); //取余则为新链表的值
+        temp.next = new ListNode(sum % 10); // 取余则为新链表的值
         temp = temp.next;
         add = sum >= 10 ? 1 : 0;
         l1 && (l1 = l1.next);
@@ -96,15 +96,15 @@ export default {
        * @param {ListNode} l2
        * @return {ListNode}
        */
-      var addTwoNumbers = function(l1, l2) {
+      const addTwoNumbers = function (l1, l2) {
         // 返回值
-        let res = new ListNode("begin"),
-          // 临时变量做中间节点
-          temp = res,
-          // 记录上次的计算是否需要进位 初始值为0
-          carry = 0,
-          // 每次计算和
-          sum = 0;
+        const res = new ListNode('begin');
+        // 临时变量做中间节点
+        let temp = res;
+        // 记录上次的计算是否需要进位 初始值为0
+        let carry = 0;
+        // 每次计算和
+        let sum = 0;
         while (l1 || l2) {
           // 求和
           sum = getListNodeVal(l1) + getListNodeVal(l2) + carry;
@@ -130,7 +130,7 @@ export default {
         // 返回 res.next res.val = 'begin' 记录的是我们开始 next才是保存我们的结果
         return res.next;
       };
-    }
-  }
+    },
+  },
 };
 </script>

+ 2 - 2
src/views/About.vue

@@ -14,7 +14,7 @@ export default {
       console.log(13);
 
       console.log(aa, bbbb);
-    }
-  }
+    },
+  },
 };
 </script>

+ 8 - 9
src/views/printView.vue

@@ -23,14 +23,13 @@
 <script>
 // import { printPreview } from '@/api/print';
 // import vuePdf from "@/components/vue-pdf/vuePdfSss.vue";
-import vuePdf from "vue-pdf";
-import CMapReaderFactory from "vue-pdf/src/CMapReaderFactory.js";
+import vuePdf from 'vue-pdf';
+import CMapReaderFactory from 'vue-pdf/src/CMapReaderFactory.js';
 
 export default {
   created() {
     // this.pdfUrl = "http://127.0.0.1:9999/test.pdf";
-    this.pdfUrl =
-      "https://tengnat.yiyuntong.net:40051/mes-print-service/print/preview?code=6100000081&configCode=transaction";
+    this.pdfUrl = 'https://tengnat.yiyuntong.net:40051/mes-print-service/print/preview?code=6100000081&configCode=transaction';
     // this.pdfUrl = vuePdf.createLoadingTask({
     //   url: "http://127.0.0.1:9999/test.pdf",
     //   CMapReaderFactory
@@ -38,12 +37,12 @@ export default {
   },
   data() {
     return {
-      pdfUrl: "",
-      path: ""
+      pdfUrl: '',
+      path: '',
     };
   },
   components: {
-    "vue-pdf": vuePdf
+    'vue-pdf': vuePdf,
   },
   methods: {
     // async getprintPreview() {
@@ -55,8 +54,8 @@ export default {
     back() {
       this.$router.go(-1);
       // this.$router.push({ path: this.path });
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 10 - 10
vue.config.js

@@ -1,20 +1,20 @@
-const SentryCliPlugin = require("@sentry/webpack-plugin");
+const SentryCliPlugin = require('@sentry/webpack-plugin');
 
 module.exports = {
   lintOnSave: false,
-  chainWebpack: config => {
-    config.plugin("sentry").use(SentryCliPlugin, [
+  chainWebpack: (config) => {
+    config.plugin('sentry').use(SentryCliPlugin, [
       {
-        include: ".",
-        ignoreFile: ".sentrycliignore",
-        ignore: ["node_modules", "webpack.config.js"],
-        configFile: "sentry.properties",
+        include: '.',
+        ignoreFile: '.sentrycliignore',
+        ignore: ['node_modules', 'webpack.config.js'],
+        configFile: 'sentry.properties',
         dryRun: true,
-        release: "foo"
-      }
+        release: 'foo',
+      },
     ]);
     // if (process.env.NODE_ENV === "production") {
 
     // }
-  }
+  },
 };