Commit 83a330a3 by 前端

修复bug

1 parent 6f2e33dc
...@@ -20,7 +20,7 @@ Vue.use(ElementUI) ...@@ -20,7 +20,7 @@ Vue.use(ElementUI)
var mixin = { var mixin = {
data() { data() {
return { return {
eventBus: new Vue() eventBus: new Vue(),
} }
}, },
mounted() { mounted() {
...@@ -36,14 +36,14 @@ var mixin = { ...@@ -36,14 +36,14 @@ var mixin = {
}, },
translate(params) { translate(params) {
_this.eventBus.$emit('params', params) _this.eventBus.$emit('params', params)
} },
} },
}) })
connection.promise.then(parent => { connection.promise.then((parent) => {
const cfg = _this.$get_session_config() const cfg = _this.$get_session_config()
_this.$$parent = parent _this.$$parent = parent
if (cfg) return if (cfg) return
parent.getResources().then(config => { parent.getResources().then((config) => {
_this.$set_session_config(config) _this.$set_session_config(config)
}) })
}) })
...@@ -59,24 +59,25 @@ var mixin = { ...@@ -59,24 +59,25 @@ var mixin = {
* @param {*} params 传给下一个页面的参数 * @param {*} params 传给下一个页面的参数
*/ */
to(path, params) { to(path, params) {
console.log(path, params, '000')
if (this.$$parent) { if (this.$$parent) {
this.$$parent.to(path, params) this.$$parent.to(path, params)
} else { } else {
this.$$connection.promise.then(parent => { this.$$connection.promise.then((parent) => {
parent.to(path, params) parent.to(path, params)
}) })
} }
}, },
close() { close(title) {
this.$$parent.close() this.$$parent.close(title)
} },
} },
} }
const URL = const URL =
'https://oss-config.dev.glsx.com.cn/mock/5be17454f31545347559d499/config' 'https://oss-config.dev.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/task-config') => { const getConfig = (url = URL + '/task-config') => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request({ url }).then(res => { request({ url }).then((res) => {
if (res.status === 'success') { if (res.status === 'success') {
resolve({ vue: Vue, config: JSON.parse(res.data) }) resolve({ vue: Vue, config: JSON.parse(res.data) })
} else { } else {
...@@ -86,13 +87,12 @@ const getConfig = (url = URL + '/task-config') => { ...@@ -86,13 +87,12 @@ const getConfig = (url = URL + '/task-config') => {
}) })
} }
/* eslint-disable no-new */ /* eslint-disable no-new */
const render = App => { const render = (App) => {
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
mixins: [mixin], mixins: [mixin],
render: h => h(App) render: (h) => h(App),
}) })
} }
export default { render, getConfig } export default { render, getConfig }
...@@ -389,11 +389,12 @@ export default { ...@@ -389,11 +389,12 @@ export default {
// }) // })
console.log(this.previewList) console.log(this.previewList)
if (this.previewList.length) { if (this.previewList.length) {
this.previewList.map((item) => { this.updateList(this.previewList, 1)
if (item.materialType == ATT_TYPE.TEXT) { // this.previewList.map((item) => {
this.textValue = item.materialContent // if (item.materialType == ATT_TYPE.TEXT) {
} // // this.textValue = item.materialContent
}) // }
// })
} }
}, },
computed: { computed: {
...@@ -496,8 +497,14 @@ export default { ...@@ -496,8 +497,14 @@ export default {
} }
return imgFlag return imgFlag
}) })
let newList = []
if (imgFlag) { if (imgFlag) {
this.previewList = [] this.previewList.map((item, index) => {
if (item.materialType == this.ATT_TYPE.TEXT) {
newList.push(item)
}
})
this.previewList = newList
console.log(this.previewList) console.log(this.previewList)
} }
var reader = new FileReader() var reader = new FileReader()
...@@ -577,7 +584,15 @@ export default { ...@@ -577,7 +584,15 @@ export default {
return videoFlag return videoFlag
}) })
console.log(videoFlag, 'videoFlag') console.log(videoFlag, 'videoFlag')
if (videoFlag) this.previewList = [] let newList = []
if (videoFlag) {
this.previewList.map((item, index) => {
if (item.materialType == this.ATT_TYPE.TEXT) {
newList.push(item)
}
})
this.previewList = newList
}
var file var file
try { try {
file = await this.uploadFileVideo(e) file = await this.uploadFileVideo(e)
...@@ -598,7 +613,6 @@ export default { ...@@ -598,7 +613,6 @@ export default {
this.videoList.uploadApi({ file: fileUrl }).then((res) => { this.videoList.uploadApi({ file: fileUrl }).then((res) => {
if (res) { if (res) {
console.log(this.previewList) console.log(this.previewList)
this.previewList = []
this.previewList.push({ this.previewList.push({
materialType: this.ATT_TYPE.VEDIO, materialType: this.ATT_TYPE.VEDIO,
materialContent: res.data.data, materialContent: res.data.data,
...@@ -625,7 +639,16 @@ export default { ...@@ -625,7 +639,16 @@ export default {
}) })
.then(({ value }) => { .then(({ value }) => {
value = value.replace(/\s+/g, '') value = value.replace(/\s+/g, '')
if (this.previewList) this.previewList = [] let newList = []
if (this.previewList) {
this.previewList.map((item, index) => {
if (item.materialType == this.ATT_TYPE.TEXT) {
newList.push(item)
}
})
this.previewList = newList
}
console.log(this.previewList, 'this.previewList')
this.previewList.push({ this.previewList.push({
materialType: this.ATT_TYPE.LINK, materialType: this.ATT_TYPE.LINK,
materialContent: value, materialContent: value,
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
<el-select <el-select
v-model="basicForm.merchantId" v-model="basicForm.merchantId"
filterable filterable
:filter-method="filterMethod" remote
:remote-method="filterMethod"
no-data-text="暂无数据" no-data-text="暂无数据"
placeholder="请选择商户" placeholder="请选择商户"
size="small" size="small"
...@@ -307,6 +308,10 @@ export default { ...@@ -307,6 +308,10 @@ export default {
callback(new Error('奖励积分不能为空')) callback(new Error('奖励积分不能为空'))
} else if (!reg.test(value)) { } else if (!reg.test(value)) {
callback(new Error('仅支持输出大于或等于0的数字,可支持小数点后两位')) callback(new Error('仅支持输出大于或等于0的数字,可支持小数点后两位'))
} else if (value == 0) {
callback(new Error('奖励积分应大于0'))
} else if (value > 999999) {
callback(new Error('奖励积分应小于999999'))
} else { } else {
callback() callback()
} }
...@@ -547,7 +552,7 @@ export default { ...@@ -547,7 +552,7 @@ export default {
this.searchValue = val this.searchValue = val
this.basicForm.merchantName = val this.basicForm.merchantName = val
this.selectMerchant(val) this.selectMerchant(val)
}, 500), }, 1000),
// 选择活动 // 选择活动
selectActivity(selectItem) { selectActivity(selectItem) {
console.log(selectItem) console.log(selectItem)
...@@ -836,7 +841,12 @@ export default { ...@@ -836,7 +841,12 @@ export default {
// 基础信息表单验证 // 基础信息表单验证
basicFormValidate() { basicFormValidate() {
this.$refs['basicForm'].validate((valid) => { this.$refs['basicForm'].validate((valid) => {
if (!valid) return console.log(valid)
if (!valid) {
console.log(111)
// return all
throw '必须选定一个值'
}
}) })
}, },
// 任务计划表单验证 // 任务计划表单验证
...@@ -867,11 +877,17 @@ export default { ...@@ -867,11 +877,17 @@ export default {
message: '请至少填写一条任务计划', message: '请至少填写一条任务计划',
type: 'error', type: 'error',
}) })
return false
} }
}, },
// 提交任务 // 提交任务
submitTask() { submitTask() {
this.basicFormValidate() try {
this.basicFormValidate()
} catch (err) {
if (err) return
}
let validFlag = this.taskFormValidate() let validFlag = this.taskFormValidate()
console.log(validFlag, '11') console.log(validFlag, '11')
if (validFlag[0] > 0) { if (validFlag[0] > 0) {
...@@ -883,7 +899,7 @@ export default { ...@@ -883,7 +899,7 @@ export default {
}) })
return return
} }
this.taskFormEmptyValidate() // this.taskFormEmptyValidate()
let params = JSON.parse(JSON.stringify(this.basicForm)) let params = JSON.parse(JSON.stringify(this.basicForm))
params.startTime = this.startTime params.startTime = this.startTime
params.endTime = this.endTime params.endTime = this.endTime
...@@ -900,25 +916,29 @@ export default { ...@@ -900,25 +916,29 @@ export default {
console.log(params, 'params') console.log(params, 'params')
// 创建 // 创建
if (!this.isEditor) { if (!this.isEditor) {
// taskApi.creatMission(params).then((res) => { taskApi.creatMission(params).then((res) => {
// console.log(res) console.log(res)
// if (res && res.code == 0) { if (res && res.code == 0) {
// this.$root.close('*添加任务模板') this.$root.to([
// this.$root.to([ '任务中心(自测)',
// '任务中心', '任务平台',
// '任务平台', '任务管理',
// '任务管理', '任务模板管理',
// '任务模板管理', '任务管理列表',
// '任务管理列表', ])
// ]) this.$root.close('*添加任务模板')
// } } else {
// }) this.$message({
message: res.message,
type: 'error',
})
}
})
return return
} }
// 编辑 // 编辑
taskApi.updateMission(params).then((res) => { taskApi.updateMission(params).then((res) => {
if (res && res.code == 0) { if (res && res.code == 0) {
this.$root.close('*添加任务模板')
this.$root.to([ this.$root.to([
'任务中心', '任务中心',
'任务平台', '任务平台',
...@@ -926,12 +946,17 @@ export default { ...@@ -926,12 +946,17 @@ export default {
'任务模板管理', '任务模板管理',
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板')
} else {
this.$message({
message: res.message,
type: 'error',
})
} }
}) })
}, },
// 取消 // 取消
cancelSubmit() { cancelSubmit() {
this.$root.close('*添加任务模板')
this.$root.to([ this.$root.to([
'任务中心', '任务中心',
'任务平台', '任务平台',
...@@ -939,6 +964,7 @@ export default { ...@@ -939,6 +964,7 @@ export default {
'任务模板管理', '任务模板管理',
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板')
}, },
}, },
} }
...@@ -946,7 +972,7 @@ export default { ...@@ -946,7 +972,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.task-box { .task-box {
padding: 0 20px; padding: 0 20px 20px 0;
.task-content { .task-content {
margin-bottom: 120px; margin-bottom: 120px;
} }
......
...@@ -266,13 +266,7 @@ export default { ...@@ -266,13 +266,7 @@ export default {
type, type,
} }
this.$root.to( this.$root.to(
[ ['任务中心', '任务平台', '任务管理', '任务模板管理', '*添加任务模板'],
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*添加任务模板',
],
para para
) )
// console.log(this.$root) // console.log(this.$root)
...@@ -316,26 +310,14 @@ export default { ...@@ -316,26 +310,14 @@ export default {
// 跳转查看详情 // 跳转查看详情
handleViewDetail(scope) { handleViewDetail(scope) {
this.$root.to( this.$root.to(
[ ['任务中心', '任务平台', '任务管理', '任务模板管理', '*查看任务'],
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*查看任务',
],
{ taskId: scope.id } { taskId: scope.id }
) )
}, },
// 任务分析 // 任务分析
handleAnalyze(scope) { handleAnalyze(scope) {
this.$root.to( this.$root.to(
[ ['任务中心', '任务平台', '任务管理', '任务模板管理', '*任务分析'],
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*任务分析',
],
{ taskId: scope.id } { taskId: scope.id }
) )
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!