From 8e3ee81b6ed824866734b7034604121f370f4201 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期三, 09 七月 2025 17:55:14 +0800 Subject: [PATCH] 登录、购书码、申请阅读 --- /dev/null | 0 src/views/personalCenter/teacherCertificate.vue | 149 ++++++++----- src/main.js | 22 +- src/views/bookList/bookDetail.vue | 257 ++++++++++++++-------- src/views/index/manual.vue | 34 +- src/views/index/index.vue | 121 +++++----- src/plugin/axios/index.js | 18 - src/views/testLogin.vue | 2 8 files changed, 352 insertions(+), 251 deletions(-) diff --git a/dist.rar b/dist.rar deleted file mode 100644 index ccc7ab4..0000000 --- a/dist.rar +++ /dev/null Binary files differ diff --git a/src/main.js b/src/main.js index 3cdfe28..f264f2a 100644 --- a/src/main.js +++ b/src/main.js @@ -54,16 +54,16 @@ if (bindingCode.code) { let query = { code: bindingCode.code, - isSocial: true // 鍏紬鍙峰拰寮�鏀惧钩鍙版槸涓嶅悓鐨勪富浣擄紝鍏紬鍙风粦瀹氬井淇′娇鐢╥sSocial=true锛屽紑鏀惧钩鍙帮紙鎵爜缁戝畾锛変娇鐢╥sSocial=false; + isSocial: true, // 鍏紬鍙峰拰寮�鏀惧钩鍙版槸涓嶅悓鐨勪富浣擄紝鍏紬鍙风粦瀹氬井淇′娇鐢╥sSocial=true锛屽紑鏀惧钩鍙帮紙鎵爜缁戝畾锛変娇鐢╥sSocial=false; }; MG.identity .bindWeChat(query) - .then(res => { + .then((res) => { const url = window.location.href; const redirectUrl = url.split("?")[0]; window.location.href = redirectUrl; }) - .catch(res => { + .catch((res) => { console.log(res); }); } else { @@ -72,13 +72,12 @@ } else { // 鎷︽埅濡傛灉鏄櫥褰昪ode let loginCode = WeChat.getUrlInfo("weChatLogin"); - console.log(loginCode, "loginCode"); if (loginCode.code) { - WeChat.login(loginCode.code, data => { + WeChat.login(loginCode.code, (data) => { toolClass.setCookie(config.tokenKey, data); const url = window.location.href; const domian = url.split("?")[0]; - console.log(domian, 'domian'); + console.log(domian, "domian"); const routeCode = url.split("#")[1]; const redirectUrl = domian + "#" + routeCode; window.location.href = redirectUrl; @@ -103,11 +102,11 @@ */ let query = { code: checkCode.code, - appCode: config.appRefCode + appCode: config.appRefCode, }; MG.identity .chechWechatAccount(query) - .then(res => { + .then((res) => { if (res == true) { const url = window.location.href; const domian = url.split("?")[0]; @@ -127,7 +126,7 @@ } } }) - .catch(res => { + .catch((res) => { console.log(res); }); } else { @@ -138,7 +137,8 @@ if (ua.match(/MicroMessenger/i) == "micromessenger") { toolClass.delCookie(config.tokenKey); localStorage.fullPath = to.fullPath; - window.location.href = config.requestCtx + "/mobile/textbooks/#" + to.fullPath; + window.location.href = + config.requestCtx + "/mobile/textbooks/#" + to.fullPath; WeChat.getCode("checkWeChat"); } else { WeChat.getCode("weChatLogin"); @@ -153,5 +153,5 @@ new Vue({ router, store, - render: h => h(App) + render: (h) => h(App), }).$mount("#app"); diff --git a/src/plugin/axios/index.js b/src/plugin/axios/index.js index 0a56f9f..960b350 100644 --- a/src/plugin/axios/index.js +++ b/src/plugin/axios/index.js @@ -9,12 +9,12 @@ // 鍒涘缓 axios 瀹炰緥 const service = axios.create({ baseURL: myConfig.requestCtx, - timeout: myConfig.requestTimeOut // 璇锋眰瓒呮椂鏃堕棿 + timeout: myConfig.requestTimeOut, // 璇锋眰瓒呮椂鏃堕棿 }); // 璇锋眰鎷︽埅鍣� service.interceptors.request.use( - config => { + (config) => { // 鍦ㄨ姹傚彂閫佷箣鍓嶅仛涓�浜涘鐞� // if (config.url !== "/api/account/loginByPassword") { let token = toolClass.getCookie(myConfig.tokenKey); @@ -32,7 +32,7 @@ // } return config; }, - error => { + (error) => { // 鍙戦�佸け璐� Promise.reject(error); } @@ -40,18 +40,14 @@ // 鍝嶅簲鎷︽埅鍣� service.interceptors.response.use( - response => { + (response) => { // dataAxios 鏄� axios 杩斿洖鏁版嵁涓殑 data const dataAxios = response.data; - // 杩欎釜鐘舵�佺爜鏄拰鍚庣绾﹀畾鐨� - const { - success - } = dataAxios; + const { success } = dataAxios; if (dataAxios.currentDate) { sessionStorage.currentDate = new Date(dataAxios.currentDate).getTime(); } - // 鏍规嵁 code 杩涜鍒ゆ柇 if (success) { return dataAxios.data; @@ -60,11 +56,11 @@ console.error(dataAxios.msg); } }, - error => { + (error) => { if ((error.message = "Network Error")) { let loginCode = WeChat.getUrlInfo("weChatLogin"); if (loginCode.code) { - WeChat.login(loginCode.code, data => { + WeChat.login(loginCode.code, (data) => { toolClass.setCookie(myConfig.tokenKey, data); location.reload(); }); diff --git a/src/views/bookList/bookDetail.vue b/src/views/bookList/bookDetail.vue index 947e30a..cabbd95 100644 --- a/src/views/bookList/bookDetail.vue +++ b/src/views/bookList/bookDetail.vue @@ -86,7 +86,7 @@ class="detailBox" v-if=" detailsInfo.tourism_catalog && - detailsInfo.tourism_catalog !== '<p></p>' + detailsInfo.tourism_catalog !== '<p></p>' " v-html="detailsInfo.tourism_catalog" ></div> @@ -99,7 +99,7 @@ class="detailBox" v-if=" detailsInfo.tourism_content && - detailsInfo.tourism_content !== '<p></p>' + detailsInfo.tourism_content !== '<p></p>' " v-html="detailsInfo.tourism_content" ></div> @@ -112,7 +112,7 @@ class="detailBox" v-if=" detailsInfo.tourism_authorBrief && - detailsInfo.tourism_authorBrief !== '<p></p>' + detailsInfo.tourism_authorBrief !== '<p></p>' " v-html="detailsInfo.tourism_authorBrief" ></div> @@ -132,9 +132,7 @@ 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" @@ -177,7 +175,11 @@ <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> @@ -203,11 +205,7 @@ 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> @@ -218,6 +216,7 @@ 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"); // 鍏ㄥ眬娉ㄥ唽 @@ -239,7 +238,7 @@ // 鏀惰棌鍥剧墖 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, @@ -258,11 +257,11 @@ teacherState: "", shoppingCartGetId: [], dialogCode: false, - code: "" + code: "", }; }, computed: { - ...mapState(["userInfo"]) + ...mapState(["userInfo"]), }, created() { var that = this; @@ -294,13 +293,13 @@ 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; @@ -312,15 +311,15 @@ 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); @@ -334,6 +333,7 @@ this.getBookResource(); }); }, + getProductType() { var that = this; this.MG.store @@ -341,22 +341,22 @@ 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 ) { @@ -365,7 +365,7 @@ }); } if (element.refCode == "tourism_zone") { - optionList.forEach(item => { + optionList.forEach((item) => { if (that.detailsInfo.tourism_zone == item.value) { that.zone = item.name; } @@ -382,7 +382,7 @@ 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; @@ -390,20 +390,20 @@ } 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( @@ -411,9 +411,9 @@ 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 == "瑙嗛") { @@ -445,12 +445,14 @@ } if (this.resourceData.length > 0) { this.resourceHave = true; - this.initChart(this.resourceData); + if (this.$refs.resourcesChart) { + this.initChart(this.resourceData); + } } else { this.resourceHave = false; } }) - .catch(error => { + .catch((error) => { console.log(error); this.resourceData = []; this.resourceHave = false; @@ -460,13 +462,14 @@ 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); @@ -480,7 +483,7 @@ // 鍩轰簬鍑嗗濂界殑dom锛屽垵濮嬪寲echarts瀹炰緥 let dataList = []; let num = []; - data.forEach(item => { + data.forEach((item) => { dataList.push(item.resourceTypeShow); num.push(item.list.length); }); @@ -489,7 +492,7 @@ myChart.setOption({ tooltip: {}, xAxis: { - data: dataList + data: dataList, }, yAxis: {}, series: [ @@ -498,7 +501,7 @@ type: "bar", data: num, itemStyle: { - color: function(params) { + color: function (params) { // params.dataIndex鏄暟鎹」鐨勭储寮曪紝浣犲彲浠ユ牴鎹繖涓储寮曟潵璁剧疆涓嶅悓鐨勯鑹� const colors = [ "#5EA1FF", @@ -510,15 +513,16 @@ "#3DB0BF", "#FBBB3B", "#3B5EFB", - "#B1FB3B" + "#B1FB3B", ]; return colors[params.dataIndex % colors.length]; - } - } - } - ] + }, + }, + }, + ], }); }, + tabChange(val) { console.log(val, 1); if (val == 3) { @@ -529,9 +533,32 @@ //浣跨敤璐功鐮� useBookCode() { - this.code = ""; - this.dialogCode = true; + 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; @@ -542,9 +569,9 @@ lock = false; that.MG.store .getActiveCode({ - code: that.code + code: that.code, }) - .then(res => { + .then((res) => { console.log(res); if (res && res.saleMethodList) { if ( @@ -553,9 +580,9 @@ ) { that.MG.store .userActiveCode({ - code: that.code + code: that.code, }) - .then(res => { + .then((res) => { Toast.success(res == "婵�娲绘垚鍔�" ? "澶熶拱鎴愬姛" : res); lock = true; that.dialogCode = false; @@ -571,6 +598,7 @@ } } }, + //鍒拌喘涔伴〉闈� payNow() { this.MG.store @@ -578,17 +606,17 @@ 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, + }, }); }); }, @@ -613,10 +641,10 @@ 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); }); @@ -630,11 +658,11 @@ { 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("鍔犲叆璐墿杞︽垚鍔�"); } @@ -644,13 +672,50 @@ //鐢宠璇曠敤 applyBook() { - const role = this.userInfo.role; - if (role == "Teacher") { - this.getAlreadyBookList(this.detailsInfo); + 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 { - Toast.fail("鎮ㄨ繕鏈�氳繃鏁欏笀瀹℃牳"); + const role = this.userInfo.role; + if (role == "Teacher") { + this.getAlreadyBookList(this.detailsInfo); + } else { + 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 = { @@ -660,12 +725,12 @@ 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) { @@ -683,7 +748,7 @@ } }); let objVal = res.datas.find( - i => + (i) => i.productId == bookData.id && i.state != "Reject" && i.state == "WaitAudit" @@ -693,39 +758,40 @@ 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浜嬩欢缁戝畾涓�涓柟娉� @@ -741,7 +807,7 @@ //缁勪欢閿�姣佸悗娓呴櫎浜嬩欢 destroyed() { window.removeEventListener("popstate", this.onClickLeft, false); //false闃绘榛樿浜嬩欢 - } + }, }; </script> @@ -860,6 +926,11 @@ overflow: auto; } +.detailBox { + font-size: none; + font-family: none; +} + .noData { font-size: 16px; font-weight: bold; @@ -887,9 +958,9 @@ width: 60px; height: 60px; } -.autoImg{ - width:40px; - height:40px; +.autoImg { + width: 40px; + height: 40px; } .titleCount { @@ -933,8 +1004,8 @@ } .btnImg { margin-top: 5px; - height:20px; - width:20px; + height: 20px; + width: 20px; } .disable { color: #999; diff --git a/src/views/index/index.vue b/src/views/index/index.vue index c2d1ba5..fb02c66 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -27,7 +27,7 @@ > <div :style="{ - background: 'url(' + item.icon + ') no-repeat 100%,center' + background: 'url(' + item.icon + ') no-repeat 100%,center', }" alt class="banner" @@ -131,10 +131,7 @@ <div class="more" @click="openBtn('true')" v-else>鏀惰捣 -</div> </div> <div class="partnerList"> - <div - :class="isOpen ? 'list' : 'list1'" - v-if="!partnersLoading && partnersList.length > 0" - > + <div class="list" v-if="!partnersLoading && partnersList.length > 0"> <div class="partnerItem" v-for="(item, index) in partnersList" @@ -142,11 +139,6 @@ > <div class="imgBox"> <img class="autoImg" :src="item.icon" /> - </div> - <div class="bookInfo"> - <div class="title" :title="item.name"> - {{ item.name }} - </div> </div> </div> </div> @@ -180,21 +172,21 @@ img: require("@/assets/images/home/guanwang3.png"), circleName: "瀹樼綉涓婚〉", url: "https://www.tepcb.com/mobile/website/", - itemN: "circle-one" + itemN: "circle-one", }, { img: require("@/assets/images/home/shuzijiaocai3.png"), circleName: "鏁板瓧鏁欐潗", url: "/bookList", - itemN: "circle-two" + itemN: "circle-two", }, { img: require("@/assets/images/home/jiaoshirenzheng3.png"), circleName: "鏁欏笀璁よ瘉", url: "/teacherCertificate", - itemN: "circle-three" - } - ] + itemN: "circle-three", + }, + ], }, bookRecommendList: [], bookRecommendLoading: true, @@ -203,7 +195,7 @@ partnersList: [], partnersLoading: false, isOpen: true, - token: "" + token: "", }; }, created() { @@ -219,26 +211,26 @@ that.getPartnersList(); }, computed: { - ...mapState(["userInfo"]) + ...mapState(["userInfo"]), }, methods: { getUserRoleMine() { let that = this; - that.MG.identity.getCurrentAppUser().then(res => { + that.MG.identity.getCurrentAppUser().then((res) => { if (res) { that.userId = res.userId; let teacherRole = res.roleLinks.find( - item => item.role?.refCode == "teacher" + (item) => item.role?.refCode == "teacher" ); let teacherInfo = res.infoList.find( - item => item.type == "teacherInfo" + (item) => item.type == "teacherInfo" ); - let wechatInfo = res.infoList.find(item => item.type == "WeChat"); + let wechatInfo = res.infoList.find((item) => item.type == "WeChat"); let studentInfo = res.infoList.find( - item => item.type == "basicInfo" || item.type == "Default" + (item) => item.type == "basicInfo" || item.type == "Default" ); let phoneInfo = res.secretList.find( - item => item.type == "MobilePhone" + (item) => item.type == "MobilePhone" ); if (teacherRole && teacherInfo) { this.$store.dispatch("setUserInfo", { @@ -246,20 +238,20 @@ phoneNumber: phoneInfo?.credential, icon: wechatInfo?.icon, role: "Teacher", - roleId: teacherRole.role.id + roleId: teacherRole.role.id, }); } else if (wechatInfo) { this.$store.dispatch("setUserInfo", { ...wechatInfo, phoneNumber: phoneInfo?.credential, - role: "Student" + role: "Student", }); } else if (studentInfo) { this.$store.dispatch("setUserInfo", { ...studentInfo, icon: wechatInfo?.icon, phoneNumber: phoneInfo?.credential, - role: "Student" + role: "Student", }); } } @@ -270,9 +262,9 @@ getBanner() { this.MG.resource .getItem({ - path: "tourism_digitalTextbook\\tourism_digitalBannerMobile" + path: "tourism_digitalTextbook\\tourism_digitalBannerMobile", }) - .then(res => { + .then((res) => { this.educate.swipePic = res.datas; console.log(res.datas); }); @@ -282,8 +274,8 @@ this.$router.push({ path: "/bookList", query: { - searchAllWords: this.searchAllWords - } + searchAllWords: this.searchAllWords, + }, }); }, //鎺ㄨ崘鏁欐潗 @@ -301,22 +293,22 @@ queryType: "*", paging: { start: 0, - size: 5 + size: 5, }, fields: { tourism_author: [], tourism_publicationDate: [], - viewCount: [] + viewCount: [], }, sort: { type: "Desc", - field: "CreateDate" + field: "CreateDate", }, coverSize: { - height: 560 - } + height: 560, + }, }) - .then(res => { + .then((res) => { this.bookRecommendList = res.datas; this.bookRecommendLoading = false; }); @@ -327,8 +319,8 @@ this.$router.push({ path: "/bookDetail", query: { - id: data.id - } + id: data.id, + }, }); }, // 杞挱鍥句笅鏂� 鍒楄〃璺宠浆椤甸潰 @@ -338,13 +330,13 @@ window.open(url); } else { this.$router.push({ - path: url + path: url, }); } }, showMore() { this.$router.push({ - path: "/bookList" + path: "/bookList", }); }, //瑙嗛璇存槑 @@ -354,12 +346,12 @@ path: "tourism_digitalTextbook\\tourism_digitalRecommendedTextbooks", fields: { tourism_file: [], - tourism_content: [] - } + tourism_content: [], + }, }) - .then(res => { + .then((res) => { if (res.datas.length > 0) { - res.datas.forEach(element => { + res.datas.forEach((element) => { if ( element.refCode == "tourism_digitalRecommendedTextbooksMobile" ) { @@ -382,7 +374,7 @@ }, getManual() { this.$router.push({ - path: "/manual" + path: "/manual", }); }, //鍚堜綔闄㈡牎 @@ -391,10 +383,16 @@ this.MG.resource .getItem({ path: "tourism_digitalTextbook\\tourism_digitalPartners", - fields: {} + fields: {}, }) - .then(res => { - this.partnersList = res.datas; + .then((res) => { + const data = res.datas; + if (this.isOpen) { + this.partnersList = data.slice(0, 4); + } else { + this.partnersList = data; + } + this.partnersLoading = false; }); }, @@ -404,11 +402,12 @@ } else { this.isOpen = false; } - } + this.getPartnersList(); + }, }, components: { - Footer - } + Footer, + }, }; </script> <style scoped> @@ -612,8 +611,8 @@ } .titleBox .operate img { margin-right: 6px; - width:24px; - height:24px; + width: 24px; + height: 24px; } .descriptionBox { @@ -635,24 +634,28 @@ .partnerList { margin-top: 10px; overflow: hidden; - min-height: 180px; + min-height: 150px; flex-wrap: wrap; } .list { - height: 160px; + min-height: 110px; + overflow: hidden; } -.list1 { +/* .list1 { + line-height: 1.5; min-height: 160px; -} +} */ .partnerItem { - width: calc(100% / 4 - 10px); + width: 25%; display: block; box-sizing: border-box; + float: left; + padding: 5px 20px; } .partnerItem .imgBox { position: relative; width: 100%; - height: 100px; + min-height: 60px; } .partnerItem .bookInfo { margin: 0; diff --git a/src/views/index/manual.vue b/src/views/index/manual.vue index 164091c..63b1076 100644 --- a/src/views/index/manual.vue +++ b/src/views/index/manual.vue @@ -1,12 +1,12 @@ <template> - <div class="manualPage"> + <div class="manualPage"> <van-nav-bar title="鎿嶄綔鎵嬪唽" left-text left-arrow @click-left="onClickLeft" /> - <div style="padding-top: 20px;" v-html="manualCon"></div> + <div style="padding-top: 20px" v-html="manualCon"></div> </div> </template> @@ -16,14 +16,13 @@ data() { return { manualCon: "", - }; }, created() { - this.getOperating() + this.getOperating(); }, methods: { - onClickLeft() { + onClickLeft() { this.$router.go(-1); }, //鎿嶄綔鎵嬪唽 @@ -37,22 +36,27 @@ }) .then((res) => { if (res.datas.length > 0) { + res.datas.forEach((item) => { + item.tourism_content = item.tourism_content.replace( + /<img/g, + '<img style="max-width:100%;height:auto"' + ); + item.tourism_content = item.tourism_content.replace( + /\..\/file/g, + this.config.requestCtx + "/file" + ); + }); this.manualCon = res.datas[0].tourism_content; } }); }, - - - } + }, }; </script> <style scoped> -.manualPage{ - width:100%; - height:100%; - padding: 15px; - +.manualPage { + width: 100%; + height: 100%; + padding: 15px; } - - </style> diff --git a/src/views/personalCenter/teacherCertificate.vue b/src/views/personalCenter/teacherCertificate.vue index 6aaf3cd..268e79a 100644 --- a/src/views/personalCenter/teacherCertificate.vue +++ b/src/views/personalCenter/teacherCertificate.vue @@ -150,7 +150,7 @@ label="鑱旂郴鐢佃瘽" :rules="[ { required: true, message: '璇峰~鍐欐偍鐨勬墜鏈哄彿鐮侊紒' }, - { pattern: /^1[3456789]\d{9}$/, message: '鎵嬫満鍙风爜鏍煎紡閿欒锛�' } + { pattern: /^1[3456789]\d{9}$/, message: '鎵嬫満鍙风爜鏍煎紡閿欒锛�' }, ]" placeholder="璇疯緭鍏ユ偍鐨勮仈绯荤數璇�" /> @@ -216,7 +216,11 @@ </div> <div v-if="!stateDisable" - style="background-color: rgb(240, 240, 240); padding-top: 25px; height: 175px" + style=" + background-color: rgb(240, 240, 240); + padding-top: 25px; + height: 175px; + " > <van-checkbox v-model="approve.agree" @@ -241,7 +245,7 @@ </div> </div> <div v-if="stateDisable && approve.state != 'WaitAudit'"> - <div style="margin:40px;"> + <div style="margin: 40px"> <van-button round block type="info" @click="stateDisable = false" >淇� 鏀�</van-button > @@ -294,7 +298,7 @@ protocolTxt: "", refCode: "", headers: { - Authorization: "" + Authorization: "", }, submitDisabled: true, // 鎻愪氦鎸夐挳,榛樿绂侀�� showPicker: false, @@ -337,7 +341,7 @@ //鐩稿叧璇佷欢 certificate: [], // 鏁欏笀鍚屾剰鍕鹃�夋 - checked: false + checked: false, }, isUpdate: false, @@ -358,7 +362,7 @@ // description: "", //涓汉绠�浠� relevantCertificates: [], //鐩稿叧璇佷欢 state: "", //瀹℃牳鐘舵�侀粯璁ゅ緟瀹℃牳 - agree: false + agree: false, }, //picker閫夋嫨鍒楄〃 colunmsJob: [ @@ -370,7 +374,7 @@ "绯诲壇涓讳换", "涓撲笟璐熻矗浜�", "涓讳换", - "鍏朵粬" + "鍏朵粬", ], colunmsTitle: ["姝i珮绾�", "楂樼骇", "涓�绾�", "浜岀骇", "涓夌骇", "鏃�"], colunmsEdu: ["澶т笓", "鏈", "纭曞+", "鍗氬+"], @@ -379,14 +383,14 @@ fileList: [], isWaitAudit: false, userId: "", - isFree: false + isFree: false, }; }, watch: { "approve.agree": { handler(val) { this.submitDisabled = !val; - } + }, }, $route(to, from) { if ( @@ -395,7 +399,7 @@ ) { this.getProtocol(); } - } + }, }, created() { var that = this; @@ -432,7 +436,7 @@ finishAddress({ selectedOptions }) { this.showPicker3 = false; this.approve.region = selectedOptions - .map(option => option.text) + .map((option) => option.text) .join("/"); }, deleteFile(file) { @@ -444,33 +448,39 @@ }, getUserRole() { let that = this; - that.MG.identity.getCurrentAppUser().then(res => { + that.MG.identity.getCurrentAppUser().then((res) => { that.userId = res.userId; - let teacherRole = res.roleLinks.find(item => item.role?.refCode == "teacher"); - let teacherInfo = res.infoList.find(item => item.type == "teacherInfo") ?? {}; - let wechatInfo = res.infoList.find(item => item.type == "WeChat") ?? {}; - let studentInfo = res.infoList.find(item => item.type == "Default"); - let phoneInfo = res.secretList.find(item => item.type == "MobilePhone"); + let teacherRole = res.roleLinks.find( + (item) => item.role?.refCode == "teacher" + ); + let teacherInfo = + res.infoList.find((item) => item.type == "teacherInfo") ?? {}; + let wechatInfo = + res.infoList.find((item) => item.type == "WeChat") ?? {}; + let studentInfo = res.infoList.find((item) => item.type == "Default"); + let phoneInfo = res.secretList.find( + (item) => item.type == "MobilePhone" + ); if (teacherRole && teacherInfo) { this.$store.dispatch("setUserInfo", { ...teacherInfo, phoneNumber: phoneInfo?.credential, icon: wechatInfo?.icon, role: "Teacher", - roleId: teacherRole.role.id + roleId: teacherRole.role.id, }); } else if (wechatInfo) { this.$store.dispatch("setUserInfo", { ...wechatInfo, phoneNumber: phoneInfo?.credential, - role: "Student" + role: "Student", }); } else if (studentInfo) { this.$store.dispatch("setUserInfo", { ...studentInfo, icon: wechatInfo?.icon, phoneNumber: phoneInfo?.credential, - role: "Student" + role: "Student", }); } }); @@ -478,9 +488,9 @@ getType() { const data = { - refCodes: ["tourism_teacherCertification"] + refCodes: ["tourism_teacherCertification"], }; - this.MG.resource.getCmsTypeByRefCode(data).then(res => { + this.MG.resource.getCmsTypeByRefCode(data).then((res) => { this.newGetTeacherInfo(); this.worksInfo = res[0].cmsTypeLinks[0].children; }); @@ -496,15 +506,15 @@ appRefCode: "tourismWebsite", sort: { type: "Desc", - field: "CreateDate" - } + field: "CreateDate", + }, }; - that.MG.ugc.getTopicMessageList(data).then(res => { + that.MG.ugc.getTopicMessageList(data).then((res) => { try { if (res.datas.length > 0) { that.fileList = []; const resData = res.datas.find( - i => i.appUserCreator.userId == that.userId + (i) => i.appUserCreator.userId == that.userId ); that.approve = that.tool.resultsBytool( that.worksInfo, @@ -528,7 +538,7 @@ } if (that.approve.relevantCertificates.length > 0) { if (typeof that.approve.relevantCertificates == "object") { - that.approve.relevantCertificates.forEach(ele => { + that.approve.relevantCertificates.forEach((ele) => { let imgObj = { md5: ele.file.md5, url: @@ -537,7 +547,7 @@ ele.file.md5, linkType: "LinkFile", linkProtectType: "Public", - isImage: true + isImage: true, }; that.fileList.push(imgObj); }); @@ -550,7 +560,7 @@ md5: that.approve.relevantCertificates, linkType: "LinkFile", linkProtectType: "Public", - isImage: true + isImage: true, }; that.fileList.push(imgObj); } @@ -570,13 +580,13 @@ .getItem({ path: "tourism_protocol", fields: { - tourism_content: [] - } + tourism_content: [], + }, }) - .then(res => { + .then((res) => { try { const data = res.datas.find( - e => e.refCode == "tourism_teacherCertificationAgreement" + (e) => e.refCode == "tourism_teacherCertificationAgreement" ); this.protocolTxt = data ? data.tourism_content : "鏆傛棤鍗忚"; } catch (error) { @@ -609,7 +619,7 @@ this.worksInfo, this.approve, this.fileList - ) + ), }; let basicInfo = JSON.parse(JSON.stringify(this.approve)); delete basicInfo.agree; @@ -620,16 +630,24 @@ { data: JSON.stringify(basicInfo), name: basicInfo.fullName, - type: "teacherInfo" - } - ] + type: "teacherInfo", + }, + ], }; - this.MG.identity.setAppUserInfo(userInfo).then(res => { + this.MG.identity.setAppUserInfo(userInfo).then((res) => { this.MG.ugc.newTopicMessage(data).then(() => { - console.log(res); this.subLoading = true; + const fromRouter = this.$route.query; if (res !== false) { that.newGetTeacherInfo(); + } + if (fromRouter.from && fromRouter.from == "bookDetail") { + this.$router.replace({ + name: "bookDetail", + query: { + id: this.$route.query.id, + }, + }); } }); }); @@ -665,8 +683,8 @@ newDataRequests: fields.newData, updateDataRequests: fields.updateData, delDataRequest: { - ids: [] - } + ids: [], + }, }; delete basicInfo.tourism_relevantCertificates; delete basicInfo.agree; @@ -677,17 +695,26 @@ { data: JSON.stringify(basicInfo), name: basicInfo.fullName, - type: "newTeacherInfo" - } - ] + type: "newTeacherInfo", + }, + ], }; - this.MG.identity.setAppUserInfo(userInfo).then(res => { + this.MG.identity.setAppUserInfo(userInfo).then((res) => { if (res) { - this.MG.ugc.updateTopicMessage(data).then(res => { + this.MG.ugc.updateTopicMessage(data).then((res) => { this.subLoading = false; + const fromRouter = this.$route.query; if (res !== false) { this.getUserRole(); this.newGetTeacherInfo(); + } + if (fromRouter.from && fromRouter.from == "bookDetail") { + this.$router.replace({ + name: "bookDetail", + query: { + id: this.$route.query.id, + }, + }); } }); } @@ -737,7 +764,7 @@ let size = 1024; that.tool .getFileMd5(file.file, size * 1024) - .then(e => { + .then((e) => { const imgData = new FormData(); that.fileMd5 = e; imgData.append("Md5", e); @@ -746,14 +773,14 @@ imgData.append("FileType", FileType); imgData.append("MetaData", null); imgData.append("file", file.file); - that.MG.file.upload(imgData).then(res => { + that.MG.file.upload(imgData).then((res) => { if (res) { this.fileList.push({ md5: e, url: this.config.requestCtx + `/file/GetPreViewImage?md5=` + e, linkType: "LinkFile", linkProtectType: "Public", - isImage: true + isImage: true, }); this.approve.relevantCertificates = this.fileList; // this.fileList = this.approve.relevantCertificates @@ -761,7 +788,7 @@ } }); }) - .catch(e => { + .catch((e) => { that.isLoding = false; console.error(e); }); @@ -802,12 +829,12 @@ } this.MG.store .getProductTypeField({ - refCodes: ["post"] + refCodes: ["post"], }) - .then(res => { + .then((res) => { if (res && res[0].config) { let list = JSON.parse(res[0].config).option; - list.forEach(item => { + list.forEach((item) => { item.text = item.name; }); this.colunmsJob = list; @@ -822,12 +849,12 @@ } this.MG.store .getProductTypeField({ - refCodes: ["positionalTitle"] + refCodes: ["positionalTitle"], }) - .then(res => { + .then((res) => { if (res && res[0].config) { let list = JSON.parse(res[0].config).option; - list.forEach(item => { + list.forEach((item) => { item.text = item.name; }); this.colunmsTitle = list; @@ -841,12 +868,12 @@ } this.MG.store .getProductTypeField({ - refCodes: ["education"] + refCodes: ["education"], }) - .then(res => { + .then((res) => { if (res && res[0].config) { let list = JSON.parse(res[0].config).option; - list.forEach(item => { + list.forEach((item) => { item.text = item.name; }); this.colunmsEdu = list; @@ -877,8 +904,8 @@ onConfirm2(value) { this.approve.education = value.text; this.showPicker2 = false; - } - } + }, + }, }; </script> diff --git a/src/views/testLogin.vue b/src/views/testLogin.vue index 6fa7b92..6d07dc5 100644 --- a/src/views/testLogin.vue +++ b/src/views/testLogin.vue @@ -24,7 +24,7 @@ name: "login", data() { return { - username: "15200000002", + username: "qiyunfeng", password: "xA123456" // username: "guest", // password: "guest" -- Gitblit v1.9.1