修改一些Bug,优化关于我们样式 ,合并版本说明中重复内容
parent
983dbda3e6
commit
2995383d63
|
@ -4,10 +4,10 @@
|
|||
*/
|
||||
// 开发环境
|
||||
const dev = {
|
||||
// common: 'http://192.168.0.109:8890',
|
||||
// buyer: 'http://192.168.0.109:8888',
|
||||
common: "https://common-api.pickmall.cn",
|
||||
buyer: "https://buyer-api.pickmall.cn",
|
||||
common: 'http://192.168.0.109:8890',
|
||||
buyer: 'http://192.168.0.109:8888',
|
||||
// common: "https://common-api.pickmall.cn",
|
||||
// buyer: "https://buyer-api.pickmall.cn",
|
||||
};
|
||||
// 生产环境
|
||||
const prod = {
|
||||
|
|
|
@ -7,4 +7,6 @@ export default {
|
|||
appid: "wx6f10f29075dc1b0b", //小程序唯一凭证,即 AppID,可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态)
|
||||
appSecret: "6dfbe0c72380dce5d49d65b3c91059b1", //可在 manifest.json 查看
|
||||
aMapKey: "d649892b3937a5ad20b76dacb2bcb5bd", //在高德中申请web端key
|
||||
};
|
||||
scanAuthNavigation:['https://m-b2b2c.pickmall.cn'], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转
|
||||
iosAppId:"id1564638363" //AppStore的应用地址id 具体在分享->拷贝链接中查看
|
||||
};
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name" : "lili商城",
|
||||
"appid" : "__UNI__C100675",
|
||||
"description" : "",
|
||||
"versionName" : "4.0.16",
|
||||
"versionCode" : 4000016,
|
||||
"versionName" : "4.0.18",
|
||||
"versionCode" : 4000018,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"compatible" : {
|
||||
|
@ -82,7 +82,7 @@
|
|||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wx32788b91bdb614c0",
|
||||
"UniversalLinks" : "gapp/"
|
||||
"UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
|
||||
},
|
||||
"alipay" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
|
|
|
@ -180,12 +180,7 @@
|
|||
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "aboutUs",
|
||||
"style": {
|
||||
"navigationBarTitleText": "关于我们"
|
||||
}
|
||||
}, {
|
||||
{
|
||||
"path": "address/address",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
|
@ -243,7 +238,7 @@
|
|||
{
|
||||
"path": "set/editionIntro",
|
||||
"style": {
|
||||
"navigationBarTitleText": "版本说明"
|
||||
"navigationBarTitleText": "关于我们"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
<template>
|
||||
<view class="about-us">
|
||||
<view class="box flex-center">
|
||||
<image src="/static/logo.png" mode="scaleToFill"></image>
|
||||
<view>{{config.name}}</view>
|
||||
</view>
|
||||
<u-cell-group :border="false">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<u-cell-item title="检查更新" @click="checkUpdate"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<u-cell-item title="证照信息" @click="navigateTo('/pages/mine/help/tips?type=message')"></u-cell-item>
|
||||
<u-cell-item title="服务协议" @click="navigateTo('/pages/mine/help/tips?type=user')"></u-cell-item>
|
||||
<u-cell-item title="隐私协议" @click="navigateTo('/pages/mine/help/tips?type=privacy')"></u-cell-item>
|
||||
<u-cell-item title="关于我们" :border-bottom="false" @click="navigateTo('/pages/mine/help/tips?type=about')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="intro flex-center c-content">
|
||||
<view>客服热线:13161366885</view>
|
||||
<view>客服邮箱:lili@lili.com</view>
|
||||
</view>
|
||||
<view class="bottom flex-center">
|
||||
<view @click="navigateTo('/pages/mine/help/tips?type=user')">《lili商城用户协议》</view>
|
||||
<view>CopyRight @ {{config.name}} </view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-PLUS
|
||||
import APPUpdate, { getCurrentNo, getServerNo } from "@/plugins/APPUpdate";
|
||||
import { getAppVersionList } from "@/api/message.js";
|
||||
// #endif
|
||||
import config from "@/config/config";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
showUpdate: false,
|
||||
version: "",
|
||||
currentNo: 0,
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 5,
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
/**
|
||||
* 根据当前app系统判断
|
||||
*/
|
||||
// #ifdef APP-PLUS
|
||||
let _this = this;
|
||||
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
||||
var wgtVer = inf.version;
|
||||
_this.currentVersion = wgtVer;
|
||||
});
|
||||
if (uni.getSystemInfoSync().platform === "android") {
|
||||
this.params.type = 0;
|
||||
} else {
|
||||
this.params.type = 1;
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击查看更新
|
||||
*/
|
||||
async checkUpdate() {
|
||||
// #ifdef APP-PLUS
|
||||
let needUpdate = false;
|
||||
getCurrentNo((res) => {
|
||||
this.currentNo = res.versionCode;
|
||||
});
|
||||
let res = await getAppVersionList(this.params);
|
||||
res.data.data.forEach((ele) => {
|
||||
let versionDetail = ele.version.replace(/\./g, "");
|
||||
if (versionDetail.length < this.currentNo.length) {
|
||||
versionDetail = versionDetail.padEnd(this.currentNo.length, "0");
|
||||
}
|
||||
if (versionDetail > this.currentNo) {
|
||||
needUpdate = true;
|
||||
}
|
||||
});
|
||||
if (needUpdate) {
|
||||
APPUpdate(true);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "已是最新版本!",
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
width: 100%;
|
||||
height: 242rpx;
|
||||
image {
|
||||
transform: scale(2.5);
|
||||
width: 94rpx;
|
||||
height: 94rpx;
|
||||
}
|
||||
view {
|
||||
font-size: 30rpx;
|
||||
margin-top: 25rpx;
|
||||
}
|
||||
}
|
||||
.u-cell {
|
||||
padding: 35rpx 20rpx;
|
||||
height: 110rpx;
|
||||
}
|
||||
.intro {
|
||||
color: #999999;
|
||||
font-size: $font-sm;
|
||||
margin-top: 20rpx;
|
||||
border: none;
|
||||
padding: 45rpx 0;
|
||||
line-height: 2em;
|
||||
}
|
||||
.bottom {
|
||||
:nth-child(1) {
|
||||
color: $main-color;
|
||||
font-size: 22rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
:last-child {
|
||||
font-size: 20rpx;
|
||||
color: $font-color-light;
|
||||
}
|
||||
margin-top: 110rpx;
|
||||
}
|
||||
</style>
|
|
@ -1,27 +1,47 @@
|
|||
// TODO 第一版本暂无此功能 后续优化以及更新
|
||||
<template>
|
||||
<view class="edition-intro">
|
||||
<view class="logo c-content">
|
||||
<view>
|
||||
<image src="/static/img/edition.png" mode=""></image>
|
||||
</view>
|
||||
<view>版本不息 优化不止</view>
|
||||
<h1> {{config.name}}</h1>
|
||||
|
||||
<view class='vesion'>
|
||||
Version
|
||||
</view>
|
||||
<view class="edition c-content" v-for="(item,index) in editionHistory" :key="index">
|
||||
<view class="level">
|
||||
<text style="color: #1ABC9C;">{{item.version}}</text>
|
||||
<text>{{$u.timeFormat(item.update_time, 'yyyy-mm-dd')}}</text>
|
||||
|
||||
<u-cell-group class="cell">
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<u-cell-item v-if="IosWhetherStar" @click="()=>{window.location.href = `itms-apps://itunes.apple.com/app/${config.iosAppId}?action=write-review`}" title="去评分"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<u-cell-item title="功能介绍"></u-cell-item>
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<u-cell-item title="检查更新" @click="checkUpdate"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<u-cell-item title="证照信息" @click="navigateTo('/pages/mine/help/tips?type=message')"></u-cell-item>
|
||||
<u-cell-item title="服务协议" @click="navigateTo('/pages/mine/help/tips?type=user')"></u-cell-item>
|
||||
<u-cell-item title="隐私协议" @click="navigateTo('/pages/mine/help/tips?type=privacy')"></u-cell-item>
|
||||
<u-cell-item title="关于我们" :border-bottom="false" @click="navigateTo('/pages/mine/help/tips?type=about')"></u-cell-item>
|
||||
|
||||
</u-cell-group>
|
||||
|
||||
<view class="intro">
|
||||
<view>客服热线:13161366885</view>
|
||||
<view style="margin:20rpx 0 0 0;">客服邮箱:lili@lili.com</view>
|
||||
|
||||
<view>
|
||||
<view style="margin:20rpx 0; color:#003a8c;" @click="navigateTo('/pages/mine/help/tips?type=user')">《lili商城用户协议》</view>
|
||||
<view>CopyRight @ {{config.name}} </view>
|
||||
</view>
|
||||
<view class="detail" v-html="item.content"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from "@/config/config";
|
||||
import * as API_Message from "@/api/message.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
IosWhetherStar: false,
|
||||
editionHistory: [], //版本历史
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
|
@ -34,6 +54,7 @@ export default {
|
|||
if (uni.getSystemInfoSync().platform === "android") {
|
||||
this.params.type = 0;
|
||||
} else {
|
||||
this.IosWhetherStar = true;
|
||||
this.params.type = 1;
|
||||
}
|
||||
this.GET_AppVersionList(true);
|
||||
|
@ -45,6 +66,11 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
},
|
||||
GET_AppVersionList(reset) {
|
||||
if (reset) {
|
||||
this.params.pageNumber = 1;
|
||||
|
@ -68,55 +94,31 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
.cell {
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.edition-intro {
|
||||
.logo {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-size: $font-lg;
|
||||
color: $font-color-light;
|
||||
height: 330rpx;
|
||||
margin-bottom: 20rpx;
|
||||
> view:nth-child(1) {
|
||||
width: 144rpx;
|
||||
height: 144rpx;
|
||||
border: 1px solid #ffc71c;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin-bottom: 30rpx;
|
||||
image {
|
||||
width: 80rpx;
|
||||
height: 113rpx;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
> h1 {
|
||||
margin: 150rpx 0 20rpx 0;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.edition {
|
||||
margin-bottom: 20rpx;
|
||||
color: $font-color-light;
|
||||
font-size: $font-sm;
|
||||
.level {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20rpx 30rpx;
|
||||
border-bottom: 2rpx solid $border-color-light;
|
||||
text:nth-child(1) {
|
||||
font-size: $font-base;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.detail {
|
||||
margin-left: 20rpx;
|
||||
line-height: 2em;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
> .vesion {
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 150rpx;
|
||||
}
|
||||
}
|
||||
.intro {
|
||||
margin-top: 150rpx;
|
||||
font-size: 24rpx;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<view class="person" @click="checkUserInfo()">
|
||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || '/static/missing-face.png'" mode=""></u-image>
|
||||
<view class="user-name">
|
||||
|
||||
|
||||
{{ userInfo.id ? userInfo.nickName || '' : '暂未登录' }}
|
||||
</view>
|
||||
<u-icon color="#ccc" name="arrow-right"></u-icon>
|
||||
|
@ -18,10 +18,8 @@
|
|||
<u-cell-item title="安全中心" @click="navigateTo('/pages/mine/set/securityCenter/securityCenter')"></u-cell-item>
|
||||
<u-cell-item title="意见反馈" @click="navigateTo('/pages/mine/set/feedBack')"></u-cell-item>
|
||||
<!-- #ifndef H5 -->
|
||||
<u-cell-item title="版本说明" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
|
||||
<!-- #endif -->
|
||||
<!-- <u-cell-item title="好评鼓励"></u-cell-item> -->
|
||||
<u-cell-item title="关于我们" @click="navigateTo('/pages/mine/aboutUs')"></u-cell-item>
|
||||
<u-cell-item :title="`关于${config.name}`" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="submit" @click="showModalDialog">{{userInfo.id ?'退出登录':'返回登录'}}</view>
|
||||
<u-modal show-cancel-button v-model="quitShow" @confirm="confirm" :confirm-color="lightColor" :async-close="true" :content="userInfo.id ? '确定要退出登录么?' : '确定要返回登录么?'"></u-modal>
|
||||
|
@ -30,9 +28,11 @@
|
|||
|
||||
<script>
|
||||
import storage from "@/utils/storage.js";
|
||||
import config from "@/config/config";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config,
|
||||
lightColor: this.$lightColor,
|
||||
quitShow: false,
|
||||
isCertificate: false,
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
</view>
|
||||
|
||||
<view class="logi-List" v-else>
|
||||
<view class="logi-List-title">
|
||||
暂无物流信息
|
||||
<view class="verificationCode" v-if="order.verificationCode ">
|
||||
券码: {{order.verificationCode}}
|
||||
</view>
|
||||
<view v-else class="logi-List-title">
|
||||
{{'暂无物流信息'}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -101,7 +104,8 @@
|
|||
</view>
|
||||
</view>
|
||||
<!-- 客户服务, 售后,取消订单,查看物流,投诉等 -->
|
||||
<view class="info-view" v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true || order.orderStatus == 'DELIVERED' || order.orderStatus != 'UNPAID' && order.orderType =='PINTUAN'">
|
||||
<view class="info-view"
|
||||
v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true || order.orderStatus == 'DELIVERED' || order.orderStatus != 'UNPAID' && order.orderType =='PINTUAN'">
|
||||
<view style="width: 100%">
|
||||
<view class="order-info-view">
|
||||
<view class="title">服务</view>
|
||||
|
@ -212,7 +216,7 @@
|
|||
import { getExpress } from "@/api/trade.js";
|
||||
import { cancelOrder, confirmReceipt, getOrderDetail } from "@/api/order.js";
|
||||
|
||||
import {h5Copy} from "@/js_sdk/h5-copy/h5-copy.js";
|
||||
import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js";
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
|
||||
import { getClearReason } from "@/api/after-sale.js";
|
||||
|
@ -359,7 +363,6 @@ export default {
|
|||
* 投诉
|
||||
*/
|
||||
complaint(sku) {
|
||||
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/order/complain/complain?sn=" +
|
||||
|
@ -378,7 +381,6 @@ export default {
|
|||
},
|
||||
// 去支付
|
||||
toPay(val) {
|
||||
|
||||
val.sn
|
||||
? uni.navigateTo({
|
||||
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
|
||||
|
@ -411,7 +413,7 @@ export default {
|
|||
this.cancelShow = true;
|
||||
},
|
||||
|
||||
//提交取消订单(未付款)
|
||||
//提交取消订单(未付款)
|
||||
submitCancel() {
|
||||
cancelOrder(this.orderSn, { reason: this.reason }).then((res) => {
|
||||
if (res.data.success) {
|
||||
|
@ -612,7 +614,7 @@ page,
|
|||
flex-direction: row;
|
||||
width: 100%;
|
||||
margin: 10rpx 0rpx;
|
||||
|
||||
|
||||
.title {
|
||||
color: #666;
|
||||
width: 140rpx;
|
||||
|
@ -651,7 +653,10 @@ page,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.verificationCode{
|
||||
font-weight: bold;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
.bottom_view {
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
|
|
|
@ -146,11 +146,9 @@ export default {
|
|||
/**点击规格 */
|
||||
handleClickSpec(val, index, specValue) {
|
||||
this.$set(this.currentSelceted, index, specValue.id);
|
||||
|
||||
let selectedSkuId = this.goodsSpec.find((i) => {
|
||||
let matched = true;
|
||||
let specValues = i.specValues.filter((j) => j.specName !== "images");
|
||||
|
||||
for (let n = 0; n < specValues.length; n++) {
|
||||
if (specValues[n].specValueId !== this.currentSelceted[n]) {
|
||||
matched = false;
|
||||
|
@ -206,7 +204,11 @@ export default {
|
|||
// 判断是否拼团商品
|
||||
if (this.buyType) {
|
||||
data.cartType = "PINTUAN";
|
||||
} else {
|
||||
}
|
||||
else if(this.goodsDetail.goodsType == 'VIRTUAL_GOODS'){
|
||||
data.cartType = "VIRTUAL";
|
||||
}
|
||||
else {
|
||||
data.cartType = "BUY_NOW";
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ export default {
|
|||
|
||||
mounted() {
|
||||
this.init();
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
@ -108,13 +107,17 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* 扫码
|
||||
* TODO 扫码功能后续还会后续增加
|
||||
* 应该实现的功能目前计划有:
|
||||
* 扫描商品跳转商品页面
|
||||
* 扫描活动跳转活动页面
|
||||
* 扫描二维码登录
|
||||
* 扫描其他站信息 弹出提示,返回首页。
|
||||
*/
|
||||
seacnCode() {
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
let path = encodeURIComponent(res.result);
|
||||
// TODO 扫码功能后续还会后续增加
|
||||
// 扫码成功后跳转到webview页面
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
|
@ -125,26 +128,60 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 提示获取权限
|
||||
*/
|
||||
tipsGetSettings() {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您已经关闭相机权限,去设置",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
let isIos = plus.os.name == "iOS";
|
||||
|
||||
if (isIos) {
|
||||
plus.runtime.openURL("app-settings:");
|
||||
} else {
|
||||
permision.gotoAppPermissionSetting()
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 唤醒客户端扫码
|
||||
* 没权限去申请权限,有权限获取扫码功能
|
||||
*/
|
||||
scan() {
|
||||
async scan() {
|
||||
// #ifdef APP-PLUS
|
||||
if (permision.judgeIosPermission("camera")) {
|
||||
this.seacnCode();
|
||||
let isIos = plus.os.name == "iOS";
|
||||
// 判断是否是Ios
|
||||
if (isIos) {
|
||||
if (permision.judgeIosPermission("camera")) {
|
||||
this.seacnCode();
|
||||
} else {
|
||||
// 没有权限提醒是否去申请权限
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您已经关闭相机权限,去设置",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
plus.runtime.openURL("app-settings:");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 没有权限提醒是否去申请权限
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "您已经关闭相机权限,去设置",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
plus.runtime.openURL("app-settings:");
|
||||
}
|
||||
},
|
||||
});
|
||||
// 安卓
|
||||
const result = await permision.requestAndroidPermission("CAMERA");
|
||||
if (result == 1 || result == 0) {
|
||||
this.seacnCode();
|
||||
} else {
|
||||
this.tipsGetSettings();
|
||||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -73,6 +73,7 @@ function cleanStorage() {
|
|||
storage.setHasLogin(false);
|
||||
storage.setAccessToken("");
|
||||
storage.setRefreshToken("");
|
||||
console.log("清空token")
|
||||
storage.setUuid("");
|
||||
storage.setUserInfo({});
|
||||
|
||||
|
@ -120,22 +121,26 @@ http.interceptors.request.use(
|
|||
|
||||
config.params = params;
|
||||
config.header.accessToken = accessToken;
|
||||
console.log(accessToken);
|
||||
console.warn(accessToken);
|
||||
/**
|
||||
* jwt 因为安卓以及ios没有window的属性
|
||||
* window.atob()这个函数 base64编码的使用方法就是btoa(),而用于解码的使用方法是atob(),
|
||||
* 所以使用手写 base-64 编码的字符串数据。
|
||||
*/
|
||||
//
|
||||
const atob = (str) => Buffer.from(str, "base64").toString("binary");
|
||||
// 判断如果过期时间小于我的当前时间,在请求上重新刷新token
|
||||
if (accessToken.split(".").length <= 1) {
|
||||
refresh();
|
||||
} else {
|
||||
console.log(
|
||||
JSON.parse(atob(accessToken.split(".")[1])).exp,
|
||||
Math.round(new Date() / 1000)
|
||||
);
|
||||
if (
|
||||
JSON.parse(atob(accessToken.split(".")[1])).exp <
|
||||
new Date().getTime() / 1000
|
||||
Math.round(new Date() / 1000)
|
||||
) {
|
||||
console.log("过期时间小于当前时间刷新token");
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
@ -154,28 +159,28 @@ http.interceptors.request.use(
|
|||
async function refresh() {
|
||||
// 本地储存的是过期token了,重新获取
|
||||
const getTokenResult = await refreshToken();
|
||||
// if (getTokenResult === "success") {
|
||||
// // 获取新的token成功 刷新当前页面
|
||||
if (getTokenResult === "success") {
|
||||
// 获取新的token成功 刷新当前页面
|
||||
|
||||
// let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
||||
// let curRoute = routes[routes.length - 1].route; //获取当前页面路由
|
||||
// let curParam = routes[routes.length - 1].options; //获取路由参数
|
||||
// // 拼接参数
|
||||
// let param = "";
|
||||
// for (let key in curParam) {
|
||||
// param += "&" + key + "=" + curParam[key];
|
||||
// }
|
||||
// // 判断当前路径
|
||||
// if (curRoute.indexOf("pages/tabbar") == 1) {
|
||||
// uni.switchTab({
|
||||
// url: "/" + curRoute + param.replace("&", "?"),
|
||||
// });
|
||||
// }
|
||||
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
|
||||
let curRoute = routes[routes.length - 1].route; //获取当前页面路由
|
||||
let curParam = routes[routes.length - 1].options; //获取路由参数
|
||||
// 拼接参数
|
||||
let param = "";
|
||||
for (let key in curParam) {
|
||||
param += "&" + key + "=" + curParam[key];
|
||||
}
|
||||
// 判断当前路径
|
||||
if (curRoute.indexOf("pages/tabbar") == 1) {
|
||||
uni.switchTab({
|
||||
url: "/" + curRoute + param.replace("&", "?"),
|
||||
});
|
||||
}
|
||||
|
||||
// uni.redirectTo({
|
||||
// url: "/" + curRoute + param.replace("&", "?"),
|
||||
// });
|
||||
// }
|
||||
uni.redirectTo({
|
||||
url: "/" + curRoute + param.replace("&", "?"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 必须使用异步函数,注意
|
||||
|
@ -184,7 +189,7 @@ http.interceptors.response.use(
|
|||
/* 请求之后拦截器。可以使用async await 做异步操作 */
|
||||
// token存在并且token过期
|
||||
let token = storage.getAccessToken();
|
||||
|
||||
console.warn(token)
|
||||
if (
|
||||
(token && response.statusCode === 403) ||
|
||||
response.data.status === 403
|
||||
|
|
Loading…
Reference in New Issue