Commit 660c1c73 authored by leiqingsong's avatar leiqingsong

替换userId

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