From b52303bd0e31320b2ec236e7525c61fb8da9ca19 Mon Sep 17 00:00:00 2001
From: lijundan <lijundan@weixiuhui.cn>
Date: Mon, 19 Apr 2021 14:59:12 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E-file=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/common/classify.data.js                   |   4 +-
 src/components/createCom/XhFiles.vue          | 110 ++++++++++++++++++
 .../XhRadio - \345\211\257\346\234\254.vue"   |  45 -------
 src/pages/order/complete.vue                  |   7 +-
 4 files changed, 119 insertions(+), 47 deletions(-)
 create mode 100644 src/components/createCom/XhFiles.vue
 delete mode 100644 "src/components/createCom/XhRadio - \345\211\257\346\234\254.vue"

diff --git a/src/common/classify.data.js b/src/common/classify.data.js
index 5e4b887..33a4b3e 100644
--- a/src/common/classify.data.js
+++ b/src/common/classify.data.js
@@ -38,7 +38,9 @@ export default [{
 				"cat": 10
 			},
 			{
-				"fieldsTitle": "短裙",
+				"fieldsTitle": "文件选择",
+				"fieldsName": "file",
+				"fieldsType": "file",
 				"key": "短裙",
 				"icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg",
 				"cat": 10
diff --git a/src/components/createCom/XhFiles.vue b/src/components/createCom/XhFiles.vue
new file mode 100644
index 0000000..6ea347b
--- /dev/null
+++ b/src/components/createCom/XhFiles.vue
@@ -0,0 +1,110 @@
+<template>
+	<view class="file-box">
+		<view class="u-flex" @click="selectUpload">
+			<view class="txt u-flex-1">{{item.fieldsTitle}}</view>
+			<u-icon name="arrow-right" color="#666" size="28"></u-icon>
+		</view>
+		<view class="pics u-flex u-flex-wrap">
+			<u-image class="pic" v-for="item in 6" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
+		</view>
+		<u-popup v-model="maskShow" mode="center" width="500">
+			<view class="upload-box u-p-30">
+				<view class="title">请选择图片</view>
+				<view class="u-flex u-row-between">
+					<view class="upload-item u-text-center" @click="uploadFile('photo')">
+						<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
+						相册
+					</view>
+					<view class="upload-item u-text-center" @click="uploadFile">
+						<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
+						拍摄
+					</view>
+				</view>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	import objMixin from './objMixin'
+	import baseFile from '@/components/upload/index';
+	export default {
+		name: 'XhFiles',
+		components: {},
+		mixins: [objMixin,baseFile],
+		props: {},
+		filters:{},
+		data() {
+			return {
+				maskShow:false
+			}
+		},
+		computed: {
+			settings() {
+				return this.item.settings || []
+			}
+		},
+		watch: {},
+		mounted() {},
+		methods: {
+			selectUpload(){
+				// 弹窗展示
+				this.maskShow = true
+			},
+			chooseImage(){
+				
+			},
+			uploadFile(type){
+				if(type&&type==='photo'){
+					// 直接打开相册
+					this.chooseImage()
+					return
+				}
+				// 使用拍照工具拍摄
+				
+			},
+			checkStatus(item){
+				if(!item){
+					return false
+				}
+				const dataValue = this.dataValue
+				let flag = Array.isArray(dataValue) && dataValue.indexOf(item)>-1
+				console.log(flag,'flag')
+				return flag
+			},
+			setValue(txt) {
+				const dataValue = this.dataValue || []
+				let idx = dataValue.indexOf(txt)
+				if (idx > -1) {
+					dataValue.splice(idx,1)
+				} else {
+					dataValue.push(txt)
+				}
+				this.dataValue = dataValue
+				this.valueChange(this.dataValue)
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.pic{
+		margin-right: 15rpx;
+		margin-bottom: 15rpx;
+		&:nth-child(3n){
+			margin-right: 0;
+		}
+	}
+	// .list {
+	// 	display: flex;
+
+	// 	.txt {
+	// 		color: #666;
+	// 		padding: 10rpx;
+
+	// 		&.active {
+	// 			background-color: red;
+	// 			color: #fff;
+	// 		}
+	// 	}
+	// }
+</style>
diff --git "a/src/components/createCom/XhRadio - \345\211\257\346\234\254.vue" "b/src/components/createCom/XhRadio - \345\211\257\346\234\254.vue"
deleted file mode 100644
index a6cae5e..0000000
--- "a/src/components/createCom/XhRadio - \345\211\257\346\234\254.vue"	
+++ /dev/null
@@ -1,45 +0,0 @@
-<template>
-	<view class="list">
-		<view v-for="(item,index) in settings" :key="index" :class="{'txt':true,'active':item===dataValue}" 
-		@click="setValue(item)">{{item}}</view>
-	</view>
-</template>
-
-<script>
-	import stringMixin from './stringMixin'
-	export default {
-		name: 'XhRadio',
-		components: {},
-		mixins: [stringMixin],
-		props: {},
-		data() {
-			return {}
-		},
-		computed: {
-			settings(){
-				return this.item.settings || []
-			}
-		},
-		watch: {},
-		mounted() {},
-		methods: {
-			setValue(txt){
-				this.dataValue = txt
-				this.valueChange(txt)
-			}
-		}
-	}
-</script>
-<style lang="scss" scoped>
-	.list{
-		display: flex;
-		.txt{
-			color:#666;
-			padding:10rpx;
-			&.active{
-				background-color: red;
-				color:#fff;
-			}
-		}
-	}
-</style>
diff --git a/src/pages/order/complete.vue b/src/pages/order/complete.vue
index 6c2e7b2..3a0181e 100644
--- a/src/pages/order/complete.vue
+++ b/src/pages/order/complete.vue
@@ -41,6 +41,9 @@
 										<xh-select v-if="item.fieldsType==='select'" :groupIndex="groupIndex"
 											:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
 										</xh-select>
+										<xh-files v-if="item.fieldsType==='file'" :groupIndex="groupIndex"
+											:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
+										</xh-files>
 									</template>
 								</u-form-item>
 							</view>
@@ -58,6 +61,7 @@
 	import XhRadio from '@/components/createCom/XhRadio.vue'
 	import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
 	import XhSelect from '@/components/createCom/XhSelect.vue'
+	import XhFiles from '@/components/createCom/XhFiles.vue'
 	// import XhRadio from '@/components/createCom/XhRadio.vue'
 	export default {
 		data() {
@@ -109,7 +113,8 @@
 			XhInput,
 			XhRadio,
 			XhCheckbox,
-			XhSelect
+			XhSelect,
+			XhFiles
 			// formCom
 		},
 		created() {
-- 
2.23.0