2 Commits
wwz_wx ... gyq

Author SHA1 Message Date
gyq
c98eb7406a 优化退出登录 2025-07-23 09:19:53 +08:00
gyq
4dad65e0e0 优化退出登录 2025-06-16 17:50:50 +08:00
4 changed files with 641 additions and 642 deletions

View File

@@ -7,9 +7,8 @@
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async (data) => { success: async (data) => {
uni.cache.set('weixincode', data.code);
let res = await Api.getminiuserinfo({ let res = await Api.getminiuserinfo({
code: uni.cache.get('weixincode') //临时登录凭证 code: data.code
}) })
uni.cache.set('open_id', res.data.openid) uni.cache.set('open_id', res.data.openid)
this.$isResolve() this.$isResolve()

View File

@@ -5,9 +5,9 @@ const proxyApi = "/api/"
// #ifdef H5 // #ifdef H5
// const baseUrl = debug ? proxyApi : "https://invoice.sxczgkj.cn/api" // const baseUrl = debug ? proxyApi : "https://invoice.sxczgkj.cn/api"
// const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式 const baseUrl = 'https://invoice.sxczgkj.cn/api/' //正式
// const baseUrl = 'http://192.168.1.6:8888/api/'//本地 // const baseUrl = 'http://192.168.1.6:8888/api/'//本地
const baseUrl = 'https://test.invoice.sxczgkj.cn/api/'//测试 // const baseUrl = 'https://test.invoice.sxczgkj.cn/api/'//测试
// import VConsole from "./vConsole.js" // import VConsole from "./vConsole.js"
if (debug) { if (debug) {
// new VConsole() // new VConsole()

View File

@@ -1,44 +1,31 @@
<template> <template>
<view class="content"> <view class="content">
<!-- 占位符导航栏 --> <!-- 占位符导航栏 -->
<navseat :opacity='false' :title='"首页"' :titleshow='true' :iconshow='false' :heightshow='true' <navseat :opacity="false" :title="'首页'" :titleshow="true" :iconshow="false" :heightshow="true" :namecolor="'#fff'" iconcolor="#fff"></navseat>
:namecolor='"#fff"' iconcolor='#fff'></navseat>
<view class="topswiper" v-if="restype == 2"> <view class="topswiper" v-if="restype == 2">
<u-swiper :list="swiperlist" height="166"></u-swiper> <u-swiper :list="swiperlist" height="166"></u-swiper>
<view class="onetopswiper"> <view class="onetopswiper">发票服务</view>
发票服务
</view>
<view class="towtopswiper flex-between" @click="wodekaifapiao"> <view class="towtopswiper flex-between" @click="wodekaifapiao">
<view class="flex-colum-start" style="color: #2b378a;"> <view class="flex-colum-start" style="color: #2b378a">我的发票</view>
我的发票 <view class="towtopswipertow"></view>
</view>
<view class="towtopswipertow">
</view>
</view> </view>
<view <view style="margin-top: 80rpx; text-align: center; color: #3088fd; position: fixed; bottom: 40rpx; left: 50%; transform: translate(-50%, -50%)" @click="qushangjia()">
style="margin-top:80rpx;text-align: center;color:#3088fd;position: fixed; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);"
@click="qushangjia()">
我是商家 我是商家
</view> </view>
</view> </view>
<view class="Box flex-between" v-if="restype == 1 && improveinformation"> <view class="Box flex-between" v-if="restype == 1 && improveinformation">
<view class="content flex-colum" @click="merchantindex" v-if="store_status == 2"> <view class="content flex-colum" @click="merchantindex" v-if="store_status == 2">
<image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"> <image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"></image>
</image>
<text>固定开票</text> <text>固定开票</text>
</view> </view>
<view class="content flex-colum" @click="indexInvoicing" v-if="store_status == 1"> <view class="content flex-colum" @click="indexInvoicing" v-if="store_status == 1">
<image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"> <image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item3.png" mode="aspectFill"></image>
</image>
<text>极速开票</text> <text>极速开票</text>
</view> </view>
<view class="content flex-colum" v-for="(item,index) in list" @click="clickcontent(item)" :key="index" <view class="content flex-colum" v-for="(item, index) in list" @click="clickcontent(item)" :key="index" v-if="item.show">
v-if="item.show"> <image :src="item.imge" mode="aspectFill"></image>
<image :src="item.imge" mode="aspectFill"> <text>{{ item.name }}</text>
</image>
<text>{{item.name}}</text>
</view> </view>
<!-- <view class="content flex-colum" @click="jumpToMiniProgram" v-if="improveinformation"> <!-- <view class="content flex-colum" @click="jumpToMiniProgram" v-if="improveinformation">
<image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item8.png" mode="aspectFill"></image> <image src="https://czg-invoicing.oss-cn-beijing.aliyuncs.com/static/item8.png" mode="aspectFill"></image>
@@ -53,13 +40,24 @@
<button class="btn">打开小程序</button> <button class="btn">打开小程序</button>
</script> </script>
</wx-open-launch-weapp> --> </wx-open-launch-weapp> -->
<view class="flex-colum" <view
style=" width: 100%;margin-top:80rpx;text-align: center;position: fixed; font-size:24rpx; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);padding: 0 40rpx;"> class="flex-colum"
<text>{{improveinformationform.store.title}}</text> style="
<text v-if="improveinformationform.is_tax == 1" width: 100%;
style="margin-top:20rpx;text-align: center;color:#3088fd;margin-left: 10rpx;" margin-top: 80rpx;
@click="clickswitch()">切换商户</text> text-align: center;
position: fixed;
font-size: 24rpx;
bottom: 40rpx;
left: 50%;
transform: translate(-50%, -50%);
padding: 0 40rpx;
"
>
<text>{{ improveinformationform.store.title }}</text>
<text v-if="improveinformationform.is_tax == 1" style="margin-top: 20rpx; text-align: center; color: #3088fd; margin-left: 10rpx" @click="clickswitch()">
切换商户
</text>
</view> </view>
</view> </view>
<!-- <view class="setClipboardDataclass" @click="setClipboardData" v-if="infos.deviceType != 'pc'"> <!-- <view class="setClipboardDataclass" @click="setClipboardData" v-if="infos.deviceType != 'pc'">
@@ -69,406 +67,401 @@
src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182"> src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182">
</pdf> --> </pdf> -->
<!-- <iframe width="100%" height="100%" src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182" frameborder="0"></iframe> --> <!-- <iframe width="100%" height="100%" src="https://dppt.shaanxi.chinatax.gov.cn:8443/kpfw/fpjfzz/v1/exportDzfpwjEwm?Wjgs=PDF&Jym=124C&Fphm=24612000000037614300&Kprq=20240430152603&Czsj=1714461964182" frameborder="0"></iframe> -->
</view> </view>
</template> </template>
<script> <script>
import wx from 'weixin-js-sdk'; import wx from 'weixin-js-sdk';
import navseat from '@/components/navseat.vue' import navseat from '@/components/navseat.vue';
export default { export default {
components: { components: {
navseat navseat
}, },
data() { data() {
return { return {
restype: 1, restype: 1,
swiperlist: [ swiperlist: ['https://shuzu-download.oss-cn-shanghai.aliyuncs.com/advertise/2024-05-08-10-52-th-663ae8fc73220.png'],
'https://shuzu-download.oss-cn-shanghai.aliyuncs.com/advertise/2024-05-08-10-52-th-663ae8fc73220.png' improveinformation: false,
], improveinformationlist: {},
improveinformation: false, onLoaduserId: '',
improveinformationlist: {}, infos: uni.getSystemInfoSync(),
onLoaduserId: '', store_status: uni.cache.get('store_status'),
infos: uni.getSystemInfoSync(), list: [],
store_status: uni.cache.get('store_status'), is_k_list: '', // 开票员列表 1 显示 2不显示
list: [], improveinformationform: {
is_k_list: '', // 开票员列表 1 显示 2不显示 is_tax: '',
improveinformationform: { store: {
is_tax: '', title: ''
store: {
title: ''
}
} }
};
},
async onLoad(e) {
await this.$onLaunched;
// // #ifdef MP-WEIXIN
// // 判断商家还是个体
// let restype = await this.api.judgeuseridentity({
// open_id: uni.cache.get('open_id') //临时登录凭证
// })
// console.log(restype.data)
// this.restype = restype.data.type
// if (this.restype == 1 && !uni.getStorageSync('logintoken')) {
// uni.reLaunch({
// url: '/pages/login/login'
// })
// return false;
// }
// // #endif
try {
if (e.restype) {
this.restype = e.restype
}
} catch (e) {
//TODO handle the exception
} }
// try { };
// if (e.userId) { },
// uni.cache.set('Type', e.type); async onLoad(e) {
// uni.cache.set('userId', e.userId); await this.$onLaunched;
// // 传参进来肯定是极速开票固然store_status=1 // // #ifdef MP-WEIXIN
// uni.cache.set('store_status', 1); // // 判断商家还是个体
// } // let restype = await this.api.judgeuseridentity({
// } catch (e) { // open_id: uni.cache.get('open_id') //临时登录凭证
// //TODO handle the exception // })
// } // console.log(restype.data)
if (this.restype == 1) { // this.restype = restype.data.type
if (uni.cache.get('userId')) { // if (this.restype == 1 && !uni.getStorageSync('logintoken')) {
// 总? // uni.reLaunch({
let token = await this.api.h5encryption({ // url: '/pages/login/login'
store_id: uni.cache.get('userId') // })
}) // return false;
if (token.code == 1) { // }
uni.cache.set('token', token.data.token); // // #endif
} try {
let res = await this.api.storestorestatus({ if (e.restype) {
store_id: uni.cache.get('userId') this.restype = e.restype;
}) }
// try { } catch (e) {
// this.is_k_list = res.data.is_k_list //TODO handle the exception
// } catch (e) { }
// //TODO handle the exception // try {
// } // if (e.userId) {
if (res.code == 1 && uni.cache.get('store_status') == 1) { // uni.cache.set('Type', e.type);
this.improveinformationform = res.data // uni.cache.set('userId', e.userId);
uni.cache.set('form', this.improveinformationform); // // 传参进来肯定是极速开票固然store_status=1
if (res.data.sz_status == 0) { // uni.cache.set('store_status', 1);
uni.reLaunch({ // }
url: '/pages/index/information' // } catch (e) {
}); // //TODO handle the exception
} else { // }
this.improveinformation = true if (this.restype == 1) {
} if (uni.cache.get('userId')) {
// 总?
let token = await this.api.h5encryption({
store_id: uni.cache.get('userId')
});
if (token.code == 1) {
uni.cache.set('token', token.data.token);
}
let res = await this.api.storestorestatus({
store_id: uni.cache.get('userId')
});
// try {
// this.is_k_list = res.data.is_k_list
// } catch (e) {
// //TODO handle the exception
// }
if (res.code == 1 && uni.cache.get('store_status') == 1) {
this.improveinformationform = res.data;
uni.cache.set('form', this.improveinformationform);
if (res.data.sz_status == 0) {
uni.reLaunch({
url: '/pages/index/information'
});
} else { } else {
// 这是固定开票的判断 this.improveinformation = true;
if (res.data.status == 4) { //如果极速开票和固定开票共存的情况下 直接跳转到极速开票的上传信息
this.improveinformation = true
return false
} else {
if (res.data.status == -1 || res.data.status == 2 || res.data.status == 0) {
uni.pro.navigateTo('merchant/information', res.data.store);
} else {
uni.pro.navigateTo('merchant/index');
}
}
} }
} else { } else {
uni.reLaunch({ // 这是固定开票的判断
url: '/pages/login/login' if (res.data.status == 4) {
}); //如果极速开票和固定开票共存的情况下 直接跳转到极速开票的上传信息
this.improveinformation = true;
return false;
} else {
if (res.data.status == -1 || res.data.status == 2 || res.data.status == 0) {
uni.pro.navigateTo('merchant/information', res.data.store);
} else {
uni.pro.navigateTo('merchant/index');
}
}
} }
} else { } else {
this.restype == 2 uni.reLaunch({
} url: '/pages/login/login'
},
// 监听跳转
handleLaunch() {
console.log('跳转');
},
// 监听错误
handleError() {
console.log('失败');
},
async onShow() {
try {
let res = await this.api.getrulelist()
this.list = res.data
} catch (e) {
//TODO handle the exception
}
},
methods: {
async jumpToMiniProgram() {
let res = await this.api.userttwechat({
url: location.href.split('#')[0]
})
console.log(res)
// plus.share.getServices(function (res) {
// var sweixin = null;
// for (var i = 0; i < res.length; i++) {
// var t = res[i];
// if (t.id == 'weixin') {
// sweixin = t;
// }
// }
// if (sweixin) {
// sweixin.launchMiniProgram({
// id:'gh_fa9286427a5b', //这里写你的小程序原始id以gh开头
// type: 0, // //小程序版本 0-正式版; 1-测试版; 2-体验版
// path: 'pages/index/index' //这里是指定页的路径,如需传参直接字符串拼接(首页可以省略)
// });
// }
// });
// wx.config({
// "debug": true,
// "beta": false,
// "jsApiList": ['wx-open-launch-weapp'],
// openTagList: ['wx-open-launch-weapp'], // 跳转小程序时必填
// "appId": res.data.wechat_mini.appId,
// "nonceStr": res.data.wechat_mini.nonceStr,
// "timestamp": res.data.wechat_mini.timestamp,
// "url": res.data.wechat_mini.url,
// "signature": res.data.wechat_mini.signature,
// });
wx.config(res.data.wechat_mini);
// res.data.wechat_mini
// 在wx.ready内调用
wx.ready(res => {
console.log(res);
this.$nextTick(() => {
let btn = document.getElementById('launch-btn');
btn.addEventListener('launch', e => {
console.log('success');
});
btn.addEventListener('error', e => {
alert('小程序打开失败');
console.log('fail', e.detail);
});
});
}); });
wx.error(function(res) {
console.log('err', res)
});
// // #ifdef H5
// // 在H5环境中调用此函数来跳转到小程序
// wx.navigateToMiniProgram({
// appId: 'wxd88fffa983758a30', // 小程序的appid
// path: 'pages/index/index', // 打开的页面路径,若为空则打开首页
// extraData: {}, // 需要传递给小程序的数据
// success(res) {
// // 打开成功的回调
// console.log('跳转成功');
// },
// fail(err) {
// // 打开失败的回调
// console.error('跳转失败', err);
// }
// });
// // jumpToMiniProgram('小程序的appid', '小程序页面路径');
// // #endif
},
async quit() {
uni.showModal({
title: '提示',
content: '确定退出开票系统吗?',
success: async (res) => {
if (res.confirm) {
await this.api.userlogout()
uni.removeStorageSync('logintoken');
uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
setClipboardData() {
uni.setClipboardData({
data: 'https://h5-invoice.sxczgkj.cn/?userId=' + uni.cache.get('userId'),
success: function() {}
});
},
clickswitch() {
uni.navigateTo({
url: '/pages/login/switch'
})
},
// 跳转
async clickcontent(item) {
switch (item.type) {
case 1:
uni.pro.navigateTo(item.url);
break;
case 2:
uni.navigateTo({
url: '/pages/webview/webview?tape=' + 1
})
break;
case 3:
uni.showModal({
title: '提示',
content: '确定退出开票系统吗?',
success: async (res) => {
if (res.confirm) {
await this.api.userlogout()
uni.removeStorageSync('logintoken');
uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
break;
}
},
qushangjia() {
uni.showModal({
title: '提示',
content: '确定去商家开票系统吗?',
success: (res) => {
if (res.confirm) {
uni.removeStorageSync('logintoken');
uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
},
auditbilling() {
uni.pro.navigateTo('index/auditbilling');
},
billingcode() {
uni.pro.navigateTo('index/billingcode');
},
drawer() {
uni.pro.navigateTo('index/drawerlist');
},
merchant() {
uni.pro.navigateTo('index/merchant');
},
information() {
uni.pro.navigateTo('index/information', this.improveinformationform.store);
},
notification() {
uni.pro.navigateTo('index/notification');
},
indexInvoicing() {
uni.pro.navigateTo('index/Invoicing');
},
merchantindex() {
uni.pro.navigateTo('merchant/index');
},
wodekaifapiao() {
uni.pro.navigateTo('hindex/involist');
},
async webview() {
// uni.pro.navigateTo('electric/index');
let res = await this.api.szzpyhurl({
store_id: uni.getStorageSync('userId')
})
if (res) {
uni.pro.navigateTo('webview/webview', {
url: res.data.url,
tape: 1
});
}
},
indexorder() {
uni.pro.navigateTo('index/order');
} }
} else {
this.restype == 2;
} }
}; },
// 监听跳转
handleLaunch() {
console.log('跳转');
},
// 监听错误
handleError() {
console.log('失败');
},
async onShow() {
try {
let res = await this.api.getrulelist();
this.list = res.data;
} catch (e) {
//TODO handle the exception
}
},
methods: {
async jumpToMiniProgram() {
let res = await this.api.userttwechat({
url: location.href.split('#')[0]
});
console.log(res);
// plus.share.getServices(function (res) {
// var sweixin = null;
// for (var i = 0; i < res.length; i++) {
// var t = res[i];
// if (t.id == 'weixin') {
// sweixin = t;
// }
// }
// if (sweixin) {
// sweixin.launchMiniProgram({
// id:'gh_fa9286427a5b', //这里写你的小程序原始id以gh开头
// type: 0, // //小程序版本 0-正式版; 1-测试版; 2-体验版
// path: 'pages/index/index' //这里是指定页的路径,如需传参直接字符串拼接(首页可以省略)
// });
// }
// });
// wx.config({
// "debug": true,
// "beta": false,
// "jsApiList": ['wx-open-launch-weapp'],
// openTagList: ['wx-open-launch-weapp'], // 跳转小程序时必填
// "appId": res.data.wechat_mini.appId,
// "nonceStr": res.data.wechat_mini.nonceStr,
// "timestamp": res.data.wechat_mini.timestamp,
// "url": res.data.wechat_mini.url,
// "signature": res.data.wechat_mini.signature,
// });
wx.config(res.data.wechat_mini);
// res.data.wechat_mini
// 在wx.ready内调用
wx.ready((res) => {
console.log(res);
this.$nextTick(() => {
let btn = document.getElementById('launch-btn');
btn.addEventListener('launch', (e) => {
console.log('success');
});
btn.addEventListener('error', (e) => {
alert('小程序打开失败');
console.log('fail', e.detail);
});
});
});
wx.error(function (res) {
console.log('err', res);
});
// // #ifdef H5
// // 在H5环境中调用此函数来跳转到小程序
// wx.navigateToMiniProgram({
// appId: 'wxd88fffa983758a30', // 小程序的appid
// path: 'pages/index/index', // 打开的页面路径,若为空则打开首页
// extraData: {}, // 需要传递给小程序的数据
// success(res) {
// // 打开成功的回调
// console.log('跳转成功');
// },
// fail(err) {
// // 打开失败的回调
// console.error('跳转失败', err);
// }
// });
// // jumpToMiniProgram('小程序的appid', '小程序页面路径');
// // #endif
},
async quit() {
uni.showModal({
title: '提示',
content: '确定退出开票系统吗?',
success: async (res) => {
if (res.confirm) {
await this.api.userlogout();
uni.clearStorageSync();
// uni.removeStorageSync('logintoken');
// uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
setClipboardData() {
uni.setClipboardData({
data: 'https://h5-invoice.sxczgkj.cn/?userId=' + uni.cache.get('userId'),
success: function () {}
});
},
clickswitch() {
uni.navigateTo({
url: '/pages/login/switch'
});
},
// 跳转
async clickcontent(item) {
switch (item.type) {
case 1:
uni.pro.navigateTo(item.url);
break;
case 2:
uni.navigateTo({
url: '/pages/webview/webview?tape=' + 1
});
break;
case 3:
uni.showModal({
title: '提示',
content: '确定退出开票系统吗?',
success: async (res) => {
if (res.confirm) {
await this.api.userlogout();
uni.clearStorageSync();
// uni.removeStorageSync('logintoken');
// uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
break;
}
},
qushangjia() {
uni.showModal({
title: '提示',
content: '确定去商家开票系统吗?',
success: (res) => {
if (res.confirm) {
uni.removeStorageSync('logintoken');
uni.removeStorageSync('token');
uni.reLaunch({
url: '/pages/login/login'
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
auditbilling() {
uni.pro.navigateTo('index/auditbilling');
},
billingcode() {
uni.pro.navigateTo('index/billingcode');
},
drawer() {
uni.pro.navigateTo('index/drawerlist');
},
merchant() {
uni.pro.navigateTo('index/merchant');
},
information() {
uni.pro.navigateTo('index/information', this.improveinformationform.store);
},
notification() {
uni.pro.navigateTo('index/notification');
},
indexInvoicing() {
uni.pro.navigateTo('index/Invoicing');
},
merchantindex() {
uni.pro.navigateTo('merchant/index');
},
wodekaifapiao() {
uni.pro.navigateTo('hindex/involist');
},
async webview() {
// uni.pro.navigateTo('electric/index');
let res = await this.api.szzpyhurl({
store_id: uni.getStorageSync('userId')
});
if (res) {
uni.pro.navigateTo('webview/webview', {
url: res.data.url,
tape: 1
});
}
},
indexorder() {
uni.pro.navigateTo('index/order');
}
}
};
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background: #F9F9F9; background: #f9f9f9;
}
.content {
.setClipboardDataclass {
width: 100%;
text-align: center;
margin-top: 90rpx;
color: #2f87fd;
font-weight: bold;
font-size: 28rpx;
} }
.content { .topswiper {
.setClipboardDataclass { width: 100%;
width: 100%; padding: 32rpx 32rpx 0 32rpx;
text-align: center;
margin-top: 90rpx; .onetopswiper {
color: #2f87fd;
font-weight: bold; font-weight: bold;
font-size: 28rpx; margin-top: 32rpx;
} }
.topswiper { .towtopswiper {
margin-top: 32rpx;
width: 100%; width: 100%;
padding: 32rpx 32rpx 0 32rpx; padding: 24rpx 32rpx;
border-radius: 16rpx;
background: #d8eafe;
.onetopswiper { .towtopswipertow {
font-weight: bold; padding: 24rpx;
margin-top: 32rpx; color: #fff;
background: #2a3aa1;
font-size: 40rpx;
width: 90rpx;
height: 90rpx;
text-align: center;
line-height: 45rpx;
border-radius: 45rpx;
} }
.towtopswiper {
margin-top: 32rpx;
width: 100%;
padding: 24rpx 32rpx;
border-radius: 16rpx;
background: #d8eafe;
.towtopswipertow {
padding: 24rpx;
color: #fff;
background: #2a3aa1;
font-size: 40rpx;
width: 90rpx;
height: 90rpx;
text-align: center;
line-height: 45rpx;
border-radius: 45rpx;
}
}
}
.Box {
padding: 0rpx 28rpx;
.content {
margin-top: 32rpx;
width: 30%;
height: 218rpx;
background: #FFFFFF;
image {
width: 60rpx;
height: 60rpx;
}
text {
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
}
.Box::after {
content: '';
width: 30%;
display: inline-block;
} }
} }
</style>
.Box {
padding: 0rpx 28rpx;
.content {
margin-top: 32rpx;
width: 30%;
height: 218rpx;
background: #ffffff;
image {
width: 60rpx;
height: 60rpx;
}
text {
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
}
.Box::after {
content: '';
width: 30%;
display: inline-block;
}
}
</style>

View File

@@ -1,18 +1,14 @@
<template> <template>
<view class="content"> <view class="content">
<view class="contentnav"> <view class="contentnav">欢迎您登录开票系统</view>
欢迎您登录开票系统
</view>
<view class="top_box"> <view class="top_box">
<view class="top_box_one"> <view class="top_box_one">
<text class="top_box_one_text">手机号码</text> <text class="top_box_one_text">手机号码</text>
<input type="number" v-model="form.account" :adjust-position="false" placeholder="请输入手机号码" maxlength="-1" <input type="number" v-model="form.account" :adjust-position="false" placeholder="请输入手机号码" maxlength="-1" data-key="mobile" />
data-key="mobile" />
</view> </view>
<view class="top_box_one"> <view class="top_box_one">
<text class="top_box_one_text">密码</text> <text class="top_box_one_text">密码</text>
<input type="mobile" v-model="form.password" :adjust-position="false" placeholder="请输入密码" <input type="mobile" v-model="form.password" :adjust-position="false" placeholder="请输入密码" maxlength="16" :password="!showPassword" />
maxlength="16" :password="!showPassword" />
<view class="repeat" @click="display"> <view class="repeat" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon> <u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon> <u-icon v-else name="eye-off"></u-icon>
@@ -40,254 +36,265 @@
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view> <view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view>--> </view>-->
<view class="agreement" @click="clickpassword"> <view class="agreement" @click="clickpassword">忘记密码</view>
忘记密码
</view>
</view> </view>
<view <view style="margin-top: 80rpx; text-align: center; color: #3088fd; position: fixed; bottom: 40rpx; left: 50%; transform: translate(-50%, -50%)" @click="quyonghu">
style="margin-top:80rpx;text-align: center;color:#3088fd;position: fixed; bottom:40rpx;left: 50%;transform: translate(-50%,-50%);"
@click="quyonghu">
我是用户 我是用户
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { import Api from '@/common/js/api.js';
data() { export default {
return { data() {
showPassword: false, //是否显示密码 return {
form: { showPassword: false, //是否显示密码
account: '', form: {
password: '', account: '',
captcha: '' password: '',
}, captcha: ''
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '发送验证码',
}
},
async onLoad(e) {
await this.$onLaunched;
if (e.userId) {
uni.showLoading({
title: '加载中',
mask: true
})
// this.onLoaduserId = e.userId
uni.cache.set('Type', e.type);
uni.cache.set('userId', e.userId);
let token = await this.api.h5encryption({
store_id: uni.cache.get('userId')
})
if (token.code == 1) {
uni.cache.set('token', token.data.token);
uni.cache.set('store_status', 1);
uni.navigateTo({
url: '/pages/index/index?restype=' + 1
})
}
}
},
methods: {
async CodeRegister() {
//发起验证码
if (this.form.account == null || this.form.account == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.api.smssend({ // post 手机验证码
mobile: this.form.account,
event: 'mobilelogin'
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
}, },
display() { // 注册定时器 初始值
// 切换图片显示隐藏 second: 60,
this.showPassword = !this.showPassword; showText: true,
}, Recapture: '发送验证码'
quyonghu() { };
uni.reLaunch({ },
url: '/pages/index/index?restype=' + 2 async onLoad(e) {
}); uni.login({
// uni.navigateTo({ provider: 'weixin',
// url: '/pages/index/index?restype=' + 2 success: async (data) => {
// }) let openid = uni.cache.get('open_id');
},
clickpassword() { if (!openid) {
uni.navigateTo({ let res = await Api.getminiuserinfo({
url:'/pages/login/password' code: data.code
})
},
async userlogin() {
if (this.form.account == null || this.form.account == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
// if (this.form.captcha == null || this.form.captcha == '') {
// uni.showToast({
// title: '请输入验证码',
// icon: 'none'
// });
// return false;
// }
let res = await this.api.userlogin({
account: this.form.account,
password: this.form.password,
open_id: uni.cache.get('open_id'),
})
uni.cache.set('userId', res.data.userinfo.store_id);
uni.cache.set('logintoken', res.data.userinfo.token);
uni.cache.set('store_status', res.data.store_status);
uni.cache.set('userinfo', res.data.userinfo);
uni.cache.set('Type', res.data.type);
uni.cache.set('set_pwd', res.data.set_pwd);
if (res.data.set_pwd == 1) {
uni.navigateTo({
url: '/pages/login/repairpassword'
})
} else {
uni.reLaunch({
url: '/pages/index/index?restype=' + 1
}); });
uni.cache.set('open_id', res.data.openid);
} }
await this.$onLaunched;
if (e.userId) {
uni.showLoading({
title: '加载中',
mask: true
});
// this.onLoaduserId = e.userId
uni.cache.set('Type', e.type);
uni.cache.set('userId', e.userId);
let token = await this.api.h5encryption({
store_id: uni.cache.get('userId')
});
if (token.code == 1) {
uni.cache.set('token', token.data.token);
uni.cache.set('store_status', 1);
uni.navigateTo({
url: '/pages/index/index?restype=' + 1
});
}
}
}
});
},
methods: {
async CodeRegister() {
//发起验证码
if (this.form.account == null || this.form.account == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.api.smssend({
// post 手机验证码
mobile: this.form.account,
event: 'mobilelogin'
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
display() {
// 切换图片显示隐藏
this.showPassword = !this.showPassword;
},
quyonghu() {
uni.reLaunch({
url: '/pages/index/index?restype=' + 2
});
// uni.navigateTo({
// url: '/pages/index/index?restype=' + 2
// })
},
clickpassword() {
uni.navigateTo({
url: '/pages/login/password'
});
},
async userlogin() {
if (this.form.account == null || this.form.account == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
// if (this.form.captcha == null || this.form.captcha == '') {
// uni.showToast({
// title: '请输入验证码',
// icon: 'none'
// });
// return false;
// }
let res = await this.api.userlogin({
account: this.form.account,
password: this.form.password,
open_id: uni.cache.get('open_id')
});
uni.cache.set('userId', res.data.userinfo.store_id);
uni.cache.set('logintoken', res.data.userinfo.token);
uni.cache.set('store_status', res.data.store_status);
uni.cache.set('userinfo', res.data.userinfo);
uni.cache.set('Type', res.data.type);
uni.cache.set('set_pwd', res.data.set_pwd);
if (res.data.set_pwd == 1) {
uni.navigateTo({
url: '/pages/login/repairpassword'
});
} else {
uni.reLaunch({
url: '/pages/index/index?restype=' + 1
});
} }
} }
} }
};
</script> </script>
<style lang="scss"> <style lang="scss">
.content { .content {
.contentnav { .contentnav {
padding-left: 48rpx; padding-left: 48rpx;
padding-top: 200rpx; padding-top: 200rpx;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500; font-weight: 500;
font-size: 56rpx; font-size: 56rpx;
color: #333333; color: #333333;
} }
.top_box { .top_box {
margin-top: 88rpx; margin-top: 88rpx;
z-index: 9; z-index: 9;
padding: 0 64rpx; padding: 0 64rpx;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
position: relative;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
.top_box_one {
position: relative; position: relative;
height: 100%; width: 100%;
display: flex; margin-top: 64rpx;
flex-direction: column; border-bottom: 6rpx solid #e5e5e5;
align-items: center;
background: #ffffff;
border-radius: 40rpx 40rpx 0px 0px;
.top_box_one { .top_box_one_text {
position: relative;
width: 100%;
margin-top: 64rpx;
border-bottom: 6rpx solid #e5e5e5;
.top_box_one_text {
font-size: 36rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.repeat {
position: absolute;
z-index: 99;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
.repeats {
z-index: 99;
position: absolute;
bottom: 26rpx;
right: 0;
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
input {
height: auto;
padding: 18rpx 0 20rpx 0;
}
}
.top_box_tow {
width: 100%;
text {
margin-top: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #666666;
}
}
.toLogin {
width: 570rpx;
margin-top: 112rpx;
padding: 10rpx 0;
text-align: center;
background: #288efb;
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 36rpx; font-size: 36rpx;
font-weight: 400;
color: #ffffff;
}
.agreement {
text-align: right;
width: 570rpx;
margin-top: 14rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN; font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500; font-weight: 500;
color: #7c8e97; color: #333333;
}
.agreement-Item { .repeat {
color: #4ca1fc; position: absolute;
} z-index: 99;
bottom: 26rpx;
right: 0;
width: 25rpx;
height: 17rpx;
}
.repeats {
z-index: 99;
position: absolute;
bottom: 26rpx;
right: 0;
font-size: 24rpx;
font-weight: 400;
color: #ffffff;
border-radius: 12rpx;
}
input {
height: auto;
padding: 18rpx 0 20rpx 0;
}
}
.top_box_tow {
width: 100%;
text {
margin-top: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #666666;
}
}
.toLogin {
width: 570rpx;
margin-top: 112rpx;
padding: 10rpx 0;
text-align: center;
background: #288efb;
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 36rpx;
font-weight: 400;
color: #ffffff;
}
.agreement {
text-align: right;
width: 570rpx;
margin-top: 14rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
} }
} }
} }
</style> }
</style>