info.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <view class="left" @tap="toEdit(info)">
  5. <view class="left_1">
  6. <image class="image" mode="aspectFill" :src="info.logo||'/static/qiudui.png'">
  7. </image>
  8. </view>
  9. <view class="right_1">
  10. <view class="name">{{info.name||'暂无名称'}}</view>
  11. <view class="ranking">{{info.ranking||'暂无排名'}}</view>
  12. </view>
  13. </view>
  14. <view class="right">
  15. <button type="warn" size="mini" @tap="toSave">
  16. <uni-icons type="plusempty" size="12" color="#ffffff"></uni-icons>
  17. <text>创建</text>
  18. </button>
  19. </view>
  20. </view>
  21. <view class="position">
  22. <view class="two">
  23. <view class="two_1">
  24. 创建活动,还可以微信、短信通知队员报名
  25. </view>
  26. <view class="two_2">
  27. <button type="warn" size="mini" @tap="toSave">创建</button>
  28. </view>
  29. <view class="two_3" @tap="toInfo({route: '/pagesHome/activity/index'})">
  30. <uni-icons type="list" size="18"></uni-icons>
  31. <text>查看全部活动</text>
  32. </view>
  33. </view>
  34. <view class="thr">
  35. <view class="thr_1">
  36. <view class="list" v-for="(item, index) in menuList" :key="index" @tap="toInfo(item)">
  37. <uni-icons custom-prefix="iconfont" :type="item.icon" size="25" :color="item.color"></uni-icons>
  38. <view class="name">{{item.name}}</view>
  39. </view>
  40. </view>
  41. <view class="thr_2">
  42. <view class="fraction">
  43. <view class="top">{{total||0}}</view>
  44. <view class="bottom">总比赛</view>
  45. </view>
  46. <view class="circle">
  47. <circle :pro="16/100" :border_back_color="'#f1f1f1'" :border_color="'#FF0000'" content="16">
  48. </circle>
  49. <text>胜</text>
  50. </view>
  51. <view class="circle">
  52. <circle :pro="5/100" :border_back_color="'#f1f1f1'" :border_color="'#35BD7B'" content="5">
  53. </circle>
  54. <text>平</text>
  55. </view>
  56. <view class="circle">
  57. <circle :pro="17/100" :border_back_color="'#f1f1f1'" :border_color="'#FFA500'" content="17">
  58. </circle>
  59. <text>负</text>
  60. </view>
  61. <uni-icons type="forward" size="25" color="#858585"></uni-icons>
  62. </view>
  63. </view>
  64. <view class="four">
  65. <view class="four_1">
  66. <view class="left">
  67. 球队历程
  68. </view>
  69. <view class="right" @tap="toInfo({route: '/pagesHome/team/album'})">
  70. <uni-icons custom-prefix="iconfont" type="icon-xiangce" size="20" color="#333333"></uni-icons>
  71. <view class="name">去相册</view>
  72. </view>
  73. </view>
  74. <view class="four_2">
  75. <view class="list" v-for="(item, index) in list" :key="index" @tap="toActivity(item)">
  76. <view class="list_1">
  77. <view class="date">
  78. {{moment(item.startTime).format('MM-DD')||'暂无日期'}}
  79. {{getDayOfWeek(item.startTime)}}
  80. </view>
  81. <view class="status"
  82. :class="[item.status=='0'?'status0':item.status=='1'?'status1':item.status=='2'?'status2':'status3']">
  83. {{getStatus(item.status)}}
  84. </view>
  85. </view>
  86. <view class="list_2">
  87. <view class="name" v-if="item.type=='0'">{{item?.matchInfo?.title||'友谊赛'}}</view>
  88. <view class="name" v-else>{{item?.leagueInfo?.title||'联赛'}}</view>
  89. <view class="score">
  90. <view class="red">
  91. <view class="red_name">{{item?.redInfo?.name||'暂无红方名称'}}</view>
  92. <view class="red_image">
  93. <image class="image" mode="aspectFill"
  94. :src="item?.redInfo?.logo||config.logoUrl">
  95. </image>
  96. </view>
  97. <view class="red_score">{{item.redScore||0}}</view>
  98. </view>
  99. <view class="center">:</view>
  100. <view class="blue">
  101. <view class="blue_score">{{item.blueScore||0}}</view>
  102. <view class="blue_image">
  103. <image class="image" mode="aspectFill"
  104. :src="item?.blueInfo?.logo||config.logoUrl">
  105. </image>
  106. </view>
  107. <view class="blue_name">{{item?.blueInfo?.name||'暂无蓝方名称'}}</view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </template>
  117. <script setup lang="ts">
  118. import moment from 'moment';
  119. import { getCurrentInstance, ref } from 'vue';
  120. import circle from './components/circle.vue';
  121. //该依赖已内置不需要单独安装
  122. import { onLoad } from "@dcloudio/uni-app";
  123. // 请求接口
  124. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  125. interface PropsItem {
  126. id ?: number,
  127. name ?: string,
  128. date ?: string,
  129. red_name ?: string,
  130. red_score ?: number,
  131. red_logo ?: string,
  132. blue_name ?: string,
  133. blue_score ?: number,
  134. blue_logo ?: string,
  135. status ?: string,
  136. status_name ?: string,
  137. };
  138. // 列表
  139. const list = ref<PropsItem[]>([{ id: 1, name: '测试球队' }, { id: 1, name: '肝帝集团队' }]);
  140. // 分页
  141. const pageNum = ref(1);
  142. const pageSize = ref(10);
  143. const total = ref(0);
  144. // 详情
  145. const info = ref({});
  146. // 详情信息id
  147. const id = ref('');
  148. // 基本信息
  149. const config = ref({ logoUrl: '' });
  150. // 用户信息
  151. const user = ref({});
  152. // 字典表
  153. const statusList = ref([]);
  154. onLoad(async (options) => {
  155. id.value = options && options.id
  156. await searchConfig();
  157. await searchOther();
  158. await search();
  159. await searchGame()
  160. })
  161. // config信息
  162. const searchConfig = async () => {
  163. config.value = uni.getStorageSync('config');
  164. user.value = uni.getStorageSync('user')
  165. };
  166. // 查询其他信息
  167. const searchOther = async () => {
  168. let res;
  169. // 比赛状态
  170. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_game_status', status: '0' });
  171. if (res.code === 200 && res.total > 0) statusList.value = res.rows
  172. };
  173. // 查询
  174. const search = async () => {
  175. if (id.value) {
  176. const res = await $api(`team/${id.value}`, 'GET', {});
  177. if (res.code === 200) {
  178. if (res.data) info.value = res.data
  179. } else {
  180. uni.showToast({
  181. title: res.msg || '',
  182. icon: 'error',
  183. });
  184. }
  185. }
  186. };
  187. // 查询
  188. const searchGame = async () => {
  189. if (id.value) {
  190. const res = await $api('game/list', 'GET', {
  191. pageNum: pageNum.value,
  192. pageSize: pageSize.value,
  193. userId: user.value.id
  194. });
  195. if (res.code === 200) {
  196. list.value = res.rows
  197. total.value = res.total
  198. } else {
  199. uni.showToast({
  200. title: res.msg || '',
  201. icon: 'error',
  202. });
  203. }
  204. }
  205. };
  206. // 标签列表
  207. const menuList = ref([
  208. { name: '队员', icon: 'icon-a-14-chengyuanguanli', color: '#333333', route: '/pagesHome/team/person', },
  209. { name: '相册', icon: 'icon-xiangce', color: '#333333', route: '/pagesHome/team/album', },
  210. { name: '账本', icon: 'icon-zhangben', color: '#333333', route: '/pagesHome/team/book', },
  211. { name: '战术板', icon: 'icon-cricket-pitch', color: '#333333', route: '/pagesHome/team/board', },
  212. ]);
  213. // 修改
  214. const toEdit = (item : any) => {
  215. uni.navigateTo({
  216. url: `/pagesHome/team/index?id=${item._id || item.id}`,
  217. })
  218. };
  219. // 菜单详情
  220. const toInfo = (item : any) => {
  221. uni.navigateTo({
  222. url: `${item.route}?id=${id.value}`,
  223. })
  224. };
  225. // 活动详情
  226. const toActivity = (item : any) => {
  227. uni.navigateTo({
  228. url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name || ''}`,
  229. })
  230. };
  231. // 创建
  232. const toSave = () => {
  233. uni.navigateTo({
  234. url: `/pagesHome/create/index?id=${id.value}`,
  235. })
  236. };
  237. // 日期换算星期几
  238. const getDayOfWeek = (dateString) => {
  239. if (dateString) {
  240. const date = new Date(dateString);
  241. const dayOfWeek = date.getDay();
  242. const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  243. return weekdays[dayOfWeek];
  244. } else return '暂无日期';
  245. };
  246. // 换算状态
  247. const getStatus = (value) => {
  248. if (value) {
  249. const data = statusList.value.find(i => i.dictValue == value)
  250. if (data) return data.dictLabel
  251. } else return '暂无状态';
  252. };
  253. </script>
  254. <style lang="scss" scoped>
  255. .content {
  256. display: flex;
  257. flex-direction: column;
  258. width: 100vw;
  259. height: 100vh;
  260. background-color: var(--footColor);
  261. .one {
  262. display: flex;
  263. justify-content: space-between;
  264. height: 40vw;
  265. padding: 8vw 3vw 0 3vw;
  266. background-color: var(--f12Color);
  267. .left {
  268. display: flex;
  269. .left_1 {
  270. padding: 0 2vw;
  271. .image {
  272. width: 18vw;
  273. height: 18vw;
  274. border-radius: 1vw;
  275. background-color: var(--mainColor);
  276. }
  277. }
  278. .right_1 {
  279. color: var(--mainColor);
  280. .name {
  281. font-size: var(--font18Size);
  282. font-weight: bold;
  283. }
  284. .ranking {
  285. margin: 4vw 0 0 0;
  286. font-size: var(--font16Size);
  287. }
  288. }
  289. }
  290. .right {
  291. margin: 4vw 0 0 0;
  292. text {
  293. font-size: var(--font14Size);
  294. }
  295. }
  296. }
  297. .position {
  298. position: absolute;
  299. top: 35vw;
  300. .two {
  301. width: 94vw;
  302. margin: 0 3vw;
  303. padding: 5vw 0 0 0;
  304. border-radius: 1vw;
  305. text-align: center;
  306. background-color: var(--mainColor);
  307. .two_1 {
  308. font-size: var(--font16Size);
  309. color: var(--f99Color);
  310. padding: 2vw 0;
  311. }
  312. .two_2 {
  313. padding: 4vw 0;
  314. button {
  315. padding: 0 10vw;
  316. font-size: var(--font16Size);
  317. }
  318. }
  319. .two_3 {
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. padding: 5vw 0;
  324. font-size: var(--font14Size);
  325. border-top: 1px solid var(--footColor);
  326. text {
  327. padding: 0 2vw;
  328. }
  329. }
  330. }
  331. .thr {
  332. width: 94vw;
  333. margin: 3vw;
  334. padding: 2vw 0;
  335. border-radius: 1vw;
  336. background-color: var(--mainColor);
  337. .thr_1 {
  338. display: flex;
  339. justify-content: space-around;
  340. padding: 1vw 0 4vw 0;
  341. border-bottom: 1px solid var(--footColor);
  342. .list {
  343. display: flex;
  344. flex-direction: column;
  345. align-items: center;
  346. .name {
  347. margin: 1vw 0 0 0;
  348. color: var(--f33Color);
  349. font-size: var(--font14Size);
  350. }
  351. }
  352. }
  353. .thr_2 {
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. padding: 4vw;
  358. .fraction {
  359. display: flex;
  360. flex-direction: column;
  361. align-items: center;
  362. .top {
  363. font-size: var(--font20Size);
  364. font-weight: bold;
  365. }
  366. .bottom {
  367. color: var(--f99Color);
  368. font-size: var(--font14Size);
  369. }
  370. }
  371. .circle {
  372. display: flex;
  373. align-items: center;
  374. color: var(--f99Color);
  375. font-size: var(--font14Size);
  376. text {
  377. padding: 0 1vw;
  378. }
  379. }
  380. }
  381. }
  382. .four {
  383. width: 94vw;
  384. margin: 3vw;
  385. padding: 2vw 0;
  386. border-radius: 1vw;
  387. background-color: var(--mainColor);
  388. .four_1 {
  389. display: flex;
  390. justify-content: space-between;
  391. padding: 2vw;
  392. border-bottom: 1px solid var(--footColor);
  393. .left {
  394. font-size: var(--font18Size);
  395. font-weight: bold;
  396. }
  397. .right {
  398. display: flex;
  399. .name {
  400. padding: 0 1vw;
  401. }
  402. }
  403. }
  404. .four_2 {
  405. .list {
  406. .list_1 {
  407. display: flex;
  408. align-items: center;
  409. padding: 4vw 2vw 2vw 2vw;
  410. .date {
  411. font-size: var(--font16Size);
  412. font-weight: bold;
  413. }
  414. .status {
  415. font-size: 10px;
  416. margin: 0 1vw;
  417. padding: 1px 5px;
  418. }
  419. .status0 {
  420. color: var(--mainColor);
  421. background-color: var(--f35BColor);
  422. }
  423. .status1 {
  424. color: var(--mainColor);
  425. background-color: var(--fFFColor);
  426. }
  427. .status2 {
  428. color: var(--mainColor);
  429. background-color: var(--fF0Color);
  430. }
  431. .status3 {
  432. color: var(--f99Color);
  433. background-color: var(--f9Color);
  434. }
  435. }
  436. .list_2 {
  437. border: 1px solid var(--f5Color);
  438. padding: 2vw;
  439. border-radius: 2px;
  440. .name {
  441. font-size: var(--font16Size);
  442. font-weight: bold;
  443. margin: 2vw;
  444. }
  445. .score {
  446. display: flex;
  447. align-items: center;
  448. justify-content: center;
  449. font-size: var(--font14Size);
  450. background-color: var(--f9Color);
  451. border-radius: 5vw;
  452. padding: 1vw 0;
  453. .red {
  454. display: flex;
  455. align-items: center;
  456. margin: 0 1vw 0 0;
  457. .red_image {
  458. margin: 0 1vw;
  459. .image {
  460. width: 8vw;
  461. height: 8vw;
  462. border-radius: 8vw;
  463. }
  464. }
  465. .red_score {
  466. font-size: var(--font16Size);
  467. color: var(--fF0Color);
  468. }
  469. }
  470. .center {
  471. font-size: var(--font16Size);
  472. color: var(--fF0Color);
  473. }
  474. .blue {
  475. display: flex;
  476. align-items: center;
  477. margin: 0 0 0 1vw;
  478. .blue_image {
  479. margin: 0 1vw;
  480. .image {
  481. width: 8vw;
  482. height: 8vw;
  483. border-radius: 8vw;
  484. }
  485. }
  486. .blue_score {
  487. font-size: var(--font16Size);
  488. color: var(--fF0Color);
  489. }
  490. }
  491. }
  492. }
  493. }
  494. }
  495. }
  496. }
  497. }
  498. </style>