CN110018760B - Time selection method, storage medium, equipment and system - Google Patents
Time selection method, storage medium, equipment and system Download PDFInfo
- Publication number
- CN110018760B CN110018760B CN201810023300.XA CN201810023300A CN110018760B CN 110018760 B CN110018760 B CN 110018760B CN 201810023300 A CN201810023300 A CN 201810023300A CN 110018760 B CN110018760 B CN 110018760B
- Authority
- CN
- China
- Prior art keywords
- time
- selection
- time period
- period
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000010187 selection method Methods 0.000 title claims abstract description 21
- 238000000034 method Methods 0.000 claims abstract description 15
- 230000006870 function Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 11
- 230000003068 static effect Effects 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000005316 response function Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0481—Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
- G06F3/04842—Selection of displayed objects or displayed text elements
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a time selection method, a storage medium, equipment and a system, which relate to the technical field of time selection, and the method comprises the following steps: presetting reference time, wherein the reference time is the local time of a user; setting a plurality of time periods by using the reference time and taking the current time as an end point, and correspondingly generating a time selection control for each time period; and returning to the corresponding time period according to the time selection control selected by the user. The invention can select a proper time period to accurately select time, has simple operation and does not need a user to perform complicated operation.
Description
Technical Field
The invention relates to the technical field of time selection, in particular to a time selection method, a storage medium, equipment and a system.
Background
At present, when a user needs to perform a certain time interval selection operation while viewing a data report, a history record, and the like, the time interval selection operation is usually accurate to days, for example: 2017-10-01-2017-10-10, and the problem that the traditional operation mode is too coarse in operation granularity and cannot see accurate data exists.
The existing solution is mostly as follows: providing a corresponding input box to enable a start time stamp and an end time stamp of a user data time interval to be calculated correspondingly;
however, although the existing solution solves the problem that a more accurate operation granularity cannot be provided, the user operation is too complicated, and the user needs to convert the relevant time into the timestamp each time the user uses the timestamp.
Disclosure of Invention
In view of the defects in the prior art, an object of the present invention is to provide a time selection method, a storage medium, a device and a system, which can select an appropriate time period, perform accurate time selection, and are simple to operate.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a time selection method for a client to select time, the method comprising the steps of:
presetting reference time, wherein the reference time is the local time of a user;
setting a plurality of time periods by using the reference time and taking the current time as a terminal point based on each preset rule, and correspondingly generating a time selection control for each time period;
returning to the corresponding time period according to the time selection control selected by the user; wherein,
the presetting of the reference time specifically comprises the following steps:
creating a time component for providing the time period at the client, configuring the reference time for the time component, and performing initialization operation on the time component;
all the preset rules are defined as static members of the class realizing the time components and are configured in the time components in an array form;
the method for setting the time period by using the reference time and taking the current time as the end point based on each preset rule comprises the following steps:
traversing the rule array, and acquiring the specific description of the preset rule from the members of the rule array;
transmitting a reference time to calculate a value of the time period;
generating a panel of an HTML element inserted into the time component according to the value of the time period; wherein,
the reference time is transmitted by a user or is the current time, and the rule array comprises at least one preset rule;
the time period comprises a start time and an end time, and is configured with a corresponding calculation function.
On the basis of the technical scheme, the time selection method further comprises the following steps:
the development end receives the returned time period and generates a time parameter for time selection;
and the development end performs time selection work according to the time parameters.
On the basis of the technical scheme, the time selection method further comprises the following steps;
and creating a callback function which is used for acquiring the time parameter and feeding the time parameter back to the development end.
On the basis of the technical scheme, in the time selection method, the following steps are carried out: the reference time is set by manually presetting or synchronizing the system time.
The invention also discloses a storage medium on which a computer program is stored which, when executed by a processor, carries out the steps of the above-mentioned time selection method.
The invention also discloses a time selection device, which comprises a memory, a processor and a computer program which is stored on the memory and runs on the processor, wherein the processor realizes the steps of the time selection method when executing the computer program.
The invention also discloses a time selection system, which comprises:
a reference time setting unit for setting a reference time in advance, the reference time being a user local time;
the time period unit is used for setting a plurality of time periods by taking the current time as an end point based on each preset rule by using the reference time, and correspondingly generating a time selection control for each time period;
the time period returning unit is used for returning the corresponding time period according to the time selection control selected by the user; wherein,
the reference time setting unit is specifically configured to create a time component for providing the time period at a client, configure the reference time for the time component, and perform initialization operation on the time component;
all the preset rules are defined as static members of the class realizing the time components and are configured in the time components in an array form;
the time period unit is also used for traversing a rule array and obtaining the specific description of the preset rule from the members of the rule array;
the time period unit transmits reference time to calculate the value of the time period;
the time period unit generates an HTML element according to the value of the time period and inserts the HTML element into a panel of the time component; wherein,
the reference time is transmitted by a user or is the current time, and the rule array comprises at least one preset rule;
the time period comprises a start time and an end time, and is configured with a corresponding calculation function.
On the basis of the above technical solution, the time selection system further includes:
a time parameter generating unit for generating a time parameter for time selection according to the time period;
and the time selection unit is used for carrying out time selection work according to the time parameter.
On the basis of the technical scheme, in the time selection system: the time parameter generating unit comprises a callback function subunit;
and the callback function subunit is used for acquiring the time parameter and feeding the time parameter back to the time parameter generating unit.
On the basis of the technical scheme, in the time selection system:
the reference time is set by manually presetting or synchronizing the system time.
Compared with the prior art, the invention has the advantages that:
(1) the method comprises the steps of setting a plurality of time periods by matching preset reference time with current time, generating a time selection space according to the time periods, and returning to the corresponding time period according to a time selection control selected by a client;
compared with the prior art, the method and the device can select a proper time period to accurately select the time, are simple to operate and do not need a user to perform complicated operation.
Drawings
FIG. 1 is a flow chart of a method of time selection in an embodiment of the present invention;
FIG. 2 is a block diagram of a time selection apparatus according to an embodiment of the present invention;
fig. 3 is a block diagram of a time selection system according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a time selection method for a client to select a time, where the method includes the following steps:
presetting reference time, wherein the reference time is the local time of a user;
setting a plurality of time periods by using the reference time and taking the current time as an end point, and correspondingly generating a time selection control for each time period;
and returning to the corresponding time period according to the time selection control selected by the user.
According to different users, the reference time of the users is different, and the reference time is used as the basis of time selection and is used as reference data;
the multiple time periods provide multiple time selection possibilities for the user, the precision of the time periods can be adjusted according to actual requirements, and because a time selection control is correspondingly generated in each time period, the client can select the corresponding time period by only selecting a time selection space, so that time selection work is performed;
the invention can select a proper time period to accurately select time, has simple operation and does not need a user to perform complicated operation.
The method for generating the reference time may be as follows:
a time component can be created in the client, and the purpose of the time component is to provide a precise time period value for a user, and the time component needs to provide a reference time for the component to initialize the component;
the initialization of the components is as follows:
<RelativeTimePicker
from={this.state.from}
till={this.state.till}
loading={this.state.loading}
onChange={(from,till)=>{
}}
/>
wherein from is a start time, tail is an end time, loading animation is carried out by a loading client when responding to an operator event, and onChange is a callback function required by a developer for transmitting a value to a time component after a user selects a time period;
when a developer using the component does not transfer two reference time values of from and bill, the reference time used by the component is the local time of the time zone in which the current running client is located;
the initialization mode enables the time assembly to be used more flexibly, because most of requirements do not need to provide specified time, the requirements of users can be met by automatically acquiring the time assembly, and meanwhile, if special requirements exist, the users can automatically specify a starting time value, so that different requirements can be met.
In addition, in this embodiment, a rule for setting a time period is given:
after having a reference time value, the component also needs to provide a series of rules for the component to generate different time periods.
The rules are specifically defined as follows:
static durations=[
{
last2Days:{
text:'Last 2days',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setDate(d.getDate()-2),
till:date,
};
},
},
last7Days:{
text:'Last 7 days',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setDate(d.getDate()-7),
till:date,
};
},
},
last30Days:{
text:'Last 30 days',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setDate(d.getDate()-30),
till:date,
};
},
},
last90Days:{
text:'Last 90 days',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setDate(d.getDate()-90),
till:date,
};
},
},
last6months:{
text:'Last 6months',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setMonth(d.getMonth()-6),
till:date,
};
},
},
…
}
in the implementation of time components, a rule is defined as a static member of a class implementing the time component, the static member of the rule is an array, and specific rules are defined in the array one by one. For example last2Days, it is obvious to know that this is the first two Days of time from the start time of the reference;
the advantages of the above method are: the rules are defined as static members of the classes, on one hand, the implementation of the time components is in accordance with the principle of object facing, the rules are also part of the classes of the time components and need to be encapsulated, and on the other hand, the rules are common to all the instances of the classes and do not need to be instantiated, so that the static members are realized to be more semantic-compliant.
Moreover, the present embodiment further provides a method for generating different time periods according to the rule and the reference time:
after the time component receives the reference time value, different time periods can be generated according to the rule;
first, the time element traverses the rule array, from the members of the array, e.g., last2Days
text:'Last 2days',
expr:(date)=>{
const d=new Date(date);
return{
from:d.setDate(d.getDate()-2),
till:date,
};
},
},
A detailed description of this rule can be obtained from its text member. Expr is then called to pass the reference time (either user passed or the current time since which the component has automatically gone). A specific value can be calculated where from and till constitute the value of the time period. Finally, generating HTML elements according to the numerical values and inserting the HTML elements into the panel of the assembly
Meanwhile, an event response function is added to the element, and when the HTML element corresponding to the time value is clicked, the interior of the component updates the internal state by using the from and the tip values of the time interval;
the setting mode has the advantages that because the rule provides uniform members and calculation functions, when the component circularly generates corresponding HTML elements, the method is more efficient, the specific numerical value of the time period can be obtained only by uniformly acquiring the description of the time interval from the text and calling the expr transfer reference time, and when the time component is expanded later, more time periods can be added only according to the same constraint.
In this embodiment, the time selection method further includes the following steps:
the development end receives the returned time period and generates a time parameter for time selection;
the development end performs time selection work according to the time parameters.
Specifically, the time selection method further includes the following steps;
creating a callback function which is used for acquiring time parameters and feeding back the time parameters to a development end;
specifically, the time parameter is fed back to the development end, i.e. the developer, in the following way:
after a user selects a time selection control, a time component in a client transmits two values of from and bill maintained in the time component to a developer through an onChange callback function provided by the developer so that the developer can work next step;
and a callback function mechanism is adopted, instead of enabling a user to obtain the internal state of the time component by himself, so that the problem that the encapsulation performance of the time component is damaged is avoided, and operation of developers is facilitated.
In this embodiment, in the time selection method: the reference time is set by manually presetting or synchronizing the system time.
An embodiment of the present invention provides a storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the time selection method described above.
Referring to fig. 2, an embodiment of the present invention provides a time selection apparatus, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the time selection method when executing the computer program.
Referring to fig. 3, an embodiment of the present invention provides a time selection system, including:
a reference time setting unit for setting a reference time in advance, the reference time being a user local time;
the time period unit is used for setting a plurality of time periods by using the reference time and taking the current time as an end point, and correspondingly generating a time selection control for each time period;
and the time period returning unit is used for returning the corresponding time period according to the time selection control selected by the user.
In this embodiment, the time selection system further includes:
a time parameter generating unit for generating a time parameter for time selection according to a time period;
and the time selection unit is used for carrying out time selection work according to the time parameter.
In this embodiment, in the time selection system: the time parameter generating unit comprises a callback function subunit;
and the callback function subunit is used for acquiring the time parameter and feeding the time parameter back to the time parameter generating unit.
In this embodiment, in the time selection system:
the reference time is set by manually presetting or synchronizing the system time.
It should be noted that: in the system provided in the above embodiment, when the time selection operation is implemented, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to complete all or part of the functions described above.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention.
Those not described in detail in this specification are within the skill of the art.
Claims (10)
1. A time selection method is used for time selection of a client side, and comprises the following steps:
presetting reference time, wherein the reference time is the local time of a user;
setting a plurality of time periods by using the reference time and taking the current time as a terminal point based on each preset rule, and correspondingly generating a time selection control for each time period;
returning to the corresponding time period according to the time selection control selected by the user; wherein,
the presetting of the reference time specifically comprises the following steps:
creating a time component for providing the time period at the client, configuring the reference time for the time component, and performing initialization operation on the time component;
all the preset rules are defined as static members of the class realizing the time components and are configured in the time components in an array form;
the method for setting the time period by using the reference time and taking the current time as the end point based on each preset rule comprises the following steps:
traversing the rule array, and acquiring the specific description of the preset rule from the members of the rule array;
transmitting a reference time to calculate a value of the time period;
generating a panel of an HTML element inserted into the time component according to the value of the time period; wherein,
the reference time is transmitted by a user or is the current time, and the rule array comprises at least one preset rule;
the time period comprises a start time and an end time, and is configured with a corresponding calculation function.
2. The time selection method of claim 1, further comprising the steps of:
the development end receives the returned time period and generates a time parameter for time selection;
and the development end performs time selection work according to the time parameters.
3. The time selection method of claim 2, wherein: the method further comprises the steps of;
and creating a callback function which is used for acquiring the time parameter and feeding the time parameter back to the development end.
4. The time selection method of claim 1, wherein: the reference time is set by manually presetting or synchronizing the system time.
5. A storage medium having a computer program stored thereon, characterized in that: the computer program when executed by a processor implements the steps of the method of any of the preceding claims 1 to 4.
6. A time selection device comprising a memory, a processor, and a computer program stored on the memory and executed on the processor, characterized in that: the processor, when executing the computer program, realizes the steps of the method of any of the preceding claims 1 to 4.
7. A time selection system, the system comprising:
a reference time setting unit for setting a reference time in advance, the reference time being a user local time;
the time period unit is used for setting a plurality of time periods by taking the current time as an end point based on each preset rule by using the reference time, and correspondingly generating a time selection control for each time period;
the time period returning unit is used for returning the corresponding time period according to the time selection control selected by the user; wherein,
the reference time setting unit is specifically configured to create a time component for providing the time period at a client, configure the reference time for the time component, and perform initialization operation on the time component;
all the preset rules are defined as static members of the class realizing the time components and are configured in the time components in an array form;
the time period unit is also used for traversing a rule array and obtaining the specific description of the preset rule from the members of the rule array;
the time period unit transmits reference time to calculate the value of the time period;
the time period unit generates an HTML element according to the value of the time period and inserts the HTML element into a panel of the time component; wherein,
the reference time is transmitted by a user or is the current time, and the rule array comprises at least one preset rule;
the time period comprises a start time and an end time, and is configured with a corresponding calculation function.
8. The time selection system of claim 7, wherein the system further comprises:
a time parameter generating unit for generating a time parameter for time selection according to the time period;
and the time selection unit is used for carrying out time selection work according to the time parameter.
9. The time selection system of claim 8, wherein the time parameter generation unit includes a callback function subunit;
and the callback function subunit is used for acquiring the time parameter and feeding the time parameter back to the time parameter generating unit.
10. The time selection system of claim 7, wherein:
the reference time is set by manually presetting or synchronizing the system time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810023300.XA CN110018760B (en) | 2018-01-10 | 2018-01-10 | Time selection method, storage medium, equipment and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810023300.XA CN110018760B (en) | 2018-01-10 | 2018-01-10 | Time selection method, storage medium, equipment and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110018760A CN110018760A (en) | 2019-07-16 |
CN110018760B true CN110018760B (en) | 2021-09-07 |
Family
ID=67188100
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810023300.XA Active CN110018760B (en) | 2018-01-10 | 2018-01-10 | Time selection method, storage medium, equipment and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110018760B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004632A (en) * | 2009-09-01 | 2011-04-06 | 阿里巴巴集团控股有限公司 | Method and device for setting time information |
CN104598252A (en) * | 2015-02-15 | 2015-05-06 | 北京恒华伟业科技股份有限公司 | Time control as well as method for determining time based on time control |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070268784A1 (en) * | 2006-05-17 | 2007-11-22 | Hongtao Xu | Alarm Clock Having Triple Weekly Alarms |
-
2018
- 2018-01-10 CN CN201810023300.XA patent/CN110018760B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004632A (en) * | 2009-09-01 | 2011-04-06 | 阿里巴巴集团控股有限公司 | Method and device for setting time information |
CN104598252A (en) * | 2015-02-15 | 2015-05-06 | 北京恒华伟业科技股份有限公司 | Time control as well as method for determining time based on time control |
Non-Patent Citations (1)
Title |
---|
最新版手机工商银行怎么查询账户明细;FC行者如风;《百度经验》;20170724;正文1-5页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110018760A (en) | 2019-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108345482B (en) | Dynamic page custom editing method and device, electronic equipment and storage medium | |
CN107733708B (en) | Equipment parameter configuration method and device, computer equipment and storage medium | |
CN105389191B (en) | A kind of method for upgrading software based on LAN, device and system | |
CN104883376B (en) | Application program recommends method and terminal | |
CN113365106B (en) | Multimedia resource generation method and device, electronic equipment and storage medium | |
JP2019523462A (en) | Multitask scheduling method, system, application server, and computer-readable storage medium | |
CN106681921B (en) | Method and device for realizing data parameterization | |
CN108038212B (en) | Data interaction method, device, system, equipment and storage medium | |
CN109408375A (en) | The generation method and device of interface document | |
CN113298331B (en) | Work order processing method, device and system and electronic equipment | |
CN109710817A (en) | Electronic device information input method, device, computer equipment and storage medium | |
CN111104450B (en) | Target data importing method, medium, device and computing equipment | |
CN109710631A (en) | Auxiliary generates method, apparatus, equipment and the computer storage medium of SQL code | |
CN109857452A (en) | A kind of configuration method and device of the rocket launch vehicle measurement based on XML | |
CN105892816A (en) | Method and device for calculating equipment desktop resetting | |
CN110018760B (en) | Time selection method, storage medium, equipment and system | |
CN110135940A (en) | Kitchen order display device and method afterwards | |
CN113568614A (en) | Task issuing method, electronic device and storage medium | |
CN106503062A (en) | Social dynamic publishing method and device and user terminal | |
CN113467782A (en) | Method, device and equipment for determining business process | |
CN112799949A (en) | Model optimization method, device, system and equipment | |
CN105490914B (en) | LED automation server and interaction method | |
CN110765150B (en) | Management method, device, server, medium and system | |
CN109739453B (en) | Splicing wall resolution ratio automatic configuration method and related equipment | |
CN111831380A (en) | Task execution method and device, storage medium and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |