2020-10-08 14:48:18 +02:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
|
|
Vue.mixin({
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
appVersion: window.appVersion
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
async appLogout(evt) {
|
2022-05-16 22:55:50 +02:00
|
|
|
if (this.$root.appConfig.proxyAuth) {
|
|
|
|
if (this.$root.appConfig.proxyLogoutUrl) {
|
|
|
|
location.assign(this.$root.appConfig.proxyLogoutUrl)
|
|
|
|
}
|
|
|
|
else return false
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
await this.axios.get('/user/logout')
|
|
|
|
this.$storage.clear()
|
2022-11-25 13:13:19 +01:00
|
|
|
this.$router.push({ name: 'login', params: { forceRefresh: true } })
|
2022-05-16 22:55:50 +02:00
|
|
|
}
|
2020-10-08 14:48:18 +02:00
|
|
|
},
|
2022-11-25 13:13:19 +01:00
|
|
|
|
|
|
|
exitSettings: function (event) {
|
2021-10-29 17:12:58 +02:00
|
|
|
if (event) {
|
|
|
|
this.$notify({ clean: true })
|
|
|
|
this.$router.push({ name: 'accounts' })
|
|
|
|
}
|
2021-11-08 22:33:32 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
isUrl: function (url) {
|
|
|
|
var strRegex = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/
|
|
|
|
var re = new RegExp(strRegex)
|
|
|
|
|
|
|
|
return re.test(url)
|
|
|
|
},
|
|
|
|
|
|
|
|
openInBrowser(uri) {
|
|
|
|
const a = document.createElement('a')
|
|
|
|
a.setAttribute('href', uri)
|
2022-11-25 13:13:19 +01:00
|
|
|
a.dispatchEvent(new MouseEvent("click", { 'view': window, 'bubbles': true, 'cancelable': true }))
|
2022-03-15 14:47:07 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2022-11-14 17:13:24 +01:00
|
|
|
*
|
2022-06-24 09:10:49 +02:00
|
|
|
*/
|
|
|
|
inputId(fieldType, fieldName) {
|
|
|
|
let prefix
|
2022-11-25 13:13:19 +01:00
|
|
|
fieldName = fieldName.toString()
|
2022-06-24 09:10:49 +02:00
|
|
|
|
|
|
|
switch (fieldType) {
|
|
|
|
case 'button':
|
|
|
|
prefix = 'txt'
|
|
|
|
break
|
|
|
|
case 'button':
|
|
|
|
prefix = 'btn'
|
|
|
|
break
|
|
|
|
case 'email':
|
|
|
|
prefix = 'eml'
|
|
|
|
break
|
|
|
|
case 'password':
|
|
|
|
prefix = 'pwd'
|
|
|
|
break
|
2022-09-21 21:38:53 +02:00
|
|
|
case 'radio':
|
|
|
|
prefix = 'rdo'
|
|
|
|
break
|
|
|
|
case 'label':
|
|
|
|
prefix = 'lbl'
|
|
|
|
break
|
2022-06-24 09:10:49 +02:00
|
|
|
default:
|
|
|
|
prefix = 'txt'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
return prefix + fieldName[0].toUpperCase() + fieldName.toLowerCase().slice(1);
|
|
|
|
// button
|
|
|
|
// checkbox
|
|
|
|
// color
|
|
|
|
// date
|
|
|
|
// datetime-local
|
|
|
|
// file
|
|
|
|
// hidden
|
|
|
|
// image
|
|
|
|
// month
|
|
|
|
// number
|
|
|
|
// radio
|
|
|
|
// range
|
|
|
|
// reset
|
|
|
|
// search
|
|
|
|
// submit
|
|
|
|
// tel
|
|
|
|
// text
|
|
|
|
// time
|
|
|
|
// url
|
|
|
|
// week
|
|
|
|
},
|
2023-02-01 17:21:55 +01:00
|
|
|
|
|
|
|
setTheme(theme) {
|
|
|
|
document.documentElement.dataset.theme = theme;
|
|
|
|
}
|
2020-10-08 14:48:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
})
|