123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <template>
- <view>
-
- <u-navbar
- title="设置"
- title-color="#fff"
- :custom-back="customBack"
- :border-bottom="false"
- back-icon-color="#CCE8FF"
- :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
-
- <view class="cell-group" style="margin-top: 30rpx;">
- <u-cell-group>
- <u-cell-item title="修改密码" @click="openPage('pages/modifypwd/modifypwd')">
- <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
- </u-cell-item>
- <u-cell-item title="打印走纸" @click="onPrintFeed()">
- <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
- </u-cell-item>
- <u-cell-item title="地锁控制" @click="lockControl()">
- <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
- </u-cell-item>
- <u-cell-item title="退出登录" @click="onLoginOut()">
- <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
- </u-cell-item>
- </u-cell-group>
- </view>
- <u-popup v-model="show" mode="center" length="auto" >
- <view>
- <u-form :model="lockForm" ref="uForm">
- <u-form-item label="设备编码" label-width="150"><u-input v-model="lockForm.deviceNo" /></u-form-item>
- <u-form-item label="是否开锁" label-width="150"><u-input v-model="lockForm.cmdLabel" type="select" @click="lockForm.cmdFlag = true"/></u-form-item>
- </u-form>
- </view>
- <u-button @click="submit" type="primary">提交</u-button>
- </u-popup>
- <u-select v-model="lockForm.cmdFlag" :list="list" @confirm="getCmdValue"></u-select>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- //#ifdef APP-PLUS
- var device = uni.requireNativePlugin("DeviceInfo")
- //#endif
- export default{
- data(){
- return{
- show: false,
- lockForm:{
- deviceNo:'',
- cmd:'',
- cmdLabel: '',
- cmdFlag: false
- },
- list:[{
- value: 'up',
- label: '升板'
- },
- {
- value: 'down',
- label: '降板'
- }]
- }
- },
- onLoad(){
-
- },
- onShow(){
-
- },
- methods:{
- lockControl(){
- this.show=true;
- },
- submit(){
- this.$u.api.lockControl({deviceNo:this.lockForm.deviceNo, cmd:this.lockForm.cmd})
- .then( res =>{
- if(res.code == 200){
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- });
- }
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- });
- })
- },
- customBack(){
- this.$u.route({
- // type:'switchTab',
- url: 'pages/index/index'
- });
- },
- openPage(path) {
- // console.log('path',path);
- this.$u.route({
- url: path
- });
- },
- onPrintFeed(){
- //#ifdef APP-PLUS
- device.printFeed(10);
- //#endif
- //#ifdef H5
- uni.showToast({
- title: '非APP环境',
- duration: 2000
- });
- //#endif
- },
- getCmdValue(val) {
- console.log(val)
- this.lockForm.cmd = val[0].value
- this.lockForm.cmdLabel = val[0].label
- },
- onLoginOut(){
- uni.showModal({
- title: '温馨提示',
- content: '是否确认退出?',
- success: (res) => {
- if (res.confirm) {
- this.$u.api.loginOut({})
- .then(res=>{
- uni.clearStorage();
- this.$u.vuex('vuex_token', null);
- this.$u.vuex('vuex_user', null);
- this.$u.vuex('vuex_hasLogin', false);
- this.userInfo = [];
- this.theRoad = [];
- this.$refs.uToast.show({
- title: '退出成功,即将跳转登录页!',
- type: 'success',
- url:'pages/login/login'
- });
- // uni.showToast({
- // title: '退出成功',
- // duration: 2000
- // });
- // uni.redirectTo({
- // url:'../login/login'
- // });
- }).catch(err=>{
- uni.showToast({
- title: '退出失败',
- duration: 2000
- });
- });
- } else if (res.cancel) {
-
- }
-
- }
- })
-
- }
-
- }
- }
- </script>
- <style lang="scss">
- @import './setting.scss'
- </style>
|