wike-tabbar.vue 9.0 KB

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