Commit 2581c2ae authored by Damon's avatar Damon

完工组件&&相机组件修改

parent 5cfa8f92
......@@ -68,7 +68,7 @@ export default [{
"fieldsTitle": "电缆",
"fieldsName": "file",
"fieldsType": "file",
"key": "短裙",
"key": "电缆",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg",
"cat": 10
},
......@@ -76,7 +76,7 @@ export default [{
"fieldsTitle": "管材",
"fieldsName": "file",
"fieldsType": "file",
"key": "短裙",
"key": "管材",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg",
"cat": 10
},
......@@ -98,54 +98,30 @@ export default [{
"icon": "https://cdn.uviewui.com/uview/common/classify/1/7.jpg",
"cat": 10
},
{
"fieldsTitle": "多级选择",
"fieldsName": "mutiPicker",
"fieldsType": "mutipicker",
"required": true,
"key": "妈妈装",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/8.jpg",
"cat": 10
},
{
"fieldsTitle": "时间选择",
"fieldsName": "time",
"fieldsType": "time",
"required": true,
"key": "牛仔裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/9.jpg",
"cat": 10
},
// {
// "fieldsTitle": "多级选择",
// "fieldsName": "mutiPicker",
// "fieldsType": "mutipicker",
// "required": true,
// "key": "妈妈装",
// "icon": "https://cdn.uviewui.com/uview/common/classify/1/8.jpg",
// "cat": 10
// },
// {
// "fieldsTitle": "时间选择",
// "fieldsName": "time",
// "fieldsType": "time",
// "required": true,
// "key": "牛仔裤",
// "icon": "https://cdn.uviewui.com/uview/common/classify/1/9.jpg",
// "cat": 10
// },
{
"fieldsTitle": "备注",
"key": "备注",
"fieldsType": "textarea",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/10.jpg",
"cat": 10
},
{
"fieldsTitle": "休闲裤",
"key": "休闲裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/11.jpg",
"cat": 10
},
{
"fieldsTitle": "雪纺衫",
"key": "雪纺衫",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/12.jpg",
"cat": 10
},
{
"fieldsTitle": "防晒衣",
"key": "防晒衣",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/13.jpg",
"cat": 10
},
{
"fieldsTitle": "礼服/婚纱",
"key": "礼服婚纱",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/14.jpg",
"cat": 10
}
]
},
......
......@@ -29,7 +29,11 @@
name: 'XhFiles',
components: {},
mixins: [objMixin,baseFile],
props: {},
props: {
files: {
type: Array,
}
},
filters:{},
data() {
return {
......@@ -41,7 +45,8 @@
{
text: '拍照'
}
]
],
takeStatus: false,
}
},
computed: {
......@@ -49,7 +54,22 @@
return this.item.settings || []
}
},
watch: {},
watch: {
'takeStatus': function(val, oldVal){
this.$emit('getTakeStatus', {status: val, index: this.itemIndex})
},
'files': { // 处理相机拍照返回的图片
handler (val) {
this.imgList = val.map(v => {
v.path = v.src
return v
})
this.setValue()
},
deep:true,
immediate: true,
}
},
mounted() {},
methods: {
selectUpload(){
......@@ -79,7 +99,7 @@
return
}
// 使用拍照工具拍摄
this.takeStatus = true
},
setValue() {
const dataValue = []
......
......@@ -29,7 +29,7 @@
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1]
str = '经度:'+dataValue[0].toFixed(4)+','+'纬度:'+dataValue[1].toFixed(4)
}
return str
},
......
......@@ -26,7 +26,6 @@
standardId: '',
images: [],
files: [],
fileMaps: [],
keys: [],
token: '',
product: '',
......@@ -74,7 +73,7 @@
})
}
}
photo.allImages.unshift(photo.tempPath.mixWater)
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
......@@ -139,34 +138,16 @@
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.api.saveImage({
"token": self.token,
"standardId": self.standardId,
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
this.$emit('changeType', 1)
}else{
this.$emit('finish')
}
} else {
uni.showToast({
title:'图片上传失败 '+ res.result.msg
})
}
})
}
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
photo.allImages.unshift(this.fileMaps[0])
if(photo.currentItemLength<10){
this.$emit('changeType', 1)
}else{
this.$emit('finish')
}
},
downloadImages() {
......
......@@ -111,7 +111,8 @@
created(e) {
const photo = getApp().globalData.photo
getApp().trackPage('拍照页')
photo.allImages = []
photo.allImages = []
photo.currentItemLength = 0
// this.ctx = uni.createCameraContext();
this.updateTime()
this.getLocation()
......
......@@ -26,8 +26,8 @@
"path": "pages/order/complete",
"style": {
"navigationBarTitleText": "订单-完工配置",
"navigationBarBackgroundColor": "#2272FF",
"navigationBarTextStyle": "white"
"navigationStyle": "custom",
"disableScroll": true
}
},{
"path": "pages/order/feedback",
......
<template>
<view class="u-wrap">
<u-tabs-swiper ref="tabs" :current="tabIndex" :list="list" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
<view v-for="(item,index) in groupList" :key="index" class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.groupName}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box"
@scroll="rightScroll">
<template>
<view>
<view class="u-wrap" v-if="!takeStatus">
<u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="26" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar>
<u-tabs-swiper ref="tabs" :current="tabIndex" :list="list" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
<view v-for="(item,index) in groupList" :key="index" class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.groupName}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box"
@scroll="rightScroll">
<u-form :model="form" ref="uForm">
<template v-for="(groupItem,groupIndex) in groupList">
<view class="class-item" :key="groupIndex">
<view class="title">{{groupItem.groupName}}</view>
<view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex"
label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="item.fieldsType!=='location'">
<!-- <text class="required" v-if="item.required">*</text> -->
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
</xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-multi-input>
<xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-radio>
<xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-checkbox>
<xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-select>
<xh-files v-else-if="typeToComponentType(item.fieldsType)==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-files>
<xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-location>
<xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-scan>
<xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-picker>
<xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-time>
</template>
</u-form-item>
<u-form :model="form" ref="uForm">
<template v-for="(groupItem,groupIndex) in groupList">
<view class="class-item" :key="groupIndex">
<view class="title">{{groupItem.groupName}}</view>
<view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex"
label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="item.fieldsType!=='location'">
<!-- <text class="required" v-if="item.required">*</text> -->
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
</xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-multi-input>
<xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-radio>
<xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-checkbox>
<xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-select>
<xh-files v-else-if="typeToComponentType(item.fieldsType)==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
:files="files[itemIndex.toString()]"
@value-change="fieldValueChange" @getTakeStatus="getTakeStatus">
</xh-files>
<xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-location>
<xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-scan>
<xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-picker>
<xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-time>
</template>
</u-form-item>
</view>
</view>
</view>
</template>
</u-form>
</scroll-view>
</view>
<view @click="nextStep">下一步</view>
</template>
</u-form>
</scroll-view>
</view>
<view class="btn-wrap flex-xc">
<u-button class="btn-submit" @click="$u.debounce(nextStep, 500)" :custom-style="buttonStyle"
type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
下一步
</u-button>
</view>
</view>
<take-photo v-else @close="closeTake"></take-photo>
</view>
</template>
<script>
......@@ -87,7 +97,7 @@
import XhScan from '@/components/createCom/XhScan.vue'
import XhPicker from '@/components/createCom/XhPicker.vue'
import XhTime from '@/components/createCom/XhTime.vue'
import takePhoto from '@/components/take/index.vue'
// import XhRadio from '@/components/createCom/XhRadio.vue'
export default {
data() {
......@@ -103,7 +113,7 @@
name: '安装信息'
}
],
tabIndex: 0,
tabIndex: 1,
scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0,
current: 0, // 预设当前项的值
......@@ -144,7 +154,11 @@
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}]
}
},
submitBtnStatus: false,
takeStatus: false,
fileIndex: null,
files: []
}
},
components: {
......@@ -157,7 +171,8 @@
XhLocation,
XhScan,
XhPicker,
XhTime,
XhTime,
'take-photo': takePhoto
},
created() {
// console.log(allComponents,'allComponents')
......@@ -176,9 +191,36 @@
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
buttonStyle() {
return this.submitBtnStatus ? {
'color': '#FFFFFF',
'background-color': '#2272FF;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
} : {
'color': '#FFFFFF',
'background-color': '#D1D4D4;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
}
}
},
methods: {
methods: {
getTakeStatus(event) {
this.takeStatus = event.status
this.fileIndex = event.index.toString()
if(!this.files[event.index] || this.files[event.index].length < 1) this.files[event.index] = []
},
closeTake(images) {
this.takeStatus = false
//const newFile = this.files[this.fileIndex].concat(images)
this.$set(this.files, this.fileIndex, images)
},
// 字段的值更新
fieldValueChange(data) {
// data.groupIndex data.itemIndex值下标 data.value //值
......@@ -199,14 +241,12 @@
console.log(this.form, 'this.form')
},
nextStep(item) {
// 下一步
console.log(item, 'item')
if (this.tabIndex < 3) this.tabIndex++
},
typeToComponentType(type) {
// 将fieldType类型统一转换为公共组件判定类型
let formType = ''
type = type.toLocaleLowerCase()
//console.log(type,'type')
switch (type) {
case 'text':
case 'password':
......@@ -242,9 +282,6 @@
case 'time':
formType = 'time'
break
case 'file':
formType = 'XhFiles'
break
}
//console.log(formType,'formType')
return formType
......@@ -522,5 +559,11 @@
.item-menu-image {
width: 120rpx;
height: 120rpx;
}
/*提交按钮*/
.btn-wrap {
width: 100%;
padding: 20rpx 0 40rpx 0;
}
</style>
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