123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <template>
- <div class="works con">
- <div class="tab">
- <div class="tab-l">
- <span @click="changeTab('list')" :class="{ active: isActive('list') }">
- 在线制作
- {{ work1TotalNum ? `(${work1TotalNum})` : "" }}
- </span>
- <span @click="changeTab('cam')" :class="{ active: isActive('cam') }">
- 相机生成
- {{ work2TotalNum ? `(${work2TotalNum})` : "" }}
- </span>
- </div>
- <div class="tab-r">
- <div class="filter">
- <div
- :class="{ active: isFilterFocus }"
- @focusin="onFilterFocus"
- @focusout="onFilterBlur"
- >
- <i class="iconfont iconworks_search search"></i>
- <input type="text" :placeholder="search" v-model="searchKey" />
- <i
- v-if="searchKey"
- @click="searchKey = ''"
- class="iconfont icon-toast_red del"
- ></i>
- </div>
- </div>
- </div>
- </div>
- <template v-if="isActive('list')">
- <list @updateNum="handleWorkNum($event, 1)" :searchKey="searchKey"></list>
- </template>
- <template v-if="isActive('cam')">
- <CamList
- @updateNum="handleWorkNum($event, 2)"
- :searchKey="searchKey"
- ></CamList>
- </template>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import { i18n } from "@/lang";
- import List from "./list";
- import CamList from "./cam";
- import browser from "@/utils/browser";
- const allTabType = ["list", "cam"];
- export default {
- components: {
- List,
- CamList,
- },
- computed: {
- ...mapGetters(["info"]),
- isActive: function () {
- return (key) => {
- return this.currentTab === key;
- };
- },
- },
- data() {
- return {
- searchKey: "",
- work1TotalNum: "",
- work2TotalNum: "",
- isFilterFocus: false,
- search: i18n.t("material.works.search"),
- searchKey: "",
- currentTab: "list",
- };
- },
- mounted() {
- const from = browser.urlQueryValue("from");
- this.changeTab(from);
- },
- methods: {
- onFilterBlur() {},
- onFilterFocus() {},
- changeTab(type) {
- if (allTabType.includes(type)) {
- this.currentTab = type;
- }
- },
- handleWorkNum(val, type) {
- console.log("handleWorkNum", val, type);
- if (type === 1) {
- this.work1TotalNum = val;
- }
- if (type === 2) {
- this.work2TotalNum = val;
- }
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .works {
- width: 100%;
- flex-direction: column;
- position: relative;
- .back-top {
- position: absolute;
- right: -80px;
- bottom: 30px;
- width: 60px;
- height: 60px;
- border-radius: 8px;
- background-color: #fff;
- z-index: 1;
- color: #c8c9cc;
- &:hover {
- color: #323233;
- }
- cursor: pointer;
- display: flex;
- justify-content: center;
- align-items: center;
- i {
- font-size: 20px;
- }
- }
- .tab {
- flex: 0 0 auto;
- width: 100%;
- display: flex;
- background: #fff;
- justify-content: space-between;
- align-items: center;
- padding: 20px 30px;
- .tab-l {
- > span {
- font-size: 18px;
- font-weight: bold;
- margin-right: 30px;
- cursor: pointer;
- &:hover {
- color: #0076f6;
- }
- &.active {
- color: #0076f6;
- }
- }
- }
- .tab-r {
- align-items: center;
- display: flex;
- .ui-button {
- margin-right: 20px;
- }
- }
- }
- .mask {
- position: absolute;
- width: 100%;
- top: 200px;
- height: 30px;
- background: linear-gradient(rgb(239, 242, 244), rgba(255, 255, 255, 0));
- z-index: 1;
- pointer-events: none;
- }
- .w-list {
- flex: 1 1 auto;
- overflow: auto;
- margin-top: 22px;
- padding-top: 8px;
- @gap: 20px;
- display: flex;
- flex-wrap: wrap;
- align-content: flex-start;
- // 让宽度和视口等宽,为了保证鼠标列表显示区域以外时列表也能响应滚轮事件。
- margin-left: calc((100vw - 100%) / -2);
- padding-left: calc((100vw - 100%) / 2);
- margin-right: calc((100vw - 100%) / -2);
- padding-right: calc((100vw - 100%) / 2);
- &::-webkit-scrollbar {
- width: 0;
- height: 0;
- }
- > li {
- width: calc((100% - @gap * 4) / 5);
- height: 322px;
- margin-bottom: @gap;
- margin-right: @gap;
- &:nth-of-type(5n) {
- margin-right: 0;
- }
- // 因为有个“创建作品”card占着空间,每次拿20个数据,每行五个,又不想每次拿到数据后最后一行只有一个card,所以把最后那个card隐藏掉。
- &:last-of-type.has-more-data {
- display: none;
- }
- .wrapper {
- height: 100%;
- background: #fff;
- position: relative;
- border-radius: 6px;
- overflow: hidden;
- .li-hover {
- display: none;
- width: 100%;
- height: 240px;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 99;
- background: rgba(0, 0, 0, 0.6);
- .lipreview {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #fff;
- display: inline-block;
- line-height: 40px;
- height: 40px;
- width: 100px;
- text-align: center;
- border-radius: 22px;
- cursor: pointer;
- background-color: transparent;
- border: 1px solid #fff;
- &:hover {
- border: none;
- background: #1983f6;
- }
- }
- .oper {
- display: flex;
- justify-content: space-around;
- align-items: center;
- position: absolute;
- bottom: 10px;
- left: 0;
- width: 100%;
- > li {
- color: #fff;
- font-size: 13px;
- display: flex;
- align-items: center;
- cursor: pointer;
- > i {
- font-size: 20px;
- margin-right: 4px;
- }
- }
- }
- }
- .img {
- width: 100%;
- height: 240px;
- position: relative;
- overflow: hidden;
- cursor: pointer;
- .real {
- height: 100%;
- position: absolute;
- top: 0;
- left: 50%;
- transform: translateX(-50%);
- z-index: 0;
- transition: all ease 0.3s;
- }
- }
- .li-info {
- font-size: 14px;
- padding: 10px;
- > div {
- text-align: left;
- &:first-of-type {
- > span {
- font-weight: bold;
- margin-bottom: 10px;
- display: inline-block;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- cursor: pointer;
- color: #323233;
- font-size: 16px;
- }
- }
- &:last-of-type {
- display: flex;
- justify-content: space-between;
- align-items: center;
- > span {
- font-size: 14px;
- color: #969799;
- }
- > div {
- color: #969799;
- i {
- margin-right: 6px;
- }
- }
- }
- }
- }
- }
- &:hover {
- .wrapper {
- box-shadow: 0px 2px 12px 0px rgba(50, 50, 51, 0.12);
- transform: translateY(-6px);
- .li-hover {
- display: block;
- }
- .img {
- .real {
- height: 108%;
- }
- }
- }
- }
- }
- .add-work {
- .wrapper {
- .add-con {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- text-align: center;
- div {
- width: 60px;
- height: 60px;
- border-radius: 50%;
- background: linear-gradient(144deg, #00aefb 0%, #0076f6 100%);
- position: relative;
- cursor: pointer;
- margin: 0 auto;
- > i {
- font-size: 16px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #fff;
- }
- }
- span {
- color: #333333;
- display: inline-block;
- margin-top: 8px;
- font-size: 14px;
- }
- }
- }
- }
- .work-list-loading-wrapper {
- width: 100%;
- margin-top: 20px;
- margin-bottom: 22px;
- .work-list-loading {
- display: block;
- margin: 0 auto;
- width: 50px;
- height: 8px;
- }
- }
- }
- }
- </style>
- <style lang="less" scoped>
- @import "../style.less";
- </style>
|