Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
wechatapp.shangjiadao.com
Project
Project
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
wangxuelai
wechatapp.shangjiadao.com
Commits
8ab90d40
Commit
8ab90d40
authored
May 06, 2020
by
wangxuelai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
's'
parent
8636be9c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
83 deletions
+135
-83
index.js
src/components/clockitemv2/index.js
+1
-1
index.js
src/pages/commenteditor/index.js
+134
-82
No files found.
src/components/clockitemv2/index.js
View file @
8ab90d40
...
...
@@ -225,7 +225,7 @@ Component({
const
customerId
=
LocalStorage
.
getItem
(
'visitor'
)
&&
LocalStorage
.
getItem
(
'visitor'
).
studentId
;
const
that
=
this
;
wx
.
navigateTo
({
url
:
`/src/pages/commenteditor/index?id=
${
that
.
data
.
cid
}
&ptype=2&
&tid=
${
that
.
data
.
tid
}
&cid=
${
that
.
data
.
clock
.
id
}
&eid=
${
dataset
.
eid
}
&roottype=
${
dataset
.
roottype
}
`
,
url
:
`/src/pages/commenteditor/index?id=
${
that
.
data
.
cid
}
&ptype=2&
tid=
${
that
.
data
.
tid
}
&cid=
${
that
.
data
.
clock
.
id
}
&eid=
${
dataset
.
eid
}
&roottype=
${
dataset
.
roottype
}
&sid=
${
this
.
data
.
clock
.
school_id
}
`
,
})
},
// 关于老师的点评回复操作
...
...
src/pages/commenteditor/index.js
View file @
8ab90d40
...
...
@@ -35,7 +35,8 @@ Page({
imageRoot
:
app
.
globalData
.
imageRoot
,
imageVersion
:
app
.
globalData
.
imageVersion
,
tid
:
0
,
// 主题ID
cid
:
0
,
// 打卡记录ID
cid
:
0
,
// 打卡记录ID\
sid
:
0
,
maxLength
:
200
,
maxImgCount
:
9
,
maxVideoCount
:
9
,
...
...
@@ -87,13 +88,14 @@ Page({
},
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
const
{
cid
,
tid
,
ptype
,
eid
,
roottype
}
=
options
;
const
{
sid
,
cid
,
tid
,
ptype
,
eid
,
roottype
}
=
options
;
this
.
setData
({
cid
,
tid
,
p_type
:
ptype
,
pid
:
eid
,
roottype
roottype
,
sid
})
},
onShow
:
function
()
{
// Do something when page show.
...
...
@@ -123,9 +125,13 @@ Page({
})
},
addImg
()
{
// 添加图片的操作
addImg
(
e
,
wxFile
)
{
// 添加图片的操作
let
imgCount
=
this
.
data
.
imageBox
.
filter
(
ele
=>
ele
.
type
==
'image'
).
length
;
if
(
imgCount
>=
this
.
data
.
maxImgCount
)
{
// 当等于10条了不能继续添加
wx
.
showToast
({
title
:
`上传图片不能超过
${
this
.
data
.
maxImgCount
}
张`
,
icon
:
'none'
})
return
}
else
{
if
(
!
this
.
data
.
imageUploaded
)
{
...
...
@@ -146,12 +152,17 @@ Page({
this
.
setData
({
imageUploaded
:
false
})
cOssAccess
().
then
((
acc
)
=>
{
access
=
acc
.
data
;
return
wxChooseImage
({
let
myPromise
=
null
;
if
(
wxFile
)
{
myPromise
=
new
Promise
((
resolve
)
=>
{
resolve
(
wxFile
);
})
}
else
{
myPromise
=
wxChooseImage
({
count
:
this
.
data
.
maxImgCount
-
imgCount
})
}).
then
((
res
)
=>
{
}
myPromise
.
then
((
res
)
=>
{
const
{
tempFiles
}
=
res
;
let
imageBox
=
this
.
data
.
imageBox
;
this
.
setData
({
...
...
@@ -178,47 +189,65 @@ Page({
this
.
setData
({
imageBox
:
res
.
imageBox
,
})
this
.
singleUploadFile
(
access
)
this
.
singleUploadFile
()
}).
catch
((
e
)
=>
{
wx
.
hideLoading
()
})
},
singleUploadFile
(
access
)
{
singleUploadFile
()
{
wx
.
showLoading
({
title
:
'图片上传中...'
,
mask
:
true
})
let
access
=
{};
let
imageBox
=
this
.
data
.
imageBox
;
if
(
this
.
data
.
currentIndex
==
(
imageBox
.
length
))
{
wx
.
hideLoading
();
this
.
setData
({
imageUploaded
:
true
})
if
(
this
.
data
.
activtySchoolInfo
.
plan
==
'planb'
&&
this
.
data
.
activtySchoolInfo
.
tid
==
this
.
data
.
tid
)
{
this
.
judgeContentQualified
();
}
return
;
}
let
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
imageBox
[
this
.
data
.
currentIndex
].
src
)}
`
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'resolving'
;
this
.
setData
({
imageBox
})
wxUploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
filename
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
imageBox
[
this
.
data
.
currentIndex
].
src
,
name
:
'file'
,
const
path
=
imageBox
[
this
.
data
.
currentIndex
].
src
;
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
);
cOssAccess
({
school_id
:
this
.
data
.
sid
,
ext
:
fileType
}).
then
((
acc
)
=>
{
if
(
acc
.
code
==
200
)
{
access
=
acc
.
data
;
return
wxUploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
access
.
path
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
imageBox
[
this
.
data
.
currentIndex
].
src
,
name
:
'file'
,
})
}
}).
then
((
res
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
status
==
'ok'
)
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fullfilled'
;
imageBox
[
this
.
data
.
currentIndex
].
src
=
filename
;
imageBox
[
this
.
data
.
currentIndex
].
src
=
access
.
path
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
else
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
...
...
@@ -226,16 +255,17 @@ Page({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
}).
catch
(()
=>
{
}).
catch
((
e
)
=>
{
console
.
log
(
'ddddddddddddddddddddd失败'
)
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
})
},
delimg
(
e
)
{
...
...
@@ -396,18 +426,28 @@ Page({
})
this
.
addVideoMethod
();
},
addVideoMethod
()
{
// 添加视频的操作
addVideoMethod
(
e
,
wxFile
)
{
// 添加视频的操作
const
that
=
this
;
let
access
=
{};
let
filename
=
''
;
cMediaOssAccess
({
type
:
1
}).
then
((
res
)
=>
{
access
=
res
.
data
;
return
wxChooseVideo
({
let
videoInsertIndex
=
0
;
let
imageBox
=
this
.
data
.
imageBox
;
let
size
=
0
;
let
duration
=
0
;
let
tempFilePath
=
''
;
let
myPromise
=
null
;
if
(
wxFile
)
{
myPromise
=
new
Promise
((
resolve
)
=>
{
resolve
(
wxFile
);
})
}).
then
((
res
)
=>
{
const
{
tempFilePath
,
duration
,
size
}
=
res
;
}
else
{
myPromise
=
wxChooseVideo
({
})
}
myPromise
.
then
((
res
)
=>
{
size
=
res
.
size
;
duration
=
res
.
duration
;
tempFilePath
=
res
.
tempFilePath
;
if
(
duration
>
constants
.
videoConf
.
duration
)
{
wx
.
showModal
({
title
:
'提示'
,
...
...
@@ -426,58 +466,70 @@ Page({
})
return
}
let
imageBox
=
this
.
data
.
imageBox
let
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
imageBox
.
splice
(
videoInsertIndex
,
0
,
{
src
:
tempFilePath
,
status
:
'resolving'
,
type
:
'video'
,
size
:
size
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
const
path
=
tempFilePath
;
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
return
cMediaOssAccess
({
school_id
:
this
.
data
.
sid
,
type
:
1
})
that
.
setData
({
imageBox
})
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
tempFilePath
)}
`
;
that
.
uploadVideoTask
=
wx
.
uploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
filename
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
tempFilePath
,
name
:
'file'
,
success
(
res
)
{
const
{
data
}
=
res
;
if
(
data
==
'{"status":"ok"}'
)
{
let
imageBox
=
that
.
data
.
imageBox
;
imageBox
[
videoInsertIndex
].
src
=
filename
;
imageBox
[
videoInsertIndex
].
status
=
'fullfilled'
;
imageBox
[
videoInsertIndex
].
videoprogress
=
100
;
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
access
=
res
.
data
;
imageBox
.
splice
(
videoInsertIndex
,
0
,
{
src
:
access
.
path
,
status
:
'resolving'
,
type
:
'video'
,
size
:
size
,
mode
:
'm3u8'
})
that
.
setData
({
imageBox
})
that
.
data
.
uploadVideoTask
[
`
${
access
.
path
}
`
]
=
wx
.
uploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
access
.
path
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
tempFilePath
,
name
:
'file'
,
success
(
res
)
{
const
{
data
}
=
res
;
if
(
data
==
'{"status":"ok"}'
)
{
let
imageBox
=
that
.
data
.
imageBox
;
imageBox
[
videoInsertIndex
].
src
=
access
.
path
;
imageBox
[
videoInsertIndex
].
status
=
'fullfilled'
;
imageBox
[
videoInsertIndex
].
videoprogress
=
100
;
that
.
setData
({
imageBox
:
imageBox
},
()
=>
{
if
(
that
.
data
.
activtySchoolInfo
.
plan
==
'planb'
&&
that
.
data
.
activtySchoolInfo
.
tid
==
that
.
data
.
tid
)
{
that
.
judgeContentQualified
();
}
})
}
else
{
that
.
setData
({
[
`imageBox[
${
videoInsertIndex
}
].status`
]:
'fail'
})
}
},
fail
(
e
)
{
}
})
if
(
that
.
data
.
uploadVideoTask
[
`
${
access
.
path
}
`
].
onProgressUpdate
)
{
that
.
data
.
uploadVideoTask
[
`
${
access
.
path
}
`
].
onProgressUpdate
((
res
)
=>
{
imageBox
[
videoInsertIndex
].
videoprogress
=
res
.
progress
>
95
?
95
:
res
.
progress
;
that
.
setData
({
imageBox
:
imageBox
})
}
else
{
that
.
setData
({
videostatus
:
'fail'
})
}
},
fail
()
{
that
.
setData
({
videostatus
:
'fail'
})
}
})
that
.
uploadVideoTask
.
onProgressUpdate
((
res
)
=>
{
imageBox
[
videoInsertIndex
].
videoprogress
=
res
.
progress
>
95
?
95
:
res
.
progress
;
that
.
setData
({
imageBox
:
imageBox
})
})
}
}).
catch
((
err
)
=>
{
wx
.
hideLoading
();
});
...
...
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