diff --git a/common/css/base.scss b/common/css/base.scss index 9da937d..42665a2 100644 --- a/common/css/base.scss +++ b/common/css/base.scss @@ -36,7 +36,11 @@ page { padding-left: #{$i}rpx; } } - +.center{ + display: flex; + align-items: center; + justify-content: center; +} .hide-txt { overflow-x: hidden; white-space: nowrap; diff --git a/pages/device/new.vue b/pages/device/new.vue index a718963..a535f3d 100644 --- a/pages/device/new.vue +++ b/pages/device/new.vue @@ -1,19 +1,97 @@ @@ -23,10 +101,18 @@ export default { return { loading: false, code: '', - type: 1, + type: 2, formData: { address: '', }, + point: { + x: 170, + y: 100, + }, + pointName: '', + pointList: [], + activeGplot: 1, + editIndex: -1, } }, methods: { @@ -52,16 +138,75 @@ export default { } }); }, - submit(){ + chooseGplot () { + this.$refs.gplot.open() + }, + closeDrawer () { + this.pointName = '' + this.point = { + x: 170, + y: 100, + } + this.$refs.gplot.close() + this.$refs.point.close() + }, + add () { + this.$refs.point.open() + }, + addPoint () { + if (!this.pointName) { + this.$util.toast('请输入监测点名称') + return + } + if (this.editIndex > -1) { + this.pointList[this.editIndex] = { + x: this.point.x, + y: this.point.y, + pointName: this.pointName, + } + this.editIndex = -1 + } else { + let arr = this.pointList.filter(item => item.pointName == this.pointName) + if (arr.length > 0) { + this.$util.toast('监测点名称已存在') + return + } + this.pointList.push({ + x: this.point.x, + y: this.point.y, + pointName: this.pointName, + }) + } + console.log(this.pointList); + this.closeDrawer() + }, + deletePoint (index) { + this.pointList.splice(index, 1) + }, + editPoint (index) { + this.editIndex = index + this.point.x = this.pointList[index].x + this.point.y = this.pointList[index].y + this.pointName = this.pointList[index].pointName + this.$refs.point.open() + }, + dragPoint (e) { + console.log(e) + this.point.x = e.detail.x + this.point.y = e.detail.y + }, + submit () { this.$util.toast('提交成功') - uni.navigateBack({ delta: 1 }) + setTimeout(() => { + uni.navigateBack({ delta: 1 }) + }, 1500); }, } } \ No newline at end of file diff --git a/pages/mine/user.vue b/pages/mine/user.vue index 6253f60..1def9ba 100644 --- a/pages/mine/user.vue +++ b/pages/mine/user.vue @@ -5,13 +5,13 @@ @@ -33,6 +33,20 @@ export default { uni.navigateTo({ url: '/pages/mine/userDetail' }) + }, + del () { + console.log('del'); + uni.showModal({ + title: '提示', + content: '确定要移除该成员吗?', + success: function (res) { + if (res.confirm) { + console.log('用户点击确定') + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) } } } diff --git a/static/point.png b/static/point.png new file mode 100644 index 0000000..b373cc0 Binary files /dev/null and b/static/point.png differ diff --git a/uni_modules/uni-drawer/changelog.md b/uni_modules/uni-drawer/changelog.md new file mode 100644 index 0000000..b9e7637 --- /dev/null +++ b/uni_modules/uni-drawer/changelog.md @@ -0,0 +1,13 @@ +## 1.2.1(2021-11-22) +- 修复 vue3中个别scss变量无法找到的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-drawer](https://uniapp.dcloud.io/component/uniui/uni-drawer) +## 1.1.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-05-12) +- 新增 组件示例地址 +## 1.0.6(2021-02-04) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-drawer/components/uni-drawer/keypress.js b/uni_modules/uni-drawer/components/uni-drawer/keypress.js new file mode 100644 index 0000000..16a5818 --- /dev/null +++ b/uni_modules/uni-drawer/components/uni-drawer/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + // this.$once('hook:beforeDestroy', () => { + // document.removeEventListener('keyup', listener) + // }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue b/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue new file mode 100644 index 0000000..5b551e3 --- /dev/null +++ b/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue @@ -0,0 +1,183 @@ + + + + + diff --git a/uni_modules/uni-drawer/package.json b/uni_modules/uni-drawer/package.json new file mode 100644 index 0000000..0bd9cf9 --- /dev/null +++ b/uni_modules/uni-drawer/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-drawer", + "displayName": "uni-drawer 抽屉", + "version": "1.2.1", + "description": "抽屉式导航,用于展示侧滑菜单,侧滑导航。", + "keywords": [ + "uni-ui", + "uniui", + "drawer", + "抽屉", + "侧滑导航" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-drawer/readme.md b/uni_modules/uni-drawer/readme.md new file mode 100644 index 0000000..dcf6e6b --- /dev/null +++ b/uni_modules/uni-drawer/readme.md @@ -0,0 +1,10 @@ + + +## Drawer 抽屉 +> **组件名:uni-drawer** +> 代码块: `uDrawer` + +抽屉侧滑菜单。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-drawer) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file