diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index 8312ae95..70e99c96 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,8 +6,8 @@ const config = { // host: 'h5api', // #endif // #ifndef H5 - host: 'http://91f.xyz:8080', - // host: 'http://b2xbj5.natappfree.cc', + // host: 'http://91f.xyz:8080', + host: 'http://epiryz.natappfree.cc', // #endif // 支付方式配置 payType: { diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 62c310c5..ea7d3236 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -213,7 +213,7 @@ const util = { responseType: params.responseType || 'text', // 请求成功返回 success: res => { - console.log('request success', url, res, params.data ? params.data : '') + // console.log('request success', url, res, params.data ? params.data : '') // 关闭加载效果 if (params.load) { uni.hideLoading() @@ -1535,16 +1535,12 @@ const util = { let userinfo = uni.$store.state.userinfo return new Promise((resolve, reject) => { // 登录 - if (!userinfo.id) { - // util.alert('请先登录') - // 失败 - reject() - } else { + if (userinfo.id) { // 成功 resolve() // 回调 cb ? cb() : '' - } + } else reject() }) }, diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index b7760086..bbf1b54f 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -63,7 +63,7 @@ type: Number, default: 0, }, - // 是否统计 0不是 1是 + // 是否显示统计 0不显示 1显示 statistic: { type: [String, Number], default: 0, @@ -113,7 +113,6 @@ if (Math.abs(formatNumber(ratio2) - formatNumber(ratio1)) < 1) result = 'cover' return result }) - const userinfo = uni.$store.state.userinfo watch(() => props.current, (nV) => { if (nV == props.index) play() @@ -137,8 +136,6 @@ // 是否计数 if (isTap.value) { return - tapList.length = 0 - changeVideoPlay() } else { isTap.value = true // 时间 @@ -389,11 +386,11 @@ */ function handleLike(index, likeType, isLike) { util.isLogin().then(rs => { - emit('like', { - index, - likeType, - isLike, - }) + emit('like', { + index, + likeType, + isLike, + }) }).catch(() => { uni.navigateTo({ url: '/pages/login/loginPhone' @@ -552,7 +549,7 @@ - + diff --git a/jiuyi2/components/index/videoMenu.vue b/jiuyi2/components/index/videoMenu.vue index 7a0f7fb5..b8f010ef 100644 --- a/jiuyi2/components/index/videoMenu.vue +++ b/jiuyi2/components/index/videoMenu.vue @@ -32,7 +32,12 @@ isMine: { type: [String, Number], default: 0, - } + }, + // 是否显示统计 0不显示 1显示 + statistic: { + type: [String, Number], + default: 0, + }, }) // 子触发父 const emit = defineEmits(['item']) @@ -70,6 +75,7 @@ url: util.setUrl('/pages/index/videoDetail', { videoId: item.id, isMine: props.isMine, + statistic: props.statistic, }) }) // videoUrl.value = item.format_videoUrl @@ -78,7 +84,6 @@ } // 菜单模式 else if (props.mode == 'menu') { - videoUrl.value = item.format_videoUrl emit('item', item) } // 多选模式 diff --git a/jiuyi2/components/mine/product.vue b/jiuyi2/components/mine/product.vue index cb110e7b..a875bb11 100644 --- a/jiuyi2/components/mine/product.vue +++ b/jiuyi2/components/mine/product.vue @@ -99,7 +99,7 @@ diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index dbf0a8d0..605bf838 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -604,7 +604,7 @@ function videoLike(param) { // 当前项 const item = tabCurrent.value.listData()[param.index] - console.log('data', { + const data = { // 视频id videoId: item.id, // 点赞用户id @@ -615,22 +615,11 @@ likeType: param.likeType, // //点赞 0.点赞 1.取消点赞 isLike: param.isLike, - }) + } // api.video.videoLike({ - data: { - // 视频id - videoId: item.id, - // 点赞用户id - likeUserId: userinfo.value.id, - // 被点赞用户id - targetUserId: item.userId, - // 点赞类型 0.公开赞 1.隐私赞 - likeType: param.likeType, - //点赞 0.点赞 1.取消点赞 - isLike: param.isLike, - } + data, }).then(rs => { if (rs.code == 200) { uni.$emit('updateVideo', { @@ -689,7 +678,6 @@ * @param {Object} item 视频列表项 */ function handleShowProduct(item) { - console.log('video', item) // 打开产品详情弹窗 proxy.$refs.productAltRef.init(item.productId) } diff --git a/jiuyi2/pages/index/videoDetail.nvue b/jiuyi2/pages/index/videoDetail.nvue index 05c99efd..8e5346c0 100644 --- a/jiuyi2/pages/index/videoDetail.nvue +++ b/jiuyi2/pages/index/videoDetail.nvue @@ -7,6 +7,7 @@ ref, getCurrentInstance, reactive, + computed, } from 'vue' import { onLoad, @@ -24,6 +25,10 @@ import collectAlt from '@/components/index/collect.vue' // 分享到好友弹窗 import shareFirendAlt from '@/components/index/shareFirend.vue' + // 产品详情弹窗 + import productAlt from '@/components/index/proDetailAlt.vue' + // 产品规格弹窗 + import productSpecAlt from '@/components/shop/detail/makeOrder.vue' const { proxy @@ -34,11 +39,17 @@ const detail = reactive({}) // 是否是自己 const isMine = ref(false) + // 显示统计 + const statistic = ref('0') + // 用户信息 + const userinfo = computed(() => uni.$store.state.userinfo) onLoad((option) => { if (option.videoId) videoId.value = option.videoId // 是否我的作品 if (option.isMine && option.isMine != 'false') isMine.value = option.isMine + // 是否显示统计 + if (option.statistic) statistic.value = option.statistic // 获取视频详情 getVideoDetail() @@ -64,12 +75,7 @@ } }).then(rs => { if (rs.code == 200) { - const result = rs.data - - result.format_videoUrl = util.format_url(result.videoUrl, 'video') - result.format_header = util.format_url(result.header, 'img') - - Object.assign(detail, result) + Object.assign(detail, rs.data) // 播放视频 proxy.$refs.indexVideo.play() @@ -107,41 +113,38 @@ proxy.$refs.shareFirendRef.open() } + /** * 视频点赞 * @param {Object} param 见下 * @param {Number} param.index 操作的视频下标 - * @param {Number|String} param.isLike 点赞操作 + * @param {Number|String} param.isLike 0.点赞 1.取消点赞 + * @param {Number|String} param.likeType 点赞类型 0.公开赞 1.隐私赞 */ function videoLike(param) { - const { - index, - isLike - } = param const item = detail - // 操作状态 - let type = 1 - // 0未点赞 1已点赞 3私密赞 - if (item.isLike == 0) type = isLike + const data = { + // 视频id + videoId: item.id, + // 点赞用户id + likeUserId: userinfo.value.id, + // 被点赞用户id + targetUserId: item.userId, + // 点赞类型 0.公开赞 1.隐私赞 + likeType: param.likeType, + // //点赞 0.点赞 1.取消点赞 + isLike: param.isLike, + } // api.video.videoLike({ - query: { - // 0赞1取消赞 3私密赞 - type, - // 视频id - videoId: item.videoId, - } + data, }).then(rs => { if (rs.code == 200) { - // 同步点赞状态 - item.isLike = { - 0: 1, - 1: 0, - 3: 3, - } [type] - // 取消减数量 否则增加 - type == 1 ? item.likes-- : item.likes++ + uni.$emit('updateVideo', { + ...item, + ...rs.data, + }) return } util.alert({ @@ -206,17 +209,64 @@ * @param {Object} detail */ function handleDataCenter(detail) { + uni.navigateTo({ + url: util.setUrl('/pages/index/dataCenter/dataCenter', { + videoId: detail.id, + }) + }) + } + + /** + * 打开产品弹窗 + * @param {Object} item 视频列表项 + */ + function handleShowProduct(item) { + // 打开产品详情弹窗 + proxy.$refs.productAltRef.init(item.productId) + } + + /** + * 商品弹窗购买 + * @param {Object} product + */ + function handleProductBuy(product) { + Object.assign(productDetail, {}, product) // + proxy.$refs.productSpecAltRef.open() + } + + /** + * 商品购买 + * @param {Object} video 视频列表 + */ + function handleProBuy(video) { + // 获取商品详情 + api.shop.productDetail({ + query: { + // 产品id + productionId: video.productId, + }, + }).then(rs => { + if (rs.code == 200) { + // + handleProductBuy(rs.data) + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) } diff --git a/jiuyi2/pages/mine/setting/teen.vue b/jiuyi2/pages/mine/setting/teen.vue index 86439a5e..3c71bc1a 100644 --- a/jiuyi2/pages/mine/setting/teen.vue +++ b/jiuyi2/pages/mine/setting/teen.vue @@ -7,8 +7,16 @@ useStore } from 'vuex' import { - computed + ref, + computed, + getCurrentInstance, } from 'vue'; + // 密码 + import payPwd from '@/components/mine/payPwd.vue' + // + const { + proxy + } = getCurrentInstance(); // vuex const store = useStore() // 用户信息 @@ -28,6 +36,32 @@ }) }) } + + // 关闭青少年模式 + function handleClose(userPassword) { + // 解除青少年模式 + api.mine.adolescentClose({ + path: [userPassword], + }).then(rs => { + if (rs.code == 200) { + util.alert('青少年模式已关闭') + store.commit('setState', { + key: 'userinfo', + value: { + ...userinfo.value, + teenTime: null, + } + }) + // 更新用户信息 + util.getUserinfo() + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + }