wike-tabbar.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view>
  3. <view class="tabbar cu-bar flex-between bg-white" :class="isShowAnimate ? 'fadeInUp' : ''"
  4. :style="{'background-color':tabBar.bgColor,'border-top-color':tabBar.borderColor}" v-show="onTabbar">
  5. <block v-for="(item, index) in tabBar.list" :key="index">
  6. <view class="action tabbar-item" :class="[item.showBig?'add-action':'']"
  7. :style="{color:item.pagePath==('/'+nowPath)?themecolor:tabBar.color}" @click="clickTab(item)">
  8. <block v-if="tabBar.showType=='img'">
  9. <image class="tabbar-icon"
  10. :src="item.pagePath==('/'+nowPath)? item.selectedIconPath : item.iconPath"></image>
  11. </block>
  12. <block v-if="tabBar.showType=='iconfont'">
  13. <view :class="['tabbar-icon',item.fontClass]"
  14. :style="{'font-size':'22px','background-color':item.showBig?themecolor:''}"></view>
  15. </block>
  16. <text class="tabbar-text">{{ item.text }}</text>
  17. <text class="tabbar-item-num" v-if="item.num">{{item.num}}</text>
  18. </view>
  19. </block>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapMutations,
  26. mapActions,
  27. mapState,
  28. mapGetters
  29. } from 'vuex';
  30. export default {
  31. props: {
  32. onTabbar: {
  33. type: Boolean,
  34. default: true
  35. },
  36. infonum: {
  37. type: String,
  38. default: ''
  39. },
  40. isShowAnimate: {
  41. type: Boolean,
  42. default: false
  43. },
  44. isglobalpartjob: {
  45. type: String,
  46. default: '1'
  47. },
  48. themecolor: {
  49. type: String,
  50. default: '#26B3A0'
  51. },
  52. is_aipainting: {
  53. type: String,
  54. default: ''
  55. }
  56. },
  57. computed: {
  58. ...mapGetters(['appInfo'])
  59. },
  60. data() {
  61. return {
  62. showBig: false,
  63. tabBar: {
  64. color: '#333333',
  65. selectedColor: '#26B3A0',
  66. showType: "iconfont", //img/图片模式,iconfont/字体图标模式
  67. borderColor: "#d3d3d3",
  68. bgColor: "#ffffff",
  69. list: [
  70. // {
  71. // pagePath: "/pages/index/index",
  72. // navigateType: "switchTab",
  73. // showBig: false,
  74. // fontClass: "tn-icon-home-capsule",
  75. // "iconPath": "/static/images/tabs/index.png",
  76. // "selectedIconPath": "/static/images/tabs/indexs.png",
  77. // "text": "首页"
  78. // },
  79. // {
  80. // pagePath: "/pages/template/template",
  81. // navigateType: "switchTab",
  82. // showBig: false,
  83. // fontClass: "tn-icon-cube",
  84. // "iconPath": "/static/images/tabs/joblist.png",
  85. // "selectedIconPath": "/static/images/tabs/joblists.png",
  86. // "text": "应用"
  87. // },
  88. {
  89. pagePath: "/pages/robot/index",
  90. navigateType: "switchTab",
  91. showBig: false,
  92. fontClass: "tn-icon-funds",
  93. "iconPath": "/static/images/tabs/joblist.png",
  94. "selectedIconPath": "/static/images/tabs/joblists.png",
  95. "text": "数字人"
  96. },
  97. // {
  98. // pagePath: "/pages/painting/painting",
  99. // navigateType: "switchTab",
  100. // showBig: false,
  101. // fontClass: "tn-icon-image",
  102. // "iconPath": "/static/images/tabs/joblist.png",
  103. // "selectedIconPath": "/static/images/tabs/joblists.png",
  104. // "text": "绘画"
  105. // },
  106. // {
  107. // pagePath: "/pages/signin/signin",
  108. // navigateType: "switchTab",
  109. // showBig: false,
  110. // fontClass: "tn-icon-funds",
  111. // "iconPath": "/static/images/tabs/joblist.png",
  112. // "selectedIconPath": "/static/images/tabs/joblists.png",
  113. // "text": "任务"
  114. // },
  115. {
  116. pagePath: "/pages/user/user",
  117. navigateType: "switchTab",
  118. showBig: false,
  119. fontClass: "tn-icon-my",
  120. "iconPath": "/static/images/tabs/mine.png",
  121. "selectedIconPath": "/static/images/tabs/mines.png",
  122. "text": "我的"
  123. }
  124. ]
  125. },
  126. };
  127. },
  128. onReady() {
  129. try {
  130. uni.hideTabBar({
  131. animation: false
  132. })
  133. } catch (e) {
  134. //TODO handle the exception
  135. }
  136. // setTimeout(function(){
  137. // uni.showTabBar({});
  138. // },600);
  139. },
  140. mounted() {
  141. // console.log(this.is_aipainting);
  142. if (this.tabBar.list.length > 4 && this.is_aipainting == '2') {
  143. this.tabBar.list.splice(2, 1)
  144. }
  145. try {
  146. uni.hideTabBar({
  147. animation: false
  148. })
  149. } catch (e) {
  150. //TODO handle the exception
  151. }
  152. },
  153. methods: {
  154. clickTab(item) {
  155. if (item.showBig == true) {
  156. this.showBig = true
  157. } else {
  158. uni[item.navigateType]({
  159. url: item.pagePath
  160. });
  161. this.showBig = false
  162. }
  163. },
  164. toggleDialog() {
  165. this.showBig = !this.showBig
  166. },
  167. toPost(e) {
  168. this.toggleDialog();
  169. uni.navigateTo({
  170. url: '/pages/' + e
  171. })
  172. },
  173. // 路由跳转
  174. jump(path, parmas) {
  175. if (Boolean(uni.getStorageSync('userInfo').telnum)) {
  176. this.$Router.push({
  177. path: path,
  178. query: parmas
  179. });
  180. } else {
  181. this.$store.commit('LOGIN_TIP', true);
  182. }
  183. }
  184. },
  185. computed: {
  186. ...mapState({
  187. showLoginTip: state => state.user.showLoginTip,
  188. }),
  189. nowPath() {
  190. return getCurrentPages()[0] && getCurrentPages()[0].route;
  191. },
  192. }
  193. };
  194. </script>
  195. <style lang="scss">
  196. .tabbar {
  197. display: flex;
  198. justify-content: space-around;
  199. /* height: 8vh; */
  200. position: fixed;
  201. bottom: 0;
  202. left: 0;
  203. right: 0;
  204. z-index: 9999;
  205. height: 98rpx;
  206. background-color: #ffffff;
  207. // border-top: 1px solid rgba(193, 192, 201, 0.5);
  208. padding-bottom: constant(safe-area-inset-bottom);
  209. padding-bottom: env(safe-area-inset-bottom);
  210. box-shadow: 0 -10rpx 20rpx 0 rgba(137, 148, 143, .1);
  211. min-height: 128rpx;
  212. padding: 0;
  213. height: calc(100rpx + env(safe-area-inset-bottom) / 2);
  214. padding-bottom: calc(env(safe-area-inset-bottom) / 2);
  215. }
  216. .tabbar::before {
  217. content: "";
  218. width: 100%;
  219. height: 152rpx;
  220. // background: url(https://ls11.cn/attachment/images/9/2019/09/TW284XJ028xWXH1mCh7pw7WhZjK4Jj.png) no-repeat;
  221. background-position: center;
  222. background-size: cover;
  223. position: absolute;
  224. left: 0;
  225. bottom: 0;
  226. z-index: -1;
  227. padding-bottom: 0;
  228. padding-bottom: calc(constant(safe-area-inset-bottom) - 12rpx);
  229. padding-bottom: calc(env(safe-area-inset-bottom) - 12rpx);
  230. }
  231. .flex-between {
  232. display: -webkit-box;
  233. display: -webkit-flex;
  234. display: -ms-flexbox;
  235. display: flex;
  236. flex-direction: row;
  237. align-items: center;
  238. justify-content: space-between;
  239. }
  240. .tabbar-item {
  241. width: 33%;
  242. display: -webkit-inline-box;
  243. display: -webkit-inline-flex;
  244. display: -ms-inline-flexbox;
  245. display: inline-flex;
  246. flex-basis: 33%;
  247. flex-direction: column;
  248. align-items: center;
  249. justify-content: space-around;
  250. }
  251. .tabbar-item.active {
  252. color: #fe8b1e;
  253. }
  254. .tabbar-item.big {
  255. position: relative;
  256. top: -23rpx;
  257. // font-size: 130%;
  258. .tabbar-icon {
  259. width: 92rpx;
  260. height: 92rpx;
  261. }
  262. }
  263. .tabbar-icon {
  264. width: 46rpx;
  265. height: 46rpx;
  266. display: block;
  267. margin: 0 auto;
  268. margin-bottom: 4rpx;
  269. // font-size: 46rpx;
  270. // line-height: 10rpx;
  271. }
  272. .tabbar-text {
  273. font-size: 12px;
  274. letter-spacing: 0;
  275. text-align: center;
  276. line-height: 14px;
  277. display: block;
  278. font-weight: 600;
  279. // color: #333;
  280. }
  281. .tabbar-item-num {
  282. position: absolute;
  283. top: 1vw;
  284. font-size: 20rpx;
  285. padding: 4rpx;
  286. border-radius: 50%;
  287. background-color: #ff4a39;
  288. color: #ffffff;
  289. width: 28rpx;
  290. height: 28rpx;
  291. text-align: center;
  292. line-height: 28rpx;
  293. left: 45rpx;
  294. margin: auto;
  295. right: 0;
  296. }
  297. .bg {
  298. position: fixed;
  299. z-index: 1007;
  300. top: 0;
  301. left: 0;
  302. width: 100%;
  303. height: 100%;
  304. background-color: #000;
  305. opacity: .8;
  306. }
  307. .fixed-fabu {
  308. position: fixed;
  309. left: 0;
  310. bottom: 0;
  311. z-index: 1008;
  312. background-color: #fff;
  313. width: 100%;
  314. padding: 30rpx;
  315. border-top-left-radius: 12rpx;
  316. border-top-right-radius: 12rpx;
  317. h2 {
  318. font-size: 18px;
  319. color: #333;
  320. font-weight: 400;
  321. text-align: center;
  322. margin: 20rpx 0;
  323. }
  324. .ul {
  325. padding: 0 50rpx;
  326. }
  327. }
  328. .close {
  329. width: 44px;
  330. height: 44px;
  331. display: block;
  332. margin: 35px auto;
  333. }
  334. @keyframes fabu_animate_in {
  335. 0% {
  336. transform: scale(1);
  337. }
  338. 50% {
  339. transform: scale(1.2);
  340. }
  341. 100% {
  342. transform: scale(1);
  343. }
  344. }
  345. .ani_fabu_in {
  346. animation: fabu_animate_in .5s 0s ease-in-out;
  347. animation-fill-mode: both;
  348. animation-iteration-count: 1
  349. }
  350. @keyframes close_rotate {
  351. 0% {
  352. transform: rotate(0deg)
  353. }
  354. 100% {
  355. transform: rotate(360deg)
  356. }
  357. }
  358. .close_rotate {
  359. animation: close_rotate .5s .1s ease-in-out;
  360. animation-fill-mode: both;
  361. animation-iteration-count: 1
  362. }
  363. .btn-personal-rec {
  364. border-radius: 10rpx;
  365. line-height: 150rpx;
  366. height: 150rpx;
  367. font-size: 50rpx;
  368. color: #fff;
  369. font-weight: bold;
  370. margin: 40rpx auto;
  371. display: flex;
  372. align-items: center;
  373. justify-content: center;
  374. box-shadow: 0rpx 14rpx 34rpx rgba(41, 57, 88, 0.4);
  375. }
  376. .btn-personal-rec .btn-img {
  377. margin-right: 20rpx;
  378. width: 70rpx;
  379. height: 70rpx;
  380. }
  381. .recruit {
  382. background: linear-gradient(to right, #03a9f48c, #03A9F4);
  383. }
  384. .partjob {
  385. background: linear-gradient(to right, #FF98008c, #FF9800);
  386. // line-height: 100rpx;
  387. }
  388. .resume {
  389. background: linear-gradient(to right, #FF57228c, #FF5722);
  390. }
  391. @keyframes fadeInUp {
  392. from {
  393. opacity: 0;
  394. -webkit-transform: translate3d(0, 100%, 0);
  395. transform: translate3d(0, 100%, 0);
  396. }
  397. to {
  398. opacity: 1;
  399. -webkit-transform: translate3d(0, 0, 0);
  400. transform: translate3d(0, 0, 0);
  401. }
  402. }
  403. .fadeInUp {
  404. animation-name: fadeInUp;
  405. animation-duration: .5s;
  406. animation-delay: 0s;
  407. }
  408. </style>