1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view class="content">
- <view class="head">
- <span class="title">项目列表</span>
- <span class="self">
- <uni-data-checkbox
- multiple
- v-model="checkself"
- :localdata="self"
- @change="checkSelf()"
- ></uni-data-checkbox>
- </span>
- </view>
- <view class="list">
- <view
- class="project"
- v-for="project in projectList"
- :key="project.id"
- @click="onClickProject(project)"
- >
- {{ `${project.project_name}(${project.project_full_code})` }}
- </view>
- </view>
- </view>
- </template>
- <script>
- import { queryProject } from "@/services/project";
- import { mapState } from "vuex";
- import uniDataCheckbox from "../../uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue";
- export default {
- components: { uniDataCheckbox },
- computed: {
- ...mapState(["currentProject"]),
- },
- data() {
- return {
- checkself: [],
- projectList: [],
- self: [{ text: "只看自己", value: 0 }],
- };
- },
- onShow() {
- this.getProject({});
- },
- methods: {
- async getProject(params) {
- let res = {};
- res = await queryProject(params);
- this.projectList = res.data.list;
- },
- async onClickProject(project) {
- await this.$store.commit("setCurrentProject", project);
- uni.navigateTo({
- url: `./detail?id=${project.id}`,
- });
- },
- checkSelf() {
- this.getProject({
- filter_type: this.checkself.length,
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .content {
- display: flex;
- justify-content: center;
- flex-wrap: wrap;
- }
- .head {
- width: 100%;
- padding: 0 20px 20px 20px;
- position: fixed;
- background: #f8f8f8;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .title {
- font: 24px bold;
- }
- .self {
- font: 16px;
- }
- }
- .list {
- width: 90%;
- margin-top: 60px;
- border-top: 2px solid gray;
- }
- .project {
- border-bottom: 2px solid gray;
- padding: 20px 0px;
- font-size: 18px;
- }
- </style>
|