From 3861b0a84f7f9316cccc88ccc2119258668bf499 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Wed, 23 Sep 2020 15:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_client/babel.config.js | 14 ++++- fir_client/package.json | 1 + fir_client/src/main.js | 103 +++++++++++++++++++++++++++++++- fir_client/src/restful/index.js | 8 +-- fir_client/src/utils/index.js | 3 +- fir_client/vue.config.js | 24 ++++++++ 6 files changed, 142 insertions(+), 11 deletions(-) create mode 100644 fir_client/vue.config.js diff --git a/fir_client/babel.config.js b/fir_client/babel.config.js index c5dc6a5..0ce69fd 100644 --- a/fir_client/babel.config.js +++ b/fir_client/babel.config.js @@ -1,5 +1,15 @@ module.exports = { presets: [ - '@vue/cli-plugin-babel/preset' + '@vue/cli-plugin-babel/preset', + "@babel/preset-env", + ], + "plugins": [ + [ + "component", + { + "libraryName": "element-ui", + "styleLibraryName": "theme-chalk" + } + ] ] -}; +}; \ No newline at end of file diff --git a/fir_client/package.json b/fir_client/package.json index e21d227..b1193f1 100644 --- a/fir_client/package.json +++ b/fir_client/package.json @@ -26,6 +26,7 @@ "@vue/cli-plugin-eslint": "^4.1.0", "@vue/cli-service": "^4.1.0", "babel-eslint": "^10.0.3", + "babel-plugin-component": "^1.1.1", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "vue-template-compiler": "^2.6.10" diff --git a/fir_client/src/main.js b/fir_client/src/main.js index 9c5978a..6929117 100644 --- a/fir_client/src/main.js +++ b/fir_client/src/main.js @@ -1,12 +1,17 @@ import Vue from 'vue' import App from "@/App"; import router from "@/router"; -import ElementUI from 'element-ui' +// import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' import Vuex from 'vuex' -const qiniu = require('qiniu-js'); +import qiniu from 'qiniu-js' +import oss from 'ali-oss' + +// const qiniu = require('qiniu-js'); +// Vue.prototype.qiniu = qiniu; +Vue.prototype.oss = oss; //使用vue-cookies import VueCookies from 'vue-cookies' @@ -41,7 +46,99 @@ router.beforeEach((to, from, next) => { Vue.config.productionTip = false; -Vue.use(ElementUI); +import { + Button, + Select, + Table, + TableColumn, + Input, + DatePicker, + Container, + Aside, + Col, + Header, + Popover, + Main, + Dialog, + Checkbox, + CheckboxGroup, + Pagination, + Option, + Upload, + Tabs, + TabPane, + Form, + FormItem, + Divider, + Message, + Row, + ButtonGroup, + MessageBox, + Image, + Loading, + Tag, + Tooltip, + Switch, + Link, + BreadcrumbItem, + Slider, + DropdownMenu, + Dropdown, + Breadcrumb,Avatar,DropdownItem,RadioButton,RadioGroup,OptionGroup,Progress,Timeline,TimelineItem,Card +} from "element-ui"; + +Vue.use(Progress); +Vue.use(OptionGroup); +Vue.use(Link); +Vue.use(Timeline); +Vue.use(TimelineItem); +Vue.use(Card); +Vue.use(RadioButton); +Vue.use(RadioGroup); +Vue.use(Avatar); +Vue.use(DropdownItem); +Vue.use(BreadcrumbItem); +Vue.use(Slider); +Vue.use(DropdownMenu); +Vue.use(Dropdown); +Vue.use(Breadcrumb); +Vue.use(Input); +Vue.use(CheckboxGroup); +Vue.use(DatePicker); +Vue.use(Button); +Vue.use(ButtonGroup); +Vue.use(Container); +Vue.use(Aside); +Vue.use(Col); +Vue.use(Header); +Vue.use(Popover); +Vue.use(Main); +Vue.use(Dialog); +Vue.use(Checkbox); +Vue.use(Pagination); +Vue.use(Select); +Vue.use(Option); +Vue.use(Table); +Vue.use(TableColumn); +Vue.use(Upload); +Vue.use(Tabs); +Vue.use(TabPane); +Vue.use(Form); +Vue.use(FormItem); +Vue.use(Divider); +Vue.use(Row); +Vue.use(Image); +Vue.use(Loading); +Vue.use(Tag); +Vue.use(Tooltip); +Vue.use(Switch); +Vue.prototype.$message = Message; + +// Vue.use(MessageBox); +Vue.prototype.$confirm = MessageBox.confirm; + + +// Vue.use(ElementUI); Vue.use(Vuex); diff --git a/fir_client/src/restful/index.js b/fir_client/src/restful/index.js index f6fb306..dded3ec 100644 --- a/fir_client/src/restful/index.js +++ b/fir_client/src/restful/index.js @@ -2,13 +2,13 @@ import Axios from 'axios' import VueCookies from 'vue-cookies' import router from "../router"; -const https = require('https'); +// const https = require('https'); const Base64 = require('js-base64').Base64; Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; Axios.defaults.withCredentials = true; -Axios.defaults.httpsAgent = new https.Agent({ - keepAlive: true -}); +// Axios.defaults.httpsAgent = new https.Agent({ +// keepAlive: true +// }); const DOMAIN = 'https://fly.harmonygames.cn'; diff --git a/fir_client/src/utils/index.js b/fir_client/src/utils/index.js index 25fdc6a..ab11a08 100644 --- a/fir_client/src/utils/index.js +++ b/fir_client/src/utils/index.js @@ -125,9 +125,8 @@ export function dataURLtoFile(dataurl, filename) {//将base64转换为文件 } export function uploadaliyunoss(file, certinfo, app, successcallback, processcallback) { - const OSS = require('ali-oss'); let token = certinfo.upload_token; - let client = new OSS({ + let client = new app.oss({ endpoint: token.endpoint, accessKeyId: token.access_key_id, accessKeySecret: token.access_key_secret, diff --git a/fir_client/vue.config.js b/fir_client/vue.config.js new file mode 100644 index 0000000..5be8946 --- /dev/null +++ b/fir_client/vue.config.js @@ -0,0 +1,24 @@ +'use strict'; + +module.exports = { + + pages: { + index: { + // page 的入口 + entry: 'src/main.js', + // 模板来源 + template: 'public/index.html', + // 在 dist/index.html 的输出 + filename: 'index.html', + // 当使用 title 选项时, + // template 中的 title 标签需要是 <%= htmlWebpackPlugin.options.title %> + title: 'FlyApp', + // 在这个页面中包含的块,默认情况下会包含 + // 提取出来的通用 chunk 和 vendor chunk。 + chunks: ['chunk-vendors', 'chunk-common', 'index'] + }, + + }, + productionSourceMap:false +}; +