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. <image src="@/traceCodePackages/static/images/scan.png" class="img" mode=""></image>
  100. <text class="text">溯源扫码</text>
  101. </view>
  102. </uni-grid-item>
  103. <uni-grid-item>
  104. <view class="grid-item-box" @click="goReport">
  105. <image src="@/traceCodePackages/static/images/report.png" class="img" mode=""></image>
  106. <text class="text">溯源报表</text>
  107. </view>
  108. </uni-grid-item>
  109. </uni-grid>
  110. </uni-section>
  111. <view style="height: 140rpx;"></view>
  112. </view>
  113. </template>
  114. <script setup>
  115. import useCounterStore from '@/stores/counter.js';
  116. import {
  117. ref,
  118. getCurrentInstance,
  119. reactive,
  120. onMounted
  121. } from 'vue';
  122. import {
  123. onReady,
  124. onShow,
  125. onLoad
  126. } from '@dcloudio/uni-app'
  127. import {
  128. Storage
  129. } from '@/service/storage'
  130. const storage = new Storage()
  131. const {
  132. proxy
  133. } = getCurrentInstance()
  134. const counterStore = useCounterStore()
  135. const menu = reactive({
  136. menu: uni.getStorageSync('menu').menu
  137. })
  138. const changeContent = (e) => {
  139. const isoDateString = e.msgDate;
  140. const date = new Date(isoDateString);
  141. const year = date.getFullYear();
  142. const month = String(date.getMonth() + 1).padStart(2, '0');
  143. const day = String(date.getDate()).padStart(2, '0');
  144. const formattedDate = `${year}-${month}-${day}`;
  145. let data = formattedDate + ' ' + e.msgContent.replace(/\n/g, ' ')
  146. return data
  147. }
  148. const state = reactive({
  149. noticeList: [],
  150. slideId: [],
  151. slidImg: []
  152. })
  153. onMounted(() => {
  154. const baseUrl = import.meta.env.VITE_APP_API_BASEURL
  155. const accessToken = uni.getStorageSync('accessToken')
  156. uni.request({
  157. url: baseUrl + '/v1/api/basic/home/menu?type=3',
  158. method: 'GET',
  159. header: {
  160. accessToken
  161. },
  162. success: (res) => {
  163. console.log(res)
  164. },
  165. fail(res) {
  166. console.log(res)
  167. }
  168. })
  169. getUserInfo()
  170. })
  171. const getUserInfo = async () => {
  172. let res = await proxy.$api.login.getInfo()
  173. uni.setStorageSync('userInfo', res.data)
  174. }
  175. const skip = (url) => {
  176. let posn = uni.getStorageSync('userInfo').posn
  177. uni.navigateTo({
  178. url
  179. })
  180. }
  181. // 跳转溯源扫码
  182. const goScan = () => {
  183. uni.navigateTo({
  184. url: '/traceCodePackages/traceabilityCodeQuery/pages/index'
  185. })
  186. }
  187. // 跳转溯源报表
  188. const goReport = () => {
  189. uni.navigateTo({
  190. url: "/traceCodePackages/traceabilityReport/pages/index",
  191. });
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .container {
  196. position: absolute;
  197. width: 750rpx;
  198. top: 150rpx;
  199. z-index: -1;
  200. }
  201. .board {
  202. width: 95%;
  203. height: 170rpx;
  204. // background-color: red;
  205. margin: auto;
  206. display: flex;
  207. justify-content: space-between;
  208. align-items: center;
  209. .box {
  210. width: 332rpx;
  211. height: 165rpx;
  212. // background-color: green;
  213. border-radius: 20rpx;
  214. position: relative;
  215. .text {
  216. position: absolute;
  217. top: 40rpx;
  218. left: 30rpx;
  219. color: #FFFFFF;
  220. }
  221. }
  222. }
  223. .nav {
  224. width: 100%;
  225. padding-top: 20rpx;
  226. padding-bottom: 5rpx;
  227. background-color: transparent;
  228. .slid {
  229. width: 690rpx;
  230. height: 294rpx;
  231. margin: 30rpx auto;
  232. position: relative;
  233. }
  234. }
  235. .notices {
  236. width: 690rpx;
  237. height: 122rpx;
  238. margin: 0rpx auto;
  239. background-color: white;
  240. border-radius: 15rpx;
  241. box-shadow: 5rpx 5rpx 20rpx rgba(0, 0, 0, 0.2);
  242. display: flex;
  243. align-items: center;
  244. justify-content: space-evenly;
  245. .news {
  246. width: 12%;
  247. height: 100%;
  248. display: flex;
  249. flex-wrap: wrap;
  250. align-items: center;
  251. justify-content: center;
  252. }
  253. .title {
  254. width: 18%;
  255. height: 100%;
  256. text-align: center;
  257. display: flex;
  258. flex-wrap: wrap;
  259. justify-content: center;
  260. align-items: center;
  261. font-weight: bold;
  262. }
  263. .btn {
  264. background-color: #fef0ef;
  265. width: 100%;
  266. height: 50rpx;
  267. color: #ec204c;
  268. font-size: 25rpx;
  269. display: flex;
  270. align-items: center;
  271. justify-content: center;
  272. border-radius: 5rpx;
  273. }
  274. .box {
  275. width: 70%;
  276. height: 100%;
  277. display: flex;
  278. flex-wrap: wrap;
  279. align-items: center;
  280. position: relative;
  281. .bar {
  282. width: 100%;
  283. height: 45rpx;
  284. display: flex;
  285. align-items: center;
  286. overflow: hidden;
  287. }
  288. }
  289. }
  290. .grid-item-box {
  291. flex: 1;
  292. /* #ifndef APP-NVUE */
  293. display: flex;
  294. /* #endif */
  295. flex-direction: column;
  296. align-items: center;
  297. justify-content: center;
  298. background-color: #fff;
  299. .img {
  300. width: 76rpx;
  301. height: 76rpx;
  302. }
  303. .text {
  304. font-size: 27rpx;
  305. margin-top: 5px;
  306. }
  307. .img-box {
  308. width: 76rpx;
  309. height: 76rpx;
  310. border-radius: 50%;
  311. background-color: #379AFF;
  312. display: flex;
  313. align-items: center;
  314. justify-content: center;
  315. .img {
  316. width: 40rpx;
  317. height: 40rpx;
  318. }
  319. }
  320. }
  321. </style>