合并代码

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) { setLabel(param) {
return util.request({ return util.request({
url: `/video/api/saveTags`, url: `/video/tag/add`,
// url: `/video/api/saveTags`,
data: param.data, data: param.data,
method: 'POST', method: 'POST',
load: true, load: true,
@ -472,8 +473,8 @@ const video = {
*/ */
setAlarm(param) { setAlarm(param) {
return util.request({ return util.request({
url: `/home/setAlarm`, url: `/video/clock/setAlarm`,
query: param.query, data: param.data,
method: 'POST', method: 'POST',
}) })
}, },
@ -483,7 +484,19 @@ const video = {
*/ */
getAlarm() { getAlarm() {
return util.request({ 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', method: 'POST',
}) })
}, },

View File

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

View File

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

View File

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

View File

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

View File

@ -4,9 +4,9 @@ import {
import uni from '@dcloudio/vite-plugin-uni'; 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.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' // let target = 'http://192.168.0.114:8080'
export default defineConfig({ export default defineConfig({