新功能
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '1.3rem' : '1.1rem'" size="mini">
|
||||
<p class="tip">{{$t('Languageselection')}}</p>
|
||||
<el-form-item :label="$t('Language')" prop="selectedLanguage">
|
||||
<el-select v-model="dataForm.selectedLanguage" :placeholder="$t('Pleaseselect')" style="width: 100%;">
|
||||
<el-select v-model="dataForm.selectedLanguage" :placeholder="$t('Pleaseselect')" id="selectedLanguage" style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in languages"
|
||||
:key="item.value"
|
||||
@@ -18,10 +18,10 @@
|
||||
</el-form-item>
|
||||
<p class="tip">{{$t('Parameterconfiguration')}}</p>
|
||||
<el-form-item :label="$t('SchedulingIP')" prop="ip">
|
||||
<el-input :placeholder="$t('PleaseIP')" v-model="dataForm.ip" @focus="show" data-layout="normal"></el-input>
|
||||
<el-input :placeholder="$t('PleaseIP')" v-model="dataForm.ip" id="ip" @focus="show" data-layout="normal"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="WIFI" prop="wifi">
|
||||
<el-input :placeholder="$t('PleaseWIFI')" v-model="dataForm.wifi" @focus="show" data-layout="normal"></el-input>
|
||||
<el-input :placeholder="$t('PleaseWIFI')" v-model="dataForm.wifi" id="wifi" @focus="show" data-layout="normal"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="absolute elec-qty-border"></div>
|
||||
<div class="elec-txt">50%</div>
|
||||
</div>
|
||||
<i class="el-icon-user-solid icon-user" :style="{'color': isUsed ? '#00ff29' : '#737f92'}" @click="loginModalHandle"></i>
|
||||
<i class="el-icon-user-solid icon-user" :style="{'color': $store.getters.userInfo === 'true' ? '#00ff29' : '#737f92'}" @click="loginModalHandle"></i>
|
||||
<i class="el-icon-s-tools icon-tools" @click="configModalHandle"></i>
|
||||
</el-row>
|
||||
</el-col>
|
||||
@@ -30,9 +30,9 @@
|
||||
<router-view></router-view>
|
||||
</el-row>
|
||||
<div class="task-tips">
|
||||
<div class="task-tips-t">A->B->C->D</div>
|
||||
<div class="task-tips-t">A<i class="el-icon-right"></i>B<i class="el-icon-right"></i>C<i class="el-icon-right"></i>D</div>
|
||||
</div>
|
||||
<login-modal v-if="loginVisible" ref="loginModal" @refreshUser="refreshUser"/>
|
||||
<login-modal v-if="loginVisible" ref="loginModal"/>
|
||||
<config-modal v-if="configVisible" ref="configModal"/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -48,7 +48,6 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
loginVisible: false,
|
||||
isUsed: false,
|
||||
configVisible: false
|
||||
}
|
||||
},
|
||||
@@ -83,10 +82,6 @@ export default {
|
||||
this.$refs.loginModal.init()
|
||||
})
|
||||
},
|
||||
// 切换登录状态
|
||||
refreshUser (flag) {
|
||||
this.isUsed = flag
|
||||
},
|
||||
// 配置
|
||||
configModalHandle () {
|
||||
this.configVisible = true
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
:visible.sync="dialogVisible"
|
||||
width="50%"
|
||||
:before-close="handleClose">
|
||||
<p class="tip">{{$t('Notloggedinyet')}}</p>
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '' : '1.1rem'" size="mini">
|
||||
<el-form-item :label="$t('Administratorpassword')" prop="password">
|
||||
<el-input :placeholder="$t('Pleasepassword')" v-model="dataForm.password" show-password @focus="show" data-layout="normal"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<p class="tip" v-if="$store.getters.userInfo === 'true'">登录成功</p>
|
||||
<div v-else>
|
||||
<p class="tip">{{$t('Notloggedinyet')}}</p>
|
||||
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '' : '1.1rem'" size="mini">
|
||||
<el-form-item :label="$t('Administratorpassword')" prop="password">
|
||||
<el-input :placeholder="$t('Pleasepassword')" v-model="dataForm.password" id="password" show-password @focus="show" data-layout="normal"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
||||
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{ $t('Logout') }}</p></button></el-col>
|
||||
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Login')}}</p></button></el-col>
|
||||
@@ -19,6 +22,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
@@ -31,6 +35,7 @@ export default {
|
||||
{ required: true, message: this.$t('Passwordnotempty'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
passwords: [], // 存储文件中的密码
|
||||
visible: false,
|
||||
layout: 'normal',
|
||||
input: null,
|
||||
@@ -43,16 +48,44 @@ export default {
|
||||
methods: {
|
||||
init () {
|
||||
this.dialogVisible = true
|
||||
this.loadPasswords()
|
||||
},
|
||||
exitUser () {
|
||||
this.dialogVisible = false
|
||||
this.visible = false
|
||||
this.$emit('refreshUser', false)
|
||||
this.$store.dispatch('setSignOut')
|
||||
},
|
||||
async loadPasswords () {
|
||||
try {
|
||||
const response = await axios.get('../../static/password.txt', {responseType: 'text'})
|
||||
let fileContent = response.data || ''
|
||||
if (typeof fileContent !== 'string') {
|
||||
fileContent = String(fileContent)
|
||||
}
|
||||
this.passwords = fileContent.split('\n').map(line => line.trim()).filter(line => line)
|
||||
if (this.passwords.length === 0) {
|
||||
throw new Error('密码文件为空或格式不正确')
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message('加载密码文件失败')
|
||||
}
|
||||
},
|
||||
dataFormSubmit () {
|
||||
this.dialogVisible = false
|
||||
this.visible = false
|
||||
this.$emit('refreshUser', true)
|
||||
if (this.$store.getters.userInfo === 'true') {
|
||||
return
|
||||
}
|
||||
if (this.passwords.includes(this.dataForm.password)) {
|
||||
this.$store.dispatch('userInfo', 'true')
|
||||
this.$message({
|
||||
message: '登录成功',
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
this.$message.error('登录失败')
|
||||
}
|
||||
this.dataForm = {password: ''}
|
||||
},
|
||||
handleClose (done) {
|
||||
this.visible = false
|
||||
|
||||
Reference in New Issue
Block a user