Commit 60a0a5b0 authored by jyx's avatar jyx

代码优化

parent 545cb2d3
......@@ -111,7 +111,6 @@
getPlayletManager
} = tt;
export default {
mixins: [common],
data() {
return {
vipList: [],
......@@ -186,7 +185,7 @@
}
});
this.post({
common.data.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
......@@ -209,7 +208,7 @@
handlePay() {
let that = this;
let vipBean = this.vipList[this.selectedIndex];
this.post({
common.data.post({
url: '/vip/getVipPayParams/douyin',
data: {
vedioId: that.point <= 0 ? null : that.vedioId,
......
<template>
<view style="background: white;height: 100%;">
<z-paging class="flex-1">
<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;">
<block v-for="(value,key) in dataList" :key="key">
<view class="mt-10"
style="width:31%; position: relative; border-radius:20rpx;margin-bottom: 10rpx;margin-left: 14rpx;"
@click.stop="click(value)" @longpress.stop="longClick(key)">
<image class="integral-mall-goods" mode="aspectFill" :src="value.coverImage"></image>
<view style="font-size: 26rpx;color: black;height: 60rpx;margin-left: 5rpx;">
{{value.title}}
</view>
<view class="text" style="font-size: 22rpx;color: gray;height: 30rpx;margin-left: 5rpx;">
{{value.vedioDesc}}
</view>
<view v-if="isEditStyle" @click.stop="cbClick(key)" style="position: absolute;background: #000000; opacity: 0.6;width: 92%;height: 96%;top: 0;border-radius:20rpx;
<view style="background-color: #f0f8ff;height: 100%;">
<scroll-view scroll-y="true" v-if="dataList.length>0" :style="{'height': clientHeight + 'px'}">
<view class="flex space" style="display:flex; flex-wrap:wrap;">
<block v-for="(value,key) in dataList" :key="key">
<view class="mt-10"
style="width:31%; position: relative; border-radius:20rpx;margin-bottom: 10rpx;margin-left: 14rpx;"
@click.stop="click(value)" @longpress.stop="longClick(key)">
<image class="integral-mall-goods" mode="aspectFill" :src="value.coverImage"></image>
<view style="font-size: 26rpx;color: black;height: 60rpx;margin-left: 5rpx;">
{{value.title}}
</view>
<view class="text" style="font-size: 22rpx;color: gray;height: 30rpx;margin-left: 5rpx;">
{{value.vedioDesc}}
</view>
<view v-if="isEditStyle" @click.stop="cbClick(key)" style="position: absolute;background: #000000; opacity: 0.6;width: 92%;height: 96%;top: 0;border-radius:20rpx;
padding-left: 20rpx;padding-top: 20rpx;">
<image v-if="value.isChecked" src="@/static/ic_selected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="!value.isChecked" src="@/static/ic_unselected.png"
style="width: 50rpx;height: 50rpx;" />
</view>
<image v-if="value.isChecked" src="@/static/ic_selected.png"
style="width: 50rpx;height: 50rpx;" />
<image v-if="!value.isChecked" src="@/static/ic_unselected.png"
style="width: 50rpx;height: 50rpx;" />
</view>
</block>
</view>
</scroll-view>
<view v-if="dataList.length<=0"
style="position: absolute;left: 50%;width: 240rpx;margin-left: -120rpx;top: 600rpx;text-align: center;">
<text style="color: gray;">暂无在追剧</text>
<view @click="goRecommend" class="button" style="margin-top: 20rpx;color: white;">去剧场</view>
</view>
</block>
</view>
</scroll-view>
<view v-if="dataList.length>=0" @click="clickEdit" class="editBar">
<image style="width: 50rpx;height: 50rpx;"
:src="!isEditStyle?'../../static/video/edit.png':'../../static/video/close.png'"></image>
</view>
</z-paging>
</view>
<view v-if="dataList.length<=0"
style="position: absolute;left: 50%;width: 240rpx;margin-left: -120rpx;top: 600rpx;text-align: center;">
<text style="color: gray;">暂无在追剧</text>
<view @click="goRecommend" class="button" style="margin-top: 20rpx;color: white;">去剧场</view>
</view>
<view v-if="dataList.length>=0" @click="clickEdit" class="editBar">
<image style="width: 50rpx;height: 50rpx;"
:src="!isEditStyle?'../../static/video/edit.png':'../../static/video/close.png'"></image>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import common from '@/mixins/common';
import {
gotoVideoPlayerPage
} from "@/common/page-route.js"
......@@ -62,9 +59,9 @@
return {
titleBarHeight: app.globalData.titleBarHeight,
statusBarHeight: app.globalData.statusBarHeight,
windowHeight: 0,
dataList: [],
isEditStyle: false
isEditStyle: false,
clientHeight: 0,
}
},
watch: {
......@@ -74,10 +71,15 @@
}
},
},
onLoad(e) {},
mounted() {
uni.getSystemInfo({
success: (res => {
this.clientHeight = res.windowHeight - 42;
})
});
},
methods: {
show() {
this.windowHeight = uni.getSystemInfoSync().windowHeight
this.loadData()
},
hide() {
......@@ -94,7 +96,12 @@
success: ({
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) {
this.$emit("showEdit", true)
} else {
......@@ -189,7 +196,7 @@
.editBar {
position: absolute;
bottom: 80rpx;
bottom: 200rpx;
right: 60rpx;
width: 80rpx;
height: 80rpx;
......@@ -197,7 +204,7 @@
justify-content: center;
align-items: center;
border-radius: 80rpx;
background-color: whitesmoke;
background-color: white;
box-shadow: 0 0 2px 0px rgba(255, 255, 255, 0.1);
}
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -124,7 +124,9 @@
this.isFirstLoad = false
this.queryList()
} else {
this.videoContext.play()
if (this.videoContext) {
this.videoContext.play()
}
}
},
hide() {
......
<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>
<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;
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content">
......@@ -10,7 +10,7 @@
</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>
<view class="flex1" style="margin-left:20rpx;">
......@@ -45,7 +45,7 @@
seq: 0,
episodeId: "",
countDown: 3,
showRewardAdPop: false,
showRewardAdPop: true,
showAdForServer: false,
showShortcutPop: false,
canShowShortcut: false,
......@@ -54,7 +54,10 @@
async beforeCreate() {
const pm = await getPlayletManager({
is: "playler", // 和插槽同名
});
});
console.log('AAAAAAAAAAAAA', pm)
pm.getPlayletInfo().then(res => {
this.albumId = res.albumId
this.seq = res.seq
......@@ -276,7 +279,6 @@
}
});
// do other thing
// 卸载 close 事件监听
// this.ad.offClose(closeHandler);
......
import {
navigateTo,
redirectTo,
loading,
message,
confirm,
alert
} from '../utils/fun.js';
const app = getApp();
export default {
data() {
return {
xhrPool: new Set(),
bottomSafePadding: app.globalData.bottomSafePadding,
options: {},
auth: false, // 登录验证
paying: false, // 支付按钮状态
};
},
onLoad(options) {
this.options = options;
},
onShow() {
this.loadData();
},
onHide() {
if (this.xhrPool.size) {
this.xhrPool.forEach((requestTask) => {
requestTask.abort();
})
}
},
methods: {
authTo(url) {//登录校验
},
authToNs(url) {//登录校验不保留当前页面
},
loadData() {},
startPay() {
loading.show();
this.paying = true;
},
stopPay() {
loading.hide();
this.paying = false;
},
/**
* @param {Object} url 接口请求地址
* @param {Object} method 接口请求方式
* @param {Object} data 接口请求参数
*/
$http(url, method, data = {}, showLoading = false) {
return new Promise((resolve, reject) => {
this[method.toLowerCase()]({
url: url,
data: data,
showLoading: showLoading,
success: (res) => {
resolve(res)
},
fail: (e) => {
reject(e)
}
});
})
},
login() {
// navigateTo('user/login');
// let redirect = this.$scope.$page.fullPath.replace('/pages', '');
// console.log(redirect)
// navigateTo('user/login?redirect=' + encodeURIComponent(redirect));
},
logout() {
uni.removeStorageSync('token');
},
put(options) {
options = Object.assign({
showLoading: true
}, options, {
method: 'PUT'
})
this.req(options);
},
post(options) {
options = Object.assign({
showLoading: true
}, options, {
method: 'POST'
})
this.req(options);
},
get(options) {
options = Object.assign({
showLoading: false
}, options, {
method: 'GET'
})
this.req(options);
},
req(options) {
let {
showLoading,
url,
data,
auth
} = options;
const success = options?.success;
const fail = options?.fail;
const header = options?.header ?? {};
showLoading && loading.show();
let requestTask;
let uniChannel='wechat';
// #ifdef MP-KUAISHOU
uniChannel='kuaishou';
// #endif
// #ifdef MP-TOUTIAO
uniChannel='douyin';
// #endif
Object.assign(header, {
token: uni.getStorageSync('token'),
pkgName: app.globalData.pkgName,
version: app.globalData.versionName,
proChannel:uniChannel
})
options = Object.assign(options, {
url: `${app.globalData.baseUrl}${url}`,
header,
data,
success: (res) => {
showLoading && loading.hide();
switch (res.data.status) {
case 200:
if (success) {
success(res.data);
}
break;
default:
if (fail) {
fail(res.data.message);
}
message.notify(res.data.message);
break;
}
},
fail: (e) => {
// message.notify('服务器开小差了');
// alert({
// content: JSON.stringify(e)
// });
if (fail) {
fail(e);
}
},
complete: () => {
this.xhrPool.delete(requestTask)
}
})
requestTask = uni.request(options);
this.xhrPool.add(requestTask)
}
}
};
import {
navigateTo,
redirectTo,
loading,
message,
confirm,
alert
} from '../utils/fun.js';
const app = getApp();
export default {
data() {
return {
xhrPool: new Set(),
bottomSafePadding: app.globalData.bottomSafePadding,
options: {},
auth: false, // 登录验证
paying: false, // 支付按钮状态
};
},
onLoad(options) {
this.options = options;
},
onShow() {
this.loadData();
},
onHide() {
if (this.xhrPool && this.xhrPool.size) {
this.xhrPool.forEach((requestTask) => {
requestTask.abort();
})
}
},
methods: {
authTo(url) { //登录校验
},
authToNs(url) { //登录校验不保留当前页面
},
loadData() {},
startPay() {
loading.show();
this.paying = true;
},
stopPay() {
loading.hide();
this.paying = false;
},
/**
* @param {Object} url 接口请求地址
* @param {Object} method 接口请求方式
* @param {Object} data 接口请求参数
*/
$http(url, method, data = {}, showLoading = false) {
return new Promise((resolve, reject) => {
this[method.toLowerCase()]({
url: url,
data: data,
showLoading: showLoading,
success: (res) => {
resolve(res)
},
fail: (e) => {
reject(e)
}
});
})
},
login() {
// navigateTo('user/login');
// let redirect = this.$scope.$page.fullPath.replace('/pages', '');
// console.log(redirect)
// navigateTo('user/login?redirect=' + encodeURIComponent(redirect));
},
logout() {
uni.removeStorageSync('token');
},
put(options) {
options = Object.assign({
showLoading: true
}, options, {
method: 'PUT'
})
this.req(options);
},
post(options) {
options = Object.assign({
showLoading: true
}, options, {
method: 'POST'
})
this.req(options);
},
get(options) {
options = Object.assign({
showLoading: false
}, options, {
method: 'GET'
})
this.req(options);
},
req(options) {
let {
showLoading,
url,
data,
auth
} = options;
const success = options?.success;
const fail = options?.fail;
const header = options?.header ?? {};
showLoading && loading.show();
let requestTask;
let uniChannel = 'wechat';
// #ifdef MP-KUAISHOU
uniChannel = 'kuaishou';
// #endif
// #ifdef MP-TOUTIAO
uniChannel = 'douyin';
// #endif
Object.assign(header, {
token: uni.getStorageSync('token'),
pkgName: app.globalData.pkgName,
version: app.globalData.versionName,
proChannel: uniChannel
})
options = Object.assign(options, {
url: `${app.globalData.baseUrl}${url}`,
header,
data,
success: (res) => {
showLoading && loading.hide();
switch (res.data.status) {
case 200:
if (success) {
success(res.data);
}
break;
default:
if (fail) {
fail(res.data.message);
}
message.notify(res.data.message);
break;
}
},
fail: (e) => {
// message.notify('服务器开小差了');
// alert({
// content: JSON.stringify(e)
// });
if (fail) {
fail(e);
}
},
complete: () => {
if (this.xhrPool) {
this.xhrPool.delete(requestTask)
}
}
})
requestTask = uni.request(options);
if (this.xhrPool) {
this.xhrPool.add(requestTask)
}
}
}
};
\ No newline at end of file
......@@ -36,12 +36,7 @@
{
"root": "pagesC",
"pages": [{
"path": "ttvideo/ttVideoDetail",
"style": {
"backgroundColor": "#000000",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "#ffffff"
}
"path": "ttvideo/ttVideoDetail"
}, {
"path": "playlet/index",
"style": {
......
......@@ -7,9 +7,8 @@
ref="follow" />
<userPage v-show="currentPage==3" ref="user" />
</view>
<view v-if="!isShowBlackBar" class="tabs-bar">
<view :class="currentPage==0?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(0)">
<view class="home-tab">
<view :class="currentPage==0?'tab active': 'tab'" @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">
......@@ -18,8 +17,7 @@
</view>
剧场
</view>
<view :class="currentPage == 1?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(1)">
<view :class="currentPage == 1?'tab active': 'tab'" @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>
......@@ -27,8 +25,7 @@
</view>
推荐
</view>
<view :class="currentPage == 2?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(2)">
<view :class="currentPage == 2?'tab active': 'tab'" @click="tabChange(2)">
<view v-if="false" style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image>
......@@ -36,8 +33,7 @@
</view>
看过
</view>
<view :class="currentPage == 3?'tab active': 'tab'"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'" @click="tabChange(3)">
<view :class="currentPage == 3?'tab active': 'tab'" @click="tabChange(3)">
<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>
......@@ -47,37 +43,6 @@
</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"
:style="'padding-top:35rpx;padding-bottom:' + bottomSafePadding + 'px;'">
<view class="editItem" @click="!isFullChoice?fullChoice():noChoice()">
......@@ -117,7 +82,6 @@
currentPage: 0,
showEditBar: false,
isFullChoice: false,
isShowBlackBar: false
}
},
onLoad(options) {
......@@ -129,9 +93,7 @@
if (tt.setVisualEffectOnCapture) {
tt.setVisualEffectOnCapture({
visualEffect: 'hidden',
success: (res) => {
},
success: (res) => {},
})
}
},
......@@ -226,40 +188,41 @@
<style lang="scss">
.body {
height: 100%;
// background-color: white;
}
.editBar {
position: absolute;
bottom: 0;
width: 100%;
height: 110rpx;
height: 60rpx;
background: white;
display: flex;
.editItem {
height: 110rpx;
line-height: 110rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
width: 50%;
}
}
.tabs-bar2 {
.home-tab {
display: flex;
background-color: black;
align-items: center;
background-color: white;
height: 42px;
.tab {
height: 110rpx;
flex: 1;
text-align: center;
font-size: 26rpx;
font-size: 12px;
font-weight: bold;
color: white;
color: black;
&.active {
color: #F8425A;
}
}
}
</style>
\ No newline at end of file
<template></template>
<script>
import Player from "@/components/player/player.vue";
import Charge from "@/components/charge/charge.vue";
......@@ -44,7 +45,7 @@
console.log("show");
},
mounted() {
console.error(this, "this");
// console.error(this, "this");
},
onShareAppMessage() {
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