安全教育平台微信小程序(hbuilder打开后运行到微信开发者程序)
祖安之光
2025-11-05 f4ed2c4a1412f7256614e04e18683ca15a89bb25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<template>
    <view>
        <!-- 自定义导航栏 -->
        <view class="custom-navbar">
            <view class="navbar-content">
                <text class="navbar-title">主页面</text>
            </view>
        </view>
        <view class="page-content" :style="{ paddingTop: navbarHeight + 'px' }">
            <view class="navBtn" @click="toReview()">
              <u-image radius="16px" width="140rpx" height="140rpx" :show-loading="true" :src="reviewIcon" mode="aspectFill">
              </u-image>
              <view class="cardTit">
                项目审批
              </view>
            </view>
            <view class="navBtn" @click="toEducate()">
              <u-image radius="16px" width="140rpx" height="140rpx" :show-loading="true" :src="educateIcon" mode="aspectFill">
              </u-image>
              <view class="cardTit">
                安全教育
              </view>
            </view>
            <view class="loginBtn">
              <u-button @click="loginOut" type="primary" text="退出登录" shape="circle"></u-button>
            </view>
        </view>
 
    </view>
</template>
 
<script>
    import VUE_APP_BASE_URL from 'common/constant.js'
    import {loginOut} from "../../api"
    import reviewIcon from '../../static/review.png'
    import educateIcon from '../../static/educate.png'
    export default {
        components: {},
        data() {
            return {
                navbarHeight: 0,
                reviewIcon: reviewIcon,
                educateIcon: educateIcon
            }
 
        },
        onLoad() {
            this.getNavbarHeight()
        },
        onShow() {
 
        },
        created() {
 
        },
        mounted() {
 
        },
        methods: {
            getNavbarHeight() {
                const systemInfo = uni.getSystemInfoSync()
                const statusBarHeight = systemInfo.statusBarHeight
                const navbarHeight = 44
                this.navbarHeight = statusBarHeight + navbarHeight
            },
            toReview() {
                uni.navigateTo({
                    url: '/pages/review/index'
                })
            },
 
            toEducate() {
                uni.switchTab({
                    url: '/pages/tabBar/firstPage/firstPage'
                })
            },
            loginOut(){
              uni.showModal({
                title: '提示',
                content: '是否确认退出该账号?',
                success: async function (res) {
                  if (res.confirm) {
                    loginOut().then(res=>{
                      if(res.code == 200){
                        uni.showToast({
                          title: '账户已退出',
                          duration: 800
                        })
                        setTimeout(()=>{
                          uni.clearStorageSync();
                          uni.clearStorage();
                          uni.navigateTo({
                            url: '/pages/index/index'
                          })
                        },800)
                      }
                    })
                  } else if (res.cancel) {
                    console.log('用户点击取消');
                  }
                }
              })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .custom-navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: #ffffff;
 
        .navbar-content {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 44px;
            padding-top: var(--status-bar-height);
        }
 
        .navbar-title {
            font-size: 16px;
            font-weight: bold;
            color: #333;
        }
        
    }
    .page-content {
      min-height: 100vh;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 0 15px;
      .navBtn{
          width: 100%;
          padding: 15px 30px;
          box-sizing: border-box;
          margin-top: 15px;
          background: #fff;
          border-radius: 20rpx;
          display: flex;
          align-items: center;
          box-shadow: 0 10rpx 20rpx rgba(0,0,0,.05);
          transition: box-shadow .15s ease !important;
          
          &:active{
            box-shadow: none;
          }
          
          .cardTit{
            font-size: 36rpx;
            font-weight: bold;
            margin-left: 30px;
          }
          
      }
      .loginBtn{
        width: 100%;
        position: fixed;
        bottom: 90px;
        
        ::v-deep .u-button{
            width: 80%;
        }
      }
    }
</style>