소스 검색

公用方法

zhuxinbo 5 년 전
부모
커밋
deb676af8b

+ 3 - 0
src/main.js

@@ -51,6 +51,9 @@ import '!style-loader!css-loader!less-loader!./theme/index.less'
 import ElementUI from 'element-ui';
 import 'element-ui/lib/theme-chalk/index.css';
 
+import { getDay,allWeeks } from '@/utils/getDay.js'
+Vue.prototype.$getDay = getDay
+Vue.prototype.allWeeks = allWeeks
 Vue.use(ElementUI);
 
 Vue.config.productionTip = false

+ 99 - 0
src/utils/getDay.js

@@ -0,0 +1,99 @@
+
+
+function getDay(day) {
+    var today = new Date()
+  
+    var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day
+  
+    today.setTime(targetday_milliseconds) //注意,这行是关键代码
+  
+    var tYear = today.getFullYear()
+  
+    var tMonth = today.getMonth()
+  
+    var tDate = today.getDate()
+  
+    tMonth = doHandleMonth(tMonth + 1)
+  
+    tDate = doHandleMonth(tDate)
+  
+    return tYear + '-' + tMonth + '-' + tDate
+  }
+  
+  function doHandleMonth(month) {
+    var m = month
+  
+    if (month.toString().length == 1) {
+      m = '0' + month
+    }
+  
+    return m
+  }
+
+export { getDay }
+
+Date.prototype.format = function (fmt) {
+    var o = {
+      "M+": this.getMonth() + 1, //月份
+      "d+": this.getDate(), //日
+      "h+": this.getHours(), //小时
+      "m+": this.getMinutes(), //分
+      "s+": this.getSeconds(), //秒
+      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
+      "S": this.getMilliseconds() //毫秒
+    };
+    if (/(y+)/.test(fmt)) {
+      fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
+    }
+    for (var k in o) {
+      if (new RegExp("(" + k + ")").test(fmt)) {
+        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+      }
+    }
+    return fmt;
+  }
+
+export  function allWeeks(now_month) {
+    let week_array = [];
+    let today = new Date(Date.parse(now_month));
+    let year = today.getFullYear();
+    let month = today.getMonth();
+    let i = 0;
+
+    let start = new Date(year, month, 1); // 得到当月第一天
+    let end = new Date(year, month + 1, 0); // 得到当月最后一天
+    let start_day = start.getDay(); // 当月第一天是周几
+    console.log(start.format("yyyy-MM-dd"), end.format("yyyy-MM-dd")); // 每月的起始日期
+    switch (start_day) {
+      case 0:
+        i = 0 - 1;
+        break;
+      case 1:
+        i = 0 - 2;
+        break;
+      case 2:
+        i = 0 - 3;
+        break;
+      case 3:
+        i = 0 - 4;
+        break;
+      case 4:
+        i = 0 - 5;
+        break;
+      case 5:
+        i = 1;
+        break;
+      case 6:
+        i = 0;
+        break;
+    }
+
+    while (new Date(year, month, i + 6) <= end) {
+
+      week_array.push([new Date(year, month, i).format("yyyy-MM-dd"),
+        new Date(year, month, i + 6).format("yyyy-MM-dd")
+      ])
+      i += 7;
+    }
+    return week_array;
+  }

+ 9 - 2
src/views/modules/Statistics/components/Treeselect.vue

@@ -52,7 +52,13 @@ export default {
         return true
       }
     },
-    appId: {}
+    appId: {},
+    request: {
+      type: String,
+      default() {
+        return '2'
+      }
+    }
   },
   components: { Treeselect },
   watch: {
@@ -125,10 +131,11 @@ export default {
     },
     getParticipateList() {
       //我参与的
+      //   toutiaoParticipateList
       getAction('/ctop/projectMember/participateList', { userId: this.userInfo().id }).then(res => {
         if (res.code == 0) {
           var data = res.result.filter(item => {
-            return item.mediaId == 2
+            return item.mediaId == this.request
           })
           this.options = data.map(item => {
             return {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 498 - 467
src/views/modules/Statistics/toutiaoAccount.vue


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 507 - 462
src/views/modules/Statistics/toutiaoMaterialStatistics.vue


+ 0 - 1
src/views/report/BytedancePlanDailyReportList.vue

@@ -137,5 +137,4 @@
 </script>
 <style scoped>
   @import '~@assets/less/common.less'
-  import moment from 'moment'
 </style>

+ 1 - 1
vue.config.js

@@ -70,7 +70,7 @@ module.exports = {
         // target: 'http://192.168.2.110:8080', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.2.132:8080', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
-        // target: 'http://192.168.2.132:8080', //请求本地 需要jeecg-boot后台项目  孙震
+        // target: 'http://192.168.2.123:8080', //请求本地 需要jeecg-boot后台项目  孙震
         // target:'http://127.0.0.1:8080',
         ws: false,
         changeOrigin: true