diff --git a/jiuyi2/api/intergral.js b/jiuyi2/api/intergral.js index b57b6c94..04c6bd34 100644 --- a/jiuyi2/api/intergral.js +++ b/jiuyi2/api/intergral.js @@ -97,6 +97,7 @@ const intergral = { return util.request({ url: `/coreplay/app/scrollinfo/buyScroll`, method: 'POST', + query: param.query, data: param.data, }) }, diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 7b5a66a6..83ae98b8 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -1477,7 +1477,7 @@ const util = { reslove(rs.data) const userinfo = rs.data // 如果开启了青少年模式 - if (userinfo.teenTime) getTeenMode(userinfo.teenTime) + if (userinfo.teenTime) util.getTeenMode(userinfo.teenTime) // 提交 store.commit('setState', { key: 'userinfo', @@ -1501,10 +1501,11 @@ const util = { // 当前小时 const currentHour = currentDate.getHours() // 大于八点 小于22点 当前时间小于设定时间 - const result = currentHour >= 8 && currentHour < 22 && currentDate.valueOf() < new Date(teenTime).valueOf() + const result = currentHour >= 6 && currentHour < 22 && currentDate.valueOf() < new Date(teenTime).valueOf() // 锁定 function lock() { + console.log('lock') uni.reLaunch({ url: '/pages/login/lock' }) @@ -1512,6 +1513,7 @@ const util = { // 结果 if (result) { + console.log('time', new Date(teenTime).valueOf() - currentDate.valueOf()) // 设置定时器 setTimeout(() => { lock() diff --git a/jiuyi2/pages/index/integralMall.vue b/jiuyi2/pages/index/integralMall.vue index 7cc1056d..02d5f34c 100644 --- a/jiuyi2/pages/index/integralMall.vue +++ b/jiuyi2/pages/index/integralMall.vue @@ -2,7 +2,6 @@ /** * 卷轴商城 */ - // import intergralApi from '@/api/intergral.js'; import api from '@/api/index.js' import { useStore, @@ -11,16 +10,24 @@ ref, reactive, computed, + getCurrentInstance } from 'vue' import { onLoad, } from '@dcloudio/uni-app' // 工具库 import util from '@/common/js/util'; + // 支付密码 + import payPwd from '@/components/mine/payPwd' + const { + proxy + } = getCurrentInstance() // const store = useStore() //我的卷轴列表 const dataList = ref([]) + // 需要操作的卷轴 + const scrollItem = ref({}) // 用户信息 const userinfo = computed(() => { let result = store.state.userinfo @@ -46,31 +53,40 @@ } // 购买卷轴 - function buyScroll(item) { - // - util.alert({ - content: '确认购买卷轴', + function buyScroll(secondPassword) { + api.intergral.buyScroll({ + query: { + // 二级密码 + secondPassword: secondPassword, + }, + data: { + // 卷轴id + scrollConfigId: scrollItem.value.scrollConfigInfoId, + // 付款类型 + payType: 1, + } }).then(rs => { - api.intergral.buyScroll({ - data: { - // 卷轴id - scrollConfigId: item.scrollConfigInfoId, - // 付款类型 - payType: 1, - } - }).then(rs => { - if (rs.code === 200) { - util.alert('购买成功') - // util.getUserinfo() - return - } - util.alert({ - content: rs.msg, - showCancel: false, - }) + if (rs.code === 200) { + util.alert('购买成功') + // util.getUserinfo() + return + } + util.alert({ + content: rs.msg, + showCancel: false, }) }) } + + /** + * 点击卷轴购买 + * @param {Object} item + */ + function handleItem(item) { + scrollItem.value = item + // + proxy.$refs.payPwdRef.open() + }