Prechádzať zdrojové kódy

fix 参数区分版本

mzr 5 rokov pred
rodič
commit
121df88296

+ 0 - 3
.env.demo

@@ -1,3 +0,0 @@
-NODE_ENV=production
-BABEL_ENV=production
-VUE_APP_SECRET=demo

+ 0 - 1
package.json

@@ -6,7 +6,6 @@
     "serve": "vue-cli-service serve --open",
     "build": "vue-cli-service build",
     "test": "vue-cli-service build --mode test",
-    "demo": "vue-cli-service build --mode demo",
     "lint": "vue-cli-service lint",
     "test:e2e": "vue-cli-service test:e2e",
     "test:unit": "vue-cli-service test:unit"

+ 2 - 3
src/assets/js/api.request.js

@@ -1,9 +1,9 @@
 /*
  * @Author: WangQiBiao
- * @LastEditors: WangQiBiao
+ * @LastEditors: MoZhuangRu
  * @Description:
  * @Date: 2019-03-02 14:21:27
- * @LastEditTime: 2019-10-08 16:52:58
+ * @LastEditTime: 2019-11-21 14:33:00
  */
 import HttpRequest from './axios'
 import config from '@/config'
@@ -16,6 +16,5 @@ if (process.env.NODE_ENV === 'production') {
     baseUrl = config.baseUrl.pro
   }
 }
-
 const axios = new HttpRequest(baseUrl)
 export default axios

+ 10 - 2
src/assets/js/axios.js

@@ -1,9 +1,9 @@
 /*
  * @Author: WangQiBiao
- * @LastEditors: mozhuangru
+ * @LastEditors: MoZhuangRu
  * @Description:
  * @Date: 2019-03-12 09:40:46
- * @LastEditTime: 2019-10-09 10:22:51
+ * @LastEditTime: 2019-11-21 15:59:50
  */
 import axios from 'axios'
 import { Loading, Message } from 'element-ui'
@@ -115,6 +115,14 @@ class HttpRequest {
   request (options) {
     const instance = axios.create()
     options = Object.assign(this.getInsideConfig(), options)
+    options.params = Object.assign({}, options.params)
+    let url = window.location.href
+    if (url.indexOf('?') !== -1) {
+      options.params.version = 'demonstration'
+    } else {
+      options.params.version = 'real'
+    }
+
     this.interceptors(instance, options.url)
     return instance(options)
   }

+ 1 - 3
src/config/index.js

@@ -3,7 +3,7 @@
  * @LastEditors: MoZhuangRu
  * @Description: 全局参数设置
  * @Date: 2019-03-12 09:40:46
- * @LastEditTime: 2019-11-20 19:00:56
+ * @LastEditTime: 2019-11-21 15:43:52
  */
 const REQUEST_MATCHING_HASH = `/9ad134a361f8d778` // 【9ad134a361f8d778 = 前端服务,用于后端接口匹配】
 
@@ -29,8 +29,6 @@ export default {
   fileUrl: process.env.NODE_ENV === 'production' ? `${REQUEST_MATCHING_HASH}` : 'http://139.159.229.250:8161',
   // 导出文件路径
   exportUrl: process.env.NODE_ENV === 'production' ? `${REQUEST_MATCHING_HASH}` : '/api',
-  // 数据区分
-  version: process.env.VUE_APP_SECRET === 'demo' ? 'demonstration' : 'real',
   /**
      * 输入框最长值
      */

+ 18 - 16
src/views/index/components/communication/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 14:10:08
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:27:17
+ * @LastEditTime: 2019-11-21 16:07:57
  * @Description: 在线沟通
  -->
 <template>
@@ -38,7 +38,6 @@ import TagCom from '@/components/tag'
 import echarts from 'echarts'
 import { api } from '@/api'
 import vueSeamless from 'vue-seamless-scroll'
-import config from '@/config'
 
 export default {
   computed: {
@@ -50,6 +49,11 @@ export default {
   },
   data () {
     return {
+      reportAdvice: '',
+      reportComplaint: '',
+      reportSuggest: '',
+      reportPraise: '',
+      reportServiceScore: '',
       reportSum: {},
       dialogData: []
     }
@@ -67,18 +71,16 @@ export default {
   },
   methods: {
     init () {
-      api.getDialogRecord({
-        version: config.version
-      }).then(res => {
+      api.getDialogRecord().then(res => {
         this.dialogData = res.data.data.list
       })
       this.getReportSum()
     },
     getReportSum () {
-      api.getReportSum({
-        version: config.version
-      }).then(res => {
-        this.reportSum = res.data.data.reportRepairStatisticsVos
+      api.getReportSum().then(res => {
+        res.data.data.reportRepairStatisticsVos && res.data.data.reportRepairStatisticsVos.map(item => {
+          this[item.type] = item.total
+        })
         this.circleProportionMap()
         this.createSatisfactionMap()
       })
@@ -112,7 +114,7 @@ export default {
             },
             data: [
               {
-                value: this.reportSum[this.reportSum.findIndex(item => item.type === 'reportAdvice')].total,
+                value: this.reportAdvice,
                 name: '咨询',
                 label: {
                   show: true,
@@ -123,7 +125,7 @@ export default {
                 }
               },
               {
-                value: this.reportSum[this.reportSum.findIndex(item => item.type === 'reportComplaint')].total,
+                value: this.reportComplaint,
                 name: '投诉',
                 label: {
                   show: true,
@@ -134,7 +136,7 @@ export default {
                 }
               },
               {
-                value: this.reportSum[this.reportSum.findIndex(item => item.type === 'reportSuggest')].total,
+                value: this.reportSuggest,
                 name: '建议',
                 label: {
                   show: true,
@@ -145,7 +147,7 @@ export default {
                 }
               },
               {
-                value: this.reportSum[this.reportSum.findIndex(item => item.type === 'reportPraise')].total,
+                value: this.reportPraise,
                 name: '表扬',
                 label: {
                   show: true,
@@ -194,14 +196,14 @@ export default {
             },
             data: [
               {
-                value: this.reportSum[this.reportSum.findIndex(item => item.type === 'reportServiceScore')].total,
-                name: `${this.reportSum[this.reportSum.findIndex(item => item.type === 'reportServiceScore')].total}%`,
+                value: this.reportServiceScore,
+                name: `${this.reportServiceScore}%`,
                 itemStyle: {
                   color: '#07E144'
                 }
               },
               {
-                value: 100 - (this.reportSum[this.reportSum.findIndex(item => item.type === 'reportServiceScore')].total),
+                value: 100 - this.reportServiceScore,
                 itemStyle: {
                   color: '#262795'
                 }

+ 2 - 4
src/views/index/components/entrance-guard/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 10:20:36
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:22:52
+ * @LastEditTime: 2019-11-21 15:42:36
  * @Description: 智能门禁
  -->
 <template>
@@ -35,7 +35,6 @@ import TitleCom from '@/components/title'
 import TagCom from '@/components/tag'
 import { api } from '@/api'
 import vueSeamless from 'vue-seamless-scroll'
-import config from '@/config'
 
 export default {
   computed: {
@@ -65,8 +64,7 @@ export default {
     init () {
       api.getFacePassRecord({
         pageSize: 30,
-        pageNum: 1,
-        version: config.version
+        pageNum: 1
       }).then(res => {
         this.faceData = res.data.data
       })

+ 2 - 5
src/views/index/components/income/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-26 10:57:30
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:22:42
+ * @LastEditTime: 2019-11-21 15:42:45
  * @Description: 收入统计
  -->
 <template>
@@ -35,7 +35,6 @@
 <script>
 import echarts from 'echarts'
 import { api } from '@/api'
-import config from '@/config'
 
 export default {
   data () {
@@ -51,9 +50,7 @@ export default {
     }
   },
   mounted () {
-    api.getBillSum({
-      version: config.version
-    }).then(res => {
+    api.getBillSum().then(res => {
       res.data.data.forEach(item => {
         this.billSum[item.type] = item.total
         if (item.type === 'billRate') {

+ 2 - 5
src/views/index/components/paid-in/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-26 08:46:04
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:22:25
+ * @LastEditTime: 2019-11-21 11:18:21
  * @Description: 近1年应实收统计
  -->
 <template>
@@ -21,7 +21,6 @@ import TitleCom from '@/components/title'
 import IncomeCom from './../income'
 import echarts from 'echarts'
 import { api } from '@/api'
-import config from '@/config'
 
 export default {
   data () {
@@ -34,9 +33,7 @@ export default {
     IncomeCom
   },
   mounted () {
-    api.getBillSumMonth({
-      version: config.version
-    }).then(res => {
+    api.getBillSumMonth().then(res => {
       this.yearTotal = res.data.data
       this.createMapPaid()
     })

+ 2 - 4
src/views/index/components/parking/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 10:20:36
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:21:49
+ * @LastEditTime: 2019-11-21 15:43:00
  * @Description: 智能停车
  -->
 <template>
@@ -35,7 +35,6 @@ import TitleCom from '@/components/title'
 import TagCom from '@/components/tag'
 import { api } from '@/api'
 import vueSeamless from 'vue-seamless-scroll'
-import config from '@/config'
 
 export default {
   computed: {
@@ -58,8 +57,7 @@ export default {
   mounted () {
     api.getTrafficRecord({
       pageSize: 30,
-      pageNum: 1,
-      version: config.version
+      pageNum: 1
     }).then(res => {
       this.parkData = res.data.data
     })

+ 2 - 5
src/views/index/components/record/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-26 14:11:25
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:21:21
+ * @LastEditTime: 2019-11-21 11:18:01
  * @Description:
  -->
 <template>
@@ -57,7 +57,6 @@
 </template>
 <script>
 import { api } from '@/api'
-import config from '@/config'
 
 export default {
   data () {
@@ -73,9 +72,7 @@ export default {
   },
   methods: {
     getAssetInfo () {
-      api.getAssetInfo({
-        version: config.version
-      }).then(res => {
+      api.getAssetInfo().then(res => {
         res.data.data.forEach(item => {
           this[item.type] = item.total
         })

+ 3 - 6
src/views/index/components/repair/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-25 17:54:01
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 09:42:52
+ * @LastEditTime: 2019-11-21 16:09:40
  * @Description: 住户报修
  -->
 <template>
@@ -54,7 +54,6 @@
 import TitleCom from '@/components/title'
 import echarts from 'echarts'
 import { api } from '@/api'
-import config from '@/config'
 
 export default {
   components: {
@@ -75,10 +74,8 @@ export default {
   },
   methods: {
     getRepairSum () {
-      api.getRepairSum({
-        version: config.version
-      }).then(res => {
-        this.repairSum = res.data.data.reportRepairStatisticsVos.map(item => {
+      api.getRepairSum().then(res => {
+        res.data.data.reportRepairStatisticsVos && res.data.data.reportRepairStatisticsVos.map(item => {
           this[item.type] = item.total
           return item
         })

+ 2 - 5
src/views/index/components/statistical/index.vue

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-24 18:56:59
  * @LastEditors: MoZhuangRu
- * @LastEditTime: 2019-11-21 10:21:29
+ * @LastEditTime: 2019-11-21 15:43:21
  * @Description:
  -->
 <template>
@@ -19,7 +19,6 @@
 import TipsCardCom from '@/components/tips-card'
 import { api } from '@/api'
 import countTo from 'vue-count-to'
-import config from '@/config'
 export default {
   data () {
     return {
@@ -62,9 +61,7 @@ export default {
     countTo
   },
   mounted () {
-    api.getAssetInfo({
-      version: config.version
-    }).then(res => {
+    api.getAssetInfo().then(res => {
       res.data.data.forEach(item => {
         this.list.map(val => {
           if (val.key === item.type) {

+ 2 - 2
vue.config.js

@@ -3,14 +3,14 @@
  * @LastEditors: MoZhuangRu
  * @Description: 配置文件
  * @Date: 2019-03-02 14:21:27
- * @LastEditTime: 2019-11-21 10:12:47
+ * @LastEditTime: 2019-11-21 11:16:15
  */
 const path = require('path')
 
 const resolve = dir => {
   return path.join(__dirname, dir)
 }
-const BASE_URL = process.env.NODE_ENV === 'production' ? '/screen' : process.env.VUE_APP_SECRET === 'test' ? '/screen' : process.env.VUE_APP_SECRET === 'demo' ? '/screen' : '/'
+const BASE_URL = process.env.NODE_ENV === 'production' ? '/screen' : process.env.VUE_APP_SECRET === 'test' ? '/screen' : '/'
 const ramdom = parseInt(Math.random() * 10000) // 随机数
 
 module.exports = {