style: 🎨 优化退出登录功能、优化部分变量名
parent
071599074c
commit
529175c0ab
|
@ -9,3 +9,5 @@ node_modules/
|
||||||
.vscode/
|
.vscode/
|
||||||
/unpackage/
|
/unpackage/
|
||||||
.hbuilderx/launch.json
|
.hbuilderx/launch.json
|
||||||
|
.project.config.json
|
||||||
|
.project.private.config.json
|
||||||
|
|
|
@ -211,7 +211,8 @@
|
||||||
"version" : "1.3.0",
|
"version" : "1.3.0",
|
||||||
"provider" : "wx2b03c6e691cd7370"
|
"provider" : "wx2b03c6e691cd7370"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
|
||||||
},
|
},
|
||||||
"h5" : {
|
"h5" : {
|
||||||
"devServer" : {
|
"devServer" : {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<u-empty
|
<u-empty
|
||||||
mode="coupon"
|
mode="coupon"
|
||||||
text="暂无优惠券了"
|
text="暂无优惠券了"
|
||||||
v-if="navItem.wheterEmpty"
|
v-if="navItem.whetherEmpty"
|
||||||
></u-empty>
|
></u-empty>
|
||||||
|
|
||||||
<!-- 数据 -->
|
<!-- 数据 -->
|
||||||
|
@ -139,7 +139,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
wheterEmpty: false,
|
whetherEmpty: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "已使用",
|
text: "已使用",
|
||||||
|
@ -151,7 +151,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
status: 2,
|
status: 2,
|
||||||
},
|
},
|
||||||
wheterEmpty: false,
|
whetherEmpty: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "已过期",
|
text: "已过期",
|
||||||
|
@ -163,7 +163,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
status: 3,
|
status: 3,
|
||||||
},
|
},
|
||||||
wheterEmpty: false,
|
whetherEmpty: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
couponList: [], //优惠券列表
|
couponList: [], //优惠券列表
|
||||||
|
@ -206,7 +206,7 @@ export default {
|
||||||
let data = res.data.result.records;
|
let data = res.data.result.records;
|
||||||
if (data.length == 0) {
|
if (data.length == 0) {
|
||||||
if (res.data.pageNumber == 1) {
|
if (res.data.pageNumber == 1) {
|
||||||
this.navList[index].wheterEmpty = true;
|
this.navList[index].whetherEmpty = true;
|
||||||
} else {
|
} else {
|
||||||
this.navList[index].loadStatus = "noMore";
|
this.navList[index].loadStatus = "noMore";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="wrapper" v-if="flage">
|
<view class="wrapper" v-if="flag">
|
||||||
<div class='goods' v-if="selectedGoods">
|
<div class='goods' v-if="selectedGoods">
|
||||||
<image class="goods-image" :src="selectedGoods.thumbnail" alt="">
|
<image class="goods-image" :src="selectedGoods.thumbnail" alt="">
|
||||||
<p class="goodsName">{{selectedGoods.goodsName}}</p>
|
<p class="goodsName">{{selectedGoods.goodsName}}</p>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
<popupGoods :addr="addr" ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" v-if="goodsDetail.id " @handleClickSku="getGoodsDetail" />
|
<popupGoods :addr="addr" ref="popupGoods" :buyMask="maskFlag" @closeBuy="closePopupBuy" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" v-if="goodsDetail.id " @handleClickSku="getGoodsDetail" />
|
||||||
<shares @close="closeShare" :link="'/pages/cart/payment/shareOrderGoods?sn='+this.routers.sn+'&sku='+this.routers.sku+'&goodsId='+this.routers.goodsId" type="pintuan"
|
<shares @close="closeShare" :link="'/pages/cart/payment/shareOrderGoods?sn='+this.routers.sn+'&sku='+this.routers.sku+'&goodsId='+this.routers.goodsId" type="pintuan"
|
||||||
:thumbnail="data.promotionGoods.thumbnail" :goodsName="data.promotionGoods.goodsName" v-if="shareFlage " />
|
:thumbnail="data.promotionGoods.thumbnail" :goodsName="data.promotionGoods.goodsName" v-if="shareFlag " />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ import popupGoods from "@/components/m-buy/goods"; //购物车商品的模块
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
flage: false, //判断接口是否正常请求
|
flag: false, //判断接口是否正常请求
|
||||||
addr: {
|
addr: {
|
||||||
id: "",
|
id: "",
|
||||||
},
|
},
|
||||||
maskFlag: false, //商品弹框
|
maskFlag: false, //商品弹框
|
||||||
timeStamp: 0,
|
timeStamp: 0,
|
||||||
shareFlage: false,
|
shareFlag: false,
|
||||||
data: "",
|
data: "",
|
||||||
isMaster: true,
|
isMaster: true,
|
||||||
selectedGoods: "", //选择的商品规格昵称
|
selectedGoods: "", //选择的商品规格昵称
|
||||||
|
@ -116,7 +116,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeShare() {
|
closeShare() {
|
||||||
this.shareFlage = false;
|
this.shareFlag = false;
|
||||||
},
|
},
|
||||||
// 这里的话得先跳到商品详情才能购买商品
|
// 这里的话得先跳到商品详情才能购买商品
|
||||||
toBuy() {
|
toBuy() {
|
||||||
|
@ -131,7 +131,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 分享
|
// 分享
|
||||||
share() {
|
share() {
|
||||||
this.shareFlage = true;
|
this.shareFlag = true;
|
||||||
},
|
},
|
||||||
closePopupBuy(val) {
|
closePopupBuy(val) {
|
||||||
this.maskFlag = false;
|
this.maskFlag = false;
|
||||||
|
@ -140,7 +140,7 @@ export default {
|
||||||
async init(sn, sku) {
|
async init(sn, sku) {
|
||||||
let res = await getPinTuanShare(sn, sku);
|
let res = await getPinTuanShare(sn, sku);
|
||||||
if (res.data.success && res.data.result.promotionGoods) {
|
if (res.data.success && res.data.result.promotionGoods) {
|
||||||
this.flage = true;
|
this.flag = true;
|
||||||
this.data = res.data.result;
|
this.data = res.data.result;
|
||||||
this.selectedGoods = res.data.result.promotionGoods;
|
this.selectedGoods = res.data.result.promotionGoods;
|
||||||
let endTime = Date.parse(
|
let endTime = Date.parse(
|
||||||
|
|
|
@ -33,18 +33,18 @@
|
||||||
<m-city :provinceData="list" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4">
|
<m-city :provinceData="list" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4">
|
||||||
</m-city>
|
</m-city>
|
||||||
|
|
||||||
<uniMap v-if="mapFlage" @close="closeMap" @callback="callBackAddress" />
|
<uniMap v-if="mapFlag" @close="closeMap" @callback="callBackAddress" />
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { addAddress, editAddress, getAddressDetail } from "@/api/address.js";
|
import { addAddress, editAddress, getAddressDetail } from "@/api/address.js";
|
||||||
import gkcity from "@/components/m-city/m-city.vue";
|
import city from "@/components/m-city/m-city.vue";
|
||||||
import uniMap from "./uniMap";
|
import uniMap from "./uniMap";
|
||||||
import permision from "@/js_sdk/wa-permission/permission.js";
|
import permision from "@/js_sdk/wa-permission/permission.js";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
"m-city": gkcity,
|
"m-city": city,
|
||||||
uniMap,
|
uniMap,
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
@ -53,7 +53,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 关闭地图
|
// 关闭地图
|
||||||
closeMap() {
|
closeMap() {
|
||||||
this.mapFlage = false;
|
this.mapFlag = false;
|
||||||
},
|
},
|
||||||
// 打开地图并访问权限
|
// 打开地图并访问权限
|
||||||
clickUniMap() {
|
clickUniMap() {
|
||||||
|
@ -61,8 +61,8 @@ export default {
|
||||||
if (plus.os.name == "iOS") {
|
if (plus.os.name == "iOS") {
|
||||||
// ios系统
|
// ios系统
|
||||||
permision.judgeIosPermission("location")
|
permision.judgeIosPermission("location")
|
||||||
? (this.mapFlage = true)
|
? (this.mapFlag = true)
|
||||||
: this.refuseMapOuther();
|
: this.refuseMap();
|
||||||
} else {
|
} else {
|
||||||
// 安卓
|
// 安卓
|
||||||
this.requestAndroidPermission(
|
this.requestAndroidPermission(
|
||||||
|
@ -72,12 +72,12 @@ export default {
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef APP-PLUS
|
// #ifndef APP-PLUS
|
||||||
this.mapFlage = true;
|
this.mapFlag = true;
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
// 如果拒绝权限 提示区设置
|
// 如果拒绝权限 提示区设置
|
||||||
refuseMapOuther() {
|
refuseMap() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: "温馨提示",
|
title: "温馨提示",
|
||||||
content: "您已拒绝定位,请开启",
|
content: "您已拒绝定位,请开启",
|
||||||
|
@ -113,9 +113,9 @@ export default {
|
||||||
var result = await permision.requestAndroidPermission(permisionID);
|
var result = await permision.requestAndroidPermission(permisionID);
|
||||||
|
|
||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
this.mapFlage = true;
|
this.mapFlag = true;
|
||||||
} else {
|
} else {
|
||||||
this.refuseMapOuther();
|
this.refuseMap();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ export default {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mapFlage = !this.mapFlage; //关闭地图
|
this.mapFlag = !this.mapFlag; //关闭地图
|
||||||
},
|
},
|
||||||
|
|
||||||
// 保存当前 地址
|
// 保存当前 地址
|
||||||
|
@ -206,7 +206,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lightColor: this.$lightColor, //高亮颜色
|
lightColor: this.$lightColor, //高亮颜色
|
||||||
mapFlage: false, // 地图选择开
|
mapFlag: false, // 地图选择开
|
||||||
routerVal: "",
|
routerVal: "",
|
||||||
form: {
|
form: {
|
||||||
detail: "", //地址详情
|
detail: "", //地址详情
|
||||||
|
|
|
@ -29,7 +29,8 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail() {
|
fail(e) {
|
||||||
|
console.log(e)
|
||||||
that.$emit("close");
|
that.$emit("close");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<swiper class="swiper-box" :current="swiperCurrent">
|
<swiper class="swiper-box" :current="swiperCurrent">
|
||||||
<swiper-item class="swiper-item" v-for="index in list.length" :key="index">
|
<swiper-item class="swiper-item" v-for="index in list.length" :key="index">
|
||||||
<scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
|
<scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
|
||||||
<view v-if="datas.length!=0" class="view-item" v-for="(logItem, logIndex) in datas" :key="logIndex">
|
<view v-if="depositData.length!=0" class="view-item" v-for="(logItem, logIndex) in depositData" :key="logIndex">
|
||||||
<view class="view-item-detail">
|
<view class="view-item-detail">
|
||||||
<view class="-title">{{logItem.detail}}</view>
|
<view class="-title">{{logItem.detail}}</view>
|
||||||
<!-- <view class="-number">{{logItem.detail}}</view> -->
|
<!-- <view class="-number">{{logItem.detail}}</view> -->
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-empty v-if="datas.length==0" mode="history" text="暂无记录" />
|
<u-empty v-if="depositData.length==0" mode="history" text="暂无记录" />
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
walletNum: 0,
|
walletNum: 0,
|
||||||
|
|
||||||
current: 0,
|
current: 0,
|
||||||
swiperCurrent: 0,
|
swiperCurrent: 0,
|
||||||
userInfo: "", //用户详情信息
|
userInfo: "", //用户详情信息
|
||||||
|
@ -54,7 +53,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
order: "desc",
|
order: "desc",
|
||||||
},
|
},
|
||||||
datas: [], //遍历的数据集合
|
depositData: [], //遍历的数据集合
|
||||||
rechargeList: "", //充值明细列表
|
rechargeList: "", //充值明细列表
|
||||||
walletLogList: "", //钱包变动列表
|
walletLogList: "", //钱包变动列表
|
||||||
list: [
|
list: [
|
||||||
|
@ -82,12 +81,10 @@ export default {
|
||||||
|
|
||||||
/**分页获取预存款充值记录 */
|
/**分页获取预存款充值记录 */
|
||||||
getRecharge() {
|
getRecharge() {
|
||||||
|
|
||||||
getUserRecharge(this.params).then((res) => {
|
getUserRecharge(this.params).then((res) => {
|
||||||
if (res.data.success) {
|
if (res.data.success) {
|
||||||
if (res.data.result.records.length != 0) {
|
if (res.data.result.records.length != 0) {
|
||||||
|
this.depositData.push(...res.data.result.records);
|
||||||
this.datas.push(...res.data.result.records);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -98,7 +95,7 @@ export default {
|
||||||
getWalletLog(this.params).then((res) => {
|
getWalletLog(this.params).then((res) => {
|
||||||
if (res.data.success) {
|
if (res.data.success) {
|
||||||
if (res.data.result.records.length != 0) {
|
if (res.data.result.records.length != 0) {
|
||||||
this.datas.push(...res.data.result.records);
|
this.depositData.push(...res.data.result.records);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -106,7 +103,7 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
changed(index) {
|
changed(index) {
|
||||||
this.datas = [];
|
this.depositData = [];
|
||||||
this.swiperCurrent = index;
|
this.swiperCurrent = index;
|
||||||
this.params.pageNumber = 1;
|
this.params.pageNumber = 1;
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<div class="deposit">预存款金额</div>
|
<div class="deposit">预存款金额</div>
|
||||||
<div class="money">¥{{walletNum | unitPrice }}</div>
|
<div class="money">¥{{walletNum | unitPrice }}</div>
|
||||||
<div class="operation-btns">
|
<div class="operation-btns">
|
||||||
<div class="operation-btn light" @click="navgition('/pages/mine/deposit/withdrawal')">提现</div>
|
<div class="operation-btn light" @click="navigateTo('/pages/mine/deposit/withdrawal')">提现</div>
|
||||||
<div class="operation-btn" @click="navgition('/pages/mine/deposit/recharge')">充值</div>
|
<div class="operation-btn" @click="navigateTo('/pages/mine/deposit/recharge')">充值</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box list" @click="navgition('/pages/mine/deposit/index')">
|
<div class="box list" @click="navigateTo('/pages/mine/deposit/index')">
|
||||||
<div class="list-left">预存款明细</div>
|
<div class="list-left">预存款明细</div>
|
||||||
<div class="list-right">
|
<div class="list-right">
|
||||||
<u-icon name="arrow-right"></u-icon>
|
<u-icon name="arrow-right"></u-icon>
|
||||||
|
@ -31,12 +31,6 @@ export default {
|
||||||
let result = await getUserWallet(); //预存款
|
let result = await getUserWallet(); //预存款
|
||||||
this.walletNum = result.data.result.memberWallet;
|
this.walletNum = result.data.result.memberWallet;
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
|
||||||
icon: "none",
|
|
||||||
duration: 3000,
|
|
||||||
title: "请先登录!",
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$options.filters.navigateToLogin("redirectTo");
|
this.$options.filters.navigateToLogin("redirectTo");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -49,7 +43,7 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 跳转
|
* 跳转
|
||||||
*/
|
*/
|
||||||
navgition(url) {
|
navigateTo(url) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url,
|
url,
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,26 +23,22 @@
|
||||||
<u-input v-model="form.___path" disabled @click="clickRegion" />
|
<u-input v-model="form.___path" disabled @click="clickRegion" />
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<view class="submit" @click="submit">保存</view>
|
<view class="submit" @click="submit">保存</view>
|
||||||
<view class="submit" @click="showModalDialog">退出登录</view>
|
<view class="submit" @click="quiteLoginOut">退出登录</view>
|
||||||
<u-modal show-cancel-button v-model="quitShow" @confirm="confirm" :confirm-color="lightColor" :async-close="true"
|
|
||||||
:content="'确定要退出登录么?'"></u-modal>
|
|
||||||
</u-form>
|
</u-form>
|
||||||
|
|
||||||
<m-city :provinceData="region" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4"></m-city>
|
<m-city :provinceData="region" headTitle="区域选择" ref="cityPicker" @funcValue="getPickerParentValue" pickerSize="4"></m-city>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { logout } from "@/api/login";
|
|
||||||
import { saveUserInfo } from "@/api/members.js";
|
import { saveUserInfo } from "@/api/members.js";
|
||||||
import { upload } from "@/api/common.js";
|
import { upload } from "@/api/common.js";
|
||||||
import storage from "@/utils/storage.js";
|
import storage from "@/utils/storage.js";
|
||||||
import uFormItem from "@/uview-ui/components/u-form-item/u-form-item.vue";
|
import uFormItem from "@/uview-ui/components/u-form-item/u-form-item.vue";
|
||||||
import gkcity from "@/components/m-city/m-city.vue";
|
import city from "@/components/m-city/m-city.vue";
|
||||||
export default {
|
export default {
|
||||||
components: { uFormItem, "m-city": gkcity },
|
components: { uFormItem, "m-city": city },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
quitShow: false,
|
|
||||||
lightColor: this.$lightColor, //高亮颜色
|
lightColor: this.$lightColor, //高亮颜色
|
||||||
form: {
|
form: {
|
||||||
nickName: storage.getUserInfo().nickName || "",
|
nickName: storage.getUserInfo().nickName || "",
|
||||||
|
@ -71,38 +67,16 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 显示退出登录对话框
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
showModalDialog() {
|
quiteLoginOut() {
|
||||||
this.quitShow = true;
|
this.$options.filters.quiteLoginOut();
|
||||||
},
|
|
||||||
|
|
||||||
clear() {
|
|
||||||
storage.setAccessToken("");
|
|
||||||
storage.setRefreshToken("");
|
|
||||||
storage.setUserInfo({});
|
|
||||||
this.$options.filters.navigateToLogin("redirectTo");
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认退出
|
|
||||||
* 清除缓存重新登录
|
|
||||||
*/
|
|
||||||
async confirm() {
|
|
||||||
try{
|
|
||||||
await logout();
|
|
||||||
this.clear();
|
|
||||||
}catch(e){
|
|
||||||
//TODO handle the exception
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择地址回调
|
* 选择地址回调
|
||||||
*/
|
*/
|
||||||
getpickerParentValue(e) {
|
getPickerParentValue(e) {
|
||||||
this.form.region = [];
|
this.form.region = [];
|
||||||
this.form.regionId = [];
|
this.form.regionId = [];
|
||||||
let name = "";
|
let name = "";
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<u-image width=140 height="140" shape="circle" :src="userInfo.face || userImage" mode="">
|
<u-image width=140 height="140" shape="circle" :src="userInfo.face || userImage" mode="">
|
||||||
</u-image>
|
</u-image>
|
||||||
<view class="user-name">
|
<view class="user-name">
|
||||||
|
|
||||||
{{ userInfo.id ? userInfo.nickName || '' : '暂未登录' }}
|
{{ userInfo.id ? userInfo.nickName || '' : '暂未登录' }}
|
||||||
</view>
|
</view>
|
||||||
<u-icon color="#ccc" name="arrow-right"></u-icon>
|
<u-icon color="#ccc" name="arrow-right"></u-icon>
|
||||||
|
@ -22,23 +21,17 @@
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<u-cell-item :title="`关于${config.name}`" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
|
<u-cell-item :title="`关于${config.name}`" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
<view class="submit" @click="showModalDialog">{{userInfo.id ?'退出登录':'登录'}}</view>
|
<view class="submit" v-if="userInfo.id" @click="quiteLoginOut">退出登录</view>
|
||||||
<u-modal show-cancel-button v-model="quitShow" @confirm="confirm" :confirm-color="lightColor" :async-close="true"
|
|
||||||
:content="userInfo.id ? '确定要退出登录么?' : '确定要登录么?'"></u-modal>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { logout } from "@/api/login";
|
|
||||||
import storage from "@/utils/storage.js";
|
|
||||||
import config from "@/config/config";
|
import config from "@/config/config";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
config,
|
config,
|
||||||
userImage:config.defaultUserPhoto,
|
userImage:config.defaultUserPhoto,
|
||||||
lightColor: this.$lightColor,
|
|
||||||
quitShow: false,
|
|
||||||
isCertificate: false,
|
isCertificate: false,
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
fileSizeString: "0B",
|
fileSizeString: "0B",
|
||||||
|
@ -54,34 +47,14 @@ export default {
|
||||||
url: url,
|
url: url,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
clear() {
|
|
||||||
storage.setAccessToken("");
|
|
||||||
storage.setRefreshToken("");
|
|
||||||
storage.setUserInfo({});
|
|
||||||
this.$options.filters.navigateToLogin("redirectTo");
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认退出
|
* 退出登录
|
||||||
* 清除缓存重新登录
|
|
||||||
*/
|
*/
|
||||||
async confirm() {
|
quiteLoginOut() {
|
||||||
try{
|
this.$options.filters.quiteLoginOut();
|
||||||
await logout();
|
|
||||||
this.clear();
|
|
||||||
}catch(e){
|
|
||||||
//TODO handle the exception
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示退出登录对话框
|
|
||||||
*/
|
|
||||||
showModalDialog() {
|
|
||||||
this.quitShow = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取当前缓存
|
* 读取当前缓存
|
||||||
|
@ -113,11 +86,7 @@ export default {
|
||||||
if (this.$options.filters.isLogin("auth")) {
|
if (this.$options.filters.isLogin("auth")) {
|
||||||
this.navigateTo("/pages/mine/set/personMsg");
|
this.navigateTo("/pages/mine/set/personMsg");
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
this.$options.filters.tipsToLogin();
|
||||||
title: "当前暂无用户请登录后重试",
|
|
||||||
duration: 2000,
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
"appid": "wx98ebde1da5b340d4",
|
|
||||||
"compileType": "miniprogram",
|
|
||||||
"libVersion": "2.27.0",
|
|
||||||
"packOptions": {
|
|
||||||
"ignore": [],
|
|
||||||
"include": []
|
|
||||||
},
|
|
||||||
"setting": {
|
|
||||||
"coverView": true,
|
|
||||||
"es6": true,
|
|
||||||
"postcss": true,
|
|
||||||
"minified": true,
|
|
||||||
"enhance": true,
|
|
||||||
"showShadowRootInWxmlPanel": true,
|
|
||||||
"packNpmRelationList": [],
|
|
||||||
"babelSetting": {
|
|
||||||
"ignore": [],
|
|
||||||
"disablePlugins": [],
|
|
||||||
"outputPath": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"condition": {},
|
|
||||||
"editorSetting": {
|
|
||||||
"tabIndent": "insertSpaces",
|
|
||||||
"tabSize": 2
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
||||||
"projectname": "lilishop-uniapp",
|
|
||||||
"setting": {
|
|
||||||
"compileHotReLoad": true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
import Foundation from "./Foundation.js";
|
import Foundation from "./Foundation.js";
|
||||||
import storage from "@/utils/storage.js";
|
import storage from "@/utils/storage.js";
|
||||||
|
import { logout } from "@/api/login";
|
||||||
import { getUserInfo } from "@/api/members";
|
import { getUserInfo } from "@/api/members";
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +35,6 @@ export function goodsFormatPrice(val) {
|
||||||
return valNum.toFixed(2).split(".");
|
return valNum.toFixed(2).split(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 脱敏姓名
|
* 脱敏姓名
|
||||||
*/
|
*/
|
||||||
|
@ -90,7 +90,7 @@ export function unixToDate(unix, format) {
|
||||||
*
|
*
|
||||||
* @param {Object} datetime
|
* @param {Object} datetime
|
||||||
*/
|
*/
|
||||||
export function beautifyTime(datetime = "") {
|
export function beautifyTime(datetime = "") {
|
||||||
if (datetime == null || datetime == undefined || !datetime) {
|
if (datetime == null || datetime == undefined || !datetime) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -154,59 +154,6 @@ export function secrecyMobile(mobile) {
|
||||||
return mobile.replace(/(\d{3})(\d{4})(\d{4})/, "$1****$3");
|
return mobile.replace(/(\d{3})(\d{4})(\d{4})/, "$1****$3");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 人性化时间显示
|
|
||||||
*
|
|
||||||
* @param {Object} datetime
|
|
||||||
*/
|
|
||||||
export function formatTime(datetime) {
|
|
||||||
if (datetime == null) return "";
|
|
||||||
|
|
||||||
datetime = datetime.replace(/-/g, "/");
|
|
||||||
|
|
||||||
let time = new Date();
|
|
||||||
let outTime = new Date(datetime);
|
|
||||||
if (/^[1-9]\d*$/.test(datetime)) {
|
|
||||||
outTime = new Date(parseInt(datetime) * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
time.getTime() < outTime.getTime() ||
|
|
||||||
time.getFullYear() != outTime.getFullYear()
|
|
||||||
) {
|
|
||||||
return parseTime(outTime, "{y}-{m}-{d} {h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.getMonth() != outTime.getMonth()) {
|
|
||||||
return parseTime(outTime, "{m}-{d} {h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.getDate() != outTime.getDate()) {
|
|
||||||
let day = outTime.getDate() - time.getDate();
|
|
||||||
if (day == -1) {
|
|
||||||
return parseTime(outTime, "昨天 {h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (day == -2) {
|
|
||||||
return parseTime(outTime, "前天 {h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseTime(outTime, "{m}-{d} {h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.getHours() != outTime.getHours()) {
|
|
||||||
return parseTime(outTime, "{h}:{i}");
|
|
||||||
}
|
|
||||||
|
|
||||||
let minutes = outTime.getMinutes() - time.getMinutes();
|
|
||||||
if (minutes == 0) {
|
|
||||||
return "刚刚";
|
|
||||||
}
|
|
||||||
|
|
||||||
minutes = Math.abs(minutes);
|
|
||||||
return `${minutes}分钟前`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间格式化方法
|
* 时间格式化方法
|
||||||
*
|
*
|
||||||
|
@ -214,7 +161,7 @@ export function secrecyMobile(mobile) {
|
||||||
* @param {String} cFormat
|
* @param {String} cFormat
|
||||||
* @returns {String | null}
|
* @returns {String | null}
|
||||||
*/
|
*/
|
||||||
export function parseTime(time, cFormat) {
|
export function parseTime(time, cFormat) {
|
||||||
if (arguments.length === 0) {
|
if (arguments.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -281,20 +228,47 @@ export function isLogin(val) {
|
||||||
return storage.getUserInfo();
|
return storage.getUserInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export function quiteLoginOut() {
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
content: "是否退出登录?",
|
||||||
|
confirmColor: Vue.prototype.$mainColor,
|
||||||
|
async success(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
storage.setAccessToken("");
|
||||||
|
storage.setRefreshToken("");
|
||||||
|
storage.setUserInfo({});
|
||||||
|
navigateToLogin("redirectTo");
|
||||||
|
await logout();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转im
|
* 跳转im
|
||||||
|
* 若未登录提示去登录
|
||||||
*/
|
*/
|
||||||
export function talkIm(storeId){
|
export function talkIm(storeId) {
|
||||||
if(isLogin('auth')){
|
if (isLogin("auth")) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/tabbar/home/web-view?IM=${storeId}`,
|
url: `/pages/tabbar/home/web-view?IM=${storeId}`,
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
tipsToLogin();
|
||||||
tipsToLogin()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前用户是否登录状态
|
||||||
|
* 若未登录点击确认跳转到登录
|
||||||
|
* 点击取消回退上一级页面
|
||||||
|
*/
|
||||||
export function tipsToLogin() {
|
export function tipsToLogin() {
|
||||||
if (!isLogin("auth")) {
|
if (!isLogin("auth")) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|
Loading…
Reference in New Issue