Browse Source

修改组件库为按需引入

huangtao 3 years ago
parent
commit
36d0b1b18c

File diff suppressed because it is too large
+ 210 - 273
package-lock.json


+ 2 - 0
src/components/echarts/EchartsBar.vue

@@ -11,6 +11,8 @@ require('echarts/lib/chart/bar');
 // 引入提示框和title组件
 require('echarts/lib/component/tooltip');
 require('echarts/lib/component/title');
+import { LegendComponent } from 'echarts/components';
+echarts.use([LegendComponent]);
 export default {
   props: {
     // 数据

+ 2 - 0
src/components/echarts/EchartsDoughnut.vue

@@ -12,6 +12,8 @@ require('echarts/lib/chart/bar');
 // 引入提示框和title组件
 require('echarts/lib/component/tooltip');
 require('echarts/lib/component/title');
+import { PieChart } from 'echarts/charts';
+echarts.use([PieChart]);
 export default {
   props: {
     // 数据

+ 2 - 3
src/main.js

@@ -2,11 +2,10 @@ import Vue from 'vue';
 import App from './App.vue';
 // 路由
 import router from './router';
-// Vue.use(router);
 
 // 使用echarts
-import echarts from 'echarts';
-Vue.prototype.$echarts = echarts;
+// import echarts from 'echarts';
+// Vue.prototype.$echarts = echarts;
 
 // Vuex
 import store from './store';

+ 47 - 10
src/styles/index.js

@@ -1,20 +1,57 @@
+import Vue from 'vue';
 // css语法
-import less from 'less'
-
+import less from 'less';
 // 引入样式
-import "./index.less";
+import './index.less';
+Vue.use(less);
 
-// 引入组件库
-import Antd from 'ant-design-vue';
+// 按需引入组件库
+import {
+  message,
+  ConfigProvider,
+  Button,
+  Modal,
+  Icon,
+  Layout,
+  Breadcrumb,
+  Menu,
+  Spin,
+  Select,
+  Form,
+  Input,
+  Table,
+  Upload,
+  Pagination,
+  Drawer,
+  Divider,
+  DatePicker,
+} from 'ant-design-vue';
 import 'ant-design-vue/dist/antd.css';
 
 // 定义网络链接的图标库组件
-import { Icon } from 'ant-design-vue';
-import Vue from 'vue'
+// import { Icon } from 'ant-design-vue';
 const IconFont = Icon.createFromIconfontCN({
   scriptUrl: '//at.alicdn.com/t/font_2605334_1qo67s1vjpz.js',
 });
 
-Vue.use(less);
-Vue.use(Antd);
-Vue.component('icon-font', IconFont)
+Vue.use(message);
+Vue.prototype.$message = message;
+Vue.use(Modal);
+Vue.prototype.$confirm = Modal.confirm;
+Vue.use(ConfigProvider);
+Vue.use(Button);
+Vue.use(Icon);
+Vue.use(Layout);
+Vue.use(Breadcrumb);
+Vue.use(Menu);
+Vue.use(Spin);
+Vue.use(Select);
+Vue.use(Form);
+Vue.use(Input);
+Vue.use(Table);
+Vue.use(Upload);
+Vue.use(Pagination);
+Vue.use(Drawer);
+Vue.use(Divider);
+Vue.use(DatePicker);
+Vue.component('icon-font', IconFont);

+ 4 - 1
src/views/answerManagement/answerManagementSpecial.vue

@@ -289,7 +289,10 @@ export default {
         { name: '不限', id: '' },
         ...this.GET_EXAM_QUESTION_TYPE_CONDITION_PARENT,
       ];
-      this.typeConditionParentValue = this.typeConditionParentList[0].id;
+
+      if (this.typeConditionParentList.length > 0) {
+        this.typeConditionParentValue = this.typeConditionParentList[0].id;
+      }
 
       // 试题类别
       this.bank_questionType = [

+ 4 - 2
src/views/examQuestionManagement/examQusetionCreateGapFilling.vue

@@ -228,8 +228,10 @@ export default {
       if (this.$route.query.id) {
         this.getExamQuestionDetailFun(this.$route.query.id); // 查询:试题的详情
       } else {
-        this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
-        this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        if (this.typeConditionParentList.length > 0) {
+          this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
+          this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        }
       }
     },
     // 查询:试题的详情

+ 4 - 2
src/views/examQuestionManagement/examQusetionCreateMultiple.vue

@@ -254,8 +254,10 @@ export default {
       if (this.$route.query.id) {
         this.getExamQuestionDetailFun(this.$route.query.id); // 查询:试题的详情
       } else {
-        this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
-        this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        if (this.typeConditionParentList.length > 0) {
+          this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
+          this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        }
       }
     },
     // 查询:试题的详情

+ 4 - 2
src/views/examQuestionManagement/examQusetionCreateSingle.vue

@@ -270,8 +270,10 @@ export default {
       if (this.$route.query.id) {
         this.getExamQuestionDetailFun(this.$route.query.id); // 查询:试题的详情
       } else {
-        this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
-        this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        if (this.typeConditionParentList.length > 0) {
+          this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
+          this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        }
       }
     },
     // 查询:试题的详情

+ 4 - 2
src/views/examQuestionManagement/examQusetionCreateTrueOrFalse.vue

@@ -245,8 +245,10 @@ export default {
       if (this.$route.query.id) {
         this.getExamQuestionDetailFun(this.$route.query.id); // 查询:试题的详情
       } else {
-        this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
-        this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        if (this.typeConditionParentList.length > 0) {
+          this.typeConditionParentValue = this.typeConditionParentList[0].id; // 所选试题类型-父类
+          this.getTableChildrenListFun(true); // 查询:试题类型列表-子类
+        }
       }
     },
     // 查询:试题的详情

Some files were not shown because too many files changed in this diff