home.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <bgImg />
  3. <view class="container">
  4. <view class="nav">
  5. <view class="slid">
  6. <swiper class="swiper" circular :indicator-dots="true" :autoplay="true" interval="2000" duration="500">
  7. <swiper-item v-for="(item, index) in state.slidImg" :key="index">
  8. <image :src="item" mode="" style="width: 100%;height: 100%;"></image>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. </view>
  13. <!-- 公告 -->
  14. <view class="notices">
  15. <view class="title">
  16. <image src="@/static/SVG/公告资讯.svg" style="width: 70rpx;height: 70rpx;" mode=""></image>
  17. </view>
  18. <view class="news">
  19. <view class="btn" v-for="(item, index) in state.noticeList" :key="index">最新</view>
  20. </view>
  21. <view class="box">
  22. <view class="bar" v-for="(item, index) in state.noticeList" :key="index">
  23. <up-notice-bar icon='' bgColor="white" color="black" :text="changeContent(item)"></up-notice-bar>
  24. </view>
  25. </view>
  26. </view>
  27. <uni-section title="决策支持" titleColor="#038CFF" type="line" :padding="false">
  28. <view class="board">
  29. <view class="box">
  30. <view class="text">管理驾驶舱</view>
  31. <image src="@/static/SVG/智能驾驶舱.svg" style="width: 100%;height: 100%;" mode=""></image>
  32. </view>
  33. <view class="box">
  34. <view class="text">全景图</view>
  35. <image src="@/static/SVG/数据看板.svg" style="width: 100%;height: 100%;" mode=""></image>
  36. </view>
  37. </view>
  38. </uni-section>
  39. <uni-section title="营销赋能" titleColor="#038CFF" type="line" :padding="false">
  40. <uni-grid :column="4" :showBorder="false" :highlight="true">
  41. <uni-grid-item>
  42. <view class="grid-item-box">
  43. <image src="@/static/SVG/进销存分析.svg" class="img" mode=""></image>
  44. <text class="text">进销存分析</text>
  45. </view>
  46. </uni-grid-item>
  47. <uni-grid-item>
  48. <view class="grid-item-box">
  49. <image src="@/static/SVG/客户分析.svg" class="img" mode=""></image>
  50. <text class="text">客户分析</text>
  51. </view>
  52. </uni-grid-item>
  53. <uni-grid-item>
  54. <view class="grid-item-box">
  55. <image src="@/static/SVG/订单分析.svg" class="img" mode=""></image>
  56. <text class="text">订单分析</text>
  57. </view>
  58. </uni-grid-item>
  59. <uni-grid-item>
  60. <view class="grid-item-box">
  61. <image src="@/static/SVG/活动赋能.svg" class="img" mode=""></image>
  62. <text class="text">活动赋能</text>
  63. </view>
  64. </uni-grid-item>
  65. <uni-grid-item>
  66. <view class="grid-item-box">
  67. <image src="@/static/SVG/终端概览.svg" class="img" mode=""></image>
  68. <text class="text">客户档案</text>
  69. </view>
  70. </uni-grid-item>
  71. <uni-grid-item>
  72. <view class="grid-item-box">
  73. <image src="@/static/城市纯销.png" class="img" mode=""></image>
  74. <text class="text">城市纯销</text>
  75. </view>
  76. </uni-grid-item>
  77. </uni-grid>
  78. </uni-section>
  79. <uni-section title="智能预警" titleColor="#038CFF" type="line" :padding="false">
  80. <uni-grid :column="4" :showBorder="false" :highlight="true">
  81. <uni-grid-item>
  82. <view class="grid-item-box">
  83. <image src="@/static/SVG/客户库存预警.svg" class="img" mode=""></image>
  84. <text class="text">客户库存预警</text>
  85. </view>
  86. </uni-grid-item>
  87. <uni-grid-item>
  88. <view class="grid-item-box">
  89. <image src="@/static/SVG/客户风险预警.svg" class="img" mode=""></image>
  90. <text class="text">渠道风险预警</text>
  91. </view>
  92. </uni-grid-item>
  93. </uni-grid>
  94. </uni-section>
  95. <uni-section title="鱼跃龙门" titleColor="#038CFF" type="line" :padding="false">
  96. <uni-grid :column="4" :showBorder="false" :highlight="true">
  97. <uni-grid-item>
  98. <view class="grid-item-box" @click="goScan">
  99. <view class="img-box">
  100. <image src="@/traceCodePackages/static/images/scan.png" class="img" mode=""></image>
  101. </view>
  102. <text class="text">溯源扫码</text>
  103. </view>
  104. </uni-grid-item>
  105. <uni-grid-item>
  106. <view class="grid-item-box" @click="goReport">
  107. <view class="img-box">
  108. <image src="@/traceCodePackages/static/images/report.png" class="img" mode=""></image>
  109. </view>
  110. <text class="text">溯源报表</text>
  111. </view>
  112. </uni-grid-item>
  113. </uni-grid>
  114. </uni-section>
  115. <view style="height: 140rpx;"></view>
  116. </view>
  117. </template>
  118. <script setup>
  119. import useCounterStore from '@/stores/counter.js';
  120. import {
  121. ref,
  122. getCurrentInstance,
  123. reactive,
  124. onMounted
  125. } from 'vue';
  126. import {
  127. onReady,
  128. onShow,
  129. onLoad
  130. } from '@dcloudio/uni-app'
  131. import {
  132. Storage
  133. } from '@/service/storage'
  134. const storage = new Storage()
  135. const {
  136. proxy
  137. } = getCurrentInstance()
  138. const counterStore = useCounterStore()
  139. const menu = reactive({
  140. menu: uni.getStorageSync('menu').menu
  141. })
  142. const changeContent = (e) => {
  143. const isoDateString = e.msgDate;
  144. const date = new Date(isoDateString);
  145. const year = date.getFullYear();
  146. const month = String(date.getMonth() + 1).padStart(2, '0');
  147. const day = String(date.getDate()).padStart(2, '0');
  148. const formattedDate = `${year}-${month}-${day}`;
  149. let data = formattedDate + ' ' + e.msgContent.replace(/\n/g, ' ')
  150. return data
  151. }
  152. const state = reactive({
  153. noticeList: [],
  154. slideId: [],
  155. slidImg: []
  156. })
  157. onMounted(() => {
  158. const baseUrl = import.meta.env.VITE_APP_API_BASEURL
  159. const accessToken = uni.getStorageSync('accessToken')
  160. uni.request({
  161. url: baseUrl + '/v1/api/basic/home/menu?type=3',
  162. method: 'GET',
  163. header: {
  164. accessToken
  165. },
  166. success: (res) => {
  167. console.log(res)
  168. },
  169. fail(res) {
  170. console.log(res)
  171. }
  172. })
  173. getUserInfo()
  174. })
  175. const getUserInfo = async () => {
  176. let res = await proxy.$api.login.getInfo()
  177. uni.setStorageSync('userInfo', res.data)
  178. }
  179. const skip = (url) => {
  180. let posn = uni.getStorageSync('userInfo').posn
  181. uni.navigateTo({
  182. url
  183. })
  184. }
  185. // 跳转溯源扫码
  186. const goScan = () => {
  187. uni.navigateTo({
  188. url: '/traceCodePackages/traceabilityCodeQuery/pages/index'
  189. })
  190. }
  191. // 跳转溯源报表
  192. const goReport = () => {
  193. uni.navigateTo({
  194. url: "/traceCodePackages/traceabilityReport/pages/index",
  195. });
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .container {
  200. position: absolute;
  201. width: 750rpx;
  202. top: 150rpx;
  203. z-index: -1;
  204. }
  205. .board {
  206. width: 95%;
  207. height: 170rpx;
  208. // background-color: red;
  209. margin: auto;
  210. display: flex;
  211. justify-content: space-between;
  212. align-items: center;
  213. .box {
  214. width: 332rpx;
  215. height: 165rpx;
  216. // background-color: green;
  217. border-radius: 20rpx;
  218. position: relative;
  219. .text {
  220. position: absolute;
  221. top: 40rpx;
  222. left: 30rpx;
  223. color: #FFFFFF;
  224. }
  225. }
  226. }
  227. .nav {
  228. width: 100%;
  229. padding-top: 20rpx;
  230. padding-bottom: 5rpx;
  231. background-color: transparent;
  232. .slid {
  233. width: 690rpx;
  234. height: 294rpx;
  235. margin: 30rpx auto;
  236. position: relative;
  237. }
  238. }
  239. .notices {
  240. width: 690rpx;
  241. height: 122rpx;
  242. margin: 0rpx auto;
  243. background-color: white;
  244. border-radius: 15rpx;
  245. box-shadow: 5rpx 5rpx 20rpx rgba(0, 0, 0, 0.2);
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-evenly;
  249. .news {
  250. width: 12%;
  251. height: 100%;
  252. display: flex;
  253. flex-wrap: wrap;
  254. align-items: center;
  255. justify-content: center;
  256. }
  257. .title {
  258. width: 18%;
  259. height: 100%;
  260. text-align: center;
  261. display: flex;
  262. flex-wrap: wrap;
  263. justify-content: center;
  264. align-items: center;
  265. font-weight: bold;
  266. }
  267. .btn {
  268. background-color: #fef0ef;
  269. width: 100%;
  270. height: 50rpx;
  271. color: #ec204c;
  272. font-size: 25rpx;
  273. display: flex;
  274. align-items: center;
  275. justify-content: center;
  276. border-radius: 5rpx;
  277. }
  278. .box {
  279. width: 70%;
  280. height: 100%;
  281. display: flex;
  282. flex-wrap: wrap;
  283. align-items: center;
  284. position: relative;
  285. .bar {
  286. width: 100%;
  287. height: 45rpx;
  288. display: flex;
  289. align-items: center;
  290. overflow: hidden;
  291. }
  292. }
  293. }
  294. .grid-item-box {
  295. flex: 1;
  296. /* #ifndef APP-NVUE */
  297. display: flex;
  298. /* #endif */
  299. flex-direction: column;
  300. align-items: center;
  301. justify-content: center;
  302. background-color: #fff;
  303. .img {
  304. width: 76rpx;
  305. height: 76rpx;
  306. }
  307. .text {
  308. font-size: 27rpx;
  309. margin-top: 5px;
  310. }
  311. .img-box {
  312. width: 76rpx;
  313. height: 76rpx;
  314. border-radius: 50%;
  315. background-color: #379AFF;
  316. display: flex;
  317. align-items: center;
  318. justify-content: center;
  319. .img {
  320. width: 40rpx;
  321. height: 40rpx;
  322. }
  323. }
  324. }
  325. </style>