xsc hace 1 año
padre
commit
70691c4880
Se han modificado 2 ficheros con 142 adiciones y 59 borrados
  1. 69 10
      pages/mine/shenbaoDetail.vue
  2. 73 49
      pages/mine/upload.vue

+ 69 - 10
pages/mine/shenbaoDetail.vue

@@ -6,7 +6,20 @@
 			</view>
 			<text>查看申报</text>
 		</view>
-		<iframe :src="uploadPdf" frameborder="0" class="iframe"></iframe>
+		<view class="tabbar" v-if="msg.extra.total_time">
+			<view @click="tabbar(0)" :class="index==0 ? 'active' : ''">
+				<text>附件</text>
+			</view>
+			<view @click="tabbar(1)" :class="index==1 ? 'active' : ''">
+				<text>证明材料</text>
+			</view>
+		</view>
+		<div v-if="msg.extra.total_time" class="nav">
+			<iframe :src="uploadPdf" frameborder="0" class="iframe"></iframe>
+		</div>
+		<div v-if="!msg.extra.total_time" class="nav1">
+			<iframe :src="uploadPdf" frameborder="0" class="iframe"></iframe>
+		</div>
 	</view>
 	</view>
 </template>
@@ -19,7 +32,8 @@
 		data() {
 			return {
 				msg:'',
-				uploadPdf:''
+				uploadPdf:'',
+				index:0
 			}
 		},
 		components: {
@@ -34,34 +48,79 @@
 						this.msg = res.data.data[0]
 					}else{
 						this.msg = res.data.data
-					}
-					var obj = this.msg.resources
-					var arr = Object.values(obj);
-					this.uploadPdf = arr[0]
+					}
+					console.log(this.msg)
+					var obj = this.msg.extra.resource_ids[0]
+					// var arr = Object.values(obj);
+					this.uploadPdf = obj
 				})
 			}else{
-				
 					this.uploadPdf = options.url
-				
 			}
-		
 		},
 		methods: {
 			backLast(){
 				uni.navigateBack()
+			},
+			tabbar(index){
+				this.index = index
+				console.log(index)
+				if(index==0){
+					this.uploadPdf = this.msg.extra.resource_ids[0]
+				}else{
+					this.uploadPdf = this.msg.extra.prove_files[0]
+				}
 			}
 		}
 	}
 </script>
 
 <style lang="scss">
-.iframe{
+.nav{
 		width: 100%;
 		height: 100%;
 		position: fixed;
 		z-index: 222;
+		top: 200upx;
+		left: 0;
+		iframe{
+			width: 100%;
+			height: 100%;
+		}
+	}
+	.nav1{
+			width: 100%;
+			height: 100%;
+			position: fixed;
+			z-index: 222;
+			top: 100upx;
+			left: 0;
+			iframe{
+				width: 100%;
+				height: 100%;
+			}
+		}
+	.tabbar{ 
+		width: 100%;
+		height: 100upx;
+		position: fixed;
+		z-index: 222;
 		top: 100upx;
 		left: 0;
+		display: flex;
+		align-items: center;
+		border: 1upx solid #EFF1F6;
+		view{
+			width: 50%;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			height: 100%;
+			color: black;
+		}
+		.active{
+			color: blue;
+		}
 	}
 	.navbar {
 		font-size: 32upx;

+ 73 - 49
pages/mine/upload.vue

@@ -8,69 +8,56 @@
 		</view>
 		<view class="upload-home">
 			<view  v-for="(item,index) in verification" :key="index">
-				<view class="imgList" v-if="item.name=='附件'">
+				<view class="imgList" v-if="item.key=='resource_ids'">
 					<view class="img-title">请上传pdf文件</view>
 					<view class="img-box">
 						<view class="htz-image-upload-Item" v-if="pdfUrl!=''" v-for="(item,index) in pdfUrl" :key="index">
 							<image class="img" src="/static/images/pdf.png" @click="imgPreview(index)"></image>
 							<view class="htz-image-upload-Item-del" @click="imgDel(index)">×</view>
 						</view>
-						<view class="htz-image-upload-Item htz-image-upload-Item-add" @click="upload">
+						<view class="htz-image-upload-Item htz-image-upload-Item-add" @click="upload" v-if="pdfUrl.length < number">
 							+
 						</view>
-						
 					</view>
 				</view>
-				<view class="table" v-if="item.name=='分值'">
-					<view class="text-box">
-						<text class="input-key">分值:</text><input type="text" v-model="item.fenshu" class="input-val" placeholder-style="color:darkgray;"
-							placeholder="请输入分值" />
+				<view class="imgList" v-if="item.key=='prove_files'">
+					<view class="img-title">{{item.name}}</view>
+					<view class="img-box">
+						<view class="htz-image-upload-Item" v-if="cailiao_pdfUrl!=''" v-for="(item,index) in cailiao_pdfUrl" :key="index">
+							<image class="img" src="/static/images/pdf.png" @click="imgPreview(index)"></image>
+							<view class="htz-image-upload-Item-del" @click="imgDel_cailiao(index)">×</view>
+						</view>
+						<view class="htz-image-upload-Item htz-image-upload-Item-add" @click="upload_cailiao" v-if="pdfUrl.length < 9">
+							+
+						</view>
 					</view>
 				</view>
-				<view class="table" v-if="item.name=='奖项名称'">
+				<view class="table" v-if="item.key!='resource_ids' && item.key!='prove_files'">
 					<view class="text-box">
 						<text class="input-key">{{item.name}}:</text><input type="text" v-model="item.fenshu" class="input-val" placeholder-style="color:darkgray;"
 							:placeholder="'请输入'+item.name" />
 					</view>
 				</view>
-				<view class="table" v-if="item.name=='奖项等级'">
+				<view class="table" v-if="item.key=='grade_id'">
 					<view class="text-box" style="display: flex;align-items: center;justify-content: space-between;">
-						<text class="input-key">奖项等级:</text>
+						<text class="input-key">{{item.name}}:</text>
 							<picker mode="selector" :range="extra.position_grade" @change="gradeChange"
 								class="input1" :value="position_grade">
 								<view class="uni-input" style="font-size: 33upx;color:  darkgray;">{{grade}}</view>
 							</picker>
 					</view>
 				</view>
-				<view class="table" v-if="item.name=='获奖名次'">
-					<view class="text-box">
-						<text class="input-key">{{item.name}}:</text><input type="text" v-model="item.fenshu" class="input-val" placeholder-style="color:darkgray;"
-							:placeholder="'请输入'+item.name" />
-					</view>
-				</view>
-				<view class="table" v-if="item.name=='颁发单位'">
-					<view class="text-box">
-						<text class="input-key">{{item.name}}:</text><input type="text" v-model="item.fenshu" class="input-val" placeholder-style="color:darkgray;"
-							:placeholder="'请输入'+item.name" />
-					</view>
-				</view>
-				<view class="table" v-if="item.name=='颁发日期'">
+				<view class="table" v-if="item.key=='award_day'">
 					<view class="text-box" style="display: flex;align-items: center;justify-content: space-between;">
-						<text class="input-key">颁发日期:</text>
+						<text class="input-key">{{item.name}}:</text>
 							<picker mode="date" :value="time" @change="birthDateChange" class="input1">
 								<view class="uni-input" style="font-size: 33upx;color:  darkgray;">{{time}}</view>
 							</picker>
 					</view>
 				</view>
-				<view class="table" v-if="item.name=='职位名称'">
-					<view class="text-box">
-						<text class="input-key">{{item.name}}:</text><input type="text" v-model="item.fenshu" class="input-val" placeholder-style="color:darkgray;"
-							:placeholder="'请输入'+item.name" />
-					</view>
-				</view>
-				<view class="table" v-if="item.name=='职位等级'">
+				<view class="table" v-if="item.key=='position_grade'">
 					<view class="text-box" style="display: flex;align-items: center;justify-content: space-between;">
-						<text class="input-key">奖项等级:</text>
+						<text class="input-key">{{item.name}}:</text>
 							<picker mode="selector" :range="extra.position_grade" @change="gradeChange"
 								class="input1" :value="position_grade">
 								<view class="uni-input" style="font-size: 33upx;color:  darkgray;">{{grade}}</view>
@@ -110,8 +97,9 @@
 				extra:[],
 				grade:'请选择',
 				position_grade:0,
-				gradeValue:''
-				
+				gradeValue:'',
+				cailiao_ids:[],
+				cailiao_pdfUrl:[]
 			}
 		},
 		components: {
@@ -158,6 +146,44 @@
 					}
 				})
 			},
+			upload_cailiao() {
+				var that = this
+				console.log(this.number)
+				uni.chooseFile({
+					count: this.number,
+					extension: ['.pdf'],
+					success(res) {
+						console.log(res)
+						that.cailiao_pdfUrl= that.cailiao_pdfUrl.concat(res.tempFilePaths)
+						that.cailiao_uploadFiles(res.tempFilePaths[0])
+					}
+				})
+			},
+			imgDel_cailiao(index){
+				var list = this.cailiao_pdfUrl
+				var id = this.cailiao_ids
+				list.splice(index,1)
+				id.splice(index,1)
+				this.cailiao_pdfUrl = list
+				this.cailiao_ids = id
+			},
+			cailiao_uploadFiles(url) {
+				uni.uploadFile({
+					url: this.baseUrl, //仅为示例,非真实的接口地址
+					filePath: url,
+					fileType: 'file',
+					formData: {
+						file_type: 'file'
+					},
+					header: this.headers,
+					success: (uploadFileRes) => {
+						console.log(uploadFileRes)
+						var data = JSON.parse(uploadFileRes.data)
+						console.log(data)
+						this.cailiao_ids = this.cailiao_ids.concat(data.data.url)
+					},
+				})
+			},
 			uploadFiles(url) {
 				uni.uploadFile({
 					url: this.baseUrl, //仅为示例,非真实的接口地址
@@ -171,21 +197,7 @@
 						console.log(uploadFileRes)
 						var data = JSON.parse(uploadFileRes.data)
 						console.log(data)
-						this.uploadPdf = this.uploadPdf.concat(data.data.url)
-						this.ids = this.ids.concat(data.data.id)
-						console.log('first-------------------')
-						// uni.hideLoading();
-						//console.log(typeof this.uploadSuccess)
-						//console.log('')
-						// if (typeof this.uploadSuccess == 'function') {
-						// 	if (this.uploadSuccess(uploadFileRes).success) {
-						// 		this.value.push(this.uploadSuccess(uploadFileRes).url)
-						// 		this.$emit("input", this.uploadLists);
-						// 	}
-						// 	console.log('成功')
-						// }
-						// resolve(uploadFileRes);
-						// this.$emit("uploadSuccess", uploadFileRes);
+						this.ids = this.ids.concat(data.data.url)
 					},
 				})
 			},
@@ -213,6 +225,9 @@
 						if(this.verification[i].key == 'resource_ids'){
 							obj.resource_ids = this.ids
 						}
+						if(this.verification[i].key == 'prove_files'){
+							obj.prove_files = this.cailiao_ids
+						}
 						if(this.verification[i].key == 'award_day'){
 							obj.award_day = this.time
 						}
@@ -226,6 +241,15 @@
 					obj.staff_id = this.staff_id
 					obj.examine_question_id = this.typeId
 					console.log(obj)
+					for(var key in obj){
+						if(!obj[key]){
+							uni.showToast({
+								title:'请完善信息表!',
+								icon:'none'
+							})
+							return
+						}
+					}
 					app.request('/examine/store', obj, 'post').then(res => {
 						console.log(res, "上传成功")
 						if(res.statusCode==200){