Files
hht-hdyy-uni/pages/login/setup.vue
2026-02-10 14:21:37 +08:00

128 lines
3.3 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="设置" :inner2="true" @goIn="goIn"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="setup-item">
<view class="filter_label">服务器</view>
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model.trim="addrip">
</view>
<!-- <view class="setup-item">
<view class="setup-label">打印机</view>
<input type="text" class="setup-input" placeholder="请输入打印地址" v-model.trim="printip">
</view> -->
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">打印机</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options"></uni-data-select>
</view>
<!-- <button class="mini-btn" type="primary" @tap="_getPrint">查询</button> -->
</view>
<!-- <view class="setup-item">
<view class="setup-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
</view> -->
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-10 button-primary" @click="_getPrint">打印机查询</button>
<button class="zd-col-10 button-primary" @click="_submit">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {getPrint} from '@/utils/getData3.js'
export default {
components: {
NavBar
},
data() {
return {
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
acsip: this.$store.getters.acsUrl,
printip: '',
setTime: this.$store.getters.setTime / 1000
};
},
created () {
// this.options.push({text:this.$store.getters.printUrl, value: this.$store.getters.printUrl})
// this.index = this.printip
},
methods: {
async _getPrint () {
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, acsUrl: this.acsip, printUrl: this.printip, setTime: this.setTime * 1000})
try {
let res = await getPrint()
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
},
selectChange (e) {
this.index = e
this.printip = e
},
goIn () {
uni.redirectTo({
url: '/pages/login/login'
})
},
_submit () {
if (this.addrip === '') {
uni.showToast({
title: '请填写LMS地址',
icon: 'none'
})
return
}
// if (this.printip === '') {
// uni.showToast({
// title: '请填写打印地址',
// icon: 'none'
// })
// return
// }
// if (this.setTime === '') {
// uni.showToast({
// title: '请填写刷新时间',
// icon: 'none'
// })
// return
// }
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, acsUrl: this.acsip, printUrl: this.printip, setTime: this.setTime * 1000})
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.setup-item
width 100%
margin-bottom 40rpx
.setup-label
_font(24rpx,40rpx,#000)
.setup-input
_wh(100%, 80rpx)
background #fff
_font(28rpx,80rpx,#323232)
padding 0 28rpx
border 2px solid #e9ecf3
border-radius 12rpx
</style>