首页+我的
This commit is contained in:
642
pages/curriculum/cate/index.vue
Normal file
642
pages/curriculum/cate/index.vue
Normal file
@@ -0,0 +1,642 @@
|
||||
<template>
|
||||
<view class="container commonPageBox">
|
||||
<!-- 公共组件-每个页面必须引入 -->
|
||||
<public-module></public-module>
|
||||
<z-nav-bar
|
||||
:title="options.navTitle"
|
||||
bgColor="#3AB3AE"
|
||||
fontColor="#fff"
|
||||
></z-nav-bar>
|
||||
|
||||
<view class="contentBox commonPageContentBox">
|
||||
<common-list @lower="onReachBottom1" :pagination="pagination" :dataList="dataList" @hancleClick="gotoDetail" label="title">
|
||||
</common-list>
|
||||
</view>
|
||||
|
||||
<z-navigation></z-navigation>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import list from "@/pages/component/commonComponents/list";
|
||||
import $http from "@/config/requestConfig.js";
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
components: {
|
||||
list,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
playData: {},
|
||||
options: {},
|
||||
searchValue: "",
|
||||
pagination: {// 请求参数
|
||||
page: 1,//页码
|
||||
limit: 20,//每页显示
|
||||
total: 0,//总条数
|
||||
},
|
||||
twoCateList: [], // 二级分类标题
|
||||
titleList: [], // 方剂标题
|
||||
curOneCateIndex: 0, // 当前选中的一级分类
|
||||
curTwoCateIndex: 0, // 当前选中的二级分类
|
||||
searchList: [], // 搜索结果数组
|
||||
showSearchList: false,
|
||||
userMes: {}, // 用户信息
|
||||
searchDisable: false, // 搜索不可用
|
||||
limitShow: false,
|
||||
limitTitle: "提示",
|
||||
limitContent: "",
|
||||
scrollViewHeight: 0,
|
||||
dataList: [],
|
||||
urlList: {
|
||||
list: "sociology/course/getSociologyCourseList",
|
||||
},
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options, "989");
|
||||
this.options = options;
|
||||
this.getUserInfo();
|
||||
this.getData();
|
||||
},
|
||||
onHide() {
|
||||
// this.showSearchList = false
|
||||
// this.searchList = []
|
||||
},
|
||||
computed: {
|
||||
...mapState(["userInfo"]),
|
||||
},
|
||||
methods: { onReachBottom1() {// 上拉加载
|
||||
// 当列表数量不大于或等于总数量,则再次调用接口请求数据
|
||||
if (this.dataList.length >= this.pagination.total) return;
|
||||
this.pagination.page++;
|
||||
this.getData();
|
||||
},
|
||||
|
||||
|
||||
// 检查是有权限使用搜索功能
|
||||
checkDisable() {
|
||||
console.log("点击了");
|
||||
},
|
||||
// 显示无权限弹窗
|
||||
// showNoRights() {
|
||||
// let that = this
|
||||
// uni.showModal({
|
||||
// content: "",
|
||||
// confirmText: '好的',
|
||||
// showCancel: false,
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {
|
||||
// // console.log('用户点击确定');
|
||||
// that.clear()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// 获取用户详情
|
||||
getUserInfo() {
|
||||
// 用户详情
|
||||
if (this.userInfo.id != undefined) {
|
||||
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
|
||||
this.userMes = res.user;
|
||||
this.getCateList();
|
||||
console.log(this.userMes, "呼呼");
|
||||
});
|
||||
}
|
||||
},
|
||||
// 详情
|
||||
gotoDetail(v) {
|
||||
console.log(v);
|
||||
uni.navigateTo({
|
||||
// url: '../bookShop/commodityDetail?id=' + item.id
|
||||
url: `/pages/curriculum/order/curriculum/index?navTitle=${v.title}&title=${v.title}&oid=${v.oid}`,
|
||||
});
|
||||
},
|
||||
|
||||
getData() {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.urlList.list,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: Number(this.options.id), //分类id
|
||||
...this.pagination
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("res at line 289:", res);
|
||||
this.pagination.total=res.courses.total
|
||||
this.dataList=[...this.dataList,...res.courses.records]
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
// 获取名称
|
||||
getTitles(dictType) {
|
||||
console.log("dictType", dictType);
|
||||
if (this.curOneCateIndex == 0) {
|
||||
if (dictType == 2) {
|
||||
uni.navigateTo({
|
||||
url: "./zhuanzhuchuban",
|
||||
});
|
||||
return;
|
||||
}
|
||||
$http
|
||||
.request({
|
||||
url: "book/generalArticle/articleByPage",
|
||||
method: "POST",
|
||||
data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
type: dictType == 1 ? "1" : "2",
|
||||
limit: 1000,
|
||||
current: 1,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, "内容获取成功");
|
||||
if (res.code == 0 && res.result && res.result.records.length > 0) {
|
||||
this.titleList = res.result.records;
|
||||
} else {
|
||||
this.titleList = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.titleList = [];
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
if (this.curOneCateIndex == 1) {
|
||||
$http
|
||||
.request({
|
||||
url: "book/medicaldes/inheritListByPage",
|
||||
method: "POST",
|
||||
data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
dictType: dictType,
|
||||
limit: 1000,
|
||||
current: 1,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, "内容获取成功");
|
||||
if (res.code == 0 && res.result.records.length > 0) {
|
||||
this.titleList = res.result.records;
|
||||
for (let i = 0; i < this.titleList.length; i++) {
|
||||
this.titleList[i].imageslist = [];
|
||||
this.titleList[i].imageslist = this.titleList[i].img.split(";");
|
||||
}
|
||||
} else {
|
||||
this.titleList = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.titleList = [];
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
if (this.curOneCateIndex == 2) {
|
||||
$http
|
||||
.request({
|
||||
url: "book/medicaldes/lightListByType?type=" + dictType,
|
||||
method: "POST",
|
||||
data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
limit: 1000,
|
||||
page: 1,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, "内容获取成功");
|
||||
if (res.code == 0 && res.result.length > 0) {
|
||||
this.titleList = res.result;
|
||||
} else {
|
||||
this.titleList = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.titleList = [];
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
if (this.curOneCateIndex == 3) {
|
||||
$http
|
||||
.request({
|
||||
url: "book/medicaldes/recordByType?type=" + dictType,
|
||||
method: "POST",
|
||||
data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
limit: 1000,
|
||||
page: 1,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, "内容获取成功");
|
||||
if (res.code == 0 && res.result.length > 0) {
|
||||
this.titleList = res.result;
|
||||
} else {
|
||||
this.titleList = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.titleList = [];
|
||||
console.log(e);
|
||||
});
|
||||
}
|
||||
},
|
||||
setTwoCateIndex(item, index) {
|
||||
let dictType = item.dictType;
|
||||
this.curTwoCateIndex = index;
|
||||
this.getTitles(dictType);
|
||||
},
|
||||
async setOneCateIndex(item, index) {
|
||||
console.log(index, 99999);
|
||||
var that = this;
|
||||
|
||||
// if(this.userMes.tgdzPower == 0){
|
||||
// let that = this
|
||||
// uni.showModal({
|
||||
// content: "购买 针灸六经法要上册和下册 后方可使用此功能",
|
||||
// confirmText: '好的',
|
||||
// showCancel: false,
|
||||
// success: function(res) {
|
||||
// if (res.confirm) {
|
||||
// // console.log('用户点击确定');
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// if(item.title == "时辰取穴"){
|
||||
// uni.navigateTo({
|
||||
// url: "../timeAcupoint/timeAcupoint"
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
let type = item.type;
|
||||
this.curOneCateIndex = index;
|
||||
this.curTwoCateIndex = 0;
|
||||
this.searchValue = "";
|
||||
this.searchList = [];
|
||||
this.showSearchList = false;
|
||||
// if (index != 2) {
|
||||
await this.getTowCateList(type);
|
||||
|
||||
// uni.createSelectorQuery().select('.oneCateList').boundingClientRect(function (rect) {
|
||||
// var height = rect.height
|
||||
// console.log('元素高度:',);
|
||||
|
||||
// }).exec();
|
||||
|
||||
// } else {
|
||||
// this.getJFList(dictType)
|
||||
// }
|
||||
},
|
||||
async getTowCateList(type) {
|
||||
var that = this;
|
||||
$http
|
||||
.request({
|
||||
url: "book/medicaldes/typeList?label=" + type,
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data: {
|
||||
loadAnimate: "none", // 请求加载动画
|
||||
// 'categoryId': id
|
||||
},
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res, "二级分类获取成功");
|
||||
if (res.code == 0 && res.result.length >= 0) {
|
||||
this.twoCateList = res.result;
|
||||
if (this.curOneCateIndex == 0) {
|
||||
this.twoCateList = [
|
||||
{
|
||||
dictType: "1",
|
||||
dictValue: "学术思想",
|
||||
},
|
||||
{
|
||||
dictType: "2",
|
||||
dictValue: "出版专著",
|
||||
},
|
||||
{
|
||||
dictType: "3",
|
||||
dictValue: "学术平台",
|
||||
},
|
||||
];
|
||||
}
|
||||
if (this.curOneCateIndex == 2) {
|
||||
this.twoCateList = [
|
||||
{
|
||||
dictType: "1",
|
||||
dictValue: "吴门之歌",
|
||||
},
|
||||
{
|
||||
dictType: "2",
|
||||
dictValue: "巴山夜语",
|
||||
},
|
||||
{
|
||||
dictType: "3",
|
||||
dictValue: "吴门之徽",
|
||||
},
|
||||
];
|
||||
}
|
||||
if (this.curOneCateIndex == 3) {
|
||||
this.twoCateList = [
|
||||
{
|
||||
dictType: "1",
|
||||
dictValue: "学术贡献",
|
||||
},
|
||||
{
|
||||
dictType: "2",
|
||||
dictValue: "抗疫纪实",
|
||||
},
|
||||
{
|
||||
dictType: "3",
|
||||
dictValue: "吴门公益",
|
||||
},
|
||||
];
|
||||
}
|
||||
this.getTitles(this.twoCateList[0].dictType);
|
||||
|
||||
this.$nextTick(async () => {
|
||||
// await uni.createSelectorQuery().select('.uni-tabbar').boundingClientRect(function (rect) {
|
||||
// console.log(rect.height, '3333')
|
||||
|
||||
// // var height = 42 + rect.height + 10;
|
||||
// // that.scrollViewHeight = height;
|
||||
// // console.log(that.scrollViewHeight, '111111')
|
||||
// // that.$forceUpdate()
|
||||
// // console.log('元素高度2:', height);
|
||||
// }).exec();
|
||||
await uni
|
||||
.createSelectorQuery()
|
||||
.select(".cateList")
|
||||
.boundingClientRect(function (rect) {
|
||||
console.log(rect.height, "22222");
|
||||
|
||||
var height = 42 + rect.height + 20;
|
||||
that.scrollViewHeight = height;
|
||||
console.log(that.scrollViewHeight, "111111");
|
||||
that.$forceUpdate();
|
||||
console.log("元素高度2:", height);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
} else {
|
||||
this.twoCateList = [];
|
||||
this.titleList = [];
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.twoCateList = [];
|
||||
this.titleList = [];
|
||||
console.log(e);
|
||||
});
|
||||
},
|
||||
transformData(inputData) {
|
||||
const result = {};
|
||||
inputData.forEach((item) => {
|
||||
const { letter } = item;
|
||||
if (!result[letter]) {
|
||||
result[letter] = [];
|
||||
}
|
||||
result[letter].push(item);
|
||||
});
|
||||
// const finalResult = Object.keys(result).map(key => ({ [key]: result[key] }));
|
||||
return result;
|
||||
},
|
||||
// getJFList(id) {
|
||||
// $http.request({
|
||||
// url: "book/prescript/prescriptListForJF",
|
||||
// method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
// data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
// 'categoryId': id
|
||||
// },
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// }).then(res => {
|
||||
// if (res.code == 0 && res.list.length > 0) {
|
||||
// this.twoCateList = []
|
||||
// this.titleList = this.transformData(res.list)
|
||||
// console.log('JF经方', this.titleList)
|
||||
// } else {
|
||||
// this.twoCateList = []
|
||||
// this.titleList = []
|
||||
// }
|
||||
// }).catch(e => {
|
||||
// this.twoCateList = []
|
||||
// this.titleList = []
|
||||
// console.log(e)
|
||||
// })
|
||||
// },
|
||||
getCateList(id) {
|
||||
id ? "" : (id = 0);
|
||||
this.twoCateList = [];
|
||||
this.curTwoCateIndex = 0;
|
||||
// 0为获取顶级分类,其他为搜索下级分类,目前的逻辑,顶级是写死的,所以可能只会涉及到搜索第二级
|
||||
// $http.request({
|
||||
// url: "book/prescript/prescriptCategoryList",
|
||||
// method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
// data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
// 'categoryId': id
|
||||
// },
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// }).then(res => {
|
||||
// console.log(res, '脉穴分类获取成功')
|
||||
// if (res.code == 0 && res.list.length > 0) {
|
||||
// this.oneCateList = res.list
|
||||
this.getTowCateList(this.oneCateList[0].type);
|
||||
// } else {
|
||||
// this.oneCateList = []
|
||||
// }
|
||||
// }).catch(e => {
|
||||
// this.oneCateList = []
|
||||
// console.log(e)
|
||||
// })
|
||||
},
|
||||
|
||||
// 放大图片
|
||||
previewImage(url) {
|
||||
console.log(url);
|
||||
uni.previewImage({
|
||||
urls: [url],
|
||||
longPressActions: {
|
||||
itemList: ["很抱歉,暂不支持保存图片到本地"],
|
||||
success: function (res) {
|
||||
// console.log(res,'+++++')
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
// getSearch() {
|
||||
// $http.request({
|
||||
// url: "book/prescript/searchPrescript",
|
||||
// method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
// data: {
|
||||
// loadAnimate: 'none', // 请求加载动画
|
||||
// 'keywords': this.searchValue,
|
||||
// type: this.curOneCateIndex + 1
|
||||
// },
|
||||
// header: { //默认 无 说明:请求头
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// }).then(res => {
|
||||
// console.log(res, '搜索结果')
|
||||
// if (res.code == 0 && res.list.length >= 0) {
|
||||
// this.showSearchList = true
|
||||
// this.searchList = res.list
|
||||
// } else {
|
||||
// this.searchList = []
|
||||
// }
|
||||
// }).catch(e => {
|
||||
// // this.titleList = []
|
||||
// this.searchList = []
|
||||
// console.log(e)
|
||||
// })
|
||||
// },
|
||||
// search(res) {
|
||||
// console.log(res, 'res')
|
||||
// // uni.showToast({
|
||||
// // title: '搜索:' + res,
|
||||
// // icon: 'none'
|
||||
// // })
|
||||
// if (res == '') {
|
||||
// this.showSearchList = false
|
||||
// this.searchList = []
|
||||
// } else {
|
||||
// this.getSearch()
|
||||
// }
|
||||
|
||||
// },
|
||||
// input(res) {
|
||||
// console.log('----input:', res)
|
||||
// if (res == '') {
|
||||
// this.searchList = []
|
||||
// } else {
|
||||
// this.getSearch()
|
||||
// }
|
||||
// },
|
||||
// clear(res) {
|
||||
// console.log('----clear:', res)
|
||||
// // uni.showToast({
|
||||
// // title: 'clear事件,清除值为:',
|
||||
// // icon: 'none'
|
||||
// // })
|
||||
// this.searchValue = ''
|
||||
// this.showSearchList = false
|
||||
// },
|
||||
// blur(res) {
|
||||
// // console.log('----blur:', res)
|
||||
// // if (res == '') {
|
||||
// // this.showSearchList = false
|
||||
// // this.searchList = []
|
||||
// // } else {
|
||||
// // this.getSearch()
|
||||
// // }
|
||||
// },
|
||||
// focus(e) {
|
||||
// console.log('----focus:')
|
||||
// // uni.showToast({
|
||||
// // title: 'focus事件,输出值为:' + e.value,
|
||||
// // icon: 'none'
|
||||
// // })
|
||||
// // 等于1 就是有权限
|
||||
// // this.showSearchList = true
|
||||
|
||||
// },
|
||||
// cancel(res) {
|
||||
// uni.showToast({
|
||||
// title: '点击取消,输入值为:' + res.value,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
onBackPress() {
|
||||
// #ifdef APP-PLUS
|
||||
plus.key.hideSoftKeybord();
|
||||
// #endif
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-grid-list {
|
||||
// height: 40rpx;
|
||||
}
|
||||
|
||||
.searchList {
|
||||
.item {
|
||||
font-size: 28rpx;
|
||||
padding: 20rpx;
|
||||
border-bottom: 1px solid #dadbde;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-view_H {
|
||||
background-color: #fff;
|
||||
white-space: nowrap;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.scroll-Y {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.scroll-view_H {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.scroll-view-item {
|
||||
// height: 300rpx;
|
||||
// line-height: 300rpx;
|
||||
// text-align: center;
|
||||
// font-size: 36rpx;
|
||||
}
|
||||
|
||||
.scroll-view-item_H {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
// height: 300rpx;
|
||||
// line-height: 300rpx;
|
||||
// text-align: center;
|
||||
// font-size: 36rpx;
|
||||
}
|
||||
|
||||
.titleList {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.titleList2 {
|
||||
height: calc(100% - 170rpx);
|
||||
}
|
||||
.commonPageContentBox{
|
||||
// min-height: 100% !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user