From b1f0a54c46e030378eaa24a35878af67c7eff608 Mon Sep 17 00:00:00 2001 From: 苏由福 <540433531@qq.com> Date: Mon, 4 Jan 2021 10:39:57 +0800 Subject: [PATCH] 小程序合并 --- components/diy_scan/diy_scan.js | 40 ++++++++++++++++++++++++++++++++++++++++ components/diy_scan/diy_scan.json | 3 +++ components/diy_scan/diy_scan.wxml | 7 +++++++ components/diy_scan/diy_scan.wxss | 7 +++++++ 4 files changed, 57 insertions(+), 0 deletions(-) create mode 100644 components/diy_scan/diy_scan.js create mode 100644 components/diy_scan/diy_scan.json create mode 100644 components/diy_scan/diy_scan.wxml create mode 100644 components/diy_scan/diy_scan.wxss diff --git a/components/diy_scan/diy_scan.js b/components/diy_scan/diy_scan.js new file mode 100644 index 0000000..8abf39e --- /dev/null +++ b/components/diy_scan/diy_scan.js @@ -0,0 +1,40 @@ +Component({ + properties: { + object: { + type: Object, + value: null + }, + // 这里定义了innerText属性,属性值可以在组件使用时指定 + }, + data: { + // 这里是一些组件内部数据 + someData: {}, + left:getApp().globalData.windowWidth-50, + top:200, + }, + methods: { + // 这里是一个自定义方法 + customMethod() { }, + //-- 如果触摸移动 -- + setTouchMove:function (e) { + var w=getApp().globalData.windowWidth; + if(e.touches[0].clientX<10 || e.touches[0].clientX>w-50) return false; + if(e.touches[0].clientY<10) return false; + this.setData({left: e.touches[0].clientX,top: e.touches[0].clientY}) + }, + + //-- 扫描成功之后 -- + getScancode:function(){ + var _this = this; + //-- 允许从相机和相册扫码 -- + wx.scanCode({ + success: (res) => { + var result = res.result; + wx.navigateTo({ + url: "/pages/goods/search/search?s_key=" + result, + }); + } + }) + } + } +}) \ No newline at end of file diff --git a/components/diy_scan/diy_scan.json b/components/diy_scan/diy_scan.json new file mode 100644 index 0000000..9e7089c --- /dev/null +++ b/components/diy_scan/diy_scan.json @@ -0,0 +1,3 @@ +{ + "component": true + } \ No newline at end of file diff --git a/components/diy_scan/diy_scan.wxml b/components/diy_scan/diy_scan.wxml new file mode 100644 index 0000000..5717414 --- /dev/null +++ b/components/diy_scan/diy_scan.wxml @@ -0,0 +1,7 @@ + + + + {{object.title}} + + + diff --git a/components/diy_scan/diy_scan.wxss b/components/diy_scan/diy_scan.wxss new file mode 100644 index 0000000..37b8376 --- /dev/null +++ b/components/diy_scan/diy_scan.wxss @@ -0,0 +1,7 @@ +.scan_view{ + position: fixed;z-index: 100; left: 0; top: 0; width: 100rpx; height: 100rpx; + border-radius: 50%; background-color: rgba(125,125,2,0.5);box-shadow: #ccc 0px 0px 70px 1px; + display: flex;align-items: center;justify-content: center; color: #f8f8f8; +} +.cs-img{ width: 32rpx; height: 32rpx; } +.s_title{ font-size: 20rpx;} \ No newline at end of file -- libgit2 0.21.4