合并代码

This commit is contained in:
sx 2025-02-05 23:29:54 +08:00
parent 06f743bb30
commit 2bb07b4957
6 changed files with 95 additions and 38 deletions

View File

@ -70,7 +70,8 @@ const video = {
*/
setLabel(param) {
return util.request({
url: `/video/api/saveTags`,
url: `/video/tag/add`,
// url: `/video/api/saveTags`,
data: param.data,
method: 'POST',
load: true,
@ -472,8 +473,8 @@ const video = {
*/
setAlarm(param) {
return util.request({
url: `/home/setAlarm`,
query: param.query,
url: `/video/clock/setAlarm`,
data: param.data,
method: 'POST',
})
},
@ -483,7 +484,19 @@ const video = {
*/
getAlarm() {
return util.request({
url: `/home/getAlarm`,
url: `/video/clock/selectAlarm`,
method: 'GET',
})
},
/**
* 删除闹铃
* @param {Object} param
*/
delAlarm(param) {
return util.request({
url: `/video/clock/delAlarm`,
data: param.data,
method: 'POST',
})
},

View File

@ -2,12 +2,13 @@
const config = {
// 接口域名
// #ifdef H5
host: 'h5api',
host: 'http://localhost:5173',
// host: 'h5api',
// #endif
// #ifndef H5
host: 'http://91f.xyz:8080',
// host: 'http://192.168.0.110:8080',
// host: 'http://192.168.0.105:8080',
// host: 'http://192.168.0.100:8080',
// host: 'http://192.168.0.114:8080',
// #endif
// 支付方式配置

View File

@ -135,6 +135,9 @@ const util = {
//
reject(res)
},
complete(rs) {
console.log('upload complete',rs)
}
})
})
},

View File

@ -28,9 +28,11 @@
const typeList = reactive([{
name: '倒计时闹钟',
key: 'countDown',
type: '2',
}, {
name: '时间闹钟',
key: 'time',
type: '1',
}, ])
const typeIndex = ref(0)
//
@ -44,6 +46,7 @@
//
const alarm = computed(() => {
let result = uni.$store.state.alarmTime
if (result) result = util.formatTime('yyyy-MM-dd HH:mm:ss', result)
return result
})
//
@ -84,11 +87,14 @@
//
function getAlarm() {
api.video.getAlarm().then(rs => {
console.log('getAlarm', rs)
if (rs.code == 200) {
const result = rs.data
if (!result) return
const findIndex = typeList.findIndex(item => item.type == result.type)
if (findIndex != -1) typeIndex.value = findIndex
//
setTime(result.endTime)
setTime(result.timestamp)
return
}
})
@ -204,24 +210,29 @@
endTime = util.strtotime(`+${hour[hourIndex.value]} hour`, new Date().getTime())
endTime = util.strtotime(`+${minute[minuteIndex.value]} minute`, endTime)
endTime = new Date(endTime).setSeconds(0)
endTime = util.formatTime('yyyy-MM-dd HH:mm:ss', endTime)
// endTime = util.formatTime('yyyy-MM-dd HH:mm:ss', endTime)
} else if (type.key == 'time') {
//
endTime += ` ${util.toTwo(hour[hourIndex.value])}:${util.toTwo(minute[minuteIndex.value])}:00`
//
const currentTime = new Date(util.formatTime('yyyy-MM-dd HH:mm:ss')).valueOf()
//
const alarmTime = new Date(endTime).valueOf()
endTime = new Date(endTime).valueOf()
//
if (alarmTime < currentTime) {
if (endTime < currentTime) {
util.alert('设置闹钟时间应大于当前时间')
return
}
}
//
api.video.setAlarm({
query: {
endTime,
data: {
//
type: type.type,
//
timestamp: endTime,
}
}).then(rs => {
if (rs.code == 200) {
@ -240,6 +251,30 @@
})
}
//
function handleClose() {
util.alert({
content: '确定关闭闹钟提醒?',
success: (rs) => {
if(!rs.confirm) return
api.video.delAlarm({}).then(rs => {
if (rs.code == 200) {
uni.$store.commit('setState', {
key: 'alarmTime',
value: '',
})
close()
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
})
}
//
defineExpose({
open,
@ -256,7 +291,8 @@
<!-- 标题 -->
<view class="title mtb40">
<picker class="df fdr jcc aic" :range="typeList" @change="handleType" :value="typeIndex" range-key="name">
<picker class="df fdr jcc aic" :range="typeList" @change="handleType" :value="typeIndex"
range-key="name">
<text class="tac f40">{{typeList[typeIndex].name}}</text>
<uni-icons type="right" color="#999" size="32rpx" />
</picker>
@ -271,7 +307,8 @@
<view class="oclock">
<!-- 选择器 -->
<view class="f1">
<picker-view v-if="visible" class="select f1" :value="[hourIndex]" indicator-class="option active" indicator-style="height: 56rpx;" @change="handleHour">
<picker-view v-if="visible" class="select f1" :value="[hourIndex]"
indicator-class="option active" indicator-style="height: 56rpx;" @change="handleHour">
<picker-view-column>
<view v-for="(item,index) in hour" :key="index" class="option fdr aic jcc">
<text class="text">{{item}}</text>
@ -286,7 +323,8 @@
</view>
<view class="f1">
<picker-view v-if="visible" class="select f1" :value="[minuteIndex]" indicator-class="option active" indicator-style="height: 56rpx;" @change="handleMinute">
<picker-view v-if="visible" class="select f1" :value="[minuteIndex]"
indicator-class="option active" indicator-style="height: 56rpx;" @change="handleMinute">
<picker-view-column>
<view v-for="(item,index) in minute" :key="index" class="option fdr aic jcc">
<text class="text">{{item}}</text>
@ -306,8 +344,8 @@
<view class="button jcc confirm mtb10" @click="handleSubmit">
<text class="text">确认</text>
</view>
<view class="button jcc cancel mtb10" @click="close()">
<text class="text">关闭</text>
<view class="button jcc cancel mtb10" @click="handleClose" v-if="alarm">
<text class="text">关闭闹钟</text>
</view>
</view>
</view>

View File

@ -508,32 +508,34 @@
</view>
</view>
<view class="product mtb20" v-if="userinfo.isShop == 1" @click="$refs.productRef.open()">
<view class="key">添加商品链接</view>
<template v-if="userinfo.isShop == 1">
<view class="product mtb20" @click="$refs.productRef.open()">
<view class="key">添加商品链接</view>
<view class="main mtb20 ptb20 tac br20" v-if="!form.productId">点击选择</view>
<view class="main df oh mtb20 plr30 br20" v-else>
<view class="df oh mtb20">
<view class="col oh df fdc jcsb f1 mr20">
<view class="name">{{form.productName}}</view>
<view class="price thd cFF9B27 f28">
<text class="price thd mr20">价格{{form.productPrice}}</text>
<text class="commission thd">佣金{{form.commission}}</text>
<view class="main mtb20 ptb20 tac br20" v-if="!form.productId">点击选择</view>
<view class="main df oh mtb20 plr30 br20" v-else>
<view class="df oh mtb20">
<view class="col oh df fdc jcsb f1 mr20">
<view class="name">{{form.productName}}</view>
<view class="price thd cFF9B27 f28">
<text class="price thd mr20">价格{{form.productPrice}}</text>
<text class="commission thd">佣金{{form.commission}}</text>
</view>
</view>
</view>
<view class="wh200 fs0 c999 bfff br10">
<image class="br10" :src="form.productImage" mode="aspectFill" />
<view class="wh200 fs0 c999 bfff br10">
<image class="br10" :src="form.productImage" mode="aspectFill" />
</view>
</view>
</view>
</view>
</view>
<view class="second df jcr mtb20">
<view>需要在第</view>
<input type="text" v-model="form.popupTime" class="input" />
<view>秒展示</view>
</view>
<view class="second df jcr mtb20">
<view>需要在第</view>
<input type="text" v-model="form.popupTime" class="input" />
<view>秒展示</view>
</view>
</template>
<view class="fill" style="height: 150rpx;"></view>

View File

@ -4,9 +4,9 @@ import {
import uni from '@dcloudio/vite-plugin-uni';
//
let target = 'http://91f.xyz:8080'
// let target = 'http://91f.xyz:8080'
// let target = 'http://192.168.0.110:8080'
// let target = 'http://192.168.0.105:8080'
let target = 'http://192.168.0.100:8080'
// let target = 'http://192.168.0.114:8080'
export default defineConfig({