generated from ccsens_fe/uni-vue3-template
19 changed files with 155 additions and 35 deletions
@ -0,0 +1,16 @@ |
|||
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ |
|||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 |
|||
"version": "0.0", |
|||
"configurations": [{ |
|||
"app-plus" : |
|||
{ |
|||
"launchtype" : "local" |
|||
}, |
|||
"default" : |
|||
{ |
|||
"launchtype" : "local" |
|||
}, |
|||
"type" : "uniCloud" |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"cSpell.words": ["dcloudio", "easyinput", "FILESYSTEMS", "localdata", "NIHSS", "nvue", "splashscreen", "uview", "vueuse"] |
|||
} |
@ -0,0 +1,59 @@ |
|||
<template> |
|||
<uni-card :is-shadow="false" :border="false" style="width: 40vw" padding="10px"> |
|||
<template v-slot:title> |
|||
<view class="text-center u-font-16 font-bold uni-mt-10 uni-mb-10">平板设置</view> |
|||
</template> |
|||
|
|||
<uni-forms ref="formRef" :modelValue="formData" :label-width="90" :rules="rules"> |
|||
<uni-forms-item label="平板编号" name="SS_DEVICE_NO"> |
|||
<uni-easyinput type="text" v-model="formData.SS_DEVICE_NO" placeholder="请输入编号" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="访问域名" name="SS_ACCESS_HOST"> |
|||
<uni-easyinput type="text" v-model="formData.SS_ACCESS_HOST" placeholder="请输入域名" /> |
|||
</uni-forms-item> |
|||
</uni-forms> |
|||
|
|||
<template v-slot:actions> |
|||
<view class="flex justify-between uni-mb-16"> |
|||
<u-button size="medium" shape="circle" @click="onCancel">取消</u-button> |
|||
<u-button size="medium" type="primary" shape="circle" class="bg-main" @click="onConfirm">确定</u-button> |
|||
</view> |
|||
</template> |
|||
</uni-card> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { reactive, ref } from 'vue'; |
|||
import { useServiceStore } from '@/store/modules/service'; |
|||
|
|||
const emits = defineEmits(['on-cancel', 'on-confirm']) |
|||
|
|||
const service = useServiceStore() |
|||
const formData = reactive({ SS_DEVICE_NO: '', SS_ACCESS_HOST: '' }) |
|||
|
|||
const rules = { |
|||
SS_DEVICE_NO: { rules: [{ required: true, errorMessage: '请输入平板编号' }] }, |
|||
SS_ACCESS_HOST: { rules: [{ required: true, errorMessage: '请输入域名' },] }, |
|||
} |
|||
|
|||
const formRef = ref() |
|||
|
|||
// cancel |
|||
function onCancel() { emits('on-cancel') } |
|||
|
|||
// confirm |
|||
function onConfirm() { |
|||
if (!formRef.value) return |
|||
formRef.value.validate().then(() => { |
|||
// 保存平板信息到localStorage |
|||
service.setDevice({ deviceNo: formData.SS_DEVICE_NO, host: formData.SS_ACCESS_HOST }) |
|||
|
|||
emits('on-confirm', formData) |
|||
}).catch(error => { |
|||
console.error(error); |
|||
}) |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
</style> |
@ -1,3 +1,5 @@ |
|||
export const LOCAL_KEY = { |
|||
LOADED: 'loaded', // 用来显示启动页 有本地数据不显示启动页 没有才显示
|
|||
DEVICE_NO: 'SS_DEVICE_NO', // 平板编号
|
|||
HOST: 'SS_ACCESS_HOST', // 域名
|
|||
} |
|||
|
Loading…
Reference in new issue