This commit is contained in:
qingjiao 2026-04-18 14:06:33 +08:00
parent 1ed30f7ebe
commit 1eeca994ab
6 changed files with 50 additions and 39 deletions

View File

@ -21,7 +21,8 @@ function hasPermission(roles, route) {
*/
export function filterAsyncRoutes(routes, roles) {
const res = []
const data = JSON.parse(getLoginData())?.menuRole || 1
const loginData = getLoginData()
const data = loginData?.menuRole || 1
routes.forEach(route => {
const tmp = { ...route }
if (hasPermission(roles, tmp)) {

View File

@ -20,6 +20,7 @@ const mutations = {
},
SET_LOGIN_DATA: (state, data) => {
state.loginData = data
console.log(state, data.udpPage)
setLoginData(data)
},
SET_KEY: (state, key) => {

View File

@ -15,11 +15,14 @@ export function setToken(token) {
}
export function getLoginData() {
return Cookies.get(LoginData)
const data = Cookies.get(LoginData)
return data ? JSON.parse(data) : null
// return Cookies.get(LoginData)
}
export function setLoginData(data) {
return Cookies.set(LoginData, data)
// return Cookies.set(LoginData, data)
return Cookies.set(LoginData, JSON.stringify(data))
}
export function getKey() {

View File

@ -4,15 +4,19 @@
{{ $t("route.agreement") }}
</div>
<div class="pageCon pageCon2">
<el-tabs v-model="selectIndex" style="margin-top: 15px">
<el-tabs
v-model="selectIndex"
style="margin-top: 15px"
>
<el-tab-pane
v-for="(item, index) in tabOptions"
:key="index"
:key="item.key"
:label="item.label"
:name="item.key"
/>
</el-tabs>
<el-form
v-show="selectIndex === '2'"
v-show="selectIndex === '0'"
class="detail-form agree-form"
label-width="180px"
label-position="right"
@ -94,7 +98,7 @@
</el-form-item>
</el-form>
<el-form
v-show="selectIndex === '0'"
v-show="selectIndex === '2'"
class="detail-form agree-form"
label-width="180px"
label-position="right"
@ -225,6 +229,7 @@
import { mapGetters } from 'vuex'
import { deviceInfo, deviceEdit } from '@/api/index.js'
import { encryptData, decryptData } from '@/utils/encryption/entrypt'
export default {
name: 'Agreement',
data() {
@ -258,7 +263,7 @@ export default {
key: '1'
}
],
selectIndex: '0',
selectIndex: '2',
formUDPData: {
udp: '',
id: '',
@ -312,9 +317,7 @@ export default {
}
},
computed: {
...mapGetters([
'udpPage'
])
...mapGetters(['udpPage']) // 'on' 'off'
},
mounted() {
if (this.udpPage === 'off') {
@ -408,7 +411,7 @@ export default {
this.formHTTPData.httpPort = res.data.httpPort
this.formHTTPData.webPort = res.data.webPort
console.log('data', res.data)
// console.log('data', res.data)
this.$forceUpdate()
} else {
this.$message.error(res.message)
@ -420,7 +423,7 @@ export default {
const portRegex = /^(1\d{4}|[2-4]\d{4}|49999)$/
const portRegex2 = /^(?:[2-9]\d{0,3}|1\d{0,3}|9999)$/
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
if (this.selectIndex === '2') {
if (this.selectIndex === '0') {
param = {
...this.formUDPData
}
@ -509,7 +512,7 @@ export default {
}
param.sipPassword = encryptData(param.sipPassword)
param.sipPassword2 = encryptData(param.sipPassword2)
} else if (this.selectIndex === '0') {
} else if (this.selectIndex === '2') {
param = {
...this.formONVIFData
}
@ -597,7 +600,7 @@ export default {
return
}
}
console.log(param)
// console.log(param)
deviceEdit(param).then((res) => {
if (res.code === 200) {
this.$message({
@ -611,6 +614,9 @@ export default {
})
}
})
},
changeTab(item, index) {
console.log(item, index)
}
}
}

View File

@ -103,7 +103,7 @@ export default {
})
return
}
if (files.size / 1024 / 1024 > 5) {
if (files.size / 1024 / 1024 > 30) {
this.$message({
type: 'error',
message: this.$i18n.t('table.fileSizeTip')

View File

@ -39,8 +39,8 @@
v-model="formData.aiVol"
:step="1"
:max="10"
@change="aiVolChange"
style="width: 120px;"
@change="aiVolChange"
/>
</el-form-item>
<el-form-item :label="$t('table.aoVol')" style="margin-left: 12px;">
@ -48,8 +48,8 @@
v-model="formData.aoVol"
:step="1"
:max="10"
@change="aoVolChange"
style="width: 120px;"
@change="aoVolChange"
/>
</el-form-item>
</el-form>
@ -255,7 +255,7 @@ export default {
})
return
}
if (files.size / 1024 / 1024 > 5) {
if (files.size / 1024 / 1024 > 30) {
this.$message({
type: 'error',
message: this.$i18n.t('table.fileSizeTip')