소스 검색

Merge branch 'dev' of http://192.168.3.207:10080/jianyu/page_bigmember_pc into dev

TANGSHIZHE 4 년 전
부모
커밋
c766f7f0ea
7개의 변경된 파일100개의 추가작업 그리고 13개의 파일을 삭제
  1. 6 2
      package.json
  2. 9 0
      public/index.html
  3. 10 3
      src/components/push-list/ProjectList.vue
  4. 1 0
      src/components/push-list/PushList.vue
  5. 3 1
      src/main.js
  6. 16 0
      src/views/reportData/pageMonth.vue
  7. 55 7
      vue.config.js

+ 6 - 2
package.json

@@ -7,7 +7,9 @@
     "serve:alone": "vue-cli-service serve --mode alone",
     "build": "vue-cli-service build",
     "build:test": "vue-cli-service build --mode test",
-    "lint": "vue-cli-service lint --fix"
+    "lint": "vue-cli-service lint --fix",
+    "analyzer": "use_analyzer=true vue-cli-service build --mode production",
+    "analyze": "cross-env use_analyzer=true vue-cli-service build --mode production"
   },
   "dependencies": {
     "axios": "^0.21.1",
@@ -31,6 +33,7 @@
     "@vue/eslint-config-standard": "^5.1.2",
     "babel-eslint": "^10.1.0",
     "babel-plugin-component": "^1.1.1",
+    "cross-env": "^7.0.3",
     "eslint": "^6.7.2",
     "eslint-plugin-import": "^2.20.2",
     "eslint-plugin-node": "^11.1.0",
@@ -40,6 +43,7 @@
     "sass": "^1.26.5",
     "sass-loader": "^8.0.2",
     "vue-cli-plugin-single-spa": "^1.0.1",
-    "vue-template-compiler": "^2.6.10"
+    "vue-template-compiler": "^2.6.10",
+    "webpack-bundle-analyzer": "^4.4.1"
   }
 }

+ 9 - 0
public/index.html

@@ -24,6 +24,15 @@
       <link href='https://web2-jytest.jydev.jianyu360.com/css/pc.css?v=6302' rel="stylesheet"/>
       <link href='https://web2-jytest.jydev.jianyu360.com/pccss/public-nav-1200.css?v=6302' rel="stylesheet" type="text/css"/>
     <% } %>
+
+    <!-- 使用CDN的CSS文件 -->
+    <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
+    <link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
+    <% } %>
+    <!-- 使用CDN的JS文件 -->
+    <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
+    <script type="text/javascript" src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
+    <% } %>
   </head>
   <style>
     .big-member-page {

+ 10 - 3
src/components/push-list/ProjectList.vue

@@ -12,7 +12,7 @@
         v-for="(item, index) in listState.list"
         :key="index"
         :index="(listState.pageSize * (listState.pageNum - 1)) +  index + 1"
-        :article="item"
+        :article="sortItemInfo(item)"
         @onClick="toDetail(item)">
         <span slot="right-time">{{ dateFromNow(item.l_lastpushtime * 1000) }}</span>
       </article-item>
@@ -127,7 +127,7 @@ export default {
     },
     async getList (filters) {
       const query = {
-        pagenum: this.listState.pageNum,
+        pageNum: this.listState.pageNum - 1,
         pageSize: this.listState.pageSize,
         area: this.getFilters.area,
         time: this.getFilters.time
@@ -162,7 +162,7 @@ export default {
     },
     toDetail (item) {
       const { sid, fid } = item
-      let link = this.$router.resolve({
+      const link = this.$router.resolve({
         path: '/project/info',
         query: {
           sid,
@@ -171,6 +171,12 @@ export default {
       })
       window.open(link.href, '_blank')
     },
+    sortItemInfo (item) {
+      return {
+        ...item,
+        type: item.status, // 类型
+      }
+    },
     onPageChange (p) {
       this.listState.pageNum = p
       this.getList()
@@ -247,6 +253,7 @@ export default {
       float: right;
     }
     .info-list {
+      min-height: 300px;
       border-top: 1px solid transparent;
     }
     .add-key-button {

+ 1 - 0
src/components/push-list/PushList.vue

@@ -212,6 +212,7 @@ export default {
       float: right;
     }
     .info-list {
+      min-height: 300px;
       border-top: 1px solid transparent;
     }
     .add-key-button {

+ 3 - 1
src/main.js

@@ -9,7 +9,7 @@ import VCharts from 'v-charts'
 import '@/utils/'
 import axios from 'axios'
 
-Vue.use(Loading.directive).use(VCharts)
+Vue.use(Loading.directive)
 Vue.prototype.$message = Message
 Vue.prototype.$echarts = echarts
 Vue.config.productionTip = false
@@ -22,6 +22,8 @@ if (process.env.NODE_ENV === 'production') {
   } else {
     window.console.log = () => null
   }
+} else {
+  Vue.use(VCharts)
 }
 
 if (process.env.VUE_APP_LOG_URL) {

+ 16 - 0
src/views/reportData/pageMonth.vue

@@ -632,6 +632,9 @@ export default {
       options.visualMap.min = 1
       options.visualMap.max = maxNum < 100 ? 100 : maxNum
       options.graphic[options.graphic.length - 1].children[0].style.text = maxNum > 100 ? maxNum : 100
+      options.tooltip.formatter = (params) => {
+        return this.formatMapTooltio(params)
+      }
       return options
     },
     mapScaleConfig (options) {
@@ -641,6 +644,9 @@ export default {
       options.visualMap.min = 1
       options.visualMap.max = maxNum < 100 ? 100 : maxNum
       options.graphic[options.graphic.length - 1].children[0].style.text = maxNum > 100 ? maxNum : 100
+      options.tooltip.formatter = (params) => {
+        return this.formatMapTooltio(params)
+      }
       return options
     },
     // 本月中标企业注册地分布
@@ -651,6 +657,9 @@ export default {
       options.visualMap.min = 1
       options.visualMap.max = maxNum < 100 ? 100 : maxNum
       options.graphic[options.graphic.length - 1].children[0].style.text = maxNum > 100 ? maxNum : 100
+      options.tooltip.formatter = (params) => {
+        return this.formatMapTooltio(params)
+      }
       return options
     },
     // 本月中标企业中标项目数量分布配置
@@ -658,6 +667,13 @@ export default {
       return options
     },
     /* 公共函数 */
+    formatMapTooltio (params) {
+      let tip = ''
+      if (params.data) {
+        tip = params.data.name + ':' + params.value
+      }
+      return tip
+    },
     formatMonth (time) {
       const date = new Date(parseInt(time) * 1000)
       const month = date.getMonth() + 1

+ 55 - 7
vue.config.js

@@ -1,3 +1,41 @@
+const externals = {
+  // 把导入语句里的 vue 替换成运行环境(html)里的全局变量 Vue
+  vue: 'Vue',
+  'vue-router': 'VueRouter',
+  vuex: 'Vuex',
+  axios: 'axios',
+  echarts: 'echarts',
+  'v-charts': 'vcharts', // 这个vcharts没有全局变量,是被直接挂载到vue上了
+  'lodash': '_', // lodash在全局变量为_
+  moment: 'moment'
+}
+
+const cdn = {
+  css: [
+    // '//unpkg.com/element-ui@2.10.1/lib/theme-chalk/index.css'
+  ],
+  jsdelivr: [
+    '//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
+    '//cdn.jsdelivr.net/npm/vue-router@3.1.5/dist/vue-router.min.js',
+    '//cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js',
+    '//cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js',
+    '//cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js',
+    '//cdn.jsdelivr.net/npm/v-charts@1.19.0/lib/index.min.js',
+    '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
+    '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
+  ],
+  js: [
+    '//cdn-common.jianyu360.cn/cdn/lib/vue/2.6.11/vue.min.js',
+    '//cdn-common.jianyu360.cn/cdn/lib/vue-router/3.1.5/vue-router.min.js',
+    '//cdn-common.jianyu360.cn/cdn/lib/vuex/3.4.0/vuex.min.js',
+    '//cdn-common.jianyu360.cn/cdn/lib/axios/0.19.2/axios.min.js',
+    '//cdn-common.jianyu360.cn/cdn/lib/echarts/4.8.0/echarts.min.js',
+    '//cdn.jsdelivr.net/npm/v-charts@1.19.0/lib/index.min.js',
+    '//cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js',
+    '//cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js'
+  ]
+}
+
 module.exports = {
   parallel: false,
   productionSourceMap: false,
@@ -20,11 +58,6 @@ module.exports = {
         target: 'http://web-jytest.jydev.jianyu360.com',
         changeOrigin: true,
         logLevel: 'debug'
-      },
-      '^/jypay': {
-        target: 'http://web-jytest.jydev.jianyu360.com',
-        changeOrigin: true,
-        logLevel: 'debug'
       }
     }
   },
@@ -36,13 +69,28 @@ module.exports = {
     }
   },
   chainWebpack: config => {
+    // single-spa
     if (!process.env.VUE_APP_ALONE) {
       config.devServer.set('inline', false)
       config.devServer.set('hot', true)
-      if (process.env.NODE_ENV !== 'production') {
+
+      if (process.env.NODE_ENV === 'production') {
+        config.externals(externals)
+        config.plugin('html').tap(args => {
+          // html中添加cdn
+          args[0].cdn = cdn
+          return args
+        })
+      } else {
         config.output.filename('js/[name].js')
       }
-      config.externals(['vue', 'vue-router'])
+    }
+
+    // 分析静态资源
+    if (process.env.use_analyzer) {
+      config
+        .plugin('webpack-bundle-analyzer')
+        .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
     }
   },
   filenameHashing: false