Browse Source

优化加载速度

朱鑫波 3 years ago
parent
commit
108be8e9d1

+ 3 - 2
package.json

@@ -75,6 +75,7 @@
     "@vue/eslint-config-standard": "^4.0.0",
     "babel-eslint": "^10.0.1",
     "babel-plugin-component": "^1.1.1",
+    "compression-webpack-plugin": "^5.0.1",
     "eslint": "^5.16.0",
     "eslint-plugin-vue": "^5.1.0",
     "html-webpack-plugin": "^3.2.0",
@@ -82,9 +83,9 @@
     "less-loader": "^4.1.0",
     "node-sass": "^4.11.0",
     "sass-loader": "^7.0.1",
-    "vue-template-compiler": "^2.6.10",
     "style-resources-loader": "^1.3.2",
-    "vue-cli-plugin-style-resources-loader": "^0.1.3"
+    "vue-cli-plugin-style-resources-loader": "^0.1.3",
+    "vue-template-compiler": "^2.6.10"
   },
   "eslintConfig": {
     "root": true,

File diff suppressed because it is too large
+ 0 - 8643
public/ckplayer/ckplayer.js


File diff suppressed because it is too large
+ 0 - 120
public/ckplayer/ckplayer.min.js


File diff suppressed because it is too large
+ 0 - 110
public/ckplayer/ckplayer.xml


+ 0 - 28
public/ckplayer/hls/LICENSE

@@ -1,28 +0,0 @@
-Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-src/remux/mp4-generator.js and src/demux/exp-golomb.js implementation in this project
-are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
-
-That work is also covered by the Apache 2 License, following copyright:
-Copyright (c) 2013-2015 Brightcove
-
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

File diff suppressed because it is too large
+ 0 - 15403
public/ckplayer/hls/hls.js


File diff suppressed because it is too large
+ 0 - 7
public/ckplayer/hls/hls.min.js


+ 0 - 46
public/ckplayer/language.xml

@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-	<language>
-		<adCountdown>[$second]</adCountdown><!--广告播放结束倒计时-->
-		<skipDelay>[$second]</skipDelay>
-		<buttonOver>
-			<play>点击播放</play>
-			<pause>暂停播放</pause>
-			<mute>静音</mute>
-			<escMute>恢复音量</escMute>
-			<full>全屏</full>
-			<escFull>退出全屏</escFull>
-			<previousPage>上一集</previousPage>
-			<nextPage>下一集</nextPage>
-			<definition>点击选择清晰度</definition>
-			<subtitle>选择字幕</subtitle>
-		</buttonOver>
-		<volumeSliderOver>
-			音量:[$volume]%
-		</volumeSliderOver>
-		<buffer>[$percentage]%</buffer>
-		<timeSliderOver><!--鼠标经过进度条显示的时间格式-->
-			[$timeh]:[$timei]:[$times]
-		</timeSliderOver>
-		<liveAndVod>
-			[$timeh]:[$timei]:[$times]
-		</liveAndVod>
-		<live>
-			直播中 [$liveTimeY]-[$liveTimem]-[$liveTimed] [$liveTimeh]:[$liveTimei]:[$liveTimes]
-		</live>
-		<m3u8Definition>
-			<name>流畅</name>
-			<name>低清</name>
-			<name>标清</name>
-			<name>高清</name>
-			<name>超清</name>
-			<name>蓝光</name>
-			<name>未知</name>
-		</m3u8Definition>
-		<error>
-			<cannotFindUrl>视频地址不存在</cannotFindUrl>
-			<streamNotFound>加载失败</streamNotFound>
-			<formatError>视频格式错误</formatError>
-		</error>
-		<definition>自动</definition>
-		<subtitle>默认</subtitle>
-	</language>

File diff suppressed because it is too large
+ 0 - 739
public/ckplayer/style.xml


+ 1 - 1
public/index.html

@@ -311,7 +311,7 @@
 <script src="<%= BASE_URL %>xlsx.full.min.js"></script>
 
 <script src="<%= BASE_URL %>export.js"></script>
-<script src="<%= BASE_URL %>ckplayer/ckplayer.js"></script>
+<!-- <script src="<%= BASE_URL %>ckplayer/ckplayer.js"></script> -->
 
 <script type="text/javascript" src="<%= BASE_URL %>cryptojs/rollups/tripledes.js"></script>
 <script type="text/javascript" src="<%= BASE_URL %>cryptojs/components/mode-ecb-min.js"></script>

+ 2 - 2
src/views/modules/kuaishouapp/account/stepForm/Step3.vue

@@ -916,7 +916,7 @@ import { getAction, postAction, deleteAction } from '@/api/manage'
 import { mapGetters } from 'vuex'
 import UploadToAli from '@femessage/upload-to-ali'
 import moment from 'moment'
-import VuePreview from 'vue-preview'
+// import VuePreview from 'vue-preview'
 import jq from 'jquery'
 import { stopOtherVideo, closeAllVideoFun } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
 import checkMatemal from './stepModule/checkMatemal'
@@ -929,7 +929,7 @@ export default {
   name: 'BaseForm',
   components: {
     UploadToAli,
-    VuePreview,
+    // VuePreview,
     checkMatemal,
     uploadFile,
   },

+ 2 - 2
src/views/modules/kuaishouapp/account/stepForm/Step4.vue

@@ -846,7 +846,7 @@ import { getAction, postAction, deleteAction } from '@/api/manage'
 import { mapGetters } from 'vuex'
 import UploadToAli from '@femessage/upload-to-ali'
 import moment from 'moment'
-import VuePreview from 'vue-preview'
+// import VuePreview from 'vue-preview'
 import jq from 'jquery'
 import { stopOtherVideo, closeAllVideoFun } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
 import checkMatemal from './stepModule/checkMatemal'
@@ -875,7 +875,7 @@ export default {
   name: 'BaseForm',
   components: {
     UploadToAli,
-    VuePreview,
+    // VuePreview,
     checkMatemal,
     uploadFile,
   },

+ 2 - 2
src/views/modules/kuaishouapp/creativeCreate.vue

@@ -522,7 +522,7 @@ import { getAction, postAction } from '@/api/manage'
 import { mapGetters } from 'vuex'
 import UploadToAli from '@femessage/upload-to-ali'
 import moment from 'moment'
-import VuePreview from 'vue-preview'
+// import VuePreview from 'vue-preview'
 import jq from 'jquery'
 import { stopOtherVideo, closeAllVideoFun } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
 import { fileCheck, fileInsert } from '@/api/actor'
@@ -531,7 +531,7 @@ export default {
   name: 'BaseForm',
   components: {
     UploadToAli,
-    VuePreview
+    // VuePreview
   },
   data() {
     return {

+ 8 - 11
src/views/modules/onlineTraining/onlineTrainingList.vue

@@ -178,20 +178,17 @@
 <script>
 import { getAction, postAction } from '@/api/manage'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-import moment from 'moment'
-import $ from 'jquery'
-import qs from 'qs'
 import UploadToAli from '@femessage/upload-to-ali'
 import uploadFile from '@/components/uploadFile.vue'
 import { mapActions, mapGetters, mapState } from 'vuex'
 // document.write(textDes('https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2020-03-20/20网服-1584693978588.mp4'))
 // document.write('<br>' + desDecrypt('s4HMPbmUfZ0=', 'ckplayerDesKey'))
-function textDes(str) {
-  var keyCode = 'ckplayerDesKey'
-  var newText = encodeURI(desEncrypt(str, keyCode))
-  newText = (keyCode == 'ckplayerDesKey' ? 'CK:' : 'CE:') + newText
-  return newText
-}
+// function textDes(str) {
+//   var keyCode = 'ckplayerDesKey'
+//   var newText = encodeURI(desEncrypt(str, keyCode))
+//   newText = (keyCode == 'ckplayerDesKey' ? 'CK:' : 'CE:') + newText
+//   return newText
+// }
 
 function desEncrypt(word, keyCode) {
   var key = CryptoJS.enc.Utf8.parse(keyCode)
@@ -662,7 +659,7 @@ export default {
                 }
                 console.log(this.videoObject.video)
 
-                let player = new ckplayer(this.videoObject)
+                // let player = new ckplayer(this.videoObject)
                 console.log(player)
               } else {
                 this.startList = true
@@ -796,7 +793,7 @@ export default {
     this.$nextTick(() => {
       this.videoObject.video = ' CK:2OoC8kA6lhNFqCi2uVquDPpnuq9VcRji9nGXe5nqadA6Jey7YFFEP8pE99j58UBbLyb7YN7cpkw='
 
-      let player = new ckplayer(this.videoObject)
+      // let player = new ckplayer(this.videoObject)
 
       getAction('/sys/user/getRoleInfo', {
         userId: this.userInfo().id,

+ 76 - 49
vue.config.js

@@ -1,5 +1,6 @@
 const path = require('path')
-
+const CompressionPlugin = require('compression-webpack-plugin')
+const TerserPlugin = require("terser-webpack-plugin");
 function resolve(dir) {
   return path.join(__dirname, dir)
 }
@@ -22,7 +23,32 @@ module.exports = {
     }
   },
   */
-  configureWebpack: {},
+  configureWebpack: config => {
+    if (process.env.NODE_ENV === 'production') {
+      return {
+        plugins: [new CompressionPlugin({
+          test: /\.js$|\.html$|\.css/,
+          threshold: 10240,
+          deleteOriginalAssets: false
+        }), new TerserPlugin({
+          cache: true,//降版本后添加
+          sourceMap: false,//降版本后添加
+          // 多进程
+          parallel: true,//降版本后添加
+          terserOptions: {
+            ecma: undefined,
+            warnings: false,
+            parse: {},
+            compress: {
+              drop_console: true,
+              drop_debugger: false,
+              pure_funcs: ['console.log'], // 移除console
+            },
+          },
+        }),]
+      }
+    }
+  },
 
   chainWebpack: (config) => {
     config.resolve.alias
@@ -33,7 +59,8 @@ module.exports = {
       .set('@comp', resolve('src/components'))
       .set('@views', resolve('src/views'))
       .set('@layout', resolve('src/layout'))
-      .set('@static', resolve('src/static'))
+      .set('@static', resolve('src/static'));
+    config.plugins.delete('prefetch')
   },
   pluginOptions: {
     'style-resources-loader': {
@@ -61,58 +88,58 @@ module.exports = {
     }
   },
 
-	devServer: {
-		hot:true,
-		// inline: true,
-		port: 3000,
-		open : true,
-		proxy: {
-			'/jeecg-boot': {
-				// target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
-				// target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+  devServer: {
+    hot: true,
+    // inline: true,
+    port: 3000,
+    open: true,
+    proxy: {
+      '/jeecg-boot': {
+        // target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+        // target: 'http://192.168.1.3:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.1.3:7001', //请求本地 需要jeecg-boot后台项目  蒙蒙
-				// target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目  英豪
-				// target: 'http://192.168.1.62:7001', //请求本地 需要jeecg-boot后台项目  英豪
-				// target: 'http://192.168.6.162:9806', //请求本地 需要jeecg-boot后台项目  祚云
-				// target: 'http://192.168.1.43:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
-				// target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
-				// target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目  毕洁泉
-				// target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
-				// target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目  赵西安
-				// target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
-				// target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-				 target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
-				// target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
-				// target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
-				//  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
-				// target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
-				// target:'http://118.24.244.213:8804',
-				// target: 'http://192.168.1.43:9090', // 子安
-				// target: 'http://192.168.1.8:8806', // 学超
-				// target:'http://139.186.165.84:8806', //测试
-				// target:'http://apipre.tjyourong.com.cn', //预生产
+        // target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目  英豪
+        // target: 'http://192.168.1.62:7001', //请求本地 需要jeecg-boot后台项目  英豪
+        // target: 'http://192.168.6.162:9806', //请求本地 需要jeecg-boot后台项目  祚云
+        // target: 'http://192.168.1.43:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
+        // target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目  赵西安
+        // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
+        // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
+        target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
+        //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
+        // target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
+        // target:'http://118.24.244.213:8804',
+        // target: 'http://192.168.1.43:9090', // 子安
+        // target: 'http://192.168.1.8:8806', // 学超
+        // target:'http://139.186.165.84:8806', //测试
+        // target:'http://apipre.tjyourong.com.cn', //预生产
         // target: 'http://192.168.1.134:8080', //请求本地 需要jeecg-boot后台项目  周泽宇
 
         // target:'http://gateway.tjyourong.com.cn/',//测试
 
-				ws: false,
+        ws: false,
 
-				// changeOrigin: true,
-				// pathRewrite: {
-				//     '/jeecg-boot': ''  //默认所有请求都加了jeecg-boot前缀,需要去掉
-				// }
-			},
-		},
-		// before(app) {
-		//     app.get('/seller', (req, res) => {
-		//         res.json({
-		//           errno: 0,
-		//           data: appData
-		//         })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用
-		//     })
-		// }
-	},
+        // changeOrigin: true,
+        // pathRewrite: {
+        //     '/jeecg-boot': ''  //默认所有请求都加了jeecg-boot前缀,需要去掉
+        // }
+      },
+    },
+    // before(app) {
+    //     app.get('/seller', (req, res) => {
+    //         res.json({
+    //           errno: 0,
+    //           data: appData
+    //         })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用
+    //     })
+    // }
+  },
 
   lintOnSave: undefined,
-//   publicPath:'./',
+  //   publicPath:'./',
 }