|
@@ -1,7 +1,7 @@
|
|
|
-import login from '../../utils/login'
|
|
|
+import {loginByUserInfo, loginFn} from './../../utils/login'
|
|
|
import { VueLikePage } from '../../utils/page'
|
|
|
import Router from '../../utils/routes'
|
|
|
-import { autoSubcrebe, subcrebe } from '../../utils/utils'
|
|
|
+import { autoSubcrebe, subcribe } from '../../utils/utils'
|
|
|
const app = getApp();
|
|
|
VueLikePage([], {
|
|
|
options: {
|
|
@@ -47,15 +47,19 @@ VueLikePage([], {
|
|
|
},
|
|
|
],
|
|
|
user_code: '',
|
|
|
- isLogined: app.globalData.token ? true : false,
|
|
|
- userinfo: app.globalData.userinfo
|
|
|
+ isLogined: getApp().globalData.token ? true : false,
|
|
|
+ userinfo: getApp().globalData.userinfo
|
|
|
},
|
|
|
methods: {
|
|
|
Navigator_to(e) {
|
|
|
const { value } = e.currentTarget.dataset
|
|
|
const item = this.data.cu_items.find(item => item.value === value)
|
|
|
if (item.needLogin && !getApp().globalData.token) {
|
|
|
- Router.push('login')
|
|
|
+ this.toLogin()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (value === 'message') {
|
|
|
+ subcribe()
|
|
|
return
|
|
|
}
|
|
|
Router.push(value)
|
|
@@ -83,7 +87,7 @@ VueLikePage([], {
|
|
|
},
|
|
|
onShow: function () {
|
|
|
let cu_items = this.data.cu_items
|
|
|
- this.isCustomer = app.globalData.userinfo ? app.globalData.userinfo.type !== 'guide' : false
|
|
|
+ this.isCustomer = getApp().globalData.userinfo ? getApp().globalData.userinfo.type !== 'guide' : false
|
|
|
cu_items.forEach(item => {
|
|
|
if (item.hiddenKey) {
|
|
|
item.hidden = this[item.hiddenKey]
|
|
@@ -91,21 +95,45 @@ VueLikePage([], {
|
|
|
})
|
|
|
this.setData({
|
|
|
cu_items,
|
|
|
- isLogined: app.globalData.token ? true : false,
|
|
|
- userinfo: app.globalData.userinfo
|
|
|
+ isLogined: getApp().globalData.token ? true : false,
|
|
|
+ userinfo: getApp().globalData.userinfo,
|
|
|
+ showLogin: false
|
|
|
});
|
|
|
+ wx.login({
|
|
|
+ success: (res) => {
|
|
|
+ if (res.code) {
|
|
|
+ this.wx_code = res.code
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ bindgetuserinfo (e) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '登陆中',
|
|
|
+ })
|
|
|
+ loginByUserInfo(e.detail, this.wx_code).then(() => {
|
|
|
+ wx.hideLoading({
|
|
|
+ complete: (res) => {
|
|
|
+ this.onShow()
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
+ },
|
|
|
+ toLogin () {
|
|
|
+ // Router.push('login')
|
|
|
+ this.setData({
|
|
|
+ showLogin: true
|
|
|
+ })
|
|
|
},
|
|
|
- bindgetphonenumber(e) {
|
|
|
- login(e, this.data.user_code).then(res => {
|
|
|
- this.setData({
|
|
|
- isLogined: app.globalData.token ? true : false,
|
|
|
- userinfo: app.globalData.userinfo
|
|
|
- })
|
|
|
+ hideLogin () {
|
|
|
+ this.setData({
|
|
|
+ showLogin: false
|
|
|
})
|
|
|
},
|
|
|
- toLogin () {
|
|
|
- Router.push('login')
|
|
|
+ loginSuccess () {
|
|
|
+ console.log('login')
|
|
|
+ this.onShow()
|
|
|
}
|
|
|
}
|
|
|
})
|