Merge branch 'test' of e.coding.net:g-cphe0354/duanju/new_app into gyq

This commit is contained in:
gyq 2025-01-06 18:31:25 +08:00
commit 96c378c54c
6 changed files with 288 additions and 236 deletions

24
App.vue
View File

@ -1,8 +1,9 @@
<script>
import http from '@/http/http.js';
import { init } from '@/api/init.js'
import http from '@/http/http.js'
export default {
onLaunch: function () {
console.log('App Launch');
console.log('App Launch')
// const systemInfo = uni.getSystemInfoSync();
// const isA = systemInfo.platform === 'android'
// if (isA) {
@ -10,26 +11,28 @@ export default {
// } else {
// uni.setStorageSync('isAI', false)
// }
},
onShow: function () {
init()
// ios
http.request({
url: 'app/common/type/919'
}).then((res) => {
url: '/common/type/919',
}).then(res => {
if (res.code == 0) {
uni.setStorageSync('isExamine', res.data.value);
uni.setStorageSync('isExamine', res.data.value)
}
});
})
},
onHide: function () {
console.log('App Hide');
console.log('App Hide')
}
};
}
</script>
<style lang="scss">
/*每个页面公共css */
@import 'uview-plus/index.scss';
@import "uview-plus/index.scss";
ul,
li {
@ -86,9 +89,6 @@ web-view {
text-decoration: none;
outline: none;
}
image {
display: block;
}
.initStyle {
padding: 20rpx;

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

@ -13,7 +13,6 @@ const loadingShowTime = 200
function getHeader() {
const headerObject = {}
// headerObject["token"] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyNjkyNSIsImlhdCI6MTczNTg4OTk5NCwiZXhwIjoxNzM2NDk0Nzk0fQ.j-KFEE1FHckmFCO8UA884RBWvpMv8MfEGj7GPGf3kVo6sHeORl043Yle_w7HdTZKPpQqSr2LQLCq_rUxG4qqwA'
headerObject["token"] = uni.getStorageSync('token')
return headerObject
}

View File

@ -10,7 +10,7 @@
</view>
</view>
<template v-if="datas.noticeList.length > 0 ">
<template v-if="datas.noticeList.length > 0">
<view class="gongao">
<view class="gongaoicon">
公告
@ -44,7 +44,7 @@
<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'
<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;">
@ -55,199 +55,186 @@
</template>
<script setup>
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: [], //
import {
reactive
} from 'vue';
import { announcement, messageselectMessage,courseselectCourse } from '@/api/index/index.js'
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, //
active: 1, //
list: [], //
page: 1, //
list: [], //
page: 1, //
ruleShow: false,
rule_title: '', //
rule_content: '', //
ruleShow: false,
rule_title: '', //
rule_content: '', //
//ios 1
isExamine: uni.getStorageSync('isExamine')
})
onLoad(() => {
getMsg()
getrecomVideo()
getPop()
})
//ios 1
isExamine: uni.getStorageSync('isExamine')
})
onLoad(() => {
getMsg()
getrecomVideo()
getPop()
})
onReachBottom(() => {
++datas.page
getrecomVideo()
})
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'
});
}
})
}
//
function moreVideo() {
uni.navigateTo({
url: '/pages/index/search/index'
//
async function getPop() {
let res = await announcement()
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'
});
}
//
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 moreVideo() {
uni.navigateTo({
url: '/pages/index/search/index'
});
}
//
async function getMsg() {
let res = await messageselectMessage()
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
}
//
async function getrecomVideo(sort, active = 1) {
datas.active = active
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({
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'
});
}
})
} else {
uni.showToast({
title: res.msg,
duration: 1000,
icon: 'none'
});
}
}
</script>
<style lang="scss" scoped>
.indexStyle {
.indexStyle {
height: 555rpx;
position: relative;
>image {
width: 100%;
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%;
}
}
position: absolute;
}
.navTop {
.indexStyleTwo {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
padding: 88rpx 25rpx;
>image {
width: 187rpx;
height: 50rpx;
}
>view {
background-color: #f0f0f0;
margin-left: 20rpx;
padding: 6rpx 20rpx
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

@ -3,19 +3,20 @@
<u-sticky :enable="true">
<view class="search-box">
<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>
</u-sticky>
</view>
<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>热搜</view>
</view>
<view class="keyword" v-if="forbid==''">
<view v-for="(keyword,index) in datas.hotKeywordList" @tap="doSearchs(keyword)" :key="index"
<view class="keyword" v-if="forbid == ''">
<view v-for="(keyword, index) in datas.hotKeywordList" @tap="doSearchs(keyword)" :key="index"
v-if="keyword">
{{keyword}}
{{ keyword }}
</view>
</view>
<view class="hide-hot-tis" v-else>
@ -26,59 +27,76 @@
</template>
<script setup>
import {
reactive
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
let datas = reactive({
hotKeywordList: [], //
})
onShow(() => {
getList()
})
import { selectCourseTitles } from '@/api/index/index.js'
import {
reactive
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
let datas = reactive({
hotKeywordList: [], //
keywordList: [],//
keyword: "",//
})
onShow(() => {
getList()
})
function getList() {
if (uni.getStorageSync('moreSearch')) {
datas.hotKeywordList = (uni.getStorageSync('moreSearch')).split(',')
} else {
datas.hotKeywordList = []
}
function getList() {
if (uni.getStorageSync('moreSearch')) {
datas.hotKeywordList = (uni.getStorageSync('moreSearch')).split(',')
} else {
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>
<style scoped lang="scss">
.search-box {
width: 100%;
/* background-color: rgb(242, 242, 242); */
padding: 15upx 2.5%;
display: flex;
justify-content: space-between;
// position: sticky;
// top: 0;
background-color: #ffffff;
}
.search-box {
width: 100%;
/* background-color: rgb(242, 242, 242); */
padding: 15upx 2.5%;
display: flex;
justify-content: space-between;
// position: sticky;
// top: 0;
background-color: #ffffff;
}
.search-keyword {
width: 100%;
}
.search-keyword {
width: 100%;
}
.keyword-block {
padding: 10upx 0;
}
.keyword-block {
padding: 10upx 0;
}
.keyword-block .keyword-list-header {
width: 94%;
padding: 10upx 3%;
font-size: 27upx;
color: #333;
display: flex;
justify-content: space-between;
}
.keyword-block .keyword-list-header {
width: 94%;
padding: 10upx 3%;
font-size: 27upx;
color: #333;
display: flex;
justify-content: space-between;
}
.keyword-block .keyword-list-header image {
width: 40upx;
height: 40upx;
}
.keyword-block .keyword-list-header image {
width: 40upx;
height: 40upx;
}
</style>