123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- const app = getApp()
- import {
- throttle,
- getWaterDrop
- } from '../../utils/index/index'
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- isHomePage: {
- type: Boolean,
- value: false
- },
- },
- props: {
- onSure: {
- type: Function,
- value: () => {}
- },
- onBack: {
- type: Function,
- value: () => {}
- },
- suerName: '确定',
- logoutName: '退出',
- showBtn: true,
- logOut: '/pages/home/index',
- isCustomBack: false
- },
- /**
- * 组件的初始数据
- */
- data: {
- intervalId: null,
- },
- didMount() {
- this.interval()
- },
- /**
- * 组件的方法列表
- */
- methods: {
- interval() {
- var that = this;
- if (app.globalData.sn) {
- that.setData({
- appVersion: app.globalData.appVersion,
- sn: app.globalData.sn,
- })
- } else {
- that.data.intervalId = setInterval(function () {
- if (app.globalData.sn) {
- that.setData({
- appVersion: app.globalData.appVersion,
- sn: app.globalData.sn,
- })
- clearInterval(that.data.intervalId);
- }
- }, 1000);
- }
- },
- logOut() {
- clearInterval(this.data.intervalId);
- app.data.isOkBrushingCard = false
- app.data.isOkQrCodeSignIn = false
- if (!this.props.isHomePage) {
- console.log(this.props.isCustomBack)
- if (this.props.isCustomBack) {
- this.props.onBack('back');
- }else {
- my.reLaunch({
- url: this.props.logOut,
- })
- }
- }
- },
- clickSure: throttle( function () {
- clearInterval(this.data.intervalId);
- this.props.onSure('sure');
- }, 5000),
- },
- observers: {}
- })
|