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"
\ No newline at end of file
VUE_APP_BASE_URL = "http://8.131.244.76:81"
\ No newline at end of file
......@@ -28,7 +28,7 @@ export default {
.getAuthToken()
.then(res => {
console.log("获取到token成功", res);
localStorage.setItem('token', res);
localStorage.setItem("token", res);
this.saveUser(res);
})
.catch(err => {
......
......@@ -30,3 +30,15 @@ export function uploadImage(params, 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({
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;
......@@ -23,14 +23,14 @@ class bridgeToAppFun {
// android
let token = null;
return new Promise((resolve, reject) => {
console.log('版本', window.android.getAppVersion());
console.log('接收', window.android.getToken());
console.log("版本", window.android.getAppVersion());
console.log("接收", window.android.getToken());
token = window.android.getToken();
console.log('token', token);
if(token) {
console.log("token", token);
if (token) {
resolve(token);
} else {
reject('没有token');
reject("没有token");
}
});
} else if (this.userAgent === "ios") {
......@@ -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;
......@@ -32,7 +32,7 @@
>
<p
v-for="(item, index) in userPoolVos"
:key="index"
:key="index + 'down'"
@click="openUserInfo(item)"
>
用户{{ item.userId }}进入空投池
......@@ -89,9 +89,11 @@ export default {
methods: {
onCloseUser() {
this.userInfoDialog = false;
this.canScroll = true;
},
openUserInfo(item) {
console.log(123);
this.canScroll = false;
this.userInfoDialog = true;
this.currentUser = item;
this.currentUser.avatar = process.env.VUE_APP_BASE_URL + item.headImage;
......
......@@ -41,8 +41,8 @@ export default {
name: "CanCashOut",
data() {
return {
preNum: "125",
currentNum: "325",
preNum: "0",
currentNum: "0",
rules: "提现规则:",
rulesMent:
"1、结算:所有购买及推广产生的佣金实时结算,月度肥料及进步奖每月1号结算上个月收益,在APP我的收益页面可随时查询收益情况。",
......
<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">
<van-icon
name="arrow-left"
......@@ -8,12 +13,13 @@
color="#ffffff"
@click="handlerBack"
/>
<img :src="imgSrc" alt="" class="imgCode" />
<!-- <img :src="imgSrc" alt="" class="imgCode" /> -->
</div>
<van-button type @click="onSave">保存</van-button>
</div>
</template>
<script>
import { inviteCode } from "@/api/invite";
// import { inviteCode } from "@/api/invite";
export default {
name: "Invite",
data() {
......@@ -25,6 +31,10 @@ export default {
this.inviteCode();
},
methods: {
onSave() {
const url = this.imgSrc;
this.$bridgeToAppFun.saveImage(url);
},
handlerBack() {
try {
this.$bridgeToAppFun.navigateBack();
......@@ -34,16 +44,17 @@ export default {
}
},
inviteCode() {
const _this = this;
let loading = _this.$toast.loading({
forbidClick: true,
message: "加载中..."
});
// const _this = this;
// let loading = _this.$toast.loading({
// forbidClick: true,
// message: "加载中..."
// });
const userId = JSON.parse(localStorage.getItem("user")).userId;
inviteCode(userId).then(res => {
if (loading) _this.$toast.clear();
_this.imgSrc = _this.getUserPhoto(res);
});
// inviteCode(userId).then(res => {
// if (loading) _this.$toast.clear();
// _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) {
let uInt8Array = new Uint8Array(res);
......@@ -64,9 +75,21 @@ export default {
.invite-code {
width: 100%;
height: 100vh;
background: url("../assets/images/invite_1.png");
background-repeat: no-repeat;
background-size: 100% 100%;
.van-button {
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 {
position: absolute;
width: 60px;
......
......@@ -14,7 +14,12 @@
:value="inviteeCode"
@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-group>
......@@ -42,10 +47,22 @@
/>
</div>
</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>
</template>
<script>
import { versionUpdate } from "@/api/base";
import { getUserInfo2 } from "@/api/user";
import { logout } from "@/api/user";
import { fillInviteCode } from "@/api/user";
......@@ -55,6 +72,12 @@ export default {
name: "Settings",
data() {
return {
downAppUrl: "",
needUpdate: false,
updateBtn: "关闭",
updateResult: "",
versionShow: false,
version: "",
userName: "",
imageBaseUrl: "",
headImage: "",
......@@ -68,8 +91,33 @@ export default {
mounted() {
this.imageBaseUrl = process.env.VUE_APP_BASE_URL;
this.getUser();
this.getAppVersion();
},
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() {
const params = {
userId: JSON.parse(localStorage.getItem("user")).userId
......@@ -188,4 +236,15 @@ export default {
background-color: #f9f9f9;
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>
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