Skip to content

Instantly share code, notes, and snippets.

@goldalworming
Created October 28, 2018 07:52
Show Gist options
  • Save goldalworming/ca412c650e74804a0d694116f607996a to your computer and use it in GitHub Desktop.
Save goldalworming/ca412c650e74804a0d694116f607996a to your computer and use it in GitHub Desktop.

Revisions

  1. goldalworming created this gist Oct 28, 2018.
    125 changes: 125 additions & 0 deletions SystemInformation.vue
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,125 @@
    <template>
    <div>
    <div class="title">Information</div>
    <div class="items">
    <div class="item">
    <div class="name">Path:</div>
    <div class="value">{{ path }}</div>
    </div>
    <div class="item">
    <div class="name">Route Name:</div>
    <div class="value">{{ name }}</div>
    </div>
    <div class="item">
    <div class="name">Vue.js:</div>
    <div class="value">{{ vue }}</div>
    </div>
    <div class="item">
    <div class="name">Electron:</div>
    <div class="value">{{ electron }}</div>
    </div>
    <div class="item">
    <div class="name">Node:</div>
    <div class="value">{{ node }}</div>
    </div>
    <div class="item">
    <div class="name">Platform:</div>
    <div class="value">{{ platform }}</div>
    </div>
    </div>
    <button @click="update">update</button>
    <button @click="openDirectory">opendir</button>
    </div>
    </template>

    <script>
    export default {
    data () {
    return {
    electron: process.versions.electron,
    name: this.$route.name,
    node: process.versions.node,
    path: this.$route.path,
    platform: require('os').platform(),
    vue: require('vue/package.json').version
    }
    },
    mounted () {
    },
    methods: {
    openDirectory () {
    const electron = require('electron')
    const remote = electron.remote
    const dialog = remote.dialog
    const fs = require('fs')
    dialog.showOpenDialog({properties: ['openDirectory']}, function (path) {
    if (path) {
    fs.access(path[0], fs.R_OK && fs.W_OK, function (err) {
    if (err) {
    prompt.alert('Cannot select this folder')
    } else {
    console.log(path[0])
    // settingsForm.find('input[name="downloadpath"]').val(path[0])
    }
    })
    }
    })
    },
    update () {
    const axios = require('axios')
    const vm = this
    const getDetails = async function () {
    const goldalworming = await axios.get('https://api.github.com/users/goldalworming')
    return goldalworming
    }
    const getDetails2 = async function () {
    const wesbos = await axios.get('https://api.github.com/users/wesbos')
    return wesbos
    }
    var name1 = ''
    var name2 = ''
    const main = async function () {
    let user = await getDetails()
    name1 = user.data.login
    user = await getDetails2()
    name2 = user.data.login
    vm.name = name1
    vm.node = name2
    }
    main()
    }
    }
    }
    </script>

    <style scoped>
    .title {
    color: #888;
    font-size: 18px;
    font-weight: initial;
    letter-spacing: .25px;
    margin-top: 10px;
    }
    .items { margin-top: 8px; }
    .item {
    display: flex;
    margin-bottom: 6px;
    }
    .item .name {
    color: #6a6a6a;
    margin-right: 6px;
    }
    .item .value {
    color: #35495e;
    font-weight: bold;
    }
    </style>