Commit 9cffeb61 authored by 全球's avatar 全球

修改

parents f741c165 cc1a3c7d
VUE_APP_BASE_URL = "http://8.131.244.76:81/" VUE_APP_BASE_URL = "http://8.131.244.76:81"
\ No newline at end of file \ No newline at end of file
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
</template> </template>
<script> <script>
import { getAuthToken } from "@/utils/bridgeToAppFun";
import BaseNavBar from "./components/BaseNavBar.vue"; import BaseNavBar from "./components/BaseNavBar.vue";
import { getUserInfo } from "@/api/user";
export default { export default {
components: { components: {
BaseNavBar BaseNavBar
...@@ -22,15 +22,31 @@ export default { ...@@ -22,15 +22,31 @@ export default {
this.currentTitle = val.meta.title; this.currentTitle = val.meta.title;
} }
}, },
mounted() { created() {
getAuthToken() console.log("和App开始交互");
this.$bridgeToAppFun
.getAuthToken()
.then(res => { .then(res => {
// const token = res; console.log("获取token成功", res);
console.log(res); this.saveUser(res);
}) })
.catch(err => { .catch(err => {
console.log("error", err); console.log("获取token失败", err);
}); });
},
methods: {
saveUser(data) {
if (data) {
getUserInfo().then(res => {
console.log("存用户信息");
if (res.code == 0) {
localStorage.setItem("user", JSON.stringify(res.data));
}
});
} else {
console.log("调用失败");
}
}
} }
}; };
</script> </script>
......
...@@ -55,7 +55,7 @@ export function cashOut(params) { ...@@ -55,7 +55,7 @@ export function cashOut(params) {
/** /**
* 获取用户银行卡信息 * 获取用户银行卡信息
* @param {*} params * @param {*} params userId
* @returns * @returns
*/ */
export function getUserBankInfo(params) { export function getUserBankInfo(params) {
...@@ -65,3 +65,14 @@ export function getUserBankInfo(params) { ...@@ -65,3 +65,14 @@ export function getUserBankInfo(params) {
params params
}); });
} }
/**
* 获取银行卡列表
* @returns
*/
export function getBankList() {
return request({
url: "/bank/getBankNameList",
method: "get"
});
}
...@@ -65,15 +65,26 @@ export function logout(token) { ...@@ -65,15 +65,26 @@ export function logout(token) {
}); });
} }
/** /**
* 根据token获取userId * 根据token获取userId
* @param {*} params token * @param {*} params token
*/ */
export function getUserInfo() { export function getUserInfo() {
return request({ return request({
url: "/api/user/info", url: "/api/user/info",
method: "post", method: "post"
});
}
/**
* 获取用户信息
* @param {*} params userId
* @returns
*/
export function getUserInfo2(params) {
return request({
url: "/user/getByUserId",
method: "get",
params
}); });
} }
\ No newline at end of file
...@@ -20,7 +20,31 @@ export default { ...@@ -20,7 +20,31 @@ export default {
}, },
methods: { methods: {
onClickLeft() { onClickLeft() {
this.$router.go(-1); const currentPage = this.$router.currentRoute.name;
console.log("router", currentPage);
const whiteList = [
"MyStatus",
"Publish",
"FastestProgress",
"MonthAward",
"Instructions",
"Settings",
"Grade",
"AirDrop",
"Invite",
"AboutUs",
"customerService"
];
if (whiteList.indexOf(currentPage) > -1) {
try {
this.$bridgeToAppFun.navigateBack();
} catch {
console.log("不能交互");
}
} else {
this.$router.go(-1);
}
// this.$router.go(-1);
}, },
onClickRight() { onClickRight() {
console.log("right"); console.log("right");
......
...@@ -8,9 +8,14 @@ import "amfe-flexible"; ...@@ -8,9 +8,14 @@ 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, getUserAvatar } from "./utils/localGetter";
Vue.prototype.$userId = getUserId();
Vue.prototype.$userAvatar = getUserAvatar();
Vue.prototype.$vConsole = new Vconsole(); import bridgeToAppFun from "@/utils/bridgeToAppFun";
Vue.prototype.$bridgeToAppFun = new bridgeToAppFun();
Vue.prototype.$vConsole = new Vconsole();
Vue.use(MiniRefreshTools); Vue.use(MiniRefreshTools);
Vue.config.productionTip = false; Vue.config.productionTip = false;
......
import Vue from "vue"; import Vue from "vue";
import { import {
ActionSheet,
Button, Button,
Cell, Cell,
CellGroup, CellGroup,
...@@ -24,7 +25,8 @@ import { ...@@ -24,7 +25,8 @@ import {
Loading Loading
} from "vant"; } from "vant";
Vue.use(Button) Vue.use(ActionSheet)
.use(Button)
.use(Cell) .use(Cell)
.use(CellGroup) .use(CellGroup)
.use(Dialog) .use(Dialog)
......
// H5 去调用App的方法 // H5 去调用App的方法
import jsBridge from "./bridge"; import jsBridge from "./bridge";
import { getUserInfo } from "@/api/user";
// 获取Token
export function getAuthToken() {
return new Promise((resolve, reject) => {
console.log("调用1");
jsBridge.callhandler("getAuthToken", null, data => {
console.log("调用2");
localStorage.setItem("token", data);
console.log("--------------"); class bridgeToAppFun {
if (data) { constructor() {
getUserInfo().then(res=>{ this.userAgent = null;
console.log(navigator.userAgent);
}) if (
alert("获取到的token" + data); navigator.userAgent.indexOf("Android") > -1 ||
resolve(data); navigator.userAgent.indexOf("Adr") > -1
} else { ) {
reject("调用失败,未返回data"); this.userAgent = "android";
} else if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
this.userAgent = "ios";
} else {
this.userAgent = "web";
}
}
// 获取Token
getAuthToken() {
if (this.userAgent === "android") {
// android
let token = null;
try {
token = window.android.getAuthToken();
localStorage.setItem("token", token);
} catch {
console.log("token获取失败");
} }
}); return new Promise((resolve, reject) => {
}); if (token) {
resolve(token);
} else {
reject("失败");
}
});
} else if (this.userAgent === "ios") {
// ios
return new Promise((resolve, reject) => {
jsBridge.callhandler("getAuthToken", null, data => {
localStorage.setItem("token", data);
if (data) {
resolve(data);
} else {
console.log("调用失败");
reject("getAuthToken", data);
}
});
});
}
}
// 退出
logoutToApp() {
console.log("退出登录");
if (this.userAgent === "android") {
console.log("an");
window.android.logout();
} else {
jsBridge.callhandler("logout");
}
}
navigateBack() {
console.log("返回");
if (this.userAgent === "android") {
console.log("an");
window.android.navigateBack();
} else {
jsBridge.callhandler("navigateBack");
}
}
showBottomBar(params) {
console.log("隐藏底部");
if (this.userAgent === "android") {
console.log("an");
window.android.showBottomBar(params);
} else {
jsBridge.callhandler("showBottomBar", params);
}
}
} }
// 退出 export default bridgeToAppFun;
export function logoutToApp() {
jsBridge.callhandler("logout");
}
export function getUserId() {
let userInfo = localStorage.getItem("user");
if (userInfo) {
return JSON.parse(userInfo).userId;
} else {
return "";
}
}
export function getUserAvatar() {
let userInfo = localStorage.getItem("user");
if (userInfo) {
return JSON.parse(userInfo).headImage;
} else {
return "";
}
}
...@@ -5,14 +5,13 @@ let loading = null; ...@@ -5,14 +5,13 @@ let loading = null;
const service = axios.create({ const service = axios.create({
baseURL: "/shop-mall", baseURL: "/shop-mall",
// baseURL: "http://192.168.204.152:8997/shop-mall",
timeout: 5000 timeout: 5000
}); });
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; config.headers["token"] = token;
if (!config.loading) { if (!config.loading) {
loading = Toast.loading({ loading = Toast.loading({
forbidClick: true, forbidClick: true,
...@@ -23,8 +22,6 @@ service.interceptors.request.use( ...@@ -23,8 +22,6 @@ service.interceptors.request.use(
}, },
error => { error => {
if (loading) Toast.clear(); if (loading) Toast.clear();
console.log("rqquest====错误", error);
console.log(error);
this.$toast.fail(error.response.data.error); this.$toast.fail(error.response.data.error);
} }
); );
......
...@@ -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
}; };
}, },
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
queryData() { queryData() {
const _this = this; const _this = this;
queryAerialDelivery().then(res => { queryAerialDelivery().then(res => {
console.log(res); console.log('空投池', res);
if (res.code === 0) { if (res.code === 0) {
_this.total = res.data.total; _this.total = res.data.total;
_this.userPoolVos = res.data.userPoolVos; _this.userPoolVos = res.data.userPoolVos;
......
<template> <template>
<div class="bank"> <div class="bank">
<van-cell-group> <van-cell-group>
<van-field <van-cell
v-model="form.bankName" is-link
label="所属银行" :value="form.bankName"
right-icon="arrow" title="所属银行"
placeholder="请选择" placeholder="请选择"
size="large" size="large"
readonly @click="sheetShow = true"
/> />
<van-field <van-field
v-model="form.cardNumber" v-model="form.cardNumber"
...@@ -31,15 +31,33 @@ ...@@ -31,15 +31,33 @@
@click="addAndEditBankInfo" @click="addAndEditBankInfo"
>编辑</van-button >编辑</van-button
> >
<van-popup v-model="sheetShow" round position="bottom">
<van-picker
show-toolbar
title="请选择银行"
:columns="actions"
:default-index="2"
@cancel="sheetShow = false"
@confirm="onSelect"
/>
</van-popup>
<!-- <van-action-sheet v-model="sheetShow" :actions="actions" @select="onSelect" /> -->
</div> </div>
</template> </template>
<script> <script>
import { getUserBankInfo, addUserBankInfo, editUserBankInfo } from "@/api/bank"; import {
getUserBankInfo,
addUserBankInfo,
editUserBankInfo,
getBankList
} from "@/api/bank";
export default { export default {
name: "Bank", name: "Bank",
data() { data() {
return { return {
sheetShow: false,
actions: [],
form: { form: {
bankName: "", bankName: "",
cardNumber: "", cardNumber: "",
...@@ -49,9 +67,21 @@ export default { ...@@ -49,9 +67,21 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getBank();
this.getBankInfo(); this.getBankInfo();
}, },
methods: { methods: {
onSelect(item) {
this.form.bankName = item;
this.sheetShow = false;
},
getBank() {
getBankList().then(res => {
if (res.code === 0) {
this.actions = res.data;
}
});
},
addAndEditBankInfo() { addAndEditBankInfo() {
const params = this.form; const params = this.form;
if (this.form.id) { if (this.form.id) {
...@@ -86,10 +116,10 @@ export default { ...@@ -86,10 +116,10 @@ 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 && res.data) {
this.form = res.data; this.form = res.data;
} }
}); });
......
...@@ -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 => {
......
...@@ -5,12 +5,18 @@ ...@@ -5,12 +5,18 @@
</van-cell-group> </van-cell-group>
<div class="detail"> <div class="detail">
<p style="font-size: 24px">提现金额</p> <p style="font-size: 24px">提现金额</p>
<van-field v-model="money" type="number" label="¥" class="money" /> <van-field
v-model="money"
type="number"
label="¥"
class="money"
@blur="onFillMoneyBlur"
/>
<div class="remain"> <div class="remain">
<span style="color: #666666" <span style="color: #666666"
>可提现金额{{ remainMoney.toFixed(2) }}</span >可提现金额{{ remainMoney.toFixed(2) }}</span
> >
<span class="all" @click="allIn">全部提现</span> <span v-if="remainMoney > 0" class="all" @click="allIn">全部提现</span>
</div> </div>
<div class="real"> <div class="real">
<p class="real-item"> <p class="real-item">
...@@ -76,6 +82,7 @@ ...@@ -76,6 +82,7 @@
</template> </template>
<script> <script>
import { getWithdrawalAmount } from "@/api/wallet";
import { getUserBankInfo, sendSms, cashOut } from "@/api/bank"; import { getUserBankInfo, sendSms, cashOut } from "@/api/bank";
import BaseDialog from "@/components/BaseDialog.vue"; import BaseDialog from "@/components/BaseDialog.vue";
export default { export default {
...@@ -83,7 +90,7 @@ export default { ...@@ -83,7 +90,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,
...@@ -97,8 +104,28 @@ export default { ...@@ -97,8 +104,28 @@ export default {
}, },
created() { created() {
this.getUserInfo(); this.getUserInfo();
this.canCashOut();
}, },
methods: { methods: {
onFillMoneyBlur(e) {
if (e.target.value > this.remainMoney) {
this.$toast.fail("输入超过可提现金额,请重新输入");
return false;
}
},
canCashOut() {
const params = {
userId: this.$userId
};
getWithdrawalAmount(params).then(res => {
if (res.code === 0) {
this.remainMoney = res.data.currentMoneyCan;
} else {
this.remainMoney = 100;
}
});
getWithdrawalAmount;
},
jumpToBank() { jumpToBank() {
console.log("1"); console.log("1");
this.$router.push("/bank"); this.$router.push("/bank");
...@@ -113,9 +140,12 @@ export default { ...@@ -113,9 +140,12 @@ export default {
this.$toast.fail("未输入提现金额"); this.$toast.fail("未输入提现金额");
return; return;
} }
if (this.money > this.remainMoney) {
this.$toast.fail("输入超过可提现金额,请重新输入");
return;
}
const params = { const params = {
userId: this.userPhone userId: this.$userId
}; };
sendSms(params).then(); sendSms(params).then();
this.validCode = null; this.validCode = null;
...@@ -123,11 +153,15 @@ export default { ...@@ -123,11 +153,15 @@ 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) {
this.bank = res.data.bankName; if (res.data.bankName) {
this.bank = res.data.bankName;
} else {
this.bank = "";
}
} }
}); });
}, },
......
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
<div class="save-code"> <div class="save-code">
<p>保存二维码</p> <p>保存二维码</p>
<p>打开微信扫一扫添加客服</p> <p>打开微信扫一扫添加客服</p>
<p>请截图保存!</p>
</div> </div>
<van-button>保存</van-button> <!-- <van-button>保存</van-button> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -42,7 +43,10 @@ export default { ...@@ -42,7 +43,10 @@ export default {
this.$router.push({ name: urlName }); this.$router.push({ name: urlName });
}, },
getCustomerData() { getCustomerData() {
getCustomer().then(res => { let params = {
userId: this.$userId
};
getCustomer(params).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.imageUrl = process.env.VUE_APP_BASE_URL + res.data; this.imageUrl = process.env.VUE_APP_BASE_URL + res.data;
} }
......
...@@ -107,7 +107,8 @@ export default { ...@@ -107,7 +107,8 @@ export default {
this.$router.push({ name: urlName }); this.$router.push({ name: urlName });
}, },
getstatus() { getstatus() {
const userId = 13933770749; const userId = this.$userId;
console.log(userId);
const _this = this; const _this = this;
getForestStatus(userId).then(res => { getForestStatus(userId).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) {
......
...@@ -2,21 +2,12 @@ ...@@ -2,21 +2,12 @@
<div class="wallet"> <div class="wallet">
<div class="content"> <div class="content">
<img class="balance-img" src="@/assets/images/余额.png" alt /> <img class="balance-img" src="@/assets/images/余额.png" alt />
<p <p class="currentprofitlabel">
style="position:absolute;top:136px;width:100%;font-size:18px;color:#333333"
>
当月收益 当月收益
</p> </p>
<div <div class="currentprofit" @click="jumpToIncomeDetail">
style="position:absolute;top:178px;width:100%"
@click="jumpToIncomeDetail"
>
<span class="month-income">{{ walletInfo.moneyIncome }}</span> <span class="month-income">{{ walletInfo.moneyIncome }}</span>
<img <img src="@/assets/images/右箭头.png" alt class="month-income-arrow" />
src="@/assets/images/右箭头.png"
alt
style="width:11px;height:18px"
/>
</div> </div>
<div class="bottom-box"> <div class="bottom-box">
<div class="income-item"> <div class="income-item">
...@@ -24,11 +15,7 @@ ...@@ -24,11 +15,7 @@
<p>累计收益</p> <p>累计收益</p>
<div @click="jumpToAll"> <div @click="jumpToAll">
<span class="money">{{ walletInfo.totalIncome }}</span> <span class="money">{{ walletInfo.totalIncome }}</span>
<img <img src="@/assets/images/右箭头.png" alt class="arrow" />
src="@/assets/images/右箭头.png"
alt
style="width:8px;height:15px"
/>
</div> </div>
</div> </div>
<div class="income-item"> <div class="income-item">
...@@ -36,11 +23,7 @@ ...@@ -36,11 +23,7 @@
<p>未提余额</p> <p>未提余额</p>
<div @click="jumpToCanCashOut"> <div @click="jumpToCanCashOut">
<span class="money">{{ walletInfo.currentMoneyCan }}</span> <span class="money">{{ walletInfo.currentMoneyCan }}</span>
<img <img src="@/assets/images/右箭头.png" alt class="arrow" />
src="@/assets/images/右箭头.png"
alt
style="width:8px;height:15px"
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -55,9 +38,7 @@ ...@@ -55,9 +38,7 @@
</template> </template>
<script> <script>
import { getAuthToken } from "@/utils/bridgeToAppFun";
import { getMoneyPackage } from "@/api/wallet"; import { getMoneyPackage } from "@/api/wallet";
export default { export default {
name: "Wallet", name: "Wallet",
data() { data() {
...@@ -71,13 +52,6 @@ export default { ...@@ -71,13 +52,6 @@ export default {
}, },
mounted() { mounted() {
this.getWalletInfo(); this.getWalletInfo();
getAuthToken()
.then(res => {
console.log("success", res);
})
.catch(err => {
console.log("error", err);
});
}, },
methods: { methods: {
// 跳转到可提现界面 // 跳转到可提现界面
...@@ -101,7 +75,7 @@ export default { ...@@ -101,7 +75,7 @@ export default {
// 获取用户钱包展示信息 // 获取用户钱包展示信息
getWalletInfo() { getWalletInfo() {
const params = { const params = {
userId: "13100911369" userId: this.$userId
}; };
getMoneyPackage(params) getMoneyPackage(params)
.then(res => { .then(res => {
...@@ -122,17 +96,31 @@ export default { ...@@ -122,17 +96,31 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.wallet { .wallet {
box-sizing: border-box; box-sizing: border-box;
height: 100vh; height: calc(100vh - 48px);
padding: 10px 16px; overflow: hidden;
padding: 15px;
box-sizing: border-box;
p { p {
margin: 0; margin: 0;
} }
.content { .content {
position: relative; position: relative;
width: 345px; width: 345px;
height: 90%; height: 100%;
text-align: center; text-align: center;
background-color: #ffffff; background-color: #ffffff;
.currentprofitlabel {
position: absolute;
top: 136px;
width: 100%;
font-size: 18px;
color: #333333;
}
.currentprofit {
position: absolute;
width: 100%;
top: 178px;
}
.balance-img { .balance-img {
position: absolute; position: absolute;
top: 72px; top: 72px;
...@@ -146,6 +134,10 @@ export default { ...@@ -146,6 +134,10 @@ export default {
font-size: 28px; font-size: 28px;
color: #333333; color: #333333;
} }
.month-income-arrow {
width: 11px;
height: 18px;
}
.bottom-box { .bottom-box {
position: absolute; position: absolute;
...@@ -159,6 +151,10 @@ export default { ...@@ -159,6 +151,10 @@ export default {
img { img {
width: 30px; width: 30px;
height: 29px; height: 29px;
&.arrow {
width: 12px;
height: 18px;
}
} }
.income-item { .income-item {
display: flex; display: flex;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
</template> </template>
<script> <script>
import { inviteCode } from "@/api/invite"; import { inviteCode } from "@/api/invite";
var userId = "13933770749";
export default { export default {
data() { data() {
return { return {
...@@ -22,7 +21,7 @@ export default { ...@@ -22,7 +21,7 @@ export default {
forbidClick: true, forbidClick: true,
message: "加载中..." message: "加载中..."
}); });
inviteCode(userId).then(res => { inviteCode(this.$userId).then(res => {
if (loading) _this.$toast.clear(); if (loading) _this.$toast.clear();
_this.imgSrc = _this.getUserPhoto(res); _this.imgSrc = _this.getUserPhoto(res);
}); });
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
</template> </template>
<script> <script>
var userId = 13100911369;
import { getMyTeam } from "@/api/grade"; import { getMyTeam } from "@/api/grade";
export default { export default {
name: "leagueNums", name: "leagueNums",
...@@ -76,7 +75,7 @@ export default { ...@@ -76,7 +75,7 @@ export default {
}, },
methods: { methods: {
getMyTeam() { getMyTeam() {
getMyTeam(userId).then(res => { getMyTeam(this.$userId).then(res => {
if (res.data) { if (res.data) {
this.list.forEach(v => { this.list.forEach(v => {
v.num = res.data[v["field"]]; v.num = res.data[v["field"]];
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
<div class="modefy-avatar"> <div class="modefy-avatar">
<img class="avatar" :src="avatar" alt /> <img class="avatar" :src="avatar" alt />
<div class="btn"> <div class="btn">
<van-button type="primary" plain style="height:44px;top:11px" @click="checkBtn"
>确定</van-button
>
<van-uploader <van-uploader
:max-count="1" :max-count="1"
:before-delete="onDeleteAvatar" :before-delete="onDeleteAvatar"
...@@ -12,6 +9,13 @@ ...@@ -12,6 +9,13 @@
> >
<van-button type="primary">上传新头像</van-button> <van-button type="primary">上传新头像</van-button>
</van-uploader> </van-uploader>
<van-button
type="primary"
:class="!canSubmit && 'deactive-btn'"
plain
@click="checkBtn"
>确定</van-button
>
</div> </div>
</div> </div>
</template> </template>
...@@ -23,21 +27,29 @@ export default { ...@@ -23,21 +27,29 @@ export default {
name: "ModefyAvatar", name: "ModefyAvatar",
data() { data() {
return { return {
canSubmit: false,
avatar: "", avatar: "",
imageUrl: "" imageUrl: ""
}; };
}, },
mounted() { mounted() {
console.log("123"); console.log(this.$route.query);
if (!this.avatar) { const headImage = this.$route.query.headImage;
if (headImage) {
this.avatar = process.env.VUE_APP_BASE_URL + headImage;
} else {
this.avatar = require("@/assets/images/no_avatar.png"); this.avatar = require("@/assets/images/no_avatar.png");
} }
}, },
methods: { methods: {
checkBtn() { checkBtn() {
if (!this.canSubmit) {
return;
}
this.canSubmit = false;
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) {
...@@ -57,6 +69,7 @@ export default { ...@@ -57,6 +69,7 @@ export default {
uploadImage(params, fd).then(res => { uploadImage(params, fd).then(res => {
console.log(res); console.log(res);
this.imageUrl = res.zxUrl; this.imageUrl = res.zxUrl;
this.canSubmit = true;
}); });
}, },
onDeleteAvatar(file, detail) { onDeleteAvatar(file, detail) {
...@@ -84,7 +97,7 @@ export default { ...@@ -84,7 +97,7 @@ export default {
.modefy-avatar { .modefy-avatar {
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
padding-top: 115px; padding-top: 25px;
} }
.avatar { .avatar {
width: 345px; width: 345px;
...@@ -92,11 +105,33 @@ export default { ...@@ -92,11 +105,33 @@ export default {
margin-bottom: 52px; margin-bottom: 52px;
border-radius: 4px; border-radius: 4px;
} }
.btn { .btn {
box-sizing: border-box;
display: flex; display: flex;
justify-content: space-around; justify-content: space-between;
align-content: center;
width: 345px;
height: 44px;
margin: 0 auto;
.van-uploader {
.van-button {
position: absolute;
top: 0;
left: 0;
}
::v-deep input {
width: 165px;
height: 44px;
}
}
.van-button { .van-button {
width: 165px; width: 165px;
} }
.deactive-btn {
color: #969595e9;
background-color: #dcd6d6;
border-color: #dcd6d6;
}
} }
</style> </style>
...@@ -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);
......
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
fd.append("files", file.file); fd.append("files", file.file);
}); });
fd.append("zxField", this.message); fd.append("zxField", this.message);
fd.append("userId", "13100911369"); fd.append("userId", this.$userId);
uploadImage(fd).then(); uploadImage(fd).then();
}, },
openPopup() { openPopup() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
> >
<div class="userAvatar"> <div class="userAvatar">
<div class="avatar-box"> <div class="avatar-box">
<img class="avatar" src="@/assets/images/avatar.png" alt="头像" /> <img class="avatar" :src="avatar" alt="头像" />
<img class="level-img" src="@/assets/images/等级展示框.png" alt /> <img class="level-img" src="@/assets/images/等级展示框.png" alt />
<span class="avatar-level">Lv.{{ userRecommendInfo.userlevel }}</span> <span class="avatar-level">Lv.{{ userRecommendInfo.userlevel }}</span>
</div> </div>
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
}, },
data() { data() {
return { return {
avatar: process.env.VUE_APP_BASE_URL + this.$userAvatar,
inviteeArr: [], inviteeArr: [],
userRecommendInfo: {}, userRecommendInfo: {},
activeTab: "", activeTab: "",
...@@ -159,7 +160,7 @@ export default { ...@@ -159,7 +160,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 +178,7 @@ export default { ...@@ -177,7 +178,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: ""
}, },
......
<template> <template>
<div class="fastest-progress"> <div class="fastest-progress">
<div class="bg"> <div class="bg">
<van-icon name="arrow-left" @click="$router.go(-1)" /> <van-icon name="arrow-left" @click="handlerBack" />
<span class="title">本月进步最大奖励池</span> <span class="title">本月进步最大奖励池</span>
<span class="award">{{ growthTotal }}</span> <span class="award">{{ growthTotal }}</span>
</div> </div>
...@@ -45,10 +45,36 @@ export default { ...@@ -45,10 +45,36 @@ export default {
prizeVos: [] prizeVos: []
}; };
}, },
beforeRouteEnter(to, from, next) {
console.log("路由前");
try {
this.$bridgeToAppFun.showBottomBar(false);
} catch {
console.log("无法请求App");
next();
}
},
beforeRouteLeave(to, form, next) {
console.log("离开");
try {
this.$bridgeToAppFun.showBottomBar(true);
} catch {
console.log("未能和App交互");
next();
}
},
mounted() { mounted() {
this.getProgressPrizes(); this.getProgressPrizes();
}, },
methods: { methods: {
handlerBack() {
try {
this.$bridgeToAppFun.navigateBack();
} catch {
console.log("不能和App交互");
this.$router.go(-1);
}
},
getProgressPrizes() { getProgressPrizes() {
const _this = this; const _this = this;
getProgressPrizes().then(res => { getProgressPrizes().then(res => {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
:duration="3000" :duration="3000"
style="font-weight: bold" style="font-weight: bold"
></countTo> ></countTo>
<p style="font-size: 14px;color:#333333"> <p v-if="awardInfo" style="font-size: 14px;color:#333333">
历史累计奖金:¥{{ awardInfo.awardTotal.toFixed(2) || 0 }} 历史累计奖金:¥{{ awardInfo.awardTotal.toFixed(2) || 0 }}
</p> </p>
</div> </div>
...@@ -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) {
......
<template> <template>
<div class="settings"> <div class="settings">
<van-cell-group class="group-1"> <van-cell-group class="group-1">
<van-cell title="用户名" value="135****1234" /> <van-cell title="用户名" :value="$userId" />
<van-cell is-link center title="头像" @click="onModefy"> <van-cell is-link center title="头像" @click="onModefy">
<img <img class="avatar-img" :src="imgBaseUrl + avatar" alt="头像" />
class="avatar-img"
src="@/assets/images/no_avatar.png"
alt="头像"
/>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
<van-cell-group> <van-cell-group>
<van-cell <van-cell
is-link is-link
title="邀请人邀请码" title="推荐人邀请码"
:value="inviteeCode" :value="inviteeCode"
@click="fillInviterCode" @click="fillInviterCode"
/> />
<van-cell is-link title="软件更新" value="版本v1.2" /> <van-cell is-link title="软件更新" value="版本v1.2" />
<van-cell is-link title="用户协议" @click="jumpToInstructions" /> <van-cell is-link title="用户协议" @click="jumpToInstructions" />
</van-cell-group> </van-cell-group>
<van-button size="large" class="logout-btn" @click="logout"
>退出登录</van-button <a href="redirect://xts.com/login_activity?hideBack=true">
> <van-button size="large" class="logout-btn" @click="logout"
>退出登录</van-button
>
</a>
<base-dialog <base-dialog
base-dialog-title="推荐人邀请码" base-dialog-title="推荐人邀请码"
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
</template> </template>
<script> <script>
import { getUserInfo2 } from "@/api/user";
import { logoutToApp } from "@/utils/bridgeToAppFun"; import { logoutToApp } from "@/utils/bridgeToAppFun";
import { logout } from "@/api/user"; import { logout } from "@/api/user";
import { fillInviteCode } from "@/api/user"; import { fillInviteCode } from "@/api/user";
...@@ -55,25 +55,49 @@ export default { ...@@ -55,25 +55,49 @@ export default {
name: "Settings", name: "Settings",
data() { data() {
return { return {
imgBaseUrl: "",
avatar: "",
fileList: [], fileList: [],
fillCode: "", fillCode: "",
inviteeCode: "未填写", inviteeCode: "未填写",
inviteeCodeDialog: false inviteeCodeDialog: false
}; };
}, },
mounted() {
this.imgBaseUrl = process.env.VUE_APP_BASE_URL;
this.getUser();
},
methods: { methods: {
logout() { getUser() {
const params = { const params = {
token: "qwedskdljlkjlklkjlkjlkjl" userId: this.$userId
}; };
logout(params).then(); console.log("setting-userId", params);
getUserInfo2(params).then(res => {
if (res.userId) {
localStorage.setItem("user", JSON.stringify(res));
this.$nextTick(() => {
this.inviteeCode = res.inviteCode;
this.avatar = res.headImage;
});
}
});
},
logout() {
localStorage.removeItem("token");
logout().then();
logoutToApp(); logoutToApp();
}, },
jumpToInstructions() { jumpToInstructions() {
this.$router.push("/instructions"); this.$router.push("/instructions");
}, },
onModefy() { onModefy() {
this.$router.push("/modefy-avatar"); this.$router.push({
path: "/modefy-avatar",
query: {
headImage: this.avatar
}
});
}, },
onCloseDialog() { onCloseDialog() {
this.inviteeCodeDialog = false; this.inviteeCodeDialog = false;
...@@ -83,7 +107,7 @@ export default { ...@@ -83,7 +107,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