var dirUrl = encodeURIComponent("http://10.0.0.36:8088/collection"); var that = this; this.$axios({ method: "GET", url: "/wxApi/cgi-bin/token?grant_type=client_credential&appid=wx97ae314497d666cc&secret=c908c74358240912dfe995474b3da54d", }) .then(function(res) { that.$axios({ method: "POST", url: "/wxApi/cgi-bin/menu/create?access_token=" + res.data.access_token, data: { "button": [{ "name": "入职管理", "sub_button": [{ "type": "view", "name": "入职指引", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx97ae314497d666cc&redirect_uri=" + dirUrl + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect" },{ "type": "view", "name": "入职申请", "url": "http://10.0.0.4:8099" }] }, { "name": "合同管理", "sub_button": [{ "type": "view", "name": "入职指引", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx97ae314497d666cc&redirect_uri=" + dirUrl + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect" }] } ] } }) .then(function(res) { console.log(res) }) .catch(function(err) { }) }) .catch(function(err) { })