You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 年之前
2 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="wrapper">
  3. <navBar title="九州ETC"></navBar>
  4. <view class="search-box">
  5. <image :src="`${$imgUrl}service/icon-search.png`" class="icon"></image>
  6. <input class="search" placeholder="请输入业务名称" />
  7. </view>
  8. <view class="content">
  9. <view class="left">
  10. <view v-for="(item,index) in menu.menuList" :key="index"
  11. :class="activeTab === item.name ? 'menu active' : 'menu'" @click="tabHandle(item.name,index)">
  12. <view :class="activeTab === item.name ? 'border on' : 'border'"></view>
  13. <view class="menu-text">{{item.name}}</view>
  14. </view>
  15. </view>
  16. <view class="right">
  17. <view class="right-content">
  18. <block v-if="menu.menuList.length >0">
  19. <view v-for="(item,index) in menu.menuList[tableSelectIndex].children" :key='index' class="item-box" @click="toNext(item.link)">
  20. <view class="item bg-blue" :style="{ '--background': bgBlue }">
  21. <image :src="`${$imgUrl}${item.iconPath}`" />
  22. </view>
  23. <view class="text">{{item.name}}</view>
  24. </view>
  25. </block>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script lang="ts" setup>
  32. import navBar from "@/components/nav-bar/nav-bar.vue";
  33. import {
  34. ref,
  35. reactive,
  36. } from "vue";
  37. import {
  38. onLoad
  39. } from "@dcloudio/uni-app";
  40. import {
  41. fileURL
  42. } from "@/datas/fileURL.js";
  43. import {
  44. msg
  45. } from "@/utils/utils";
  46. import {
  47. queryMenuConfig
  48. } from "@/utils/network/api.js";
  49. import {
  50. request
  51. } from "@/utils/network/request.js";
  52. import {
  53. getItem,
  54. StorageKeys,
  55. } from "@/utils/storage";
  56. import {
  57. stringToJson
  58. } from "@/utils/network/encryption";
  59. const bgOrange = `url(${fileURL}image/service/bg-orange.png) center center no-repeat`;
  60. const bgBlue = `url(${fileURL}image/service/bg-blue.png) center center no-repeat`;
  61. const activeTab = ref("业务服务");
  62. const tableSelectIndex = ref(0);
  63. // 切换
  64. function tabHandle(val, index) {
  65. activeTab.value = val;
  66. tableSelectIndex.value = index
  67. console.log(tableSelectIndex.value)
  68. }
  69. const menu = reactive({
  70. list: []
  71. });
  72. onLoad(() => {
  73. queryMenuConfigAction().then((val : any) => {
  74. menu.list = val.menuList??[]
  75. })
  76. });
  77. const queryMenuConfigAction = () => {
  78. var data = {
  79. openId: getItem(StorageKeys.OpenId),
  80. systemType: '6',
  81. loginSource: '69af303ba2eb4608a099163f0d2a5dbd'
  82. };
  83. const options = {
  84. type: 2,
  85. data: data,
  86. method: "POST",
  87. showLoading: true,
  88. };
  89. return new Promise(async (resolve, reject) => {
  90. const res = await request(queryMenuConfig, options);
  91. const data = stringToJson(res.bizContent);
  92. console.log("data",data.menuList)
  93. resolve(data);
  94. }).catch((error) => {
  95. reject(error);
  96. });
  97. }
  98. function toNext(url) {
  99. uni.navigateTo({
  100. url: url,
  101. });
  102. }
  103. </script>
  104. <style>
  105. page {
  106. height: 100%;
  107. }
  108. .wrapper {
  109. display: flex;
  110. background: linear-gradient(to left, #43a1e0 0%, #13e7c1 100%);
  111. flex-direction: column;
  112. height: 100%;
  113. }
  114. .search-box {
  115. margin: 50rpx 40rpx;
  116. height: 72rpx;
  117. border-radius: 36rpx;
  118. background: #f7f7f7;
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. }
  123. .search-box .icon {
  124. width: 48rpx;
  125. height: 48rpx;
  126. margin: 0 20rpx;
  127. }
  128. .search-box .search {
  129. flex: 1;
  130. margin-right: 20rpx;
  131. height: 100%;
  132. padding: 0 10rpx;
  133. font-size: 28rpx;
  134. color: #00b38b;
  135. }
  136. .content {
  137. display: flex;
  138. flex: 1;
  139. flex-grow: 1;
  140. background: #fff;
  141. border-radius: 30rpx 30rpx 0 0;
  142. padding-top: 40rpx;
  143. }
  144. .left {
  145. width: 180rpx;
  146. border-right: 1px solid #dcdcdc;
  147. margin-right: 29rpx;
  148. }
  149. .left .menu-text {
  150. font-size: 26rpx;
  151. color: #666666;
  152. width: 120rpx;
  153. }
  154. .left .menu {
  155. padding-left: 15rpx;
  156. display: flex;
  157. align-items: center;
  158. margin: 20rpx 0 60rpx 0;
  159. }
  160. .left .active .menu-text {
  161. font-weight: bold;
  162. color: #00b38b;
  163. font-size: 28rpx;
  164. line-height: 32rpx;
  165. }
  166. .left .border {
  167. width: 9rpx;
  168. height: 26rpx;
  169. border-radius: 4rpx;
  170. margin-right: 20rpx;
  171. }
  172. .left .on {
  173. background: linear-gradient(0deg, #43a1e0 0%, #13e7c1 100%);
  174. font-size: 28rpx;
  175. }
  176. .right {
  177. flex: 1;
  178. }
  179. .right-content {
  180. display: flex;
  181. flex-wrap: wrap;
  182. }
  183. .right .item-box {
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: center;
  187. align-items: center;
  188. margin-right: 30rpx;
  189. margin-bottom: 39rpx;
  190. }
  191. .item {
  192. width: 105rpx;
  193. height: 105rpx;
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. border-radius: 20rpx;
  198. }
  199. .item image {
  200. width: 64rpx;
  201. height: 64rpx;
  202. }
  203. .right .text {
  204. width: 105rpx;
  205. font-size: 22rpx;
  206. text-align: center;
  207. height: 60rpx;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. margin-top: 19rpx;
  212. color: #666666;
  213. }
  214. .bg-blue {
  215. background: var(--background);
  216. }
  217. .bg-orange {
  218. background: var(--background);
  219. }
  220. .right .text-orange {
  221. color: #fd8362;
  222. }
  223. </style>