kyy
3 天以前 ab826d12b52265bc4f25044d43a042df2104f972
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<template>
  <uni-base-page :footer="false">
    <view slot="page">
      <view v-if="loginInfo.hasLogin">
        <!-- 通报批评、消息预警、公告、报告 -->
        <uni-notice-bar :show-icon="true" :scrollable="true" :speed="30" :single="true"
                        :text="msg" class="notice-bar"></uni-notice-bar>
        <!-- 用户系统菜单模块 -->
        <view class="example-body">
          <view class="menu-header">
            <text class="menu-title">系统功能</text>
            <view class="decorative-line"></view>
          </view>
          <uni-grid :column="col" :showBorder="false" class="menu-grid">
            <uni-grid-item v-for="(item, index) in userMenu" :index="index" :key="index" class="grid-item">
              <navigator navigateTo class="grid-item-box" hover-class="none"
                         :url="`../${item.path}`">
                <view class="icon-container">
                  <image v-if="item.icoimg" class="imgMenu" :src="`${item.icoimg}`"></image>
                  <image v-else class="imgMenu default-icon" src="/static/img/imgMenu/WARBAAHtml.png"></image>
                  <view class="icon-badge" v-if="item.badge">{{ item.badge }}</view>
                </view>
                <text class="text" style="text-align: center;padding:5px 0px 5px 0px">{{ item.pagE_VIEW }}</text>
              </navigator>
            </uni-grid-item>
          </uni-grid>
        </view>
      </view>
      <view v-if="!loginInfo.hasLogin">
        <view class="guest-container">
          <view class="title">
            您好,游客。
          </view>
          <view class="ul">
            <view>这是 广深MES 首页。</view>
            <view>在 “我的” 中点击 “登录” 可以 “登录您的账户”</view>
          </view>
          <view class="login-prompt">
            <text class="login-note">登录后可访问全部功能</text>
          </view>
        </view>
      </view>
    </view>
  </uni-base-page>
</template>
 
<script>
export default {
  data() {
    return {
      loginInfo: this.$loginInfo,
      // 优化后的主题颜色方案,增加层次感
      primaryColor: '#1677FF',
      primaryLight: '#E6F7FF',
      secondaryColor: '#36CFC9',
      successColor: '#52C41A',
      warningColor: '#FAAD14',
      errorColor: '#F5222D',
      // 中性色优化
      neutral1: '#FFFFFF',
      neutral2: '#F7F8FA',
      neutral3: '#E5E6EB',
      neutral4: '#C9CDD4',
      neutral5: '#86909C',
      neutral6: '#4E5969',
      neutral7: '#1F2329',
      
      userMenu: [],
      imgUrls: [
        "../../static/img/SN-GG.png",
        "../../static/img/SN-GG1.png"
      ],
      col: 4, //菜单列数
      msg: "宁波广深科技有限公司"
    };
  },
  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();
        }
      });
    },
    getIsMsg() {
      this.$post({
        url: "/MessageCenter/getPushFailed",
        data: {
          createBy: this.$loginInfo.account,
          isShow: 1
        },
      }).then(res => {
        if (res.data.tbBillList.length > 0) {
          this.msg = "您有新的异常待处理/您有新的异常待处理";
          //展示图标
          uni.showTabBarRedDot({
            index: 1
          });
        } else {
          this.msg = "宁波广深科技有限公司";
          //展示图标
          uni.hideTabBarRedDot({
            index: 1
          });
        }
      })
    },
    checkForUpdate() {
      this.$post({
        url: "/Login/getAppUpgradeInfo",
        data: {}
      }).then(res => {
        
        let newVersion = res.data.version;
        let currentVersion = uni.getSystemInfoSync(); // 获取当前 APK 版本号
         
        if (newVersion > currentVersion.appVersion) {
          uni.showModal({
            title: "发现新版本",
            content: "是否下载最新版本?",
            success: (modalRes) => {
              if (modalRes.confirm) {
                this.downloadNewApk(res.data.apkUrl);
              }
            }
          });
          this.updateChecked = true; // 标记更新已检查过
        }
      })
    },
 
    downloadNewApk(apkUrl) {
      uni.showToast({
        title: "开始下载更新...",
        icon: "none",
        duration: 2000
      });
 
      uni.downloadFile({
        url: apkUrl,
        success: (res) => {
          if (res.statusCode === 200) {
            plus.runtime.install(res.tempFilePath, {
              force: true
            }, function() {
              console.log("安装成功,重启应用");
            }, function(e) {
              console.error("安装失败:", e);
            });
          }
        },
        fail: (err) => {
          console.error("下载失败:", err);
          uni.showToast({
            title: "下载失败,请检查网络",
            icon: "none",
            duration: 2000
          });
        }
      });
    }
  },
 
  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);
      this.checkForUpdate();
    }
  },
  onShow() {
    this.getIsMsg();
  },
  onPullDownRefresh() {
    if (this.loginInfo.hasLogin)
      this.getMenu(true);
  }
}
</script>
 
<style>
/* 全局样式重置 */
page {
  background-color: #F7F8FA;
  color: #1F2329;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
 
/* 优化后的文本样式 */
.text {
  font-weight: 500;
  color: #4E5969;
  font-size: 24rpx;
  margin-top: 10rpx;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
 
.example-body {
  padding: 30rpx;
  flex: 1;
  display: flex;
  flex-direction: column;
}
 
/* 菜单头部样式 */
.menu-header {
  margin-bottom: 30rpx;
  position: relative;
}
 
.menu-title {
  font-size: 36rpx;
  font-weight: 600;
  color: #1F2329;
  display: inline-block;
  position: relative;
  padding-bottom: 10rpx;
}
 
.decorative-line {
  height: 4rpx;
  width: 120rpx;
  background: linear-gradient(to right, #1677FF, #36CFC9);
  border-radius: 2rpx;
  margin-top: 10rpx;
}
 
/* 网格菜单优化 */
.menu-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
 
.grid-item {
  display: flex;
  flex-wrap: wrap;
  height: 100% !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 20rpx;
}
 
.grid-item-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20rpx;
  background-color: #FFFFFF;
  border-radius: 20rpx;
  box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
 
.grid-item-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4rpx;
  background: linear-gradient(to right, #1677FF, #36CFC9);
  opacity: 0;
  transition: opacity 0.3s ease;
}
 
.grid-item-box:hover {
  transform: translateY(-8rpx);
  box-shadow: 0 12rpx 30rpx rgba(22, 119, 255, 0.15);
}
 
.grid-item-box:hover::before {
  opacity: 1;
}
 
/* 图标容器优化 */
.icon-container {
  width: 140rpx;
  height: 140rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15rpx;
  position: relative;
}
 
.imgMenu {
  width: 100rpx;
  height: 100rpx;
  border-radius: 50%;
  background-color: #F7F8FA;
  padding: 16rpx;
  box-sizing: border-box;
  transition: transform 0.3s ease;
}
 
.imgMenu.default-icon {
  background-color: #E6F7FF;
  color: #1677FF;
}
 
.grid-item-box:hover .imgMenu {
  transform: scale(1.1);
}
 
.icon-badge {
  position: absolute;
  top: -10rpx;
  right: -10rpx;
  width: 30rpx;
  height: 30rpx;
  background-color: #F5222D;
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18rpx;
  box-shadow: 0 2rpx 8rpx rgba(245, 34, 45, 0.3);
}
 
/* 通知栏样式优化 */
.notice-bar {
  background: linear-gradient(90deg, #1677FF, #36CFC9);
  color: #FFFFFF;
  font-weight: 500;
  padding: 20rpx 30rpx;
  border-radius: 10rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 4rpx 12rpx rgba(22, 119, 255, 0.2);
}
 
/* 未登录状态样式优化 */
.guest-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 40rpx;
}
 
.title {
  font-size: 36rpx;
  font-weight: 600;
  color: #1F2329;
  margin: 40rpx 0 30rpx;
  text-align: center;
}
 
.ul {
  background-color: #FFFFFF;
  border-radius: 20rpx;
  padding: 30rpx;
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 600rpx;
}
 
.ul view {
  font-size: 28rpx;
  color: #4E5969;
  line-height: 1.8;
  margin-bottom: 20rpx;
}
 
.login-prompt {
  margin-top: 40rpx;
  padding: 15rpx 30rpx;
  background-color: #E6F7FF;
  border-radius: 30rpx;
  font-size: 24rpx;
  color: #1677FF;
}
 
.login-note {
  font-weight: 500;
}
</style>