Commit f3f3b9f9 authored by leiqingsong's avatar leiqingsong

版本更新 + 邀请好友页面保存

parent dea7a795
# 生产环境 部署生产环境放开这个 # 生产环境 部署生产环境放开这个
VUE_APP_BASE_URL = "http://app.xitiansen.com" # VUE_APP_BASE_URL = "http://app.xitiansen.com"
# 测试环境 部署测试环境放开这个 # 测试环境 部署测试环境放开这个
# 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
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
.getAuthToken() .getAuthToken()
.then(res => { .then(res => {
console.log("获取到token成功", res); console.log("获取到token成功", res);
localStorage.setItem('token', res); localStorage.setItem("token", res);
this.saveUser(res); this.saveUser(res);
}) })
.catch(err => { .catch(err => {
......
...@@ -30,3 +30,15 @@ export function uploadImage(params, file) { ...@@ -30,3 +30,15 @@ export function uploadImage(params, file) {
data: file data: file
}); });
} }
/**
* 版本检查
* @param {*} version
* @returns
*/
export function versionUpdate(version) {
return request({
url: `/account/version?version=${version}`,
method: "get"
});
}
...@@ -162,31 +162,4 @@ const router = new VueRouter({ ...@@ -162,31 +162,4 @@ const router = new VueRouter({
routes routes
}); });
// router.beforeEach((to, from, next) => {
// console.log('to', to);
// const whiteList = [
// "MyStatus",
// "Publish",
// "FastestProgress",
// "MonthAward",
// "Settings",
// "Grade",
// "AirDrop",
// "Invite",
// "AboutUs",
// "customerService",
// "Wallet"
// ];
// const token = localStorage.getItem("token");
// if (whiteList.indexOf(to.name) > -1) {
// if (token) {
// next()
// } else {
// console.log('未登录');
// }
// } else {
// next()
// }
// })
export default router; export default router;
...@@ -23,14 +23,14 @@ class bridgeToAppFun { ...@@ -23,14 +23,14 @@ class bridgeToAppFun {
// android // android
let token = null; let token = null;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log('版本', window.android.getAppVersion()); console.log("版本", window.android.getAppVersion());
console.log('接收', window.android.getToken()); console.log("接收", window.android.getToken());
token = window.android.getToken(); token = window.android.getToken();
console.log('token', token); console.log("token", token);
if(token) { if (token) {
resolve(token); resolve(token);
} else { } else {
reject('没有token'); reject("没有token");
} }
}); });
} else if (this.userAgent === "ios") { } else if (this.userAgent === "ios") {
...@@ -108,6 +108,20 @@ class bridgeToAppFun { ...@@ -108,6 +108,20 @@ class bridgeToAppFun {
}); });
} }
} }
getAppVersion() {
let version = "";
if (this.userAgent === "android") {
console.log("an");
version = window.android.getAppVersion();
} else {
jsBridge.callhandler("getAppVersion", null, response => {
if (response) {
version = response;
}
});
}
return version;
}
} }
export default bridgeToAppFun; export default bridgeToAppFun;
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
> >
<p <p
v-for="(item, index) in userPoolVos" v-for="(item, index) in userPoolVos"
:key="index" :key="index + 'down'"
@click="openUserInfo(item)" @click="openUserInfo(item)"
> >
用户{{ item.userId }}进入空投池 用户{{ item.userId }}进入空投池
...@@ -89,9 +89,11 @@ export default { ...@@ -89,9 +89,11 @@ export default {
methods: { methods: {
onCloseUser() { onCloseUser() {
this.userInfoDialog = false; this.userInfoDialog = false;
this.canScroll = true;
}, },
openUserInfo(item) { openUserInfo(item) {
console.log(123); console.log(123);
this.canScroll = false;
this.userInfoDialog = true; this.userInfoDialog = true;
this.currentUser = item; this.currentUser = item;
this.currentUser.avatar = process.env.VUE_APP_BASE_URL + item.headImage; this.currentUser.avatar = process.env.VUE_APP_BASE_URL + item.headImage;
......
...@@ -41,8 +41,8 @@ export default { ...@@ -41,8 +41,8 @@ export default {
name: "CanCashOut", name: "CanCashOut",
data() { data() {
return { return {
preNum: "125", preNum: "0",
currentNum: "325", currentNum: "0",
rules: "提现规则:", rules: "提现规则:",
rulesMent: rulesMent:
"1、结算:所有购买及推广产生的佣金实时结算,月度肥料及进步奖每月1号结算上个月收益,在APP我的收益页面可随时查询收益情况。", "1、结算:所有购买及推广产生的佣金实时结算,月度肥料及进步奖每月1号结算上个月收益,在APP我的收益页面可随时查询收益情况。",
......
<template> <template>
<div class="invite-code"> <div
class="invite-code"
:style="
`background-image: url(${imgSrc});background-size: 100% 100%;background-repeat: no-repeat;`
"
>
<div class="nav"> <div class="nav">
<van-icon <van-icon
name="arrow-left" name="arrow-left"
...@@ -8,12 +13,13 @@ ...@@ -8,12 +13,13 @@
color="#ffffff" color="#ffffff"
@click="handlerBack" @click="handlerBack"
/> />
<img :src="imgSrc" alt="" class="imgCode" /> <!-- <img :src="imgSrc" alt="" class="imgCode" /> -->
</div> </div>
<van-button type @click="onSave">保存</van-button>
</div> </div>
</template> </template>
<script> <script>
import { inviteCode } from "@/api/invite"; // import { inviteCode } from "@/api/invite";
export default { export default {
name: "Invite", name: "Invite",
data() { data() {
...@@ -25,6 +31,10 @@ export default { ...@@ -25,6 +31,10 @@ export default {
this.inviteCode(); this.inviteCode();
}, },
methods: { methods: {
onSave() {
const url = this.imgSrc;
this.$bridgeToAppFun.saveImage(url);
},
handlerBack() { handlerBack() {
try { try {
this.$bridgeToAppFun.navigateBack(); this.$bridgeToAppFun.navigateBack();
...@@ -34,16 +44,17 @@ export default { ...@@ -34,16 +44,17 @@ export default {
} }
}, },
inviteCode() { inviteCode() {
const _this = this; // const _this = this;
let loading = _this.$toast.loading({ // let loading = _this.$toast.loading({
forbidClick: true, // forbidClick: true,
message: "加载中..." // message: "加载中..."
}); // });
const userId = JSON.parse(localStorage.getItem("user")).userId; const userId = JSON.parse(localStorage.getItem("user")).userId;
inviteCode(userId).then(res => { // inviteCode(userId).then(res => {
if (loading) _this.$toast.clear(); // if (loading) _this.$toast.clear();
_this.imgSrc = _this.getUserPhoto(res); // _this.imgSrc = _this.getUserPhoto(res);
}); // });
this.imgSrc = `${process.env.VUE_APP_BASE_URL}/shop-mall/api/user/registerByQrCode?height=150&userId=${userId}&width=150`;
}, },
getUserPhoto(res) { getUserPhoto(res) {
let uInt8Array = new Uint8Array(res); let uInt8Array = new Uint8Array(res);
...@@ -64,9 +75,21 @@ export default { ...@@ -64,9 +75,21 @@ export default {
.invite-code { .invite-code {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
background: url("../assets/images/invite_1.png");
background-repeat: no-repeat; .van-button {
background-size: 100% 100%; position: absolute;
left: 50%;
bottom: 100px;
transform: translateX(-50%);
width: 160px;
height: 36px;
font-size: 18px;
color: #ffffff;
background-color: #88c678;
border: none;
border-radius: 4px;
}
.imgCode { .imgCode {
position: absolute; position: absolute;
width: 60px; width: 60px;
......
...@@ -14,7 +14,12 @@ ...@@ -14,7 +14,12 @@
:value="inviteeCode" :value="inviteeCode"
@click="fillInviterCode" @click="fillInviterCode"
/> />
<van-cell is-link title="软件更新" value="版本v1.2" /> <van-cell
is-link
title="软件更新"
:value="version"
@click="updateVersion"
/>
<van-cell is-link title="用户协议" @click="jumpToInstructions" /> <van-cell is-link title="用户协议" @click="jumpToInstructions" />
</van-cell-group> </van-cell-group>
...@@ -42,10 +47,22 @@ ...@@ -42,10 +47,22 @@
/> />
</div> </div>
</base-dialog> </base-dialog>
<base-dialog
base-dialog-title="版本更新"
:base-dialog-show="versionShow"
:base-dialog-btn="updateBtn"
@onClick="onUpdateVersion"
>
<div slot="content" class="update-content">
<span class="update-tip">{{ updateResult }}</span>
</div>
</base-dialog>
</div> </div>
</template> </template>
<script> <script>
import { versionUpdate } from "@/api/base";
import { getUserInfo2 } from "@/api/user"; import { getUserInfo2 } from "@/api/user";
import { logout } from "@/api/user"; import { logout } from "@/api/user";
import { fillInviteCode } from "@/api/user"; import { fillInviteCode } from "@/api/user";
...@@ -55,6 +72,12 @@ export default { ...@@ -55,6 +72,12 @@ export default {
name: "Settings", name: "Settings",
data() { data() {
return { return {
downAppUrl: "",
needUpdate: false,
updateBtn: "关闭",
updateResult: "",
versionShow: false,
version: "",
userName: "", userName: "",
imageBaseUrl: "", imageBaseUrl: "",
headImage: "", headImage: "",
...@@ -68,8 +91,33 @@ export default { ...@@ -68,8 +91,33 @@ export default {
mounted() { mounted() {
this.imageBaseUrl = process.env.VUE_APP_BASE_URL; this.imageBaseUrl = process.env.VUE_APP_BASE_URL;
this.getUser(); this.getUser();
this.getAppVersion();
}, },
methods: { methods: {
onUpdateVersion() {
if (this.needUpdate) {
location.href = this.downAppUrl;
} else {
this.versionShow = false;
}
},
updateVersion() {
versionUpdate(this.version).then(res => {
this.versionShow = true;
if (res.data === "当前已是最新版本!") {
this.updateResult = res.data;
this.needUpdate = false;
} else {
this.downAppUrl = res.data;
this.updateResult = "最新版App下载地址:" + res.data;
this.updateBtn = "下载最新版App";
this.needUpdate = true;
}
});
},
getAppVersion() {
this.version = "版本" + this.$bridgeToAppFun.getAppVersion();
},
getUser() { getUser() {
const params = { const params = {
userId: JSON.parse(localStorage.getItem("user")).userId userId: JSON.parse(localStorage.getItem("user")).userId
...@@ -188,4 +236,15 @@ export default { ...@@ -188,4 +236,15 @@ export default {
background-color: #f9f9f9; background-color: #f9f9f9;
border-radius: 20px; border-radius: 20px;
} }
.update-content {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
.update-tip {
width: 90%;
font-size: 18px;
word-break: break-all;
}
</style> </style>
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