Commit 60a0a5b0 authored by jyx's avatar jyx

代码优化

parent 545cb2d3
...@@ -111,7 +111,6 @@ ...@@ -111,7 +111,6 @@
getPlayletManager getPlayletManager
} = tt; } = tt;
export default { export default {
mixins: [common],
data() { data() {
return { return {
vipList: [], vipList: [],
...@@ -186,7 +185,7 @@ ...@@ -186,7 +185,7 @@
} }
}); });
this.post({ common.data.post({
url: '/user/baseMsg', url: '/user/baseMsg',
showLoading: false, showLoading: false,
success: ({ success: ({
...@@ -209,7 +208,7 @@ ...@@ -209,7 +208,7 @@
handlePay() { handlePay() {
let that = this; let that = this;
let vipBean = this.vipList[this.selectedIndex]; let vipBean = this.vipList[this.selectedIndex];
this.post({ common.data.post({
url: '/vip/getVipPayParams/douyin', url: '/vip/getVipPayParams/douyin',
data: { data: {
vedioId: that.point <= 0 ? null : that.vedioId, vedioId: that.point <= 0 ? null : that.vedioId,
......
<template> <template>
<view style="background: white;height: 100%;"> <view style="background-color: #f0f8ff;height: 100%;">
<z-paging class="flex-1"> <scroll-view scroll-y="true" v-if="dataList.length>0" :style="{'height': clientHeight + 'px'}">
<scroll-view scroll-y="true" v-if="dataList.length>0" :style="'height: '+(windowHeight -120)+'px;'">
<view class="flex space" style="display:flex; flex-wrap:wrap;"> <view class="flex space" style="display:flex; flex-wrap:wrap;">
<block v-for="(value,key) in dataList" :key="key"> <block v-for="(value,key) in dataList" :key="key">
<view class="mt-10" <view class="mt-10"
...@@ -36,9 +35,7 @@ ...@@ -36,9 +35,7 @@
<image style="width: 50rpx;height: 50rpx;" <image style="width: 50rpx;height: 50rpx;"
:src="!isEditStyle?'../../static/video/edit.png':'../../static/video/close.png'"></image> :src="!isEditStyle?'../../static/video/edit.png':'../../static/video/close.png'"></image>
</view> </view>
</z-paging>
</view> </view>
</template> </template>
<script> <script>
...@@ -62,9 +59,9 @@ ...@@ -62,9 +59,9 @@
return { return {
titleBarHeight: app.globalData.titleBarHeight, titleBarHeight: app.globalData.titleBarHeight,
statusBarHeight: app.globalData.statusBarHeight, statusBarHeight: app.globalData.statusBarHeight,
windowHeight: 0,
dataList: [], dataList: [],
isEditStyle: false isEditStyle: false,
clientHeight: 0,
} }
}, },
watch: { watch: {
...@@ -74,10 +71,15 @@ ...@@ -74,10 +71,15 @@
} }
}, },
}, },
onLoad(e) {}, mounted() {
uni.getSystemInfo({
success: (res => {
this.clientHeight = res.windowHeight - 42;
})
});
},
methods: { methods: {
show() { show() {
this.windowHeight = uni.getSystemInfoSync().windowHeight
this.loadData() this.loadData()
}, },
hide() { hide() {
...@@ -94,7 +96,12 @@ ...@@ -94,7 +96,12 @@
success: ({ success: ({
data data
}) => { }) => {
this.dataList = data.list; for (var i = 0; i < 10; i++) {
this.dataList = [...this.dataList, ...data.list];
}
// this.dataList = data.list;
if (this.dataList.length > 0) { if (this.dataList.length > 0) {
this.$emit("showEdit", true) this.$emit("showEdit", true)
} else { } else {
...@@ -189,7 +196,7 @@ ...@@ -189,7 +196,7 @@
.editBar { .editBar {
position: absolute; position: absolute;
bottom: 80rpx; bottom: 200rpx;
right: 60rpx; right: 60rpx;
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
...@@ -197,7 +204,7 @@ ...@@ -197,7 +204,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
border-radius: 80rpx; border-radius: 80rpx;
background-color: whitesmoke; background-color: white;
box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1); box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1);
} }
</style> </style>
\ No newline at end of file
This diff is collapsed.
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<image class="mt-30" mode="widthFix" :src="maskImage1"></image> <image class="mt-30" mode="widthFix" :src="maskImage1"></image>
<image :src="maskImage2" mode="widthFix"></image> <image :src="maskImage2" mode="widthFix"></image>
</view> </view>
<z-paging style="height: 100%;background-color: #f0f8ff;">
<scroll-view scroll-y="true" :style="{'height': clientHeight + 'px'}">
<view style="width: 100%;height: 340rpx; <view style="width: 100%;height: 340rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
<view class="item_bd ellipsis" style="margin-left: 58rpx;"></view> <view class="item_bd ellipsis" style="margin-left: 58rpx;"></view>
</view> </view>
</view> </view>
</z-paging> </scroll-view>
<kefu-popup :show="showKefuPop" @close="showKefuPop = false" /> <kefu-popup :show="showKefuPop" @close="showKefuPop = false" />
</view> </view>
...@@ -154,9 +155,17 @@ ...@@ -154,9 +155,17 @@
showMask: false, showMask: false,
showKefuPop: false, showKefuPop: false,
maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png', maskImage1: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find1.png',
maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png' maskImage2: 'https://mints-web.oss-cn-beijing.aliyuncs.com/images/bg_find2.png',
clientHeight: 0,
}; };
}, },
mounted() {
uni.getSystemInfo({
success: (res => {
this.clientHeight = res.windowHeight - 42;
})
});
},
methods: { methods: {
show() { show() {
this.post({ this.post({
......
...@@ -124,8 +124,10 @@ ...@@ -124,8 +124,10 @@
this.isFirstLoad = false this.isFirstLoad = false
this.queryList() this.queryList()
} else { } else {
if (this.videoContext) {
this.videoContext.play() this.videoContext.play()
} }
}
}, },
hide() { hide() {
if (this.videoContext) { if (this.videoContext) {
......
<template>
<view class="number-box">
<view @click="_calcValue('minus')" class="number-box-btns" :class="{ 'number-box-disabled': inputValue <= min || disabled }">
<icons icon="minus" :color="inputValue <= min || disabled ? '#868686' : '#299FEF'" size="40" />
</view>
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="number-box-input" type="number" v-model="inputValue" />
<view @click="_calcValue('plus')" class="number-box-btns"><icons icon="plus" :color="inputValue >= max || disabled ? '#868686' : '#299FEF'" size="40" /></view>
</view>
</template>
<script>
/**
* NumberBox 数字输入框
* @description 带加减按钮的数字输入框
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
* @property {Number} value 输入框当前值
* @property {Number} min 最小值
* @property {Number} max 最大值
* @property {Number} step 每次点击改变的间隔大小
* @property {String} color 字体颜色(前景色)
* @property {Boolean} disabled = [true|false] 是否为禁用状态
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
* @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象
* @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象
*/
export default {
name: 'NumberBox',
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
props: {
value: {
type: [Number, String],
default: 1
},
modelValue: {
type: [Number, String],
default: 1
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
inputValue: 0
};
},
watch: {
value(val) {
this.inputValue = +val;
},
modelValue(val) {
this.inputValue = +val;
}
},
created() {
if (this.value === 1) {
this.inputValue = +this.modelValue;
}
if (this.modelValue === 1) {
this.inputValue = +this.value;
}
},
methods: {
_calcValue(type) {
if (this.disabled) {
return;
}
const scale = this._getDecimalScale();
let value = this.inputValue * scale;
let step = this.step * scale;
if (type === 'minus') {
value -= step;
if (value < this.min * scale) {
return;
}
if (value > this.max * scale) {
value = this.max * scale;
}
}
if (type === 'plus') {
value += step;
if (value > this.max * scale) {
return;
}
if (value < this.min * scale) {
value = this.min * scale;
}
}
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
this.$emit('change', +this.inputValue);
// TODO vue2 兼容
this.$emit('input', +this.inputValue);
// TODO vue3 兼容
this.$emit('update:modelValue', +this.inputValue);
},
_getDecimalScale() {
let scale = 1;
// 浮点型
if (~~this.step !== this.step) {
scale = Math.pow(10, String(this.step).split('.')[1].length);
}
return scale;
},
_onBlur(event) {
this.$emit('blur', event);
let value = event.detail.value;
if (!value) {
// this.inputValue = 0;
return;
}
value = +value;
if (value > this.max) {
value = this.max;
} else if (value < this.min) {
value = this.min;
}
const scale = this._getDecimalScale();
this.inputValue = value.toFixed(String(scale).length - 1);
this.$emit('change', +this.inputValue);
this.$emit('input', +this.inputValue);
},
_onFocus(event) {
this.$emit('focus', event);
}
}
};
</script>
<style lang="scss">
.number-box {
display: inline-flex;
align-items: center;
margin-right: -16rpx;
&-btns {
line-height: 1;
vertical-align: bottom;
display: inline-block;
padding: 16rpx;
cursor: pointer;
}
&-input {
margin: 0 4rpx;
width: 50rpx;
text-align: center;
color: black;
}
}
</style>
<template> <template>
<view> <view>
<view class="container" v-show="showRewardAdPop"> <view class="container" v-show="true">
<image @click="closeAdPop" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx; <image @click="closeAdPop" style="width: 50rpx; height: 50rpx;margin-left:auto;margin-right: 30rpx;
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image> margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content"> <view class="content">
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</view> </view>
</view> </view>
<view class="shortcut" v-show="showShortcutPop"> <view class="shortcut" v-show="true">
<image style="width:70rpx;height:70rpx;margin-left:10rpx;" src="../../static/logo-about.png"> <image style="width:70rpx;height:70rpx;margin-left:10rpx;" src="../../static/logo-about.png">
</image> </image>
<view class="flex1" style="margin-left:20rpx;"> <view class="flex1" style="margin-left:20rpx;">
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
seq: 0, seq: 0,
episodeId: "", episodeId: "",
countDown: 3, countDown: 3,
showRewardAdPop: false, showRewardAdPop: true,
showAdForServer: false, showAdForServer: false,
showShortcutPop: false, showShortcutPop: false,
canShowShortcut: false, canShowShortcut: false,
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
const pm = await getPlayletManager({ const pm = await getPlayletManager({
is: "playler", // 和插槽同名 is: "playler", // 和插槽同名
}); });
console.log('AAAAAAAAAAAAA', pm)
pm.getPlayletInfo().then(res => { pm.getPlayletInfo().then(res => {
this.albumId = res.albumId this.albumId = res.albumId
this.seq = res.seq this.seq = res.seq
...@@ -276,7 +279,6 @@ ...@@ -276,7 +279,6 @@
} }
}); });
// do other thing
// 卸载 close 事件监听 // 卸载 close 事件监听
// this.ad.offClose(closeHandler); // this.ad.offClose(closeHandler);
......
...@@ -27,17 +27,17 @@ export default { ...@@ -27,17 +27,17 @@ export default {
this.loadData(); this.loadData();
}, },
onHide() { onHide() {
if (this.xhrPool.size) { if (this.xhrPool && this.xhrPool.size) {
this.xhrPool.forEach((requestTask) => { this.xhrPool.forEach((requestTask) => {
requestTask.abort(); requestTask.abort();
}) })
} }
}, },
methods: { methods: {
authTo(url) {//登录校验 authTo(url) { //登录校验
}, },
authToNs(url) {//登录校验不保留当前页面 authToNs(url) { //登录校验不保留当前页面
}, },
loadData() {}, loadData() {},
...@@ -118,21 +118,21 @@ export default { ...@@ -118,21 +118,21 @@ export default {
let requestTask; let requestTask;
let uniChannel='wechat'; let uniChannel = 'wechat';
// #ifdef MP-KUAISHOU // #ifdef MP-KUAISHOU
uniChannel='kuaishou'; uniChannel = 'kuaishou';
// #endif // #endif
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
uniChannel='douyin'; uniChannel = 'douyin';
// #endif // #endif
Object.assign(header, { Object.assign(header, {
token: uni.getStorageSync('token'), token: uni.getStorageSync('token'),
pkgName: app.globalData.pkgName, pkgName: app.globalData.pkgName,
version: app.globalData.versionName, version: app.globalData.versionName,
proChannel:uniChannel proChannel: uniChannel
}) })
options = Object.assign(options, { options = Object.assign(options, {
...@@ -165,12 +165,16 @@ export default { ...@@ -165,12 +165,16 @@ export default {
} }
}, },
complete: () => { complete: () => {
if (this.xhrPool) {
this.xhrPool.delete(requestTask) this.xhrPool.delete(requestTask)
} }
}
}) })
requestTask = uni.request(options); requestTask = uni.request(options);
if (this.xhrPool) {
this.xhrPool.add(requestTask) this.xhrPool.add(requestTask)
} }
} }
}
}; };
\ No newline at end of file
...@@ -36,12 +36,7 @@ ...@@ -36,12 +36,7 @@
{ {
"root": "pagesC", "root": "pagesC",
"pages": [{ "pages": [{
"path": "ttvideo/ttVideoDetail", "path": "ttvideo/ttVideoDetail"
"style": {
"backgroundColor": "#000000",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
}, { }, {
"path": "playlet/index", "path": "playlet/index",
"style": { "style": {
......
...@@ -7,9 +7,8 @@ ...@@ -7,9 +7,8 @@
ref="follow" /> ref="follow" />
<userPage v-show="currentPage==3" ref="user" /> <userPage v-show="currentPage==3" ref="user" />
</view> </view>
<view v-if="!isShowBlackBar" class="tabs-bar"> <view class="home-tab">
<view :class="currentPage==0?'tab active': 'tab'" <view :class="currentPage==0?'tab active': 'tab'" @click="tabChange(0)">
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(0)">
<view v-if="false" style="margin: 16rpx 0 11rpx;"> <view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==0" class="tabs-image" src="/static/tab/index_selected.png" <image v-if="currentPage==0" class="tabs-image" src="/static/tab/index_selected.png"
mode="heightFix"> mode="heightFix">
...@@ -18,8 +17,7 @@ ...@@ -18,8 +17,7 @@
</view> </view>
剧场 剧场
</view> </view>
<view :class="currentPage == 1?'tab active': 'tab'" <view :class="currentPage == 1?'tab active': 'tab'" @click="tabChange(1)">
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(1)">
<view v-if="false" style="margin: 16rpx 0 11rpx;"> <view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==1" class="tabs-image" src="/static/tab/promote_selected.png" <image v-if="currentPage==1" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image> mode="heightFix"></image>
...@@ -27,8 +25,7 @@ ...@@ -27,8 +25,7 @@
</view> </view>
推荐 推荐
</view> </view>
<view :class="currentPage == 2?'tab active': 'tab'" <view :class="currentPage == 2?'tab active': 'tab'" @click="tabChange(2)">
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(2)">
<view v-if="false" style="margin: 16rpx 0 11rpx;"> <view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/promote_selected.png" <image v-if="currentPage==2" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image> mode="heightFix"></image>
...@@ -36,8 +33,7 @@ ...@@ -36,8 +33,7 @@
</view> </view>
看过 看过
</view> </view>
<view :class="currentPage == 3?'tab active': 'tab'" <view :class="currentPage == 3?'tab active': 'tab'" @click="tabChange(3)">
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(3)">
<view v-if="false" style="margin: 16rpx 0 11rpx;"> <view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==3" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix"> <image v-if="currentPage==3" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix">
</image> </image>
...@@ -47,37 +43,6 @@ ...@@ -47,37 +43,6 @@
</view> </view>
</view> </view>
<view v-if="isShowBlackBar" class="tabs-bar2">
<view :class="currentPage==0?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(0)">
<view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==0" class="tabs-image" src="/static/tab/index_selected.png"
mode="heightFix">
</image>
<image v-else class="tabs-image" src="/static/tab/index_unselected.png" mode="heightFix"></image>
</view>
剧场
</view>
<view :class="currentPage == 1?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(1)">
<view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==1" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image>
<image v-else class="tabs-image" src="/static/tab/promote_unselected.png" mode="heightFix"></image>
</view>
推荐
</view>
<view :class="currentPage == 2?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(2)">
<view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix">
</image>
<image v-else class="tabs-image" src="/static/tab/my_unselected.png" mode="heightFix"></image>
</view>
我的
</view>
</view>
<view v-if="showEditBar" class="editBar" <view v-if="showEditBar" class="editBar"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'"> :style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'">
<view class="editItem" @click="!isFullChoice?fullChoice():noChoice()"> <view class="editItem" @click="!isFullChoice?fullChoice():noChoice()">
...@@ -117,7 +82,6 @@ ...@@ -117,7 +82,6 @@
currentPage: 0, currentPage: 0,
showEditBar: false, showEditBar: false,
isFullChoice: false, isFullChoice: false,
isShowBlackBar: false
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -129,9 +93,7 @@ ...@@ -129,9 +93,7 @@
if (tt.setVisualEffectOnCapture) { if (tt.setVisualEffectOnCapture) {
tt.setVisualEffectOnCapture({ tt.setVisualEffectOnCapture({
visualEffect: 'hidden', visualEffect: 'hidden',
success: (res) => { success: (res) => {},
},
}) })
} }
}, },
...@@ -226,40 +188,41 @@ ...@@ -226,40 +188,41 @@
<style lang="scss"> <style lang="scss">
.body { .body {
height: 100%; height: 100%;
// background-color: white;
} }
.editBar { .editBar {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 110rpx; height: 60rpx;
background: white; background: white;
display: flex; display: flex;
.editItem { .editItem {
height: 110rpx; height: 60rpx;
line-height: 110rpx; line-height: 60rpx;
text-align: center; text-align: center;
width: 50%; width: 50%;
} }
} }
.tabs-bar2 { .home-tab {
display: flex; display: flex;
background-color: black; align-items: center;
background-color: white;
height: 42px;
.tab { .tab {
height: 110rpx;
flex: 1; flex: 1;
text-align: center; text-align: center;
font-size: 26rpx; font-size: 12px;
font-weight: bold; font-weight: bold;
color: white; color: black;
&.active { &.active {
color: #F8425A; color: #F8425A;
} }
} }
} }
</style> </style>
\ No newline at end of file
<template></template>
<script> <script>
import Player from "@/components/player/player.vue"; import Player from "@/components/player/player.vue";
import Charge from "@/components/charge/charge.vue"; import Charge from "@/components/charge/charge.vue";
...@@ -44,7 +45,7 @@ ...@@ -44,7 +45,7 @@
console.log("show"); console.log("show");
}, },
mounted() { mounted() {
console.error(this, "this"); // console.error(this, "this");
}, },
onShareAppMessage() { onShareAppMessage() {
console.log("share"); console.log("share");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment