@@ -4,7 +4,8 @@ | |||||
"pages/payOrder/payOrder", | "pages/payOrder/payOrder", | ||||
"pages/login/login", | "pages/login/login", | ||||
"pages/userProtocol/userProtocol", | "pages/userProtocol/userProtocol", | ||||
"pages/upload/upload" | |||||
"pages/upload/upload", | |||||
"pages/checkImg/checkImg" | |||||
], | ], | ||||
"window": { | "window": { | ||||
"backgroundTextStyle": "light", | "backgroundTextStyle": "light", | ||||
@@ -0,0 +1,51 @@ | |||||
// pages/checkImg/checkImg.ts | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad(options) { | |||||
console.log(options); | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow() { | |||||
}, | |||||
previewImage() { | |||||
wx.previewImage({ | |||||
}) | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh() { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom() { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage() { | |||||
} | |||||
}) |
@@ -0,0 +1,6 @@ | |||||
{ | |||||
"navigationBarTitleText": "我的写真", | |||||
"navigationBarBackgroundColor": "#333333", | |||||
"navigationBarTextStyle": "white", | |||||
"usingComponents": {} | |||||
} |
@@ -0,0 +1,4 @@ | |||||
/* pages/checkImg/checkImg.wxss */ | |||||
page { | |||||
background-color: #333333; | |||||
} |
@@ -0,0 +1,19 @@ | |||||
<!--pages/checkImg/checkImg.wxml--> | |||||
<text>pages/checkImg/checkImg.wxml</text> | |||||
<swiper> | |||||
<swiper-item> | |||||
<image src="../../asset/image/test.png" mode="" /> | |||||
</swiper-item> | |||||
<swiper-item> | |||||
<image src="../../asset/image/test.png" mode="" /> | |||||
</swiper-item> | |||||
<swiper-item> | |||||
<image src="../../asset/image/test.png" mode="" /> | |||||
</swiper-item> | |||||
<swiper-item> | |||||
<image src="../../asset/image/test.png" mode="" /> | |||||
</swiper-item> | |||||
<swiper-item> | |||||
<image src="../../asset/image/test.png" mode="" /> | |||||
</swiper-item> | |||||
</swiper> |
@@ -6,8 +6,16 @@ import Dialog from '@vant/weapp/dialog/dialog'; | |||||
Page({ | Page({ | ||||
data: { | data: { | ||||
isLogin: false, | isLogin: false, | ||||
itemList: [1, 1, 1, 1, 1, 1], | |||||
showPrivacy: false | |||||
itemList: [ | |||||
{ id: 1 }, | |||||
{ id: 2 }, | |||||
{ id: 3 }, | |||||
{ id: 4 }, | |||||
{ id: 5 }, | |||||
{ id: 6 }, | |||||
], | |||||
showPrivacy: false, | |||||
avatarUrl: "../../asset/icon/logo-5.png" | |||||
}, | }, | ||||
// 事件处理函数 | // 事件处理函数 | ||||
@@ -94,16 +102,6 @@ Page({ | |||||
} | } | ||||
}, | }, | ||||
getUserProfile() { | |||||
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 | |||||
wx.getUserProfile({ | |||||
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 | |||||
success: (res) => { | |||||
console.log(res, 'getUserProfile') | |||||
} | |||||
}) | |||||
}, | |||||
getUserPhone(e) { | getUserPhone(e) { | ||||
const sessionKey = wx.getStorageSync('sessionKey') | const sessionKey = wx.getStorageSync('sessionKey') | ||||
this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId) | this.doGetUserPhone(e.detail.encryptedData, e.detail.iv, sessionKey, request.appId) | ||||
@@ -150,8 +148,12 @@ Page({ | |||||
}) | }) | ||||
}, | }, | ||||
goCheckImage(){ | |||||
goCheckImage(e) { | |||||
console.log(e, 'e'); | |||||
const id = e.currentTarget.dataset.id | |||||
wx.navigateTo({ | |||||
url: `/pages/checkImg/checkImg?id=${id}`, | |||||
}) | |||||
}, | }, | ||||
onShareAppMessage() { | onShareAppMessage() { | ||||
@@ -26,6 +26,14 @@ page { | |||||
padding-top: 60rpx; | padding-top: 60rpx; | ||||
z-index: -8; | z-index: -8; | ||||
.getUserinfo { | |||||
background-color: #ffffff00; | |||||
&::after { | |||||
border: none; | |||||
} | |||||
} | |||||
.avatar { | .avatar { | ||||
width: 220rpx; | width: 220rpx; | ||||
height: 220rpx; | height: 220rpx; | ||||
@@ -5,9 +5,9 @@ | |||||
</view> | </view> | ||||
<view class="content"> | <view class="content"> | ||||
<block bindtap="getUserProfile"> | |||||
<block> | |||||
<view class="avatar"> | <view class="avatar"> | ||||
<image src="../../asset/icon/logo-5.png" mode="" /> | |||||
<image src="{{ avatarUrl }}" mode="" /> | |||||
</view> | </view> | ||||
<view wx:if="{{ !isLogin }}" class="nickname">微信用户</view> | <view wx:if="{{ !isLogin }}" class="nickname">微信用户</view> | ||||
<view wx:if="{{ isLogin }}" class="nickname">用户名</view> | <view wx:if="{{ isLogin }}" class="nickname">用户名</view> | ||||
@@ -25,7 +25,7 @@ | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="photoList" bindtap="goCheckImage"> | |||||
<view class="photoList" bindtap="goCheckImage" data-id="{{ item.id }}"> | |||||
<image wx:for="{{[1,1,1,1]}}" wx:key="index" src="../../asset/image/test.png" mode="widthFix" /> | <image wx:for="{{[1,1,1,1]}}" wx:key="index" src="../../asset/image/test.png" mode="widthFix" /> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
@@ -7,15 +7,24 @@ Page({ | |||||
* 页面的初始数据 | * 页面的初始数据 | ||||
*/ | */ | ||||
data: { | data: { | ||||
topTitle: "请添加一张正面照片", | |||||
showScanLine: false, | |||||
isUploaded: false, | isUploaded: false, | ||||
tempFilePath: "" | |||||
isSuccess: false, | |||||
tempFilePath: "", | |||||
onlineFilePath: "", | |||||
id: "" | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad() { | |||||
onLoad(options) { | |||||
if (options.id) { | |||||
this.setData({ | |||||
id: options.id | |||||
}) | |||||
} | |||||
}, | }, | ||||
@@ -23,7 +32,6 @@ Page({ | |||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow() { | onShow() { | ||||
wx.hideHomeButton() | |||||
app.tokenCallBack = res => { | app.tokenCallBack = res => { | ||||
this.setData({ | this.setData({ | ||||
isLogin: res | isLogin: res | ||||
@@ -41,12 +49,139 @@ Page({ | |||||
success: res => { | success: res => { | ||||
that.setData({ | that.setData({ | ||||
tempFilePath: res.tempFiles[0].tempFilePath, | tempFilePath: res.tempFiles[0].tempFilePath, | ||||
isUploaded: true | |||||
showScanLine: true, | |||||
isUploaded: true, | |||||
isSuccess: false | |||||
}) | |||||
that.imgCheckByFace() | |||||
} | |||||
}) | |||||
}, | |||||
// 检查图片是否符合人脸规范 | |||||
imgCheckByFace() { | |||||
const that = this | |||||
const filePath = that.data.tempFilePath | |||||
const BaseUrl = request.baseUrl | |||||
wx.uploadFile({ | |||||
filePath, | |||||
url: BaseUrl + "/api/userDigital/checkPhoto", | |||||
name: 'file', | |||||
formData: { | |||||
user: "test", | |||||
}, | |||||
success: res => { | |||||
const code = JSON.parse(res.data).code | |||||
if (code == 200) { | |||||
that.imgCheckByBaidu() | |||||
} else { | |||||
that.setData({ | |||||
showScanLine: false | |||||
}) | |||||
wx.showToast({ | |||||
title: '图片不合规范,请重新上传', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
}, | |||||
fail: err => { | |||||
wx.showToast({ | |||||
title: '上传失败,请稍后再试', | |||||
icon: "none" | |||||
}) | }) | ||||
} | } | ||||
}) | }) | ||||
}, | }, | ||||
// 检查图片合法性 | |||||
imgCheckByBaidu() { | |||||
const that = this | |||||
const filePath = that.data.tempFilePath | |||||
const BaseUrl = request.baseUrl | |||||
wx.uploadFile({ | |||||
filePath, | |||||
url: BaseUrl + "/api/baidu/checkPhoto", | |||||
name: 'file', | |||||
formData: { | |||||
user: "test", | |||||
}, | |||||
success: res => { | |||||
const code = JSON.parse(res.data).code | |||||
if (code == 200) { | |||||
that.doUploadImg() | |||||
} else { | |||||
that.setData({ | |||||
showScanLine: false | |||||
}) | |||||
wx.showToast({ | |||||
title: '图片不合规范,请重新上传', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
}, | |||||
fail: err => { | |||||
wx.showToast({ | |||||
title: '上传失败,请稍后再试', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
// 上传图片 | |||||
doUploadImg() { | |||||
const that = this | |||||
const filePath = that.data.tempFilePath | |||||
const BaseUrl = request.baseUrl | |||||
wx.uploadFile({ | |||||
filePath, | |||||
url: BaseUrl + "/api/upload/awsImgUpload", | |||||
name: 'file', | |||||
formData: { | |||||
user: "test", | |||||
}, | |||||
header: { | |||||
"Content-Type": "multipart/form-data" | |||||
}, | |||||
success: res => { | |||||
console.log(res, 'res'); | |||||
const code = JSON.parse(res.data).code | |||||
if (code == 200) { | |||||
that.setData({ | |||||
showScanLine: false, | |||||
isSuccess: true | |||||
}) | |||||
wx.showToast({ | |||||
title: '上传成功!', | |||||
icon: "success" | |||||
}) | |||||
} else { | |||||
wx.showToast({ | |||||
title: '服务器繁忙,请稍后再试', | |||||
icon: "none" | |||||
}) | |||||
that.setData({ | |||||
showScanLine: false | |||||
}) | |||||
} | |||||
}, | |||||
fail: err => { | |||||
wx.showToast({ | |||||
title: '上传失败,请稍后再试', | |||||
icon: "none" | |||||
}) | |||||
} | |||||
}) | |||||
}, | |||||
// 确认照片 | |||||
confirmImage() { | |||||
}, | |||||
/** | /** | ||||
* 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
*/ | */ | ||||
@@ -15,11 +15,33 @@ page { | |||||
.uploadArea { | .uploadArea { | ||||
position: relative; | position: relative; | ||||
width: 60%; | width: 60%; | ||||
height: 700rpx; | |||||
height: 600rpx; | |||||
background-color: #393b3d; | background-color: #393b3d; | ||||
margin: 50rpx auto; | margin: 50rpx auto; | ||||
border-radius: 40rpx; | border-radius: 40rpx; | ||||
@keyframes scanAnimation { | |||||
0% { | |||||
transform: translateY(-100%); | |||||
} | |||||
100% { | |||||
transform: translateY(150%); | |||||
} | |||||
} | |||||
.scanLine { | |||||
position: absolute; | |||||
top: 0; | |||||
left: 0; | |||||
width: 100%; | |||||
height: 40%; | |||||
background: linear-gradient(180deg, rgba(0, 255, 51, 0) 50%, #00ff33 300%); | |||||
border-bottom: 2px solid #00ff33; | |||||
animation: scanAnimation 2s linear infinite; | |||||
z-index: 9; | |||||
} | |||||
.scanBorder { | .scanBorder { | ||||
position: absolute; | position: absolute; | ||||
top: 50%; | top: 50%; | ||||
@@ -42,7 +64,7 @@ page { | |||||
top: 50%; | top: 50%; | ||||
left: 50%; | left: 50%; | ||||
transform: translate(-50%, -50%); | transform: translate(-50%, -50%); | ||||
width: 78%; | |||||
width: 70%; | |||||
} | } | ||||
} | } | ||||
@@ -59,6 +81,22 @@ page { | |||||
margin: auto; | margin: auto; | ||||
} | } | ||||
.reUpload { | |||||
width: 70%; | |||||
height: 100rpx; | |||||
line-height: 100rpx; | |||||
font-weight: 600; | |||||
background-color: #292929; | |||||
color: #ff4f00; | |||||
font-size: 32rpx; | |||||
text-align: center; | |||||
border-radius: 50rpx; | |||||
margin: auto; | |||||
border: 1px solid #ff4f00; | |||||
box-sizing: border-box; | |||||
margin-top: 30rpx; | |||||
} | |||||
.notice { | .notice { | ||||
margin-top: 50rpx; | margin-top: 50rpx; | ||||
@@ -1,15 +1,21 @@ | |||||
<!--pages/upload/upload.wxml--> | <!--pages/upload/upload.wxml--> | ||||
<view class="content"> | <view class="content"> | ||||
<view class="title">请添加一整正脸照片</view> | |||||
<view class="title">{{ topTitle }}</view> | |||||
<view class="uploadArea" bindtap="chooseImage"> | <view class="uploadArea" bindtap="chooseImage"> | ||||
<view wx:if="{{ showScanLine }}" class="scanLine"></view> | |||||
<image class="scanBorder" src="../../asset/icon/scanBorder.png" mode="" /> | <image class="scanBorder" src="../../asset/icon/scanBorder.png" mode="" /> | ||||
<image wx:if="{{ !isUploaded }}" class="addBtn" src="../../asset/icon/add.png" mode="widthFix" /> | <image wx:if="{{ !isUploaded }}" class="addBtn" src="../../asset/icon/add.png" mode="widthFix" /> | ||||
<image wx:if="{{ isUploaded }}" class="chooseImage" src="{{ tempFilePath }}" mode="widthFix" /> | <image wx:if="{{ isUploaded }}" class="chooseImage" src="{{ tempFilePath }}" mode="widthFix" /> | ||||
</view> | </view> | ||||
<view> | |||||
<block wx:if="{{ !isSuccess }}"> | |||||
<button class="uploadImgBtn" bindtap="chooseImage">上传照片</button> | <button class="uploadImgBtn" bindtap="chooseImage">上传照片</button> | ||||
</view> | |||||
</block> | |||||
<block wx:if="{{ isSuccess }}"> | |||||
<button class="uploadImgBtn" bindtap="confirmImage">就这张了</button> | |||||
<button class="reUpload" bindtap="chooseImage">重新上传</button> | |||||
</block> | |||||
<view class="notice"> | <view class="notice"> | ||||
<view class="text">请参考范例上传五官清晰的照片</view> | <view class="text">请参考范例上传五官清晰的照片</view> | ||||
@@ -1,5 +1,3 @@ | |||||
const url = 'https://zhixiangtest.malls.iformall.com/C' | |||||
class request { | class request { | ||||
constructor(address) { | constructor(address) { | ||||
if (address) { | if (address) { | ||||
@@ -9,10 +7,17 @@ class request { | |||||
/** | /** | ||||
* 配置 | * 配置 | ||||
*/ | */ | ||||
/** | |||||
* @description 基地址 | |||||
* @returns {string} https://zhixiangtest.malls.iformall.com/C | |||||
*/ | |||||
baseUrl = 'https://zhixiangtest.malls.iformall.com/C' | |||||
/** | /** | ||||
* 请求路径前缀 | * 请求路径前缀 | ||||
*/ | */ | ||||
address = url; | |||||
address = 'https://zhixiangtest.malls.iformall.com/C'; | |||||
/** | /** | ||||
* 请求头 | * 请求头 | ||||
*/ | */ | ||||
@@ -19,7 +19,14 @@ | |||||
{ | { | ||||
"name": "", | "name": "", | ||||
"pathName": "pages/upload/upload", | "pathName": "pages/upload/upload", | ||||
"query": "", | |||||
"query": "id=123456", | |||||
"launchMode": "default", | |||||
"scene": null | |||||
}, | |||||
{ | |||||
"name": "", | |||||
"pathName": "pages/checkImg/checkImg", | |||||
"query": "id=1", | |||||
"launchMode": "default", | "launchMode": "default", | ||||
"scene": null | "scene": null | ||||
} | } | ||||
@@ -33,6 +33,7 @@ | |||||
"miniprogram/pages/payOrder/payOrder.js", | "miniprogram/pages/payOrder/payOrder.js", | ||||
"miniprogram/pages/login/login.js", | "miniprogram/pages/login/login.js", | ||||
"miniprogram/pages/upload/upload.js", | "miniprogram/pages/upload/upload.js", | ||||
"miniprogram/pages/checkImg/checkImg.js", | |||||
], | ], | ||||
"exclude": [ | "exclude": [ | ||||
"node_modules" | "node_modules" | ||||