Commit 780a01e6 authored by DESKTOP-B3ACAM7\huang's avatar DESKTOP-B3ACAM7\huang

'扫描二维码'

parent 70df6407
......@@ -55,7 +55,10 @@ export default [{
"cat": 10
},
{
"fieldsTitle": "连衣裙",
"fieldsTitle": "充电桩编码",
"fieldsName": "scan",
"fieldsType": "scan",
"required": true,
"key": "连衣裙",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/7.jpg",
"cat": 10
......
......@@ -10,7 +10,7 @@
<script>
import objMixin from './objMixin'
export default {
name: 'XhRadio',
name: 'XhLocation',
components: {},
mixins: [objMixin],
props: {},
......
<template>
<view class="">
<view class="u-flex">
请输入:<u-input class="u-flex-1" v-model="dataValue" @input="valueChange" type="text" />
</view>
<view class="u-flex" @click="getScan('')">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<!-- <view class="list u-flex u-row-between">
<text class="required" v-if="item.required">*</text>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1">{{valueTxt || ''}}</view>
<u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">默认按钮</u-button>
</view> -->
</view>
</template>
<script>
import objMixin from './objMixin'
export default {
name: 'XhScan',
components: {},
mixins: [objMixin],
props: {},
filters:{},
data() {
return {}
},
computed: {
valueTxt() {
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1]
}
return str
}
},
watch: {},
mounted() {},
methods: {
getScan(type){
uni.scanCode({
scanType: ['barCode'],
success: function (res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
},
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
self.setValue(dataValue)
},
fail(err) {}
});
},
setValue(txt) {
this.valueChange(this.dataValue)
}
}
}
</script>
<style lang="scss" scoped>
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
</style>
......@@ -48,6 +48,9 @@
<xh-location v-else-if="toLowerCase(item.fieldsType)==='location'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
</xh-location>
<xh-scan v-else-if="toLowerCase(item.fieldsType)==='scan'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
</xh-scan>
</template>
</u-form-item>
</view>
......@@ -67,6 +70,7 @@
import XhSelect from '@/components/createCom/XhSelect.vue'
import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from '@/components/createCom/XhScan.vue'
// import XhRadio from '@/components/createCom/XhRadio.vue'
export default {
data() {
......@@ -120,7 +124,8 @@
XhCheckbox,
XhSelect,
XhFiles,
XhLocation
XhLocation,
XhScan
// formCom
},
created() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment