nav.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="box">
  3. <view class="header-box">
  4. <view class="top-box">
  5. <view class="box-right"><wyb-drop-down :zIndex="1" class="han-box" ref="dropDown" :options="options" @select="onItemSelect"></wyb-drop-down></view>
  6. </view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import wybDropDown from '@/components/wyb-drop-down/wyb-drop-down.vue';
  12. import { mapState, mapMutations } from 'vuex';
  13. // import { goodslist,allist,aboutlist, fllist } from '../../api/api.js';
  14. export default {
  15. components: {
  16. wybDropDown
  17. },
  18. computed: {
  19. ...mapState(['lang'])
  20. },
  21. watch: {
  22. lang(val) {
  23. this.$set(this.options[0], 'header', this.$t('hea.yy'));
  24. }
  25. },
  26. data() {
  27. return {
  28. show: false,
  29. options: [
  30. {
  31. header: 'Language',
  32. contents: ['中文', 'english']
  33. }
  34. ],
  35. langlist: ['zh_cn', 'en'],
  36. // 弹窗分类样式
  37. itemStyle: {
  38. fontSize: '36rpx',
  39. fontWeight: 'bold'
  40. },
  41. // 弹窗标题样式
  42. titleStyle: {
  43. 'font-size': '40rpx'
  44. },
  45. //弹窗当前idnex
  46. swIndex: 0,
  47. checkedIndex: 0, //设置当前选中的分类对象
  48. popList: [
  49. {
  50. type: 'product',
  51. title: '公司产品',
  52. list: [], //保存商品列表
  53. loding: false, //判断是否加载中
  54. more: 'loadmore' //判断是否还可以加载数据
  55. },
  56. {
  57. type: 'cases',
  58. title: '方案案例',
  59. list: [], //保存商品列表
  60. loding: false, //判断是否加载中
  61. more: 'loadmore' //判断是否还可以加载数据
  62. },
  63. {
  64. type: 'about',
  65. title: '关于我们',
  66. list: [], //保存商品列表
  67. loding: false, //判断是否加载中
  68. more: 'loadmore' //判断是否还可以加载数据
  69. }
  70. ],
  71. // 自定义加载文本
  72. loadText: {
  73. loadmore: 'loading...',
  74. loading: 'loading...',
  75. nomore: 'ready'
  76. }
  77. };
  78. },
  79. created() {
  80. // this.init();
  81. const lang = uni.getStorageSync('lang') || 0;
  82. this.$store.commit('changelang', this.langlist[lang]);
  83. },
  84. methods: {
  85. // 下拉选择语言分类
  86. onItemSelect(e) {
  87. const lang = this.langlist[e.contentIndex];
  88. uni.setStorageSync('lang', e.contentIndex);
  89. this.$store.commit('changelang', lang);
  90. this.$i18n.locale = lang;
  91. // 保存当前选中的对象
  92. this.$emit('changeSelect', e);
  93. this.$refs.dropDown.close();
  94. console.log(lang);
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. .alertSw {
  101. height: 100vh;
  102. .item {
  103. padding-top: 100rpx;
  104. }
  105. }
  106. /deep/ .collapseItemBox {
  107. .title {
  108. padding: 30rpx;
  109. font-size: 32rpx;
  110. font-weight: bold;
  111. color: #101010;
  112. }
  113. }
  114. .margin-t-40 {
  115. margin-top: 40rpx;
  116. }
  117. .alertColl,
  118. .pop-box,
  119. .header-box {
  120. padding: 0 30rpx;
  121. }
  122. .navtoIndex {
  123. font-size: 41rpx;
  124. font-weight: bold;
  125. margin-bottom: 20rpx;
  126. padding-left: 30rpx;
  127. }
  128. .pop-box {
  129. position: relative;
  130. width: 700rpx;
  131. padding-right: 15rpx;
  132. .box-right {
  133. position: absolute;
  134. top: 0;
  135. left: 0;
  136. width: 100%;
  137. text-align: right;
  138. // margin-bottom: 20rpx;
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: center;
  142. z-index: 999;
  143. .item {
  144. padding: 30rpx;
  145. }
  146. }
  147. .collapse-item {
  148. font-weight: 500;
  149. .item-box {
  150. font-size: 28rpx;
  151. color: #101010;
  152. // margin-bottom: 15rpx;
  153. line-height: 50rpx;
  154. }
  155. }
  156. }
  157. .header-box {
  158. width: 750rpx;
  159. height: 100rpx;
  160. background: #000;
  161. display: flex;
  162. align-items: center;
  163. padding: 0 30rpx;
  164. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  165. position: flex;
  166. top: var(--status-bar-height);
  167. left: 0;
  168. z-index: 1000;
  169. .box-center {
  170. flex: 1;
  171. text-align: center;
  172. margin-left: 180rpx;
  173. font-size: 34rpx;
  174. font-weight: bold;
  175. color: #fff;
  176. }
  177. .box-right {
  178. width: 180rpx;
  179. text-align: right;
  180. position: relative;
  181. height: calc(100% - 1px);
  182. overflow: hidden;
  183. /deep/ .wyb-drop-down-header {
  184. position: absolute;
  185. top: 0;
  186. left: 0;
  187. width: 100%;
  188. }
  189. /deep/ .wyb-drop-down-content {
  190. top: 88rpx;
  191. }
  192. }
  193. .top-box {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: center;
  197. width: 100%;
  198. height: 100rpx;
  199. z-index: 99999;
  200. .top-left {
  201. height: 100%;
  202. display: flex;
  203. align-items: center;
  204. flex-grow: 1;
  205. background-color: #e3e3e3;
  206. .logo-img {
  207. width: 314rpx;
  208. height: 43rpx;
  209. }
  210. }
  211. .top-right,
  212. .top-left {
  213. z-index: 99999;
  214. background-color: #ffffff;
  215. }
  216. .top-right {
  217. padding-left: 20rpx;
  218. height: 100%;
  219. display: flex;
  220. align-items: center;
  221. }
  222. }
  223. }
  224. </style>