活动介绍

for i in lable: if(i == "phone"): # window.label_6.setText("<font color=red>正在用手机</font>") # window.label_9.setText("<font color=red>请不要分心!!!</font>") if ActionCOUNTER > 0: ActionCOUNTER -= 1

时间: 2023-07-15 07:14:04 浏览: 109
这段代码是一个简单的 Python 循环,它遍历列表 `lable` 中的元素。如果某个元素等于字符串 "phone",它会执行一些操作,包括将标签 `window.label_6` 的文本设置为红色的 "正在用手机",将标签 `window.label_9` 的文本设置为红色的 "请不要分心!!!",以及将变量 `ActionCOUNTER` 减 1。 你可以根据需要修改这些操作,例如更改标签的文本或颜色,或者执行其他操作。
相关问题

<view class="xw-form-item uni-column" v-if="i.compCode === 'radio'"> <view class="form-lable"> <text class="label-required" v-if="i.attribute.isRequire">*</text> {{ i.name }} </view> <radio-group name="radio" v-model="ruleForm[i.enName]" @change="onRadioChange($event, i)"> <label style="display: block;margin-bottom: 10px" v-for="(r, index) in i.attribute.options" :key="index"> <radio :value="r.value" :checked="ruleForm[i.enName] == r.value" :color="'#6aabea'" /> <text>{{ r.label }}</text> </label> </radio-group> </view>那在当前代码中 用第三种方式怎么实现 给我具体的代码

### 小程序 `radio-group` 实现单击选中再次点击取消的功能(第三种方式) 以下为基于 **uni-app** 或者类似的 Vue 驱动框架的具体实现代码示例。这种实现方式能够很好地满足用户需求,即通过单击选中某个选项后再点击该选项可将其取消选中。 #### HTML 结构 ```html <template> <view class="container"> <!-- Radio Group --> <radio-group @change="handleChange"> <block v-for="(option, index) in options" :key="index"> <label class="radio-item" @click="handleClick(option.value)"> <radio color="#007AFF" :value="option.value" :checked="isChecked(option.value)" /> {{ option.label }} </label> </block> </radio-group> <!-- 显示当前选中值 --> <view>当前选中:{{ selectedValue || '未选择' }}</view> </view> </template> ``` --- #### JavaScript 逻辑 ```javascript <script> export default { data() { return { // 定义选项列表 options: [ { label: '选项 A', value: 'A' }, { label: '选项 B', value: 'B' }, { label: '选项 C', value: 'C' } ], // 存储当前选中的值 selectedValue: null }; }, methods: { /** * 处理点击事件 */ handleClick(value) { if (this.selectedValue === value) { // 如果当前选中的值等于点击的值,则清空选中状态 this.selectedValue = null; } else { // 否则更新为新的选中值 this.selectedValue = value; } }, /** * 判断某选项是否被选中 */ isChecked(value) { return this.selectedValue === value; }, /** * 改变事件回调函数 */ handleChange(event) { console.log('Radio change:', event); } } }; </script> ``` --- #### CSS 样式 为了提升用户体验,可以适当美化界面布局: ```css <style scoped> .container { padding: 20px; } .radio-item { margin-bottom: 10px; font-size: 16px; } </style> ``` --- ### 功能解析 1. **数据结构设计** - 使用 `options` 数组存储所有的选项及其对应的值。 - 使用 `selectedValue` 来记录当前选中的值[^1]。 2. **核心逻辑** - 在每次点击时调用 `handleClick` 方法判断当前点击的值是否已经处于选中状态。 - 若已选中,则将 `selectedValue` 清空;否则,更新为新的值[^2]。 3. **动态渲染** - 使用 `v-for` 指令遍历 `options` 数组生成多个 `<radio>` 元素。 - 使用 `isChecked` 方法动态设置每个 `<radio>` 的 `checked` 属性[^3]。 4. **事件监听** - 监听 `@click` 事件以触发自定义逻辑。 - 提供 `@change` 回调以便后续扩展功能。 --- ### 总结 上述代码实现了在小程序中通过 `radio-group` 和 `radio` 组件完成单击选中、再次点击取消选中的功能。整个过程依赖于 Vue 数据驱动机制,确保了逻辑清晰且易于维护。 ---

<template> <view> <view class="home-back" @click="backHome"> 返回首页 </view> <view class=""> <u-list> <u-list-item class="yuyue" v-for="item in yuyueList" :key="item.id"> <u-cell> <template #label> <view class="shoufei-lable"> <span class="lable-one">预约时间:{{fetchDate(item.createtime) }}</span> <!-- <span class="lable-two"></span> --> </view> <view class="shoufei-lable"> <span class="lable-one">预计到达时间:{{fetchDate(item.arriveTime)}}</span> <!-- <span class="lable-two"></span> --> </view> <view class="shoufei-lable"> <span class="lable-one">送货总量:{{item.sendAmonut}}</span> <!-- <span class="lable-two">6</span> --> </view> <view class="shoufei-lable"> <span class="lable-one">供应商:{{item.sName}}</span> <!-- <span class="lable-two">6</span> --> </view> <view class="shoufei-lable"> <span class="lable-one">车牌号:{{item.carNo}}</span> <!-- <span class="lable-two">6</span> --> </view> <view class="shoufei-lable"> <span class="lable-one">货源地:{{item.huoyuandiName}}</span> <!-- <span class="lable-two">6</span> --> </view> <view> <view class="lable-one">预约图片:</view> <image class="yuyeu-img" v-for="itemImg in item.pictureUrl.slice(0, -1).split(',')" :src=" 'http://' + itemImg" mode=""> </image> </view> </template> </u-cell> <u-cell> <template #value> <view class="yuyue-but"> <button class="but-one" type="default" @click="changeDel(item.id, item.weightStatus)">删除</button> <button class="but-two" type="default" @click="changeWeigh(item.id)">过磅二维码</button> </view> </template> </u-cell> </u-list-item> </u-list> </view> <view class="yuyue-popup"> <u-popup :show="yuyueshow" mode="center"> <!-- <canvas id="qrcode" canvas-id="qrcode" style="width: 500rpx;height: 500rpx;"></canvas> --> <view class="" style="width: 66vw; margin: 0 auto;"> <uqrcode ref="uqrcode" canvas-id="qrcode" :value="QRvalue" :options="{ margin: 10 }" :size="size"> </uqrcode> </view> <u-button class="close-Qr" @click="yuyueshow = false">关闭过磅二维码</u-button> </u-popup> </view> <!-- <u-loadmore :status="status" /> --> </view> </template> <script> import dayjs from 'dayjs' import api from '@/api/api.js'; export default { data() { return { yuyueshow: false, size: 240, QRvalue: "", pagenum: 1, //加载页 pageSize: '2', isFinished: false, status: 'loading', yuyueList: [], } }, onLoad(option) { this.fetchYuyueInfo() }, onReachBottom() { alert(111) if (this.isFinished) return // this.status = "nomore" this.pagenum = this.pagenum + 1 this.fetchYuyueInfo() }, methods: { fetchDate(times) { return dayjs(times).format('YYYY-MM-DD') }, async fetchYuyueInfo() { const data = await api.getYuyueInfo({ iDisplayStart: this.pagenum, iDisplayLength: this.pageSize }) console.log(data); if (this.pagenum === 1) { this.yuyueList = data.data // this.status = "nomore" console.log(this.pagenum); } else { this.yuyueList = [...this.yuyueList, ...data.data] } console.log(this.yuyueList.length) console.log(data.total) if (this.yuyueList.length >= data.total) { this.isFinished = true } console.log(this.pagenum, this.yuyueList); }, changeDel(delid, statu) { console.log("删除"); if (statu === 0) { uni.showModal({ title: '提示', content: '是否删除此条信息', success: async (res) => { if (res.confirm) { const data = await api.getYuyueInfoDel({ Id: delid }) uni.$u.toast(data.message) this.fetchYuyueInfo() } else if (res.cancel) { console.log('用户点击取消'); } } }); } else { uni.$u.toast("此条数据不可删除!") } }, changeWeigh(Id) { this.QRvalue = `${Id};` this.yuyueshow = true }, backHome() { uni.reLaunch({ url: '/pages/index/index' }); }, } } </script> <style lang="scss" scoped> .home-back { width: 230rpx; height: 60rpx; margin: 5rpx 40rpx; text-align: center; line-height: 60rpx; border-radius: 50px; font-weight: bold; color: #66cc1c; background: #fff; } .yuyue { width: 95vw; margin: 10rpx auto; border-radius: 8rpx; background: #fff; .shoufei-lable { display: flex; justify-content: space-evenly; align-items: center; margin: 10rpx 0; font-size: 32rpx; color: #82848a; .lable-one { flex: 1; } .lable-two { flex: 1; } } .yuyue-but { display: flex; justify-content: center; align-items: center; .but-one { width: 130rpx; height: 75rpx; line-height: 75rpx; font-size: 30rpx; color: #fff; margin-right: 20rpx; background: #f56c6c; } .but-two { width: 240rpx; height: 75rpx; line-height: 75rpx; font-size: 35rpx; color: #fff; background: #66cccc; } } .yuyue-popup { width: 550rpx; height: 550rpx; border-radius: 10rpx; } .yuyeu-img { width: 305rpx; height: 230rpx; margin: 10rpx auto; margin-right: 18rpx; } } :v-deep .uni-file-picker__container[data-v-bdfc07e0] { width: 240rpx; } .close-Qr { box-sizing: border-box; margin: 20rpx; width: 66vw; background: #66cccc; color: #fff; } </style> 以上代码onReachBottom() 只执行一次

<think>我们之前已经讨论过uni-app中onReachBottom只执行一次的问题,现在根据用户提供的站内引用,进一步整理解决方案。 用户引用的内容中提到了几个关键点: 1. pages.json中必须设置onReachBottomDistance(引用[1]和[2]) 2. 页面结构问题:使用绝对定位或固定定位可能导致无法触底(引用[4]) 3. 设置了overflow样式可能导致失效(引用[5]) 4. 使用scroll-view会屏蔽页面滚动事件(之前已提到,引用[4]中也有类似问题) 结合之前的回答和新的引用,我们重新梳理解决方案: 问题:uni-app onReachBottom 方法仅触发一次 可能原因及解决方案: 1. **pages.json未配置触发距离**(最常见) 在pages.json中为对应页面设置`onReachBottomDistance`,建议值100-150(引用[1][2])。 ```json // pages.json { "pages": [ { "path": "pages/yourPage", "style": { "onReachBottomDistance": 150 // 设置触发距离 } } ] } ``` 2. **页面内容高度不足** 确保初始数据足够撑满一屏,否则不会触发滚动。可以在onLoad中初始化数据。 3. **页面结构问题** - 避免在页面最外层使用`position:absolute`或`position:fixed`(引用[4])。 - 避免使用`overflow`样式(引用[5]),特别是外层容器设置`overflow:scroll`可能影响。 - 确保页面内容从顶部开始布局,没有额外的定位偏移。 4. **使用了scroll-view组件** scroll-view会屏蔽页面滚动事件,应移除scroll-view,使用普通view(引用[4])。 5. **加载状态锁未重置** 在onReachBottom中,如果设置了loading状态,在数据加载完成后必须重置为false,否则后续触发会被拦截。 6. **跨端样式问题** 在App端,如果页面样式使用了scoped,可能需要单独为page元素设置样式(引用[5]): ```html <style> /* 非scoped样式 */ page { height: 100vh; background-color: #F5F6FA; } </style> <style scoped> /* 组件样式 */ </style> ``` 7. **列表容器高度问题** 如果页面底部没有足够空间,可以添加一个空白view(引用[5]): ```html <template> <view> <!-- 列表内容 --> <view v-for="(item,index) in list" :key="index">{{item}}</view> <!-- 底部空白,确保有滚动空间 --> <view style="height:300rpx;"></view> </view> </template> ``` 完整示例代码: ```javascript // 页面脚本 export default { data() { return { list: [], // 列表数据 loading: false, // 加载状态 page: 1, // 当前页码 } }, onLoad() { // 初始化数据,确保第一屏有足够数据 this.loadData() }, methods: { loadData() { // 模拟请求 uni.showLoading({ title: '加载中' }) setTimeout(() => { // 生成新数据 const newData = Array(10).fill().map((_, i) => `Item ${this.list.length + i + 1}`) this.list = [...this.list, ...newData] uni.hideLoading() this.loading = false // 重置加载状态 }, 1000) } }, onReachBottom() { // 防止重复请求 if (this.loading) return this.loading = true this.page++ this.loadData() } } ``` ```html <!-- 页面模板 --> <template> <view class="content"> <!-- 避免使用scroll-view --> <view v-for="(item, index) in list" :key="index" class="item">{{item}}</view> <!-- 底部空白区域 --> <view style="height: 300rpx;"></view> </view> </template> <style> /* 全局page样式 */ page { height: 100vh; background-color: #F5F6FA; } </style> <style scoped> .content { /* 避免使用绝对定位和overflow */ } .item { height: 120rpx; line-height: 120rpx; text-align: center; border-bottom: 1px solid #eee; } </style> ``` ```json // pages.json配置 { "pages": [ { "path": "pages/index/index", "style": { "navigationBarTitleText": "分页测试", "onReachBottomDistance": 150 } } ] } ``` 如果按照以上步骤仍然无法解决,请检查是否有其他因素影响滚动区域计算,例如自定义导航栏(navigationStyle:custom)可能需要调整页面顶部内边距。 相关问题: 1. uni-app中如何实现自定义导航栏下的滚动区域适配? 2. uni-app长列表性能优化有哪些方案? 3. uni-app中scroll-view和页面滚动如何选择? 4. uni-app如何实现跨端样式兼容?</think>### Uni-App `onReachBottom` 方法仅触发一次解决方案 根据引用内容和实践经验,`onReachBottom` 只执行一次通常由以下原因导致,以下是完整解决方案: #### 核心问题排查与解决 1. **页面配置缺失**(关键!) 在 `pages.json` 中必须设置触发距离(引用[1][2]): ```json { "path": "pages/yourPage", "style": { "onReachBottomDistance": 150, // 建议150px "enablePullDownRefresh": true } } ``` 2. **布局结构问题**(高频原因) - **绝对定位导致失效**(引用[4]): 移除容器层的 `position: absolute/fixed` ```html <!-- 错误示例 --> <view class="container" style="position: absolute"> ... </view> <!-- 正确示例 --> <view class="container"> <!-- 内容 --> </view> ``` - **高度不足**(引用[5]): 在页面底部添加空白区域: ```html <template> <view> <!-- 主要内容 --> <view style="height: 300rpx"></view> <!-- 确保滚动空间 --> </view> </template> ``` 3. **CSS 样式冲突**(引用[5]) - 避免在容器层使用 `overflow: scroll` - 正确设置页面高度: ```css /* 单独添加全局样式 */ <style> page { height: 100vh; background: #F5F6FA; } </style> <style scoped> /* 组件样式 */ </style> ``` 4. **数据加载逻辑错误** ```javascript export default { data() { return { list: [], loading: false, // 状态锁 page: 1, noMore: false } }, onReachBottom() { if (this.loading || this.noMore) return this.loading = true uni.showLoading({ title: '加载中' }) // 模拟请求 setTimeout(() => { const newData = Array(10).fill().map((_, i) => ({ id: this.list.length + i })) this.list = [...this.list, ...newData] this.page++ this.loading = false // 关键:重置状态锁 uni.hideLoading() // 模拟无更多数据 if (this.page > 3) this.noMore = true }, 1000) } } ``` 5. **错误使用 scroll-view**(引用[4]) ```html <!-- 错误:scroll-view 会屏蔽页面滚动 --> <scroll-view scroll-y> <view v-for="item in list">...</view> </scroll-view> <!-- 正确:使用普通容器 --> <view> <view v-for="item in list">...</view> </view> ``` #### 完整可运行示例 ```html <!-- 页面模板 --> <template> <view class="content"> <view v-for="item in list" :key="item.id" class="item"> {{ item.id }} - 列表项 </view> <!-- 底部提示 --> <view v-if="noMore" class="no-more">没有更多了</view> <view v-else class="loading-text">{{ loading ? '加载中...' : '上拉加载' }}</view> </view> </template> <script> export default { data() { return { list: Array(15).fill().map((_, i) => ({ id: i + 1 })), loading: false, noMore: false, page: 1 } }, onReachBottom() { if (this.loading || this.noMore) return this.loading = true console.log('触底触发') // 模拟API请求 setTimeout(() => { const newData = Array(5).fill().map((_, i) => ({ id: this.list.length + i + 1 })) this.list = [...this.list, ...newData] this.page++ this.loading = false // 模拟数据结束 if (this.page >= 4) this.noMore = true }, 1500) } } </script> <style> /* 关键:全局页面高度 */ page { height: 100vh; background-color: #f7f7f7; } .content { padding: 20rpx; } .item { height: 120rpx; line-height: 120rpx; border-bottom: 1rpx solid #eee; text-align: center; } .loading-text, .no-more { text-align: center; padding: 30rpx; color: #999; } </style> ``` ```json // pages.json 配置 { "pages": [ { "path": "pages/index/index", "style": { "navigationBarTitleText": "分页测试", "onReachBottomDistance": 150 } } ] } ``` #### 排查流程图 ```mermaid graph TD A[onReachBottom只触发一次] --> B{检查pages.json配置} B -->|未设置| C[添加onReachBottomDistance] B -->|已设置| D{检查页面布局} D -->|绝对定位| E[移除position:absolute] D -->|高度不足| F[添加底部空白view] D -->|使用scroll-view| G[改用普通view] A --> H{检查数据加载逻辑} H -->|loading未重置| I[确保重置loading:false] H -->|无更多数据| J[添加noMore状态判断] ``` > **关键提示**: > 1. 小程序端需确保页面内容高度 > 屏幕高度 + `onReachBottomDistance` > 2. H5端需检查浏览器滚动条是否生效(禁用`body{overflow:hidden}`) > 3. 使用自定义导航栏时,需手动设置页面顶部内边距[^4] --- ### 相关问题 1. uni-app 中如何优化长列表滚动性能? 2. uni-app 的 `scroll-view` 和页面滚动应该如何选择? 3. uni-app 如何实现跨端兼容的下拉刷新功能? 4. uni-app 中自定义导航栏导致滚动区域计算错误怎么办?
阅读全文

相关推荐

业务画面:<template> <my-form ref="forRef" :model="data"> <my-form-item label="产品名称" prop="name"> <my-input v-model="data.name" :rules="[ { required: true, message: '请输入产品名称', trigger: 'blur' }, { max: 10, maxMessage: '产品名称不能超过10个汉字' } ]" /> </my-form-item> <my-form-item label="产品描述" prop="age"> <my-input v-model="data.age" :rules="[ { required: true, message: '请输入产品描述', trigger: 'blur' }, { max: 10, maxMessage: '姓名不能超过200个汉字' } ]" /> </my-form-item> <my-form-item label="性别" prop="sex" :rules="[ { required: true, message: '请选择性别', trigger: 'blur' },]"> <my-select v-model="data.sex"> <my-option v-for="item in sexOptions" :label="item.lable" :value="item.value" /> </my-select> </my-form-item> <my-form-item label="产品单价" prop="price"> <my-input v-model="data.price" :rules="[ { required: true, message: '请输入产品单价', trigger: 'blur' }, { min: 0, message: '产品单价不能小于0', trigger: 'blur' }, { max: 10000, message: '产品单价不能超过10000', trigger: 'blur' } ]" /> </my-form-item> <my-form-item label="产品库存" prop="price"> <my-input v-model="data.price" :rules="[ { required: true, message: '请输入产品库存', trigger: 'blur' }, { min: 0, message: '产品库存不能小于0', trigger: 'blur' }, { max: 10000, message: '产品库存不能超过10000', trigger: 'blur' } ]" /> </my-form-item> </my-form> {{ data }} <button @click="checkForm">提交</button> <button @click="clearForm">清空</button> </template> <script setup> import myForm from '@/components/myForm'; import myFormItem from '@/components/myForm/myFormItem'; import MyInput from '@/components/input' import MySelect from '@/components/mySelect' import MyOption from '@/components/mySelect/myOption' const forRef = ref() const sexOptions = reactive([{ lable: "男", value: 1 }, { lable: "女", value: 2 }]) const data = reactive({ name: "", age: "", sex: "", price: "", formCheck: null }) function checkForm() { data.formCheck = forRef.value.validate() } function clearForm() { forRef.value.resetField() } const rules = reactive({ name: [ { required: true, message: '请输入产品名称', trigger: 'blur' }, { max: 10, message: '长度超过10位', trigger: 'blur' }, ], description: [ { required: true, message: '请输入产品描述', trigger: 'blur' }, { max: 200, message: '长度超过200位', trigger: 'blur' }, ], category: [ { required: true, message: '请选择产品分类', trigger: 'change' }, ], }); </script> form画面:<template> <slot> </slot> </template> <script setup> import { provide } from 'vue'; const props = defineProps({ model: { type: Object, required: true } }) const form = reactive({ childItem: [], childProp: [] }) provide('addChildItem', (item) => { form.childItem.push(item) }) provide('addChildProp', (item) => { form.childProp.push(item) }) function validate() { let bool = true form.childItem.forEach(item => { let check = item.validate() if (check) { bool = false } }) return bool } function resetField() { form.childProp.forEach(item => { if (props.model[item]) { props.model[item] = null } }) } defineExpose({ validate, resetField }) </script> form-item画面:<template> <label class="label">{{ props.label }}</label> <label>:</label> <slot></slot> </template> <script setup> const props = defineProps({ label: { type: String, required: true, default: '' }, prop: { type: String, default: '' } }) const addChildProp = inject('addChildProp') onMounted(() => { if (addChildProp) { addChildProp(props.prop) } }) </script> <style> .label { min-width: 100px; text-align: right; } </style> select组件:<template> <button class="trigger" @click="toggleMenu"> {{ selectedLabel || placeholder }} </button> <template v-for="item in selectOptions"> {{ item.label }} </template> <slot></slot> </template> <script setup> const model = defineModel() const selectedLabel = ref('') const selectOptions = ref([]) const isOpen = ref(false) const props = defineProps({ placeholder: { type: String, default: '请选择' }, options: { type: Array, default: [] } }) const emit = defineEmits(['change']) function handleClick(item) { model.value = item.value toggleMenu() } function setOtherOptionDefault(value) { selectOptions.value.forEach(item => { if (item.value != value) { item.selected = false } else { item.selected = true } }) } function toggleMenu() { isOpen.value = !isOpen.value } provide('pushOptions', item => { selectOptions.value.push(item) }) watch( () => model, // 监听的属性 (newVal, oldVal) => { // 变化时的回调函数 if (newVal != null && newVal != undefined && newVal.value != null && newVal.value != undefined) { selectOptions.value.forEach(item => { if (item.value == newVal.value) { selectedLabel.value = item.label setOtherOptionDefault(newVal.value) } }) } else { selectedLabel.value = "" } }, { deep: true } ); onMounted(() => { if (props.options.length > 0) { selectOptions.value = props.options } selectOptions.value.forEach(item => { if (item.value == model.value) { selectedLabel.value = item.label setOtherOptionDefault(model.value) } }) }) </script> <style scoped lang="scss"> .option { width: 100%; padding: 3px 0px 3px 0px; &:hover { background-color: #fa0808; } span { margin-left: 15px; font-size: 14px; user-select: none; } } .selected { color: #409eff; } .select { position: relative; width: 200px; } .trigger { width: 100%; padding: 8px 12px; border: 1px solid #ccc; background-color: #fff; text-align: left; cursor: pointer; } .arrow { float: right; transition: transform 0.3s ease; } .arrow.rotated { transform: rotate(180deg); } .menu { position: absolute; top: 100%; left: 0; width: calc(100% - 1px); height: 0px; overflow-x: auto !important; overflow-y: auto !important; border: 1px solid #ccc; border-top: none; background: white; z-index: 10; transition: height 0.3s ease; &::-webkit-scrollbar { width: 5px; /* 垂直滚动条宽度 */ height: 5px; /* 水平滚动条高度(可选) */ } /* 滚动条滑块部分 */ &::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.3); border-radius: 4px; } /* 滚动条轨道 */ &::-webkit-scrollbar-track { background-color: #f1f1f1; } } .menu.menu_open { height: 100px !important; } .fade-enter-active, .fade-leave-active { transition: opacity 0.2s; } .fade-enter-from, .fade-leave-to { opacity: 0; } </style> 子组件:<template> </template> <script setup> const props = defineProps({ label: { type: String, required: true }, value: { type: [String, Number], required: true }, }) const pushOptions = inject('pushOptions') onMounted(() => { pushOptions && pushOptions({ value: props.value, label: props.label, selected: false },) }) </script> 我想实现下拉框的check

def addstudents(stuid,stuname,stusex,stuaddress,china,math,english): sqlstr="""insert into students(stuid,stuname,stusex,stuaddress,china,math,english) values(?,?,?,?,?,?,?)""" cursor.execute(sqlstr,(stuid,stuname,stusex,stuaddress,china,math,english)) cursor.commit() return stuid,stuname,stusex,stuaddress,china,math,english #添加学生信息的窗口 def windowadd(): window=tkinter.Toplevel() window.title("添加学生信息")#窗口名字 window.geometry("600x500")#窗口大小 #学号的标签和entry sid=tkinter.StringVar() sid.set("") lable1=tkinter.Label(window,text="学 号:",font=(20),width=25) lable1.place(x=40,y=50,anchor='nw') input1=tkinter.Entry(window,show=None,font=(20),textvariable=sid,width=25) input1.place(x=200,y=50,anchor='nw') sname=tkinter.StringVar() sname.set("") lable2=tkinter.Label(window,text="姓 名:",font=(20),width=25) lable2.place(x=40,y=100,anchor='nw') input2=tkinter.Entry(window,show=None,font=(20),textvariable=sname,width=25) input2.place(x=200, y=100, anchor='nw') ssex=tkinter.StringVar() ssex.set("") lable3=tkinter.Label(window,text="性 别:",font=(20),width=25) lable3.place(x=40,y=150,anchor='nw') input3=tkinter.Entry(window,show=None,font=(20),textvariable=ssex,width=25) input3.place(x=200, y=150, anchor='nw') saddress=tkinter.StringVar() saddress.set("") lable4=tkinter.Label(window,text="地 址:",font=(20),width=25) lable4.place(x=40,y=200,anchor='nw') input4=tkinter.Entry(window,show=None,font=(20),textvariable=saddress,width=25) input4.place(x=200, y=200, anchor='nw') schina=tkinter.StringVar() schina.set("") lable5=tkinter.Label(window,text="语 文:",font=(20),width=25) lable5.place(x=40,y=250,anchor='nw') input5=tkinter.Entry(window,show=None,font=(20),textvariable=schina,width=25) input5.place(x=200, y=250, anchor='nw') smath=tkinter.StringVar() smath.set("") lable6=tkinter.Label(window,text="数 学:",font=(20),width=25) lable6.place(x=40,y=300,anchor='nw') input6=tkinter.Entry(window,show=None,font=(20),textvariable=smath,width=25) input6.place(x=200, y=300, anchor='nw') seng=tkinter.StringVar() seng.set("") lable7=tkinter.Label(window,text="英 语:",font=(20),width=25) lable7.place(x=40,y=350,anchor='nw') input7=tkinter.Entry(window,show=None,font=(23),textvariable=seng,width=25) input7.place(x=200, y=350, anchor='nw') b_yes=tkinter.Button(window,text='确认',bg='blue',font=(20),command=lambda:addstudents(sid.get(),sname.get(),ssex.get(),saddress.get(),schina.get(),smath.get(),seng.get())) b_yes.place(x=70,y=420,anchor='nw') b_no=tkinter.Button(window,text="取消",bg='blue',font=(23),command=lambda :window.destroy()) b_no.place(x=400,y=420,anchor='nw') window.mainloop() 为什么会有 File "D:\pythonProject2\main.py", line 119, in <lambda> b_yes=tkinter.Button(window,text='确认',bg='blue',font=(20),command=lambda:addstudents(sid.get(),sname.get(),ssex.get(),saddress.get(),schina.get(),smath. TypeError: 'Button' object is not callable的错误

#include "hmi_coffee_main_page.h" #include <src/core/lv_obj.h> #include <src/core/lv_obj_pos.h> #include <src/core/lv_obj_style_gen.h> #include <src/display/lv_display.h> #include <src/misc/lv_area.h> #include <src/misc/lv_palette.h> #include <src/widgets/image/lv_image.h> #include <string.h> #include "hmi_make_coffee_page.h" #include "stdio.h" #include "main/src/image/image.h" #include "main/src/fonts/font.h" HMI_REGISTER_PAGE(hmi_coffee_main_page,COFFE_MAIN_PAGE) // 声明 DECLARE_PAGE(hmi_make_coffee_page); extern hmi_coffee_main_page_t hmi_coffee_main_page; extern const lv_img_dsc_t *hot_coffe_types_big_image[]; extern const char *hot_coffe_types_name[]; extern const lv_img_dsc_t *cold_coffe_types_big_image[]; extern const char *cold_coffe_types_name[]; int hot_drink_count(void); int cold_drink_count(void); static void hot_drink_selected_cb(lv_event_t *e); #define LIST_ITEM_HEIGHT 303 // 定义列表项高度 #define LIST_ITEM_WIDTH 230 // 定义列表项宽度 #define LIST_NUM 14 // 定义列表项数量(与图片数组长度一致) #define LIST_HEIGHT 303 // 定义列表高度 #define LIST_WIDTH 1280 // 定义列表宽度 typedef struct { const lv_img_dsc_t* img; const char* name; } coffee_transfer_info_t; /**************************************************/ // 页面独有的方法 /**************************************************/ // 用于跟踪当前是热饮还是冷饮列表 static bool hot_lable_event = true; // 饮品点击事件处理函数 static void drink_item_click_handler(lv_event_t *e) { coffee_transfer_info_t *data = lv_event_get_user_data(e); // 跳转到制作咖啡页面并传递数据 page_manager_go_to(INSTANCE_PAGE(hmi_make_coffee_page), data); } static lv_obj_t *create_hot_list_item(lv_obj_t *list, const lv_img_dsc_t *img_src, const char *text, int index) { // 创建列表项 lv_obj_t *item = lv_obj_create(list); // 设置列表项的宽度和高度 lv_obj_set_size(item, LIST_ITEM_WIDTH, LIST_ITEM_HEIGHT); // 设置列表项的样式 lv_obj_set_style_bg_opa(item, 0, 0);// 设置背景透明 lv_obj_set_style_bg_color(item, lv_color_hex(0xff0000), 0); // 设置背景颜色为红色 lv_obj_set_style_border_width(item, 0, 0); // 设置边框宽度为0 //lv_obj_align(item,LV_ALIGN_TOP_MID, 0, 0); lv_obj_set_scroll_dir(item, LV_DIR_NONE);// 设置列表项的滚动方向为无 lv_obj_remove_style(item, NULL, LV_PART_SCROLLBAR);// 移除列表滚动条样式 if (img_src != NULL) { // 创建图片对象 lv_obj_t *image = lv_image_create(item); // 设置图片源 lv_image_set_src(image, img_src); // 设置图片对齐方式为底部中间 lv_obj_align(image, LV_ALIGN_BOTTOM_MID, 0, -40); // 创建按钮对象 lv_obj_t *button = lv_obj_create(item); // 设置按钮的大小和位置 lv_obj_set_size(button, LIST_ITEM_WIDTH, LIST_ITEM_HEIGHT); // 设置按钮背景透明 lv_obj_set_style_bg_opa(button, 0, 0); // 设置按钮边框宽度为0 lv_obj_set_style_border_width(button, 0, 0); // 设置按钮圆角为0 lv_obj_set_style_radius(button, 0, 0); // 设置按钮对齐方式为底部中间 lv_obj_align(button, LV_ALIGN_BOTTOM_MID, 0, -40); // 为按钮添加用户数据 /*coffee_transfer_info_t *data = lv_mem_alloc(sizeof(coffee_transfer_info_t)); data->img = img_src; data->name = text; lv_obj_add_event_cb(button, drink_item_click_handler, LV_EVENT_CLICKED, data);*/ // 创建标签文本 lv_obj_t *name = lv_label_create(item); // 设置标签的字体 lv_obj_set_style_text_font(name, &SourceHan_Sans_SC_regular_26, 0); // 设置标签的颜色 lv_obj_set_style_text_color(name, lv_color_hex(0xffffff), 0); // 设置标签文本 lv_label_set_text(name, text); // 设置标签对齐方式为底部中间 lv_obj_align(name, LV_ALIGN_BOTTOM_MID, 0, 0); } return item; } static void hot_drink_selected_cb(lv_event_t *e) { // 获取用户传递的索引(通过user_data) int *index_ptr = lv_event_get_user_data(e); int index = *index_ptr; /*/ 构造传递给制作页面的参数 coffee_transfer_info_t info = { .coffee_image = hot_coffe_types_big_image[index], // 当前热饮的图片 .coffee_name = hot_coffe_types_name[index] // 当前热饮的名称 }; // 跳转到咖啡制作页面,并传递参数 page_manager_go_to(INSTANCE_PAGE(hmi_make_coffee_page), &info);*/ } static lv_obj_t *create_cold_list_item(lv_obj_t *list, const lv_img_dsc_t *img_src, const char *text) { // 创建列表项 lv_obj_t *item = lv_obj_create(list); // 设置列表项的宽度和高度 lv_obj_set_size(item, LIST_ITEM_WIDTH, LIST_ITEM_HEIGHT); // 设置列表项的样式 lv_obj_set_style_bg_opa(item, 0, 0);// 设置背景透明 lv_obj_set_style_bg_color(item, lv_color_hex(0xff0000), 0); // 设置背景颜色为红色 lv_obj_set_style_border_width(item, 0, 0); // 设置边框宽度为0 //lv_obj_align(item,LV_ALIGN_TOP_MID, 0, 0); lv_obj_set_scroll_dir(item, LV_DIR_NONE);// 设置列表项的滚动方向为无 lv_obj_remove_style(item, NULL, LV_PART_SCROLLBAR);// 移除列表滚动条样式 if (img_src != NULL) { // 创建图片对象 lv_obj_t *image = lv_image_create(item); // 设置图片源 lv_image_set_src(image, img_src); // 设置图片对齐方式为底部中间 lv_obj_align(image, LV_ALIGN_BOTTOM_MID, 0, -40); // 创建按钮对象 lv_obj_t *button = lv_obj_create(item); // 设置按钮的大小和位置 lv_obj_set_size(button, LIST_ITEM_WIDTH, LIST_ITEM_HEIGHT); // 设置按钮背景透明 lv_obj_set_style_bg_opa(button, 0, 0); // 设置按钮边框宽度为0 lv_obj_set_style_border_width(button, 0, 0); // 设置按钮圆角为0 lv_obj_set_style_radius(button, 0, 0); // 设置按钮对齐方式为底部中间 lv_obj_align(button, LV_ALIGN_BOTTOM_MID, 0, -40); // 创建标签文本 lv_obj_t *name = lv_label_create(item); // 设置标签的字体 lv_obj_set_style_text_font(name, &SourceHan_Sans_SC_regular_26, 0); // 设置标签的颜色 lv_obj_set_style_text_color(name, lv_color_hex(0xffffff), 0); // 设置标签文本 lv_label_set_text(name, text); // 设置标签对齐方式为底部中间 lv_obj_align(name, LV_ALIGN_BOTTOM_MID, 0, 0); } return item; } static void create_hot_drinks() { // 添加列表项,显示图片 for (int i = 0; i < hot_drink_count(); i++) { if (hot_coffe_types_big_image[i] != NULL) { create_hot_list_item(hmi_coffee_main_page.coffee_main_list, hot_coffe_types_big_image[i], hot_coffe_types_name[i],i); } } } static void create_cold_drinks() { // 添加列表项,显示图片 for (int i = 0; i < cold_drink_count(); i++) { if (cold_coffe_types_big_image[i] != NULL) { create_cold_list_item(hmi_coffee_main_page.coffee_main_list, cold_coffe_types_big_image[i], cold_coffe_types_name[i]); } } } static void hmi_coffee_main_page_hot_or_cold_label_event(lv_event_t *e) { lv_obj_t *obj = lv_event_get_target(e); // 重置文本颜色 lv_obj_set_style_text_color(hmi_coffee_main_page.coffee_main_hot_text, lv_color_hex(0xFFFFFF), 0); lv_obj_set_style_text_color(hmi_coffee_main_page.coffee_main_cold_text, lv_color_hex(0xFFFFFF), 0); if (obj == hmi_coffee_main_page.coffee_main_cold_text) { lv_obj_set_style_text_color(hmi_coffee_main_page.coffee_main_cold_text, lv_color_hex(0xE9BD85), 0); } else if (obj == hmi_coffee_main_page.coffee_main_hot_text) { lv_obj_set_style_text_color(hmi_coffee_main_page.coffee_main_hot_text, lv_color_hex(0xE9BD85), 0); } if (obj == hmi_coffee_main_page.coffee_main_hot_text) { // 删除冷饮项并创建热饮项 if (!hot_lable_event) { // 删除所有子对象 lv_obj_clean(hmi_coffee_main_page.coffee_main_list); create_hot_drinks(); hot_lable_event = true; } } else if (obj == hmi_coffee_main_page.coffee_main_cold_text) { // 删除热饮项并创建冷饮项 if (hot_lable_event) { // 删除所有子对象 lv_obj_clean(hmi_coffee_main_page.coffee_main_list); create_cold_drinks(); hot_lable_event = false; } } } // 滚动结束事件回调函数,实现吸附功能 static void list_scroll_end_event_cb(lv_event_t * e) { lv_obj_t * list = lv_event_get_target(e); lv_coord_t scroll_x = lv_obj_get_scroll_x(list); // 水平滚动,获取 x 轴滚动位置 lv_obj_t * first_item = lv_obj_get_child(list, 0); // 获取第一个列表项 if (!first_item) return; lv_coord_t item_width = lv_obj_get_width(first_item); // 获取列表项宽度 lv_coord_t pad_column = lv_obj_get_style_pad_column(list, 0); // 获取列间距 // 计算吸附位置 int new_scroll_x = ((scroll_x + item_width / 2 + pad_column / 2) / (item_width + pad_column)) * (item_width + pad_column); // 设置新的滚动位置 lv_obj_scroll_to_x(list, new_scroll_x, LV_ANIM_ON); } /**************************************************/ // 下面是通用方法的实现 /**************************************************/ /* 页面初始化 通用*/ static void page_init() { hmi_coffee_main_page_t *page = &hmi_coffee_main_page; // 创建屏幕 page->base.screen = lv_obj_create(NULL); // 移除列表滚动条样式 lv_obj_remove_style(page->base.screen, NULL, LV_PART_SCROLLBAR); // 禁用列表滚动功能 lv_obj_clear_flag(page->base.screen, LV_OBJ_FLAG_SCROLLABLE); // 设置背景图片 page->hmi_coffee_main_page_bg = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_bg, &hmi_coffee_main_page_bg); lv_obj_align(page->hmi_coffee_main_page_bg, LV_ALIGN_CENTER, 0,0); // 创建列表 page->coffee_main_list = lv_obj_create(page->base.screen); // 设置列表的宽度和高度 lv_obj_set_size(page->coffee_main_list, LIST_WIDTH, LIST_HEIGHT); // 设置列表背景透明 lv_obj_set_style_bg_opa(page->coffee_main_list, 0, 0); // 设置列表边框宽度为 0 lv_obj_set_style_border_width(page->coffee_main_list, 0, 0); // 设置列表对齐方式 lv_obj_align(page->coffee_main_list, LV_ALIGN_TOP_LEFT, 0, 54); // 移除列表滚动条样式 lv_obj_remove_style(page->coffee_main_list, NULL, LV_PART_SCROLLBAR); // 禁用列表弹性滚动 lv_obj_clear_flag(page->coffee_main_list, LV_OBJ_FLAG_SCROLL_ELASTIC); // 设置列表滚动方向为水平 lv_obj_set_scroll_dir(page->coffee_main_list, LV_DIR_HOR); // 设置列表的布局方式为水平布局 lv_obj_set_flex_flow(page->coffee_main_list, LV_FLEX_FLOW_ROW); // 设置列表的间距 lv_obj_set_style_pad_column(page->coffee_main_list, 20, 0); // 添加滚动结束事件回调 lv_obj_add_event_cb(page->coffee_main_list, list_scroll_end_event_cb, LV_EVENT_SCROLL_END, NULL); page->coffee_main_hot_text = lv_label_create(page->base.screen); lv_label_set_text(page->coffee_main_hot_text, "热饮"); lv_obj_add_flag(page->coffee_main_hot_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->coffee_main_hot_text, lv_color_hex(0xE9BD85), 0); lv_obj_set_style_text_font(page->coffee_main_hot_text, &SourceHan_Sans_SC_regular_26, 0); lv_obj_set_size(page->coffee_main_hot_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->coffee_main_hot_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->coffee_main_hot_text, LV_ALIGN_TOP_LEFT, 516, 34); lv_obj_add_event_cb(page->coffee_main_hot_text, hmi_coffee_main_page_hot_or_cold_label_event,LV_EVENT_CLICKED, NULL); create_hot_drinks(); page->coffee_main_cold_text = lv_label_create(page->base.screen); lv_label_set_text(page->coffee_main_cold_text, "冷饮"); lv_obj_add_flag(page->coffee_main_cold_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->coffee_main_cold_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->coffee_main_cold_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->coffee_main_cold_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->coffee_main_cold_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->coffee_main_cold_text, LV_ALIGN_TOP_LEFT, 712, 34); lv_obj_add_event_cb(page->coffee_main_cold_text, hmi_coffee_main_page_hot_or_cold_label_event,LV_EVENT_CLICKED, NULL); //锁屏 page->hmi_coffee_main_page_lock_icon = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_lock_icon, &hmi_coffee_main_page_lock); lv_obj_align(page->hmi_coffee_main_page_lock_icon, LV_ALIGN_TOP_LEFT, 78, 417); page->hmi_coffee_main_page_lock_text = lv_label_create(page->base.screen); lv_label_set_text(page->hmi_coffee_main_page_lock_text, "童锁"); lv_obj_add_flag(page->hmi_coffee_main_page_lock_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->hmi_coffee_main_page_lock_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->hmi_coffee_main_page_lock_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->hmi_coffee_main_page_lock_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->hmi_coffee_main_page_lock_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->hmi_coffee_main_page_lock_text, LV_ALIGN_TOP_LEFT, 126, 417); //用户 page->hmi_coffee_main_page_user_icon = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_user_icon, &hmi_coffee_main_page_user); lv_obj_align(page->hmi_coffee_main_page_user_icon, LV_ALIGN_TOP_LEFT, 330, 417); page->hmi_coffee_main_page_user_text = lv_label_create(page->base.screen); lv_label_set_text(page->hmi_coffee_main_page_user_text, "用户"); lv_obj_add_flag(page->hmi_coffee_main_page_user_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->hmi_coffee_main_page_user_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->hmi_coffee_main_page_user_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->hmi_coffee_main_page_user_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->hmi_coffee_main_page_user_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->hmi_coffee_main_page_user_text, LV_ALIGN_TOP_LEFT, 385, 417); //设置 page->hmi_coffee_main_page_setting_icon = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_setting_icon, &hmi_coffee_main_page_setting); lv_obj_align(page->hmi_coffee_main_page_setting_icon, LV_ALIGN_TOP_LEFT, 588, 417); page->hmi_coffee_main_page_setting_text = lv_label_create(page->base.screen); lv_label_set_text(page->hmi_coffee_main_page_setting_text, "设置"); lv_obj_add_flag(page->hmi_coffee_main_page_setting_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->hmi_coffee_main_page_setting_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->hmi_coffee_main_page_setting_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->hmi_coffee_main_page_setting_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->hmi_coffee_main_page_setting_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->hmi_coffee_main_page_setting_text, LV_ALIGN_TOP_LEFT, 640, 417); //收藏 page->hmi_coffee_main_page_collection_icon = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_collection_icon, &hmi_coffee_main_page_collection); lv_obj_align(page->hmi_coffee_main_page_collection_icon, LV_ALIGN_TOP_LEFT, 842, 417); page->hmi_coffee_main_page_collection_text = lv_label_create(page->base.screen); lv_label_set_text(page->hmi_coffee_main_page_collection_text, "收藏"); lv_obj_add_flag(page->hmi_coffee_main_page_collection_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->hmi_coffee_main_page_collection_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->hmi_coffee_main_page_collection_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->hmi_coffee_main_page_collection_text, 52, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->hmi_coffee_main_page_collection_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->hmi_coffee_main_page_collection_text, LV_ALIGN_TOP_LEFT, 898, 417); //快速冲洗 page->hmi_coffee_main_page_fast_rinse_icon = lv_image_create(page->base.screen); lv_image_set_src(page->hmi_coffee_main_page_fast_rinse_icon, &hmi_coffee_main_page_fast_rinse); lv_obj_align(page->hmi_coffee_main_page_fast_rinse_icon, LV_ALIGN_TOP_LEFT, 1072, 417); page->hmi_coffee_main_page_fast_rinse_text = lv_label_create(page->base.screen); lv_label_set_text(page->hmi_coffee_main_page_fast_rinse_text, "快速冲洗"); lv_obj_add_flag(page->hmi_coffee_main_page_fast_rinse_text, LV_OBJ_FLAG_CLICKABLE); // 确保能点击到,不然点不到文字 lv_obj_set_style_text_color(page->hmi_coffee_main_page_fast_rinse_text, lv_color_hex(0xffffff), 0); //设置字体颜色 lv_obj_set_style_text_font(page->hmi_coffee_main_page_fast_rinse_text, &SourceHan_Sans_SC_regular_26, 0);//设置字体 lv_obj_set_size(page->hmi_coffee_main_page_fast_rinse_text, 104, 33); // 设置标签宽度和高度 lv_obj_set_style_text_align(page->hmi_coffee_main_page_fast_rinse_text, LV_TEXT_ALIGN_CENTER, 0); // 添加文字居中对齐 lv_obj_align(page->hmi_coffee_main_page_fast_rinse_text, LV_ALIGN_TOP_LEFT, 1127, 417); } /* 页面进入 通用*/ static void page_enter(void *args) {} /* 页面退出 通用*/ static void page_exit() {} /* 页面销毁 通用*/ static void page_destroy(void) {} /* 主页面update实现 */ static void page_update(const hmi_global_data_t *data) {}

在以下的代码中那哪些部分需要替换为实际路径:import os from scipy.io import loadmat import pandas as pd import tables import numpy as np class Paderborn: """"" 读取帕德博恩数据集数据 传入文件所在地址,设置了一个.select_label方法,可以只选择需要的故障 """ def __init__(self,root_dir): self.root_dir=root_dir #帕德博恩数据集载入,输入文件位置,返回值为以电流/振动数据数组为元素的列表和试验代号列表 current_list=[] # 电流信号 vibration_list=[] # 振动信号 name_list=[] # 文件名字暂存 lable=[] # 故障类型暂存,单词写错了,懒得改了 for dirpath, dirnames, filenames in os.walk(self.root_dir): for filename in filenames: try: if filename.endswith('.mat'): mat_file_path=os.path.join(dirpath, filename) # 文件路径+文件名,生成完整路径 mat_file = loadmat(mat_file_path,struct_as_record=False, squeeze_me=True) mat_file_keys=list(mat_file.keys()) # 获取数据名称 name=mat_file_keys[-1] Y_struct = mat_file[name] # 获取名为'Y'的struct data0=Y_struct.Y[1].Data # 获取第二行名为Data的numoy数组,为电流信号 data1=Y_struct.Y[-1].Data # 获取最后一行名为Data的numpy数组,为振动信号 #写入列表 current_list.append(data0[0:255960])#总长255960 vibration_list.append(data1[0:255960]) name_list.append(mat_file_path) except: print('Error') continue for i in name_list: #人工实验部分 if 'KA01' in i: #外圈人工点蚀(EDM) lable.append(0) elif 'KA03' in i or'KA05' in i or 'KA06' in i : # 外圈人工雕刻 lable.append(1) elif 'KA07' in i or 'KA08' in i or 'KA09' in i : #外圈人工钻孔 lable.append(2) elif 'KI01' in i : #内圈人工点蚀 lable.append(3) elif 'KI03' in i or 'KI05' in i or 'KI07' in i or 'KI08' in i : #内圈人工雕刻 lable.append(4)

<template> <template v-if="companyInfo.companyCode"> <a-spin :spinning="isLoading" :delay="500" :tip="$t('加载中...')"> {{ $t('预案是否启用') }} <a-radio-group v-model="formData.enabled" :default-value="1"> <a-radio :value="1">{{ $t('启用') }}</a-radio> <a-radio :value="0">{{ $t('禁用') }}</a-radio> </a-radio-group> {{ $t('报警类型:') }} <a-select collapseTags mode="multiple" :maxTagCount="2" v-model="formData.type" allowClear placeholder="请选择" optionFilterProp="label" > <a-select-option v-for="(item, index) in typeOptions" :value="item.value" :key="index"> {{ item.label }} </a-select-option> </a-select> {{ $t('工单派发配置:') }} <a-table rowKey="department" :columns="columns" :dataSource="optimizedTableData" :scroll="{ x: '100%' }" :pagination="false" > <template slot="staff" slot-scope="text, record"> <a-select v-model="record.staffConfig" mode="multiple" placeholder="选择人员" optionFilterProp="label" :maxTagCount="2" allowClear @change="val => handleStaffChange(val, record)" > <a-select-option v-for="person in record.availableStaff" :key="person.id" :label="person.name" :value="person.id" > {{ person.name }} </a-select-option> </a-select> </template> <template slot="time" slot-scope="text, record"> <a-select v-model="record.timeConfig" @change="val => (record.timeConfig = val)" placeholder="选择期望完成时间" > <a-select-option v-for="option in timeOptions" :key="option.value" :value="option.value"> {{ option.label }} </a-select-option> </a-select> </template> </a-table> <a-button @click="onSave" type="primary">{{ $t('确定') }}</a-button> <a-button @click="onCancel" type="normal">{{ $t('取消') }}</a-button> </a-spin> </template> </template> <script> export default { props: { orgInfo: { type: Object, default: () => { return {}; }, }, companyInfo: { type: Object, default: () => { return {}; }, }, }, data() { return { isLoading: false, formData: {}, typeOptions: [ { label: '选项1', value: 1, }, { label: '选项2', value: 2, }, { label: '选项3', value: 3, }, { label: '选项4', value: 4, }, ], columns: [ { title: '部门', key: 'department', dataIndex: 'department', ellipsis: true, }, { title: '用户', dataIndex: 'staff', scopedSlots: { customRender: 'staff' }, key: 'staff', }, { title: '期望完成时间设定', dataIndex: 'time', scopedSlots: { customRender: 'time' }, key: 'time', }, ], tableList: [ { department: '技术部', staffConfig: ['001', '002'], timeConfig: '24h' }, { department: '运维部', staffConfig: ['003'], timeConfig: '48h' }, { department: '安全部', staffConfig: [], timeConfig: '7d' }, { department: '网络部', staffConfig: [], timeConfig: '24h' }, { department: '数据库部', staffConfig: [], timeConfig: '12h' }, ], timeOptions: [ { label: '报警后12小时', value: '12h' }, { label: '报警后24小时', value: '24h' }, { label: '报警后48小时', value: '48h' }, { label: '报警后7日内', value: '7d' }, ], staffList: [ { id: '001', name: '张三' }, { id: '002', name: '李四' }, { id: '003', name: '王五' }, { id: '004', name: '赵六' }, ], }; }, computed: { optimizedTableData() { // 收集所有被选中的用户ID const allSelected = new Set(); this.tableList.forEach(row => { if (Array.isArray(row.staffConfig)) { row.staffConfig.forEach(id => allSelected.add(id)); } }); // 为每行生成可用人员列表 return this.tableList.map(row => { const currentSelected = row.staffConfig ? new Set(row.staffConfig) : new Set(); const availableStaff = this.staffList.filter( person => !allSelected.has(person.id) || currentSelected.has(person.id) ); return { ...row, availableStaff, // 添加可用人员列表 }; }); }, }, mounted() {}, methods: { handleStaffChange(value, row) { // 人员只能选择两位 if (value && value.length > 2) { this.$message.destroy(); this.$message.warning('人员最多选择2位'); value = value.slice(0, 2); } row.staffConfig = value; }, // 确定 onSave() { console.log('保存的数据:', { tableList: this.tableList, }); }, // 取消 onCancel() {}, }, }; </script> <style lang="less" scoped> .alarm-work-order { height: 100%; width: 100%; position: relative; box-sizing: border-box; .edit-view { width: 100%; padding: 46px 32px 24px 32px; .input-item { width: 100%; display: flex; margin-bottom: 22px; &:last-child { margin-bottom: 0 !important; } } .input-lable { width: 88px; min-width: 88px; justify-content: start; display: flex; color: #808e9d; font-size: 14px; line-height: 19px; margin-right: 24px; span { white-space: nowrap; } } .text-bold { font-weight: bold; color: #4e5c6b; } .text-align { align-items: center; } .btn-view { display: flex; align-items: center; justify-content: flex-start; padding-left: 112px; margin-top: 24px; & > button { margin-right: 12px; } } } } </style> 下拉数据无法改变

最新推荐

recommend-type

基于等式约束的车辆纵向动力学模型预测控制及其Matlab数值仿真实验研究 指南

内容概要:本文探讨了车辆纵向动力学模型预测控制,特别是引入等式约束条件下的实现方法,并通过Matlab数值仿真实验验证了其有效性和优越性。文章首先介绍了车辆纵向动力学模型的基本概念,包括牵引力、空气阻力、轮胎与地面的摩擦力等因素对车辆速度的影响。接着详细阐述了预测控制算法的工作原理,即通过优化算法寻找最佳的牵引力和制动力,以实现最佳行驶效果。最后展示了Matlab数值仿真实验的具体步骤和结果,对比了不同控制策略的性能,证明了基于模型的预测控制策略在复杂道路和交通环境下具有更高的准确性和鲁棒性。 适合人群:从事汽车工程、自动化控制领域的研究人员和技术人员,尤其是关注车辆动力学建模和预测控制算法的人士。 使用场景及目标:适用于希望深入了解车辆纵向动力学模型预测控制理论并掌握其实现方法的研究人员和技术人员。目标是提高车辆的安全性、节能性和驾驶辅助系统的智能化水平。 阅读建议:读者可以重点关注等式约束条件下的预测控制算法设计思路,以及Matlab数值仿真实验的设计和结果分析部分,以便更好地理解和应用这一先进技术。
recommend-type

基于React框架构建的现代化前端Web应用程序开发模板_包含完整开发环境配置和构建工具链_用于快速启动React项目开发_支持热重载和自动化测试_集成Webpack和Babel构.zip

基于React框架构建的现代化前端Web应用程序开发模板_包含完整开发环境配置和构建工具链_用于快速启动React项目开发_支持热重载和自动化测试_集成Webpack和Babel构.zip
recommend-type

【业余无线电】FT8jtdx-2.2.158 石家庄业余无线电俱乐部 定制版-win32

【业余无线电】【FT8】jtdx-2.2.158 石家庄业余无线电俱乐部 定制版-win32
recommend-type

langchain4j-community-redis-spring-boot-starter-1.0.1-beta6.jar中文文档.zip

1、压缩文件中包含: 中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。 2、使用方法: 解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。 3、特殊说明: (1)本文档为人性化翻译,精心制作,请放心使用; (2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; (3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 4、温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。 5、本文件关键字: jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。
recommend-type

MATLAB复现凝固相场模拟及多元合金各向异性枝晶生长的实践——激光增材制造、选区激光熔融等场景下凝固模型的集成应用

MATLAB在实现凝固相场模拟中的应用,涵盖了纯物质及合金凝固模型、各向异性枝晶生长、激光增材制造、选择性激光熔融(SLM)等多场景。相场模拟作为一种定量分析材料行为的方法,通过数值计算模拟材料的相场分布,研究材料的凝固过程、微观组织结构等。文章还展示了MATLAB复现ACTA文章核心模拟的部分,包括选材与工艺、相场模拟实现、结果分析及其应用与展望。 适合人群:材料科学家、增材制造工程师、冶金工程师、研究人员和技术爱好者。 使用场景及目标:适用于需要理解和优化合金凝固过程的研究人员和技术人员,特别是在3D打印、增材制造、焊接熔池、定向凝固等领域。目标是帮助读者掌握MATLAB在相场模拟中的具体应用,提高对合金凝固行为的理解和预测能力。 其他说明:文章不仅提供了理论背景,还包括了具体的MATLAB代码实现步骤和实际案例分析,使读者能够在实践中更好地应用这些知识。
recommend-type

Python打造的Slaee管理系统升级版发布

由于提供的文件信息中,文件名《基于python的slaee管理系统 (15).zip》与描述《基于python的slaee管理系统 (15).zip》相同,并且给出的压缩包文件名称列表中只有一个文件《基于python的slaee管理系统 (14).zip》,该信息表明我们正在讨论两个不同版本的Python系统管理软件的压缩包。以下知识点将根据这些信息详细展开: 知识点一:Python编程语言基础 Python是一种高级编程语言,以其简洁的语法和强大的库支持而闻名。它是解释型语言,具有动态类型系统和垃圾回收功能,适用于多种编程范式,包括面向对象、命令式、函数式和过程式编程。Python广泛应用于系统管理、网络服务器、开发脚本、科学计算、数据挖掘和人工智能等领域。 知识点二:系统管理相关知识 系统管理指的是对计算机系统进行配置、监控和维护的过程,包括硬件资源、软件资源和数据资源的管理。在Python中,系统管理通常涉及操作系统级别的任务,如进程管理、文件系统管理、网络配置、系统日志监控等。Python的系统管理库(例如psutil、fabric、paramiko等)提供了丰富的API来简化这些任务。 知识点三:项目版本控制 从文件名《基于python的slaee管理系统 (14).zip》和《基于python的slaee管理系统 (15).zip》可以看出,这是一个项目在不同版本之间的迭代。版本控制是一种记录一个或多个文件随时间变化的方式,它允许用户可以回到特定版本。在软件开发中,版本控制非常重要,它有助于团队协作、代码合并、分支管理和错误跟踪。常见的版本控制系统包括Git、Subversion (SVN)、Mercurial等。 知识点四:打包与部署 提到“压缩包子文件”,这通常意味着文件已经被压缩打包成一个ZIP文件。在软件开发中,打包是为了便于文件传输、存档保存和分发。在Python项目中,打包也是部署过程的一部分。一个Python项目通常需要包含源代码、依赖关系、配置文件和安装脚本等。打包成ZIP文件后,可以通过各种方式部署到服务器上运行,如使用Fabric或Ansible等自动化部署工具。 知识点五:项目命名及版本命名规则 文件命名中的“基于python的slaee管理系统”表明这是一个与Python语言相关的系统管理项目。而数字“15”和“14”则代表着项目的版本号,这表明项目在持续发展,不同的数字代表了项目在不同时期的迭代。版本号的命名规则通常遵循语义化版本控制(SemVer),这种版本控制系统以 MAJOR.MINOR.PATCH 的形式表示版本号。 知识点六:文件压缩与解压缩技术 ZIP是一种常用的文件压缩格式,它通过减少文件大小来提高存储效率和传输速度。ZIP文件通常是无损压缩,意味着文件在压缩和解压缩的过程中不会丢失信息。Python标准库提供了zipfile模块,允许用户在Python程序中创建ZIP文件、读取ZIP文件内容、提取ZIP文件中的文件等操作。用户可以使用各种图形界面工具(如WinRAR、7-Zip)或命令行工具来处理ZIP文件。 总结以上内容,从文件信息中我们可以得知该内容涉及了Python编程语言、系统管理知识、版本控制、打包与部署、命名规则以及文件压缩技术等多方面的知识点。这些知识点对于理解和应用Python进行系统管理软件开发以及软件的版本迭代、打包与部署均具有重要意义。
recommend-type

深入解析PCB走线传输延时:关键因素与实用公式

# 1. PCB走线传输延时基础 在电子工程领域,尤其是在印刷电路板(PCB)设计中,走线传输延时是一个不可忽视的重要概念。传输延时主要指的是电信号通过PCB上的导电路径从源头传送到目的地所耗费的时间。本章将介绍PCB走线传输延时的基础知识点,为后续章节的深入探讨打下坚实的基础。 首先,了解什么是传输延时是至关重要的。简单来说,它反
recommend-type

gpio很弱是什么意思

<think>嗯,用户的问题是关于GPIO信号弱的概念及其影响。用户似乎对硬件或嵌入式系统有一定了解,但需要更深入的解释。从用户提到的"信号弱"来看,ta可能遇到了实际电路设计中的驱动能力问题,或者在学习GPIO原理时遇到了术语困惑。 用户引用了四篇资料,其中提到GPIO的模拟输入输出模式、施密特触发器的作用、上拉下拉电阻的配置,以及信号线串联电阻的作用。这些内容都与GPIO的驱动能力和信号质量相关。特别是引用[4]中提到的"信号线串联小电阻"和"低频电路不考虑反射",暗示用户可能正在处理实际电路中的信号完整性问题。 用户真正想知道的可能是:为什么我的GPIO输出无法正确驱动某个设备?或者
recommend-type

Python打造的Slaee管理系统升级版发布

标题中的“基于python的slaee管理系统”表明这是一个使用Python编程语言开发的系统。Python是一种广泛使用的高级编程语言,以其易读性和简洁的语法而闻名。SLAEE管理系统可能是指一个特定类型的管理软件,但由于没有给出缩写的完整解释,我们可以假设SLAEE可能是某机构或系统名称的缩写。 从标题和描述来看,存在一处笔误:“基于python的slaee管理系统 (19).zip”和“基于python的slaee管理系统 (18).zip”所指的似乎是同一软件系统,只是版本号不同。根据文件名称列表中的两个文件名,可以推断系统至少有两个版本,一个是版本18,一个是版本19。通常情况下,版本号的增加表示软件进行了更新或改进。 接下来,根据这些信息,我们可以阐述一些相关的知识点: 1. Python编程基础:Python是一种解释型、面向对象、高级编程语言。Python支持多种编程范式,包括过程式、面向对象和函数式编程。Python由于其简洁和易于学习的特性,被广泛应用于网络开发、数据分析、人工智能、机器学习和科学计算等领域。 2. 文件压缩与打包:文件压缩是将文件的大小减小以节省存储空间或网络传输时间的技术。常见的文件压缩格式包括ZIP、RAR、7Z等。文件打包通常指的是将多个文件或文件夹压缩成一个单独的文件。这在数据备份、软件分发和档案管理中非常常见。 3. 版本控制:在软件开发中,“版本”通常指软件的特定状态,版本号则用来标识这些状态。版本控制是一种记录文件、目录或集合随着时间变化的方式,以便将来可以检索特定版本。对于软件项目来说,版本控制是至关重要的,它不仅允许开发者追踪和管理代码的变化,而且还能帮助团队协作,解决冲突,并回滚到旧版本。 4. 软件管理系统的开发:一个软件管理系统可能是针对特定业务领域而设计的,它可能包括用户界面、数据库管理、业务逻辑处理、报告生成和其他许多功能。软件管理系统的开发通常涉及需求分析、系统设计、编程、测试和维护等多个阶段。 5. Python在软件开发中的应用:Python因为具有丰富的库和框架,被广泛用于开发各种类型的软件。例如,Django和Flask是用于Web开发的流行Python框架;而对于数据分析和数据科学任务,Pandas、NumPy和Matplotlib等库提供了强大的数据处理和可视化工具;对于机器学习和人工智能,TensorFlow、PyTorch等库使得复杂算法的实现变得更为简单。 6. 系统更新与维护:随着软件的使用和发展,需求可能会变化,新的问题可能会出现,所以软件系统需要定期进行更新和维护。软件更新可能包括修复已知问题、改进现有功能、增加新功能或优化性能。开发者需要评估是否需要为修复安全漏洞或提高系统性能而更新系统,以及更新之后对用户体验的影响。 由于文件名中只提到了“基于python的slaee管理系统”,没有提供该系统具体功能的详细描述,我们无法提供更加具体的技术知识点。如果需要分析系统的工作原理或具体的技术实现细节,还需要更多的信息。
recommend-type

【Keil-ARM编程艺术】:如何编写可维护且高效的代码

# 摘要 本文旨在为读者提供ARM微控制器编程和Keil开发环境的全面指南。第一章概览了ARM微控制