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

bug修复

parent a2cf3ed0
...@@ -4,7 +4,8 @@ export function userAuthLogin(data) { ...@@ -4,7 +4,8 @@ export function userAuthLogin(data) {
return request({ return request({
url: `/app/unify/authorization`, url: `/app/unify/authorization`,
method: 'POST', method: 'POST',
data data,
noLoading:true
}) })
} }
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</view> </view>
</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> <calendar-popup :date="form.happenTime" ref="calendar-popup" @confirm="calendarChange"></calendar-popup>
</view> </view>
...@@ -57,6 +57,7 @@ import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue'; ...@@ -57,6 +57,7 @@ import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import BillingCategory from './components/billing-category.vue'; import BillingCategory from './components/billing-category.vue';
import { billingTypeOptions } from '@/utils/options/bill'; import { billingTypeOptions } from '@/utils/options/bill';
import { indexBaseUrl, UPLOAD_FILE_HOST } from '@/utils/config.js'; import { indexBaseUrl, UPLOAD_FILE_HOST } from '@/utils/config.js';
import { checkToken } from '@/utils/common.js';
import upload from '@/utils/upload'; import upload from '@/utils/upload';
import { getBillTypes, add } from '@/api/bill/daily.js'; import { getBillTypes, add } from '@/api/bill/daily.js';
import { get } from '@/api/bill/index.js'; import { get } from '@/api/bill/index.js';
...@@ -135,8 +136,11 @@ export default { ...@@ -135,8 +136,11 @@ export default {
methods: { methods: {
init() { init() {
this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}'); this.form.happenTime = this.parseTime(new Date(), '{y}-{m}-{d}');
if(checkToken()){
this.getBillTypeOptions(); this.getBillTypeOptions();
this.getQiniuToken(); this.getQiniuToken();
}
}, },
async getBillTypeOptions() { async getBillTypeOptions() {
try { try {
...@@ -182,6 +186,7 @@ export default { ...@@ -182,6 +186,7 @@ export default {
}, },
open(id) { open(id) {
this.getQiniuToken(); this.getQiniuToken();
this.getBillTypeOptions();
if (id) { if (id) {
this.id = id; this.id = id;
this.getDetail(); this.getDetail();
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="mid-popup"> <view class="mid-popup">
<u-row gutter="16"> <u-row gutter="16">
<u-col span="4" v-for="(item, index) in list" :key="index"> <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-icon"><image :src="item.icon" mode=""></image></view>
<view class="button-view-content">{{ item.label }}</view> <view class="button-view-content">{{ item.label }}</view>
</view> </view>
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<script> <script>
import BillingDetails from '@/components/billing-daily/billing-daily.vue'; import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { minPopupOptions } from '@/utils/options/index/index.js'; import { minPopupOptions } from '@/utils/options/index/index.js';
import { checkLogin} from '@/utils/common.js';
export default { export default {
name: 'mid-popup', name: 'mid-popup',
components: { components: {
...@@ -39,6 +40,11 @@ export default { ...@@ -39,6 +40,11 @@ export default {
close() { close() {
this.show = false; this.show = false;
}, },
clickItem(item){
checkLogin(()=>{
this.openBill(item)
})
},
openBill(item) { openBill(item) {
this.type = item.type; this.type = item.type;
this.close(); this.close();
......
...@@ -31,7 +31,7 @@ import NavbarNormal from '@/components/navbar-normal'; ...@@ -31,7 +31,7 @@ import NavbarNormal from '@/components/navbar-normal';
import ScrollBox from './components/scroll-box.vue'; import ScrollBox from './components/scroll-box.vue';
import { tabbar } from '@/utils/settings.js'; import { tabbar } from '@/utils/settings.js';
import { baseUrl } from '@/utils/config.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 { downLoad } from '@/utils/download.js';
import { getList, getStatistics } from '@/api/bill/index.js'; import { getList, getStatistics } from '@/api/bill/index.js';
import { exportBill } from '@/api/bill/index.js'; import { exportBill } from '@/api/bill/index.js';
...@@ -131,7 +131,9 @@ export default { ...@@ -131,7 +131,9 @@ export default {
}; };
}, },
handlClickOut() { handlClickOut() {
this.visible = true; checkLogin(()=>{
this.visible=true
})
}, },
handleClickConfirm(range) { handleClickConfirm(range) {
console.log(range); console.log(range);
......
...@@ -129,7 +129,7 @@ import BillList from '@/components/bill-list'; ...@@ -129,7 +129,7 @@ import BillList from '@/components/bill-list';
import PopNormal from '@/components/pop-normal'; import PopNormal from '@/components/pop-normal';
import { tabbar } from '@/utils/settings.js'; import { tabbar } from '@/utils/settings.js';
import { getWeather, bookRecord, monthRecord } from '@/api/maintain/index.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'; import { mapGetters } from 'vuex';
export default { export default {
components: { components: {
...@@ -243,8 +243,10 @@ export default { ...@@ -243,8 +243,10 @@ export default {
onShow() { onShow() {
console.log('----------------'); console.log('----------------');
this.getWeather(); this.getWeather();
if(checkToken()){
this.monthRecord(); this.monthRecord();
this.bookRecord(); this.bookRecord();
}
}, },
onReady() {}, onReady() {},
methods: { methods: {
...@@ -325,8 +327,6 @@ export default { ...@@ -325,8 +327,6 @@ export default {
}, },
checkVip() { checkVip() {
// 测试数据 // 测试数据
return true;
if (checkVip()) { if (checkVip()) {
return true; return true;
} else { } else {
......
...@@ -53,8 +53,9 @@ export default { ...@@ -53,8 +53,9 @@ export default {
}); });
} }
}, },
handleConfirm(path){ handleConfirm(){
this.$store.dispatch("LogOut") this.$store.dispatch("LogOut")
this.$store.dispatch("Set_auto_login",false)
this.showToast("已退出登录",true) this.showToast("已退出登录",true)
setTimeout(()=>{ setTimeout(()=>{
uni.switchTab({ uni.switchTab({
......
...@@ -88,7 +88,7 @@ export default { ...@@ -88,7 +88,7 @@ export default {
if (this.platform === '4') { if (this.platform === '4') {
this.appWxLogin(); this.appWxLogin();
} else { } else {
uni.redirectTo({ uni.navigateTo({
url: './quick-login/quick-login' url: './quick-login/quick-login'
}); });
} }
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
grantType: '1' // APP微信登录 grantType: '1' // APP微信登录
}; };
} }
this.$u.route({ url: 'pages/login/binding-phone', params }); this.$u.route({ url: 'pages/login/binding-phone/binding-phone', params });
}, },
checkAgree() { checkAgree() {
if (!this.agree) { if (!this.agree) {
......
...@@ -4,8 +4,8 @@ ...@@ -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 class="quick-color-cancel" :style="{ 'padding-top': platform == '3' ? 0 : statusBarHeight + 'px' }"><u-icon name="close" @click="toIndex"></u-icon></view>
</view> </view>
<view class="quick-background"> <view class="quick-background">
<image src="/static/images/login/startup/denglulogo@3x.png" mode="" class="quick-background-logo"></image> <image src="/static/image/index/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/shiyongbanshou@3x.png" mode="" class="quick-background-slogn"></image>
</view> </view>
<view class="quick-mark"> <view class="quick-mark">
<view class="quick-center"> <view class="quick-center">
...@@ -227,7 +227,7 @@ export default { ...@@ -227,7 +227,7 @@ export default {
} else { } else {
// 临时解决方案 // 临时解决方案
that.$u.route({ that.$u.route({
url: 'pages/login/binding-phone', url: 'pages/login/binding-phone/binding-phone',
params: { params: {
encryptedData: that.params.encryptedData, encryptedData: that.params.encryptedData,
iv: that.params.iv iv: that.params.iv
......
...@@ -16,23 +16,53 @@ ...@@ -16,23 +16,53 @@
</view> </view>
</view> </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> </view>
</template> </template>
<script> <script>
import UnsubscribePopup from './components/unsubscribe-popup.vue';
import { version } from '@/utils/config.js'; import { version } from '@/utils/config.js';
import { mapGetters } from 'vuex';
export default { export default {
components: {
UnsubscribePopup
},
data() { data() {
return { return {
version version,
title: '温馨提示',
content: '您正在申请注销扳手记账账号,注销后,您的兑换码,积分,会员特权,邀请等数据将会失效,且不可恢复。确定注销吗?'
}; };
}, },
computed: {
...mapGetters(['userInfo'])
},
methods: { methods: {
handleClick(type) { handleClick(type) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/agreement/agreement?type=' + type 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> </script>
...@@ -72,4 +102,15 @@ export default { ...@@ -72,4 +102,15 @@ export default {
font-size: 26rpx; font-size: 26rpx;
padding-right: 6rpx; 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> </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 { ...@@ -6,9 +6,6 @@ import {
} from "@/utils/common.js" } from "@/utils/common.js"
import {whiteList} from "@/utils/config.js" import {whiteList} from "@/utils/config.js"
import store from "../store/index.js" import store from "../store/index.js"
import {
getCode
} from "@/utils/auth.js"
import { import {
RouterMount, RouterMount,
...@@ -50,6 +47,7 @@ const router = createRouter({ ...@@ -50,6 +47,7 @@ const router = createRouter({
} }
}else{ }else{
if(store.getters.autoLogin){
store.dispatch('Auto_login').then(()=>{ store.dispatch('Auto_login').then(()=>{
next() next()
}).catch(()=>{ }).catch(()=>{
...@@ -68,6 +66,21 @@ const router = createRouter({ ...@@ -68,6 +66,21 @@ const router = createRouter({
}) })
}else{
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('请先登录');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
}
}
} }
} }
......
...@@ -5,6 +5,7 @@ const getters = { ...@@ -5,6 +5,7 @@ const getters = {
platform:state=>state.login.platform, platform:state=>state.login.platform,
loginChannel:state=>state.login.loginChannel, loginChannel:state=>state.login.loginChannel,
authType:state=>state.login.authType, authType:state=>state.login.authType,
autoLogin:state=>state.login.autoLogin,
quotedPriceTooltip:state=>state.common.quotedPriceTooltip, quotedPriceTooltip:state=>state.common.quotedPriceTooltip,
cdKeySetting:state=>state.common.cdKeySetting, cdKeySetting:state=>state.common.cdKeySetting,
} }
......
...@@ -8,6 +8,8 @@ import { ...@@ -8,6 +8,8 @@ import {
setTimetamp, setTimetamp,
setChannel, setChannel,
getChannel, getChannel,
setAutoLogin,
getAutoLogin,
} from "@/utils/common.js" } from "@/utils/common.js"
import { import {
loginInfo loginInfo
...@@ -30,6 +32,7 @@ const state = { ...@@ -30,6 +32,7 @@ const state = {
platform: platform, // platform: platform, //
loginChannel: getChannel().loginChannel, // 登录渠道 loginChannel: getChannel().loginChannel, // 登录渠道
authType: getChannel().authType, // 授权渠道 authType: getChannel().authType, // 授权渠道
autoLogin: getAutoLogin(),
userInfo: getUserinfo(), userInfo: getUserinfo(),
scene: null, scene: null,
showPublic: false, showPublic: false,
...@@ -83,7 +86,10 @@ const mutations = { ...@@ -83,7 +86,10 @@ const mutations = {
state.loginChannel = channel.loginChannel state.loginChannel = channel.loginChannel
state.authType = channel.authType state.authType = channel.authType
}, },
SET_AUTO_LOGIN: (state, data) => {
state.autoLogin = data
setAutoLogin(data)
},
} }
const actions = { const actions = {
...@@ -92,6 +98,11 @@ const actions = { ...@@ -92,6 +98,11 @@ const actions = {
}, data) { }, data) {
commit("SET_SCENE", data) commit("SET_SCENE", data)
}, },
Set_auto_login({
commit
}, data) {
commit("SET_AUTO_LOGIN", data)
},
App_WX_login({ App_WX_login({
state, state,
commit, commit,
...@@ -171,6 +182,7 @@ const actions = { ...@@ -171,6 +182,7 @@ const actions = {
} = res.data } = res.data
setTimetamp() setTimetamp()
setToken(token) setToken(token)
dispatch("Set_auto_login",true)
await dispatch('Get_UserInfo') await dispatch('Get_UserInfo')
resolve(res) resolve(res)
} catch (e) { } catch (e) {
...@@ -209,6 +221,7 @@ const actions = { ...@@ -209,6 +221,7 @@ const actions = {
}) { }) {
removeToken() removeToken()
removeUserinfo() removeUserinfo()
commit("SET_USERINFO",{})
removeTimetamp() removeTimetamp()
}, },
// 获取图片域名 // 获取图片域名
......
...@@ -231,3 +231,4 @@ export const authorize = function(scope="scope.userInfo") { ...@@ -231,3 +231,4 @@ export const authorize = function(scope="scope.userInfo") {
}); });
}) })
} }
...@@ -74,6 +74,39 @@ export function getChannel() { ...@@ -74,6 +74,39 @@ export function getChannel() {
return uni.getStorageSync("CHANNEL") || {} 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() { export function checkPhone() {
let userinfo = getUserinfo() let userinfo = getUserinfo()
......
...@@ -94,7 +94,9 @@ function request({ ...@@ -94,7 +94,9 @@ function request({
} else if (res.data.code === 23001) { } else if (res.data.code === 23001) {
reject(res.data) reject(res.data)
} else { } else {
if(checkToken()){
showToast(res.data.msg) showToast(res.data.msg)
}
reject(res.data) 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