Commit d08c088f authored by zhaofei's avatar zhaofei

s

parent 56807772
<view class="url-task"> <view class="url-task">
<button size="small" type="primary" text="{{true}}" onTap="onOpenDialog" >{{taskData.title || '编辑任务'}}</button> <button size="small" type="primary" text="{{true}}" onTap="onOpenDialog" >{{taskData.title || '编辑任务'}}</button>
<!-- <task-dialog <task-dialog
visible="{{visible}}" visible="{{visible}}"
a:if="{{visible}}" a:if="{{visible}}"
onClose="onClose" onClose="onClose"
onUpdate="onUpdate" onUpdate="onUpdate"
unit="{{unit}}" unit="{{unit}}"
frequency="{{frequency}}"
hasItems="{{hasItems}}" hasItems="{{hasItems}}"
hasLink="{{hasLink}}" hasLink="{{hasLink}}"
taskData="{{taskData}}" 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> </view>
Component({ Component({
mixins: [], mixins: [],
data: { data: {
taskRateType: 1, visible: false
times: '',
title: '',
link: '',
itemIds: '',
value: ''
}, },
props: { props: {
hasLink: false, hasLink: false,
unit: '', unit: '',
frequency:'',
onUpdate: ()=> {}, onUpdate: ()=> {},
taskData: { taskData: {
title: '', title: '',
...@@ -24,27 +18,22 @@ Component({ ...@@ -24,27 +18,22 @@ Component({
}, },
didMount() { didMount() {
}, },
didUpdate() { }, didUpdate() {},
didUnmount() { }, didUnmount() {},
methods: { methods: {
onUpdate() { onClose() {
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;
this.setData({ this.setData({
[name]: value visible: false
}) })
this.onUpdate()
}, },
onItemIdsChange(ids) { onOpenDialog() {
this.setData({ this.setData({
itemIds: ids visible: true
}) })
this.onUpdate()
}, },
onUpdate(taskData) {
const { onUpdate, dataName } = this.props;
onUpdate && onUpdate(taskData, dataName);
}
}, },
}); });
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"task-dialog": "/components/dialog/task-dialog/task-dialog", "task-dialog": "/components/dialog/task-dialog/task-dialog"
"items-config": "/components/task/items-config/items-config"
} }
} }
...@@ -5,19 +5,20 @@ import { rankTableValidator, validateRangeNumber, rankTimeValidator, isNumber,va ...@@ -5,19 +5,20 @@ import { rankTableValidator, validateRangeNumber, rankTimeValidator, isNumber,va
export const descriptor = { export const descriptor = {
<% for(var i = 0; i < configList.length; ++i) {%> <% for(var i = 0; i < configList.length; ++i) {%>
<%- configList[i].validator ? configList[i].validator + ',' : '' %><% } %> <%- !taskKeys.includes(configList[i].key) && configList[i].validator ? configList[i].validator + ',' : '' %><% } %>
// tasks: { tasks: {
// type: 'object', type: 'object',
// required: false, required: false,
// fields: { fields: {
// <% for(var i = 0; i < configList.length; ++i) {%> <% 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 + ',' : '' %><% } %>
// } }
// } }
} }
export const formatValidator = (descriptor, validators) => { export const formatValidator = (descriptor, validators) => {
validators = validators || {} validators = validators || {}
Object.keys(descriptor).forEach(key => { 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