123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- import login from '../../utils/login'
- import { VueLikePage } from '../../utils/page'
- import Router from '../../utils/routes'
- import { autoSubcrebe, subcrebe } from '../../utils/utils'
- const app = getApp();
- VueLikePage([], {
- options: {
- addGlobalClass: true,
- },
- data: {
- cu_items: [{
- title: '名片夹',
- icon: 'my_contacts',
- value: 'businessCard',
- needLogin: true
- },
- {
- title: '已收藏产品',
- icon: 'my_product',
- value: 'collectGoods',
- needLogin: true
- },
- // {
- // title: '已收藏参展商',
- // icon: 'my_enterprise',
- // value: 'collectEnterprise',
- // },
- // {
- // title: '数据报表',
- // icon: 'my_reportform',
- // value: 'dataReport',
- // needLogin: true
- // },
- {
- title: '账号设置',
- icon: 'my_set',
- value: 'logout',
- needLogin: true
- },
- {
- title: '开启消息订阅',
- icon: 'cus_msg',
- value: 'message',
- needLogin: true,
- hiddenKey: 'isCustomer',
- hidden: getApp().globalData.userinfo ? getApp().globalData.userinfo.type==='guide' : false
- },
- ],
- user_code: '',
- isLogined: app.globalData.token ? true : false,
- userinfo: app.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')
- return
- }
- Router.push(value)
- },
- toModifyUser() {
- if (!this.data.isLogined) {
- return
- }
- wx.navigateTo({
- url: '/pages/user-info/user-info',
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (e) {
- wx.login({
- success: (res) => {
- this.setData({
- user_code: res.code
- })
- }
- })
- },
- onShow: function () {
- let cu_items = this.data.cu_items
- this.isCustomer = app.globalData.userinfo ? app.globalData.userinfo.type !== 'guide' : false
- cu_items.forEach(item => {
- if (item.hiddenKey) {
- item.hidden = this[item.hiddenKey]
- }
- })
- this.setData({
- cu_items,
- isLogined: app.globalData.token ? true : false,
- userinfo: app.globalData.userinfo
- });
-
- },
- bindgetphonenumber(e) {
- login(e, this.data.user_code).then(res => {
- this.setData({
- isLogined: app.globalData.token ? true : false,
- userinfo: app.globalData.userinfo
- })
- })
- },
- toLogin () {
- Router.push('login')
- }
- }
- })
|