index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="content">
  3. <view class="swiper-item" style="padding: 0 15px;" v-show="current == 0">
  4. <view class="chart-box">
  5. <canvas canvas-id="chartBox" id="chartBox" class="chart-canvas" force-use-old-canvas="true"></canvas>
  6. </view>
  7. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="goToTodayEnroll()">查看详情</u-button>
  8. <view class="section-title" style="margin-top: 40px;">
  9. <u-image width="20px" height="10px" :src="sectionIcon"></u-image>
  10. <u-section title="场馆推荐" sub-title="查看更多" font-size="32" :show-line="false" @click="goToVenueList()"></u-section>
  11. </view>
  12. <u-card :show-head="false" :show-foot="false" :border="false" margin="0px">
  13. <view class="class-show-box" slot="body">
  14. <view v-for="(item, index) in videoList" :key="index" class="class-show-card" @click="goToVenueDetail(item)">
  15. <u-image :src="item.url" mode="aspectFill" height="30vw" border-radius="10px"></u-image>
  16. <view class="class-show-name">{{item.name}}</view>
  17. </view>
  18. </view>
  19. </u-card>
  20. </view>
  21. <view class="swiper-item" v-show="current == 1">
  22. <view class="enroll-fix-box">
  23. <view class="enroll-button" @click="goToAddForm('enrolledForm')">
  24. <view class="enroll-img">
  25. <u-image :src="enrolledIcon" mode="aspectFit" width="34px" height="34px"></u-image>
  26. </view>
  27. <view class="enroll-text">已报名</view>
  28. </view>
  29. <view class="enroll-button" @click="goToAddForm('intentionForm')">
  30. <view class="enroll-img">
  31. <u-image :src="intentionIcon" mode="aspectFit" width="34px" height="34px"></u-image>
  32. </view>
  33. <view class="enroll-text">有意向</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="swiper-item" v-show="current == 2">
  38. <view class="user-info">
  39. <view class="user-data">
  40. <view class="user-name">{{userData.nickName}}</view>
  41. <view class="user-phone">{{userData.phone}}</view>
  42. </view>
  43. <view class="user-img">
  44. <u-avatar :src="userData.headImage" size="160"></u-avatar>
  45. </view>
  46. </view>
  47. <view class="user-handle" v-for="(item, index) in handleList" :key="index" @click="goToHandle(item)">
  48. <view class="handle-icon">
  49. <u-image :src="item.icon" mode="aspectFit" width="28px" height="28px"></u-image>
  50. </view>
  51. <view class="handle-label">{{item.label}}</view>
  52. <view class="handle-arrow">
  53. <u-icon name="arrow-right" color="#cccccc" size="32"></u-icon>
  54. </view>
  55. </view>
  56. </view>
  57. <u-top-tips ref="uTips"></u-top-tips>
  58. <u-tabbar v-model="current" :list="tabbarList" :mid-button="true" :active-color="mainColor" inactive-color="#cccccc"
  59. icon-size="60"></u-tabbar>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. mapGetters
  65. } from 'vuex'
  66. import uCharts from '@/js_sdk/u-charts/u-charts/u-charts.min.js';
  67. const NET = require('@/utils/request')
  68. const API = require('@/config/api')
  69. var _self;
  70. let chartBox = null;
  71. export default {
  72. computed: {
  73. ...mapGetters([
  74. 'mainColor',
  75. 'customStyle',
  76. ])
  77. },
  78. data() {
  79. return {
  80. cWidth: '',
  81. longitude: '',
  82. latitude: '',
  83. sectionIcon: API.getServerImg + 'biaoti.png',
  84. enrolledIcon: API.getServerImg + 'yibaoming.png ',
  85. intentionIcon: API.getServerImg + 'yixiangkehu.png',
  86. videoList: [],
  87. current: 0,
  88. tabbarList: [{
  89. iconPath: "../../../static/images/icon-index.png",
  90. selectedIconPath: "../../../static/images/icon-index-active.png",
  91. text: '首页',
  92. customIcon: false,
  93. },
  94. {
  95. iconPath: "plus-circle-fill",
  96. selectedIconPath: "close-circle-fill",
  97. text: '新增',
  98. midButton: true,
  99. customIcon: false,
  100. },
  101. {
  102. iconPath: "../../../static/images/icon-mine.png",
  103. selectedIconPath: "../../../static/images/icon-mine-active.png",
  104. text: '我的',
  105. customIcon: false,
  106. },
  107. ],
  108. userData: {
  109. headImage: '',
  110. userId: '',
  111. nickName: '',
  112. userName: '',
  113. phone: '',
  114. },
  115. handleList: [{
  116. label: '全部客户',
  117. path: 'customerList',
  118. icon: API.getServerImg + 'kehu.png'
  119. },
  120. {
  121. label: '营销业绩排行',
  122. path: 'marketRankList',
  123. icon: API.getServerImg + 'paihang.png'
  124. },
  125. {
  126. label: '续费提醒',
  127. path: 'renewList',
  128. icon: API.getServerImg + 'xufeitixing.png'
  129. },
  130. {
  131. label: '消息通知',
  132. path: 'messageList',
  133. icon: API.getServerImg + 'xiaoxi.png'
  134. },
  135. {
  136. label: '数据统计',
  137. path: 'dataCensus',
  138. icon: API.getServerImg + 'shujutongji.png'
  139. },
  140. {
  141. label: '我的二维码',
  142. path: 'shareInfo',
  143. icon: API.getServerImg + 'erweima.png'
  144. },
  145. {
  146. label: '退出登录',
  147. path: 'logout',
  148. icon: API.getServerImg + 'kehu.png'
  149. },
  150. ]
  151. }
  152. },
  153. onLoad() {
  154. // _self = this; // 浏览器调试时需要打开,微信调试时需关闭
  155. if (!uni.getStorageSync('token')) {
  156. uni.navigateTo({
  157. url: '/pages/login/index'
  158. });
  159. }
  160. },
  161. onReady() {
  162. this.cWidth = uni.upx2px(750) - 30;
  163. },
  164. onShow() {
  165. if (uni.getStorageSync('userData')) {
  166. this.userData = uni.getStorageSync('userData')
  167. }
  168. uni.getLocation({
  169. type: 'wgs84',
  170. geocode: true,
  171. success: (res) => {
  172. uni.setStorage({
  173. key: 'locationData',
  174. data: {
  175. longitude: res.longitude,
  176. latitude: res.latitude,
  177. }
  178. })
  179. this.initialize()
  180. }
  181. });
  182. },
  183. onPullDownRefresh() {
  184. this.initialize()
  185. setTimeout(() => {
  186. uni.stopPullDownRefresh();
  187. }, 500)
  188. },
  189. methods: {
  190. // 获取初始化数据
  191. initialize() {
  192. NET.request(API.getCensusChart, {}, 'POST').then(res => {
  193. let option = {
  194. $this: _self,
  195. canvasId: "chartBox",
  196. type: 'column',
  197. width: this.cWidth,
  198. height: 200,
  199. padding: [20, 10, 10, 10],
  200. pixelRatio: 1,
  201. animation: true,
  202. background: '#FFFFFF',
  203. fontSize: 11,
  204. xAxis: {
  205. type: 'grid',
  206. gridType: 'dash',
  207. disableGrid: true,
  208. itemCount: 10,
  209. },
  210. yAxis: {},
  211. categories: res.data.customerCreateListRes.map(site => {
  212. return site.week
  213. }),
  214. legend: {
  215. show: false
  216. },
  217. series: [{
  218. name: "",
  219. color: "#fcbd71",
  220. data: res.data.customerCreateListRes.map(site => {
  221. return site.newCount
  222. })
  223. }],
  224. }
  225. chartBox = new uCharts(option)
  226. }).catch(error => {
  227. this.$refs.uTips.show({
  228. title: error.message,
  229. type: 'warning',
  230. })
  231. })
  232. NET.request(API.getNearVenueList, uni.getStorageSync('locationData'), 'POST').then(res => {
  233. this.videoList = res.data
  234. }).catch(error => {
  235. this.$refs.uTips.show({
  236. title: error.message,
  237. type: 'warning',
  238. })
  239. })
  240. },
  241. // 跳转今日新增
  242. goToTodayEnroll() {
  243. uni.navigateTo({
  244. url: '/pagesEnroll/todayEnroll'
  245. });
  246. },
  247. // 跳转所有场馆
  248. goToVenueList() {
  249. uni.navigateTo({
  250. url: '/pagesEnroll/venueList'
  251. });
  252. },
  253. // 跳转场馆详情
  254. goToVenueDetail(item) {
  255. uni.navigateTo({
  256. url: '/pagesEnroll/venueDetail?id=' + item.id
  257. });
  258. },
  259. // 跳转添加信息
  260. goToAddForm(path) {
  261. uni.removeStorageSync('defaultClass');
  262. uni.navigateTo({
  263. url: '/pagesEnroll/' + path
  264. });
  265. },
  266. // 跳转我的各列表界面
  267. goToHandle(site) {
  268. if(site.path == 'logout'){
  269. uni.removeStorageSync('token')
  270. uni.navigateTo({
  271. url: '/pages/login/index'
  272. });
  273. }else{
  274. uni.navigateTo({
  275. url: '/pagesMain/' + site.path
  276. });
  277. }
  278. }
  279. },
  280. }
  281. </script>
  282. <style lang="scss" scoped>
  283. @import "@/static/css/themes.scss";
  284. .content {
  285. width: 100%;
  286. float: left;
  287. .swiper-item {
  288. width: 100%;
  289. height: calc(100vh - 50px);
  290. position: relative;
  291. }
  292. .chart-box {
  293. width: 100%;
  294. height: 240px;
  295. float: left;
  296. padding: 20px 0;
  297. display: flex;
  298. .chart-canvas {
  299. width: 100% !important;
  300. height: 200px !important;
  301. float: left;
  302. }
  303. }
  304. .section-title {
  305. width: 100%;
  306. height: 28px;
  307. display: flex;
  308. align-items: center;
  309. u-section {
  310. margin-left: 10px;
  311. flex: 1;
  312. }
  313. }
  314. .class-show-box {
  315. width: calc(100% + 32px);
  316. margin: 0 -16px;
  317. float: left;
  318. padding-bottom: 50px;
  319. .class-show-card {
  320. width: calc(50% - 16px);
  321. margin: 0 8px 16px 8px;
  322. float: left;
  323. .class-show-name {
  324. width: 100%;
  325. text-align: center;
  326. line-height: 18px;
  327. font-size: 12px;
  328. margin-top: 5px;
  329. }
  330. }
  331. }
  332. .enroll-fix-box {
  333. width: 100%;
  334. height: 90px;
  335. position: absolute;
  336. bottom: 40px;
  337. left: 0;
  338. display: flex;
  339. justify-content: space-around;
  340. .enroll-button {
  341. width: 60px;
  342. height: 90px;
  343. .enroll-img {
  344. width: 60px;
  345. height: 60px;
  346. padding-left: 5px;
  347. border-radius: 50%;
  348. background-color: #ffffff;
  349. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. }
  354. .enroll-text {
  355. width: 60px;
  356. height: 20px;
  357. margin-top: 10px;
  358. line-height: 20px;
  359. font-size: 14px;
  360. text-align: center;
  361. white-space: nowrap;
  362. }
  363. }
  364. }
  365. .user-info {
  366. width: 100%;
  367. height: 110px;
  368. margin-bottom: 20px;
  369. float: left;
  370. background-color: $mainColor;
  371. .user-data {
  372. width: calc(100% - 110px);
  373. height: 110px;
  374. padding: 15px 0 15px 15px;
  375. float: left;
  376. .user-name {
  377. width: 100%;
  378. float: left;
  379. font-size: 24px;
  380. color: #FFFFFF;
  381. line-height: 30px;
  382. margin: 10px 0;
  383. white-space: nowrap;
  384. overflow: hidden;
  385. text-overflow: ellipsis;
  386. }
  387. .user-phone {
  388. width: 100%;
  389. color: #FFFFFF;
  390. line-height: 20px;
  391. float: left;
  392. white-space: nowrap;
  393. overflow: hidden;
  394. text-overflow: ellipsis;
  395. }
  396. }
  397. .user-img {
  398. width: 110px;
  399. height: 110px;
  400. padding: 15px;
  401. float: left;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. }
  406. }
  407. .user-handle {
  408. width: 100vw;
  409. height: 40px;
  410. float: left;
  411. padding: 0 15px;
  412. margin-bottom: 10px;
  413. display: flex;
  414. align-items: center;
  415. .handle-icon {
  416. width: 40px;
  417. height: 40px;
  418. text-align: center;
  419. line-height: 40px;
  420. display: flex;
  421. align-items: center;
  422. }
  423. .handle-label {
  424. height: 40px;
  425. flex: 1;
  426. margin-left: 10px;
  427. line-height: 40px;
  428. font-size: 15px;
  429. }
  430. .handle-arrow {
  431. line-height: 40px;
  432. }
  433. }
  434. }
  435. </style>