This commit is contained in:
GaoHao
2025-01-07 09:55:31 +08:00
17 changed files with 740 additions and 605 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/node_modules/ /node_modules/
/unpackage/ /unpackage/
/unpackage/dist/ /unpackage/dist/
/unpackage/dist/cache/

9
.hbuilderx/launch.json Normal file
View File

@@ -0,0 +1,9 @@
{
"version" : "1.0",
"configurations" : [
{
"playground" : "custom",
"type" : "uni-app:app-android"
}
]
}

234
App.vue
View File

@@ -1,124 +1,122 @@
<script> <script>
import http from '@/http/http.js' import { init } from '@/api/init.js'
export default { import http from '@/http/http.js'
onLaunch: function() { export default {
console.log('App Launch') onLaunch: function () {
// const systemInfo = uni.getSystemInfoSync(); console.log('App Launch')
// const isA = systemInfo.platform === 'android' // const systemInfo = uni.getSystemInfoSync();
// if (isA) { // const isA = systemInfo.platform === 'android'
// uni.setStorageSync('isAI', true) // if (isA) {
// } else { // uni.setStorageSync('isAI', true)
// uni.setStorageSync('isAI', false) // } else {
// } // uni.setStorageSync('isAI', false)
// }
}, },
onShow: function() { onShow: function () {
// ios是否在审核 init()
http.request({ // ios是否在审核
url: 'common/type/919', http.request({
}).then(res => { url: '/common/type/919',
if (res.code == 0) { }).then(res => {
uni.setStorageSync('isExamine', res.data.value) if (res.code == 0) {
} uni.setStorageSync('isExamine', res.data.value)
}) }
}, })
onHide: function() { },
console.log('App Hide') onHide: function () {
} console.log('App Hide')
} }
}
</script> </script>
<style lang="scss"> <style lang="scss">
/*每个页面公共css */ /*每个页面公共css */
@import "uview-plus/index.scss"; @import "uview-plus/index.scss";
ul, ul,
li { li {
list-style: none; list-style: none;
} }
.show { .show {
display: none !important; display: none !important;
} }
.hidden { .hidden {
display: block !important; display: block !important;
} }
page, page,
view, view,
scroll-view, scroll-view,
swiper, swiper,
swiper-item, swiper-item,
match-media, match-media,
movable-area, movable-area,
movable-view, movable-view,
cover-view, cover-view,
cover-image, cover-image,
icon, icon,
text, text,
rich-text, rich-text,
progress, progress,
button, button,
checkbox-group, checkbox-group,
editor, editor,
form, form,
input, input,
label, label,
picker, picker,
picker-view, picker-view,
radio-group, radio-group,
slider, slider,
switch, switch,
textarea, textarea,
navigator, navigator,
audio, audio,
camera, camera,
image, image,
video, video,
live-player, live-player,
live-pusher, live-pusher,
map, map,
canvas, canvas,
web-view { web-view {
box-sizing: border-box; box-sizing: border-box;
padding: 0; padding: 0;
margin: 0; margin: 0;
text-decoration: none; text-decoration: none;
outline: none; outline: none;
}
}
.initStyle {
.initStyle { padding: 20rpx;
padding: 20rpx; background-color: #2a2a2a;
background-color: #2a2a2a; height: 100vh;
height: 100vh; color: #fff;
color: #fff; }
}
.fc {
.fc { color: #f4f693;
color: #f4f693; }
}
.inputClass {
.inputClass { line-height: 80rpx;
line-height: 80rpx; }
}
.inputClass input {
.inputClass input { background-color: #fff;
background-color: #fff; height: 80rpx;
height: 80rpx; padding: 10rpx;
padding: 10rpx; color: #000;
color: #000; }
}
.result {
.result { position: absolute;
position: absolute; font-size: 100rpx;
font-size: 100rpx; left: 50%;
left: 50%; top: 800rpx;
top: 800rpx; transform: translateX(-50%);
transform: translateX(-50%); }
} </style>
</style>

35
api/index/index.js Normal file
View File

@@ -0,0 +1,35 @@
import http from '@/http/http.js'
// 获取弹窗信息
export const announcement = (data) => {
return http.request({
url: '/announcement',
data
})
}
// 获取公告
export const messageselectMessage = (data) => {
return http.request({
url: '/message/selectMessage',
data: {
page: 1,
limit: 5,
state: 1
}
})
}
// 获取推荐视频
export const courseselectCourse = (data) => {
return http.request({
url: '/course/selectCourse',
data
})
}
// 搜索
export const selectCourseTitles = (data) => {
return http.request({
url: '/course/selectCourseTitles',
data
})
}

13
api/init.js Normal file
View File

@@ -0,0 +1,13 @@
import http from '@/http/http.js'
export async function init() {
//热搜词
http.request({
url: 'common/type/249',
}).then(res => {
if (res.code == 0) {
uni.setStorageSync('moreSearch', res.data.value)
}
})
}

View File

@@ -6,6 +6,7 @@ import http from '@/http/http.js'
export const selectByUserId = (data) => { export const selectByUserId = (data) => {
return http.request({ return http.request({
url: '/courseCollect/selectByUserId', url: '/courseCollect/selectByUserId',
data: data data: data,
method: 'GET'
}) })
} }

View File

@@ -13,7 +13,7 @@ export const h5Config = {
export const AppConfig = { export const AppConfig = {
production: 'https://dj-api.hnsiyao.cn', production: 'https://dj-api.hnsiyao.cn',
test: 'https://video-h5.hnsiyao.cn', test: 'https://web-api.hnsiyao.cn',
local: 'http://192.168.1.41:8100' local: 'http://192.168.1.41:8100'
} }

View File

@@ -8,12 +8,11 @@ import {
} from 'lodash'; } from 'lodash';
import config from '@/commons/config.js' import config from '@/commons/config.js'
// 测试服 // 测试服
let baseUrl = config.baseApiUrl let baseUrl = config.baseApiUrl + 'app'
const loadingShowTime = 200 const loadingShowTime = 200
function getHeader() { function getHeader() {
const headerObject = {} const headerObject = {}
// headerObject["token"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNjkyNSIsImlhdCI6MTczNTg4OTk5NCwiZXhwIjoxNzM2NDk0Nzk0fQ.j-KFEE1FHckmFCO8UA884RBWvpMv8MfEGj7GPGf3kVo6sHeORl043Yle_w7HdTZKPpQqSr2LQLCq_rUxG4qqwA'
headerObject["token"] = uni.getStorageSync('token') headerObject["token"] = uni.getStorageSync('token')
return headerObject return headerObject
} }

View File

@@ -54,7 +54,8 @@
"NSPhotoLibraryUsageDescription" : "获取您的相册读取权限,目的是为了在我的资料页面使用相册读取功能,修改上传头像", "NSPhotoLibraryUsageDescription" : "获取您的相册读取权限,目的是为了在我的资料页面使用相册读取功能,修改上传头像",
"NSCameraUsageDescription" : "获取您的摄像头权限,目的是为了在我的资料页面使用摄像头功能,修改上传头像" "NSCameraUsageDescription" : "获取您的摄像头权限,目的是为了在我的资料页面使用摄像头功能,修改上传头像"
}, },
"urltypes" : "com.hnsiyao.duanju" "urltypes" : "com.hnsiyao.duanju",
"dSYMs" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs" : { "sdkConfigs" : {

View File

@@ -9,73 +9,75 @@
} }
}, },
"pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{
"path": "pages/task/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{
"path": "pages/chasingDrama/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{
"path": "pages/me/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},{
"path": "pages/login/register",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
},{
"path": "pages/login/registerApp",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
},{
"path": "pages/login/forgetPwd",
"style": {
"navigationBarTitleText": "忘记密码",
"navigationStyle": "custom"
}
},{
"path": "pages/me/userInfo",
"style": {
"navigationBarTitleText": "个人资料"
}
},
{
"path" : "pages/index/search/index",
"style" :
{ {
"navigationBarTitleText" : "搜索" "path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}, {
"path": "pages/video/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}, {
"path": "pages/task/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}, {
"path": "pages/chasingDrama/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
}, {
"path": "pages/watching_history/watching_history"
}, {
"path": "pages/me/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/register",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/registerApp",
"style": {
"navigationBarTitleText": "注册",
"navigationStyle": "custom"
}
}, {
"path": "pages/login/forgetPwd",
"style": {
"navigationBarTitleText": "忘记密码",
"navigationStyle": "custom"
}
}, {
"path": "pages/me/userInfo",
"style": {
"navigationBarTitleText": "个人资料"
}
},
{
"path": "pages/index/search/index",
"style": {
"navigationBarTitleText": "搜索"
}
} }
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
@@ -88,13 +90,12 @@
"selectedColor": "#FF7581", "selectedColor": "#FF7581",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "black", "borderStyle": "black",
"list": [ "list": [{
{
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "static/tabbar/index.png", "iconPath": "static/tabbar/index.png",
"selectedIconPath": "static/tabbar/index_2.png", "selectedIconPath": "static/tabbar/index_2.png",
"text": "小剧场" "text": "小剧场"
},{ }, {
"pagePath": "pages/video/index", "pagePath": "pages/video/index",
"iconPath": "static/tabbar/learn.png", "iconPath": "static/tabbar/learn.png",
"selectedIconPath": "static/tabbar/learn_2.png", "selectedIconPath": "static/tabbar/learn_2.png",
@@ -106,7 +107,7 @@
"selectedIconPath": "static/tabbar/task_2.png", "selectedIconPath": "static/tabbar/task_2.png",
"text": "任务" "text": "任务"
}, },
{ {
"pagePath": "pages/chasingDrama/index", "pagePath": "pages/chasingDrama/index",
"iconPath": "static/tabbar/zhuiju.png", "iconPath": "static/tabbar/zhuiju.png",

View File

@@ -4,87 +4,65 @@
<view class="list-wrap"> <view class="list-wrap">
<view class="title-wrap"> <view class="title-wrap">
<view class="title">最近观看</view> <view class="title">最近观看</view>
<view class="more">更多</view> <navigator class="more" url="/pages/watching_history/watching_history?type=3">更多</navigator>
</view> </view>
<view class="list"> <view class="list">
<view class="item"> <view class="item">
<div class="item-content"> <view class="cover">
<view class="cover"> <image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <view class="num">第三集</view>
<view class="num">第三集</view> </view>
</view> <view class="intro-wrap">
<view class="intro-wrap"> <view class="name">我在八十年代当后妈</view>
<view class="name">我在八十年代当后妈</view> <view class="t">言情</view>
<view class="t">言情</view> </view>
</view>
</div>
</view> </view>
<view class="item"> <view class="item">
<div class="item-content"> <view class="cover">
<view class="cover"> <image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <view class="num">第三集</view>
<view class="num">第三集</view> </view>
</view> <view class="intro-wrap">
<view class="intro-wrap"> <view class="name">我在八十年代当后妈</view>
<view class="name">我在八十年代当后妈</view> <view class="t">言情</view>
<view class="t">言情</view> </view>
</view>
</div>
</view> </view>
<view class="item"> <view class="item">
<div class="item-content"> <view class="cover">
<view class="cover"> <image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <view class="num">第三集</view>
<view class="num">第三集</view> </view>
</view> <view class="intro-wrap">
<view class="intro-wrap"> <view class="name">我在八十年代当后妈</view>
<view class="name">我在八十年代当后妈</view> <view class="t">言情</view>
<view class="t">言情</view> </view>
</view>
</div>
</view> </view>
<view class="item"> <view class="item">
<div class="item-content"> <view class="cover">
<view class="cover"> <image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <view class="num">第三集</view>
<view class="num">第三集</view> </view>
</view> <view class="intro-wrap">
<view class="intro-wrap"> <view class="name">我在八十年代当后妈</view>
<view class="name">我在八十年代当后妈</view> <view class="t">言情</view>
<view class="t">言情</view> </view>
</view>
</div>
</view> </view>
<view class="item"> <view class="item">
<div class="item-content"> <view class="cover">
<view class="cover"> <image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image> <view class="num">第三集</view>
<view class="num">第三集</view> </view>
</view> <view class="intro-wrap">
<view class="intro-wrap"> <view class="name">我在八十年代当后妈</view>
<view class="name">我在八十年代当后妈</view> <view class="t">言情</view>
<view class="t">言情</view> </view>
</view>
</div>
</view>
<view class="item">
<div class="item-content">
<view class="cover">
<image class="img" src="https://img0.baidu.com/it/u=966333451,3199467079&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=714" mode="aspectFill"></image>
<view class="num">第三集</view>
</view>
<view class="intro-wrap">
<view class="name">我在八十年代当后妈</view>
<view class="t">言情</view>
</view>
</div>
</view> </view>
</view> </view>
</view> </view>
<view class="list-wrap"> <view class="list-wrap">
<view class="title-wrap"> <view class="title-wrap">
<view class="title">我的追剧</view> <view class="title">我的追剧</view>
<view class="more">更多</view> <navigator class="more" url="/pages/watching_history/watching_history?type=1">更多</navigator>
</view> </view>
<view class="list"> <view class="list">
<view class="item"> <view class="item">
@@ -105,20 +83,37 @@
</template> </template>
<script setup> <script setup>
import { reactive } from 'vue';
import { selectByUserId } from '@/api/me/me.js'; import { selectByUserId } from '@/api/me/me.js';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
async function selectByUserIdAjax() { async function selectByUserIdAjax() {
try { try {
const res = await selectByUserId(); const res1 = await selectByUserId({ page: 1, limit: 6, classify: 3 });
console.log(res); const res2 = await selectByUserId({ page: 1, limit: 6, classify: 6 });
console.log(res1);
console.log(res2);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
} }
const data = reactive({
list1: [], // 最近观看
list2: [] // 我的追剧
});
// 滚动到底部
onReachBottom(() => {});
// 监听下拉结束
onPullDownRefresh(() => {
selectByUserIdAjax();
});
// 页面初始化
onLoad(() => { onLoad(() => {
selectByUserId(); selectByUserIdAjax();
}); });
</script> </script>
@@ -155,44 +150,43 @@ page {
grid-row-gap: 28upx; grid-row-gap: 28upx;
padding: 0 28upx; padding: 0 28upx;
.item { .item {
.item-content { width: 100%;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
border-radius: 30upx; border-radius: 20upx;
.cover { .cover {
height: 200upx; height: 200upx;
position: relative; position: relative;
.img { .img {
width: 100%; width: 100%;
height: 100%; height: 100%;
}
.num {
padding: 4upx 16upx;
border-radius: 8upx;
background: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(5px);
position: absolute;
right: 8upx;
bottom: 8upx;
color: #fff;
font-size: 24upx;
}
} }
.intro-wrap { .num {
padding: 20upx; padding: 4upx 16upx;
.name { border-radius: 8upx;
width: 180upx; background: rgba(0, 0, 0, 0.3);
overflow: hidden; backdrop-filter: blur(5px);
text-overflow: ellipsis; position: absolute;
white-space: nowrap; right: 8upx;
line-height: 32upx; bottom: 8upx;
font-weight: bold; color: #fff;
} font-size: 24upx;
.t { }
color: #999; }
font-size: 24upx; .intro-wrap {
margin-top: 8upx; padding: 20upx;
} .name {
width: 180upx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 32upx;
font-weight: bold;
}
.t {
color: #999;
font-size: 24upx;
margin-top: 8upx;
} }
} }
} }

View File

@@ -10,7 +10,7 @@
</view> </view>
</view> </view>
<template v-if="datas.noticeList.length > 0 "> <template v-if="datas.noticeList.length > 0">
<view class="gongao"> <view class="gongao">
<view class="gongaoicon"> <view class="gongaoicon">
公告 公告
@@ -44,7 +44,7 @@
<contentlist :list='datas.list'></contentlist> <contentlist :list='datas.list'></contentlist>
<!-- <u-image v-if="isShowMoneyPay" @click="goMsg('/me/VjgyqAzklr/VjgyqAzklr')" :src="`../../static/red-pack-new.gif`" <!-- <u-image v-if="isShowMoneyPay" @click="goMsg('/me/VjgyqAzklr/VjgyqAzklr')" :src="`../../static/red-pack-new.gif`"
style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image> --> style="width: 200rpx;height: 200rpx;position: fixed;right: 10rpx;bottom: 180rpx;"></u-image> -->
<u-modal :show="datas.ruleShow" v-if="datas.isExamine==0" confirm-text="知道了" @confirm='datas.ruleShow=false' <u-modal :show="datas.ruleShow" v-if="datas.isExamine == 0" confirm-text="知道了" @confirm='datas.ruleShow = false'
:title="datas.rule_title" :title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)"> :title="datas.rule_title" :title-style="{ fontWeight: '700' }" confirm-color="rgb(255, 117, 129)">
<view class="" style="padding-top: 30rpx;text-align: left;"> <view class="" style="padding-top: 30rpx;text-align: left;">
<scroll-view scroll-y="true" style="max-height: 50vh;"> <scroll-view scroll-y="true" style="max-height: 50vh;">
@@ -55,199 +55,186 @@
</template> </template>
<script setup> <script setup>
import { import {
reactive reactive
} from 'vue'; } from 'vue';
import { import { announcement, messageselectMessage,courseselectCourse } from '@/api/index/index.js'
onLoad, import {
onReachBottom onLoad,
} from '@dcloudio/uni-app' onReachBottom
import contentlist from './components/contentlist.vue' } from '@dcloudio/uni-app'
import http from '@/http/http.js' import contentlist from './components/contentlist.vue'
let datas = reactive({ import http from '@/http/http.js'
noticeList: [], //公告列表 let datas = reactive({
noticeList: [], //公告列表
active: 1, // 最新、最热。。。切换顶部导航栏 active: 1, // 最新、最热。。。切换顶部导航栏
list: [], // 底部短剧内容 list: [], // 底部短剧内容
page: 1, // 首页推荐分页 page: 1, // 首页推荐分页
ruleShow: false, ruleShow: false,
rule_title: '', // 首页弹窗标题 rule_title: '', // 首页弹窗标题
rule_content: '', // 首页弹窗内容 rule_content: '', // 首页弹窗内容
//ios是否在审核 1是审核 //ios是否在审核 1是审核
isExamine: uni.getStorageSync('isExamine') isExamine: uni.getStorageSync('isExamine')
}) })
onLoad(() => { onLoad(() => {
getMsg() getMsg()
getrecomVideo() getrecomVideo()
getPop() getPop()
}) })
onReachBottom(() => { onReachBottom(() => {
++datas.page ++datas.page
getrecomVideo() getrecomVideo()
}) })
// 获取弹窗信息 // 获取弹窗信息
function getPop() { async function getPop() {
http.request({ let res = await announcement()
url: 'app/announcement', if (res.code == 0) {
}).then(res => { if (res.data && res.data.state == 1) {
if (res.code == 0) { datas.ruleShow = true
if (res.data && res.data.state == 1) { datas.rule_title = res.data.title
datas.ruleShow = true datas.rule_content = res.data.content
datas.rule_title = res.data.title }
datas.rule_content = res.data.content } else {
} uni.showToast({
} else { title: res.msg,
uni.showToast({ duration: 1000,
title: res.msg, icon: 'none'
duration: 1000,
icon: 'none'
});
}
})
}
// 搜索跳转
function moreVideo() {
uni.navigateTo({
url: '/pages/index/search/index'
}); });
} }
// 公告 }
function getMsg() { // 搜索跳转
http.request({ function moreVideo() {
url: 'app/message/selectMessage', uni.navigateTo({
data: { url: '/pages/index/search/index'
page: 1, });
limit: 5, }
state: 1 // 公告
} async function getMsg() {
}).then(res => { let res = await messageselectMessage()
if (res.code == 0) { if (res.code == 0) {
datas.noticeList = res.data.list datas.noticeList = res.data.list
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
duration: 1000, duration: 1000,
icon: 'none' icon: 'none'
}); });
}
})
} }
//获取推荐视频 }
function getrecomVideo(sort, active = 1) { //获取推荐视频
datas.active = active async function getrecomVideo(sort, active = 1) {
if (sort) { datas.active = active
datas.page = 1 if (sort) {
datas.page = 1
}
let res = await courseselectCourse({
page: datas.page,
limit: 12,
sort: sort,
classifyId: ''
})
if (res.code == 0) {
if (datas.page == 1) {
datas.list = res.data.list
} else {
datas.list = [...datas.list, ...res.data.list]
} }
http.request({ } else {
url: 'app/course/selectCourse', uni.showToast({
data: { title: res.msg,
page: datas.page, duration: 1000,
limit: 12, icon: 'none'
sort: sort, });
classifyId: ''
}
}).then(res => {
if (res.code == 0) {
if (datas.page == 1) {
datas.list = res.data.list
} else {
datas.list = [...datas.list, ...res.data.list]
}
} else {
uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
})
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.indexStyle { .indexStyle {
height: 555rpx;
position: relative;
>image {
width: 100%;
height: 555rpx; height: 555rpx;
position: relative; position: absolute;
>image {
width: 100%;
height: 555rpx;
position: absolute;
}
.indexStyleTwo {
display: flex;
align-items: center;
justify-content: space-between;
padding: 88rpx 25rpx;
>image {
width: 187rpx;
height: 50rpx;
}
>view {
z-index: 50;
width: 236rpx;
line-height: 43rpx;
background: rgba(255, 255, 255, 0.29);
border-radius: 7rpx 7rpx 7rpx 7rpx;
font-weight: 400;
font-size: 21rpx;
color: rgba(255, 255, 255, 0.85);
display: flex;
align-items: center;
}
}
.gongao {
position: absolute;
bottom: 75rpx;
left: 70rpx;
border-radius: 21rpx 21rpx 21rpx 21rpx;
width: 611rpx;
height: 78rpx;
background-color: rgba(255, 255, 255, .65);
display: flex;
align-items: center;
padding: 12rpx;
box-sizing: border-box;
.gongaoicon {
color: #ffffff;
width: 98rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
font-size: 25rpx;
background-image: url('../../static/index/gonggaobg.png');
background-size: 98rpx 50rpx;
}
.swiperstyle {
height: 78rpx;
width: 80%;
}
}
} }
.navTop { .indexStyleTwo {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 20rpx; padding: 88rpx 25rpx;
>image {
width: 187rpx;
height: 50rpx;
}
>view { >view {
background-color: #f0f0f0; z-index: 50;
margin-left: 20rpx; width: 236rpx;
padding: 6rpx 20rpx line-height: 43rpx;
background: rgba(255, 255, 255, 0.29);
border-radius: 7rpx 7rpx 7rpx 7rpx;
font-weight: 400;
font-size: 21rpx;
color: rgba(255, 255, 255, 0.85);
display: flex;
align-items: center;
} }
} }
.gongao {
position: absolute;
bottom: 75rpx;
left: 70rpx;
border-radius: 21rpx 21rpx 21rpx 21rpx;
width: 611rpx;
height: 78rpx;
background-color: rgba(255, 255, 255, .65);
display: flex;
align-items: center;
padding: 12rpx;
box-sizing: border-box;
.gongaoicon {
color: #ffffff;
width: 98rpx;
height: 50rpx;
line-height: 50rpx;
text-align: center;
font-size: 25rpx;
background-image: url('../../static/index/gonggaobg.png');
background-size: 98rpx 50rpx;
}
.swiperstyle {
height: 78rpx;
width: 80%;
}
}
}
.navTop {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
>view {
background-color: #f0f0f0;
margin-left: 20rpx;
padding: 6rpx 20rpx
}
}
</style> </style>

View File

@@ -3,19 +3,20 @@
<u-sticky :enable="true"> <u-sticky :enable="true">
<view class="search-box"> <view class="search-box">
<u-search bg-color="#f2f2f2" style="width: 100%;" placeholder="搜索更多资源" :focus="true" :show-action="true" <u-search bg-color="#f2f2f2" style="width: 100%;" placeholder="搜索更多资源" :focus="true" :show-action="true"
:animation="true" action-text="取消" @custom="goBack()" @search="doSearch(false)"></u-search> :animation="true" action-text="取消" v-model="datas.keyword" @custom="goBack()"
@search="doSearch(false)"></u-search>
</view> </view>
</u-sticky> </u-sticky>
</view> </view>
<view class="search-keyword"> <view class="search-keyword">
<view class="keyword-block" v-if="datas.hotKeywordList.length !=0"> <view class="keyword-block" v-if="datas.hotKeywordList.length != 0">
<view class="keyword-list-header"> <view class="keyword-list-header">
<view>热搜</view> <view>热搜</view>
</view> </view>
<view class="keyword" v-if="forbid==''"> <view class="keyword" v-if="forbid == ''">
<view v-for="(keyword,index) in datas.hotKeywordList" @tap="doSearchs(keyword)" :key="index" <view v-for="(keyword, index) in datas.hotKeywordList" @tap="doSearchs(keyword)" :key="index"
v-if="keyword"> v-if="keyword">
{{keyword}} {{ keyword }}
</view> </view>
</view> </view>
<view class="hide-hot-tis" v-else> <view class="hide-hot-tis" v-else>
@@ -26,59 +27,76 @@
</template> </template>
<script setup> <script setup>
import { import { selectCourseTitles } from '@/api/index/index.js'
reactive import {
} from 'vue'; reactive
import { } from 'vue';
onShow import {
} from '@dcloudio/uni-app' onShow
let datas = reactive({ } from '@dcloudio/uni-app'
hotKeywordList: [], //热搜 let datas = reactive({
}) hotKeywordList: [], //热搜
onShow(() => { keywordList: [],// 搜索列表
getList() keyword: "",// 搜索关键字
}) })
onShow(() => {
getList()
})
function getList() { function getList() {
if (uni.getStorageSync('moreSearch')) { if (uni.getStorageSync('moreSearch')) {
datas.hotKeywordList = (uni.getStorageSync('moreSearch')).split(',') datas.hotKeywordList = (uni.getStorageSync('moreSearch')).split(',')
} else { } else {
datas.hotKeywordList = [] datas.hotKeywordList = []
}
} }
}
// 搜索
async function doSearch() {
let res = await selectCourseTitles({
title: datas.keyword,
limit: 20,
page: 1,
})
datas.keywordList = res.data.list
}
// 取消返回首页
function goBack() {
uni.navigateBack()
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.search-box { .search-box {
width: 100%; width: 100%;
/* background-color: rgb(242, 242, 242); */ /* background-color: rgb(242, 242, 242); */
padding: 15upx 2.5%; padding: 15upx 2.5%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
// position: sticky; // position: sticky;
// top: 0; // top: 0;
background-color: #ffffff; background-color: #ffffff;
} }
.search-keyword { .search-keyword {
width: 100%; width: 100%;
} }
.keyword-block { .keyword-block {
padding: 10upx 0; padding: 10upx 0;
} }
.keyword-block .keyword-list-header { .keyword-block .keyword-list-header {
width: 94%; width: 94%;
padding: 10upx 3%; padding: 10upx 3%;
font-size: 27upx; font-size: 27upx;
color: #333; color: #333;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.keyword-block .keyword-list-header image { .keyword-block .keyword-list-header image {
width: 40upx; width: 40upx;
height: 40upx; height: 40upx;
} }
</style> </style>

View File

@@ -5,7 +5,9 @@
<view class="content"> <view class="content">
<view class="user-info"> <view class="user-info">
<view class="logo-wrap"> <view class="logo-wrap">
<view class="logo"></view> <view class="logo">
<image class="img" src="/static/logo.png" mode="widthFix"></image>
</view>
<view class="quick-menu"> <view class="quick-menu">
<image class="icon" src="/static/me/logo_btn1.png" mode="aspectFit"></image> <image class="icon" src="/static/me/logo_btn1.png" mode="aspectFit"></image>
<image class="icon" src="/static/me/logo_btn2.png" mode="aspectFit"></image> <image class="icon" src="/static/me/logo_btn2.png" mode="aspectFit"></image>
@@ -137,7 +139,15 @@ page {
.user-info { .user-info {
.logo-wrap { .logo-wrap {
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
.logo {
width: 160upx;
.img {
width: 100%;
display: block;
}
}
.quick-menu { .quick-menu {
display: flex; display: flex;
gap: 20upx; gap: 20upx;
@@ -151,6 +161,7 @@ page {
.top { .top {
display: flex; display: flex;
align-items: center; align-items: center;
padding-top: 40upx;
.avatar { .avatar {
$size: 94upx; $size: 94upx;
width: $size; width: $size;

View File

@@ -0,0 +1,126 @@
<template>
<view class="container">
<view class="list">
<view class="item" v-for="item in listData.list" :key="item.id">
<view class="cover">
<image class="img" :src="item.titleImg" mode="aspectFill"></image>
</view>
<view class="info">
<view class="title">
{{ item.title }}
</view>
<view class="record">看到{{ item.courseDetailsName }}</view>
<view class="btm">
<view class="num">
<view v-if="item.courseDetailsCount">更新{{ item.courseDetailsCount }}</view>
</view>
<view class="btn">继续观看</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
import { selectByUserId } from '@/api/me/me.js';
const type = ref(1);
const typeList = ref([
{
type: 1,
label: '我的追剧'
},
{
type: 3,
label: '最近观看'
}
]);
const listData = reactive({
list: [],
page: 1,
size: 10
});
// 获取数据
async function selectByUserIdAjax() {
try {
const res = await selectByUserId({
page: listData.page,
limit: listData.size,
classify: type.value
});
console.log(res);
if (res.code === 0) {
listData.list = res.data.records;
}
} catch (error) {
console.log(error);
}
}
onReachBottom(() => {
listData.page++;
selectByUserIdAjax();
});
onLoad((e) => {
if (e.type) {
type.value = e.type;
uni.setNavigationBarTitle({
title: typeList.value.find((item) => item.type == type.value).label
});
}
selectByUserIdAjax();
});
</script>
<style scoped lang="scss">
.container {
padding: 28upx;
color: #333;
font-size: 29upx;
}
.list {
.item {
padding: 28upx 0;
display: flex;
.cover {
width: 150upx;
height: 200upx;
margin-right: 28upx;
.img {
width: 100%;
height: 100%;
display: block;
border-radius: 20upx;
}
}
.info {
display: flex;
flex-direction: column;
gap: 4px;
.title {
font-size: 32upx;
font-weight: bold;
}
.record {
color: $uni-zj-color-primary;
}
.btm {
display: flex;
justify-content: space-between;
.btn {
padding: 4upx 12upx;
color: #fff;
background: $uni-zj-color-primary;
}
}
}
}
}
</style>

View File

@@ -13,6 +13,8 @@
*/ */
/* 颜色变量 */ /* 颜色变量 */
$uni-zj-color-primary: #ff7581;
$uni-zj-color-primary-active: #cb5d68;
/* 行为相关颜色 */ /* 行为相关颜色 */
$uni-color-primary: #007aff; $uni-color-primary: #007aff;
@@ -21,32 +23,32 @@ $uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d; $uni-color-error: #dd524d;
/* 文字基本颜色 */ /* 文字基本颜色 */
$uni-text-color:#333;//基本色 $uni-text-color: #333; //基本色
$uni-text-color-inverse:#fff;//反色 $uni-text-color-inverse: #fff; //反色
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 $uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息
$uni-text-color-placeholder: #808080; $uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0; $uni-text-color-disable: #c0c0c0;
/* 背景颜色 */ /* 背景颜色 */
$uni-bg-color:#ffffff; $uni-bg-color: #ffffff;
$uni-bg-color-grey:#f8f8f8; $uni-bg-color-grey: #f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色 $uni-bg-color-hover: #f1f1f1; //点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 $uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色
/* 边框颜色 */ /* 边框颜色 */
$uni-border-color:#c8c7cc; $uni-border-color: #c8c7cc;
/* 尺寸变量 */ /* 尺寸变量 */
/* 文字尺寸 */ /* 文字尺寸 */
$uni-font-size-sm:12px; $uni-font-size-sm: 12px;
$uni-font-size-base:14px; $uni-font-size-base: 14px;
$uni-font-size-lg:16px; $uni-font-size-lg: 16px;
/* 图片尺寸 */ /* 图片尺寸 */
$uni-img-size-sm:20px; $uni-img-size-sm: 20px;
$uni-img-size-base:26px; $uni-img-size-base: 26px;
$uni-img-size-lg:40px; $uni-img-size-lg: 40px;
/* Border Radius */ /* Border Radius */
$uni-border-radius-sm: 2px; $uni-border-radius-sm: 2px;
@@ -68,10 +70,10 @@ $uni-spacing-col-lg: 12px;
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */ /* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色 $uni-color-title: #2c405a; // 文章标题颜色
$uni-font-size-title:20px; $uni-font-size-title: 20px;
$uni-color-subtitle: #555555; // 二级标题颜色 $uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:26px; $uni-font-size-subtitle: 26px;
$uni-color-paragraph: #3F536E; // 文章段落颜色 $uni-color-paragraph: #3f536e; // 文章段落颜色
$uni-font-size-paragraph:15px; $uni-font-size-paragraph: 15px;
@import 'uview-plus/theme.scss'; @import 'uview-plus/theme.scss';

View File

@@ -1,64 +1,3 @@
import { SM4 } from 'gm-crypto'
import {encryptKey} from '@/commons/config.js'
let HEX_KEY = null
// 字符串转16进制
function str2hex(str) {
var val = ''
for (var i = 0; i < str.length; i++) {
if (val == '')
val = str.charCodeAt(i).toString(16)
else
val += str.charCodeAt(i).toString(16)
}
val += ''
return val
}
// 获取hex秘钥
function getHexKey(){
if(!HEX_KEY){
HEX_KEY = str2hex(encryptKey)
}
return HEX_KEY
}
// 解密 (http响应数据 做通用处理)
export function sm4DecryptByResData(data){ export function sm4DecryptByResData(data){
return data
if(!data){ }
return data
}
let res = SM4.decrypt(data, getHexKey(), {
inputEncoding: 'base64',
outputEncoding: 'utf8'
})
if(!res){
return res
}
return JSON.parse(res)['originData']
}
// 加密 (http响应数据 做通用处理)
export function sm4EncryptByReqData(data){
if(!data){
return data
}
// 加密处理
let encryptData = SM4.encrypt(JSON.stringify(data), getHexKey(), {
inputEncoding: 'utf8',
outputEncoding: 'base64'
})
return {encryptData : encryptData}
}