| | |
| | | style="width: 100%; height: 300px" |
| | | ></div> |
| | | </div> |
| | | <div class="title" v-if="resourceData.length > 0"> |
| | | 资源明细 |
| | | </div> |
| | | <div class="title" v-if="resourceData.length > 0">资源明细</div> |
| | | <div class="resourceList" v-if="resourceData.length > 0"> |
| | | <div |
| | | v-for="(item, index) in resourceData" |
| | |
| | | <p v-else class="disable">申请试用</p> |
| | | </li> |
| | | <li class="btmBottom1"> |
| | | <img src="@/assets/images/textBook/shidu3.png" alt="" class="btnImg" /> |
| | | <img |
| | | src="@/assets/images/textBook/shidu3.png" |
| | | alt="" |
| | | class="btnImg" |
| | | /> |
| | | <p v-if="isBuy" @click="readBook()">阅读</p> |
| | | <p v-if="!isBuy" @click="readBook()">试读</p> |
| | | </li> |
| | |
| | | show-cancel-button |
| | | @confirm="onConfirm" |
| | | > |
| | | <van-field |
| | | v-model="code" |
| | | placeholder="请输入购书码" |
| | | class="message" |
| | | /> |
| | | <van-field v-model="code" placeholder="请输入购书码" class="message" /> |
| | | </van-dialog> |
| | | </div> |
| | | </template> |
| | |
| | | import { mapState } from "vuex"; |
| | | import toolClass from "@/assets/js/toolClass"; |
| | | import myConfig from "@/assets/js/config"; |
| | | import WeChat from "@/assets/js/weChat/weChat"; |
| | | import axios from "axios"; |
| | | var echarts = require("echarts"); |
| | | // 全局注册 |
| | |
| | | // 收藏图片 |
| | | collectIcon: { |
| | | star: require("@/assets/images/textBook/shoucang3.png"), |
| | | selected_star: require("@/assets/images/tab_collection_pre.png") |
| | | selected_star: require("@/assets/images/tab_collection_pre.png"), |
| | | }, |
| | | isBuy: false, |
| | | tabActive: 0, |
| | |
| | | teacherState: "", |
| | | shoppingCartGetId: [], |
| | | dialogCode: false, |
| | | code: "" |
| | | code: "", |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapState(["userInfo"]) |
| | | ...mapState(["userInfo"]), |
| | | }, |
| | | created() { |
| | | var that = this; |
| | |
| | | tourism_teachingLevel: [], |
| | | tourism_professionalCategory: [], |
| | | tourism_zone: [], |
| | | viewCount: [] |
| | | viewCount: [], |
| | | }, |
| | | coverSize: { |
| | | width: 880 |
| | | } |
| | | width: 880, |
| | | }, |
| | | }) |
| | | .then(res => { |
| | | .then((res) => { |
| | | console.log(res.datas); |
| | | this.isBuy = res.datas.alreadyBuy; |
| | | that.detailsInfo = res.datas; |
| | |
| | | requests: [ |
| | | { |
| | | saleMethodId: this.detailsInfo.defaultSaleMethodId, |
| | | count: 1 |
| | | } |
| | | ] |
| | | count: 1, |
| | | }, |
| | | ], |
| | | }) |
| | | .then(initRes => { |
| | | .then((initRes) => { |
| | | if (initRes.orderNumber) { |
| | | this.MG.store |
| | | .confirmOrder({ orderNum: initRes.orderNumber }) |
| | | .then(aRes => { |
| | | .then((aRes) => { |
| | | if (aRes) { |
| | | Toast.success("免费领取成功!"); |
| | | this.getDetail(id); |
| | |
| | | this.getBookResource(); |
| | | }); |
| | | }, |
| | | |
| | | getProductType() { |
| | | var that = this; |
| | | this.MG.store |
| | |
| | | refCodes: [ |
| | | "tourism_teachingLevel", |
| | | "tourism_professionalCategory", |
| | | "tourism_zone" |
| | | ] |
| | | "tourism_zone", |
| | | ], |
| | | }) |
| | | .then(res => { |
| | | .then((res) => { |
| | | if (res.length > 0) { |
| | | res.forEach(element => { |
| | | res.forEach((element) => { |
| | | let optionList = JSON.parse(element.config).option; |
| | | if (element.refCode == "tourism_teachingLevel") { |
| | | optionList.forEach(item => { |
| | | optionList.forEach((item) => { |
| | | if (that.detailsInfo.tourism_teachingLevel == item.value) { |
| | | that.teachingLevel = item.name; |
| | | } |
| | | }); |
| | | } |
| | | if (element.refCode == "tourism_professionalCategory") { |
| | | optionList.forEach(item => { |
| | | optionList.forEach((item) => { |
| | | if ( |
| | | that.detailsInfo.tourism_professionalCategory == item.value |
| | | ) { |
| | |
| | | }); |
| | | } |
| | | if (element.refCode == "tourism_zone") { |
| | | optionList.forEach(item => { |
| | | optionList.forEach((item) => { |
| | | if (that.detailsInfo.tourism_zone == item.value) { |
| | | that.zone = item.name; |
| | | } |
| | |
| | | this.MG.store |
| | | .delProductLink({ |
| | | productIds: [this.detailsInfo.id], |
| | | linkType: this.config.refCodes.LinkType.FavoriteTextBook |
| | | linkType: this.config.refCodes.LinkType.FavoriteTextBook, |
| | | }) |
| | | .then(() => { |
| | | this.detailsInfo.isFavourite = false; |
| | |
| | | } else { |
| | | let params = { |
| | | productIds: [this.detailsInfo.id], |
| | | linkType: this.config.refCodes.LinkType.FavoriteTextBook |
| | | linkType: this.config.refCodes.LinkType.FavoriteTextBook, |
| | | }; |
| | | this.MG.store.addProductLink(params).then(res => { |
| | | this.MG.store.addProductLink(params).then((res) => { |
| | | this.detailsInfo.isFavourite = true; |
| | | }); |
| | | } |
| | | }, |
| | | //获取教材资源信息 |
| | | getBookResource() { |
| | | console.log( |
| | | this.config.textBookResourceUrl + |
| | | this.detailsInfo.refCode + |
| | | "/resource.json" |
| | | ); |
| | | // console.log( |
| | | // this.config.textBookResourceUrl + |
| | | // this.detailsInfo.refCode + |
| | | // "/resource.json" |
| | | // ); |
| | | try { |
| | | axios |
| | | .get( |
| | |
| | | this.detailsInfo.refCode + |
| | | "/resource.json" |
| | | ) |
| | | .then(async res => { |
| | | .then(async (res) => { |
| | | if (res.data.length > 0) { |
| | | res.data.forEach(item => { |
| | | res.data.forEach((item) => { |
| | | if (item.resourceTypeShow == "图片") { |
| | | item.icon = this.imgIcon; |
| | | } else if (item.resourceTypeShow == "视频") { |
| | |
| | | } |
| | | if (this.resourceData.length > 0) { |
| | | this.resourceHave = true; |
| | | if (this.$refs.resourcesChart) { |
| | | this.initChart(this.resourceData); |
| | | } |
| | | } else { |
| | | this.resourceHave = false; |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | .catch((error) => { |
| | | console.log(error); |
| | | this.resourceData = []; |
| | | this.resourceHave = false; |
| | |
| | | this.resourceHave = false; |
| | | } |
| | | }, |
| | | |
| | | groupByResourceTypeShow(resources) { |
| | | const grouped = resources.reduce((acc, item) => { |
| | | const key = item.resourceTypeShow; |
| | | if (!acc[key]) { |
| | | acc[key] = { |
| | | resourceTypeShow: key, |
| | | list: [] |
| | | list: [], |
| | | }; |
| | | } |
| | | acc[key].list.push(item); |
| | |
| | | // 基于准备好的dom,初始化echarts实例 |
| | | let dataList = []; |
| | | let num = []; |
| | | data.forEach(item => { |
| | | data.forEach((item) => { |
| | | dataList.push(item.resourceTypeShow); |
| | | num.push(item.list.length); |
| | | }); |
| | |
| | | myChart.setOption({ |
| | | tooltip: {}, |
| | | xAxis: { |
| | | data: dataList |
| | | data: dataList, |
| | | }, |
| | | yAxis: {}, |
| | | series: [ |
| | |
| | | "#3DB0BF", |
| | | "#FBBB3B", |
| | | "#3B5EFB", |
| | | "#B1FB3B" |
| | | "#B1FB3B", |
| | | ]; |
| | | return colors[params.dataIndex % colors.length]; |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | }); |
| | | }, |
| | | |
| | | tabChange(val) { |
| | | console.log(val, 1); |
| | | if (val == 3) { |
| | |
| | | |
| | | //使用购书码 |
| | | useBookCode() { |
| | | if (this.token == "" || this.token == undefined || this.token == null) { |
| | | Dialog.confirm({ |
| | | title: "温馨提示", |
| | | message: "请您登录后使用购书码", |
| | | showCancelButton: true, |
| | | cancelButtonText: "取消", |
| | | confirmButtonText: "确定", |
| | | inputType: "text", |
| | | inputPlaceholder: "请输入购书码", |
| | | }) |
| | | .then((res) => { |
| | | if (res == "confirm") { |
| | | toolClass.delCookie(myConfig.tokenKey); |
| | | WeChat.getCode("weChatLogin"); |
| | | return false; |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err); |
| | | }); |
| | | } else { |
| | | this.code = ""; |
| | | this.dialogCode = true; |
| | | } |
| | | }, |
| | | |
| | | onConfirm() { |
| | | var that = this; |
| | | let lock = true; |
| | |
| | | lock = false; |
| | | that.MG.store |
| | | .getActiveCode({ |
| | | code: that.code |
| | | code: that.code, |
| | | }) |
| | | .then(res => { |
| | | .then((res) => { |
| | | console.log(res); |
| | | if (res && res.saleMethodList) { |
| | | if ( |
| | |
| | | ) { |
| | | that.MG.store |
| | | .userActiveCode({ |
| | | code: that.code |
| | | code: that.code, |
| | | }) |
| | | .then(res => { |
| | | .then((res) => { |
| | | Toast.success(res == "激活成功" ? "够买成功" : res); |
| | | lock = true; |
| | | that.dialogCode = false; |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //到购买页面 |
| | | payNow() { |
| | | this.MG.store |
| | |
| | | requests: [ |
| | | { |
| | | saleMethodId: this.detailsInfo.defaultSaleMethodId, |
| | | count: 1 |
| | | } |
| | | ] |
| | | count: 1, |
| | | }, |
| | | ], |
| | | }) |
| | | .then(res => { |
| | | .then((res) => { |
| | | this.$router.push({ |
| | | path: "/pay", |
| | | query: { |
| | | orderNum: res.orderNumber, |
| | | shopId: this.id |
| | | } |
| | | shopId: this.id, |
| | | }, |
| | | }); |
| | | }); |
| | | }, |
| | |
| | | start: 0, |
| | | size: 999, |
| | | filterList: [], |
| | | searchList: [] |
| | | searchList: [], |
| | | }; |
| | | const res = await this.MG.store.getShoppingCartProductList(query); |
| | | res.datas.forEach(item => { |
| | | res.datas.forEach((item) => { |
| | | that.shoppingCartGetId.push(item.saleMethod.id); |
| | | }); |
| | | |
| | |
| | | { |
| | | saleMethodId: this.detailsInfo.defaultSaleMethodId, |
| | | storeEventId: null, |
| | | agentCode: "" |
| | | } |
| | | ] |
| | | agentCode: "", |
| | | }, |
| | | ], |
| | | }; |
| | | this.MG.store.addShoppingCart(data).then(res => { |
| | | this.MG.store.addShoppingCart(data).then((res) => { |
| | | if (res) { |
| | | Toast.success("加入购物车成功"); |
| | | } |
| | |
| | | |
| | | //申请试用 |
| | | applyBook() { |
| | | if (this.token == "" || this.token == undefined || this.token == null) { |
| | | Dialog.confirm({ |
| | | title: "温馨提示", |
| | | message: "请您登录后申请试用", |
| | | showCancelButton: true, |
| | | cancelButtonText: "关闭", |
| | | confirmButtonText: "确定", |
| | | inputType: "text", |
| | | }).then((res) => { |
| | | if (res == "confirm") { |
| | | toolClass.delCookie(myConfig.tokenKey); |
| | | WeChat.getCode("weChatLogin"); |
| | | return false; |
| | | } |
| | | }); |
| | | } else { |
| | | const role = this.userInfo.role; |
| | | if (role == "Teacher") { |
| | | this.getAlreadyBookList(this.detailsInfo); |
| | | } else { |
| | | Toast.fail("您还未通过教师审核"); |
| | | Dialog.confirm({ |
| | | title: "温馨提示", |
| | | message: "您不是教师用户,请进行教师认证后申请试用。", |
| | | messageAlign: "left", |
| | | showCancelButton: true, |
| | | cancelButtonText: "关闭", |
| | | confirmButtonText: "教师认证", |
| | | inputType: "text", |
| | | }) |
| | | .then((res) => { |
| | | if (res == "confirm") { |
| | | this.$router.replace({ |
| | | path: "/teacherCertificate", |
| | | query: { from: "bookDetail", ...this.$route.query }, |
| | | }); |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err); |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //获取已申请试用列表 |
| | | getAlreadyBookList(bookData) { |
| | | const data = { |
| | |
| | | appRefCode: this.config.appRefCode, |
| | | sort: { |
| | | type: "Desc", |
| | | field: "CreateDate" |
| | | } |
| | | field: "CreateDate", |
| | | }, |
| | | }; |
| | | this.MG.ugc.getTopicMessageList(data).then(res => { |
| | | this.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | if (res.datas.length > 0) { |
| | | res.datas.map(item => { |
| | | res.datas.map((item) => { |
| | | if (item.feedBack) { |
| | | item.feedBack = JSON.parse(item.feedBack); |
| | | if (item.feedBack.endDate) { |
| | |
| | | } |
| | | }); |
| | | let objVal = res.datas.find( |
| | | i => |
| | | (i) => |
| | | i.productId == bookData.id && |
| | | i.state != "Reject" && |
| | | i.state == "WaitAudit" |
| | |
| | | title: "提示", |
| | | message: "您已申请试用该书,是否前往查看", |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消" |
| | | cancelButtonText: "取消", |
| | | }).then(() => { |
| | | this.$router.push({ |
| | | name: "myApplyBook" |
| | | name: "myApplyBook", |
| | | }); |
| | | }); |
| | | } else { |
| | | this.$router.push({ |
| | | name: "bookApply", |
| | | query: { |
| | | bookInfo: JSON.stringify(this.detailsInfo) |
| | | } |
| | | bookInfo: JSON.stringify(this.detailsInfo), |
| | | }, |
| | | }); |
| | | } |
| | | } else { |
| | | this.$router.push({ |
| | | name: "bookApply", |
| | | query: { |
| | | bookInfo: JSON.stringify(this.detailsInfo) |
| | | } |
| | | bookInfo: JSON.stringify(this.detailsInfo), |
| | | }, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | contactUs() { |
| | | this.$router.push({ |
| | | name: "aboutUs" |
| | | name: "aboutUs", |
| | | }); |
| | | }, |
| | | |
| | | onClickLeft() { |
| | | this.$router.go(-1); |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | //挂载成功后给pop事件绑定一个方法 |
| | |
| | | //组件销毁后清除事件 |
| | | destroyed() { |
| | | window.removeEventListener("popstate", this.onClickLeft, false); //false阻止默认事件 |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | |
| | | overflow: auto; |
| | | } |
| | | |
| | | .detailBox { |
| | | font-size: none; |
| | | font-family: none; |
| | | } |
| | | |
| | | .noData { |
| | | font-size: 16px; |
| | | font-weight: bold; |