Commit 83a330a3 by 前端

修复bug

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