This commit is contained in:
2023-11-24 11:01:04 +08:00
11 changed files with 60 additions and 248 deletions

View File

@@ -1,159 +0,0 @@
<template>
<section v-if="active" class="pick-bottom">
<van-picker
show-toolbar
:title="title"
:columns="columns"
:default-index="defaultIndex"
@cancel="onCancel"
@confirm="onConfirm"
/>
<transition name="fade">
<div class="overlay" @click="onCancel"></div>
</transition>
</section>
</template>
<script>
import { Picker } from 'vant'
import {deviceQuery, workprocedureQuery, instStatusQuery} from '@config/getData1'
export default {
name: 'Picker',
components: {
[Picker.name]: Picker
},
props: {
active: Boolean,
title: String,
api: String,
selectItem: Object,
pickerArr: Array
// defaultIndex: {
// type: Number,
// default: 0
// }
},
computed: {
defaultIndex () {
return this.columns.findIndex(item => {
return item.id === this.selectItem.id
})
}
},
data () {
return {
columns: []
}
},
created () {
if (!this.api && this.pickerArr.length > 0) {
this.columns = this.pickerArr
}
switch (this.api) {
case 'deviceQuery':
this._deviceQuery()
break
case 'workprocedureQuery':
this._workprocedureQuery()
break
case 'instStatusQuery':
this._instStatusQuery()
break
case 'layerArr':
this._layerArr()
break
case 'seatArr':
this._seatArr()
break
}
},
methods: {
async _deviceQuery () {
let res = await deviceQuery()
if (res.code === '1') {
this.columns = res.result
} else {
this.Dialog(res.desc)
}
},
// _deviceQuery () {
// this.columns = [{id: '01', text: '缓存线1'}, {id: '02', text: '缓存线2'}, {id: '03', text: '缓存线3'}]
// },
async _workprocedureQuery () {
let res = await workprocedureQuery()
if (res.code === '1') {
this.columns = res.result
} else {
this.Dialog(res.desc)
}
},
// _workprocedureQuery () {
// this.columns = [{id: '1', text: '工序1'}, {id: '2', text: '工序2'}, {id: '3', text: '工序3'}]
// },
async _instStatusQuery () {
let res = await instStatusQuery()
if (res.code === '1') {
this.columns = res.result
} else {
this.Dialog(res.desc)
}
},
// _instStatusQuery () {
// this.columns = [{id: '1', text: '状态1'}, {id: '2', text: '状态2'}, {id: '3', text: '状态3'}]
// },
_layerArr () {
this.columns = [{id: '1', text: '1'}, {id: '2', text: '2'}, {id: '3', text: '3'}]
},
_seatArr () {
this.columns = [{id: '1', text: '1'}, {id: '2', text: '2'}, {id: '3', text: '3'}, {id: '4', text: '4'}, {id: '5', text: '5'}, {id: '6', text: '6'}, {id: '7', text: '7'}, {id: '8', text: '8'}, {id: '9', text: '9'}, {id: '10', text: '10'}]
},
onConfirm (value, index) {
this.$emit('onConfirmCallback', value)
// this.columns.defaultIndex = index
},
onCancel () {
this.$emit('onCancelCallback')
}
}
}
</script>
<style lang="stylus" scoped>
.pick-bottom >>> .van-ellipsis
font-size 14px
.pick-bottom
position fixed
width 100%
bottom 0
z-index 2018
.van-picker
z-index 2018
.overlay
position fixed
top 0
left 0
width 100%
height 100%
background-color rgba(0, 0, 0, 0.7)
z-index 2012
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.fade-enter-active
animation 0.3s fade-in
.fade-leave-active
animation 0.3s fade-out
</style>

View File

@@ -1,22 +1,28 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locale from 'element-ui/lib/locale'
import zh from './langs/zh'
import en from './langs/en'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
Vue.use(VueI18n)
// 引入本地包
const messages = {
en: Object.assign(en, enLocale),
zh: Object.assign(zh, zhLocale)
'en-US': Object.assign(en, enLocale),
'en': Object.assign(en, enLocale),
'zh-CN': Object.assign(zh, zhLocale),
'zh': Object.assign(zh, zhLocale)
}
// console.log(messages.zh)
const navLang = navigator.language || navigator.userLanguage
let localLang = navLang || false
let lang = localLang || window.localStorage.getItem('locale') || 'zh-CN'
lang = 'zh-CN'
// 创建国际化实例
const i18n = new VueI18n({
locale: localStorage.getItem('locale') || 'zh',
locale: lang,
messages
})

View File

@@ -1,9 +1,11 @@
module.exports = {
message: {
title: 'Sport Brands'
},
top: {
run: 'run',
auto: 'auto'
login: {
passwordlogin: 'Password login',
configuration: 'Configuration',
username: 'Username',
password: 'Password',
domainnameaddress: 'Domain name address',
refreshtime: 'Refresh time(s)',
login: 'Login'
}
}

View File

@@ -1,9 +1,11 @@
module.exports = {
message: {
title: '运动品牌'
},
top: {
run: '运行',
auto: '自动'
login: {
passwordlogin: '密码登录',
configuration: '配置',
username: '用户名',
password: '密码',
domainnameaddress: '域名地址',
refreshtime: '刷新时间(秒)',
login: '登录'
}
}

View File

@@ -10,8 +10,6 @@ import infiniteScroll from 'vue-infinite-scroll'
import VueTouchKeyboard from 'vue-touch-keyboard'
import 'vue-touch-keyboard/dist/vue-touch-keyboard.css'
import { DatePicker, Select, Option, Radio, Menu, MenuItem, Tree } from 'element-ui'
import { Pagination } from 'vant'
// import '@style/layout.styl'
import '@style/common.styl'
import i18n from './i18n/i18n'
import '@config/rem.js'
@@ -27,7 +25,6 @@ Vue.use(Radio)
Vue.use(Menu)
Vue.use(MenuItem)
Vue.use(Tree)
Vue.use(Pagination)
Vue.use(infiniteScroll)
Vue.use(VueTouchKeyboard)
Vue.prototype.$post = post

View File

@@ -6,7 +6,7 @@
<div class="login-bottom"></div>
<div class="login-wraper">
<div class="navs-wraper">
<button class="nav_item" :class="{'nav_item_active': tab === 0}" @click="toLogin">密码登录</button>
<button class="nav_item" :class="{'nav_item_active': tab === 0}" @click="toLogin">{{ $t('login.passwordlogin') }}</button>
<button class="nav_item" :class="{'nav_item_active': tab === 1}" @click="toSetup">配置</button>
</div>
<div v-show="tab === 0" class="login-content_wraper">

View File

@@ -51,11 +51,11 @@
<div class="state_left_wrap">
<div class="state_item_wrap">
<div class="agv_item_label">车辆状态</div>
<div class="agv_item_val" :style="result.vehicle_status === '运行' ? {'color': '#3CC1FF'} : {'color': '#E54F29'}">{{result.vehicle_status}}</div>
<div class="agv_item_val" :class="{'state_item_val_disabled': result.vehicle_status !== '运行'}">{{result.vehicle_status}}</div>
</div>
<div class="state_item_wrap">
<div class="agv_item_label">工作状态</div>
<div class="agv_item_val" :style="result.working_status === '正常' ? {'color': '#3CC1FF'} : {'color': '#E54F29'}">{{result.working_status}}</div>
<div class="agv_item_val" :class="{'state_item_val_disabled': result.working_status !== '正常'}">{{result.working_status}}</div>
</div>
</div>
<div class="state_line_dot_2"></div>
@@ -142,12 +142,13 @@ export default {
margin-bottom 50px
.agv_item_label
width 190px
_font(36px, 36px, #B4C1D8, 500, right)
_font(36px, 56px, #B4C1D8, 500, right)
font-family: SourceHanSansCN-Medium;
.agv_item_val
width calc(100% - 190px)
_font(36px, 36px, #3CC1FF, 500, left)
font-family: SourceHanSansCN-Medium;
_font(36px, 56px, #fff, 500,,)
padding-left 66px
background left center url(../../../images/new/state_btn.png) no-repeat
.state_wrap
width 100%
_fj(,flex-start)
@@ -157,7 +158,7 @@ export default {
.state_item_wrap
width 100%
_fj(flex-start)
margin-bottom 52px
margin-bottom 30px
.state_line_dot_2
_wh(1px, 201px)
background center / 100% 100% url(../../../images/new/line_2.png) no-repeat

View File

@@ -1,5 +1,5 @@
import Vue from 'vue'
import Router from 'vue-router'
import VueRouter from 'vue-router'
const Preload = r => require.ensure([], () => r(require('@page/Preload')), 'Preload')
const Login = r => require.ensure([], () => r(require('@page/modules/login/login.vue')), 'login')
@@ -24,9 +24,9 @@ const Role = r => require.ensure([], () => r(require('@page/modules/SystemManage
const System = r => require.ensure([], () => r(require('@page/modules/SystemManage/system.vue')), 'modules')
const Developer = r => require.ensure([], () => r(require('@page/modules/SystemManage/developer.vue')), 'modules')
Vue.use(Router)
Vue.use(VueRouter)
export default new Router({
const router = new VueRouter({
routes: [
{
path: '/',
@@ -99,3 +99,17 @@ export default new Router({
}
]
})
router.beforeEach((to, from, next) => {
if (!localStorage.getItem('locale')) {
let lang = navigator.language
if (lang === 'zh' || lang === 'zh-CN') {
localStorage.setItem('locale', 'zh-CN')
} else {
localStorage.setItem('locale', 'en-US')
}
}
next()
})
export default router