Commit d08c088f authored by zhaofei's avatar zhaofei

s

parent 56807772
<view class="url-task">
<button size="small" type="primary" text="{{true}}" onTap="onOpenDialog" >{{taskData.title || '编辑任务'}}</button>
<!-- <task-dialog
<task-dialog
visible="{{visible}}"
a:if="{{visible}}"
onClose="onClose"
onUpdate="onUpdate"
unit="{{unit}}"
frequency="{{frequency}}"
hasItems="{{hasItems}}"
hasLink="{{hasLink}}"
taskData="{{taskData}}"
/> -->
<input a:if="{{hasLink}}" style="width: 250px" onChange="onChange" data-name="link" defaultValue="{{link}}" name="link" placeholder="请输入跳转链接"/>
<items-config a:if="{{hasItems}}" itemIds="{{itemIds}}" onUpdate="onItemIdsChange"/>
/>
</view>
Component({
mixins: [],
data: {
taskRateType: 1,
times: '',
title: '',
link: '',
itemIds: '',
value: ''
visible: false
},
props: {
hasLink: false,
unit: '',
frequency:'',
onUpdate: ()=> {},
taskData: {
title: '',
......@@ -24,27 +18,22 @@ Component({
},
didMount() {
},
didUpdate() { },
didUnmount() { },
didUpdate() {},
didUnmount() {},
methods: {
onUpdate() {
const { onUpdate, dataName, type } = this.props;
let taskData = { ...this.props.taskData, ...this.data, type };
onUpdate && onUpdate(taskData, dataName);
},
onChange(e) {
const { value } = e.detail;
const { name } = e.target.dataset;
onClose() {
this.setData({
[name]: value
visible: false
})
this.onUpdate()
},
onItemIdsChange(ids) {
onOpenDialog() {
this.setData({
itemIds: ids
visible: true
})
this.onUpdate()
},
onUpdate(taskData) {
const { onUpdate, dataName } = this.props;
onUpdate && onUpdate(taskData, dataName);
}
},
});
{
"component": true,
"usingComponents": {
"task-dialog": "/components/dialog/task-dialog/task-dialog",
"items-config": "/components/task/items-config/items-config"
"task-dialog": "/components/dialog/task-dialog/task-dialog"
}
}
......@@ -5,19 +5,20 @@ import { rankTableValidator, validateRangeNumber, rankTimeValidator, isNumber,va
export const descriptor = {
<% for(var i = 0; i < configList.length; ++i) {%>
<%- configList[i].validator ? configList[i].validator + ',' : '' %><% } %>
// tasks: {
// type: 'object',
// required: false,
// fields: {
// <% for(var i = 0; i < configList.length; ++i) {%>
// <%- taskKeys.includes(configList[i].key) && configList[i].validator ? configList[i].validator + ',' : '' %><% } %>
// }
// }
<%- !taskKeys.includes(configList[i].key) && configList[i].validator ? configList[i].validator + ',' : '' %><% } %>
tasks: {
type: 'object',
required: false,
fields: {
<% for(var i = 0; i < configList.length; ++i) {%>
<%- taskKeys.includes(configList[i].key) && configList[i].validator ? configList[i].validator + ',' : '' %><% } %>
}
}
}
export const formatValidator = (descriptor, validators) => {
validators = validators || {}
Object.keys(descriptor).forEach(key => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment