menuMinxin.js
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* @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('获取链接失败')
}
}
}