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.

service.vue 5.0KB

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