Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

杨树贤 / kefu_server

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Find file
Normal viewHistoryPermalink
Switch branch/tag
  • kefu_server
  • ui
  • kefu_admin
  • src
  • plugins
  • help.js
help.js 1.61 KB
keith's avatar
into client,admin public
f958b975
 
keith committed 5 years ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
var moment = require('moment');
// eslint-disable-next-line no-undef
var Helps = {};
Helps.install = function (Vue, options) {
    Vue.prototype.$myMethod = function(){
        console.log(options)
    }
    // 获取单个平台数据
    Vue.prototype.$getPlatformItem = function(index){
        var platformConfigItem
        var platformConfig = this.$store.getters.platformConfig
        for(let i = 0; i< platformConfig.length; i++){
            if(platformConfig[i].id == index){
                platformConfigItem = platformConfig[i]
            }
        }
        return platformConfigItem || {title: "未知"}
    }
    // 格式化日期
    Vue.prototype.$formatUnixDate = function(unix, format = "YYYY-MM-DD HH:mm:ss"){
        return moment(parseInt(unix + '000')).format(format)
    }
    // 格式化日期(相对日期)
keith's avatar
updatecode
c03280ec
 
keith committed 5 years ago
24 25 26 27
    Vue.prototype.$formatDate = function (unix, format = "YYYY-MM-DD HH:mm:ss") {
        return moment(parseInt(unix + '000')).format(format)
    }
    // 格式化日期(相对日期)
keith's avatar
into client,admin public
f958b975
 
keith committed 5 years ago
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
    Vue.prototype.$formatFromNowDate = function(unix){
        if(moment().format("YYYYMMDD") == moment(parseInt(unix + '000')).format("YYYYMMDD")){
            return moment(parseInt(unix + '000')).format("HH:mm")
        }
        return moment(parseInt(unix + '000')).format("YYYY-MM-DD HH:mm")
    }
    Vue.prototype.$robotNickname = function(id){
        var nickname
        var robots = this.$store.getters.robots
        for(let i = 0; i< robots.length; i++){
            if(robots[i].id == id){
                nickname = robots[i].nickname
            }
        }
        return nickname
    }

}
export default Helps;