12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- Component({
- data: {
- userInfoTop: 0,
- cardBackground: '',
- time: 0
- },
- props: {
- cardInfo: {},
- componentData: {},
- onNextPage: () => null
- },
- didMount() {
- this.setUserInfoTop();
- this.setCardBackground();
- },
- didUpdate() {},
- didUnmount() {},
- methods: {
- /*
- * 设置背景图
- * */
- setCardBackground() {
- const {
- componentData
- } = this.props;
- const {
- componentExtInfo
- } = componentData;
- const {
- cardBackground = ''
- } = componentExtInfo || {};
- this.setData({
- cardBackground
- });
- },
- /*
- * 设置位置
- * */
- setUserInfoTop() {
- const {
- componentData
- } = this.props;
- const {
- componentExtInfo
- } = componentData;
- const {
- userInfoPositionTop = 0
- } = componentExtInfo || {};
- this.setData({
- userInfoPositionTop: +userInfoPositionTop
- });
- },
- toDetail() {
- this.props.onNextPage(2);
- },
- refreshCard() {
- const {
- healthCardId
- } = this.props.cardInfo;
- if (this.data.time !== 0) {
- return;
- }
- this.setData({
- time: 60
- });
- this.timer = setInterval(() => {
- this.setData({
- time: this.data.time - 1
- });
- this.data.time === 0 && clearInterval(this.timer);
- }, 1000);
- this.props.onRefreshCard(healthCardId);
- }
- }
- });
|