| | |
| | | this.getShoppingCartProductGet() |
| | | this.getApplyInfo(options.id) |
| | | this.getMockData() |
| | | this.getAlreadyPBookList() |
| | | this.getAlreadyEBookList() |
| | | } |
| | | if (wx.getStorageSync(app.config.userInfoKey)) { |
| | | this.setData({ |
| | | userInfo: JSON.parse(wx.getStorageSync(app.config.userInfoKey)) |
| | | }) |
| | | // 获取申请次数 |
| | | this.getSelectPaperBookCount() |
| | | this.getSelectBookCount() |
| | | } |
| | | |
| | | }, |
| | |
| | | }, |
| | | |
| | | //样书申请 |
| | | //获取已申请纸质样书 |
| | | getAlreadyPBookList() { |
| | | const data = { |
| | | start: 0, |
| | | size: 9999, |
| | | topicIdOrRefCode: 'applyEntityBook', |
| | | appRefCode: app.config.appRefCode, |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | } |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | let list = []; |
| | | res.datas.map((item) => { |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | } |
| | | list.push(item) |
| | | }) |
| | | this.setData({ |
| | | alreadyPaperBookList: list, |
| | | }); |
| | | }) |
| | | }, |
| | | //获取已申请电子样书 |
| | | getAlreadyEBookList() { |
| | | const data = { |
| | | start: 0, |
| | | size: 9999, |
| | | topicIdOrRefCode: 'applyBook', |
| | | appRefCode: app.config.appRefCode, |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | } |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | let list = [] |
| | | if (res.datas.length > 0) { |
| | | res.datas.map((item) => { |
| | | if (item.feedBack) { |
| | | item.feedBack = JSON.parse(item.feedBack) |
| | | if (item.feedBack.endDate) { |
| | | let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime() |
| | | let currentDate = new Date().getTime() |
| | | if (times < currentDate) { |
| | | item.isExpiry = true |
| | | } |
| | | } |
| | | } |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | } |
| | | if (item.state != 'Reject') { |
| | | list.push(item) |
| | | } |
| | | }) |
| | | this.setData({ |
| | | alreadyElectronicBookList: list, |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //获取当前已申请次数(纸质) |
| | | getSelectPaperBookCount() { |
| | | app.MG.app |
| | | .getTicketResult({ |
| | | ticketRefCodeOrGuid: 'paperSampleBookapplyNum', |
| | | roleId: this.data.userInfo.roleId |
| | | }) |
| | | .then((res) => { |
| | | this.setData({ |
| | | paperBookCount: res.totalCount - res.usedCount |
| | | }) |
| | | }) |
| | | }, |
| | | //获取当前已申请次数(电子) |
| | | getSelectBookCount() { |
| | | app.MG.app |
| | | .getTicketResult({ |
| | | ticketRefCodeOrGuid: 'electronicSampleBookapplyNum', |
| | | roleId: this.data.userInfo.roleId |
| | | }) |
| | | .then((res) => { |
| | | this.setData({ |
| | | ebookCount: res.totalCount - res.usedCount |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | //申请电子样书 |
| | | appplyElectronicBook() { |
| | | console.log(this.data.bookDetail) |
| | | if (this.data.bookDetail.isApplyBook == 2 || this.data.bookDetail.isApplyBook == 4) { |
| | | |
| | | let role = this.data.userInfo != null ? this.data.userInfo.role : null |
| | | if (role) { |
| | | if (role == 'Teacher') { |
| | | if (this.data.noFile) { |
| | | this.getSelectBookCount() |
| | | } else { |
| | | if (!this.data.noFile) { |
| | | wx.showToast({ |
| | | title: "暂无电子书文件,请联系管理员!", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return |
| | | } |
| | | if (this.data.ebookCount == 0) { |
| | | wx.showToast({ |
| | | title: "您的电子样书申请次数已用尽,若要继续,请联系管理员!", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | if (this.data.electronicBookList.length >= 2) { |
| | | wx.showToast({ |
| | | title: "每次最多只可申请2本样书", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | let isHas = this.data.electronicBookList.find((eitem) => eitem.id == this.data.bookDetail.id) |
| | | if (isHas) { |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | let isApply = this.data.alreadyElectronicBookList.find((eitem) => eitem.id == this.data.bookDetail.id) |
| | | if (isApply) { |
| | | wx.showToast({ |
| | | title: "该书已申请!", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | this.addBookFun(this.data.bookDetail, "eBook") |
| | | } else { |
| | | wx.showModal({ |
| | | title: '尊敬的用户,您好!', //提示的标题 |
| | |
| | | let role = this.data.userInfo != null ? this.data.userInfo.role : null |
| | | if (role) { |
| | | if (role == 'Teacher') { |
| | | this.getSelectPaperBookCount() |
| | | // 点击选中 |
| | | if (this.data.paperBookCount == 0) { |
| | | wx.showToast({ |
| | | title: "您的纸质样书申请次数已用尽,若要继续,请联系管理员!", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | if (this.data.paperBookList.length >= 2) { |
| | | wx.showToast({ |
| | | title: "每次最多只可申请2本样书", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | let isHas = this.data.paperBookList.find((pitem) => pitem.id == this.data.bookDetail.id) |
| | | if (isHas) { |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | let isApply = this.data.alreadyPaperBookList.find((pitem) => pitem.id == this.data.bookDetail.id) |
| | | if (isApply) { |
| | | wx.showToast({ |
| | | title: "该书已申请!", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | return false; |
| | | } |
| | | this.addBookFun(this.data.bookDetail, "pBook") |
| | | } else { |
| | | wx.showModal({ |
| | | title: '尊敬的用户,您好!', //提示的标题 |
| | |
| | | }) |
| | | } |
| | | }, |
| | | //获取当前已申请次数(纸质) |
| | | getSelectPaperBookCount() { |
| | | app.MG.app |
| | | .getTicketResult({ |
| | | ticketRefCodeOrGuid: 'paperSampleBookapplyNum', |
| | | roleId: this.data.userInfo.roleId |
| | | }) |
| | | .then((res) => { |
| | | this.setData({ |
| | | paperBookCount: res.totalCount - res.usedCount |
| | | }) |
| | | this.getAlreadyBookList(this.data.bookDetail, 'pBook') |
| | | }) |
| | | }, |
| | | //获取当前已申请次数(电子) |
| | | getSelectBookCount() { |
| | | app.MG.app |
| | | .getTicketResult({ |
| | | ticketRefCodeOrGuid: 'electronicSampleBookapplyNum', |
| | | roleId: this.data.userInfo.roleId |
| | | }) |
| | | .then((res) => { |
| | | this.setData({ |
| | | ebookCount: res.totalCount - res.usedCount |
| | | }) |
| | | this.getAlreadyBookList(this.data.bookDetail, 'eBook') |
| | | }) |
| | | }, |
| | | //获取已申请的样书列表 |
| | | getAlreadyBookList(item, type) { |
| | | let topicIdOrRefCode = null |
| | | // 添加样书 |
| | | addBookFun(item, type) { |
| | | let itemAttr = null |
| | | const eList = this.data.electronicBookList; |
| | | const pList = this.data.paperBookList; |
| | | itemAttr = { |
| | | id: item.id, |
| | | title: item.name || '-', |
| | | icon: item.icon, |
| | | checked: false, |
| | | defaultSaleMethodId: item.defaultSaleMethodId, |
| | | md5: item.datas.Icon, |
| | | author: item.author || '-', |
| | | price: item.price || '-', |
| | | isbn: item.isbn || '-', |
| | | publicationDate: item.publicationDate |
| | | } |
| | | if (type == 'eBook') { |
| | | topicIdOrRefCode = 'applyBook' |
| | | } else { |
| | | topicIdOrRefCode = 'applyEntityBook' |
| | | } |
| | | const data = { |
| | | start: 0, |
| | | size: 9999, |
| | | topicIdOrRefCode, |
| | | appRefCode: app.config.appRefCode, |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | } |
| | | } |
| | | app.MG.ugc.getTopicMessageList(data).then((res) => { |
| | | let itemAttr = null |
| | | let isHas = false |
| | | itemAttr = { |
| | | id: item.id, |
| | | title: item.name || '--', |
| | | icon: item.icon, |
| | | checked: false, |
| | | defaultSaleMethodId: item.defaultSaleMethodId, |
| | | md5: item.datas.Icon, |
| | | author: item.author || '--', |
| | | price: item.price || '--', |
| | | isbn: item.isbn || '--', |
| | | publicationDate: item.publicationDate |
| | | } |
| | | res.datas.map((item) => { |
| | | if (item.feedBack) { |
| | | item.feedBack = JSON.parse(item.feedBack) |
| | | if (item.feedBack.endDate) { |
| | | const currentDate = new Date() |
| | | let times = new Date(item.feedBack.endDate + ' 23:59:59').getTime() |
| | | if (times < currentDate.getTime()) { |
| | | item.isExpiry = true |
| | | } |
| | | } |
| | | } |
| | | if (item.content) { |
| | | item.content = JSON.parse(item.content) |
| | | item.content.map((e) => (item.productId = e.id)) |
| | | } |
| | | eList.push(itemAttr) |
| | | this.setData({ |
| | | electronicBookList: eList, |
| | | }) |
| | | let objVal = null |
| | | if (type != 'eBook') { |
| | | objVal = res.datas.find( |
| | | (i) => i.productId == item.id && i.state != 'Reject' && i.state == 'WaitAudit' |
| | | ) |
| | | } else { |
| | | objVal = res.datas.find((i) => i.productId == item.id && i.state != 'Reject') |
| | | } |
| | | if (objVal && !objVal.isExpiry && type == 'eBook') { |
| | | wx.showToast({ |
| | | title: "您已申请该样书", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | } else if (objVal && type != 'eBook') { |
| | | wx.showToast({ |
| | | title: "您已申请该样书", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | } else { |
| | | if (type == 'eBook') { |
| | | if (this.data.ebookCount > 0) { |
| | | const eBookData = this.data.electronicBookList |
| | | if (eBookData.length == 2) { |
| | | wx.showToast({ |
| | | title: "每次最多只可申请2本样书", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return false |
| | | } |
| | | if (eBookData.length > 0) { |
| | | for (let i = 0; i < eBookData.length; i++) { |
| | | if (eBookData[i].id == item.id) { |
| | | isHas = true |
| | | } |
| | | } |
| | | if (!isHas) { |
| | | wx.showToast({ |
| | | title: "添加成功,在样书申请单等您哦~", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: [...this.data.electronicBookList, ...[itemAttr]], |
| | | num: this.data.electronicBookList.length + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", this.data.electronicBookList); |
| | | } else { |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: "添加成功,在样书申请单等您哦~", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | electronicBookList: [itemAttr], |
| | | num: 1 + this.data.paperBookList.length |
| | | }) |
| | | wx.setStorageSync("electronicBookList", [itemAttr]); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: "您的电子样书申请次数已用尽,若要继续,请联系管理员!", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | } |
| | | } else { |
| | | if (this.data.paperBookCount > 0) { |
| | | const pBookData = this.data.paperBookList |
| | | if (pBookData.length == 2) { |
| | | wx.showToast({ |
| | | title: "每次最多只可申请2本样书", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return false |
| | | } |
| | | if (pBookData.length > 0) { |
| | | for (let i = 0; i < pBookData.length; i++) { |
| | | if (pBookData[i].id == item.id) { |
| | | isHas = true |
| | | } |
| | | } |
| | | if (!isHas) { |
| | | wx.showToast({ |
| | | title: "添加成功,在样书申请单等您哦~", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | paperBookList: [...this.data.paperBookList, ...[itemAttr]], |
| | | num: this.data.paperBookList.lenght + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", this.data.paperBookList); |
| | | } else { |
| | | wx.showToast({ |
| | | title: "该书已在清单列表中", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: "添加成功,在样书申请单等您哦~", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | this.setData({ |
| | | paperBookList: [itemAttr], |
| | | num: 1 + this.data.electronicBookList.length |
| | | }) |
| | | wx.setStorageSync("paperBookList", [itemAttr]); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: "您的纸质样书申请次数已用尽,若要继续,请联系管理员!", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | wx.setStorageSync("electronicBookList", eList); |
| | | } else { |
| | | pList.push(itemAttr) |
| | | this.setData({ |
| | | paperBookList: pList, |
| | | }) |
| | | wx.setStorageSync("paperBookList", pList); |
| | | } |
| | | this.setData({ |
| | | num: this.data.num + 1 |
| | | }) |
| | | wx.showToast({ |
| | | title: "添加成功,在样书申请单等您哦~", |
| | | icon: "none", |
| | | duration: 1000, |
| | | }) |
| | | }, |
| | | |
| | | //去样书申请单 |
| | | goApply() { |
| | | wx.navigateTo({ |
| | |
| | | link: false, |
| | | epubObj: null, |
| | | currentPage: '', |
| | | pdfList: [] |
| | | pdfList: [], |
| | | skeletonLoding: true, |
| | | }, |
| | | |
| | | /** |
| | |
| | | src: '' |
| | | }) |
| | | if (options) { |
| | | console.log(options) |
| | | wx.setNavigationBarTitle({ |
| | | title: options.fileName, |
| | | skeletonLoding: true |
| | | }) |
| | | this.getProgress(options) |
| | | } |
| | |
| | | this.data.currentPage + "&freeEpubPage=" + data.freePage |
| | | } |
| | | this.setData({ |
| | | src: url |
| | | src: url, |
| | | skeletonLoding: false, |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | |
| | | app.MG.file.getPdfInfo({ |
| | | md5: data.md5 |
| | | }).then((res) => { |
| | | let pageCount = data.bookBuy ? res.totalPages : data.freePage |
| | | if (res && pageCount) { |
| | | let pageCount = data.bookBuy ? res.totalPages : Number(data.freePage) |
| | | |
| | | if (pageCount) { |
| | | let list = []; |
| | | |
| | | for (let i = 0; i < pageCount; i++) { |
| | | const src = app.config.requestCtx + '/file/GetPdfPageImage?md5=' + data.md5 + '&index=' + (i + 1) + '&dpi=300' |
| | | list.push(src) |
| | | } |
| | | console.log(list) |
| | | this.setData({ |
| | | pdfList: list |
| | | pdfList: list, |
| | | skeletonLoding: false, |
| | | }) |
| | | |
| | | } |
| | |
| | | { |
| | | "navigationBarTitleText": "京师E课", |
| | | "usingComponents": {} |
| | | "usingComponents": { |
| | | "t-loading": "tdesign-miniprogram/loading/loading" |
| | | } |
| | | } |
| | |
| | | <!--packageBookService/pages/components/webView/index.wxml--> |
| | | <view class="page-body"> |
| | | <view wx:if="{{epubObj.fileType == 'pdf'}}" class="pdfBox"> |
| | | <view class="body-loading" wx:if="{{skeletonLoding}}"> |
| | | <t-loading theme="circular" size="40rpx" class="wrapper" /> |
| | | </view> |
| | | <view wx:if="{{epubObj.fileType == 'pdf' && !skeletonLoding}}" class="pdfBox"> |
| | | <view wx:for="{{pdfList}}" wx:key="index" wx:for-item="item" wx:for-index="index" class="pdfItem"> |
| | | <image src="{{item}}" alt="" mode="widthFix"></image> |
| | | </view> |
| | | </view> |
| | | <web-view bind:message="drawBack" binderror="onError" bindload="onLoadWeb" src="{{src}}" id="webView" wx:else></web-view> |
| | | <web-view bind:message="drawBack" binderror="onError" bindload="onLoadWeb" src="{{src}}" id="webView" wx:if="{{epubObj.fileType !== 'pdf' && !skeletonLoding}}"></web-view> |
| | | </view> |
| | |
| | | |
| | | .pdfItem { |
| | | text-align: center; |
| | | } |
| | | |
| | | .body-loading { |
| | | padding: 200rpx 0; |
| | | text-align: center; |
| | | } |
| | |
| | | editState: true, |
| | | reasonTxt: "", |
| | | reasonTxtShow: false, |
| | | skeletonLoding: true, |
| | | }, |
| | | |
| | | /** |
| | |
| | | if (res) { |
| | | this.getType() |
| | | this.setData({ |
| | | userId: res.userId |
| | | userId: res.userId, |
| | | skeletonLoding: true, |
| | | }) |
| | | let nickNameData = res.infoList.find((item) => item.type == 'nickName') |
| | | let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') |
| | |
| | | topicId: resData.id, |
| | | topicMessageList: resData.cmsItemDataList, |
| | | teachText: info.positionalTitle, |
| | | skeletonLoding: false, |
| | | }) |
| | | if (resData.feedBack != null) { |
| | | that.setData({ |
| | |
| | | // 上传图片事件 |
| | | chooseImg(e) { |
| | | var that = this; |
| | | if (that.data.imgPics.length == 4) { |
| | | wx.showToast({ |
| | | title: "工作证文件不超过5个!", |
| | | icon: 'none', |
| | | duration: 1000, |
| | | }) |
| | | return |
| | | } |
| | | wx.chooseMedia({ |
| | | count: 1, |
| | | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
| | |
| | | "t-upload": "tdesign-miniprogram/upload/upload", |
| | | "t-popup": "tdesign-miniprogram/popup/popup", |
| | | "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", |
| | | "t-loading": "tdesign-miniprogram/loading/loading", |
| | | "t-image": "tdesign-miniprogram/image/image" |
| | | } |
| | | } |
| | |
| | | <view class="container"> |
| | | <view class="content"> |
| | | <view class="tips"> 仅限学校本课程任课教师申请;请上传有效在职教师工作证将有助于审核。 </view> |
| | | <view class="page-body"> |
| | | <view class="body-loading" wx:if="{{skeletonLoding}}"> |
| | | <t-loading theme="circular" size="40rpx" class="wrapper" /> |
| | | </view> |
| | | <view class="page-body" wx:if="{{!skeletonLoding}}"> |
| | | <view class="baseInfoBox"> |
| | | <view class="from-item"> |
| | | <view class="label"> 当前状态: </view> |
| | | <view class="stateBox" wx:if="{{teacherInfo.schoolName}}"> |
| | | <view class="stateBox"> |
| | | <text class="wait" wx:if="{{teacherInfo.state == 'WaitAudit'}}">等待审核</text> |
| | | <text class="yes" wx:if="{{teacherInfo.state == 'Normal'}}">已认证</text> |
| | | <text class="no" wx:if="{{teacherInfo.state == 'Reject'}}">已驳回</text> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="fileTip"> |
| | | 教务处盖章文件、校工卡皆可 |
| | | 教务处盖章文件、校工卡皆可(不超过5个文件) |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | min-height: 160rpx; |
| | | } |
| | | |
| | | .weui-uploader { |
| | | min-height: 160rpx; |
| | | display: flex; |
| | | flex-flow: row wrap; |
| | | } |
| | | |
| | | .fileTip { |
| | | font-size: 24rpx; |
| | | color: #949494; |
| | |
| | | position: absolute; |
| | | top: -15rpx; |
| | | right: -5rpx; |
| | | } |
| | | |
| | | .body-loading { |
| | | padding: 200rpx 0; |
| | | text-align: center; |
| | | } |
| | |
| | | let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') |
| | | let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo') |
| | | let WeChatInfo = res.infoList.find((item) => item.type === "WeChat"); |
| | | let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword') |
| | | if (teacherRole && teacherInfos) { |
| | | defaultUser = { |
| | | ...teacherInfos, |
| | |
| | | this.setData({ |
| | | currAuthStep: 3, |
| | | }); |
| | | } else if (secretData) { |
| | | defaultUser = { |
| | | nickName: secretData.credential, |
| | | icon: "", |
| | | userId: res.userId, |
| | | role: "Student" |
| | | } |
| | | this.setData({ |
| | | currAuthStep: 3, |
| | | }); |
| | | } |
| | | this.setData({ |
| | | userInfo: defaultUser |