Commit 5fe78b53 by xuyl

Merge branch 'v2.12.0' of http://192.168.3.233:8090/glsx-web/glsx-oss-task into xuyl_dev_v2.12.0

2 parents 4bf33f6e 568320bc
...@@ -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,12 +22,14 @@ ...@@ -22,12 +22,14 @@
<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"
@change="changeMerchant" @change="changeMerchant"
@focus="selectMerchant" @focus="selectMerchant"
:loading="merchantLoading"
> >
<el-option <el-option
v-for="(item, index) in merchantList" v-for="(item, index) in merchantList"
...@@ -44,6 +46,7 @@ ...@@ -44,6 +46,7 @@
size="small" size="small"
@focus="openActivityDia" @focus="openActivityDia"
:disabled="isEditor" :disabled="isEditor"
readonly
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="任务指定人群:" prop="crowd"> <el-form-item label="任务指定人群:" prop="crowd">
...@@ -177,7 +180,10 @@ ...@@ -177,7 +180,10 @@
:prop="'missionList.' + index1 + '.rewardType'" :prop="'missionList.' + index1 + '.rewardType'"
:rules="taskFormRules.rewardType" :rules="taskFormRules.rewardType"
> >
<el-radio-group v-model="itm.rewardType"> <el-radio-group
v-model="itm.rewardType"
@change="rewardTypeChange(itm)"
>
<el-radio :label="1">累计奖励</el-radio> <el-radio :label="1">累计奖励</el-radio>
<el-radio :label="2">排名奖励</el-radio> <el-radio :label="2">排名奖励</el-radio>
</el-radio-group> </el-radio-group>
...@@ -188,7 +194,10 @@ ...@@ -188,7 +194,10 @@
:prop="'missionList.' + index1 + '.rewardCount'" :prop="'missionList.' + index1 + '.rewardCount'"
:rules="taskFormRules.rewardCount" :rules="taskFormRules.rewardCount"
> >
<el-radio-group v-model="itm.rewardCount"> <el-radio-group
v-model="itm.rewardCount"
@change="rewardCountChange(itm)"
>
<el-radio :label="1">单次</el-radio> <el-radio :label="1">单次</el-radio>
<el-radio :label="2">重复累计</el-radio> <el-radio :label="2">重复累计</el-radio>
</el-radio-group> </el-radio-group>
...@@ -286,6 +295,7 @@ ...@@ -286,6 +295,7 @@
import { commonApi } from '../../../api/commonApi' import { commonApi } from '../../../api/commonApi'
import { taskApi } from '../../../api/task' import { taskApi } from '../../../api/task'
import ActivityDia from './components/activityDia.vue' import ActivityDia from './components/activityDia.vue'
import { utils } from 'glsx-common'
export default { export default {
components: { components: {
ActivityDia, ActivityDia,
...@@ -293,11 +303,15 @@ export default { ...@@ -293,11 +303,15 @@ export default {
data() { data() {
// 奖励积分校验规则 // 奖励积分校验规则
const validateAwardIntegral = (rule, value, callback) => { const validateAwardIntegral = (rule, value, callback) => {
let reg = /(^[0-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/ let reg = /(^[0-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{0,2}$)/
if (!value) { if (!value) {
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()
} }
...@@ -329,18 +343,19 @@ export default { ...@@ -329,18 +343,19 @@ export default {
activityDiaVisible: false, activityDiaVisible: false,
// 活动日期天数 // 活动日期天数
taskDateNum: 0, taskDateNum: 0,
merchantLoading: false,
btnList: [ btnList: [
{ {
name: '表情', name: '表情',
funcName: '', funcName: '',
type: 'expression', type: 'expression',
limitSize: 10, limitSize: 10,
limitNum: 9,
}, },
{ {
name: '图片', name: '图片',
funcName: '', funcName: '',
type: 'img', type: 'img',
limitNum: 9,
uploadApi: commonApi.uploadImgApi, uploadApi: commonApi.uploadImgApi,
}, },
{ {
...@@ -381,25 +396,25 @@ export default { ...@@ -381,25 +396,25 @@ export default {
// 分享指标任务类型 // 分享指标任务类型
shareObj: { shareObj: {
missionMaterialList: [], missionMaterialList: [],
rewardType: '0', rewardType: '',
rewardCount: '0', rewardCount: '',
triggerValue: '', triggerValue: '',
}, },
// 浏览指标任务类型 // 浏览指标任务类型
browseObj: { browseObj: {
rewardType: '0', rewardType: '',
rewardCount: '0', rewardCount: '',
repeatCount: '', repeatCount: '',
triggerValue: '', triggerValue: '',
}, },
// 访客指标任务类型 // 访客指标任务类型
visitorObj: { visitorObj: {
rewardType: '0', rewardType: '',
triggerValue: '0', triggerValue: '',
}, },
// 成单指标任务类型 // 成单指标任务类型
orderObj: { orderObj: {
rewardType: '0', rewardType: '',
triggerValue: '', triggerValue: '',
}, },
// 编辑任务计划数据 // 编辑任务计划数据
...@@ -510,12 +525,16 @@ export default { ...@@ -510,12 +525,16 @@ export default {
}) })
return return
} }
this.merchantLoading = true
let params = {} let params = {}
params.merchantAccountType = 4 params.merchantAccountType = 4
params.merchantName = query params.merchantName = query
taskApi.findMerchantByScene(params).then((res) => { taskApi.findMerchantByScene(params).then((res) => {
console.log(res) console.log(res)
if (res.code == 0) {
this.merchantList = res.data this.merchantList = res.data
}
this.merchantLoading = false
}) })
}, },
// 商户改变获取商户名 // 商户改变获取商户名
...@@ -523,13 +542,17 @@ export default { ...@@ -523,13 +542,17 @@ export default {
this.basicForm.merchantName = this.basicForm.merchantName =
val && val &&
this.merchantList.find((item) => item.merchantId == val).merchantName this.merchantList.find((item) => item.merchantId == val).merchantName
// 清空活动
this.basicForm.activityId = ''
this.basicForm.activityName = ''
this.taskList = []
}, },
// 根据商户名搜索商户 // 根据商户名搜索商户
filterMethod(query) { filterMethod: utils.debounce(function (val) {
if (query !== '') { this.searchValue = val
this.selectMerchant(query) this.basicForm.merchantName = val
} this.selectMerchant(val)
}, }, 1000),
// 选择活动 // 选择活动
selectActivity(selectItem) { selectActivity(selectItem) {
console.log(selectItem) console.log(selectItem)
...@@ -596,8 +619,8 @@ export default { ...@@ -596,8 +619,8 @@ export default {
}) })
// 如果是编辑/复制页面,任务计划回显 // 如果是编辑/复制页面,任务计划回显
if (this.isEditor || this.isClone) this.dealEcho() if (this.isEditor || this.isClone) this.dealEcho()
// 如果是编辑,还需处理是否可编辑处理 // 如果是如果是编辑/新建页面,还需处理当前日期之前是否可编辑处理
if (this.isEditor) this.getEditTaskList() if (!this.isClone) this.getEditTaskList()
// 如果是克隆,还需处理克隆时间 // 如果是克隆,还需处理克隆时间
if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList() if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
return this.taskList return this.taskList
...@@ -804,31 +827,65 @@ export default { ...@@ -804,31 +827,65 @@ export default {
} }
}) })
}, },
// 奖励模式切换
rewardTypeChange(itm) {
console.log(itm)
if (itm.rewardType == 2) {
this.$nextTick(() => {
this.$set(itm, 'triggerValue', 0)
// itm.triggerValue = ''
})
} else {
this.$nextTick(() => {
this.$set(itm, 'rewardCount', '1')
// itm.rewardCount = ''
})
}
},
// 奖励次数切换
rewardCountChange(itm) {
if (itm.rewardCount == 2) {
this.$nextTick(() => {
this.$set(itm, 'repeatCount', 0)
this.$set(itm, 'triggerValue', 0)
// itm.repeatCount = ''
// itm.triggerValue = ''
})
} else {
this.$nextTick(() => {
this.$set(itm, 'triggerValue', 0)
// itm.triggerValue = ''
})
}
},
// 基础信息表单验证 // 基础信息表单验证
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 '必须选定一个值'
}
}) })
}, },
// 任务计划表单验证 // 任务计划表单验证
taskFormValidate() { taskFormValidate() {
this.taskList.every((item, index) => {
var validFlag = 0 var validFlag = 0
var dayIndex = 0
this.taskList.every((item, index) => {
this.$refs['taskForm'][index].validate((valid) => { this.$refs['taskForm'][index].validate((valid) => {
if (!valid) validFlag = validFlag + 1 if (!valid) validFlag = validFlag + 1
}) })
dayIndex = index
console.log(validFlag, '000')
// 检测到未填写跳转到未填写页面 // 检测到未填写跳转到未填写页面
if (validFlag > 0) { if (validFlag > 0) {
this.$alert('第' + (index + 1) + '天填写未完成', '警告', {
confirmButtonText: '知道了',
callback: (action) => {
this.activeName = index + ''
},
})
return false return false
} }
return true
}) })
return [validFlag, dayIndex]
}, },
// 任务计划是否为空验证 // 任务计划是否为空验证
taskFormEmptyValidate() { taskFormEmptyValidate() {
...@@ -841,13 +898,29 @@ export default { ...@@ -841,13 +898,29 @@ export default {
message: '请至少填写一条任务计划', message: '请至少填写一条任务计划',
type: 'error', type: 'error',
}) })
return false
} }
}, },
// 提交任务 // 提交任务
submitTask() { submitTask() {
try {
this.basicFormValidate() this.basicFormValidate()
this.taskFormValidate() } catch (err) {
this.taskFormEmptyValidate() if (err) return
}
let validFlag = this.taskFormValidate()
console.log(validFlag, '11')
if (validFlag[0] > 0) {
this.$alert('第' + (validFlag[1] + 1) + '天填写未完成', '警告', {
confirmButtonText: '知道了',
callback: (action) => {
this.activeName = validFlag[1] + ''
},
})
return
}
// 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
...@@ -867,7 +940,6 @@ export default { ...@@ -867,7 +940,6 @@ export default {
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([
'任务中心', '任务中心',
'任务平台', '任务平台',
...@@ -875,6 +947,12 @@ export default { ...@@ -875,6 +947,12 @@ export default {
'任务模板管理', '任务模板管理',
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板')
} else {
this.$message({
message: res.message,
type: 'error',
})
} }
}) })
return return
...@@ -882,7 +960,6 @@ export default { ...@@ -882,7 +960,6 @@ export default {
// 编辑 // 编辑
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([
'任务中心', '任务中心',
'任务平台', '任务平台',
...@@ -890,12 +967,17 @@ export default { ...@@ -890,12 +967,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([
'任务中心', '任务中心',
'任务平台', '任务平台',
...@@ -903,6 +985,7 @@ export default { ...@@ -903,6 +985,7 @@ export default {
'任务模板管理', '任务模板管理',
'任务管理列表', '任务管理列表',
]) ])
this.$root.close('*添加任务模板')
}, },
}, },
} }
...@@ -910,7 +993,7 @@ export default { ...@@ -910,7 +993,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;
} }
...@@ -951,7 +1034,7 @@ export default { ...@@ -951,7 +1034,7 @@ export default {
width: 475px; width: 475px;
} }
.el-form-item { .el-form-item {
margin-bottom: 10px; margin-bottom: 15px;
} }
.footer-close { .footer-close {
text-align: center; text-align: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!