Browse Source

Merge branch 'front_lxy' of gitee.com:deter_kali/WeChatTrading

daisy 1 year ago
parent
commit
16a51a7c52

+ 2 - 1
fore-end/API/appraise.js

@@ -28,7 +28,8 @@ const API = {
     postReviseOrder: '/order/revise',
 	getRecommendUrl: '/goods/recommend',
 	getUserAllGoodsUrl:'/goods/user',
-	initRecommendURL:'/user/rec/new'
+	initRecommendURL:'/user/rec/new',
+	uploadImageURL:'/pic/upload'
 }
 
 //查询列表时传参---注意参数数据类型

+ 7 - 7
fore-end/pages/register/register.js

@@ -93,18 +93,18 @@ Page({
 	// 	  avatarUrl,
 	// 	})
 	//   },
-	onChooseAvatar1(){
-		chooseImage().then((res)=>{
-			this.uploadImage(res.tempFilePaths[0]);
-		})
-	},
-	uploadImage(imagePath){
-		upLoad( imagePath ).then((res) => {
+	onChooseAvatar(e){
+		const {avatarUrl} = e.detail;
+		console.log(avatarUrl);
+		upLoad( avatarUrl ).then((res) => {
 			console.log(res);
 			this.setData({
 				avatarUrl: res.Url
 			});
 			wx.setStorageSync('avatarUrl', res.Url);
+			this.setData({
+				avatarUrl,
+			})
 		})
 	},
 	onInputUsername:function(e){

+ 3 - 3
fore-end/pages/register/register.wxml

@@ -1,12 +1,12 @@
 <!--pages/register.wxml-->
 <view data-weui-theme="{{theme}}">
-  <button class="avatar-wrapper" open-type="chooseAvatar"  bindtap="onChooseAvatar1">
-    <image class="avatar" src="{{avatarUrl}}" mode="center" lazy-load></image>
+  <button class="avatar-wrapper" open-type="chooseAvatar"  bind:chooseavatar="onChooseAvatar">
+    <image class="avatar" src="{{avatarUrl}}" lazy-load></image>
   </button> 
   <mp-form>
     <mp-cells>
       <mp-cell title="昵称">
-        <input  class="weui-input" placeholder="请输入昵称" bindinput="onInputUsername"/>
+        <input type="nickname" class="weui-input" placeholder="请输入昵称" bind:blur="onInputUsername"/>
       </mp-cell>
     </mp-cells>
   </mp-form>

+ 8 - 0
fore-end/utils/util.js

@@ -118,6 +118,14 @@ function chooseImage(){
 	})
 }
 
+/**
+ * 
+ * @param {string} imageUrl 图片链接 
+ */
+function ImageProcess(imageUrl) {
+	imageUrl.split('')
+}
+
 function wxLogin(){
 	return new Promise((resolve,reject)=>{
 		wx.login({