Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
990b8215
You need to sign in or sign up before continuing.
Commit
990b8215
authored
Aug 28, 2019
by
赵雅纹
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-zyw-sc' into 'dev_7.1.0'
Feature zyw sc See merge request
!88
parents
1b001430
f52d1736
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
162 additions
and
79 deletions
+162
-79
uploadImg.js
src/component/uploadImg/uploadImg.js
+35
-20
uploadVideo.js
src/component/uploadVideo/uploadVideo.js
+46
-4
uploadVideo.wxml
src/component/uploadVideo/uploadVideo.wxml
+2
-1
uploadVideo.wxss
src/component/uploadVideo/uploadVideo.wxss
+13
-2
refund.js
src/pages/refund/refund.js
+5
-44
refund.wxml
src/pages/refund/refund.wxml
+1
-1
grassCommunity.js
src/subPackage/page/pages/grassCommunity/grassCommunity.js
+50
-5
grassCommunity.wxml
src/subPackage/page/pages/grassCommunity/grassCommunity.wxml
+2
-1
grassCommunity.wxss
src/subPackage/page/pages/grassCommunity/grassCommunity.wxss
+8
-1
No files found.
src/component/uploadImg/uploadImg.js
View file @
990b8215
// component/uploadImg/uploadImg.js
var
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
Component
({
/**
* 组件的属性列表
...
...
@@ -33,21 +37,23 @@ Component({
chooseImg
(){
let
that
=
this
;
let
pics
=
this
.
data
.
pics
;
var
url
=
envInfo
.
ctx
+
'/merchant/upload/pic'
wx
.
chooseImage
({
count
:
5
-
pics
.
length
,
// 最多可以选择的图片5张,
sizeType
:
[
'original'
,
'compressed'
],
// original 原图,compressed 压缩图,默认二者都有
sourceType
:
[
'album'
,
'camera'
],
// album 从相册选图,camera 使用相机,默认二者都有
success
:
function
(
res
)
{
var
imgsrc
=
res
.
tempFilePaths
;
pics
=
pics
.
concat
(
imgsrc
);
var
imgsrcs
=
res
.
tempFilePaths
;
imgsrcs
.
forEach
(
src
=>
{
pics
.
push
(
src
);
});
that
.
setData
({
pics
:
pics
});
console
.
log
(
that
.
data
.
pics
)
// that.moreImgUpload({
// url: 'https://........',//这里是你图片上传的接口
// path: that.data.pics//这里是选取的图片的地址数组
// });
that
.
moreImgUpload
({
url
:
url
,
//这里是你图片上传的接口
path
:
imgsrcs
//这里是选取的图片的地址数组
});
},
fail
:
function
()
{
// fail
...
...
@@ -67,26 +73,35 @@ Component({
wx
.
uploadFile
({
url
:
data
.
url
,
filePath
:
data
.
path
[
i
],
name
:
'
file
'
,
//这里根据自己的实际情况改
name
:
'
imgs
'
,
//这里根据自己的实际情况改
formData
:
null
,
//这里是上传图片时一起上传的数据
success
:
(
resp
)
=>
{
success
++
;
//图片上传成功,图片上传成功的变量+1
console
.
log
(
resp
)
console
.
log
(
i
);
//这里可能有BUG,失败也会执行这里,所以这里应该是后台返回过来的状态码为成功时,这里的success才+1
header
:
{
'buyer-token'
:
wx
.
getStorageSync
(
'token'
)
},
success
:
(
res
)
=>
{
if
(
res
.
statusCode
==
200
)
{
var
imgdata
=
JSON
.
parse
(
res
.
data
);
var
img
=
imgdata
.
data
[
0
];
success
++
;
//图片上传成功,图片上传成功的变量+1
// this.data.params.sspList.push({
// cover: 0,
// url: img.url
// });
// that.setData({
// 'params.sspList': this.data.params.sspList
// })
wxService
.
nextTick
(()
=>
{
that
.
triggerEvent
(
'_uploadImg'
,
img
)
})
}
},
fail
:
(
res
)
=>
{
fail
++
;
//图片上传失败,图片上传失败的变量+1
console
.
log
(
'fail:'
+
i
+
"fail:"
+
fail
);
},
complete
:
()
=>
{
console
.
log
(
i
);
i
++
;
//这个图片执行完上传后,开始上传下一张
if
(
i
==
data
.
path
.
length
)
{
//当图片传完时,停止调用
console
.
log
(
'执行完毕'
);
console
.
log
(
'成功:'
+
success
+
" 失败:"
+
fail
);
}
else
{
//若图片还没有传完,则继续调用函数
console
.
log
(
i
);
if
(
i
==
data
.
path
.
length
)
{
//当图片传完时,停止调用
}
else
{
//若图片还没有传完,则继续调用函数
data
.
i
=
i
;
data
.
success
=
success
;
data
.
fail
=
fail
;
...
...
src/component/uploadVideo/uploadVideo.js
View file @
990b8215
// component/uploadVideo/uploadVideo.js
var
app
=
getApp
()
const
wxService
=
require
(
'../../utils/wxService'
)
const
utils
=
require
(
'../../utils/util'
)
const
envInfo
=
require
(
'../../config/index'
).
envInfo
Component
({
/**
* 组件的属性列表
*/
properties
:
{
video
:{
// 显示视频
type
:
String
,
value
:
''
}
},
/**
...
...
@@ -21,9 +28,43 @@ Component({
*/
methods
:
{
//点击上传图片
uploadVideo
(){
console
.
log
(
'1111'
)
this
.
chooseVideo
()
uploadVideo
(
src
){
console
.
log
(
envInfo
)
var
url
=
envInfo
.
ctx
+
'/merchant/upload/file'
var
that
=
this
console
.
log
(
url
)
wx
.
uploadFile
({
url
:
url
,
//服务器接口
// method: 'POST',//这句话好像可以不用
filePath
:
src
,
header
:
{
'content-type'
:
'multipart/form-data'
,
'buyer-token'
:
wx
.
getStorageSync
(
'token'
)
},
name
:
'files'
,
//服务器定义的Key值
success
:
function
(
res
)
{
if
(
res
.
statusCode
==
200
){
var
imgdata
=
JSON
.
parse
(
res
.
data
);
var
img
=
imgdata
.
data
[
0
];
console
.
log
(
img
)
wxService
.
nextTick
(()
=>
{
that
.
triggerEvent
(
'_uploadVideo'
,
img
)
})
}
},
fail
:
function
()
{
}
})
},
// 刪除視頻
deleteImage
()
{
this
.
setData
({
video
:
''
})
wxService
.
nextTick
(()
=>
{
this
.
triggerEvent
(
'_deleteVideo'
,
true
)
})
},
//选取图片
...
...
@@ -40,6 +81,7 @@ Component({
that
.
setData
({
video
:
video
})
that
.
uploadVideo
(
that
.
data
.
video
)
}
})
}
...
...
src/component/uploadVideo/uploadVideo.wxml
View file @
990b8215
<!--component/uploadVideo/uploadVideo.wxml-->
<view class="page-upload-img">
<view class="video_area" wx:if="{{video}}">
<icon size="16" type="clear" catchtap="deleteImage" />
<video class="video_item" src="{{video}}" controls></video>
<!-- 防止视频组件层级太高,导致部分机型覆盖悬浮按钮 -->
<!-- <cover-image
...
...
@@ -11,7 +12,7 @@
/>-->
</view>
<view class="upload-wrap" wx:if="{{!video}}" bindtap="
upload
Video">
<view class="upload-wrap" wx:if="{{!video}}" bindtap="
choose
Video">
<view class="upload-text">+视频</view>
</view>
</view>
...
...
src/component/uploadVideo/uploadVideo.wxss
View file @
990b8215
...
...
@@ -29,4 +29,15 @@
.video_delete {
width: 160rpx;
height: 160rpx;
}
\ No newline at end of file
}
.video_area{
position: relative;
}
.video_area icon {
position: absolute;
right: -10rpx;
top: -10rpx;
background: #ffffff;
border-radius: 50%;
z-index: 99;
}
\ No newline at end of file
src/pages/refund/refund.js
View file @
990b8215
...
...
@@ -110,51 +110,12 @@ wxService.page({
})
},
chooseImage
:
function
(
event
)
{
// 选择图片
// wx.chooseImage({
// count: 1,
// success: res => {
// var tempFilePaths = res.tempFilePaths
// wx.uploadFile({
// url: app.globalData.ctx + 'returnOrder/uploadReturnGoodsImg',
// filePath: tempFilePaths[0],
// header: { token: wx.getStorageSync('token') },
// name: 'file',
// success: res_ => {
// this.setData({
// imageDomain: JSON.parse(res_.data).data.imageDomain,
// tempFilePaths: this.data.tempFilePaths.concat(JSON.parse(res_.data).data.imageDomain + JSON.parse(res_.data).data.imgPath)
// })
// }
// })
// }
// })
let
that
=
this
;
let
tempFilePaths
=
this
.
data
.
tempFilePaths
;
wx
.
chooseImage
({
count
:
5
-
tempFilePaths
.
length
,
// 最多可以选择的图片5张,
sizeType
:
[
'original'
,
'compressed'
],
// original 原图,compressed 压缩图,默认二者都有
sourceType
:
[
'album'
,
'camera'
],
// album 从相册选图,camera 使用相机,默认二者都有
success
:
function
(
res
)
{
var
imgsrc
=
res
.
tempFilePaths
;
tempFilePaths
=
tempFilePaths
.
concat
(
imgsrc
);
that
.
setData
({
tempFilePaths
:
tempFilePaths
});
console
.
log
(
that
.
data
.
tempFilePaths
)
// that.moreImgUpload({
// url: 'https://........',//这里是你图片上传的接口
// path: that.data.pics//这里是选取的图片的地址数组
// });
},
fail
:
function
()
{
// fail
},
complete
:
function
()
{
// complete
}
})
// 上传图片
_uploadImg
(
e
){
console
.
log
(
e
)
},
checkPro
(
e
)
{
var
index
=
e
.
currentTarget
.
dataset
.
index
const
{
cartList
}
=
this
.
data
...
...
src/pages/refund/refund.wxml
View file @
990b8215
...
...
@@ -76,7 +76,7 @@
<text class="img-number">最多5张</text>
</view>
<view class="form-input">
<upload-img/>
<upload-img
bind:_uploadImg="_uploadImg"
/>
</view>
</view>
</view>
...
...
src/subPackage/page/pages/grassCommunity/grassCommunity.js
View file @
990b8215
...
...
@@ -3,7 +3,7 @@ const app = getApp()
const
wxService
=
require
(
'../../../../utils/wxService'
)
const
utils
=
require
(
'../../../../utils/util'
)
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
envInfo
=
require
(
'../../../../config/index'
).
envInfo
wxService
.
page
({
...
...
@@ -21,6 +21,7 @@ wxService.page({
stcList
:
[],
userId
:
memberId
},
video
:
''
,
pageNo
:
1
,
pageSize
:
100
},
...
...
@@ -65,7 +66,14 @@ wxService.page({
}
})
for
(
var
i
in
data
.
sspList
){
this
.
data
.
pics
.
push
(
app
.
globalData
.
imageUrl
+
data
.
sspList
[
i
].
url
)
if
(
data
.
sspList
[
i
].
url
){
this
.
data
.
pics
.
push
(
app
.
globalData
.
imageUrl
+
data
.
sspList
[
i
].
url
)
}
if
(
data
.
sspList
[
i
].
videoUrl
){
this
.
setData
({
video
:
app
.
globalData
.
imageUrl
+
data
.
sspList
[
i
].
videoUrl
})
}
}
this
.
setData
({
...
...
@@ -101,6 +109,8 @@ wxService.page({
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
...
...
@@ -120,6 +130,7 @@ wxService.page({
chooseImg
(){
let
that
=
this
;
let
pics
=
this
.
data
.
pics
;
var
url
=
envInfo
.
ctx
+
'/merchant/upload/pic'
wx
.
chooseImage
({
count
:
5
-
pics
.
length
,
// 最多可以选择的图片5张,
sizeType
:
[
'original'
,
'compressed'
],
// original 原图,compressed 压缩图,默认二者都有
...
...
@@ -134,7 +145,7 @@ wxService.page({
});
// console.log(',..............',that.data.pics)
that
.
moreImgUpload
({
url
:
'http://buyer.devapi.bigaka.net/merchant/upload/pic'
,
//这里是你图片上传的接口
url
:
url
,
//这里是你图片上传的接口
path
:
imgsrcs
//这里是选取的图片的地址数组
});
},
...
...
@@ -149,7 +160,6 @@ wxService.page({
// 关联商品
_selectGoods
(
e
){
console
.
log
(
'444'
,
e
)
this
.
setData
({
proGoods
:
e
.
detail
})
...
...
@@ -192,7 +202,6 @@ wxService.page({
that
.
setData
({
'params.sspList'
:
this
.
data
.
params
.
sspList
})
console
.
log
(
'
\\\\\\\\\\\
\'
, that.data.params.sspList)
}
},
fail
:
(
res
)
=>
{
...
...
@@ -212,6 +221,42 @@ wxService.page({
}
})
},
// 删除图片
deleteImage
(
event
)
{
var
pics
=
this
.
data
.
pics
pics
.
splice
(
event
.
currentTarget
.
dataset
.
index
,
1
)
this
.
setData
({
pics
:
pics
})
var
sspList
=
this
.
data
.
params
.
sspList
for
(
var
i
in
sspList
)
{
if
(
sspList
[
i
].
url
)
{
sspList
.
splice
(
event
.
currentTarget
.
dataset
.
index
,
1
)
}
}
},
// 上传视频
_uploadVideo
(
e
){
console
.
log
(
e
)
this
.
data
.
params
.
sspList
.
push
({
cover
:
0
,
videoUrl
:
e
.
detail
});
},
// 删除视频
_deleteVideo
(
e
){
var
sspList
=
this
.
data
.
params
.
sspList
for
(
var
i
in
sspList
){
if
(
sspList
[
i
].
videoUrl
){
console
.
log
(
i
)
sspList
.
splice
(
i
,
1
)
}
}
},
// 发布笔记
formSubmit
(
e
){
...
...
src/subPackage/page/pages/grassCommunity/grassCommunity.wxml
View file @
990b8215
...
...
@@ -4,6 +4,7 @@
<view class="page-upload-img">
<view class="flex-wrp">
<view class="flex-item" wx:for="{{pics}}" wx:key="{{index}}">
<icon size="16" type="clear" catchtap="deleteImage" data-index="{{index}}" />
<image class="item-img" src="{{item}}" />
</view>
<view class="flex-item" hidden="{{pics.length >= 5}}">
...
...
@@ -12,7 +13,7 @@
</view>
</view>
<view class="flex-item">
<upload-video/>
<upload-video
bind:_uploadVideo="_uploadVideo" bind:_deleteVideo="_deleteVideo" video="{{video}}"
/>
</view>
</view>
</view>
...
...
src/subPackage/page/pages/grassCommunity/grassCommunity.wxss
View file @
990b8215
...
...
@@ -86,6 +86,13 @@ page{
width: 21%;
height: 160rpx;
margin-left: 20rpx;
}
position: relative;
}
.flex-item icon {
position: absolute;
right: -10rpx;
top: -10rpx;
background: #ffffff;
border-radius: 50%; }
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment