index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="mine-container">
  3. <image class="top-bg" src="/static/image/home/top-bg.png" />
  4. <!-- 顶部背景区域 -->
  5. <view class="header-bg">
  6. <NavBar title="" color="#020202" :fixed="true" :bg="'transparent'">
  7. <template #left>
  8. <view class="left-title"></view>
  9. </template>
  10. </NavBar>
  11. <!-- 用户信息 -->
  12. <view class="user-info-section">
  13. <view class="avatar-wrapper">
  14. <image class="avatar" :src="cardInfo.avatar || '/static/image/public/avatar-default.png'" mode="aspectFill" />
  15. <image class="avatar-badge" src="/static/image/public/badge-icon.png" />
  16. </view>
  17. <view class="user-details">
  18. <view class="name-row">
  19. <text class="user-name">{{ cardInfo.nickName || '用户' }}</text>
  20. <text class="user-role">{{ cardInfo.postName || '职位' }}</text>
  21. </view>
  22. <text class="company-name">{{ cardInfo.companyName || '公司名称' }}</text>
  23. </view>
  24. <view class="qr-btn" @click="showCard">
  25. <image class="qr-icon" src="/static/image/public/qr-icon.png" />
  26. <text class="qr-text">我的名片</text>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 内容区域 -->
  31. <view class="content-section" >
  32. <!-- 线索数据卡片 -->
  33. <view class="data-card" v-if="false">
  34. <view class="card-header">
  35. <text class="card-title">线索数据</text>
  36. </view>
  37. <view class="data-row">
  38. <view class="data-item">
  39. <text class="data-value">{{ statisticsData.clueTotal.toLocaleString() }}</text>
  40. <text class="data-label">线索总数</text>
  41. </view>
  42. <view class="data-item highlight">
  43. <text class="data-value orange">{{ statisticsData.clueNewThisMonth.toLocaleString() }}</text>
  44. <text class="data-label">本月新增</text>
  45. </view>
  46. <view class="data-item">
  47. <text class="data-value">{{ statisticsData.clueMine.toLocaleString() }}</text>
  48. <text class="data-label">我的线索</text>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 客户数据卡片 -->
  53. <view class="data-card" v-if="false">
  54. <view class="card-header">
  55. <text class="card-title">客户数据</text>
  56. <uni-icons type="eye" size="20" color="#999999"></uni-icons>
  57. </view>
  58. <view class="data-row">
  59. <view class="data-item">
  60. <text class="data-value">{{ statisticsData.customerTotal.toLocaleString() }}</text>
  61. <text class="data-label">客户总数</text>
  62. </view>
  63. <view class="data-item highlight">
  64. <text class="data-value orange">{{ statisticsData.customerNewThisMonth.toLocaleString() }}</text>
  65. <text class="data-label">本月新增</text>
  66. </view>
  67. <view class="data-item">
  68. <text class="data-value">{{ statisticsData.customerMine.toLocaleString() }}</text>
  69. <text class="data-label">我的客户</text>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 商机数据卡片 -->
  74. <view class="data-card" v-if="false">
  75. <view class="card-header">
  76. <text class="card-title">商机数据</text>
  77. <uni-icons type="eye" size="20" color="#999999"></uni-icons>
  78. </view>
  79. <view class="data-row">
  80. <view class="data-item">
  81. <text class="data-value">{{ statisticsData.opportunityTotal.toLocaleString() }}</text>
  82. <text class="data-label">商机总数</text>
  83. </view>
  84. <view class="data-item highlight">
  85. <text class="data-value orange">{{ statisticsData.opportunityNewThisMonth.toLocaleString() }}</text>
  86. <text class="data-label">本月新增</text>
  87. </view>
  88. <view class="data-item">
  89. <text class="data-value">{{ statisticsData.opportunityMine.toLocaleString() }}</text>
  90. <text class="data-label">我的商机</text>
  91. </view>
  92. </view>
  93. </view>
  94. <!-- 功能菜单卡片 -->
  95. <view class="menu-card">
  96. <view class="menu-item" @click="navigateTo('guide')">
  97. <view class="menu-icon-wrapper icon-blue">
  98. <uni-icons type="help" size="24" color="#4A90E2"></uni-icons>
  99. </view>
  100. <text class="menu-text">使用指南</text>
  101. <uni-icons type="right" size="16" color="#cccccc"></uni-icons>
  102. </view>
  103. <view class="menu-divider"></view>
  104. <view class="menu-item" @click="navigateTo('service')">
  105. <view class="menu-icon-wrapper icon-blue">
  106. <uni-icons type="paperclip" size="24" color="#4A90E2"></uni-icons>
  107. </view>
  108. <text class="menu-text">联系客服</text>
  109. <uni-icons type="right" size="16" color="#cccccc"></uni-icons>
  110. </view>
  111. <view class="menu-divider"></view>
  112. <view class="menu-item" @click="navigateTo('about')">
  113. <view class="menu-icon-wrapper icon-blue">
  114. <uni-icons type="gear" size="24" color="#4A90E2"></uni-icons>
  115. </view>
  116. <text class="menu-text">关于我们</text>
  117. <uni-icons type="right" size="16" color="#cccccc"></uni-icons>
  118. </view>
  119. </view>
  120. <!-- 底部占位 -->
  121. <view class="bottom-spacer"></view>
  122. </view>
  123. </view>
  124. </template>
  125. <script setup>
  126. import {
  127. ref,
  128. onMounted
  129. } from 'vue'
  130. import NavBar from '@/components/nav-bar/index.vue'
  131. import {
  132. useUserStore
  133. } from '@/store/modules/user.js'
  134. import {
  135. storeToRefs
  136. } from 'pinia'
  137. // 使用 Pinia 管理用户状态
  138. const userStore = useUserStore()
  139. const { cardInfo, companyInfo } = storeToRefs(userStore)
  140. // 统计数据
  141. const statisticsData = ref({
  142. clueTotal: 0,
  143. clueNewThisMonth: 0,
  144. clueMine: 0,
  145. customerTotal: 0,
  146. customerNewThisMonth: 0,
  147. customerMine: 0,
  148. opportunityTotal: 0,
  149. opportunityNewThisMonth: 0,
  150. opportunityMine: 0
  151. })
  152. onMounted(async () => {
  153. // 如果没有数据,重新获取
  154. if (!cardInfo.value.nickName) {
  155. await userStore.queryCardInfo()
  156. }
  157. if (!companyInfo.value.name) {
  158. await userStore.queryCompanyInfo()
  159. }
  160. // 加载统计数据
  161. loadStatisticsData()
  162. })
  163. // 加载统计数据(后续对接真实 API)
  164. const loadStatisticsData = () => {
  165. // TODO: 调用统计 API 获取真实数据
  166. statisticsData.value = {
  167. clueTotal: 1266,
  168. clueNewThisMonth: 65,
  169. clueMine: 126,
  170. customerTotal: 1088,
  171. customerNewThisMonth: 123,
  172. customerMine: 235,
  173. opportunityTotal: 1366,
  174. opportunityNewThisMonth: 63,
  175. opportunityMine: 86
  176. }
  177. }
  178. const navigateTo = (page) => {
  179. uni.showToast({
  180. title: `功能开发中:${page}`,
  181. icon: 'none'
  182. })
  183. }
  184. // 显示名片
  185. const showCard = () => {
  186. uni.navigateTo({
  187. url: '/pages/mine/card'
  188. })
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .mine-container {
  193. background: #f5f6f8;
  194. }
  195. .top-bg {
  196. width: 750rpx;
  197. height: 634rpx;
  198. position: fixed;
  199. top: 0;
  200. left: 0;
  201. z-index: 1;
  202. }
  203. // 顶部背景区域
  204. .header-bg {
  205. padding: 0 40rpx;
  206. padding-bottom: 200rpx;
  207. position: relative;
  208. overflow: hidden;
  209. // 背景光效
  210. .bg-light {
  211. position: absolute;
  212. border-radius: 50%;
  213. background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  214. }
  215. .bg-light-1 {
  216. top: -150rpx;
  217. right: -100rpx;
  218. width: 500rpx;
  219. height: 500rpx;
  220. }
  221. .bg-light-2 {
  222. top: 200rpx;
  223. left: -200rpx;
  224. width: 400rpx;
  225. height: 400rpx;
  226. }
  227. // 顶部状态栏
  228. .header-top {
  229. display: flex;
  230. justify-content: space-between;
  231. align-items: center;
  232. margin-bottom: 60rpx;
  233. position: relative;
  234. z-index: 10;
  235. .header-left {
  236. width: 100rpx;
  237. }
  238. .header-right {
  239. display: flex;
  240. align-items: center;
  241. .more-btn,
  242. .refresh-btn {
  243. width: 64rpx;
  244. height: 64rpx;
  245. border-radius: 50%;
  246. background: rgba(255, 255, 255, 0.15);
  247. display: flex;
  248. align-items: center;
  249. justify-content: center;
  250. margin-left: 16rpx;
  251. }
  252. }
  253. }
  254. // 用户信息区域
  255. .user-info-section {
  256. display: flex;
  257. align-items: center;
  258. position: relative;
  259. z-index: 10;
  260. .avatar-wrapper {
  261. position: relative;
  262. margin-right: 24rpx;
  263. .avatar {
  264. width: 128rpx;
  265. height: 128rpx;
  266. border-radius: 50%;
  267. border: 4rpx solid rgba(255, 255, 255, 0.4);
  268. background: #ffffff;
  269. }
  270. .avatar-badge {
  271. position: absolute;
  272. bottom: -18rpx;
  273. right: -18rpx;
  274. width: 64rpx;
  275. height: 64rpx;
  276. background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  277. border-radius: 50%;
  278. border: 3rpx solid #ffffff;
  279. }
  280. }
  281. .user-details {
  282. flex: 1;
  283. .name-row {
  284. display: flex;
  285. align-items: center;
  286. margin-bottom: 12rpx;
  287. .user-name {
  288. font-size: 36rpx;
  289. font-weight: 600;
  290. color: #ffffff;
  291. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  292. }
  293. .user-role {
  294. font-size: 22rpx;
  295. color: #ffffff;
  296. background: rgba(255, 255, 255, 0.25);
  297. padding: 4rpx 16rpx;
  298. border-radius: 20rpx;
  299. margin-left: 16rpx;
  300. font-weight: 500;
  301. }
  302. }
  303. .company-name {
  304. font-size: 24rpx;
  305. color: rgba(255, 255, 255, 0.85);
  306. display: block;
  307. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  308. }
  309. }
  310. .qr-btn {
  311. display: flex;
  312. flex-direction: column;
  313. align-items: center;
  314. justify-content: center;
  315. .qr-icon {
  316. width: 48rpx;
  317. height: 48rpx;
  318. }
  319. .qr-text {
  320. font-size: 20rpx;
  321. color: #ffffff;
  322. margin-top: 4rpx;
  323. }
  324. }
  325. }
  326. }
  327. // 内容区域
  328. .content-section {
  329. margin-top: -160rpx;
  330. position: relative;
  331. z-index: 20;
  332. padding: 0 40rpx;
  333. }
  334. // 数据卡片
  335. .data-card {
  336. background: #ffffff;
  337. margin-bottom: 24rpx;
  338. padding: 32rpx;
  339. border-radius: 24rpx;
  340. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
  341. .card-header {
  342. display: flex;
  343. justify-content: space-between;
  344. align-items: center;
  345. margin-bottom: 24rpx;
  346. }
  347. .card-title {
  348. font-size: 28rpx;
  349. font-weight: 600;
  350. color: #333333;
  351. }
  352. .data-row {
  353. display: flex;
  354. justify-content: space-between;
  355. .data-item {
  356. display: flex;
  357. flex-direction: column;
  358. align-items: center;
  359. flex: 1;
  360. position: relative;
  361. .data-value {
  362. font-size: 40rpx;
  363. font-weight: 600;
  364. color: #333333;
  365. margin-bottom: 12rpx;
  366. font-family: DIN, 'DIN Alternate', sans-serif;
  367. }
  368. .data-label {
  369. font-size: 24rpx;
  370. color: #999999;
  371. }
  372. &.highlight .data-value {
  373. color: #ff6b35;
  374. }
  375. &:not(:last-child)::after {
  376. content: '';
  377. position: absolute;
  378. right: 0;
  379. top: 50%;
  380. transform: translateY(-50%);
  381. width: 1rpx;
  382. height: 60rpx;
  383. background: #f0f0f0;
  384. }
  385. }
  386. }
  387. }
  388. // 功能菜单卡片
  389. .menu-card {
  390. background: #ffffff;
  391. padding: 0 32rpx;
  392. border-radius: 24rpx;
  393. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
  394. .menu-item {
  395. display: flex;
  396. align-items: center;
  397. padding: 32rpx 0;
  398. .menu-icon-wrapper {
  399. width: 64rpx;
  400. height: 64rpx;
  401. border-radius: 16rpx;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. margin-right: 20rpx;
  406. &.icon-blue {
  407. background: rgba(74, 144, 226, 0.1);
  408. }
  409. }
  410. .menu-text {
  411. flex: 1;
  412. font-size: 28rpx;
  413. color: #333333;
  414. }
  415. }
  416. .menu-divider {
  417. height: 1rpx;
  418. background: #f0f0f0;
  419. }
  420. }
  421. // 底部占位
  422. .bottom-spacer {
  423. height: 40rpx;
  424. }
  425. </style>