123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <view class="container">
- <view id="topnav" class="topnav flex-between" :style="{'height':`${topbarOffsetHeight-statusBarHeight}px`,'padding-top':`${statusBarHeight}px`}">
- <view class="nav-item flex-center" @click="back">
- <image :src="`${assetsUrl}back.png`" mode="widthFix" class="nav-img"></image>
- </view>
- <view class="nav-text font32 fw600">
- {{topbarTitle}}
- </view>
- <view class="nav-item"></view>
- </view>
- <view class="setting-box flex-between" :style="{'margin-top':`${topNavHeight+15}px`}">
- <view class="setting-item flex-between" @click="loginOut">
- <view class="setting-text font28 fw600">
- 退出登录
- </view>
- <image :src="`${assetsUrl}setting-more.png`" mode="widthFix" class="setting-icon"></image>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- topbarIcon:'back',
- topbarTitle:'设置',
- assetsUrl:this.$util.assetsUrl,
- topNavHeight:0,
- };
- },
- mounted() {
- this.computedScollviewHeight();
- },
- computed: {
- statusBarHeight() {
- return this.$store.state.statusBarHeight;
- },
- topbarOffsetHeight() {
- return this.$store.state.topbarOffsetHeight;
- },
- userInfo(){
- return this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))
- }
- },
- methods:{
- back(){
- uni.navigateBack({
- delta:1
- })
- },
- /**
- * 计算scroll高度
- */
- computedScollviewHeight() {
- let query = uni.createSelectorQuery().in(this);
- let heightLeaf =0;
- query.select('#topnav').boundingClientRect(data => {
- this.topNavHeight=data.height;
- heightLeaf += data.height;
- }).exec(() => {
- let sysInfo = uni.getSystemInfoSync();
- this.scrollHeight = sysInfo.windowHeight - heightLeaf;
- });
-
- },
- loginOut(){
- uni.showModal({
- title:'退出登录',
- content:'退出登录后将清除所有本机数据,下次登录自动登录,是否继续?',
- confirmColor:'#6C52F4',
- confirmText:'继续',
- success:(res)=>{
- if(res.confirm){
- uni.$TUIKit.logout();
- uni.$TUIKit.destroy();
- uni.setStorageSync('token','');
- uni.setStorageSync('LL_Ukn','');
- uni.setStorageSync('autoLogin','false');
- uni.reLaunch({
- url:'/pages/login/login'
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container{
- width: 100vw;
- height: 100vh;
- background-color: $bgcolor1;
- overflow: hidden;
- .topnav {
- padding: 0 10rpx;
- position: fixed;
- top: 0;
- left: 0;
- width: 100vw;
- z-index: 100;
- background-color: $bgcolor1;
- .nav-item{
- width: 40rpx;
- height: 40rpx;
- margin-left: 16rpx;
-
- .nav-img{
- width: 40rpx;
- height: 40rpx;
- }
- }
- .nav-text{
- flex: 1;
- color: $fontcolor5;
- height: 40rpx;
- text-align: center;
- }
- }
- .setting-box{
- margin: 16rpx;
- border-radius: 8rpx;
- background-color: $bgcolor3;
-
- flex-direction: column;
- .setting-item{
- width: 100%;
- height: 112rpx;
- padding: 0rpx 32rpx;
- box-sizing: border-box;
- .setting-text{
- color: $fontcolor5;
- }
- .setting-icon{
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- }
- </style>
|