更新代码
This commit is contained in:
7
App.vue
7
App.vue
@@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { init } from '@/api/init.js'
|
||||||
import http from '@/http/http.js'
|
import http from '@/http/http.js'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
@@ -13,9 +14,10 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
init()
|
||||||
// ios是否在审核
|
// ios是否在审核
|
||||||
http.request({
|
http.request({
|
||||||
url: 'app/common/type/919',
|
url: '/common/type/919',
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
uni.setStorageSync('isExamine', res.data.value)
|
uni.setStorageSync('isExamine', res.data.value)
|
||||||
@@ -118,7 +120,4 @@
|
|||||||
top: 800rpx;
|
top: 800rpx;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
35
api/index/index.js
Normal file
35
api/index/index.js
Normal 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
13
api/init.js
Normal 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)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -13,8 +13,7 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
import {
|
import {
|
||||||
reactive
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
import { announcement, messageselectMessage,courseselectCourse } from '@/api/index/index.js'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReachBottom
|
onReachBottom
|
||||||
@@ -91,10 +92,8 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 获取弹窗信息
|
// 获取弹窗信息
|
||||||
function getPop() {
|
async function getPop() {
|
||||||
http.request({
|
let res = await announcement()
|
||||||
url: 'app/announcement',
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
if (res.data && res.data.state == 1) {
|
if (res.data && res.data.state == 1) {
|
||||||
datas.ruleShow = true
|
datas.ruleShow = true
|
||||||
@@ -108,7 +107,6 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// 搜索跳转
|
// 搜索跳转
|
||||||
function moreVideo() {
|
function moreVideo() {
|
||||||
@@ -117,15 +115,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 公告
|
// 公告
|
||||||
function getMsg() {
|
async function getMsg() {
|
||||||
http.request({
|
let res = await messageselectMessage()
|
||||||
url: 'app/message/selectMessage',
|
|
||||||
data: {
|
|
||||||
page: 1,
|
|
||||||
limit: 5,
|
|
||||||
state: 1
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
datas.noticeList = res.data.list
|
datas.noticeList = res.data.list
|
||||||
} else {
|
} else {
|
||||||
@@ -135,23 +126,20 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
//获取推荐视频
|
//获取推荐视频
|
||||||
function getrecomVideo(sort, active = 1) {
|
async function getrecomVideo(sort, active = 1) {
|
||||||
datas.active = active
|
datas.active = active
|
||||||
if (sort) {
|
if (sort) {
|
||||||
datas.page = 1
|
datas.page = 1
|
||||||
}
|
}
|
||||||
http.request({
|
let res = await courseselectCourse({
|
||||||
url: 'app/course/selectCourse',
|
|
||||||
data: {
|
|
||||||
page: datas.page,
|
page: datas.page,
|
||||||
limit: 12,
|
limit: 12,
|
||||||
sort: sort,
|
sort: sort,
|
||||||
classifyId: ''
|
classifyId: ''
|
||||||
}
|
})
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
if (datas.page == 1) {
|
if (datas.page == 1) {
|
||||||
datas.list = res.data.list
|
datas.list = res.data.list
|
||||||
@@ -165,7 +153,6 @@
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
<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>
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { selectCourseTitles } from '@/api/index/index.js'
|
||||||
import {
|
import {
|
||||||
reactive
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@@ -34,6 +36,8 @@
|
|||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
hotKeywordList: [], //热搜
|
hotKeywordList: [], //热搜
|
||||||
|
keywordList: [],// 搜索列表
|
||||||
|
keyword: "",// 搜索关键字
|
||||||
})
|
})
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getList()
|
getList()
|
||||||
@@ -46,6 +50,20 @@
|
|||||||
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">
|
||||||
|
|||||||
Reference in New Issue
Block a user