优化me页面
This commit is contained in:
parent
cb3b44572e
commit
8c3441a833
224
package-lock.json
generated
224
package-lock.json
generated
@ -1217,9 +1217,9 @@
|
||||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
|
||||
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==",
|
||||
"version": "6.1.8",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.8.tgz",
|
||||
"integrity": "sha512-sb9b0cp855NbkMJcskdSYA7b11Q8JsX4qe4pyUAfHp+Y6jBjJeek2ZVlwEfWayshEIwlIzXx0Fain3QG9JPm2A==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chownr": "^2.0.0",
|
||||
@ -1228,6 +1228,27 @@
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-minipass": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
|
||||
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
|
||||
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^3.0.0",
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"yallist": {
|
||||
@ -1836,63 +1857,6 @@
|
||||
"integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
|
||||
"dev": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
|
||||
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
|
||||
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^2.1.2"
|
||||
}
|
||||
},
|
||||
"ssri": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364735533&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz",
|
||||
@ -1901,28 +1865,6 @@
|
||||
"requires": {
|
||||
"minipass": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"vue-loader-v16": {
|
||||
"version": "npm:vue-loader@16.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
|
||||
"integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chalk": "^4.1.0",
|
||||
"hash-sum": "^2.0.0",
|
||||
"loader-utils": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -5910,15 +5852,6 @@
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
|
||||
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"fs-write-stream-atomic": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npm.taobao.org/fs-write-stream-atomic/download/fs-write-stream-atomic-1.0.10.tgz",
|
||||
@ -7989,24 +7922,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
|
||||
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minipass": "^3.0.0",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"mississippi": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npm.taobao.org/mississippi/download/mississippi-3.0.0.tgz",
|
||||
@ -9884,8 +9799,8 @@
|
||||
},
|
||||
"querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/querystringify/download/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha1-M0WUG0FTy50ILY7uTNogFqmu9/Y=",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||
"dev": true
|
||||
},
|
||||
"randombytes": {
|
||||
@ -12151,9 +12066,9 @@
|
||||
}
|
||||
},
|
||||
"url-parse": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npm.taobao.org/url-parse/download/url-parse-1.5.1.tgz?cache=0&sync_timestamp=1613659698159&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Furl-parse%2Fdownload%2Furl-parse-1.5.1.tgz",
|
||||
"integrity": "sha1-1fqYkK+KXh8nSiyYN2UQ9kJfbjs=",
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
|
||||
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"querystringify": "^2.1.1",
|
||||
@ -12326,6 +12241,87 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"vue-loader-v16": {
|
||||
"version": "npm:vue-loader@16.5.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.5.0.tgz",
|
||||
"integrity": "sha512-WXh+7AgFxGTgb5QAkQtFeUcHNIEq3PGVQ8WskY5ZiFbWBkOwcCPRs4w/2tVyTbh2q6TVRlO3xfvIukUtjsu62A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"chalk": "^4.1.0",
|
||||
"hash-sum": "^2.0.0",
|
||||
"loader-utils": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
|
||||
"integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"big.js": "^5.2.2",
|
||||
"emojis-list": "^3.0.0",
|
||||
"json5": "^2.1.2"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"vue-router": {
|
||||
"version": "4.0.8",
|
||||
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.8.tgz",
|
||||
|
||||
@ -57,18 +57,24 @@ let pageSize = 15
|
||||
}())
|
||||
|
||||
!(function private1() {
|
||||
let data = {total: Mock.Random.natural(1, 20)}
|
||||
data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
// let data = {total: Mock.Random.natural(1, 20)}
|
||||
// data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
let data = {total: 4}
|
||||
data[`list|${data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
Mock.mock(/private/, Mock.mock({data, code: 200, msg: '',}))
|
||||
}())
|
||||
|
||||
!(function like() {
|
||||
let data = {total: Mock.Random.natural(1, 20)}
|
||||
data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
// let data = {total: Mock.Random.natural(1, 20)}
|
||||
// data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
let data = {total: 11}
|
||||
data[`list|${data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
Mock.mock(/like/, Mock.mock({data, code: 200, msg: '',}))
|
||||
}())
|
||||
!(function collect() {
|
||||
let data = {total: Mock.Random.natural(1, 20)}
|
||||
data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
// let data = {total: Mock.Random.natural(1, 20)}
|
||||
// data[`list|${data.total > pageSize ? pageSize : data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
let data = {total: 5}
|
||||
data[`list|${data.total}`] = [{'like|10000-990000': 1000000, src: '@imgs'}]
|
||||
Mock.mock(/collect/, Mock.mock({data, code: 200, msg: '',}))
|
||||
}())
|
||||
|
||||
@ -290,40 +290,61 @@ export default {
|
||||
this.changeIndex(0, null)
|
||||
})
|
||||
this.videoItemHeight = this.bodyWidth / 3 * 1.2 + 2
|
||||
// console.log('videoItemHeight',this.videoItemHeight)
|
||||
},
|
||||
methods: {
|
||||
async changeIndex(newVal, oldVal) {
|
||||
let res
|
||||
if (this.videos[Object.keys(this.videos)[newVal]].total !== -1) return
|
||||
switch (newVal) {
|
||||
case 0:
|
||||
res = await this.$api.videos.my()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.my = res.data
|
||||
this.$console(this.videos)
|
||||
// console.log('oldVal',oldVal)
|
||||
if (this.videos[Object.keys(this.videos)[newVal]].total === -1) {
|
||||
let res
|
||||
switch (newVal) {
|
||||
case 0:
|
||||
res = await this.$api.videos.my()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.my = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 1:
|
||||
res = await this.$api.videos.private()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.private = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 2:
|
||||
res = await this.$api.videos.like()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.like = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 3:
|
||||
res = await this.$api.videos.collect()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.collect = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
}
|
||||
}
|
||||
let posterHeight = Math.ceil(this.videos[Object.keys(this.videos)[newVal]].total / 3) * this.videoItemHeight
|
||||
// console.log('posterHeight', posterHeight)
|
||||
|
||||
let posterHeight = Math.ceil(this.videos.my.total / 3) * this.videoItemHeight
|
||||
if (posterHeight < this.refs.defaultVideoSlideRowListHeight) {
|
||||
// this.$setCss(this.$refs.videoSlideRowList, 'height', posterHeight + 'px')
|
||||
this.refs.videoSlideRowListHeight = posterHeight + 60
|
||||
} else {
|
||||
this.refs.videoSlideRowListHeight = this.refs.defaultVideoSlideRowListHeight
|
||||
}
|
||||
break
|
||||
case 1:
|
||||
res = await this.$api.videos.private()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.private = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 2:
|
||||
res = await this.$api.videos.like()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.like = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 3:
|
||||
res = await this.$api.videos.collect()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.collect = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
if (oldVal !== null) {
|
||||
let transformY = this.getTransform(this.$refs.scroll)
|
||||
// console.log('transformY', transformY)
|
||||
let slideRowListHeight = this.bodyHeight - 50 - 352 - 50 + Math.abs(transformY)
|
||||
// console.log('slideRowListHeight', slideRowListHeight)
|
||||
// debugger
|
||||
if (posterHeight + 60 < slideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = slideRowListHeight
|
||||
}
|
||||
if (posterHeight + 60 > slideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = posterHeight + 60
|
||||
}
|
||||
if (posterHeight + 60 > this.refs.defaultVideoSlideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = this.refs.defaultVideoSlideRowListHeight
|
||||
}
|
||||
} else {
|
||||
if (posterHeight + 60 < this.refs.defaultVideoSlideRowListHeight) {
|
||||
// this.$setCss(this.$refs.videoSlideRowList, 'height', posterHeight + 'px')
|
||||
this.refs.videoSlideRowListHeight = posterHeight + 60
|
||||
} else {
|
||||
this.refs.videoSlideRowListHeight = this.refs.defaultVideoSlideRowListHeight
|
||||
}
|
||||
}
|
||||
},
|
||||
touchStart(e) {
|
||||
@ -344,6 +365,7 @@ export default {
|
||||
// console.log('distance', distance)
|
||||
//往上划
|
||||
if (distance > 0) {
|
||||
this.$refs.scroll.style.transform = `translate3d(0,0,0)`
|
||||
if (distance < 400) {
|
||||
// if (this.baseActiveIndex !== 0) return
|
||||
// if (this.refs.header.getBoundingClientRect().top !== 0) return
|
||||
@ -374,23 +396,19 @@ export default {
|
||||
}
|
||||
} else {
|
||||
this.indicatorFixed = Math.abs(distance) > offsetTop
|
||||
this.floatFixed = Math.abs(distance) > 100
|
||||
this.floatShowName = Math.abs(distance) > 150
|
||||
if (this.indicatorFixed) {
|
||||
this.fixedLocationY = e.touches[0].pageY
|
||||
}
|
||||
// console.log('indicatorFixed', this.indicatorFixed)
|
||||
// console.log('distance', distance)
|
||||
// if (this.indicatorFixed){
|
||||
// this.$refs.scroll.style.transform = `translate3d(0,${this.indicatorFixed ? -offsetTop : distance}px,0)`
|
||||
// }
|
||||
//todo
|
||||
if (this.refs.defaultVideoSlideRowListHeight > this.refs.videoSlideRowListHeight) {
|
||||
let endTransformY = Math.abs(offsetTop) - (this.refs.defaultVideoSlideRowListHeight - this.refs.videoSlideRowListHeight)
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${
|
||||
distance > -endTransformY ? distance : -endTransformY
|
||||
}px,0)`
|
||||
this.floatFixed = Math.abs(distance) > 100
|
||||
this.floatShowName = Math.abs(distance) > 150
|
||||
} else {
|
||||
this.floatFixed = Math.abs(distance) > 100
|
||||
this.floatShowName = Math.abs(distance) > 150
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${this.indicatorFixed ? -offsetTop : distance}px,0)`
|
||||
}
|
||||
}
|
||||
@ -476,22 +494,34 @@ export default {
|
||||
this.moveYDistance = distance > 0 ? 0 : -this.refs.descHeight
|
||||
}
|
||||
this.indicatorFixed = this.floatShowName = this.floatFixed = this.isScroll = false
|
||||
this.changeIndex(this.contentIndex, this.contentIndex)
|
||||
} else {
|
||||
//往下划
|
||||
this.$refs.scroll.style.transition = 'all .3s'
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${distance > 0 ? 0 : -this.refs.descHeight + this.floatHeight}px,0)`
|
||||
this.moveYDistance = distance > 0 ? 0 : -this.refs.descHeight + this.floatHeight
|
||||
this.indicatorFixed = this.floatShowName = this.floatFixed = this.isScroll = true
|
||||
let offsetTop = this.refs.descHeight - this.floatHeight
|
||||
if (this.refs.defaultVideoSlideRowListHeight > this.refs.videoSlideRowListHeight) {
|
||||
let endTransformY = Math.abs(offsetTop) - (this.refs.defaultVideoSlideRowListHeight - this.refs.videoSlideRowListHeight)
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${-endTransformY}px,0)`
|
||||
// this.floatShowName = this.floatFixed = true
|
||||
this.floatFixed = Math.abs(endTransformY) > 100
|
||||
this.floatShowName = Math.abs(endTransformY) > 150
|
||||
this.moveYDistance = -endTransformY
|
||||
} else {
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${-this.refs.descHeight + this.floatHeight}px,0)`
|
||||
this.indicatorFixed = this.floatShowName = this.floatFixed = this.isScroll = true
|
||||
this.moveYDistance = -this.refs.descHeight + this.floatHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.isScroll = true
|
||||
}
|
||||
// console.log('end-isScroll', this.isScroll)
|
||||
},
|
||||
getTransform(el) {
|
||||
let transform = el.style.transform
|
||||
// console.log(transform)
|
||||
let transformY = transform.substring(transform.indexOf('0px') + 5, transform.lastIndexOf('0px') - 4)
|
||||
// console.log(transformY)
|
||||
//当前的transformY
|
||||
transformY = parseInt(transformY)
|
||||
return transformY
|
||||
|
||||
822
src/pages/me/Me3.vue
Normal file
822
src/pages/me/Me3.vue
Normal file
@ -0,0 +1,822 @@
|
||||
<template>
|
||||
<div class="Me">
|
||||
<SlideRowList style="width: 100vw;" v-model:active-index="baseActiveIndex">
|
||||
<SlideItem>
|
||||
<div ref="float" class="float" :class="floatFixed?'fixed':''">
|
||||
<div class="left" style="opacity: 0;">
|
||||
<img src="../../assets/img/icon/next.svg" alt="">
|
||||
<span>切换账号</span>
|
||||
</div>
|
||||
<transition name="fade">
|
||||
<div class="center" v-if="floatShowName">
|
||||
<p class="name f22 mt1r mb1r">ttentau</p>
|
||||
</div>
|
||||
</transition>
|
||||
<div class="right">
|
||||
<img :style="floatFixed?'opacity: 0;':''" src="../../assets/img/icon/me/finger-right.png" alt="">
|
||||
<img src="../../assets/img/icon/me/menu.png" alt="" @click.stop="baseActiveIndex = 1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="scroll"
|
||||
ref="scroll"
|
||||
@touchstart="touchStart($event)"
|
||||
@touchmove="touchMove($event)"
|
||||
@touchend="touchEnd($event)">
|
||||
<div ref="desc" class="desc">
|
||||
<header ref="header"></header>
|
||||
<div class="detail">
|
||||
<div class="head">
|
||||
<img src="../../assets/img/icon/head-image.jpeg" class="head-image">
|
||||
<div class="other-buttons" v-if="false">
|
||||
<div class="attention">
|
||||
关注
|
||||
</div>
|
||||
<div class="more-attention">
|
||||
-
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-buttons ">
|
||||
<div class="collect" @click="$nav('/edit-userinfo')">
|
||||
<span class="mr1r">编辑资料</span>
|
||||
<span class="f10p" style="color: darkgray">85%</span>
|
||||
</div>
|
||||
<div class="add-friend" @click="$nav('/find-acquaintance')">
|
||||
<img src="../../assets/img/icon/add-white.png" alt="">
|
||||
<span class="mr5p">熟人</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p class="name f22 mt1r mb1r">ttentau</p>
|
||||
<div class="number mb1r">
|
||||
<span class="mr1r">私密账号</span>
|
||||
<span>抖音号:605128307</span>
|
||||
<img src="../../assets/img/icon/me/qrcode-gray.png" alt="" @click.stop="$nav('/my-card')">
|
||||
</div>
|
||||
<div class="signature f12 mb1r">
|
||||
<span>填写个性签名更容易获得别人关注哦</span>
|
||||
</div>
|
||||
<div class="heat">
|
||||
<div class="text"><span class="num">8</span>获赞</div>
|
||||
<div class="text"><span class="num">8</span>关注</div>
|
||||
<div class="text"><span class="num">8</span>粉丝</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Indicator
|
||||
:class="indicatorFixed?'fffffffff':''"
|
||||
name="videoList"
|
||||
tabStyleWidth="25%"
|
||||
:tabTexts="['作品','私密','喜欢','收藏']"
|
||||
v-model:active-index="contentIndex">
|
||||
</Indicator>
|
||||
<SlideRowList
|
||||
ref="videoSlideRowList"
|
||||
name="videoList"
|
||||
:style="videoSlideRowListStyle"
|
||||
v-model:active-index="contentIndex">
|
||||
<SlideItem class="SlideItem"
|
||||
@touchmove="move"
|
||||
:style="isScroll?'overflow: auto;':''">
|
||||
<Posters v-if="videos.my.total !== -1" :list="videos.my.list"></Posters>
|
||||
<Loading v-else :is-full-screen="false"></Loading>
|
||||
<no-more/>
|
||||
</SlideItem>
|
||||
<SlideItem class="SlideItem"
|
||||
@touchmove="move"
|
||||
:style="isScroll?'overflow: auto;':''">
|
||||
<Posters v-if="videos.private.total !== -1" :list="videos.private.list"></Posters>
|
||||
<Loading v-else :is-full-screen="false"></Loading>
|
||||
<no-more/>
|
||||
</SlideItem>
|
||||
<SlideItem class="SlideItem"
|
||||
@touchmove="move"
|
||||
:style="isScroll?'overflow: auto;':''">
|
||||
<Posters v-if="videos.like.total !== -1" :list="videos.like.list"></Posters>
|
||||
<Loading v-else :is-full-screen="false"></Loading>
|
||||
<no-more/>
|
||||
</SlideItem>
|
||||
<SlideItem class="SlideItem"
|
||||
@touchmove="move"
|
||||
:style="isScroll?'overflow: auto;':''">
|
||||
<Posters v-if="videos.collect.total !== -1" :list="videos.collect.list"></Posters>
|
||||
<Loading v-else :is-full-screen="false"></Loading>
|
||||
<no-more/>
|
||||
</SlideItem>
|
||||
</SlideRowList>
|
||||
</div>
|
||||
<Footer v-bind:init-tab="5"/>
|
||||
</SlideItem>
|
||||
<SlideItem style="min-width: 70vw; overflow:auto;">
|
||||
<transition name="fade1">
|
||||
<div class="ul" v-if="!isMoreFunction">
|
||||
<div class="li" @click="$nav('/my-card')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/shopping.png" alt="">
|
||||
<span>我的订单</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/wallet.png" alt="">
|
||||
<span>钱包</span>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
|
||||
<div class="li" @click="$nav('/me/right-menu/look-history')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/clock.png" alt="">
|
||||
<span>观看历史</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('/my-card')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/qrcode.png" alt="">
|
||||
<span>我的二维码</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/workbench.png" alt="">
|
||||
<span>创作者服务中心</span>
|
||||
</div>
|
||||
|
||||
<div class="line"></div>
|
||||
|
||||
<div class="li" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/bytedance-mini-app.png" alt="">
|
||||
<span>小程序</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/gongyi.png" alt="">
|
||||
<span>抖音公益</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('/me/right-menu/minor-protection/index')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/umbrella.png" alt="">
|
||||
<span>未成年保护工具</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/headset.png" alt="">
|
||||
<span>我的客服</span>
|
||||
</div>
|
||||
<div class="li" @click="$nav('/me/right-menu/setting')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/setting-one.png" alt="">
|
||||
<span>设置</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="more-function">
|
||||
<div class="title">生活服务</div>
|
||||
<div class="functions">
|
||||
<div class="function">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/quan.png" alt="">
|
||||
<span>卡券</span>
|
||||
</div>
|
||||
<div class="function">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/sd-card.png" alt="">
|
||||
<span>免流量</span>
|
||||
</div>
|
||||
<div class="function" @click="$nav('MyCollect')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/alarmmmmmmmmmmmm.png" alt="">
|
||||
<span>视频彩铃</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="title">拓展功能</div>
|
||||
<div class="functions">
|
||||
<div class="function" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/sun-one.png" alt="">
|
||||
<span>我的动态</span>
|
||||
</div>
|
||||
<div class="function">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/download.png" alt="">
|
||||
<span>我的缓存</span>
|
||||
</div>
|
||||
<div class="function" @click="$nav('MyCard')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/hot.png" alt="">
|
||||
<span>上热门</span>
|
||||
</div>
|
||||
<div class="function" @click="$nav('MyCollect')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/shop.png" alt="">
|
||||
<span>小店随心推</span>
|
||||
</div>
|
||||
<div class="function" @click="$nav('MyCollect')">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/yuandi.png" alt="">
|
||||
<span>投教园地</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<div class="button-ctn">
|
||||
<div class="button" v-if="!isMoreFunction" @click="isMoreFunction = true">
|
||||
<img src="../../assets/img/icon/newicon/left_menu/more.png" alt="">
|
||||
<span>更多功能</span>
|
||||
</div>
|
||||
<div class="button" v-if="isMoreFunction" @click="isMoreFunction = false">
|
||||
<span>返回</span>
|
||||
</div>
|
||||
</div>
|
||||
</SlideItem>
|
||||
</SlideRowList>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Posters from '../../components/Posters'
|
||||
import Footer from "../../components/Footer";
|
||||
import Indicator from '../../components/Indicator'
|
||||
|
||||
export default {
|
||||
name: "Me",
|
||||
components: {Posters, Footer, Indicator},
|
||||
data() {
|
||||
return {
|
||||
contentIndex: 0,
|
||||
baseActiveIndex: 0,
|
||||
desc: null,
|
||||
tabContents: [],
|
||||
indicatorHeight: 42,
|
||||
indicatorFixed: false,
|
||||
floatFixed: false,
|
||||
floatShowName: false,
|
||||
isScroll: false,
|
||||
isMoreFunction: false,
|
||||
refs: {
|
||||
header: null,
|
||||
headerHeight: 0,
|
||||
descHeight: 0,
|
||||
videoSlideRowListHeight: 0,
|
||||
defaultVideoSlideRowListHeight: 0
|
||||
},
|
||||
videoItemHeight: 0,
|
||||
startLocationY: 0,
|
||||
fixedLocationY: 0,
|
||||
moveYDistance: 0,
|
||||
startTime: 0,
|
||||
floatHeight: 46,
|
||||
videos: {
|
||||
my: {
|
||||
list: [],
|
||||
total: -1
|
||||
},
|
||||
private: {
|
||||
list: [],
|
||||
total: -1
|
||||
},
|
||||
like: {
|
||||
list: [],
|
||||
total: -1
|
||||
},
|
||||
collect: {
|
||||
list: [],
|
||||
total: -1
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
bodyHeight() {
|
||||
return this.$store.state.bodyHeight
|
||||
},
|
||||
bodyWidth() {
|
||||
return this.$store.state.bodyWidth
|
||||
},
|
||||
videoSlideRowListStyle() {
|
||||
return {height: this.refs.videoSlideRowListHeight !== 0 ? this.refs.videoSlideRowListHeight + 'px' : 'calc(100vh - 14.6rem)'}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
contentIndex(newVal, oldVal) {
|
||||
this.changeIndex(newVal, oldVal)
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.refs.header = this.$refs.header
|
||||
this.refs.headerHeight = this.$refs.header.offsetHeight
|
||||
this.refs.descHeight = this.$refs.desc.offsetHeight
|
||||
this.refs.defaultVideoSlideRowListHeight = this.$refs.videoSlideRowList.wrapperHeight
|
||||
// this.refs.videoSlideRowListHeight = this.$refs.videoSlideRowList.wrapperHeight
|
||||
this.changeIndex(0, null)
|
||||
})
|
||||
this.videoItemHeight = this.bodyWidth / 3 * 1.2 + 2
|
||||
// console.log('videoItemHeight',this.videoItemHeight)
|
||||
},
|
||||
methods: {
|
||||
async changeIndex(newVal, oldVal) {
|
||||
// console.log('oldVal',oldVal)
|
||||
if (this.videos[Object.keys(this.videos)[newVal]].total === -1) {
|
||||
let res
|
||||
switch (newVal) {
|
||||
case 0:
|
||||
res = await this.$api.videos.my()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.my = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 1:
|
||||
res = await this.$api.videos.private()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.private = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 2:
|
||||
res = await this.$api.videos.like()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.like = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
case 3:
|
||||
res = await this.$api.videos.collect()
|
||||
if (res.code === this.SUCCESS_CODE) this.videos.collect = res.data
|
||||
this.$console(this.videos)
|
||||
break
|
||||
}
|
||||
}
|
||||
let posterHeight = Math.ceil(this.videos[Object.keys(this.videos)[newVal]].total / 3) * this.videoItemHeight
|
||||
// console.log('posterHeight', posterHeight)
|
||||
|
||||
if (oldVal !== null) {
|
||||
let transformY = this.getTransform(this.$refs.scroll)
|
||||
// console.log('transformY', transformY)
|
||||
let slideRowListHeight = this.bodyHeight - 50 - 352 - 50 + Math.abs(transformY)
|
||||
// console.log('slideRowListHeight', slideRowListHeight)
|
||||
// debugger
|
||||
if (posterHeight + 60 < slideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = slideRowListHeight
|
||||
}
|
||||
if (posterHeight + 60 > slideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = posterHeight + 60
|
||||
}
|
||||
if (posterHeight + 60 > this.refs.defaultVideoSlideRowListHeight) {
|
||||
this.refs.videoSlideRowListHeight = this.refs.defaultVideoSlideRowListHeight
|
||||
}
|
||||
} else {
|
||||
if (posterHeight + 60 < this.refs.defaultVideoSlideRowListHeight) {
|
||||
// this.$setCss(this.$refs.videoSlideRowList, 'height', posterHeight + 'px')
|
||||
this.refs.videoSlideRowListHeight = posterHeight + 60
|
||||
} else {
|
||||
this.refs.videoSlideRowListHeight = this.refs.defaultVideoSlideRowListHeight
|
||||
}
|
||||
}
|
||||
},
|
||||
touchStart(e) {
|
||||
this.$refs.scroll.style.transition = 'none'
|
||||
this.fixedLocationY = this.startLocationY = e.touches[0].pageY
|
||||
this.startTime = Date.now()
|
||||
},
|
||||
move(e) {
|
||||
(!this.isScroll) && e.preventDefault();
|
||||
},
|
||||
touchMove(e) {
|
||||
//距离顶部的距离
|
||||
let offsetTop = this.refs.descHeight - this.floatHeight
|
||||
// console.log('pageY', e.touches[0].pageY)
|
||||
// console.log('moveYDistance', this.moveYDistance)
|
||||
let moveYDistance = e.touches[0].pageY - this.startLocationY
|
||||
let distance = this.moveYDistance + moveYDistance * 1.2
|
||||
// console.log('distance', distance)
|
||||
//往上划
|
||||
if (distance > 0) {
|
||||
this.$refs.scroll.style.transform = `translate3d(0,0,0)`
|
||||
if (distance < 400) {
|
||||
// if (this.baseActiveIndex !== 0) return
|
||||
// if (this.refs.header.getBoundingClientRect().top !== 0) return
|
||||
this.refs.header.style.transition = 'all 0s'
|
||||
this.refs.header.style.height = this.refs.headerHeight + (distance / 2) + 'px'
|
||||
} else {
|
||||
this.startLocationY = e.touches[0].pageY
|
||||
this.moveYDistance = 400
|
||||
}
|
||||
return
|
||||
}
|
||||
// console.log('s', e.touches[0].pageY - this.startLocationY)
|
||||
// console.log('indicatorFixed', this.indicatorFixed)
|
||||
if (this.indicatorFixed) {
|
||||
let SlideItems = document.querySelectorAll('.SlideItem')
|
||||
let SlideItem = SlideItems[this.contentIndex]
|
||||
|
||||
// console.log(tt.scrollTop)
|
||||
if (!this.isScroll) {
|
||||
SlideItem.style.overflow = 'auto'
|
||||
SlideItem.scrollTop = Math.abs(distance) - this.refs.descHeight + this.floatHeight
|
||||
}
|
||||
if (SlideItem.scrollTop === 0 && (e.touches[0].pageY - this.fixedLocationY) > 0) {
|
||||
this.isScroll = this.indicatorFixed = false
|
||||
SlideItem.style.overflow = 'hidden'
|
||||
this.startLocationY = e.touches[0].pageY
|
||||
this.moveYDistance = -this.refs.descHeight + this.floatHeight
|
||||
}
|
||||
} else {
|
||||
this.indicatorFixed = Math.abs(distance) > offsetTop
|
||||
if (this.indicatorFixed) {
|
||||
this.fixedLocationY = e.touches[0].pageY
|
||||
}
|
||||
if (this.refs.defaultVideoSlideRowListHeight > this.refs.videoSlideRowListHeight) {
|
||||
let endTransformY = Math.abs(offsetTop) - (this.refs.defaultVideoSlideRowListHeight - this.refs.videoSlideRowListHeight)
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${
|
||||
distance > -endTransformY ? distance : -endTransformY
|
||||
}px,0)`
|
||||
this.floatFixed = Math.abs(distance) > 100
|
||||
this.floatShowName = Math.abs(distance) > 150
|
||||
} else {
|
||||
this.floatFixed = Math.abs(distance) > 100
|
||||
this.floatShowName = Math.abs(distance) > 150
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${this.indicatorFixed ? -offsetTop : distance}px,0)`
|
||||
}
|
||||
}
|
||||
},
|
||||
touchEnd(e) {
|
||||
// console.log('this.startLocationY', this.startLocationY)
|
||||
// debugger
|
||||
let moveYDistance = e.changedTouches[0].pageY - this.startLocationY
|
||||
this.moveYDistance = this.moveYDistance + moveYDistance * 1.2//乘以1.2倍,加速滚动,不然看起来很慢
|
||||
// console.log('end-moveYDistance', this.moveYDistance)
|
||||
|
||||
|
||||
//往上划,恢复header
|
||||
if (this.moveYDistance > 0) {
|
||||
// if (this.baseActiveIndex !== 0) return
|
||||
this.refs.header.style.transition = 'all .3s'
|
||||
this.refs.header.style.height = this.refs.headerHeight + 'px'
|
||||
this.moveYDistance = 0
|
||||
this.floatShowName = this.floatFixed = this.isScroll = false
|
||||
return
|
||||
}
|
||||
|
||||
// console.log('header-height', this.refs.descHeight - this.floatHeight)
|
||||
// this.isScroll = Math.abs(this.moveYDistance) > this.refs.descHeight - this.floatHeight
|
||||
//原谅我判断太多
|
||||
//如果没固定,则可以滚动到顶和底
|
||||
if (!this.indicatorFixed) {
|
||||
//算出滚动距离
|
||||
let distance = e.changedTouches[0].pageY - this.startLocationY
|
||||
// console.log('end-distance', distance)
|
||||
let endTime = Date.now()
|
||||
let gapTime = endTime - this.startTime
|
||||
|
||||
//距离太小
|
||||
if (Math.abs(distance) < 20) gapTime = 1000
|
||||
//超过header的1/3
|
||||
if (Math.abs(distance) > (this.refs.descHeight / 2)) gapTime = 50
|
||||
// console.log('时间', gapTime)
|
||||
if (gapTime < 150) {
|
||||
//往上划
|
||||
if (distance > 0) {
|
||||
//时间短,滑动距离长,则应该快速滚动到顶部
|
||||
gapTime = endTime - this.startTime
|
||||
if (gapTime < 100 && Math.abs(distance) > 100) {
|
||||
//用cancelAnimationFrame快速滚动到顶部,要比transition = 'all .3s'快
|
||||
this.$refs.scroll.style.transition = 'none'
|
||||
let transformY = this.getTransform(this.$refs.scroll)
|
||||
//当前的transformY
|
||||
// console.log('transformY', transformY)
|
||||
let timer
|
||||
cancelAnimationFrame(timer);
|
||||
let fn = () => {
|
||||
//说明没到顶
|
||||
if (transformY < 0) {
|
||||
transformY = transformY + 40
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${transformY > 0 ? 0 : transformY}px,0)`
|
||||
timer = requestAnimationFrame(fn);
|
||||
} else {
|
||||
//transformY === 0说明,本来就在顶部,然后猛的一划,这里要判断下
|
||||
if (transformY !== 0) {
|
||||
if (this.$getCss(this.refs.header, 'height') < 400) {
|
||||
this.refs.header.style.transition = 'none'
|
||||
this.refs.header.style.height = this.$getCss(this.refs.header, 'height') + 10 + 'px'
|
||||
timer = requestAnimationFrame(fn);
|
||||
} else {
|
||||
this.refs.header.style.transition = 'all .6s'
|
||||
this.refs.header.style.height = this.refs.headerHeight + 'px'
|
||||
this.moveYDistance = 0
|
||||
cancelAnimationFrame(timer);
|
||||
}
|
||||
} else {
|
||||
//快速动画结束
|
||||
this.moveYDistance = 0
|
||||
cancelAnimationFrame(timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
timer = requestAnimationFrame(fn);
|
||||
} else {
|
||||
//正常回弹动画
|
||||
this.$refs.scroll.style.transition = 'all .3s'
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${distance > 0 ? 0 : -this.refs.descHeight}px,0)`
|
||||
this.moveYDistance = distance > 0 ? 0 : -this.refs.descHeight
|
||||
}
|
||||
this.indicatorFixed = this.floatShowName = this.floatFixed = this.isScroll = false
|
||||
this.changeIndex(this.contentIndex, this.contentIndex)
|
||||
} else {
|
||||
//往下划
|
||||
this.$refs.scroll.style.transition = 'all .3s'
|
||||
let offsetTop = this.refs.descHeight - this.floatHeight
|
||||
if (this.refs.defaultVideoSlideRowListHeight > this.refs.videoSlideRowListHeight) {
|
||||
let endTransformY = Math.abs(offsetTop) - (this.refs.defaultVideoSlideRowListHeight - this.refs.videoSlideRowListHeight)
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${-endTransformY}px,0)`
|
||||
// this.floatShowName = this.floatFixed = true
|
||||
this.floatFixed = Math.abs(endTransformY) > 100
|
||||
this.floatShowName = Math.abs(endTransformY) > 150
|
||||
this.moveYDistance = -endTransformY
|
||||
} else {
|
||||
this.$refs.scroll.style.transform = `translate3d(0,${-this.refs.descHeight + this.floatHeight}px,0)`
|
||||
this.indicatorFixed = this.floatShowName = this.floatFixed = this.isScroll = true
|
||||
this.moveYDistance = -this.refs.descHeight + this.floatHeight
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.isScroll = true
|
||||
}
|
||||
},
|
||||
getTransform(el) {
|
||||
let transform = el.style.transform
|
||||
// console.log(transform)
|
||||
let transformY = transform.substring(transform.indexOf('0px') + 5, transform.lastIndexOf('0px') - 4)
|
||||
// console.log(transformY)
|
||||
//当前的transformY
|
||||
transformY = parseInt(transformY)
|
||||
return transformY
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
@import "../../assets/scss/index";
|
||||
|
||||
.fade1-enter-active,
|
||||
.fade1-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.fade1-enter-from,
|
||||
.fade1-leave-to {
|
||||
transform: translateY(10px);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.Me {
|
||||
background: $main-bg;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.no-more {
|
||||
font-size: 1.4rem;
|
||||
padding: 10px;
|
||||
color: gray;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.float {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 4.6rem;
|
||||
padding: 0 1.5rem;
|
||||
background: transparent;
|
||||
transition: all .2s;
|
||||
|
||||
.center {
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.fixed {
|
||||
background: $main-bg;
|
||||
|
||||
img {
|
||||
background: $main-bg !important;
|
||||
}
|
||||
}
|
||||
|
||||
.left {
|
||||
font-size: 1.2rem;
|
||||
height: 2.6rem;
|
||||
display: flex;
|
||||
padding-right: 1.3rem;
|
||||
padding-left: .5rem;
|
||||
align-items: center;
|
||||
border-radius: 2rem;
|
||||
background: rgba(82, 80, 80, 0.5);
|
||||
|
||||
img {
|
||||
padding: .6rem;
|
||||
width: 1.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
img {
|
||||
margin-left: 2rem;
|
||||
border-radius: 50%;
|
||||
background: rgba(82, 80, 80, 0.5);
|
||||
padding: .6rem;
|
||||
width: 1.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
header {
|
||||
color: white;
|
||||
height: 12rem;
|
||||
background-image: url('../../assets/img/header-bg.png');
|
||||
//background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxAQEBAQEBAPEBAPEBAP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VzpQ31f2l4nUq1471mmy1TEwSu1f4I51bFO+7ouzLFGebb/F/Tmc/KvGo9bmGvLeYxzd+JmqPVnSuMjr4V7kehzKvrPqx+HqLKrmao9X1F+JzPbZhpbnxZMpGalLd+JLNSs2ezJMo2LZFxqzle4XF3Ai+JQBYmxzdUATYiwAAWCwAAWCwAAWAugAAIoAAA00MZJaPVD8RWzJW4czn2G0arXQG1E0VTGOzFyNM4GQAWGqAABosmFypITF6cuI+lO1zOmTGYXGmVUTJlc5VzBV7ipE5irCYZFi5PUkgEi8XoWzC0wuXU8V2yLlAGr4r3C5QBpgAAMNgAAAAAAAAAAAAAAAAAAAAAAAAACYAAAoAAAAAAAAAJgAACgAAAAAAAAAAAAJgAABj/2Q==');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.detail {
|
||||
background: $main-bg;
|
||||
padding: 0 20px;
|
||||
|
||||
.head {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
transform: translateY(-20px);
|
||||
|
||||
.head-image {
|
||||
background: black;
|
||||
padding: 2px;
|
||||
border-radius: 50%;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.my-buttons {
|
||||
div {
|
||||
font-size: 1.2rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
float: left;
|
||||
border-radius: 2px;
|
||||
background: $second-btn-color;
|
||||
margin-left: 5px;
|
||||
padding: 0 10px;
|
||||
height: 30px;
|
||||
color: white;
|
||||
|
||||
&:nth-child(1) {
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
img {
|
||||
padding: 0 .6rem;
|
||||
height: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
font-size: 1.2rem;
|
||||
color: white;
|
||||
transform: translateY(-20px);
|
||||
|
||||
.number {
|
||||
color: $second-text-color;
|
||||
padding-bottom: 2rem;
|
||||
border-bottom: 1px solid $line-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
width: 18px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.heat {
|
||||
color: darkgray;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.num {
|
||||
color: white;
|
||||
font-size: 1.8rem;
|
||||
font-weight: bold;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 1.4rem;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ul {
|
||||
font-size: 1.4rem;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
color: white;
|
||||
background: $main-bg;
|
||||
|
||||
.line {
|
||||
height: 1px;
|
||||
background: #cccccc;
|
||||
opacity: .1;
|
||||
margin: 5px 20px;
|
||||
}
|
||||
|
||||
.li {
|
||||
box-sizing: border-box;
|
||||
background: $main-bg;
|
||||
width: 100%;
|
||||
padding: 1rem 2rem;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 4rem;
|
||||
|
||||
&:nth-last-child(1) {
|
||||
margin-bottom: 90px;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #454b65;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.more-function {
|
||||
box-sizing: border-box;
|
||||
font-size: 1.2rem;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
background: $main-bg;
|
||||
|
||||
.title {
|
||||
padding: 2rem 0 1rem 2rem;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.functions {
|
||||
display: grid;
|
||||
grid-template-columns: 33.33% 33.33% 33.33%;
|
||||
|
||||
color: white;
|
||||
|
||||
.function {
|
||||
margin: 15px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
border-radius: 50%;
|
||||
background: $second-btn-color-tran;
|
||||
padding: .6rem;
|
||||
height: 1.6rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button-ctn {
|
||||
font-size: 1.4rem;
|
||||
z-index: 99999;
|
||||
width: 70vw;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: $main-bg;
|
||||
|
||||
.button {
|
||||
box-sizing: border-box;
|
||||
width: calc(100% - 4rem);
|
||||
background: $second-btn-color;
|
||||
margin: 2rem;
|
||||
height: 4.5rem;
|
||||
border-radius: 3px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
|
||||
img {
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user