=chenming 5 years ago
parent
commit
0720b1dc5e
3 changed files with 40 additions and 27 deletions
  1. +28
    -24
      496_dongfengqichen/pages/scout/register/register.js
  2. +2
    -1
      496_dongfengqichen/pages/scout/register/register.wxml
  3. +10
    -2
      496_dongfengqichen/pages/scout/register/register.wxss

+ 28
- 24
496_dongfengqichen/pages/scout/register/register.js View File

@@ -80,8 +80,6 @@ Page({
* 提交信息-注册
*/
formSubmit2(e) {
console.log(this.data.cityList[0][e.detail.value.city[0]]);
return;
console.log('form发生了submit事件,携带数据为:', e.detail.value)
if (e.detail.value.name == "" || e.detail.value.name == null) {
wx.showToast({icon:'none',title: '请输入您的姓名'})
@@ -228,34 +226,33 @@ Page({
chooseImage(e){
var list=this.data.photoList;
wx.chooseImage({
count:1,
count: 3-this.data.photoList.length,
sizeType: ['original'], //可选择原图
sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
success: res => {
wx.uploadFile({
url: app.globalData.urlRoot + "upload/uploadImage",
header:{"OPENID": app.globalData.openid},
filePath: res.tempFilePaths[0],
name: "file",
success: res => {
console.log(res)
if(res.data){
console.log(JSON.parse(res.data));
var json=JSON.parse(res.data);
if(json.code==200){
console.log(json.data[0].url);
if(e.currentTarget.dataset.value>-1){
list[e.currentTarget.dataset.value]=json.data[0].url;
}else{
list.push(json.data[0].url);
for (let i = 0; i < res.tempFilePaths.length; i++) {
wx.uploadFile({
url: app.globalData.urlRoot + "upload/uploadImage",
header: { "OPENID": app.globalData.openid },
filePath: res.tempFilePaths[i],
name: "file",
success: res => {
if (res.data) {
var json = JSON.parse(res.data);
if (json.code == 200) {
if (e.currentTarget.dataset.value > -1) {
list[e.currentTarget.dataset.value] = json.data[0].url;
} else {
list.push(json.data[0].url);
}
this.setData({ photoList: list });
} else {
wx.showToast({ icon: 'none', title: '图片上传失败' })
}
this.setData({photoList:list});
}else{
wx.showToast({icon:'none',title: '图片上传失败'})
}
}
}
})
})
}
}
})
},
@@ -429,5 +426,12 @@ Page({
*/
onShareAppMessage: function() {
return app.sharePack();
},
deleteImg:function(e){
var index = e.currentTarget.dataset.index;
this.data.photoList.splice(index,1);
this.setData({
photoList: this.data.photoList
})
}
})

+ 2
- 1
496_dongfengqichen/pages/scout/register/register.wxml View File

@@ -54,8 +54,9 @@
</view>
<view class="upPhotoTitle">请上传您的照片:</view>
<view class="upPhonoBox">
<view class="phontBox" wx:for="{{photoList}}" wx:key="*this" wx:if="{{photoList.length>0}}" bindtap="chooseImage"data-value="{{index}}">
<view class="phontBox" wx:for="{{photoList}}" wx:key="*this" wx:if="{{photoList.length>0}}" data-value="{{index}}">
<image src="{{item}}" mode="aspectFill" ></image>
<image bindtap="deleteImg" data-index="{{index}}" class="gameRuleClose" src="{{imgUrl+'/images/gameRuleClose.png'}}"></image>
</view>
<image class="upPhontBtn" wx:if="{{photoList.length<3}}" src="{{imgUrl+'/star/scout/register/upBtn.png'}}" bindtap="chooseImage"></image>
</view>

+ 10
- 2
496_dongfengqichen/pages/scout/register/register.wxss View File

@@ -169,10 +169,18 @@ image.arrowDown{
margin: 10rpx 25rpx;
}
.NoVehicle>.upPhonoBox>.phontBox{
position: relative;
width: 125rpx;
height: 125rpx;
margin: 10rpx 25rpx;
}
.NoVehicle>.upPhonoBox>.phontBox>.gameRuleClose{
position: absolute;
top: -15rpx;
right: -15rpx;
width: 31rpx;
height: 29rpx;
}
.NoVehicle>.upPhonoBox>.phontBox>image{
width: 100%;
height: 100%;
@@ -206,11 +214,11 @@ image.arrowDown{
}
.mask {
position: absolute;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
height: calc(100% - 150rpx);
display: flex;
align-items: center;
justify-content: center;

Loading…
Cancel
Save