Commit 9636bc69 authored by 刘文虎's avatar 刘文虎

bug修复

parent a2cf3ed0
......@@ -4,7 +4,8 @@ export function userAuthLogin(data) {
return request({
url: `/app/unify/authorization`,
method: 'POST',
data
data,
noLoading:true
})
}
......
......@@ -43,7 +43,7 @@
</view>
</view>
<!-- 计算器 -->
<view class="billing-calculator"><ab-calculator @change="calculatorChange" @sure="calculatorSure"></ab-calculator></view>
<view class="billing-calculator"><ab-calculator ref="ab-calculator" @change="calculatorChange" @sure="calculatorSure"></ab-calculator></view>
<!-- 日历 -->
<calendar-popup :date="form.happenTime" ref="calendar-popup" @confirm="calendarChange"></calendar-popup>
</view>
......@@ -57,6 +57,7 @@ import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillingCategory from './components/billing-category.vue';
import { billingTypeOptions } from '@/utils/options/bill';
import { indexBaseUrl, UPLOAD_FILE_HOST } from '@/utils/config.js';
import { checkToken } from '@/utils/common.js';
import upload from '@/utils/upload';
import { getBillTypes, add } from '@/api/bill/daily.js';
import { get } from '@/api/bill/index.js';
......@@ -135,8 +136,11 @@ export default {
methods: {
init() {
this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}');
this.getBillTypeOptions();
this.getQiniuToken();
if(checkToken()){
this.getBillTypeOptions();
this.getQiniuToken();
}
},
async getBillTypeOptions() {
try {
......@@ -182,6 +186,7 @@ export default {
},
open(id) {
this.getQiniuToken();
this.getBillTypeOptions();
if (id) {
this.id = id;
this.getDetail();
......
......@@ -4,7 +4,7 @@
<view class="mid-popup">
<u-row gutter="16">
<u-col span="4" v-for="(item, index) in list" :key="index">
<view class="button-view" @click="openBill(item)">
<view class="button-view" @click="clickItem(item)">
<view class="button-view-icon"><image :src="item.icon" mode=""></image></view>
<view class="button-view-content">{{ item.label }}</view>
</view>
......@@ -20,6 +20,7 @@
<script>
import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { minPopupOptions } from '@/utils/options/index/index.js';
import { checkLogin} from '@/utils/common.js';
export default {
name: 'mid-popup',
components: {
......@@ -39,6 +40,11 @@ export default {
close() {
this.show = false;
},
clickItem(item){
checkLogin(()=>{
this.openBill(item)
})
},
openBill(item) {
this.type = item.type;
this.close();
......
......@@ -31,7 +31,7 @@ import NavbarNormal from '@/components/navbar-normal';
import ScrollBox from './components/scroll-box.vue';
import { tabbar } from '@/utils/settings.js';
import { baseUrl } from '@/utils/config.js';
import { keepTwoDecimalFull } from '@/utils/common.js';
import { keepTwoDecimalFull,checkLogin} from '@/utils/common.js';
import { downLoad } from '@/utils/download.js';
import { getList, getStatistics } from '@/api/bill/index.js';
import { exportBill } from '@/api/bill/index.js';
......@@ -131,7 +131,9 @@ export default {
};
},
handlClickOut() {
this.visible = true;
checkLogin(()=>{
this.visible=true
})
},
handleClickConfirm(range) {
console.log(range);
......
......@@ -129,7 +129,7 @@ import BillList from '@/components/bill-list';
import PopNormal from '@/components/pop-normal';
import { tabbar } from '@/utils/settings.js';
import { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.js';
import { checkVip } from '@/utils/common.js';
import { checkVip,checkToken } from '@/utils/common.js';
import { mapGetters } from 'vuex';
export default {
components: {
......@@ -243,8 +243,10 @@ export default {
onShow() {
console.log('----------------');
this.getWeather();
this.monthRecord();
this.bookRecord();
if(checkToken()){
this.monthRecord();
this.bookRecord();
}
},
onReady() {},
methods: {
......@@ -325,8 +327,6 @@ export default {
},
checkVip() {
// 测试数据
return true;
if (checkVip()) {
return true;
} else {
......
......@@ -53,8 +53,9 @@ export default {
});
}
},
handleConfirm(path){
handleConfirm(){
this.$store.dispatch("LogOut")
this.$store.dispatch("Set_auto_login",false)
this.showToast("已退出登录",true)
setTimeout(()=>{
uni.switchTab({
......
......@@ -88,7 +88,7 @@ export default {
if (this.platform === '4') {
this.appWxLogin();
} else {
uni.redirectTo({
uni.navigateTo({
url: './quick-login/quick-login'
});
}
......@@ -154,7 +154,7 @@ export default {
grantType: '1' // APP微信登录
};
}
this.$u.route({ url: 'pages/login/binding-phone', params });
this.$u.route({ url: 'pages/login/binding-phone/binding-phone', params });
},
checkAgree() {
if (!this.agree) {
......
......@@ -4,8 +4,8 @@
<view class="quick-color-cancel" :style="{ 'padding-top': platform == '3' ? 0 : statusBarHeight + 'px' }"><u-icon name="close" @click="toIndex"></u-icon></view>
</view>
<view class="quick-background">
<image src="/static/images/login/startup/denglulogo@3x.png" mode="" class="quick-background-logo"></image>
<image src="/static/images/login/startup/shiyongbanshou@3x.png" mode="" class="quick-background-slogn"></image>
<image src="/static/image/index/denglulogo@3x.png" mode="" class="quick-background-logo"></image>
<image src="/static/image/index/shiyongbanshou@3x.png" mode="" class="quick-background-slogn"></image>
</view>
<view class="quick-mark">
<view class="quick-center">
......@@ -227,7 +227,7 @@ export default {
} else {
// 临时解决方案
that.$u.route({
url: 'pages/login/binding-phone',
url: 'pages/login/binding-phone/binding-phone',
params: {
encryptedData: that.params.encryptedData,
iv: that.params.iv
......
......@@ -16,23 +16,53 @@
</view>
</view>
</view>
<view class="unsubscribe" v-if="userInfo && userInfo.userId"><text @click="$u.throttle(unsubscribe, 500)">注销账号</text></view>
<unsubscribe-popup :title="title" :content="content" ref="unsubscribe-popup" @confirm="onUnsubscribe"></unsubscribe-popup>
</view>
</template>
<script>
import UnsubscribePopup from './components/unsubscribe-popup.vue';
import { version } from '@/utils/config.js';
import { mapGetters } from 'vuex';
export default {
components: {
UnsubscribePopup
},
data() {
return {
version
version,
title: '温馨提示',
content: '您正在申请注销扳手记账账号,注销后,您的兑换码,积分,会员特权,邀请等数据将会失效,且不可恢复。确定注销吗?'
};
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
handleClick(type) {
uni.navigateTo({
url: '/pages/login/agreement/agreement?type=' + type
});
},
unsubscribe() {
this.$refs['unsubscribe-popup'].open();
},
onUnsubscribe() {
this.$store.dispatch('LogOut');
this.$store.dispatch('Set_auto_login', false);
uni.showModal({
title: '注销成功',
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.switchTab({
url: '/pages/index/index'
});
}
}
});
}
}
};
</script>
......@@ -72,4 +102,15 @@ export default {
font-size: 26rpx;
padding-right: 6rpx;
}
.unsubscribe {
position: absolute;
bottom: 24upx;
left: 0;
width: 100%;
color: #8d8d8d;
text-align: center;
line-height: 88upx;
text-align: center;
font-size: 24upx;
}
</style>
<template>
<!-- 弹出获取用户信息 -->
<u-popup v-model="show" :mask-close-able="false" mode="center" border-radius="12">
<view class="alert-message">
<view class="alert-message-box">
<view class="alert-message-title">{{title}}</view>
<view class="alert-message-content">{{ content }}</view>
<view class="alert-message-checkbox">
<u-checkbox shape="circle" active-color="#02A074" v-model="checked">我已阅读</u-checkbox>
</view>
</view>
<view class="alert-message-box-center">
</view>
<view class="alert-message-bottom">
<button class="alert-message-bottom-button" @click="close">{{ cancelText }}</button>
<button class="alert-message-bottom-button alert-message-bottom-confirm" :class="{disabled:!checked}" :disabled="!checked" @click="$u.throttle(confirm, 500)">{{ confirmText }}</button>
</view>
</view>
</u-popup>
</template>
<script>
export default {
props: {
title: {
type: String,
default: '提示!'
},
content: {
type: String,
default: '确认提交吗?'
},
cancelText: {
type: String,
default: '取消'
},
confirmText: {
type: String,
default: '确定'
}
},
data() {
return {
show: false,
checked:false
};
},
methods: {
open() {
this.show = true;
},
close() {
this.show = false;
},
confirm() {
this.show = false;
this.$emit('confirm');
},
}
};
</script>
<style lang="scss" scoped>
.alert-message {
color: #808080;
width: 662upx;
// border-radius: 16upx;
overflow: hidden;
font-size: 28upx;
z-index: 99999;
.alert-message-box {
padding: 0 40upx;
padding-bottom: 50upx;
.alert-message-title {
text-align: center;
font-size: 32upx;
line-height: 120upx;
font-weight: bold;
color: #333333;
}
.alert-message-content {
text-indent: 2em;
font-size: 28upx;
font-weight: 500;
line-height: 40upx;
color: #333333;
}
.alert-message-checkbox{
margin-top: 10upx;
}
.alert-message-confirm-content {
padding-top: 100upx;
.alert-message-confirm-content-text {
display: flex;
align-items: center;
justify-content: center;
.controls-icon {
width: 80upx;
height: 80upx;
}
}
}
}
.alert-message-box-center {
width: 100%;
height: 20upx;
background: #f2f3f3;
}
.alert-message-bottom {
height: 84upx;
text-align: center;
line-height: 84upx;
color: #faf7f5;
font-size: 32upx;
// border-radius: 0px 0px 12upx 12upx;
display: flex;
position: relative;
&:active {
opacity: 0.8;
}
.alert-message-bottom-button {
flex: 1;
background-color: #ffffff;
border: none;
&:after {
border: none;
}
}
.alert-message-bottom-confirm {
color: $default-color;
}
.alert-message-bottom-right {
left: unset;
right: 0;
}
.disabled{
color: #8D8D8D;
}
}
}
</style>
......@@ -6,9 +6,6 @@ import {
} from "@/utils/common.js"
import {whiteList} from "@/utils/config.js"
import store from "../store/index.js"
import {
getCode
} from "@/utils/auth.js"
import {
RouterMount,
......@@ -50,24 +47,40 @@ const router = createRouter({
}
}else{
store.dispatch('Auto_login').then(()=>{
next()
}).catch(()=>{
if(store.getters.autoLogin){
store.dispatch('Auto_login').then(()=>{
next()
}).catch(()=>{
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('自动登录失败');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
}
})
}else{
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('自动登录失败');
showToast('请先登录');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
}
}
})
}
}
......
......@@ -5,6 +5,7 @@ const getters = {
platform:state=>state.login.platform,
loginChannel:state=>state.login.loginChannel,
authType:state=>state.login.authType,
autoLogin:state=>state.login.autoLogin,
quotedPriceTooltip:state=>state.common.quotedPriceTooltip,
cdKeySetting:state=>state.common.cdKeySetting,
}
......
......@@ -8,6 +8,8 @@ import {
setTimetamp,
setChannel,
getChannel,
setAutoLogin,
getAutoLogin,
} from "@/utils/common.js"
import {
loginInfo
......@@ -30,6 +32,7 @@ const state = {
platform: platform, //
loginChannel: getChannel().loginChannel, // 登录渠道
authType: getChannel().authType, // 授权渠道
autoLogin: getAutoLogin(),
userInfo: getUserinfo(),
scene: null,
showPublic: false,
......@@ -83,7 +86,10 @@ const mutations = {
state.loginChannel = channel.loginChannel
state.authType = channel.authType
},
SET_AUTO_LOGIN: (state, data) => {
state.autoLogin = data
setAutoLogin(data)
},
}
const actions = {
......@@ -92,6 +98,11 @@ const actions = {
}, data) {
commit("SET_SCENE", data)
},
Set_auto_login({
commit
}, data) {
commit("SET_AUTO_LOGIN", data)
},
App_WX_login({
state,
commit,
......@@ -171,6 +182,7 @@ const actions = {
} = res.data
setTimetamp()
setToken(token)
dispatch("Set_auto_login",true)
await dispatch('Get_UserInfo')
resolve(res)
} catch (e) {
......@@ -209,6 +221,7 @@ const actions = {
}) {
removeToken()
removeUserinfo()
commit("SET_USERINFO",{})
removeTimetamp()
},
// 获取图片域名
......
......@@ -231,3 +231,4 @@ export const authorize = function(scope="scope.userInfo") {
});
})
}
......@@ -74,6 +74,39 @@ export function getChannel() {
return uni.getStorageSync("CHANNEL") || {}
}
export function setAutoLogin(data) {
uni.setStorageSync("AUTOLOGIN", data);
}
export function getAutoLogin() {
return uni.getStorageSync("AUTOLOGIN")||false
}
export function checkLogin(callback){
if(checkToken()){
if(checkVip()){
if(callback){
callback()
}
}else{
showToast('您还不是会员,请先开通会员')
}
}else{
uni.showToast({
icon:'none',
title:'您还未登录,请先登录',
success(){
setTimeout(()=>{
uni.navigateTo({
url:'/pages/login/login'
})
},1500)
}
})
}
}
export function checkPhone() {
let userinfo = getUserinfo()
......
......@@ -94,7 +94,9 @@ function request({
} else if (res.data.code === 23001) {
reject(res.data)
} else {
showToast(res.data.msg)
if(checkToken()){
showToast(res.data.msg)
}
reject(res.data)
}
}
......
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