Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-task
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1365dfe1
authored
Nov 15, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
配置物料加限制
1 parent
090b771a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
103 deletions
src/components/GLEditor/index.vue
src/utils/upload.js
src/views/task/addTask/components/activityDia.vue
src/views/task/addTask/index.vue
src/components/GLEditor/index.vue
View file @
1365dfe
...
@@ -219,12 +219,9 @@
...
@@ -219,12 +219,9 @@
</div>
</div>
</
template
>
</
template
>
<
template
v-else-if=
"itm.materialType == ATT_TYPE.LINK"
>
<
template
v-else-if=
"itm.materialType == ATT_TYPE.LINK"
>
<el-tag
<el-tag
type=
"info"
closable
@
close=
"close(index)"
>
{{
type=
"info"
itm
.
materialContent
:closable=
"!linkStatus"
}}
</el-tag>
@
close=
"close(index)"
>
{{
itm
.
materialContent
}}
</el-tag
>
</
template
>
</
template
>
<!-- <i class="el-icon-circle-close" @click="close(index)"></i> -->
<!-- <i class="el-icon-circle-close" @click="close(index)"></i> -->
</div>
</div>
...
@@ -396,9 +393,7 @@ export default {
...
@@ -396,9 +393,7 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
console
.
log
(
this
.
linkStatus
,
999
)
if
(
this
.
previewList
.
length
)
{
if
(
this
.
previewList
.
length
)
{
console
.
log
(
this
.
previewList
,
999
)
this
.
previewList
.
map
((
item
)
=>
{
this
.
previewList
.
map
((
item
)
=>
{
if
(
item
.
materialType
==
ATT_TYPE
.
TEXT
)
{
if
(
item
.
materialType
==
ATT_TYPE
.
TEXT
)
{
this
.
textValue
=
this
.
changeText
(
item
.
materialContent
)
this
.
textValue
=
this
.
changeText
(
item
.
materialContent
)
...
@@ -442,7 +437,6 @@ export default {
...
@@ -442,7 +437,6 @@ export default {
watch
:
{
watch
:
{
previewList
:
{
previewList
:
{
handler
(
val
)
{
handler
(
val
)
{
console
.
log
(
val
,
'previewList'
)
this
.
$emit
(
'shareMatrial'
,
val
)
this
.
$emit
(
'shareMatrial'
,
val
)
this
.
$emit
(
'getEditor'
)
this
.
$emit
(
'getEditor'
)
},
},
...
@@ -454,10 +448,8 @@ export default {
...
@@ -454,10 +448,8 @@ export default {
this
.
uploadInfo
.
clickEvent
(
e
.
srcElement
.
files
)
this
.
uploadInfo
.
clickEvent
(
e
.
srcElement
.
files
)
},
},
resetItem
()
{
resetItem
()
{
console
.
log
(
this
.
previewList
,
'previewList'
)
this
.
previewList
=
[]
this
.
previewList
=
[]
this
.
textValue
=
''
this
.
textValue
=
''
console
.
log
(
this
.
previewList
,
this
.
linkStatus
,
'previewList2'
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
this
.
linkStatus
)
this
.
handleFun
({
type
:
'link'
})
if
(
this
.
linkStatus
)
this
.
handleFun
({
type
:
'link'
})
})
})
...
@@ -527,29 +519,23 @@ export default {
...
@@ -527,29 +519,23 @@ export default {
},
},
// 上传图片
// 上传图片
handleImgChange
(
e
)
{
handleImgChange
(
e
)
{
// 判断是否有链接
var
materialFlag
=
0
this
.
previewList
.
some
((
item
)
=>
{
if
(
item
.
materialType
==
ATT_TYPE
.
LINK
)
{
materialFlag
=
materialFlag
+
1
}
})
if
(
materialFlag
)
{
this
.
$message
.
error
(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
return
}
this
.
$notify
({
this
.
$notify
({
title
:
'提示'
,
title
:
'提示'
,
message
:
'图片上传中,请稍后'
,
message
:
'图片上传中,请稍后'
,
})
})
// let imgFlag = false
// this.previewList.map((item) => {
// if (
// item.materialType != ATT_TYPE.IMAGE &&
// item.materialType != ATT_TYPE.TEXT
// ) {
// imgFlag = true
// }
// return imgFlag
// })
// let newList = []
// if (imgFlag) {
// this.previewList.map((item, index) => {
// if (item.materialType == this.ATT_TYPE.TEXT) {
// newList.push(item)
// }
// })
// this.previewList = newList
// }
var
reader
=
new
FileReader
()
var
reader
=
new
FileReader
()
var
file
=
e
.
srcElement
.
files
[
0
]
var
file
=
e
.
srcElement
.
files
[
0
]
// 默认1MB
// 默认1MB
...
@@ -619,6 +605,20 @@ export default {
...
@@ -619,6 +605,20 @@ export default {
},
},
// 上传视频
// 上传视频
async
handleVideoChange
(
e
)
{
async
handleVideoChange
(
e
)
{
// 判断是否有链接
var
materialFlag
=
0
this
.
previewList
.
some
((
item
)
=>
{
if
(
item
.
materialType
==
ATT_TYPE
.
LINK
)
{
materialFlag
=
materialFlag
+
1
}
})
if
(
materialFlag
)
{
this
.
$message
.
error
(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
document
.
querySelector
(
'.upload-video'
).
value
=
''
return
}
await
this
.
uploadFileVideo
(
e
)
await
this
.
uploadFileVideo
(
e
)
const
that
=
this
const
that
=
this
this
.
uploadInfo
=
new
upload
({
this
.
uploadInfo
=
new
upload
({
...
@@ -718,6 +718,22 @@ export default {
...
@@ -718,6 +718,22 @@ export default {
})
})
},
},
handleFun
(
type
)
{
handleFun
(
type
)
{
// 判断是否有图片或者视频
var
materialFlag
=
0
this
.
previewList
.
some
((
item
)
=>
{
if
(
item
.
materialType
==
ATT_TYPE
.
IMAGE
||
item
.
materialType
==
ATT_TYPE
.
VEDIO
)
{
materialFlag
=
materialFlag
+
1
}
})
if
(
materialFlag
)
{
this
.
$message
.
error
(
'为规范小程序显示样式,专属链接不能与图片或视频同时配置'
)
return
}
const
name
=
type
.
type
const
name
=
type
.
type
if
(
name
==
'nickname'
)
{
if
(
name
==
'nickname'
)
{
this
.
$refs
.
textContent
.
addTag
(
'@昵称'
)
this
.
$refs
.
textContent
.
addTag
(
'@昵称'
)
...
@@ -733,13 +749,10 @@ export default {
...
@@ -733,13 +749,10 @@ export default {
if
(
this
.
previewList
.
length
)
{
if
(
this
.
previewList
.
length
)
{
let
linkFlag
=
0
let
linkFlag
=
0
this
.
previewList
.
map
((
item
)
=>
{
this
.
previewList
.
map
((
item
)
=>
{
console
.
log
(
item
)
if
(
item
.
materialType
==
this
.
ATT_TYPE
.
LINK
)
{
if
(
item
.
materialType
==
this
.
ATT_TYPE
.
LINK
)
{
console
.
log
(
111
)
linkFlag
=
linkFlag
+
1
linkFlag
=
linkFlag
+
1
}
}
})
})
console
.
log
(
linkFlag
,
'linkFlag'
)
if
(
linkFlag
>
0
)
{
if
(
linkFlag
>
0
)
{
this
.
$message
.
warning
(
'最多上传一条活动专属链接!'
)
this
.
$message
.
warning
(
'最多上传一条活动专属链接!'
)
return
return
...
@@ -750,7 +763,6 @@ export default {
...
@@ -750,7 +763,6 @@ export default {
materialType
:
this
.
ATT_TYPE
.
LINK
,
materialType
:
this
.
ATT_TYPE
.
LINK
,
materialContent
:
'#活动专属链接#'
,
materialContent
:
'#活动专属链接#'
,
})
})
console
.
log
(
this
.
previewList
)
}
}
},
},
close
(
index
)
{
close
(
index
)
{
...
...
src/utils/upload.js
View file @
1365dfe
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
import
MD5
from
'md5'
import
MD5
from
'md5'
var
that
=
''
var
that
=
''
var
w
=
{}
var
w
=
{}
var
upload
=
function
(
options
)
{
var
upload
=
function
(
options
)
{
//upload("options") 或者 new upload("options")都可以使用upload方法
//upload("options") 或者 new upload("options")都可以使用upload方法
if
(
!
(
this
instanceof
upload
))
{
if
(
!
(
this
instanceof
upload
))
{
return
new
upload
(
options
)
return
new
upload
(
options
)
...
@@ -28,7 +28,7 @@ var upload = function(options) {
...
@@ -28,7 +28,7 @@ var upload = function(options) {
tips
:
''
,
tips
:
''
,
size
:
2
,
size
:
2
,
url
:
''
,
url
:
''
,
success
:
''
success
:
''
,
},
},
options
options
)
)
...
@@ -41,7 +41,7 @@ var upload = function(options) {
...
@@ -41,7 +41,7 @@ var upload = function(options) {
v
:
'1.0.0'
,
v
:
'1.0.0'
,
format
:
'json'
,
format
:
'json'
,
url
:
'http://didicb.glsx.com.cn/router'
,
url
:
'http://didicb.glsx.com.cn/router'
,
secret
:
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
secret
:
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
,
}
}
/*this.token = '';
/*this.token = '';
...
@@ -60,7 +60,7 @@ upload.prototype = {
...
@@ -60,7 +60,7 @@ upload.prototype = {
/**
/**
* 初始化方法
* 初始化方法
*/
*/
init
:
function
(
id
)
{
init
:
function
(
id
)
{
if
(
!
id
)
{
if
(
!
id
)
{
return
false
return
false
}
}
...
@@ -69,8 +69,6 @@ upload.prototype = {
...
@@ -69,8 +69,6 @@ upload.prototype = {
that
.
config
.
id
=
id
that
.
config
.
id
=
id
console
.
log
(
that
.
config
)
//创建最外层div
//创建最外层div
var
_div
=
document
.
createElement
(
'div'
)
var
_div
=
document
.
createElement
(
'div'
)
_div
.
className
=
'test'
_div
.
className
=
'test'
...
@@ -85,7 +83,8 @@ upload.prototype = {
...
@@ -85,7 +83,8 @@ upload.prototype = {
var
_input
=
document
.
createElement
(
'input'
)
var
_input
=
document
.
createElement
(
'input'
)
_input
.
type
=
'file'
_input
.
type
=
'file'
_input
.
className
=
'file_input'
_input
.
className
=
'file_input'
_input
.
style
=
'opacity:0;position:absolute;top:0px;right:0px;bottom:0px;left:0px;font-size:14px;'
_input
.
style
=
'opacity:0;position:absolute;top:0px;right:0px;bottom:0px;left:0px;font-size:14px;'
_input
.
onchange
=
this
.
clickEvent
_input
.
onchange
=
this
.
clickEvent
_iptdiv
.
appendChild
(
_input
)
_iptdiv
.
appendChild
(
_input
)
...
@@ -93,7 +92,8 @@ upload.prototype = {
...
@@ -93,7 +92,8 @@ upload.prototype = {
var
_button
=
document
.
createElement
(
'button'
)
var
_button
=
document
.
createElement
(
'button'
)
_button
.
className
=
'testbu'
_button
.
className
=
'testbu'
_button
.
innerText
=
'选择文件'
_button
.
innerText
=
'选择文件'
_button
.
style
=
'border:1px solid #409eff;background:#409eff;color:#fff;border-radius:4px;padding:6px 14px;outline:none;font-size:14px;'
_button
.
style
=
'border:1px solid #409eff;background:#409eff;color:#fff;border-radius:4px;padding:6px 14px;outline:none;font-size:14px;'
_iptdiv
.
appendChild
(
_button
)
_iptdiv
.
appendChild
(
_button
)
_div
.
appendChild
(
_iptdiv
)
_div
.
appendChild
(
_iptdiv
)
...
@@ -124,12 +124,14 @@ upload.prototype = {
...
@@ -124,12 +124,14 @@ upload.prototype = {
var
_pDiv
=
document
.
createElement
(
'div'
)
var
_pDiv
=
document
.
createElement
(
'div'
)
_pDiv
.
className
=
'progress_box'
_pDiv
.
className
=
'progress_box'
_pDiv
.
id
=
'upload_progress_box'
_pDiv
.
id
=
'upload_progress_box'
_pDiv
.
style
=
'background:#ebeef5;border-radius:100px;position:relative;height:2px;min-width:200px;display:none;'
_pDiv
.
style
=
'background:#ebeef5;border-radius:100px;position:relative;height:2px;min-width:200px;display:none;'
//创建进度条内部
//创建进度条内部
var
_iDiv
=
document
.
createElement
(
'div'
)
var
_iDiv
=
document
.
createElement
(
'div'
)
_iDiv
.
className
=
'progress_box_inner'
_iDiv
.
className
=
'progress_box_inner'
_iDiv
.
style
=
'background:#409eff;border-radius:2px;position:absolute;left:0px;top:0px;bottom:0px;border-radius:100px;'
_iDiv
.
style
=
'background:#409eff;border-radius:2px;position:absolute;left:0px;top:0px;bottom:0px;border-radius:100px;'
_pDiv
.
appendChild
(
_iDiv
)
_pDiv
.
appendChild
(
_iDiv
)
_fileDiv
.
appendChild
(
_pDiv
)
_fileDiv
.
appendChild
(
_pDiv
)
}
}
...
@@ -139,7 +141,7 @@ upload.prototype = {
...
@@ -139,7 +141,7 @@ upload.prototype = {
},
},
// 参数合并方法体
// 参数合并方法体
extend
:
function
(
obj
,
obj2
)
{
extend
:
function
(
obj
,
obj2
)
{
for
(
var
key
in
obj2
)
{
for
(
var
key
in
obj2
)
{
obj
[
key
]
=
obj2
[
key
]
obj
[
key
]
=
obj2
[
key
]
// 确保参数唯一
// 确保参数唯一
...
@@ -158,7 +160,7 @@ upload.prototype = {
...
@@ -158,7 +160,7 @@ upload.prototype = {
// }
// }
// that.checkFile(files[0])
// that.checkFile(files[0])
// },
// },
clickEvent
:
function
(
e
)
{
clickEvent
:
function
(
e
)
{
var
files
=
e
var
files
=
e
if
(
!
files
||
files
.
length
<=
0
)
{
if
(
!
files
||
files
.
length
<=
0
)
{
return
false
return
false
...
@@ -168,7 +170,7 @@ upload.prototype = {
...
@@ -168,7 +170,7 @@ upload.prototype = {
/**
/**
* 处理选中的文件
* 处理选中的文件
*/
*/
treatEvent
:
async
function
(
file
)
{
treatEvent
:
async
function
(
file
)
{
//var random = Math.random();
//var random = Math.random();
// var _workerJs = await that.calculateHashWorker()
// var _workerJs = await that.calculateHashWorker()
// var _workerJs = that.createWorker()
// var _workerJs = that.createWorker()
...
@@ -184,7 +186,7 @@ upload.prototype = {
...
@@ -184,7 +186,7 @@ upload.prototype = {
oParams
.
config
=
that
.
config
oParams
.
config
=
that
.
config
//oParams.options = that.options;
//oParams.options = that.options;
webWorker
.
postMessage
(
oParams
)
webWorker
.
postMessage
(
oParams
)
webWorker
.
onmessage
=
function
(
e
)
{
webWorker
.
onmessage
=
function
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
var
_obj
=
e
.
data
var
_obj
=
e
.
data
w
=
_obj
w
=
_obj
...
@@ -199,10 +201,10 @@ upload.prototype = {
...
@@ -199,10 +201,10 @@ upload.prototype = {
var
_arr
=
fileSlice
(
_obj
)
var
_arr
=
fileSlice
(
_obj
)
w
.
list
=
_arr
w
.
list
=
_arr
w
.
fileMD5
=
_obj
.
fileMD5
w
.
fileMD5
=
_obj
.
fileMD5
Promise
.
all
([
r1
]).
then
(
res
=>
{
Promise
.
all
([
r1
]).
then
(
(
res
)
=>
{
var
_token
=
res
[
0
]
var
_token
=
res
[
0
]
that
.
config
.
token
=
_token
that
.
config
.
token
=
_token
checkFileIsUpload
(
_obj
.
fileMD5
).
then
(
res
=>
{
checkFileIsUpload
(
_obj
.
fileMD5
).
then
(
(
res
)
=>
{
var
_data
=
res
.
data
var
_data
=
res
.
data
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
//如果存在fileUrl,则证明服务器存在该文件
//如果存在fileUrl,则证明服务器存在该文件
...
@@ -221,7 +223,7 @@ upload.prototype = {
...
@@ -221,7 +223,7 @@ upload.prototype = {
/**
/**
* 文件校验
* 文件校验
*/
*/
checkFile
:
function
(
file
)
{
checkFile
:
function
(
file
)
{
var
o
=
that
.
options
var
o
=
that
.
options
var
max
=
o
.
max
?
Number
(
o
.
max
)
*
1024
*
1024
:
''
var
max
=
o
.
max
?
Number
(
o
.
max
)
*
1024
*
1024
:
''
if
(
max
&&
file
.
size
>
max
)
{
if
(
max
&&
file
.
size
>
max
)
{
...
@@ -242,17 +244,17 @@ upload.prototype = {
...
@@ -242,17 +244,17 @@ upload.prototype = {
that
.
treatEvent
(
file
)
that
.
treatEvent
(
file
)
},
},
async
calculateHashWorker
()
{
async
calculateHashWorker
()
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
(
resolve
)
=>
{
this
.
worker
=
new
Worker
(
'/hash.js'
)
this
.
worker
=
new
Worker
(
'/hash.js'
)
this
.
worker
.
postMessage
({
chunks
:
this
.
chunks
})
this
.
worker
.
postMessage
({
chunks
:
this
.
chunks
})
this
.
worker
.
onmessage
=
e
=>
{
this
.
worker
.
onmessage
=
(
e
)
=>
{
const
{
hash
}
=
e
.
data
const
{
hash
}
=
e
.
data
if
(
hash
)
{
if
(
hash
)
{
resolve
(
hash
)
resolve
(
hash
)
}
}
}
}
})
})
}
}
,
// //创建worker分线程
// //创建worker分线程
// createWorker: function() {
// createWorker: function() {
// var myWorker = function() {
// var myWorker = function() {
...
@@ -317,7 +319,7 @@ upload.prototype = {
...
@@ -317,7 +319,7 @@ upload.prototype = {
* 封装请求方法
* 封装请求方法
*/
*/
function
request
(
options
)
{
function
request
(
options
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
_url
=
options
.
url
var
_url
=
options
.
url
var
_data
=
options
.
data
var
_data
=
options
.
data
var
xhr
=
new
XMLHttpRequest
()
var
xhr
=
new
XMLHttpRequest
()
...
@@ -329,16 +331,16 @@ function request(options) {
...
@@ -329,16 +331,16 @@ function request(options) {
xhr
.
responseType
=
options
.
responseType
||
'json'
xhr
.
responseType
=
options
.
responseType
||
'json'
//请求成功
//请求成功
xhr
.
onload
=
function
(
res
)
{
xhr
.
onload
=
function
(
res
)
{
resolve
(
res
.
target
.
response
)
resolve
(
res
.
target
.
response
)
}
}
//请求失败
//请求失败
xhr
.
onerror
=
function
(
res
)
{
xhr
.
onerror
=
function
(
res
)
{
reject
(
res
.
target
.
response
)
reject
(
res
.
target
.
response
)
}
}
//请求超时
//请求超时
xhr
.
ontimeout
=
function
(
res
)
{
xhr
.
ontimeout
=
function
(
res
)
{
reject
(
res
.
target
.
response
)
reject
(
res
.
target
.
response
)
}
}
...
@@ -427,13 +429,15 @@ function send(arr) {
...
@@ -427,13 +429,15 @@ function send(arr) {
o
.
method
=
'POST'
o
.
method
=
'POST'
o
.
data
=
oParams
o
.
data
=
oParams
o
.
url
=
(
that
.
options
.
url
||
that
.
config
.
url
)
+
'?method=glsx.accounts.biz.common.uploadFileWithFileInfo'
o
.
url
=
(
that
.
options
.
url
||
that
.
config
.
url
)
+
'?method=glsx.accounts.biz.common.uploadFileWithFileInfo'
//fileFragmentUpload(o);
//fileFragmentUpload(o);
//如果存在url,则直接跳出循环
//如果存在url,则直接跳出循环
if
(
hasFile
)
{
if
(
hasFile
)
{
return
false
return
false
}
}
request
(
o
).
then
(
res
=>
{
request
(
o
).
then
(
(
res
)
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
_num
++
_num
++
var
_obj
=
res
.
data
var
_obj
=
res
.
data
...
@@ -475,7 +479,7 @@ function _allCallback(url) {
...
@@ -475,7 +479,7 @@ function _allCallback(url) {
*/
*/
function
fileFragmentUpload
(
oParams
)
{
function
fileFragmentUpload
(
oParams
)
{
request
()
request
()
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
this
.
_num
++
this
.
_num
++
var
_obj
=
res
.
data
var
_obj
=
res
.
data
...
@@ -493,7 +497,7 @@ function fileFragmentUpload(oParams) {
...
@@ -493,7 +497,7 @@ function fileFragmentUpload(oParams) {
}; */
}; */
}
}
})
})
.
catch
(
res
=>
{
.
catch
(
(
res
)
=>
{
fileFragmentUpload
(
oParams
)
fileFragmentUpload
(
oParams
)
})
})
}
}
...
@@ -518,7 +522,7 @@ function createSign(params) {
...
@@ -518,7 +522,7 @@ function createSign(params) {
}
}
params
[
key
]
=
obj
params
[
key
]
=
obj
}
}
keys
.
forEach
(
e
=>
{
keys
.
forEach
(
(
e
)
=>
{
!
noSignAttr
.
includes
(
e
)
&&
str
.
push
(
e
+
params
[
e
])
!
noSignAttr
.
includes
(
e
)
&&
str
.
push
(
e
+
params
[
e
])
})
})
params
.
sign
=
MD5
(
secret
+
str
.
join
(
''
)
+
secret
)
params
.
sign
=
MD5
(
secret
+
str
.
join
(
''
)
+
secret
)
...
@@ -577,7 +581,7 @@ function getParams(index, oInfo) {
...
@@ -577,7 +581,7 @@ function getParams(index, oInfo) {
* 获取token
* 获取token
*/
*/
function
getToken
(
file
)
{
function
getToken
(
file
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
_obj
=
that
.
config
var
_obj
=
that
.
config
var
o
=
{}
var
o
=
{}
var
oParams
=
{}
var
oParams
=
{}
...
@@ -608,14 +612,14 @@ function getToken(file) {
...
@@ -608,14 +612,14 @@ function getToken(file) {
o
.
data
=
createSign
(
oParams
)
o
.
data
=
createSign
(
oParams
)
o
.
method
=
'GET'
o
.
method
=
'GET'
request
(
o
)
request
(
o
)
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
var
_data
=
res
.
data
||
{}
var
_data
=
res
.
data
||
{}
w
.
token
=
_data
.
token
w
.
token
=
_data
.
token
resolve
(
_data
.
token
)
resolve
(
_data
.
token
)
}
}
})
})
.
catch
(
res
=>
{
.
catch
(
(
res
)
=>
{
reject
(
res
)
reject
(
res
)
})
})
})
})
...
@@ -658,12 +662,12 @@ function checkFileIsUpload(md5) {
...
@@ -658,12 +662,12 @@ function checkFileIsUpload(md5) {
o
.
data
=
createSign
(
oParams
)
o
.
data
=
createSign
(
oParams
)
o
.
method
=
'GET'
o
.
method
=
'GET'
request
(
o
)
request
(
o
)
.
then
(
res
=>
{
.
then
(
(
res
)
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
resolve
(
res
)
resolve
(
res
)
}
}
})
})
.
catch
(
res
=>
{
.
catch
(
(
res
)
=>
{
reject
(
res
)
reject
(
res
)
})
})
})
})
...
...
src/views/task/addTask/components/activityDia.vue
View file @
1365dfe
...
@@ -118,12 +118,10 @@ export default {
...
@@ -118,12 +118,10 @@ export default {
return
day
return
day
},
},
handleSelectItem
(
item
)
{
handleSelectItem
(
item
)
{
console
.
log
(
item
)
this
.
selectItem
=
item
this
.
selectItem
=
item
},
},
// 确认活动
// 确认活动
confirmActivity
()
{
confirmActivity
()
{
console
.
log
(
11
)
if
(
!
this
.
selectItem
.
id
)
{
if
(
!
this
.
selectItem
.
id
)
{
this
.
$message
({
this
.
$message
({
message
:
'请选择活动'
,
message
:
'请选择活动'
,
...
...
src/views/task/addTask/index.vue
View file @
1365dfe
...
@@ -193,14 +193,18 @@
...
@@ -193,14 +193,18 @@
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
label=
"分享模式:"
label=
"分享模式:"
:prop=
"'missionList.' + index1 + '.shareModel'"
:prop=
"'missionList.' + index1 + '.sharingMethod'"
:rules=
"taskFormRules.shareModel"
:rules=
"taskFormRules.sharingMethod"
v-if=
"itm.missonType && itm.missonType != 1"
v-if=
"
itm.missonType &&
itm.missonType != 1 &&
itm.sharingMethod
"
>
>
<el-checkbox-group
v-model=
"itm.shar
eModel
"
>
<el-checkbox-group
v-model=
"itm.shar
ingMethod
"
>
<el-checkbox
label=
"
微信群发"
>
</el-checkbox>
<el-checkbox
label=
"
1"
>
微信群发
</el-checkbox>
<el-checkbox
label=
"
分享好友"
>
</el-checkbox>
<el-checkbox
label=
"
2"
>
分享好友
</el-checkbox>
<el-checkbox
label=
"
分享朋友圈"
>
</el-checkbox>
<el-checkbox
label=
"
3"
>
分享朋友圈
</el-checkbox>
</el-checkbox-group>
</el-checkbox-group>
</el-form-item>
</el-form-item>
<el-form-item
<el-form-item
...
@@ -478,7 +482,7 @@ export default {
...
@@ -478,7 +482,7 @@ export default {
rewardCount
:
''
,
rewardCount
:
''
,
triggerValue
:
''
,
triggerValue
:
''
,
minTriggerValue
:
''
,
minTriggerValue
:
''
,
shar
eModel
:
[],
shar
ingMethod
:
[],
},
},
// 浏览指标任务类型
// 浏览指标任务类型
browseObj
:
{
browseObj
:
{
...
@@ -488,7 +492,7 @@ export default {
...
@@ -488,7 +492,7 @@ export default {
repeatCount
:
''
,
repeatCount
:
''
,
triggerValue
:
''
,
triggerValue
:
''
,
minTriggerValue
:
''
,
minTriggerValue
:
''
,
shar
eModel
:
[],
shar
ingMethod
:
[],
},
},
// 访客指标任务类型
// 访客指标任务类型
visitorObj
:
{
visitorObj
:
{
...
@@ -496,7 +500,7 @@ export default {
...
@@ -496,7 +500,7 @@ export default {
rewardType
:
''
,
rewardType
:
''
,
triggerValue
:
''
,
triggerValue
:
''
,
minTriggerValue
:
''
,
minTriggerValue
:
''
,
shar
eModel
:
[],
shar
ingMethod
:
[],
},
},
// 成单指标任务类型
// 成单指标任务类型
orderObj
:
{
orderObj
:
{
...
@@ -504,7 +508,7 @@ export default {
...
@@ -504,7 +508,7 @@ export default {
rewardType
:
''
,
rewardType
:
''
,
triggerValue
:
''
,
triggerValue
:
''
,
minTriggerValue
:
''
,
minTriggerValue
:
''
,
shar
eModel
:
[],
shar
ingMethod
:
[],
},
},
// 编辑任务计划数据
// 编辑任务计划数据
taskEditList
:
{},
taskEditList
:
{},
...
@@ -558,7 +562,7 @@ export default {
...
@@ -558,7 +562,7 @@ export default {
rewardScore
:
[
rewardScore
:
[
{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateAwardIntegral
},
{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateAwardIntegral
},
],
],
shar
eModel
:
[
shar
ingMethod
:
[
{
required
:
true
,
trigger
:
'change'
,
message
:
'请选择分享模式'
},
{
required
:
true
,
trigger
:
'change'
,
message
:
'请选择分享模式'
},
],
],
attachmentList
:
[{
required
:
true
,
message
:
'请输入分享素材'
}],
attachmentList
:
[{
required
:
true
,
message
:
'请输入分享素材'
}],
...
@@ -755,7 +759,6 @@ export default {
...
@@ -755,7 +759,6 @@ export default {
...
this
.
basicObj
,
...
this
.
basicObj
,
})
})
this
.
taskList
[
index
].
missionList
[
0
].
taskid
=
this
.
getUuid
()
this
.
taskList
[
index
].
missionList
[
0
].
taskid
=
this
.
getUuid
()
console
.
log
(
this
.
taskList
[
index
].
missionList
[
0
])
},
},
// 任务选择类型切换
// 任务选择类型切换
selectTaskType
(
dateTask
,
dateTaskIndex
,
task
,
taskIndex
)
{
selectTaskType
(
dateTask
,
dateTaskIndex
,
task
,
taskIndex
)
{
...
@@ -771,13 +774,6 @@ export default {
...
@@ -771,13 +774,6 @@ export default {
typeIndex
=
typeIndex
+
1
typeIndex
=
typeIndex
+
1
}
}
})
})
}
else
{
// var box = document.getElementById('missionList' + task.id + 'welcome')
// if (box) {
// var editName = 'missionList' + task.id + 'welcome'
// // console.log(this.$refs[editName])
// // this.$refs[editName][0].resetItem()
// }
}
}
if
(
typeIndex
>
1
)
{
if
(
typeIndex
>
1
)
{
this
.
$alert
(
'每个时间标签下最多只能有1个该类型任务'
,
'警告'
,
{
this
.
$alert
(
'每个时间标签下最多只能有1个该类型任务'
,
'警告'
,
{
...
@@ -792,19 +788,19 @@ export default {
...
@@ -792,19 +788,19 @@ export default {
let
taskItem
let
taskItem
switch
(
task
.
missonType
)
{
switch
(
task
.
missonType
)
{
case
1
:
case
1
:
taskItem
=
{
...
this
.
basicObj
}
taskItem
=
Object
.
assign
({},
this
.
basicObj
)
break
break
case
2
:
case
2
:
taskItem
=
{
...
this
.
basicObj
,
...
this
.
shareObj
}
taskItem
=
Object
.
assign
({},
this
.
basicObj
,
this
.
shareObj
)
break
break
case
3
:
case
3
:
taskItem
=
{
...
this
.
basicObj
,
...
this
.
browseObj
}
taskItem
=
Object
.
assign
({},
this
.
basicObj
,
this
.
browseObj
)
break
break
case
4
:
case
4
:
taskItem
=
{
...
this
.
basicObj
,
...
this
.
visitorObj
}
taskItem
=
Object
.
assign
({},
this
.
basicObj
,
this
.
visitorObj
)
break
break
case
5
:
case
5
:
taskItem
=
{
...
this
.
basicObj
,
...
this
.
orderObj
}
taskItem
=
Object
.
assign
({},
this
.
basicObj
,
this
.
orderObj
)
break
break
default
:
default
:
taskItem
=
{
...
this
.
basicObj
}
taskItem
=
{
...
this
.
basicObj
}
...
@@ -828,7 +824,6 @@ export default {
...
@@ -828,7 +824,6 @@ export default {
this
.
$refs
[
editName
][
0
].
resetItem
()
this
.
$refs
[
editName
][
0
].
resetItem
()
}
}
})
})
console
.
log
(
this
.
taskList
[
dateTaskIndex
].
missionList
)
},
},
// 获取分享素材内容
// 获取分享素材内容
getEditor
(
dateTask
,
dateTaskIndex
,
task
,
taskIndex
)
{
getEditor
(
dateTask
,
dateTaskIndex
,
task
,
taskIndex
)
{
...
@@ -921,10 +916,17 @@ export default {
...
@@ -921,10 +916,17 @@ export default {
if
(
!
itm
.
missionMaterialList
)
{
if
(
!
itm
.
missionMaterialList
)
{
delete
itm
.
missionMaterialList
delete
itm
.
missionMaterialList
}
}
// 处理重复次数
if
(
itm
.
repeatCount
&&
itm
.
repeatCount
==
-
1
)
{
if
(
itm
.
repeatCount
&&
itm
.
repeatCount
==
-
1
)
{
this
.
$set
(
itm
,
'repeatFlag'
,
true
)
this
.
$set
(
itm
,
'repeatFlag'
,
true
)
itm
.
repeatCount
=
''
itm
.
repeatCount
=
''
}
}
// 处理分享模式
if
(
itm
.
sharingMethod
)
{
itm
.
sharingMethod
=
itm
.
sharingMethod
.
split
(
','
)
}
else
{
itm
.
sharingMethod
=
[]
}
})
})
})
})
this
.
setHouseRatesColumn
(
startTime
,
endTime
)
this
.
setHouseRatesColumn
(
startTime
,
endTime
)
...
@@ -943,7 +945,6 @@ export default {
...
@@ -943,7 +945,6 @@ export default {
},
},
// 奖励模式切换
// 奖励模式切换
rewardTypeChange
(
itm
)
{
rewardTypeChange
(
itm
)
{
console
.
log
(
itm
)
if
(
itm
.
rewardType
==
2
)
{
if
(
itm
.
rewardType
==
2
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$set
(
itm
,
'triggerValue'
,
''
)
this
.
$set
(
itm
,
'triggerValue'
,
''
)
...
@@ -984,9 +985,7 @@ export default {
...
@@ -984,9 +985,7 @@ export default {
taskFormValidate
()
{
taskFormValidate
()
{
this
.
taskList
.
map
((
item
,
index
)
=>
{
this
.
taskList
.
map
((
item
,
index
)
=>
{
this
.
$refs
[
'taskForm'
][
index
].
validate
((
valid
)
=>
{
this
.
$refs
[
'taskForm'
][
index
].
validate
((
valid
)
=>
{
console
.
log
(
valid
)
if
(
!
valid
)
{
if
(
!
valid
)
{
console
.
log
(
111
)
this
.
validFlag
=
false
this
.
validFlag
=
false
this
.
dayIndex
=
index
this
.
dayIndex
=
index
return
return
...
@@ -1023,9 +1022,12 @@ export default {
...
@@ -1023,9 +1022,12 @@ export default {
itm
.
rewardCount
==
2
&&
itm
.
rewardCount
==
2
&&
!
itm
.
minTriggerValue
!
itm
.
minTriggerValue
)
{
)
{
console
.
log
(
22323233
)
itm
.
minTriggerValue
=
1
itm
.
minTriggerValue
=
1
}
}
// 分享模式处理
if
(
itm
.
sharingMethod
)
{
itm
.
sharingMethod
=
itm
.
sharingMethod
.
toString
()
}
// 自定义uuid删除
// 自定义uuid删除
delete
itm
.
taskid
delete
itm
.
taskid
})
})
...
@@ -1076,7 +1078,6 @@ export default {
...
@@ -1076,7 +1078,6 @@ export default {
}
}
},
},
(
err
)
=>
{
(
err
)
=>
{
console
.
log
(
err
)
this
.
$message
({
this
.
$message
({
message
:
err
,
message
:
err
,
type
:
'error'
,
type
:
'error'
,
...
@@ -1088,7 +1089,6 @@ export default {
...
@@ -1088,7 +1089,6 @@ export default {
// 编辑
// 编辑
taskApi
.
updateMission
(
params
).
then
(
taskApi
.
updateMission
(
params
).
then
(
(
res
)
=>
{
(
res
)
=>
{
console
.
log
(
res
,
'res'
)
if
(
res
&&
res
.
code
==
0
)
{
if
(
res
&&
res
.
code
==
0
)
{
this
.
$root
.
to
([
this
.
$root
.
to
([
'任务中心'
,
'任务中心'
,
...
@@ -1101,7 +1101,6 @@ export default {
...
@@ -1101,7 +1101,6 @@ export default {
}
}
},
},
(
err
)
=>
{
(
err
)
=>
{
console
.
log
(
err
)
this
.
$message
({
this
.
$message
({
message
:
err
,
message
:
err
,
type
:
'error'
,
type
:
'error'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment