Commit 57c1e774b63ebdcaea9a55676a31734e08b5bf33
1 parent
8b6c5262
测肤上传
Showing
7 changed files
with
124 additions
and
61 deletions
packageB/pages/AI-test-skin/select_photo/select_photo.js
@@ -19,33 +19,21 @@ Page({ | @@ -19,33 +19,21 @@ Page({ | ||
19 | */ | 19 | */ |
20 | data: { | 20 | data: { |
21 | iurl: setting.imghost, | 21 | iurl: setting.imghost, |
22 | + gl_skin_img: null, | ||
22 | }, | 23 | }, |
23 | 24 | ||
24 | /** | 25 | /** |
25 | * 生命周期函数--监听页面加载 | 26 | * 生命周期函数--监听页面加载 |
26 | */ | 27 | */ |
27 | onLoad: function (options) { | 28 | onLoad: function (options) { |
28 | - | ||
29 | - }, | ||
30 | - | ||
31 | - /** | ||
32 | - * 生命周期函数--监听页面初次渲染完成 | ||
33 | - */ | ||
34 | - onReady: function () { | ||
35 | - | 29 | + var img=getApp().globalData.skin_img; |
30 | + this.setData({gl_skin_img:img}) | ||
36 | }, | 31 | }, |
37 | 32 | ||
38 | /** | 33 | /** |
39 | * 生命周期函数--监听页面显示 | 34 | * 生命周期函数--监听页面显示 |
40 | */ | 35 | */ |
41 | - onShow: function () { | ||
42 | - | ||
43 | - }, | ||
44 | - | ||
45 | - goto(){ | ||
46 | - let url = "/packageB/pages/AI-test-skin/analyse/analyse"; //跳到分析页 | ||
47 | - app.goto(url); | ||
48 | - }, | 36 | + onShow: function () {}, |
49 | 37 | ||
50 | /** | 38 | /** |
51 | * 生命周期函数--监听页面隐藏 | 39 | * 生命周期函数--监听页面隐藏 |
@@ -53,32 +41,63 @@ Page({ | @@ -53,32 +41,63 @@ Page({ | ||
53 | onHide: function () { | 41 | onHide: function () { |
54 | 42 | ||
55 | }, | 43 | }, |
56 | - | ||
57 | /** | 44 | /** |
58 | - * 生命周期函数--监听页面卸载 | 45 | + * 页面上拉触底事件的处理函数 |
59 | */ | 46 | */ |
60 | - onUnload: function () { | 47 | + onReachBottom: function () { |
61 | 48 | ||
62 | }, | 49 | }, |
63 | 50 | ||
64 | /** | 51 | /** |
65 | - * 页面相关事件处理函数--监听用户下拉动作 | 52 | + * 用户点击右上角分享 |
66 | */ | 53 | */ |
67 | - onPullDownRefresh: function () { | 54 | + onShareAppMessage: function () { |
68 | 55 | ||
69 | }, | 56 | }, |
70 | 57 | ||
71 | - /** | ||
72 | - * 页面上拉触底事件的处理函数 | ||
73 | - */ | ||
74 | - onReachBottom: function () { | 58 | + //-- 完成选择 -- |
59 | + ok_select:function () { | ||
60 | + var th=this; | ||
61 | + app.request.uploadFile("/api/weshop/baidubce/face/uploadImg?uploadPath=faceimg&storeId="+setting.stoid, { | ||
62 | + filePath: th.data.gl_skin_img, | ||
63 | + name: "file", | ||
64 | + success: function (e) { | ||
65 | + if(e.data.code==0) { | ||
66 | + getApp().globalData.face_img=e.data.data.img; | ||
67 | + getApp().globalData.face_SourceImg=e.data.data.SourceImg; | ||
68 | + | ||
69 | + let url = "/packageB/pages/AI-test-skin/analyse/analyse"; //跳到分析页 | ||
70 | + app.goto(url); | ||
71 | + | ||
72 | + } else { | ||
73 | + wx.showToast({ | ||
74 | + title: e.data.msg, | ||
75 | + icon: 'success', | ||
76 | + duration: 2000 | ||
77 | + }); | ||
78 | + }; | ||
79 | + } | ||
80 | + }); | ||
81 | + }, | ||
82 | + | ||
83 | + //-- 重新从相册中选择图片 -- | ||
84 | + show_pai_pop:function () { | ||
85 | + var th=this; | ||
86 | + //选择和拍照一张图片 | ||
87 | + wx.chooseImage({ | ||
88 | + count: 1, | ||
89 | + sizeType: ['original', 'compressed'], | ||
90 | + sourceType: ['album', 'camera'], | ||
91 | + success (res) { | ||
92 | + let imgArr = res.tempFilePaths; | ||
93 | + getApp().globalData.skin_img=imgArr[0]; | ||
94 | + th.setData({gl_skin_img:imgArr[0]}) | ||
95 | + } | ||
96 | + }) | ||
75 | 97 | ||
76 | }, | 98 | }, |
77 | 99 | ||
78 | - /** | ||
79 | - * 用户点击右上角分享 | ||
80 | - */ | ||
81 | - onShareAppMessage: function () { | ||
82 | 100 | ||
83 | - } | 101 | + |
102 | + | ||
84 | }) | 103 | }) |
85 | \ No newline at end of file | 104 | \ No newline at end of file |
packageB/pages/AI-test-skin/select_photo/select_photo.json
packageB/pages/AI-test-skin/select_photo/select_photo.wxml
1 | <view class="content" style="height: 70%;"> | 1 | <view class="content" style="height: 70%;"> |
2 | <view style="height: 100%;"> | 2 | <view style="height: 100%;"> |
3 | - <image style="height: 100%;width: 100%;border-radius: 3%;" src="/packageB/images/touxiang.jpg"></image> | 3 | + <image style="height: 100%;width: 100%;border-radius: 3%;" src="{{gl_skin_img}}"></image> |
4 | </view> | 4 | </view> |
5 | <view class="foot_btn"> | 5 | <view class="foot_btn"> |
6 | - <view class="reset_select"> | ||
7 | - <text class="iconfont icon-zuojiantou"></text> | ||
8 | - <text>重拍</text> | 6 | + <view class="reset_select" bindtap="show_pai_pop"> |
7 | + <text class="iconfont icon-zuojiantou" style="font-size: 40rpx"></text> | ||
8 | + <text style="font-size: 28rpx">重拍</text> | ||
9 | </view> | 9 | </view> |
10 | - <view class="ok_btn" bindtap="goto"> | 10 | + <view class="ok_btn" bindtap="ok_select"> |
11 | <text class="iconfont icon-dagou" style="margin-right: 10rpx"></text> | 11 | <text class="iconfont icon-dagou" style="margin-right: 10rpx"></text> |
12 | <text>完成</text> | 12 | <text>完成</text> |
13 | </view> | 13 | </view> |
packageB/pages/AI-test-skin/select_photo/select_photo.wxss
packageB/pages/AI-test-skin/shoot_notice/shoot_notice.js
@@ -29,22 +29,11 @@ Page({ | @@ -29,22 +29,11 @@ Page({ | ||
29 | }, | 29 | }, |
30 | 30 | ||
31 | /** | 31 | /** |
32 | - * 生命周期函数--监听页面初次渲染完成 | ||
33 | - */ | ||
34 | - onReady: function () { | ||
35 | - | ||
36 | - }, | ||
37 | - | ||
38 | - /** | ||
39 | * 生命周期函数--监听页面显示 | 32 | * 生命周期函数--监听页面显示 |
40 | */ | 33 | */ |
41 | onShow: function () { | 34 | onShow: function () { |
42 | 35 | ||
43 | }, | 36 | }, |
44 | - goto(){ | ||
45 | - let url = "/packageB/pages/AI-test-skin/select_photo/select_photo"; | ||
46 | - app.goto(url); | ||
47 | - }, | ||
48 | 37 | ||
49 | /** | 38 | /** |
50 | * 生命周期函数--监听页面隐藏 | 39 | * 生命周期函数--监听页面隐藏 |
@@ -54,13 +43,6 @@ Page({ | @@ -54,13 +43,6 @@ Page({ | ||
54 | }, | 43 | }, |
55 | 44 | ||
56 | /** | 45 | /** |
57 | - * 生命周期函数--监听页面卸载 | ||
58 | - */ | ||
59 | - onUnload: function () { | ||
60 | - | ||
61 | - }, | ||
62 | - | ||
63 | - /** | ||
64 | * 页面相关事件处理函数--监听用户下拉动作 | 46 | * 页面相关事件处理函数--监听用户下拉动作 |
65 | */ | 47 | */ |
66 | onPullDownRefresh: function () { | 48 | onPullDownRefresh: function () { |
@@ -79,5 +61,26 @@ Page({ | @@ -79,5 +61,26 @@ Page({ | ||
79 | */ | 61 | */ |
80 | onShareAppMessage: function () { | 62 | onShareAppMessage: function () { |
81 | 63 | ||
82 | - } | 64 | + }, |
65 | + | ||
66 | + //从相册中选择图片 | ||
67 | + show_pai_pop:function () { | ||
68 | + //选择和拍照一张图片 | ||
69 | + wx.chooseImage({ | ||
70 | + count: 1, | ||
71 | + sizeType: ['original', 'compressed'], | ||
72 | + sourceType: ['album', 'camera'], | ||
73 | + success (res) { | ||
74 | + let imgArr = res.tempFilePaths; | ||
75 | + getApp().globalData.skin_img=imgArr[0]; | ||
76 | + let url = "/packageB/pages/AI-test-skin/select_photo/select_photo"; | ||
77 | + app.goto(url); | ||
78 | + } | ||
79 | + }) | ||
80 | + | ||
81 | + }, | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
83 | }) | 86 | }) |
84 | \ No newline at end of file | 87 | \ No newline at end of file |
packageB/pages/AI-test-skin/shoot_notice/shoot_notice.wxml
@@ -51,9 +51,7 @@ | @@ -51,9 +51,7 @@ | ||
51 | </view> | 51 | </view> |
52 | <view style="height: 300rpx;background-color: #e7f5fb;"> | 52 | <view style="height: 300rpx;background-color: #e7f5fb;"> |
53 | <view class="btn_fixed"> | 53 | <view class="btn_fixed"> |
54 | - <view class="btn" bindtap="goto"> | ||
55 | - 准备闭眼拍摄 | ||
56 | - </view> | 54 | + <view class="btn" bindtap="show_pai_pop">准备闭眼拍摄</view> |
57 | <view class="notice" style="display:flex;justify-content:center;align-items: center;"> | 55 | <view class="notice" style="display:flex;justify-content:center;align-items: center;"> |
58 | <text class="iconfont icon-info" style="margin-right: 10rpx;font-size: 26rpx"></text> | 56 | <text class="iconfont icon-info" style="margin-right: 10rpx;font-size: 26rpx"></text> |
59 | <text>如无闭眼,将导致图片分析失败</text> | 57 | <text>如无闭眼,将导致图片分析失败</text> |
packageB/pages/AI-test-skin/shoot_notice/shoot_notice.wxss
@@ -2,11 +2,11 @@ | @@ -2,11 +2,11 @@ | ||
2 | page { | 2 | page { |
3 | width: 100vw; | 3 | width: 100vw; |
4 | height: 100%; | 4 | height: 100%; |
5 | - padding: 40rpx 30rpx 0 30rpx; | 5 | + /*padding: 40rpx 30rpx 0 30rpx;*/ |
6 | box-sizing: border-box; | 6 | box-sizing: border-box; |
7 | background-color: #e7f5fb; | 7 | background-color: #e7f5fb; |
8 | } | 8 | } |
9 | - | 9 | +.page_set{padding: 40rpx 30rpx 0 30rpx;} |
10 | .content { | 10 | .content { |
11 | width: 100%; | 11 | width: 100%; |
12 | /* height: 100%; */ | 12 | /* height: 100%; */ |
@@ -90,4 +90,45 @@ page { | @@ -90,4 +90,45 @@ page { | ||
90 | text-align: center; | 90 | text-align: center; |
91 | color: red; | 91 | color: red; |
92 | font-size: 28rpx; | 92 | font-size: 28rpx; |
93 | -} | ||
94 | \ No newline at end of file | 93 | \ No newline at end of file |
94 | +} | ||
95 | + | ||
96 | +.cover-layer { | ||
97 | + position: fixed; | ||
98 | + left: 0; | ||
99 | + top: 0; | ||
100 | + right: 0; | ||
101 | + bottom: 0; | ||
102 | + z-index: 11; | ||
103 | + background: rgba(0,0,0,0.4); | ||
104 | + width: 100%; | ||
105 | + height: 100%; | ||
106 | +} | ||
107 | + | ||
108 | +.flex{display: flex} | ||
109 | +.jc-center{ | ||
110 | + justify-content: center; | ||
111 | +} | ||
112 | +.ac{align-items: center} | ||
113 | +.pai_content{ | ||
114 | + position: fixed;z-index: 100;bottom: 0;background: #FFFFFF;width: 100%; | ||
115 | + border-top-left-radius:30rpx; | ||
116 | + border-top-right-radius:30rpx; | ||
117 | +} | ||
118 | +.p_item{ height: 100rpx; line-height: 100rpx;text-align: center; border-bottom: 1rpx solid #eee} | ||
119 | +.p_cancle{height: 100rpx; line-height: 100rpx;text-align: center; border-top:20rpx solid #f8f8f8;} | ||
120 | + | ||
121 | +@keyframes p_up | ||
122 | +{ | ||
123 | + from {transform:translateY(100%);} | ||
124 | + to {transform:translateY(0);} | ||
125 | +} | ||
126 | + | ||
127 | +@keyframes p_down | ||
128 | +{ | ||
129 | + from {transform:translateY(0);} | ||
130 | + to {transform:translateY(100%);} | ||
131 | +} | ||
132 | +.p_to_up{animation:p_up 1s;} | ||
133 | +.p_to_down{animation:p_down 0.5s;} | ||
134 | + | ||
135 | + |