| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- const LOGIN_LIST = ['pages/mine/mine']
- /*
- * 全局注入器
- */
- let page = {
- data() {
- return {
- }
- },
- computed: {
- //ios底部安全区域
- safeAreaBottom() {
- let info = uni.getSystemInfoSync()
- let safe = 20
- if (
- info && ['devtools', 'ios'].includes(info.platform) &&
- info.statusBarHeight > safe
- ) {
- return info.statusBarHeight - safe + 'px'
- }
- return 0
- },
- formatTime() {
- return (data, format = 'yyyy-mm-dd') => {
- // yyyy-mm-dd hh:MM:ss
- return this.$u.timeFormat(this.$dateTime.getTime(data), format)
- }
- },
- numberNull() {
- return data => {
- if (data == -1 || this.$isEmpty(data)) {
- return 0
- }
- return data
- }
- }
- },
- onLoad(options) {
- let currentPage = this.$util.getCurrentRoute()
- if (LOGIN_LIST.includes(currentPage)) {
- this.login()
- }
- },
- methods: {
- init() {
- console.log("登录成功,初始化数");
- },
- // 登录 begin
- showLogin(notToast = false) {
- // #ifdef MP-WEIXIN
- this.$refs.login.show(notToast)
- // #endif
- // #ifdef H5
- setTimeout(() => {
- this.$refs.login.show(notToast)
- }, 20)
- // #endif
- },
- signIn(resp) {
- //获取数据
- this.init()
- },
- async login(e) {
- if (this.$isEmpty(this.vuex_userId)) {
- this.showLogin()
- return
- }
- //获取数据
- this.init()
- //获取手机号
- if (this.$isEmpty(this.vuex_phone) && this.$config.isAuthPhone) {
- this.$refs.login.showPhoneModal()
- }
- },
- phoneSuccess() {
- console.log('手机号获取成功>>>>>>>>');
- },
- // 登录 end
- },
- }
- export default page
|