67 lines
1.3 KiB
Vue
67 lines
1.3 KiB
Vue
<template>
|
|
<view class="min-page bg-gray u-p-30 u-flex u-flex-col ">
|
|
<div class="w-full" v-for="item in pageData.list " :key="item.id">
|
|
<printer-item :data="item" @init='init'></printer-item>
|
|
</div>
|
|
<view v-if="!pageData.list.length">
|
|
<my-img-empty ></my-img-empty>
|
|
</view>
|
|
<view style="height: 100rpx;"></view>
|
|
<view class="fixed_b u-fixed">
|
|
<my-button shape="circle" @tap="toAdd">
|
|
<view>
|
|
<text>+</text>
|
|
<text>添加云打印机</text>
|
|
</view>
|
|
</my-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import go from '@/commons/utils/go.js'
|
|
import { onShow } from '@dcloudio/uni-app'
|
|
import { reactive } from 'vue';
|
|
import printerItem from './components/printer-item.vue';
|
|
import { getPrinter } from '@/http/api/printer.js'
|
|
|
|
const pageData = reactive({
|
|
list: [],
|
|
query: {
|
|
name: '',
|
|
connectionType: ''
|
|
}
|
|
})
|
|
|
|
onShow(()=>{
|
|
init()
|
|
})
|
|
|
|
/**
|
|
* 获取打印机列表
|
|
*/
|
|
async function init() {
|
|
const res = await getPrinter(pageData.query)
|
|
pageData.list = res.records
|
|
}
|
|
|
|
/**
|
|
* 添加打印机
|
|
*/
|
|
function toAdd(){
|
|
go.to('PAGES_PRINTER_ADD',{
|
|
a:1
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.fixed_b{
|
|
left: 110rpx;
|
|
right: 110rpx;
|
|
bottom: calc(env(safe-area-inset-bottom) + 10rpx);
|
|
/* #ifdef H5 */
|
|
bottom: 30rpx;
|
|
/* #endif */
|
|
}
|
|
</style> |