更新代码

This commit is contained in:
duan 2025-01-06 17:24:15 +08:00
parent f016c3094d
commit 4ec188968d
10 changed files with 493 additions and 54 deletions

138
App.vue
View File

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

View File

@ -1,17 +1,20 @@
// 导入全局属性
import {
sm4DecryptByResData
} from '@/utils/encryptUtil.js'
import infoBox from "@/utils/infoBox.js"
import { reject } from 'lodash';
import {
reject
} from 'lodash';
import config from '@/commons/config.js'
// 测试服
let baseUrl = config.baseApiUrl
const loadingShowTime = 200
function getHeader(){
const headerObject={}
headerObject["token"] = uni.getStorageSync('token')
function getHeader() {
const headerObject = {}
headerObject["token"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNjkyNSIsImlhdCI6MTczNTg4OTk5NCwiZXhwIjoxNzM2NDk0Nzk0fQ.j-KFEE1FHckmFCO8UA884RBWvpMv8MfEGj7GPGf3kVo6sHeORl043Yle_w7HdTZKPpQqSr2LQLCq_rUxG4qqwA'
// headerObject["token"] = uni.getStorageSync('token')
return headerObject
}
@ -61,7 +64,7 @@ function commonsProcess(showLoading, httpReqCallback) {
// http响应码不正确
if (statusCode != 200 && statusCode != 204 && statusCode != 201) {
isShowErrorToast = true
data.message=data.message=='Bad credentials'?'用户名或密码错误':data.message
data.message = data.message == 'Bad credentials' ? '用户名或密码错误' : data.message
infoBox.showToast(data.message || '服务器异常')
return Promise.reject(bodyData) // 跳转到catch函数
}
@ -79,15 +82,16 @@ function commonsProcess(showLoading, httpReqCallback) {
return Promise.resolve(bodyData)
}).catch(res => {
if(res.status==401){
infoBox.showErrorToast(res.message||'请登录').then(() => {
uni.redirectTo({url: '/pages/login/index'})
if (res.status == 401) {
infoBox.showErrorToast(res.message || '请登录').then(() => {
uni.redirectTo({
url: '/pages/login/index'
})
reject()
})
}
if(res.status==500){
infoBox.showErrorToast(res.message||'服务器异常').then(() => {
})
if (res.status == 500) {
infoBox.showErrorToast(res.message || '服务器异常').then(() => {})
}
reqFinishFunc(); // 请求完毕的动作
@ -134,17 +138,30 @@ function request(args) {
return commonsProcess(showLoading, () => {
return uni.request(
Object.assign({
url: baseUrl + url,
data: params||data,
url: slash(baseUrl, url),
data: params || data,
method: method,
header: getHeader()
header: getHeader()
}, extParams)
)
})
}
// 处理/
function slash(baseUrl, url) {
let u = ''
if (baseUrl[baseUrl.length - 1] == '/') {
u += baseUrl
} else {
u = u + baseUrl + '/'
}
if (url[0] == '/') {
u = u + url.slice(1)
} else {
u = u + url
}
return u
}
// 上传
function upload(uri, data, file, showLoading = true, extParams = {}) {
@ -156,14 +173,14 @@ function upload(uri, data, file, showLoading = true, extParams = {}) {
url: baseUrl + uri,
formData: data,
name: "file",
filePath: file.path||file.url,
header: getHeader()
filePath: file.path || file.url,
header: getHeader()
}, extParams)
).then((httpData) => {
// uni.upload 返回bodyData 的是 string类型。 需要解析。
httpData.data = JSON.parse(httpData.data)
return Promise.resolve(httpData)
}).catch(err=>{
}).catch(err => {
uni.hideLoading()
infoBox.showErrorToast(`上传失败`)
})

View File

@ -39,6 +39,13 @@
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/search/index",
"style" :
{
"navigationBarTitleText" : ""
}
}
],
"globalStyle": {

View File

@ -0,0 +1,62 @@
<template>
<view class="contentlist">
<view class="liststyle" v-for="item in props.list" :key="item.courseId" @tap="seVideo(item)">
<image :src="item.titleImg" style="width: 188rpx;height: 247rpx;border-radius:21rpx 21rpx 21rpx 21rpx"
mode=""></image>
<view style="color: #333333;">
{{item.title.slice(0,6)}}
</view>
<view style="color: #999999;">
{{item.courseLabel}}
</view>
</view>
</view>
</template>
<script setup>
import {
returnIsSafari
} from '@/utils/app.js'
const props = defineProps({
list: {
type: Array,
default: []
},
})
function seVideo(item) {
// uni.navigateTo({
// url: '/me/detail/detail?id=' + item.courseId + '&courseDetailsId=' + item.courseDetailsId +
// '&tt_album_id=' + item.dyCourseId + '&tt_episode_id=' + item
// .dyEpisodeId
// })
}
</script>
<style scoped lang="scss">
.contentlist {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: wrap;
margin-top: 10rpx;
padding: 0 26rpx;
.liststyle {
border-radius: 21rpx 21rpx 21rpx 21rpx;
width: 30%;
margin-top: 20rpx;
>view {
font-weight: 400;
font-size: 25rpx;
text-align: left;
}
}
.liststyle:last-child {
margin-right: auto;
margin-left: 6rpx;
}
}
</style>

View File

@ -1,20 +1,253 @@
<template>
ios
anzhuo
<view class="indexStyle">
<image src="@/static/index/indexbh.png" mode="">
</image>
<view class="indexStyleTwo">
<image src="@/static/logo.png" mode=""></image>
<view @tap="moreVideo">
<image src="@/static/sosuo.png" style="height: 34rpx;width: 34rpx;" mode=""></image>
点击搜索更多好剧
</view>
</view>
<template v-if="datas.noticeList.length > 0 ">
<view class="gongao">
<view class="gongaoicon">
公告
</view>
<swiper :autoplay="true" :vertical="true" :interval="4000" :circular="true" :indicator-dots="false"
class="swiperstyle">
<swiper-item @tap='goMsg(item.url)' v-for="(item, index) in datas.noticeList" :key="index">
<view style="height: 80rpx;line-height: 80rpx;">{{ item.title }}</view>
</swiper-item>
</swiper>
</view>
</template>
</view>
<view class="navTop">
<view :style="datas.active == 1 ? 'color:#ff6b7f' : ''" @tap="getrecomVideo('', 1)">
最新
</view>
<view :style="datas.active == 2 ? 'color:#ff6b7f' : ''" @tap="getrecomVideo('1', 2)">
排行
</view>
<view :style="datas.active == 3 ? 'color:#ff6b7f' : ''" @tap="getrecomVideo('2', 3)">
最热
</view>
<view :style="datas.active == 4 ? 'color:#ff6b7f' : ''" @tap="getrecomVideo('1', 4)">
剧情
</view>
<view :style="datas.active == 5 ? 'color:#ff6b7f' : ''" @tap="getrecomVideo('2', 5)">
飙升
</view>
</view>
<contentlist :list='datas.list'></contentlist>
<!-- <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> -->
<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)">
<view class="" style="padding-top: 30rpx;text-align: left;">
<scroll-view scroll-y="true" style="max-height: 50vh;">
<rich-text style="color:#666" :nodes="datas.rule_content"></rich-text>
</scroll-view>
</view>
</u-modal>
</template>
<script setup>
// import http from '@/http/http.js'
// http.request({
// url:'app/common/getAppUseKv'
// }).then(res=>{
// console.log(res);
// })
import {
reactive
} from 'vue';
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app'
import contentlist from './components/contentlist.vue'
import http from '@/http/http.js'
let datas = reactive({
noticeList: [], //
active: 1, //
list: [], //
page: 1, //
ruleShow: false,
rule_title: '', //
rule_content: '', //
//ios 1
isExamine: uni.getStorageSync('isExamine')
})
onLoad(() => {
getMsg()
getrecomVideo()
getPop()
})
onReachBottom(() => {
++datas.page
getrecomVideo()
})
//
function getPop() {
http.request({
url: 'app/announcement',
}).then(res => {
if (res.code == 0) {
if (res.data && res.data.state == 1) {
datas.ruleShow = true
datas.rule_title = res.data.title
datas.rule_content = res.data.content
}
} else {
uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
})
}
//
// uni.navigateTo({
// url: '/pages/index/search/index'
// });
function moreVideo() {
uni.navigateTo({
url: '/pages/index/search/index'
});
}
//
function getMsg() {
http.request({
url: 'app/message/selectMessage',
data: {
page: 1,
limit: 5,
state: 1
}
}).then(res => {
if (res.code == 0) {
datas.noticeList = res.data.list
} else {
uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
})
}
//
function getrecomVideo(sort, active = 1) {
datas.active = active
if (sort) {
datas.page = 1
}
http.request({
url: 'app/course/selectCourse',
data: {
page: datas.page,
limit: 12,
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>
<style>
</style>
<style lang="scss" scoped>
.indexStyle {
height: 555rpx;
position: relative;
>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 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
>view {
background-color: #f0f0f0;
margin-left: 20rpx;
padding: 6rpx 20rpx
}
}
</style>

View File

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

BIN
static/index/gonggaobg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

BIN
static/index/indexbh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/sosuo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B