index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="all-box" :class="isIos ? 'isIos' : ''">
  3. <div style="height: 100%;">
  4. <initHome v-if="active_index===0" @activeMenu="activeMenu" ref="initHome"/>
  5. <department v-if="active_index===1" isHide></department>
  6. <userCenter v-if="active_index===2" ref="userCenter"></userCenter>
  7. </div>
  8. <!-- 导航 -->
  9. <van-tabbar v-model="active_index" :class="isIos ? 'padding-m' : ''" :fixed="false">
  10. <van-tabbar-item>
  11. <icon :name="tabs == 0? 'statistics_checked':'statistics'" :class="tabs == 0? 'active':''"></icon>
  12. <span>首页</span>
  13. </van-tabbar-item>
  14. <van-tabbar-item>
  15. <icon :name="tabs == 1? 'footer_nav_work_press':'footer_nav_work'" :class="tabs == 1? 'active':''"></icon>
  16. <span>组织</span>
  17. </van-tabbar-item>
  18. <van-tabbar-item>
  19. <icon :name="tabs == 2? 'footer_nav_me_press':'footer_nav_me'" :class="tabs == 2? 'active':''"></icon>
  20. <span>我的</span>
  21. </van-tabbar-item>
  22. </van-tabbar>
  23. <van-popup v-model="updateVisible" :close-on-click-overlay="false" style="border-radius: 0.15rem; background: #fff0; overflow: visible;">
  24. <div class="buyPopupBody" style="width: 85vw;">
  25. <div class="buyPopupContent">
  26. <div class="buyPopupTitle"> {{announcement.type == 1? '版本更新':'系统公告'}}</div>
  27. <div style="padding: 0.5rem 0.3rem 0.3rem 0.3rem; overflow-y: auto;font-size: 0.3rem; box-sizing: border-box;" v-html="announcement.focus"></div>
  28. <van-row gutter="20">
  29. <van-col span="12"><van-button block type="info" @click="updateVisible=false">我知道了</van-button></van-col>
  30. <van-col span="12"><van-button block type="default" @click="getItemBuyPopupPage">查看详情</van-button></van-col>
  31. </van-row>
  32. </div>
  33. </div>
  34. </van-popup>
  35. </div>
  36. </template>
  37. <script>
  38. import initHome from '@/view/body/initHome';
  39. import userCenter from '@/view/body/userCenter';
  40. import department from '@/view/user/department';
  41. // import management from '@/point/view/body/management';
  42. // import messageList from '@/point/view/body/messageList';
  43. import {get_employee_all} from '@/api/login';
  44. export default {
  45. components: {userCenter,initHome,department},
  46. data() {
  47. return {
  48. isIos:this.$getCache('iPhone'),
  49. active_index:0,
  50. tabs:0,
  51. manNUm: 0, // 绩效数
  52. // 公共
  53. updateVisible:false,
  54. announcement:'',
  55. };
  56. },
  57. watch: {
  58. active_index(val){
  59. this.tabs = val;
  60. }
  61. },
  62. methods: {
  63. IsPC() {
  64. var userAgentInfo = navigator.userAgent;
  65. var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
  66. var flag = true;
  67. for (var v = 0; v < Agents.length; v++) {
  68. if (userAgentInfo.indexOf(Agents[v]) > 0) {
  69. flag = false;
  70. break;
  71. }
  72. }
  73. return flag;
  74. },
  75. //系统公告
  76. noticeList() {
  77. let params = { page: 1, page_size: 10 };
  78. this.$axiosUser('get', '/api/pro/announcement/list', params).then(res => {
  79. if (res.data.code == 1) {
  80. let list = res.data.data.list[0];
  81. if(!list){
  82. return false
  83. }
  84. if (localStorage.getItem('noticeId')) {
  85. if (localStorage.getItem('noticeId') != list.id) {
  86. this.updateVisible = true;
  87. localStorage.setItem('noticeId', list.id);
  88. }
  89. } else {
  90. localStorage.setItem('noticeId', list.id);
  91. this.updateVisible = true;
  92. }
  93. this.announcement = list;
  94. }
  95. });
  96. },
  97. getItemBuyPopupPage() {
  98. this.updateVisible = false;
  99. this.$router.push({ path: '/noticeList' });
  100. },
  101. setEmployee() {
  102. get_employee_all().then(res => {
  103. if (res.data.code == 1) {
  104. let list = res.data.data.list;
  105. let data = {};
  106. list.forEach((item, index) => {
  107. if (item.status == 2) {
  108. item.name = item.name + '(已离职)';
  109. }
  110. data[item.id] = item;
  111. });
  112. if (window.plus) {
  113. plus.storage.setItem('SET_EMPLOYEE_MAP_JX', JSON.stringify(data));
  114. } else {
  115. localStorage.setItem('SET_EMPLOYEE_MAP_JX', JSON.stringify(data));
  116. }
  117. }
  118. });
  119. },
  120. activeMenu() {
  121. this.active_index = 1;
  122. },
  123. shwoCunt() {
  124. this.$axiosUser('get', '/api/pro/notice/number').then(res => {
  125. this.cuntNum = res.data.data;
  126. });
  127. },
  128. },
  129. created() {
  130. if (this.IsPC()&&process.env.NODE_ENV == 'production') {
  131. this.$router.replace({name: 'error'}); // 提示去APP端
  132. return false
  133. }
  134. this.shwoCunt();
  135. this.setEmployee();
  136. this.noticeList();
  137. },
  138. };
  139. </script>
  140. <style scoped lang="scss">
  141. .all-box{
  142. height: calc(100% - 1rem) !important;
  143. position: relative;
  144. }
  145. .isIos {
  146. height: calc(100% - 1.4rem) !important;
  147. }
  148. .padding-m {
  149. padding-bottom: 0.4rem;
  150. }
  151. /deep/ .shortcut-option-btn .van-icon {
  152. font-size: 0.6rem;
  153. }
  154. .all-box /deep/ .van-tabbar-item {
  155. text-align: center;
  156. position: relative;
  157. }
  158. .all-box /deep/ .van-tabbar-item .svg-icon {
  159. color: #606266;
  160. height: 0.36rem;
  161. margin-bottom: 0.08rem;
  162. }
  163. .all-box .footer_nav_add_press {
  164. height: 0.8rem !important;
  165. }
  166. .all-box /deep/ .van-tabbar-item .active {
  167. color: #238dfa;
  168. }
  169. .all-box /deep/ .van-tabbar-item span {
  170. display: block;
  171. font-size: 0.2rem;
  172. margin-bottom: 0.08rem;
  173. }
  174. // .buyPopupBody {
  175. // width: 85vw;
  176. // }
  177. // .buyPopupContent{
  178. // background: white;
  179. // padding:0.2rem 0.24rem;
  180. // border-radius: 0.15rem;
  181. // }
  182. // .buyPopupTitle{
  183. // background: #1a89fa;
  184. // text-align: center;
  185. // border-radius: 0.1rem;
  186. // font-weight: normal;
  187. // font-size: 0.32rem;
  188. // height: 0.8rem;
  189. // line-height: 0.8rem;
  190. // color: #fff;
  191. // margin-top: 0.24rem;
  192. // }
  193. .buyPopupBody {
  194. width: 85vw;
  195. .buyPopupContent {
  196. position: relative;
  197. background: white;
  198. padding: 0 5vw 5vw 5vw;
  199. border-radius: 0.15rem;
  200. .buyPopupTitle {
  201. background: #1a89fa;
  202. position: absolute;
  203. left: 0.6rem;
  204. right: 0.6rem;
  205. top: -0.3rem;
  206. text-align: center;
  207. border-radius: 0.1rem;
  208. line-height: 2;
  209. font-weight: normal;
  210. font-size: 0.36rem;
  211. color: #fff;
  212. }
  213. .buyPopupTxt {
  214. font-size: 0.32rem;
  215. line-height: 1.8;
  216. padding-top: 0.8rem;
  217. }
  218. .buyPopupTel {
  219. color: #1a89fa;
  220. font-weight: bold;
  221. }
  222. }
  223. }
  224. .buyPopupContent /deep/ img,.buyPopupContent /deep/ ul,.buyPopupContent /deep/ li,.buyPopupContent /deep/ p{
  225. width: 100%;
  226. }
  227. </style>