App.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div id="app" :class="`${$state.theme === 'red' ? 'red-theme' : 'black-theme'}`">
  3. <div :class="`header-box`" v-if="hasHeader && title !== '用户登录'">
  4. <mt-header :title="title">
  5. <mt-button icon="back" slot="left" @click="$router.go(-1)"></mt-button>
  6. <div v-if="!is_Show">
  7. <template v-if="iconRight == 'search'">
  8. <img slot="right" class="search-right" src="./assets/ico/fangdajing.png" alt />
  9. </template>
  10. <template v-else>
  11. <mt-button icon="more" slot="right"></mt-button>
  12. </template>
  13. </div>
  14. </mt-header>
  15. </div>
  16. <div class="body-box">
  17. <transition
  18. :name="transitionName"
  19. >
  20. <router-view></router-view>
  21. </transition>
  22. </div>
  23. <foot v-if="$route.meta.show !== true" @close="footColse"></foot>
  24. <elalert></elalert>
  25. <loginPopup @close="dialogClose"/>
  26. </div>
  27. </template>
  28. <script>
  29. import elalert from "@/components/elalert.vue";
  30. import foot from "@/components/foot.vue";
  31. import loginPopup from "@/components/loginDialog.vue";
  32. //引入css
  33. import "@/assets/iconfont/iconfont.css";
  34. import "@/assets/iconfont/iconfont.ttf";
  35. export default {
  36. components: {
  37. foot,
  38. elalert,
  39. loginPopup
  40. },
  41. name: "App",
  42. created() {
  43. this.$state.theme="red";
  44. console.log(this.$state.theme,"asdasdasd")
  45. let title = this.$route.meta.title || "首页";
  46. this.title = title;
  47. if(this.$route.meta.is_Show){
  48. this.is_Show = this.$route.meta.is_Show;
  49. }else{
  50. this.is_Show = true;
  51. }
  52. if (this.$route.meta.hasHeader) {
  53. this.hasHeader = true;
  54. } else {
  55. this.hasHeader = false;
  56. }
  57. if (this.$route.meta.iconRight) {
  58. this.iconRight = this.$route.meta.iconRight;
  59. } else {
  60. this.iconRight = "default";
  61. }
  62. // this.$store.state.className = window.localStorage.getItem('styleName')?window.localStorage.getItem('styleName'):'red'
  63. },
  64. mounted() {
  65. },
  66. watch: {
  67. $route(to, from) {
  68. let title = to.meta.title || "首页";
  69. this.title = title;
  70. if (to.meta.iconRight) {
  71. this.iconRight = to.meta.iconRight;
  72. } else {
  73. this.iconRight = "default";
  74. }
  75. if (to.meta.hasHeader) {
  76. this.hasHeader = true;
  77. } else {
  78. this.hasHeader = false;
  79. }
  80. if (to.meta.index > from.meta.index) {
  81. console.log("slide-left");
  82. //设置动画名称
  83. this.transitionName = "slide-left";
  84. } else {
  85. console.log("slide-right");
  86. this.transitionName = "slide-right";
  87. }
  88. }
  89. },
  90. data() {
  91. return {
  92. title: "首页",
  93. hasHeader: false,
  94. iconRight: "default",
  95. transitionName: '',
  96. is_Show:true,
  97. is_foot:true,
  98. };
  99. },
  100. methods: {
  101. footColse(){
  102. this.$store.commit('dialogVisible',true);
  103. },
  104. dialogClose(){
  105. this.$store.commit('dialogVisible',false);
  106. }
  107. }
  108. };
  109. </script>
  110. <style lang="less" scoped>
  111. /deep/ .van-list__finished-text{
  112. line-height: 1.925926rem !important;
  113. }
  114. /deep/ .van-list__error-text{
  115. line-height: 1.925926rem !important;
  116. }
  117. #app {
  118. width: 100vw;
  119. height: 100vh;
  120. overflow: hidden;
  121. font-family: "rubik";
  122. .header-box {
  123. width: 100%;
  124. height: 1.4rem;
  125. /deep/.mint-header {
  126. height: 100%;
  127. background-color: #16171d;
  128. // background-color: rgba(20, 45, 55, 0.3);
  129. .is-left {
  130. .mintui {
  131. font-size: 20px;
  132. }
  133. }
  134. .mint-header-title {
  135. font-size: 0.36rem;
  136. color: rgba(255, 255, 255, 1);
  137. }
  138. }
  139. button {
  140. outline: none;
  141. }
  142. }
  143. .body-box {
  144. width: 100%;
  145. height: 100%;
  146. // height: calc(100% - 1rem);
  147. box-sizing: border-box;
  148. overflow-y: auto;
  149. }
  150. &.red-theme {
  151. background: rgb(241,242,246);
  152. color:#000;
  153. /deep/.mint-header {
  154. background: none;
  155. .mint-header-title {
  156. font-size: 0.42rem;
  157. color: #212121;
  158. }
  159. .mintui {
  160. color: #212121;
  161. }
  162. }
  163. /deep/.van-swipe-item {
  164. color: #000;
  165. }
  166. /deep/.navs_content {
  167. background: #fff!important;
  168. }
  169. /deep/.fo_content {
  170. background: #fff;
  171. }
  172. /deep/.news-tab{
  173. background: #fff;
  174. }
  175. /deep/.mint-tab-item-label {
  176. color: #000;
  177. font-size: .35rem;
  178. }
  179. /deep/.top_title{
  180. color: #000;
  181. }
  182. /deep/.titContent{
  183. color:#000;
  184. }
  185. /deep/.mint-navbar {
  186. background: #fff;
  187. }
  188. /deep/.mint-tab-item {
  189. background: #fff;
  190. border: none;
  191. }
  192. /deep/.footCss{
  193. background: #fff;
  194. }
  195. /deep/.newDetail-tits{
  196. color: #aaa;
  197. }
  198. /deep/.van-skeleton__row, .van-skeleton__title{
  199. background-color: #fff!important;
  200. }
  201. }
  202. &.black-theme {
  203. // background: #16171d;
  204. // background: rgb(14, 14, 15);
  205. background: rgb(33, 33, 43);
  206. /deep/.navs_content {
  207. background: #272733;
  208. }
  209. /deep/.fo_content {
  210. background: #272733;
  211. }
  212. /deep/.news-tab{
  213. background: #272733;
  214. }
  215. /deep/.mint-navbar {
  216. background: #272733;
  217. }
  218. /deep/.titContent{
  219. color:#000;
  220. }
  221. /deep/.mint-tab-container {}
  222. /deep/.mint-tab-item {
  223. background: #272733;
  224. }
  225. /deep/.van-swipe-item {
  226. color: #000;
  227. }
  228. /deep/.footCss{
  229. background: rgb(33, 33, 43);
  230. }
  231. /deep/.newDetail-tits{
  232. color: #999;
  233. }
  234. }
  235. }
  236. .search-right {
  237. width: 0.3rem;
  238. height: 0.3rem;
  239. }
  240. .mint-search-list {
  241. position: relative !important;
  242. }
  243. .topLeft{
  244. }
  245. /deep/.el-alert{
  246. width: 75%!important;
  247. height: 1.1rem!important;
  248. position: absolute!important;
  249. top: 0!important;
  250. bottom: 0!important;
  251. left: 0!important;
  252. right: 0!important;
  253. margin: auto!important;
  254. font-size: 0.36rem!important;
  255. }
  256. /deep/.el-alert__title{
  257. font-size: 0.36rem!important;
  258. }
  259. /deep/.el-icon-close::before{
  260. display: none;
  261. }
  262. /deep/.icon-icon_A::before{
  263. font-size: 0.6rem!important;
  264. }
  265. </style>