index-安全管理体系第一版.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <template>
  2. <view>
  3. <!-- 首页风格切换-1-切换风格 -->
  4. <view class="top_bg_color">
  5. <!-- 背景虚化轮播图 -->
  6. <!-- <view class="bg_img" :style="{backgroundImage:'url('+top_bg_color_img+')'}"></view> -->
  7. <!-- 固定安全色 -->
  8. <view class="bg_img" :style="{backgroundColor:top_bg_color}"></view>
  9. <t-i-navbar :mine_code="mine_code" :navbar_bg_color="navbar_bg_color"></t-i-navbar>
  10. <t-i-notice :text="text"></t-i-notice>
  11. <t-i-banner :banner="banners" :mine_code="mine_code" @change_top_bg_color_img="change_top_bg_color_img">
  12. </t-i-banner>
  13. </view>
  14. <view v-for="(item,index) in common" :key="index">
  15. <view class="fixed_system" v-if="item.type_name == '七大板块' && item.index == index">
  16. <view class="line">
  17. <view class="item" v-for="(item_2,index_2) in item.data" :key="index_2" v-if="index_2 < 3" @click="go_page(item_2)">
  18. <view class="icon">
  19. <image :src="item_2.thumb" mode=""></image>
  20. </view>
  21. <view class="text">{{item_2.title}}</view>
  22. </view>
  23. </view>
  24. <view class="line">
  25. <view class="item" v-for="(item_2,index_2) in item.data" :key="index_2" v-if="index_2 > 2" @click="go_page(item_2)">
  26. <view class="icon">
  27. <image :src="item_2.thumb" mode=""></image>
  28. </view>
  29. <view class="text">{{item_2.title}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="todo" v-if="item.type_name == '待办事项' && item.index == index">
  34. <view class="left">
  35. <view class="title">
  36. <view class="icon"></view>
  37. <view class="text">待办事项</view>
  38. </view>
  39. </view>
  40. <view class="right">
  41. <view class="tip">您有 <text style="color: #FF0000;">0</text> 项待办</view>
  42. <view class="detail">
  43. 详情 <uni-icons type="right" size="12" color="#B5B5B5"></uni-icons>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="nav" v-if="item.type_name == '实操应用' && item.index == index">
  48. <view class="section" v-for="(item_2,index_2) in item.data" :key="index_2">
  49. <view class="title">
  50. <view class="icon"></view>
  51. <view class="text">{{item_2.title}}</view>
  52. </view>
  53. <view class="list">
  54. <view class="item" v-for="(item_3,index_3) in item_2.children" :key="index_3" @click="go_page(item_3)">
  55. <view class="icon">
  56. <image :src="item_3.thumb" mode=""></image>
  57. </view>
  58. <view class="text">{{item_3.title}}</view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="nav" v-if="item.type_name == '数据平台' && item.index == index">
  64. <view class="section" v-for="(item_2,index_2) in item.data" :key="index_2">
  65. <view class="title">
  66. <view class="icon"></view>
  67. <view class="text">{{item_2.title}}</view>
  68. </view>
  69. <view class="list">
  70. <view class="item" v-for="(item_3,index_3) in item_2.children" :key="index_3" @click="go_page(item_3)">
  71. <view class="icon">
  72. <image :src="item_3.thumb" mode=""></image>
  73. </view>
  74. <view class="text">{{item_3.title}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="nav" v-if="item.type_name == '学习资料' && item.index == index">
  80. <view class="section" v-for="(item_2,index_2) in item.data" :key="index_2">
  81. <view class="title">
  82. <view class="icon"></view>
  83. <view class="text">{{item_2.title}}</view>
  84. </view>
  85. <view class="list">
  86. <view class="item" v-for="(item_3,index_3) in item_2.children" :key="index_3" @click="go_page(item_3)">
  87. <view class="icon">
  88. <image :src="item_3.thumb" mode=""></image>
  89. </view>
  90. <view class="text">{{item_3.title}}</view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="news" v-if="item.type_name == '动态信息' && item.index == index">
  96. <view class="title_box">
  97. <view class="left">
  98. <view class="title">
  99. <view class="icon"></view>
  100. <view class="text">动态信息</view>
  101. </view>
  102. </view>
  103. <view class="right" @click="go_more()">
  104. <view class="detail">
  105. 查看全部 <uni-icons type="right" size="12" color="#B5B5B5"></uni-icons>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="list">
  110. <view class="item" v-for="(item,index) in newsList" :key="index" @click="go_detail(item.id)">
  111. <view class="icon"></view>
  112. <view class="inner">
  113. <view class="new_title">{{item.title}}</view>
  114. <view class="tip">
  115. <view class="time">{{item.created_at}}</view>
  116. <view class="detail">
  117. 详情<image src="./icon/new_detail.png" mode=""></image>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. import {
  129. set_base_url
  130. } from '@/common/set_base_url.js'
  131. import {
  132. goToLink
  133. } from '@/common/common.js'
  134. // 版本控制
  135. import upApp from "@/uni_modules/uni-upgrade-center-app/utils/check-update"
  136. export default {
  137. data() {
  138. return {
  139. // 根_mine_code
  140. app_mine_code: "",
  141. // 当前煤矿编码
  142. mine_code: "",
  143. // 首页接口的基础请求路径 默认为当前矿编码的基础路径
  144. base_url: " ",
  145. // 轮播图
  146. banners: [],
  147. // 新闻列表
  148. newsList: "",
  149. // 值班公告
  150. text: "",
  151. // 背景虚化图片
  152. top_bg_color_img: "",
  153. // 背景安全色
  154. top_bg_color: "#7372c2",
  155. top_bg_color_list: ['#d62b2b', '#00a2e8', '#b08654',"#7372c2"],
  156. // 标题栏背景色
  157. navbar_bg_color: "",
  158. common:[]
  159. }
  160. },
  161. onPullDownRefresh() {
  162. uni.reLaunch({
  163. url: "./index"
  164. })
  165. setTimeout(function() {
  166. uni.stopPullDownRefresh();
  167. }, 1000);
  168. },
  169. onLoad() {
  170. // 初始化当前煤矿编码
  171. this.mine_code = uni.getStorageSync('mine_code')
  172. // 根据矿编码切换首页接口不同的请求基础路径
  173. this.base_url = set_base_url(this.mine_code)
  174. // #ifdef H5
  175. if (this.mine_code == 'ningmeijituan') {
  176. if (window.location.href.indexOf('token') != -1) {
  177. this.$api.oauth_getNoPasswordToken({
  178. token: window.location.href.split('token=')[1].split('&')[0],
  179. caller: window.location.href.split('token=')[1].split('&')[1].split('=')[1]
  180. }).then((res) => {
  181. uni.setStorageSync('Authorization', res.data.data.accessToken)
  182. uni.setStorageSync('token_type', res.data.data.token_type)
  183. // 存储用户基本信息
  184. uni.setStorageSync('user', res.data.data.user);
  185. uni.setStorageSync('people_code', res.data.data.user.people_code);
  186. // 存储电话号码
  187. uni.setStorageSync('mobile', res.data.data.user.mobile);
  188. })
  189. }else{
  190. this.check_token()
  191. }
  192. }else{
  193. this.check_token()
  194. }
  195. // #endif
  196. // 检查更新
  197. upApp()
  198. // #ifdef APP-PLUS
  199. this.check_token()
  200. // #endif
  201. // 获取轮播图
  202. this.get_banner()
  203. // 获取首页新闻列表
  204. this.getNews()
  205. // 值班公告
  206. this.get_notice()
  207. this.get_home_aqyk_newLinks()
  208. },
  209. onPageScroll: function(e) {
  210. if (e.scrollTop > 300) {
  211. this.navbar_bg_color = "#009fe8"
  212. } else {
  213. this.navbar_bg_color = ""
  214. }
  215. },
  216. methods: {
  217. // 单点登录及token过期验证
  218. check_token() {
  219. // token过期验证
  220. this.$api.worksheet_classify_list({
  221. }).then((res) => {
  222. // console.log(res)
  223. if (res.data.code == 401) {
  224. uni.showToast({
  225. icon: "none",
  226. title: "登录失效、请重新登录"
  227. })
  228. uni.clearStorageSync('Authorization');
  229. setTimeout(function() {
  230. uni.redirectTo({
  231. url: "../../my/login/login"
  232. })
  233. }, 1500)
  234. } else {
  235. // console.log(res)
  236. }
  237. })
  238. },
  239. get_home_aqyk_newLinks() {
  240. this.$api.home_aqyk_newLinks({
  241. }).then((res) => {
  242. // console.log(res.data)
  243. let data = res.data
  244. data.forEach((item,index)=>{
  245. item['index'] = index
  246. })
  247. // console.log(data)
  248. this.common = data
  249. })
  250. },
  251. // 获取轮播图
  252. get_banner() {
  253. uni.request({
  254. url: this.base_url + "/scrollImg/list",
  255. method: "GET",
  256. header:{
  257. 'accesskey': "b364b449a18af327867f7edc3431b541"
  258. },
  259. success: (res) => {
  260. // console.log(res.data.data.data)
  261. this.banners = res.data.data.data
  262. this.top_bg_color_img = this.banners[0].imgURL
  263. }
  264. })
  265. },
  266. // 请求新闻动态
  267. getNews() {
  268. uni.request({
  269. url: this.base_url + "/article/list",
  270. method: "GET",
  271. header:{
  272. 'accesskey': "b364b449a18af327867f7edc3431b541"
  273. },
  274. data: {
  275. pageSize: 4
  276. },
  277. success: (res) => {
  278. this.newsList = res.data.data.data
  279. }
  280. })
  281. },
  282. // 值班公告
  283. get_notice() {
  284. uni.request({
  285. url: this.base_url + "/notice/list",
  286. method: "GET",
  287. header:{
  288. 'accesskey': "b364b449a18af327867f7edc3431b541"
  289. },
  290. success: (res) => {
  291. if (!res.data.data.content) {
  292. this.text = res.data.data.message
  293. } else {
  294. this.text = res.data.data.content.replace(/<br /g, " ").replace(/>/g, " ").replace(
  295. /\//g, " ")
  296. }
  297. }
  298. })
  299. },
  300. // 切换背景图片
  301. change_top_bg_color_img(index) {
  302. if (index > 3) {
  303. index = parseInt(4 * Math.random())
  304. }
  305. this.top_bg_color = this.top_bg_color_list[index]
  306. },
  307. go_page(item){
  308. if(item.link == null){
  309. uni.showToast({
  310. icon:"none",
  311. title:"暂未开通"
  312. })
  313. return
  314. }
  315. goToLink(item, this.mine_code)
  316. },
  317. // 打开详情页
  318. go_detail(id) {
  319. uni.navigateTo({
  320. url: "../../index/news/news?id=" + id + "&mine_code=ningmeijituan"
  321. })
  322. },
  323. // 打开列表
  324. go_more() {
  325. uni.navigateTo({
  326. url: "../../index/news/news_list/news_list?mine_code=ningmeijituan"
  327. })
  328. }
  329. }
  330. }
  331. </script>
  332. <style lang="scss">
  333. page {
  334. background-color: #FFFFFF;
  335. }
  336. .top_bg_color {
  337. position: relative;
  338. width: 750rpx;
  339. overflow: hidden;
  340. .bg_img {
  341. width: 750rpx;
  342. height: 440rpx;
  343. position: absolute;
  344. top: 0;
  345. left: 0;
  346. z-index: 0;
  347. background-position: center;
  348. background-size: 100% 100%;
  349. filter: blur(50px);
  350. transform: scale(2);
  351. opacity: 0.9;
  352. }
  353. }
  354. .fixed_system {
  355. box-sizing: border-box;
  356. padding: 25rpx 0;
  357. width: 750rpx;
  358. height: 436rpx;
  359. background-image: url(./icon/section.png);
  360. background-size: 100% 100%;
  361. background-repeat: no-repeat;
  362. .line {
  363. box-sizing: border-box;
  364. padding: 25rpx;
  365. display: flex;
  366. justify-content: center;
  367. .item {
  368. margin-right: 54rpx;
  369. .icon {
  370. image {
  371. width: 109rpx;
  372. height: 109rpx;
  373. display: block;
  374. }
  375. }
  376. .text {
  377. font-size: 28rpx;
  378. color: #171717;
  379. }
  380. }
  381. }
  382. .line:first-child {
  383. .item:nth-child(3) {
  384. margin-right: 0;
  385. }
  386. }
  387. .line:last-child {
  388. .item:nth-child(4) {
  389. margin-right: 0;
  390. }
  391. }
  392. }
  393. .todo {
  394. box-sizing: border-box;
  395. padding: 25rpx;
  396. display: flex;
  397. justify-content: space-between;
  398. align-items: center;
  399. .left {
  400. .title {
  401. display: flex;
  402. align-items: center;
  403. .icon {
  404. width: 9rpx;
  405. height: 34rpx;
  406. background-color: #04A0E8;
  407. border-radius: 5rpx;
  408. }
  409. .text {
  410. margin-left: 10rpx;
  411. color: #6A6A6A;
  412. font-size: 33rpx;
  413. font-weight: 700;
  414. }
  415. }
  416. }
  417. .right {
  418. display: flex;
  419. align-items: baseline;
  420. .tip {
  421. font-size: 25rpx;
  422. color: #6A6A6A;
  423. }
  424. .detail {
  425. margin-left: 24rpx;
  426. font-size: 25rpx;
  427. color: #B5B5B5;
  428. }
  429. }
  430. }
  431. .nav {
  432. background-color: #F7F9F7;
  433. width: 750rpx;
  434. padding: 10rpx 0;
  435. .section {
  436. background-color: #FFFFFF;
  437. box-sizing: border-box;
  438. padding: 25rpx;
  439. .title {
  440. padding: 20rpx 0;
  441. display: flex;
  442. align-items: center;
  443. .icon {
  444. width: 9rpx;
  445. height: 34rpx;
  446. background-color: #04A0E8;
  447. border-radius: 5rpx;
  448. }
  449. .text {
  450. margin-left: 10rpx;
  451. color: #6A6A6A;
  452. font-size: 33rpx;
  453. font-weight: 700;
  454. }
  455. }
  456. .list {
  457. width: 700rpx;
  458. overflow: hidden;
  459. .item {
  460. margin-top: 20rpx;
  461. float: left;
  462. margin-right: 20rpx;
  463. width: 120rpx;
  464. text-align: center;
  465. .icon {
  466. image {
  467. width: 73rpx;
  468. height: 73rpx;
  469. }
  470. }
  471. .text {
  472. color: #171717;
  473. font-size: 26rpx;
  474. white-space: nowrap;
  475. overflow: hidden;
  476. text-overflow: ellipsis;
  477. }
  478. }
  479. .item:nth-child(5n) {
  480. margin-right: 0;
  481. }
  482. }
  483. }
  484. }
  485. .news {
  486. background-color: #F7F9F7;
  487. padding-top: 20rpx;
  488. .title_box {
  489. background-color: #FFFFFF;
  490. box-sizing: border-box;
  491. padding: 25rpx;
  492. display: flex;
  493. justify-content: space-between;
  494. align-items: center;
  495. .left {
  496. .title {
  497. display: flex;
  498. align-items: center;
  499. .icon {
  500. width: 9rpx;
  501. height: 34rpx;
  502. background-color: #04A0E8;
  503. border-radius: 5rpx;
  504. }
  505. .text {
  506. margin-left: 10rpx;
  507. color: #6A6A6A;
  508. font-size: 33rpx;
  509. font-weight: 700;
  510. }
  511. }
  512. }
  513. .right {
  514. display: flex;
  515. align-items: baseline;
  516. .tip {
  517. font-size: 25rpx;
  518. color: #6A6A6A;
  519. }
  520. .detail {
  521. margin-left: 24rpx;
  522. font-size: 25rpx;
  523. color: #B5B5B5;
  524. }
  525. }
  526. }
  527. .list {
  528. box-sizing: border-box;
  529. padding: 25rpx;
  530. background-color: #FFFFFF;
  531. .item {
  532. margin-bottom: 20rpx;
  533. display: flex;
  534. justify-content: space-between;
  535. border-bottom: 1rpx solid #F5F6F7;
  536. .icon {
  537. position: relative;
  538. top: 16rpx;
  539. width: 8rpx;
  540. height: 8rpx;
  541. background: #999999;
  542. border-radius: 50%;
  543. }
  544. .inner {
  545. width: 680rpx;
  546. .new_title {
  547. color: #171717;
  548. font-size: 29rpx;
  549. line-height: 44rpx;
  550. }
  551. .tip {
  552. margin: 20rpx 0;
  553. display: flex;
  554. justify-content: space-between;
  555. .time {
  556. font-size: 26rpx;
  557. color: #999999;
  558. }
  559. .detail {
  560. color: #FD6B5C;
  561. font-size: 23rpx;
  562. image {
  563. margin-left: 8rpx;
  564. width: 19rpx;
  565. height: 16rpx;
  566. }
  567. }
  568. }
  569. }
  570. }
  571. .item:last-child {
  572. border: none;
  573. }
  574. }
  575. }
  576. </style>