Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
4.4 kB
3
Indexable
Never
```js
<template>
  <div class="flex-grow-1">
    <div class="d-flex align-center py-3">
      <div>
        <div class="display-1 ma-0 pa-0">Profile</div>
        <!-- <v-breadcrumbs :items="breadcrumbs" class="pa-0 py-2"></v-breadcrumbs> -->
      </div>
      <v-spacer></v-spacer>
    
    </div>

    <v-tabs v-model="tab" :show-arrows="false" background-color="transparent">
      <v-tab class=""  to="#tabs-account">Account</v-tab>
      <!-- <v-tab to="#tabs-information">Information</v-tab> -->
    </v-tabs>

    <v-tabs-items v-model="tab">
      <v-tab-item value="tabs-account">
        <account-tab ref="tabs-account" :user="user"></account-tab>
      </v-tab-item>

      <v-tab-item value="tabs-information">
        <information-tab ref="tabs-information" :user="user"></information-tab>
      </v-tab-item>
    </v-tabs-items>
  </div>
</template>

<script>
import authHeader from '../../configs/auth-header/auth-header'
import axios from 'axios'
import apiUrl from '../../configs/environment/apiUrl'
import CopyLabel from '../../components/common/CopyLabel'
import AccountTab from './EditUser/AccountTab'
import InformationTab from './EditUser/InformationTab'

export default {
  components: {
    CopyLabel,
    AccountTab,
    InformationTab
  },
  data: () => ({
      user: {
        'user_id':localStorage.getItem('user_id'),
        'email':localStorage.getItem('email'),
        'nim':localStorage.getItem('nim'),
        'name':localStorage.getItem('name'),
        'verified':false,
        // 'created':'2019-08-09T03:14:12Z',
        // 'lastSignIn':'2019-08-14T20:00:53Z',
        'disabled':true,
        'role':'ADMIN',
        'avatar':'/images/avatars/avatar1.svg'
      },
      tab: null,
      breadcrumbs: [
        {
          text: 'Users',
          to: '/users/list',
          exact: true
        },
        {
          text: 'Edit User'
        }
      ],
    }),
    

  methods: {
        
        load(){
          // this.user.id = '32643652436'
          this.getProspectiveStudent()
        },

        getProspectiveStudent(){
            axios
              .create(
                { headers:  authHeader() }
              )
              .get(apiUrl('studentdata')+user.user_id).then(res => {
                  this.desserts = res.data
                  this.id = res.data[0].id
                  this.nim = res.data[0].nim
                  this.name = res.data[0].fullname
                  this.email = res.data[0].email
                  console.log(this.desserts)
                })
              
              .catch ((err) => {
                  console.log(err);
              })
          },

          // GenerateQR(item) {
          //   this.dialogGenerate = true
          //   this.qrid = item.id
          //   console.log(item.id)
          //   // this.host =window.location.host
          // },
          downloadQR() {
            axios({
              url:"https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl="+this.user_id,
              method:'GET',
              responseType:'blob'
            }).then((response)=> {
              var fileUrl = window.URL.createObjectURL(new Blob([response.data]))
              var fileLink = document.createElement('a')
              fileLink.href = fileUrl
    
              fileLink.setAttribute('download', 'image.jpg')
              document.body.appendChild(fileLink)
              fileLink.click()
            })
            // alert("hi")
            
            // axios({
            //   url:"https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl='http://localhost:8083//marketing/form/${item.id}'",
            //   method: 'GET',
            //   response
            // }).then((response) => {
            //   var fileURl = window.URL.createObjectURL(new Blob([response.data]))
            //   var fileLink = document.createElement('a')
            //   fileLink.href = fileUrl
    
            //   fileLink.setAttribute('download', 'image.jpg')
            //   document.body.appendChild(fileLink)
            //   fileLink.cli
            // })
            // alert("hi")
            // url:"https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl='http://localhost:8083//marketing/form/${item.id}'"
            // console.log('downloading', url); 
            // document.execCommand('SaveAs',true, url);
            },
        
      },
}
</script>

```