wbc
2024-08-16 f4a7dcfadc671c17e9c06e0749bc216dbf757bdf
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
<template>
  <uni-base-page :footer="false">
    <view slot="page">
      <view v-if="loginInfo.hasLogin">
        <!-- 教学视频、公司内部宣传图片等 -->
        <swiper indicator-dots="true" :autoplay="true" :interval="3000">
          <swiper-item v-for="(img,key) in imgUrls" :key="key">
            <image :src="img"/>
          </swiper-item>
        </swiper>
        <!-- 通报批评、消息预警、公告、报告 -->
        <uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true"
                        text="通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,通报批评,消息预警,公告/报告,提示消息,"/>
        <!-- 用户系统菜单模块 -->
        <view class="example-body">
          <uni-grid :column="col" :showBorder="true">
            <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index">
              <navigator navigateTo class="grid-item-box" hover-class="none"
                         :url="`../${item.path}`">
                <image v-if="item.icoimg" class="imgMenu" :src="`${item.icoimg}`" ></image>
                <image v-else class="imgMenu" src="/static/img/imgMenu/APP01.png" ></image>
                <uni-notice-bar v-if="item.pagE_VIEW.length>6" :speed="30"
                                style="padding:0;margin-bottom:0;font-weight: 900;" textSize="13px"
                                background-color="#ffffff" color="#000000" :scrollable="item.pagE_VIEW.length>6"
                                :single="true" :text="item.pagE_VIEW"/>
                <text v-else class="text">{{ item.pagE_VIEW }}</text>
              </navigator>
            </uni-grid-item>
          </uni-grid>
        </view>
      </view>
      <view v-if="!loginInfo.hasLogin">
        <view class="title">
          您好 游客。
        </view>
        <view class="ul">
          <view>这是 XXMES 首页。</view>
          <view>在 “我的” 中点击 “登录” 可以 “登录您的账户”</view>
        </view>
      </view>
    </view>
  </uni-base-page>
</template>
 
<script>
export default {
  data() {
    return {
      loginInfo: this.$loginInfo,
      color: this.$defaultColor,
      userMenu: [],
      imgUrls: [
        "../../static/img/SN-GG.png",
        "../../static/img/SN-GG1.png"
      ],
      col: 4, //菜单列数
    };
  },
  methods: {
    getMenu(isShowMask) {
      if (isShowMask) uni.showLoading({
        mask: true,
        title: "加载中..."
      });
      this.$getUserMenu({
        type: 'sys',
        programId: this.loginInfo.sysNumber,
        success: (res) => {
          this.userMenu = res;
          uni.stopPullDownRefresh();
        },
        fail: (err) => {
 
        },
        complete() {
          if (isShowMask) uni.hideLoading();
        }
      });
    }
  },
  onLoad() {
    if (!this.loginInfo.hasLogin) {
      uni.showModal({
        title: '未登录',
        content: '您未登录,需要登录后才能继续',
        /**
         * 如果需要强制登录,不显示取消按钮
         */
        showCancel: !this.loginInfo.forcedLogin,
        success: (res) => {
          if (res.confirm) {
            /**
             * 如果需要强制登录,使用reLaunch方式
             */
            if (this.loginInfo.forcedLogin) {
              uni.reLaunch({
                url: 'login'
              });
            } else {
              uni.navigateTo({
                url: 'login'
              });
            }
          }
        }
      });
    } else {
      this.getMenu(true);
    }
 
  },
  onPullDownRefresh() {
    if (this.loginInfo.hasLogin)
      this.getMenu(true);
  },
}
</script>
 
<style>
.text {
  /* color: #ffffff; */
  /* font-size: 15px; */
  font-weight: 900;
}
 
.example-body {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  /* background-color: #ffffff; */
}
 
.grid-item-box {
  flex: 1;
  /* position: relative;*/
  /* #ifndef APP-NVUE */
  display: flex;
  /* #endif */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 0;
}
 
.imgMenu {
  width: 100rpx;
  height: 100rpx;
}
 
image,
swiper,
.img-view {
  width: 100%;
  height: 350rpx;
  margin-bottom: 10rpx;
}
 
.example-body {
  flex-direction: row;
  justify-content: flex-start;
}
</style>