Commit 660c1c73 authored by leiqingsong's avatar leiqingsong

替换userId

parent 33a8642d
...@@ -24,13 +24,6 @@ export default { ...@@ -24,13 +24,6 @@ export default {
}, },
mounted() { mounted() {
getAuthToken() getAuthToken()
.then(res => {
// const token = res;
console.log(res);
})
.catch(err => {
console.log("error", err);
});
} }
}; };
</script> </script>
......
...@@ -73,7 +73,6 @@ export function logout(token) { ...@@ -73,7 +73,6 @@ export function logout(token) {
export function getUserInfo() { export function getUserInfo() {
return request({ return request({
url: "/api/user/info", url: "/api/user/info",
method: "post", method: "post"
}); });
} }
\ No newline at end of file
...@@ -8,9 +8,10 @@ import "amfe-flexible"; ...@@ -8,9 +8,10 @@ import "amfe-flexible";
import "@/plugins/vant-ui.js"; import "@/plugins/vant-ui.js";
import "@/plugins/echarts-plugins.js"; import "@/plugins/echarts-plugins.js";
import Vconsole from "vconsole"; import Vconsole from "vconsole";
import { getUserId } from "./utils/localGetter";
Vue.prototype.$userId = getUserId();
Vue.prototype.$vConsole = new Vconsole(); Vue.prototype.$vConsole = new Vconsole();
Vue.use(MiniRefreshTools); Vue.use(MiniRefreshTools);
Vue.config.productionTip = false; Vue.config.productionTip = false;
......
...@@ -3,24 +3,26 @@ import jsBridge from "./bridge"; ...@@ -3,24 +3,26 @@ import jsBridge from "./bridge";
import { getUserInfo } from "@/api/user"; import { getUserInfo } from "@/api/user";
// 获取Token // 获取Token
export function getAuthToken() { export function getAuthToken() {
return new Promise((resolve, reject) => { getUserInfo().then()
console.log("调用1"); // return new Promise((resolve, reject) => {
// console.log("调用1");
jsBridge.callhandler("getAuthToken", null, data => { jsBridge.callhandler("getAuthToken", null, data => {
console.log("调用2"); console.log("调用2");
localStorage.setItem("token", data); localStorage.setItem("token", data);
console.log("--------------"); console.log("--------------");
if (data) { if (data) {
getUserInfo().then(res=>{ getUserInfo().then(res => {
if (res.code === 0) {
localStorage.setItem("user", JSON.stringify(res.data));
}
}) })
alert("获取到的token" + data); // resolve(data);
resolve(data);
} else { } else {
reject("调用失败,未返回data"); // reject("调用失败,未返回data");
console.log("调用失败");
} }
}); });
}); // });
} }
// 退出 // 退出
......
export function getUserId() {
return JSON.parse(localStorage.getItem('user')).userId;
}
\ No newline at end of file
...@@ -11,8 +11,10 @@ const service = axios.create({ ...@@ -11,8 +11,10 @@ const service = axios.create({
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
const token = localStorage.getItem("token"); // const token = localStorage.getItem("token");
config.headers["Authorization"] = "Bearer " + token; const token = "b5f71c00b8fa4fe6b2eac577d9f15e19";
// config.headers["Authorization"] = "Bearer " + token;
config.headers["token"] = token;
if (!config.loading) { if (!config.loading) {
loading = Toast.loading({ loading = Toast.loading({
forbidClick: true, forbidClick: true,
......
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
data() { data() {
return { return {
total: 0, total: 0,
userPoolVos: [{ userId: "" }], userPoolVos: [{ userId: this.$userId }],
timer: null timer: null
}; };
}, },
......
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
}, },
getBankInfo() { getBankInfo() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
getUserBankInfo(params).then(res => { getUserBankInfo(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
methods: { methods: {
getWithdrawal() { getWithdrawal() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
getWithdrawalAmount(params).then(res => { getWithdrawalAmount(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
}, },
getRecordList(yearMonth) { getRecordList(yearMonth) {
const params = { const params = {
userId: "13100911369", userId: this.$userId,
yearMonth: yearMonth yearMonth: yearMonth
}; };
getWithdrawalRecord(params).then(res => { getWithdrawalRecord(params).then(res => {
......
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
name: "CashOut", name: "CashOut",
data() { data() {
return { return {
userPhone: "13100911369", userPhone: this.$userId,
bank: "", bank: "",
money: null, money: null,
remainMoney: 100, remainMoney: 100,
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
} }
const params = { const params = {
userId: this.userPhone userId: this.$userId
}; };
sendSms(params).then(); sendSms(params).then();
this.validCode = null; this.validCode = null;
...@@ -123,7 +123,7 @@ export default { ...@@ -123,7 +123,7 @@ export default {
}, },
getUserInfo() { getUserInfo() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
getUserBankInfo(params).then(res => { getUserBankInfo(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
methods: { methods: {
getAllRecord() { getAllRecord() {
const params = { const params = {
userId: "5" userId: this.$userId
}; };
showIncomeRecord(params).then(res => { showIncomeRecord(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -231,7 +231,7 @@ export default { ...@@ -231,7 +231,7 @@ export default {
}, },
getDetail() { getDetail() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
queryIncomeDetail(params).then(res => { queryIncomeDetail(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
// 获取用户钱包展示信息 // 获取用户钱包展示信息
getWalletInfo() { getWalletInfo() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
getMoneyPackage(params) getMoneyPackage(params)
.then(res => { .then(res => {
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
checkBtn() { checkBtn() {
const params = { const params = {
headImage: this.imageUrl, headImage: this.imageUrl,
userId: "18757121665" userId: this.$userId
}; };
setAvatar(params).then(res => { setAvatar(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
methods: { methods: {
getMoment() { getMoment() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
findByUserId(params).then(res => { findByUserId(params).then(res => {
console.log(res); console.log(res);
......
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
}, },
getRecommendInfo() { getRecommendInfo() {
const params = { const params = {
userId: "13933770749" userId: this.$userId
}; };
recomendInfo(params).then(res => { recomendInfo(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -177,7 +177,7 @@ export default { ...@@ -177,7 +177,7 @@ export default {
}, },
getRecommendDetail(level) { getRecommendDetail(level) {
const params = { const params = {
userid: "13933770749", userId: this.$userId,
userlevel: level userlevel: level
}; };
recommendDetail(params).then(res => { recommendDetail(params).then(res => {
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
data() { data() {
return { return {
form: { form: {
userId: "", userId: this.$userId,
sms: "", sms: "",
beInvitedCode: "" beInvitedCode: ""
}, },
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
methods: { methods: {
getData() { getData() {
const params = { const params = {
userId: "18757121665" userId: this.$userId
}; };
monthRewards(params).then(res => { monthRewards(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
......
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
this.inviteeCode = this.fillCode; this.inviteeCode = this.fillCode;
const params = { const params = {
inviteCode: this.fillCode, inviteCode: this.fillCode,
userId: "18757121665" userId: this.$userId
}; };
fillInviteCode(params).then(); fillInviteCode(params).then();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment