Browse Source

吉农宝

hanfucheng 1 năm trước cách đây
mục cha
commit
13bec0438b

+ 8 - 0
api/me/nameAuthentication.js

@@ -8,3 +8,11 @@ export function appletAdd(query) {
     data: query
   })
 }
+
+//按用户id查询实名认证信息
+export function getUserInfo(userId) {
+  return request({
+    url: '/nameAuthentication/getNameInfo/'+ userId,
+    method: 'get',
+  })
+}

+ 9 - 0
api/me/officialAuthentication.js

@@ -8,3 +8,12 @@ export function appletAdd(query) {
     data: query
   })
 }
+
+
+//按用户id查询实名认证信息
+export function getUserInfo(userId) {
+  return request({
+    url: '/officialAuthentication/getOfficialInfo/'+ userId,
+    method: 'get',
+  })
+}

+ 22 - 4
pages/me/nameAuthentication.vue

@@ -12,19 +12,23 @@
                 <uni-forms-item label="身份证号" required name="idCard">
                     <uni-easyinput v-model="form.idCard" placeholder="请输入身份证号" maxlength="18"/>
                 </uni-forms-item>
-                <uni-forms-item label="身份证正反面" required name="path">
+				<uni-forms-item label="身份证正反面" required class="onePic" v-if="form.id != null">
+					<image :src="loadImgSrc(item)" v-for="(item, index1) in imageList" :key="index1">
+					</image>
+				</uni-forms-item>
+                <uni-forms-item label="身份证正反面" required name="path" v-if="form.id == null">
                     <upload :imgArr="imageList" name="path" v-model="form.path" :fileSize="1" :limit="2"
                             @updateImg="updateImg"></upload>
                 </uni-forms-item>
             </uni-forms>
-            <button type="primary" @click="submitForm('customForm')">提交</button>
+            <button type="primary" @click="submitForm('customForm')" v-if="form.id==null">提交</button>
         </view>
     </uni-section>
 </template>
 
 <script>
     import upload from '../../components/upload/index.vue'
-    import {appletAdd} from '@/api/me/nameAuthentication.js'
+    import {appletAdd,getUserInfo} from '@/api/me/nameAuthentication.js'
 
     export default {
         components: {
@@ -33,6 +37,8 @@
         onReady() {
             // 设置自定义表单校验规则,必须在节点渲染完毕后执行
             this.$refs.customForm.setRules(this.customRules)
+			this.userId = getApp().globalData.userId
+			this.getUserInfoByUserId(this.userId)
         },
         data() {
             return {
@@ -97,10 +103,22 @@
 				})
             },
 
+			//图片上传
             updateImg(imgList) {
                 this.imageList = imgList;
                 this.form.path = this.imageList.join(',');
-            }
+            },
+			
+			//按userId查询实名认证信息
+			getUserInfoByUserId(userId){
+				getUserInfo(userId).then(res =>{
+					if(res.data!=null){
+						this.form = res.data;
+						this.imageList = res.data.path.split(",")
+					}
+					
+				})
+			}
         }
     };
 </script>

+ 22 - 6
pages/me/officialAuthentication.vue

@@ -12,19 +12,23 @@
                 <uni-forms-item label="联系电话" required name="phone">
                     <uni-easyinput v-model="form.phone" placeholder="请输入联系电话" maxlength="13"/>
                 </uni-forms-item>
-                <uni-forms-item label="证照信息" required name="path">
+				<uni-forms-item label="证照信息" required class="onePic" v-if="form.id != null">
+					<image :src="loadImgSrc(item)" v-for="(item, index1) in imageList" :key="index1">
+					</image>
+				</uni-forms-item>
+                <uni-forms-item label="证照信息" required name="path" v-if="form.id == null">
                     <upload :imgArr="imageList" name="path" v-model="form.path" :fileSize="1" :limit="2"
                             @updateImg="updateImg"></upload>
                 </uni-forms-item>
             </uni-forms>
-            <button type="primary" @click="submitForm('customForm')">提交</button>
+            <button type="primary" @click="submitForm('customForm')" v-if="form.id==null">提交</button>
         </view>
     </uni-section>
 </template>
 
 <script>
     import upload from '../../components/upload/index.vue'
-    import {appletAdd} from '@/api/me/officialAuthentication.js'
+    import {appletAdd,getUserInfo} from '@/api/me/officialAuthentication.js'
 
     export default {
         components: {
@@ -33,6 +37,8 @@
         onReady() {
             // 设置自定义表单校验规则,必须在节点渲染完毕后执行
             this.$refs.customForm.setRules(this.customRules)
+			this.userId = getApp().globalData.userId
+			this.getUserInfoByUserId(this.userId)
         },
         data() {
             return {
@@ -87,18 +93,28 @@
 						})
 					}else{
 						appletAdd(this.form).then(res => {
-							console.log("1111111111")
 							uni.navigateBack();
-							console.log("2222222222222")
 						});
 					}
 				})
             },
 			
+			//图片上传
             updateImg(imgList) {
                 this.imageList = imgList;
                 this.form.path = this.imageList.join(',');
-            }
+            },
+			
+			//按userId查询实名认证信息
+			getUserInfoByUserId(userId){
+				getUserInfo(userId).then(res =>{
+					if(res.data!=null){
+						this.form = res.data;
+						this.imageList = res.data.path.split(",")
+					}
+					
+				})
+			}
         }
     };
 </script>