Browse Source

修改方法

tanxue 5 days ago
parent
commit
a26dcd60ab
1 changed files with 7 additions and 2 deletions
  1. 7 2
      pages/client/my/myInfo.vue

+ 7 - 2
pages/client/my/myInfo.vue

@@ -3,9 +3,9 @@
 		<!-- 导航区域 -->
 		<customNavbarVue title="个人信息" :show-back-btn="true" @back="handleBack"></customNavbarVue>
 		<!-- 头像 -->
-		<view class="user-img-box">
+		<view class="user-img-box" @click="openFilePicker">
 			<view class="user-title">头像</view>
-			<uni-file-picker return-type="object" v-model="data.images" :del-icon="false" mode="grid" disable-preview :auto-upload="false"
+			<uni-file-picker ref="filePicker" return-type="object" v-model="data.images" :del-icon="false" mode="grid" disable-preview :auto-upload="false"
 				@select="handleSelect" file-mediatype="image" class="phone-file-picker user-file-picker">
 			</uni-file-picker>
 			<icon class="user-jt-icon" :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
@@ -50,6 +50,7 @@
 	import {ref,reactive} from "vue"
 	import {onLoad} from "@dcloudio/uni-app"
 	import cacheManager from '@/utils/cacheManager.js';
+	const filePicker = ref(null)
 	const defaultImage1 = ref({
 		url:'', extname: 'png', name: 'moren.png'
 	})
@@ -78,6 +79,10 @@
 		defaultImage1.url= cacheManager.get('projectImg').user_default_img;
 		initPage();
 	})
+	
+	function openFilePicker(){
+		filePicker.value.upload()
+	}
 
 	function handleSelect(e) {
 		console.log('eee',e)