menuMinxin.js 1.49 KB
/*
 * @Author: yangming@didihu.com.cn yangming@didihu.com.cn
 * @Date: 2025-05-13 10:52:26
 * @LastEditors: yangming@didihu.com.cn yangming@didihu.com.cn
 * @LastEditTime: 2025-05-13 14:06:00
 * @FilePath: \ww-ai-market\src\mixins\menuMinxin.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { indexApi } from '@/api'
import { Notify } from 'vant'
export default {
  data() {
    return {
      menuList: [],
      userInfo: {}
    }
  },
  computed: {
    userId() {
      let userInfo = this.getLocalStorage('ww_userInfo') || {}
      this.userInfo = userInfo || {}
      return userInfo.userId
    }
  },
  mounted() {
    this.getAiMenu()
  },
  methods: {
    async getAiMenu() {
      try {
        let { userId } = this
        const { code, data, message } = await indexApi.getAiMenu({
          userId
        })
        if (code == 0) {
          this.menuList = data
        } else throw message
      } catch (error) {
        Notify(typeof error == 'string' ? error : '获取失败')
      }
    },

    handleClick(e) {
      const { ownerPost, agentUrl, domainName, presuppositionProblem, accountPhone } = e
      if (agentUrl)
        window.location.href = `${agentUrl}?one_id=${this.userId}&platformType=0&phone=${accountPhone}&position=${ownerPost}&domain=${domainName}&presuppositionProblem=${presuppositionProblem}`
      else Notify('获取链接失败')
    }
  }
}