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({
...
@@ -225,7 +225,7 @@ Component({
const
customerId
=
LocalStorage
.
getItem
(
'visitor'
)
&&
LocalStorage
.
getItem
(
'visitor'
).
studentId
;
const
customerId
=
LocalStorage
.
getItem
(
'visitor'
)
&&
LocalStorage
.
getItem
(
'visitor'
).
studentId
;
const
that
=
this
;
const
that
=
this
;
wx
.
navigateTo
({
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({
...
@@ -35,7 +35,8 @@ Page({
imageRoot
:
app
.
globalData
.
imageRoot
,
imageRoot
:
app
.
globalData
.
imageRoot
,
imageVersion
:
app
.
globalData
.
imageVersion
,
imageVersion
:
app
.
globalData
.
imageVersion
,
tid
:
0
,
// 主题ID
tid
:
0
,
// 主题ID
cid
:
0
,
// 打卡记录ID
cid
:
0
,
// 打卡记录ID\
sid
:
0
,
maxLength
:
200
,
maxLength
:
200
,
maxImgCount
:
9
,
maxImgCount
:
9
,
maxVideoCount
:
9
,
maxVideoCount
:
9
,
...
@@ -87,13 +88,14 @@ Page({
...
@@ -87,13 +88,14 @@ Page({
},
},
},
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
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
({
this
.
setData
({
cid
,
cid
,
tid
,
tid
,
p_type
:
ptype
,
p_type
:
ptype
,
pid
:
eid
,
pid
:
eid
,
roottype
roottype
,
sid
})
})
},
},
onShow
:
function
()
{
// Do something when page show.
onShow
:
function
()
{
// Do something when page show.
...
@@ -123,9 +125,13 @@ Page({
...
@@ -123,9 +125,13 @@ Page({
})
})
},
},
addImg
()
{
// 添加图片的操作
addImg
(
e
,
wxFile
)
{
// 添加图片的操作
let
imgCount
=
this
.
data
.
imageBox
.
filter
(
ele
=>
ele
.
type
==
'image'
).
length
;
let
imgCount
=
this
.
data
.
imageBox
.
filter
(
ele
=>
ele
.
type
==
'image'
).
length
;
if
(
imgCount
>=
this
.
data
.
maxImgCount
)
{
// 当等于10条了不能继续添加
if
(
imgCount
>=
this
.
data
.
maxImgCount
)
{
// 当等于10条了不能继续添加
wx
.
showToast
({
title
:
`上传图片不能超过
${
this
.
data
.
maxImgCount
}
张`
,
icon
:
'none'
})
return
return
}
else
{
}
else
{
if
(
!
this
.
data
.
imageUploaded
)
{
if
(
!
this
.
data
.
imageUploaded
)
{
...
@@ -146,12 +152,17 @@ Page({
...
@@ -146,12 +152,17 @@ Page({
this
.
setData
({
this
.
setData
({
imageUploaded
:
false
imageUploaded
:
false
})
})
cOssAccess
().
then
((
acc
)
=>
{
let
myPromise
=
null
;
access
=
acc
.
data
;
if
(
wxFile
)
{
return
wxChooseImage
({
myPromise
=
new
Promise
((
resolve
)
=>
{
resolve
(
wxFile
);
})
}
else
{
myPromise
=
wxChooseImage
({
count
:
this
.
data
.
maxImgCount
-
imgCount
count
:
this
.
data
.
maxImgCount
-
imgCount
})
})
}).
then
((
res
)
=>
{
}
myPromise
.
then
((
res
)
=>
{
const
{
tempFiles
}
=
res
;
const
{
tempFiles
}
=
res
;
let
imageBox
=
this
.
data
.
imageBox
;
let
imageBox
=
this
.
data
.
imageBox
;
this
.
setData
({
this
.
setData
({
...
@@ -178,47 +189,65 @@ Page({
...
@@ -178,47 +189,65 @@ Page({
this
.
setData
({
this
.
setData
({
imageBox
:
res
.
imageBox
,
imageBox
:
res
.
imageBox
,
})
})
this
.
singleUploadFile
(
access
)
this
.
singleUploadFile
()
}).
catch
((
e
)
=>
{
}).
catch
((
e
)
=>
{
wx
.
hideLoading
()
wx
.
hideLoading
()
})
})
},
},
singleUploadFile
(
access
)
{
singleUploadFile
()
{
wx
.
showLoading
({
title
:
'图片上传中...'
,
mask
:
true
})
let
access
=
{};
let
imageBox
=
this
.
data
.
imageBox
;
let
imageBox
=
this
.
data
.
imageBox
;
if
(
this
.
data
.
currentIndex
==
(
imageBox
.
length
))
{
if
(
this
.
data
.
currentIndex
==
(
imageBox
.
length
))
{
wx
.
hideLoading
();
this
.
setData
({
this
.
setData
({
imageUploaded
:
true
imageUploaded
:
true
})
})
if
(
this
.
data
.
activtySchoolInfo
.
plan
==
'planb'
&&
this
.
data
.
activtySchoolInfo
.
tid
==
this
.
data
.
tid
)
{
this
.
judgeContentQualified
();
}
return
;
return
;
}
}
let
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
imageBox
[
this
.
data
.
currentIndex
].
src
)}
`
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'resolving'
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'resolving'
;
this
.
setData
({
this
.
setData
({
imageBox
imageBox
})
})
wxUploadFile
({
const
path
=
imageBox
[
this
.
data
.
currentIndex
].
src
;
url
:
access
.
host
,
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
);
formData
:
{
cOssAccess
({
key
:
filename
,
school_id
:
this
.
data
.
sid
,
policy
:
access
.
policy
,
ext
:
fileType
OSSAccessKeyId
:
access
.
accessid
,
}).
then
((
acc
)
=>
{
signature
:
access
.
signature
,
if
(
acc
.
code
==
200
)
{
callback
:
access
.
callback
,
access
=
acc
.
data
;
success_action_status
:
'200'
return
wxUploadFile
({
},
url
:
access
.
host
,
filePath
:
imageBox
[
this
.
data
.
currentIndex
].
src
,
formData
:
{
name
:
'file'
,
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
)
=>
{
}).
then
((
res
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
);
let
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
status
==
'ok'
)
{
if
(
data
.
status
==
'ok'
)
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fullfilled'
;
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
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
this
.
setData
({
imageBox
,
imageBox
,
currentIndex
currentIndex
})
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
else
{
}
else
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
...
@@ -226,16 +255,17 @@ Page({
...
@@ -226,16 +255,17 @@ Page({
imageBox
,
imageBox
,
currentIndex
currentIndex
})
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
}
}).
catch
(()
=>
{
}).
catch
((
e
)
=>
{
console
.
log
(
'ddddddddddddddddddddd失败'
)
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
this
.
setData
({
imageBox
,
imageBox
,
currentIndex
currentIndex
})
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
})
})
},
},
delimg
(
e
)
{
delimg
(
e
)
{
...
@@ -396,18 +426,28 @@ Page({
...
@@ -396,18 +426,28 @@ Page({
})
})
this
.
addVideoMethod
();
this
.
addVideoMethod
();
},
},
addVideoMethod
()
{
// 添加视频的操作
addVideoMethod
(
e
,
wxFile
)
{
// 添加视频的操作
const
that
=
this
;
const
that
=
this
;
let
access
=
{};
let
access
=
{};
let
filename
=
''
;
let
filename
=
''
;
cMediaOssAccess
({
let
videoInsertIndex
=
0
;
type
:
1
let
imageBox
=
this
.
data
.
imageBox
;
}).
then
((
res
)
=>
{
let
size
=
0
;
access
=
res
.
data
;
let
duration
=
0
;
return
wxChooseVideo
({
let
tempFilePath
=
''
;
let
myPromise
=
null
;
if
(
wxFile
)
{
myPromise
=
new
Promise
((
resolve
)
=>
{
resolve
(
wxFile
);
})
})
}).
then
((
res
)
=>
{
}
else
{
const
{
tempFilePath
,
duration
,
size
}
=
res
;
myPromise
=
wxChooseVideo
({
})
}
myPromise
.
then
((
res
)
=>
{
size
=
res
.
size
;
duration
=
res
.
duration
;
tempFilePath
=
res
.
tempFilePath
;
if
(
duration
>
constants
.
videoConf
.
duration
)
{
if
(
duration
>
constants
.
videoConf
.
duration
)
{
wx
.
showModal
({
wx
.
showModal
({
title
:
'提示'
,
title
:
'提示'
,
...
@@ -426,58 +466,70 @@ Page({
...
@@ -426,58 +466,70 @@ Page({
})
})
return
return
}
}
let
imageBox
=
this
.
data
.
imageBox
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
let
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
const
path
=
tempFilePath
;
imageBox
.
splice
(
videoInsertIndex
,
0
,
{
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
src
:
tempFilePath
,
return
cMediaOssAccess
({
status
:
'resolving'
,
school_id
:
this
.
data
.
sid
,
type
:
'video'
,
type
:
1
size
:
size
})
})
that
.
setData
({
}).
then
((
res
)
=>
{
imageBox
if
(
res
.
code
==
200
)
{
})
access
=
res
.
data
;
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
tempFilePath
)}
`
;
imageBox
.
splice
(
videoInsertIndex
,
0
,
{
that
.
uploadVideoTask
=
wx
.
uploadFile
({
src
:
access
.
path
,
url
:
access
.
host
,
status
:
'resolving'
,
formData
:
{
type
:
'video'
,
key
:
filename
,
size
:
size
,
policy
:
access
.
policy
,
mode
:
'm3u8'
OSSAccessKeyId
:
access
.
accessid
,
})
signature
:
access
.
signature
,
that
.
setData
({
callback
:
access
.
callback
,
imageBox
success_action_status
:
'200'
})
},
that
.
data
.
uploadVideoTask
[
`
${
access
.
path
}
`
]
=
wx
.
uploadFile
({
filePath
:
tempFilePath
,
url
:
access
.
host
,
name
:
'file'
,
formData
:
{
success
(
res
)
{
key
:
access
.
path
,
const
{
data
}
=
res
;
policy
:
access
.
policy
,
if
(
data
==
'{"status":"ok"}'
)
{
OSSAccessKeyId
:
access
.
accessid
,
let
imageBox
=
that
.
data
.
imageBox
;
signature
:
access
.
signature
,
imageBox
[
videoInsertIndex
].
src
=
filename
;
callback
:
access
.
callback
,
imageBox
[
videoInsertIndex
].
status
=
'fullfilled'
;
success_action_status
:
'200'
imageBox
[
videoInsertIndex
].
videoprogress
=
100
;
},
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
({
that
.
setData
({
imageBox
:
imageBox
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
)
=>
{
}).
catch
((
err
)
=>
{
wx
.
hideLoading
();
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