project.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view style="display: flex;flex-wrap: wrap;">
  3. <view class="project" v-for="item in projects" :key="item.number" @tap="showDetail" :data-code="item.code">
  4. <image class="image" src="../../static/项目管理/项目管理@2x.png"></image>
  5. <text class="text">{{item.name}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. projects: [],
  14. }
  15. },
  16. onLoad() {
  17. uni.request({
  18. url: 'http://127.0.0.1:9999/project/list',
  19. method: 'GET',
  20. data: {},
  21. success: res => {
  22. this.projects = res.data.data.projects;
  23. console.log(res.data.data.projects);
  24. },
  25. })
  26. uni.$on('flush', () => {
  27. uni.request({
  28. url: 'http://127.0.0.1:9999/project/list',
  29. method: 'GET',
  30. data: {},
  31. success: res => {
  32. this.projects = res.data.data.projects;
  33. console.log(res.data.data.projects);
  34. },
  35. })
  36. })
  37. },
  38. methods: {
  39. showDetail(e) {
  40. console.log(e);
  41. var code = e.currentTarget.dataset.code;
  42. uni.navigateTo({
  43. url: '/pages/project/projectInfo/projectInfo?code=' + code,
  44. });
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .project {
  51. width: 343rpx;
  52. height: 260rpx;
  53. background-color: white;
  54. display: flex;
  55. flex-direction: column;
  56. margin-left: 22rpx;
  57. margin-top: 30rpx;
  58. border-radius: 10rpx;
  59. text-align: center;
  60. }
  61. .image {
  62. margin-left: 100rpx;
  63. margin-top: 30rpx;
  64. width: 140rpx;
  65. height: 140rpx;
  66. }
  67. .text {
  68. margin-top: 10rpx;
  69. }
  70. </style>