From 23db8ee6063226480f964ed1de3ece9310e221a2 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期三, 21 八月 2024 09:37:43 +0800 Subject: [PATCH] 提交 --- pages/tabBar/firstPage/firstPage.vue | 805 +++++++++++++----------- pages.json | 66 - static/sell.png | 0 common/constant.js | 8 static/companyLogo.png | 0 /dev/null | 0 pages/tabBar/count/count.vue | 108 +- pages/tabBar/current/current.vue | 335 +++++----- pages/tabBar/count/productDetail.vue | 270 ++++++++ static/my-bg.jpg | 0 static/delete.png | 0 manifest.json | 8 static/return.png | 0 static/check.png | 0 pages/tabBar/tabBarIndex.vue | 9 static/take.png | 0 api/index.js | 77 ++ pages/tabBar/count/countDetail.vue | 207 +++--- static/loginTop1.png | 0 pages/index/index.vue | 12 pages/tabBar/utils/tabBar.js | 26 21 files changed, 1,151 insertions(+), 780 deletions(-) diff --git a/api/examine.js b/api/examine.js deleted file mode 100644 index ec11ff6..0000000 --- a/api/examine.js +++ /dev/null @@ -1,17 +0,0 @@ -import {service} from '../common/request.js'; - -export function getExamine(data) { - return service({ - url: '/app/warninfo/review/Page', - method: 'POST', - data - }) -} - -export function submit(data) { - return service({ - url: '/app/warninfo/review/submit', - method: 'POST', - data - }) -} \ No newline at end of file diff --git a/api/index.js b/api/index.js index 7789e7f..0a1a5a0 100644 --- a/api/index.js +++ b/api/index.js @@ -31,26 +31,91 @@ }) } -export function getSwiperList(data) { +export function getHazmatByCode(data) { return service({ - url: '/api/app/carousel/list', + url: '/api/app/hazmat/getHazmatByCode', method: 'GET', data }) } -export function getClassList(data) { +export function getHazmatFlowByUser(data) { return service({ - url: '/api/app/phase-student/list', + url: '/api/app/hazmat-flow/getHazmatFlowByUser', method: 'GET', data }) } -export function getExamList(data) { +export function getProductFlowByUser(data) { return service({ - url: '/api/app/paper-student/list', + url: '/api/app/product-flow/getProductFlowByUser', method: 'GET', data }) +} + +export function getHazmatFlowByCode(data) { + return service({ + url: '/api/app/hazmat-flow/getHazmatFlowByCode', + method: 'GET', + data + }) +} + +// 领用 +export function postHazmatUse(hazmatId) { + return service({ + url: `/api/app/hazmat/hazmatUse/${hazmatId}`, + method: 'POST', + }) +} + +// 归还 +export function postHazmatReturn(data) { + return service({ + url: '/api/app/hazmat/hazmatReturn', + method: 'POST', + data + }) +} + +// 用尽登记 +export function postHazmatUsed(hazmatId) { + return service({ + url: `/api/app/hazmat/hazmatUsed/${hazmatId}`, + method: 'POST', + }) +} + +// 原材料二维码作废 +export function postHazmatDiscard(hazmatId) { + return service({ + url: `/api/app/hazmat/hazmatDiscard/${hazmatId}`, + method: 'POST', + }) +} + +export function getProductByCode(data) { + return service({ + url: '/api/app/product/getProductByCode', + method: 'GET', + data + }) +} + +// 成品销售 +export function postProductDiscard(productId) { + return service({ + url: `/api/app/product/productDiscard/${productId}`, + method: 'POST', + }) +} + +// 成品二维码作废 +export function postProductSold(productId) { + return service({ + url: `/api/app/product/productSold/${productId}`, + method: 'POST', + }) } \ No newline at end of file diff --git a/api/information.js b/api/information.js deleted file mode 100644 index 1ab35b3..0000000 --- a/api/information.js +++ /dev/null @@ -1,17 +0,0 @@ -import {service} from '../common/request.js'; - -export function getInfo(data) { - return service({ - url: '/app/warninfo/waitForPublish/Page', - method: 'POST', - data - }) -} - -export function publishInfo(data) { - return service({ - url: '/app/warninfo/publishById', - method: 'GET', - data - }) -} \ No newline at end of file diff --git a/api/notice.js b/api/notice.js deleted file mode 100644 index 3bcdf38..0000000 --- a/api/notice.js +++ /dev/null @@ -1,64 +0,0 @@ -import {service} from '../common/request.js'; - -export function getNotice(data) { - return service({ - url: '/app/warninfo/receive/Page', - method: 'POST', - data - }) -} -export function confirm(data) { - return service({ - url: '/app/warninfo/responseById', - method: 'GET', - data - }) -} - -export function update(data) { - return service({ - url: '/app/warninfo/readById', - method: 'GET', - data - }) -} - -export function measureList(data) { - return service({ - url: '/response/measure/page', - method: 'POST', - data - }) -} - -export function submitMeasures(data) { - return service({ - url: '/app/warninfo/responseMeasure/submit', - method: 'POST', - data - }) -} - -export function getPublished(data) { - return service({ - url: '/app/warninfo/published/Page', - method: 'POST', - data - }) -} - -export function getMeasureDetail(data) { - return service({ - url: '/app/warninfo/responseMeasure/get', - method: 'POST', - data - }) -} - -export function getResponseDetail(data) { - return service({ - url: '/app/warninfo/responses/page', - method: 'POST', - data - }) -} \ No newline at end of file diff --git a/api/response.js b/api/response.js deleted file mode 100644 index 8b7d57a..0000000 --- a/api/response.js +++ /dev/null @@ -1,17 +0,0 @@ -import {service} from '../common/request.js'; - -export function getResponse(data) { - return service({ - url: '/app/warninfo/person/response', - method: 'POST', - data - }) -} - -export function getDetail(data) { - return service({ - url: '/app/warninfo/detailsByWarnLogId', - method: 'GET', - data - }) -} \ No newline at end of file diff --git a/common/constant.js b/common/constant.js index aeb496f..dc30993 100644 --- a/common/constant.js +++ b/common/constant.js @@ -1,15 +1,11 @@ let VUE_APP_BASE_URL= null; if (process.env.NODE_ENV == 'development') { - VUE_APP_BASE_URL = 'http://192.168.2.15:8082' - // VUE_APP_BASE_URL = 'http://117.190.40.54:6622/edu' + VUE_APP_BASE_URL = 'http://192.168.2.15:8083' // VUE_APP_BASE_URL = 'http://47.108.222.15:8000' }else { - // VUE_APP_BASE_URL = 'http://192.168.2.15:8082' - // 正式环境 + VUE_APP_BASE_URL = 'http://192.168.2.15:8083' // VUE_APP_BASE_URL = 'http://47.108.222.15:8000' - // 国泰 - VUE_APP_BASE_URL = 'http://117.190.40.54:6622/edu' } export default VUE_APP_BASE_URL \ No newline at end of file diff --git a/manifest.json b/manifest.json index a9bfff9..d1b8287 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { - "name" : "安全教育平台", - "appid" : "__UNI__9D7DB5D", + "name" : "危化品全生命周期管理平台", + "appid" : "__UNI__3D059D7", "description" : "", "versionName" : "1.0.0", "versionCode" : 1, @@ -21,7 +21,9 @@ }, "modules" : { "Push" : {}, - "VideoPlayer" : {} + "VideoPlayer" : {}, + "Barcode" : {}, + "Camera" : {} }, /* 模块配置 */ "distribute" : { diff --git a/pages.json b/pages.json index bd37345..009bebd 100644 --- a/pages.json +++ b/pages.json @@ -25,18 +25,6 @@ } }, { - "path" : "pages/tabBar/firstPage/exam", - "style" : - { - "navigationStyle": "custom", - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "app-plus": { - "scrollIndicator": "none" - } - } - }, - { "path" : "pages/tabBar/count/count", "style" : { @@ -66,6 +54,18 @@ } }, { + "path" : "pages/tabBar/count/productDetail", + "style" : + { + "navigationStyle": "custom", + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "app-plus": { + "scrollIndicator": "none" + } + } + }, + { "path" : "pages/tabBar/current/current", "style" : { @@ -79,42 +79,6 @@ "color": "#000000", "style": "circle" } - } - } - }, - { - "path" : "pages/tabBar/current/detail", - "style" : - { - "navigationStyle": "custom", - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "app-plus": { - "scrollIndicator": "none" - } - } - }, - { - "path" : "pages/tabBar/wearhouse/wearhouse", - "style" : - { - "navigationStyle": "custom", - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "app-plus": { - "scrollIndicator": "none" - } - } - }, - { - "path" : "pages/tabBar/wearhouse/questions", - "style" : - { - "navigationStyle": "custom", - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "app-plus": { - "scrollIndicator": "none" } } } @@ -142,13 +106,7 @@ }, { "pagePath": "pages/tabBar/current/current" - }, - { - "pagePath": "pages/tabBar/wearhouse/wearhouse" } - - - ] } } diff --git a/pages/index/index.vue b/pages/index/index.vue index b2c3f32..5414e97 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -4,7 +4,7 @@ <view class="main"> <view class="header"> <view class="titleFirst"> - 你好~<br/>欢迎来到安全教育平台</view> + 你好~<br/>欢迎来到危化品全生命周期管理平台</view> </view> <view> <u-form :model="form" ref="uForm" class="form" > @@ -233,7 +233,7 @@ .titleFirst{ width: 80%; - font-size: 44rpx; + font-size: 34rpx; line-height: 1.5; font-weight: bold; letter-spacing: 2px; @@ -259,7 +259,7 @@ border-radius: 99px; background: #f5f5f5; padding: 15px 20px !important; - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1) !important; + box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1)!important; transition: box-shadow .1s ease !important; &:active{ @@ -269,8 +269,8 @@ .isFocused{ background: #fff; - border-width: 1.5px !important; - border-color: #e6e6e6 !important; + border-width: 2px !important; + border-color: #fff !important; box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.1) inset !important; } @@ -281,7 +281,7 @@ } .loginBtn{ - border: 1px solid rgba(255,255,255,.4); + border: 2px solid rgba(255,255,255,.8); letter-spacing: 10px; box-shadow: 0 2px 4px rgba(0,0,0,.2); background-image: linear-gradient(#41a2ff,#0f7ff9); diff --git a/pages/tabBar/count/count.vue b/pages/tabBar/count/count.vue index 731455e..56fb158 100644 --- a/pages/tabBar/count/count.vue +++ b/pages/tabBar/count/count.vue @@ -15,18 +15,18 @@ <view class="m-p-15"> <view class="userInfo"> <view class="info-l"> - <image src="../../../static/avator.png" mode="widthFix"></image> - <view class="info-icons"> - <u-icon v-if="user.sex==0" name="man" color="#0f7ff9" bold size="24"></u-icon> - <u-icon v-else-if="user.sex==1" name="woman" color="#ff69bf" bold size="24"></u-icon> - <u-icon v-else name="question" color="#ff69bf" bold size="24"></u-icon> - </view> + <image src="../../../static/companyLogo.png" mode="widthFix"></image> +<!-- <view class="info-icons">--> +<!-- <u-icon v-if="user.sex==0" name="man" color="#0f7ff9" bold size="24"></u-icon>--> +<!-- <u-icon v-else-if="user.sex==1" name="woman" color="#ff69bf" bold size="24"></u-icon>--> +<!-- <u-icon v-else name="question" color="#ff69bf" bold size="24"></u-icon>--> +<!-- </view>--> </view> <view class="info-r"> <view class="info-n"> <!-- 用户:--> - <span>{{user.name}}</span> + <span>{{username}}</span> </view> <!-- <view class="info-id">--> @@ -36,20 +36,17 @@ </view> <view class="card-list"> <view class="paper-card"> - <view class="company-info"> - <view class="company-i"> - <view>电话:</view> - <span>{{getPhoneNumber(user.phone)}}</span> - </view> - <view class="company-i"> - <view>公司:</view> - <span v-if="user.company && user.company.name">{{user.company.name?user.company.name:'暂无'}}</span> - </view> - </view> - <view class="menu-i" @click="toMyScore"> + <view class="menu-i" @click="toHazmat"> <view class="menu-l"> - <u-icon name="info-circle-fill" color="#0f7ff9" size="20"></u-icon> - <view>我的成绩</view> + <u-icon name="warning" color="#0f7ff9" size="32"></u-icon> + <view><span style="color: #ed6464">危化品</span>操作记录</view> + </view> + <u-icon name="arrow-right" color="#ccc" size="20"></u-icon> + </view> + <view class="menu-i" @click="toProduct"> + <view class="menu-l"> + <u-icon name="bag" color="#0f7ff9" size="32"></u-icon> + <view><span style="color: #5fb734">成品</span>操作记录</view> </view> <u-icon name="arrow-right" color="#ccc" size="20"></u-icon> </view> @@ -76,7 +73,7 @@ return { page: 'pages/tabBar/count/count', statusBarHeight: '', - user: {}, + username: '', examParams: { pageNum: 1, pageSize: 10, @@ -92,8 +89,9 @@ }, onLoad() { this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; + this.username = uni.getStorageSync('name') // uni.hideTabBar(); - this.getUserInfo() + // this.getUserInfo() }, methods: { @@ -119,10 +117,17 @@ url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) }) }, - toMyScore(){ + toHazmat(){ uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); uni.navigateTo({ url: '/pages/tabBar/count/countDetail' + }) + }, + + toProduct(){ + uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); + uni.navigateTo({ + url: '/pages/tabBar/count/productDetail' }) }, @@ -170,8 +175,6 @@ flex-direction: column; width: 100%; height: 100%; - background: url("../../../static/my-bg.png") no-repeat top fixed; - background-size: 100% auto; } .u-icon{ margin: 0 !important; @@ -211,21 +214,22 @@ .m-p-15{ width: 100%; - margin-top: 50rpx; + padding-top: 50rpx; + background: url("../../../static/my-bg.jpg") no-repeat top; + background-size: 100% auto; .userInfo{ display: flex; align-items: center; - justify-content: left; width: calc(100% - 60px); - margin: 0 auto; + margin: 20rpx auto; .info-l{ width: 150rpx; height: 150rpx; border-radius: 50%; - margin-right: 40rpx; position: relative; + margin-right: 20px; image{ width: 150rpx; height: 150rpx; @@ -267,47 +271,39 @@ margin: 20px 0; .paper-card{ - width: calc(100% - 60px); - background: #fff; - border-radius: 20px; - padding: 15px 15px 5px; + width: calc(100% - 40px); margin: 0 auto 15px; - box-sizing: border-box; - box-shadow: 0 3px 8px rgba(150,150,150,.1); - .company-info{ - border-bottom: 1px solid #e6e6e6; - .company-i{ - display: flex; - align-items: center; - font-size: 28rpx; - color: #999; - margin-bottom: 15px; - view{ - margin-left: 4px; - } - span{ - color: #333; - } - &:first-of-type{ - margin-bottom: 5px; - } - } - } + display: flex; + align-items: center; + justify-content: space-between; .menu-i{ + width: calc(50% - 5px); + background: rgba(255,255,255,1); + border-radius: 12px; display: flex; align-items: center; + box-shadow: 0 3px 8px rgba(150,150,150,.1); justify-content: space-between; - padding: 15px 0; + padding: 18px 15px; box-sizing: border-box; cursor: pointer; .menu-l{ display: flex; align-items: center; - font-size: 28rpx; + font-size: 22rpx; + color: #999; view{ margin-left: 6px; + display: flex; + flex-direction: column; + align-items: flex-start; + span{ + font-size: 32rpx; + font-weight: bold; + color: #333; + } } } } diff --git a/pages/tabBar/count/countDetail.vue b/pages/tabBar/count/countDetail.vue index 7eb97b4..ef721e2 100644 --- a/pages/tabBar/count/countDetail.vue +++ b/pages/tabBar/count/countDetail.vue @@ -8,32 +8,39 @@ <view style="display: flex; flex-direction: column;"> <view class="navBar"> <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack" /> - <view class="barText">我的成绩</view> + <view class="barText">我的操作</view> </view> </view> </view> <view class="m-p-15"> <view class="card-list"> <scroll-view v-if="examList && examList.length>0" scroll-y="true" class="scroll-Y" @scrolltoupper="upper" @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:100%"> - <view class="paper-card" v-for="(item,index) in examList" :key="index" @click="toDetail(item,2)"> + <view class="paper-card" v-for="(item,index) in examList" :key="index"> <view class="paper-card-l"> - <view class="paper-card-t">{{item.examPaper.name}}</view> - <view style="color: #999;margin-bottom: 15px;font-size: 12px">{{item.examPaper.code}}</view> - <view style="display: flex;align-items: center"> - <u-tag style="margin-right: 20rpx" :text="item.examPaper.categoryName" size="mini"></u-tag> - <u-tag :text="item.createName" plain plainFill size="mini"></u-tag> - </view> + <view class="dot"></view> + <view class="line"></view> </view> - <view class="paper-card-r"> - <view :class="item.passed == 0?'red':'green'"> - <view>{{item.score}}</view> - <view class="divide"></view> - <view>{{item.passed == 0?'不合格':'合格'}}</view> + <view class="paper-card-box"> + <view class="paper-card-r"> + <view class="paper-card-t"><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</view> + <view class="paper-card-c"> + <span style="margin-right: 4px">对</span> + <span style="font-weight: bold" v-if="item.hazmatBasic">{{item.hazmatBasic.companyName?item.hazmatBasic.companyName + '的':''}}{{item.hazmatBasic.name}}({{item.hazmatBasic.productSn}})</span> + <span style="font-weight: bold" v-if="item.productBasic">{{item.productBasic.companyName?item.productBasic.companyName + '的':''}}{{item.productBasic.name}}({{item.productBasic.productSn}})</span> + 进行 + <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':'-- '}}</span> + </view> + <view v-if="item.hazmatBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> + <span v-if="item.num > 0">+</span>{{item.num + item.hazmatBasic.unit}} + </view> + <view v-if="item.productBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> + <span v-if="item.num > 0">+</span>{{item.num + item.productBasic.unit}} + </view> </view> </view> </view> </scroll-view> - <u-empty v-else text="暂无已完成的考试记录" mode="list"></u-empty> + <u-empty v-else text="暂无记录" mode="list"></u-empty> </view> <!-- <view>--> <!-- <u-button @click="loginOut" type="primary" text="退出登录" style="width: 80%" shape="circle"></u-button>--> @@ -45,7 +52,7 @@ <script> import tabBar from '../tabBarIndex.vue' - import {getExamList, loginOut} from "../../../api"; + import {getHazmatFlowByUser,loginOut} from "../../../api"; import {getCleanRecord} from "../../../api/wearhouse"; export default { components:{ @@ -58,7 +65,6 @@ examParams: { pageNum: 1, pageSize: 10, - state: 2 }, examList: [], totalPage: 0 @@ -69,7 +75,7 @@ console.log('跳转完成') this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; // uni.hideTabBar(); - this.getExamList() + this.getList() }, methods: { goBack() { @@ -84,8 +90,8 @@ }) } }, - getExamList(){ - getExamList(this.examParams).then(res => { + getList(){ + getHazmatFlowByUser(this.examParams).then(res => { if(res.code == 200) { let list = res.data.list?res.data.list: []; if (res.data.pageNum != 1) { @@ -96,41 +102,6 @@ this.totalPage = res.data.totalPage }else{ uni.$u.toast(res.message) - } - }) - }, - - toDetail(item,type){ - uni.setStorageSync("prevPage", '/pages/tabBar/count/count'); - uni.navigateTo({ - url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) - }) - }, - - loginOut(){ - uni.showModal({ - title: '提示', - content: '是否确认退出该账号?', - success: async function (res) { - if (res.confirm) { - loginOut().then(res=>{ - if(res.code == 200){ - uni.showToast({ - title: '账户已退出', - duration: 1000 - }) - setTimeout(()=>{ - uni.clearStorageSync(); - uni.clearStorage(); - uni.navigateTo({ - url: '/pages/index/index' - }) - },1000) - } - }) - } else if (res.cancel) { - console.log('用户点击取消'); - } } }) }, @@ -146,7 +117,7 @@ uni.$u.toast('已加载全部数据') return } - this.getExamList() + this.getList() }, scrollView(e) { // console.log(e) @@ -205,64 +176,92 @@ .paper-card{ width: calc(100% - 30px); - background: #fff; - border-radius: 20px; - padding: 15px; - margin: 0 auto 15px; - box-sizing: border-box; - box-shadow: 0 3px 8px rgba(150,150,150,.1); + margin: 0 auto; display: flex; - align-items: center; justify-content: space-between; .paper-card-l{ - width: 75%; - - .paper-card-t{ - font-size: 32rpx; - margin-bottom: 10rpx; - font-family: "PingFang SC"; - font-weight: 800; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; + width: 5%; + position: relative; + .dot{ + width: 32rpx; + height: 32rpx; + border-radius: 50%; + background: #5fb734; + position: absolute; + left: 50%; + top: 28rpx; + transform: translateX(-16rpx); + z-index: 9; + box-shadow: 0 3px 8px rgba(95,183,52,.4); + border: 1px solid #fff; + } + .line{ + position: absolute; + left: 50%; + top: 0; + width: 1px; + height: 100%; + border-left: 1px dashed #ccc; } } - - .paper-card-r{ - width: 25%; - &>view{ - width: 140rpx; - height: 140rpx; - border-radius: 50%; - color: #fff; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: 20rpx; - line-height: 1; - - view:first-of-type{ - font-size: 44rpx; - font-weight: 600; + &:first-of-type{ + .paper-card-l{ + .line{ + position: absolute; + left: 50%; + top: 44rpx; + width: 1px; + height: calc(100% - 44rpx); + border-left: 1px dashed #ccc; } - - .divide{ - width: 60%; - height: 1rpx; - background: #fff; + } + } + &:last-of-type{ + .paper-card-l{ + .line{ + position: absolute; + left: 50%; + top: 0; + width: 1px; + height: 56rpx; + border-left: 1px dashed #ccc; + } + } + } + .paper-card-box{ + width: calc(95% - 15px); + padding-bottom: 15px; + .paper-card-r{ + width: 100%; + background: #fff; + border-radius: 20px; + padding: 15px; + box-sizing: border-box; + box-shadow: 0 3px 8px rgba(150,150,150,.1); + .paper-card-t{ + font-size: 32rpx; + font-family: "PingFang SC"; + font-weight: 800; + display: flex; + } + .paper-card-c{ + font-size: 28rpx; margin: 10rpx 0; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; } - } - - .green{ - background: #5fb734; - } - .red{ - background: #ed6464 + .green{ + margin-bottom: 5px; + color: #5fb734; + } + .red{ + margin-bottom: 5px; + color: #ed6464 + } } } } diff --git a/pages/tabBar/count/productDetail.vue b/pages/tabBar/count/productDetail.vue new file mode 100644 index 0000000..023173e --- /dev/null +++ b/pages/tabBar/count/productDetail.vue @@ -0,0 +1,270 @@ +<template> + <view class="box"> + <!-- 自定义导航栏 --> + <view class="navBarBox"> + <!-- 状态栏占位 --> + <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> + <!-- 真正的导航栏内容 --> + <view style="display: flex; flex-direction: column;"> + <view class="navBar"> + <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack" /> + <view class="barText">我的操作</view> + </view> + </view> + </view> + <view class="m-p-15"> + <view class="card-list"> + <scroll-view v-if="examList && examList.length>0" scroll-y="true" class="scroll-Y" @scrolltoupper="upper" @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:100%"> + <view class="paper-card" v-for="(item,index) in examList" :key="index"> + <view class="paper-card-l"> + <view class="dot"></view> + <view class="line"></view> + </view> + <view class="paper-card-box"> + <view class="paper-card-r"> + <view class="paper-card-t"><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</view> + <view class="paper-card-c"> + <span style="margin-right: 4px">对</span> + <span style="font-weight: bold" v-if="item.hazmatBasic">{{item.hazmatBasic.companyName?item.hazmatBasic.companyName + '的':''}}{{item.hazmatBasic.name}}({{item.hazmatBasic.productSn}})</span> + <span style="font-weight: bold" v-if="item.productBasic">{{item.productBasic.companyName?item.productBasic.companyName + '的':''}}{{item.productBasic.name}}({{item.productBasic.productSn}})</span> + 进行 + <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':'-- '}}</span> + </view> + <view v-if="item.hazmatBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> + <span v-if="item.num > 0">+</span>{{item.num + item.hazmatBasic.unit}} + </view> + <view v-if="item.productBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> + <span v-if="item.num > 0">+</span>{{item.num + item.productBasic.unit}} + </view> + </view> + </view> + </view> + </scroll-view> + <u-empty v-else text="暂无记录" mode="list"></u-empty> + </view> +<!-- <view>--> +<!-- <u-button @click="loginOut" type="primary" text="退出登录" style="width: 80%" shape="circle"></u-button>--> +<!-- </view>--> + </view> +<!-- <tabBar :currentPagePath="page"></tabBar>--> + </view> +</template> + +<script> + import tabBar from '../tabBarIndex.vue' + import {getHazmatFlowByUser, getProductFlowByUser, loginOut} from "../../../api"; + import {getCleanRecord} from "../../../api/wearhouse"; + export default { + components:{ + tabBar + }, + data() { + return { + page: 'pages/tabBar/count/productDetail', + statusBarHeight: '', + examParams: { + pageNum: 1, + pageSize: 10, + }, + examList: [], + totalPage: 0 + } + + }, + onLoad() { + console.log('跳转完成') + this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; + // uni.hideTabBar(); + this.getList() + }, + methods: { + goBack() { + const url = uni.getStorageSync("prevPage"); + if(url){ + uni.reLaunch({ + url: url + }); + } else{ + uni.reLaunch({ + url: '/pages/tabBar/count/count' + }) + } + }, + getList(){ + getProductFlowByUser(this.examParams).then(res => { + if(res.code == 200) { + let list = res.data.list?res.data.list: []; + if (res.data.pageNum != 1) { + this.examList = this.examList.concat(list) + } else { + this.examList = res.data.list + } + this.totalPage = res.data.totalPage + }else{ + uni.$u.toast(res.message) + } + }) + }, + + upper(e) { + // console.log(e) + }, + lower(e) { + //并且让页码+1,调用获取数据的方法获取第二页数据 + this.examParams.pageNum++ + //此处调用自己获取数据列表的方法 + if (this.examParams.pageNum > this.totalPage){ + uni.$u.toast('已加载全部数据') + return + } + this.getList() + }, + scrollView(e) { + // console.log(e) + }, + } + } + +</script> + +<style lang='scss' scoped> +.box { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; +} +.fix{ + position: sticky; + top: 0; + left: 0; + right: 0; + width: 100%; + z-index: 1; +} +.navBarBox .navBar { + background-color:#fff; + height: 50px; + display: flex; + flex-direction: row; + justify-content: space-around; + align-items: center; + box-shadow: 0 3px 12px rgba(0,0,0,0.05); +} +.barText{ + margin-left: -20px; + flex: 1; + /* margin-left: 20px; */ + text-align: center; + width: 85%; + font-size: 16px; + /* text-align: center; */ + font-weight: 600; +} +.navBarBox .navBar .logo { + width: 82rpx; + height: 82rpx; + margin-right: 10rpx; +} +.m-p-15{ + width: 100%; + + .card-list{ + width: 100%; + height: calc(100vh - 85px); + margin: 20px 0 15px; + + .paper-card{ + width: calc(100% - 30px); + margin: 0 auto; + display: flex; + justify-content: space-between; + + .paper-card-l{ + width: 5%; + position: relative; + .dot{ + width: 32rpx; + height: 32rpx; + border-radius: 50%; + background: #5fb734; + position: absolute; + left: 50%; + top: 28rpx; + transform: translateX(-16rpx); + z-index: 9; + box-shadow: 0 3px 8px rgba(95,183,52,.4); + border: 1px solid #fff; + } + .line{ + position: absolute; + left: 50%; + top: 0; + width: 1px; + height: 100%; + border-left: 1px dashed #ccc; + } + } + &:first-of-type{ + .paper-card-l{ + .line{ + position: absolute; + left: 50%; + top: 44rpx; + width: 1px; + height: calc(100% - 44rpx); + border-left: 1px dashed #ccc; + } + } + } + &:last-of-type{ + .paper-card-l{ + .line{ + position: absolute; + left: 50%; + top: 0; + width: 1px; + height: 56rpx; + border-left: 1px dashed #ccc; + } + } + } + .paper-card-box{ + width: calc(95% - 15px); + padding-bottom: 15px; + .paper-card-r{ + width: 100%; + background: #fff; + border-radius: 20px; + padding: 15px; + box-sizing: border-box; + box-shadow: 0 3px 8px rgba(150,150,150,.1); + .paper-card-t{ + font-size: 32rpx; + font-family: "PingFang SC"; + font-weight: 800; + display: flex; + } + .paper-card-c{ + font-size: 28rpx; + margin: 10rpx 0; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + .green{ + margin-bottom: 5px; + color: #5fb734; + } + .red{ + margin-bottom: 5px; + color: #ed6464 + } + } + } + } + } +} +</style> \ No newline at end of file diff --git a/pages/tabBar/current/current.vue b/pages/tabBar/current/current.vue index 44bedb3..febe4c3 100644 --- a/pages/tabBar/current/current.vue +++ b/pages/tabBar/current/current.vue @@ -6,36 +6,53 @@ <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> <!-- 真正的导航栏内容 --> <view class="navBar"> -<!-- <u-icon style=" margin-left: 13px;" name="arrow-left" color="black" size="17" @click="goBack"/>--> - <view class="barText">课程</view> -<!-- <view >--> -<!-- <u-button type="text" @click="loginOut" style="color: #1890ff;margin-right: 5px;width: 65px;">退出</u-button>--> -<!-- </view>--> + <view class="barText">记录查询</view> </view> </view> <!-- 页面内容 --> <view class="m-p-15"> - <view class="cardList"> - <scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" - @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:100%"> - <view style="padding: 20px 0 20px"> - <view class="card-i" v-for="(item,index) in classList" :key="index"> - <u-image radius="16px" width="200rpx" height="200rpx" :show-loading="true" :src="getImageUrl(item.course.logo)" mode="aspectFill"> - </u-image> - <!-- <view class="card-i-t">目前已学:{{item.totalProgress}}分钟</view>--> - <view class="card-i-r"> - <view class="card-i-r-t"> - <view>{{item.phaseName + '-' + item.course.name}}</view> - <span style="color: #999;font-size: 12px;display: flex;align-items: center"><u-icon name="account" color="#999" size="18" style="margin-bottom: 0;margin-right: 2px"></u-icon>{{item.createName +'('+ item.createTime +')'}}</span> - </view> - <view class="card-i-r-b"> - <u-tag icon="clock" :text="secondsToHms(item.course.period)" type="success" size="mini" shape="circle" plain plainFill></u-tag> - <u-button class="study-button" type="primary" text="开始学习" shape="circle" size="small" @click="toStudy(item)"></u-button> - </view> + <u-sticky> + <u-input placeholder="请输入或扫描二维码编号进行搜索" v-model="searchContent"> + <template slot="prefix"> + <u-icon name="scan" color="#2979ff" size="28" @click="scanCode()"></u-icon> + </template> + <template slot="suffix"> + <u-button type="primary" class="searchBtn" size="small" text="溯源查询" shape="circle" @click="getList()"></u-button> + </template> + </u-input> + </u-sticky> + <view class="productCard" v-if="dataList && dataList.length>0"> + <view v-if="dataList[0].hazmatBasic"> + <view>名称:<span>{{dataList[0].hazmatBasic?dataList[0].hazmatBasic.name:''}}({{dataList[0].hazmatBasic?dataList[0].hazmatBasic.productSn :''}})</span></view> + <view>条码:<span>{{dataList[0].code}}</span></view> + </view> + <view v-if="dataList[0].productBasic"> + <view>名称:{{dataList[0].productBasic?dataList[0].productBasic.name:''}}({{dataList[0].productBasic?dataList[0].productBasic.productSn :''}})</view> + <view>条码:{{dataList[0].code}}</view> + </view> + </view> + <view class="cardList" v-if="dataList && dataList.length>0"> + <view class="card-i" v-for="(item,index) in dataList" :key="index"> + <view class="card-i-l"> + <span><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</span> + <view v-if="item.user"> + <span></span>{{item.user.departName}}部门的<span style="font-weight: bold">{{item.user.name }}</span>进行了<span :class="item.num>=0?'green':'red'">{{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':'--'}}</span> </view> </view> + <view v-if="item.hazmatBasic" class="card-i-r" :class="item.num>=0?'green':'red'"> + <span v-if="item.num > 0">+</span>{{item.num + item.hazmatBasic.unit}} </view> - </scroll-view> + <view v-if="item.productBasic" class="card-i-r" :class="item.num>=0?'green':'red'"> + <span v-if="item.num > 0">+</span>{{item.num + item.productBasic.unit}} + </view> + </view> + </view> + <view v-else style="margin-top: 200rpx"> + <u-empty + mode="list" + text="通过条码搜索记录" + > + </u-empty> </view> </view> <tabBar :currentPagePath="page"></tabBar> @@ -44,7 +61,7 @@ <script> import tabBar from '../tabBarIndex.vue' - import {getClassList} from '../../../api/index.js' + import {getHazmatFlowByCode} from '../../../api/index.js' import tebBar from '../tabBarIndex.vue' import VUE_APP_BASE_URL from "../../../common/constant"; export default { @@ -55,20 +72,12 @@ return { page: 'pages/tabBar/current/current', statusBarHeight: 0, - classParams: { - pageNum: 1, - pageSize: 10, - }, - classList: [], - totalPage: 0 + searchContent: '', + dataList: [] } }, onLoad() { - // this.unitType = uni.getStorageSync('unittype') + 1; - //获取手机状态栏高度 this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; - this.classParams.pageNum = 1 - this.getClass(); }, onShow() { // this.role = uni.getStorageSync('roleName'); @@ -77,36 +86,43 @@ uni.hideTabBar() }, methods: { - loginOut() { - uni.clearStorageSync(); - uni.clearStorage(); - uni.navigateTo({ - url: '/pages/index/index' - }) - }, - goBack() { - uni.switchTab({ - url:'/pages/tabBar/firstPage/firstPage' - }); - }, - getClass(){ - getClassList(this.classParams).then(res => { - if(res.code == 200) { - let list = res.data.list?res.data.list: []; - if (res.data.pageNum != 1) { - this.classList = this.classList.concat(list) - } else { - this.classList = res.data.list + scanCode(){ + const t = this + uni.scanCode({ + autoZoom: false, + success: function (res) { + if(res && res.result){ + t.searchContent = res.result + getHazmatFlowByCode({code: res.result}).then(re => { + if(re.code == 200) { + t.dataList = re.data?re.data: [] + }else{ + uni.$u.toast(re.message) + } + }) + }else{ + uni.showToast({ + title: '该二维码已失效或不包含条码信息', + duration: 2000 + }) } - this.totalPage = res.data.totalPage - }else{ - uni.$u.toast(res.message) } }) }, - getImageUrl(logo) { - return logo ? VUE_APP_BASE_URL + '/api/' + logo : '/static/defaultCover.jpg'; + getList(){ + const t = this + if(t.searchContent == ''){ + uni.$u.toast('请输入二维码编号') + }else{ + getHazmatFlowByCode({code: t.searchContent}).then(re => { + if(re.code == 200) { + t.dataList = re.data?re.data: [] + }else{ + uni.$u.toast(re.message) + } + }) + } }, toStudy(item) { @@ -115,35 +131,6 @@ url: `/pages/tabBar/current/detail?bank=` + encodeURIComponent(JSON.stringify(item)) }) }, - - secondsToHms(seconds) { - seconds = Number(seconds); - const h = Math.floor(seconds / 3600); - const m = Math.floor(seconds % 3600 / 60); - const s = Math.floor(seconds % 3600 % 60); - - const hDisplay = h > 0 ? String(h).padStart(2, '0') : '00'; - const mDisplay = m > 0 ? String(m).padStart(2, '0') : '00'; - const sDisplay = s > 0 ? String(s).padStart(2, '0') : '00'; - return `${hDisplay}:${mDisplay}:${sDisplay}`; - }, - - upper(e) { - // console.log(e) - }, - lower(e) { - //并且让页码+1,调用获取数据的方法获取第二页数据 - this.classParams.pageNum++ - if (this.classParams.pageNum > this.totalPage){ - uni.$u.toast('已加载全部数据') - return - } - //此处调用自己获取数据列表的方法 - this.getClass() - }, - scrollView(e) { - // console.log(e) - } } } @@ -176,110 +163,122 @@ font-size: 16px; font-weight: 600; flex: 2; - margin-left: 45%; -} -.examineList{ - margin-top: 12px; - height: calc(100vh - 246px); - overflow: hidden; - overflow-y: scroll; + text-align: center; } -.content{ - .tit{ - width: 100%; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - } - .cont{ - width: 100%; - font-size: 14px; - color: #666; - display: block; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - margin-bottom: 6px; - } - .btnGroup{ - width: 100%; - display: flex; - justify-content: space-between; - } +.u-input{ + border-color: #f5f5f5 !important; + border-radius: 99px; + background: #f5f5f5; + + box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.1) inset !important; + transition: box-shadow .1s ease !important; } -.buttonCo{ - margin-top: 5px; - margin-bottom: 10px; +.searchBtn{ + border: 1px solid #fff; + padding: 0 30rpx; + box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.15)!important; } .m-p-15{ width: 100%; -} -.cardList{ - width: 100%; - height: calc(100vh - 130px); + padding: 0 15px; + margin-top: 20px; box-sizing: border-box; - .card-i{ - width: calc(100% - 30px); + .productCard{ + width: 100%; background: #fff; border-radius: 20px; padding: 15px; - margin: 0 auto 15px; - position: relative; - display: flex; - align-items: flex-start; + margin: 15px auto; box-sizing: border-box; box-shadow: 4px 4px 12px rgba(150,150,150,.05); - &:last-of-type{ - margin-bottom: 0; - } - .card-i-t{ - position: absolute; - width: 250rpx; - height: 30px; - border-radius: 20px; - line-height: 30px; - color: #fff; - padding: 0 10rpx; - box-sizing: border-box; - left: 0; - bottom: 0; - background: rgba(0,0,0,.4); - } - .card-i-r{ + &>view>view{ width: 100%; - height: 200rpx; - margin-left: 20rpx; + font-size: 28rpx; + font-weight: bold; + margin-bottom: 10rpx; + + span{ + color: #2979ff; + } + + &:last-of-type{ + margin-bottom: 0; + } + } + } + + .cardList{ + width: 100%; + box-sizing: border-box; + margin-top: 15px; + box-shadow: 4px 4px 12px rgba(150,150,150,.05); + + .card-i{ + width: 100%; + background: #fff; + border-radius: 12px; + padding: 20px 15px; + margin: 0 auto; + box-sizing: border-box; display: flex; - flex-direction: column; justify-content: space-between; - .card-i-r-t{ - view{ - font-size: 32rpx; - margin-bottom: 20rpx; - font-family: "PingFang SC"; - font-weight: 800; + align-items: center; + border-bottom: 1px dashed #ccc; + + &:first-of-type{ + border-radius: 20px 20px 12px 12px; + } + + &:last-of-type{ + margin-bottom: 0; + border-bottom: none; + border-radius: 12px 12px 20px 20px; + } + + .card-i-l{ + height: 100%; + width: 75%; + flex-direction: column; + align-items: flex-end; + justify-content: space-between; + &>span{ + display: flex; + align-items: center; + font-size: 30rpx; + font-weight: bold; + margin-bottom: 15rpx; + } + + &>view{ + width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; + span{ + &:first-of-type{ + display: inline-block; + width: 22px; + } + } } } - .card-i-r-b{ - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; - - .study-button{ - width: 220rpx; - margin: 0; - box-shadow: 3px 3px 12px rgba(51,133,217,.3), -2px -2px 6px #fff; - border: 1px solid rgba(255,255,255,.8); - } + .card-i-r{ + height: 100%; + width: 25%; + text-align: right; + font-size: 32rpx; + font-weight: bolder; + } + .green{ + color: #5fb734; + } + .red{ + color: #ed6464 } } } diff --git a/pages/tabBar/current/detail.vue b/pages/tabBar/current/detail.vue deleted file mode 100644 index 3ffd3eb..0000000 --- a/pages/tabBar/current/detail.vue +++ /dev/null @@ -1,475 +0,0 @@ -<template> - <view style="display: flex;flex-direction: column;height: 100%;"> - <!-- 自定义导航栏 --> - <view class="navBarBox"> - <!-- 状态栏占位 --> - <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> - <!-- 真正的导航栏内容 --> - <view style="display: flex; flex-direction: column;"> - <view class="navBar"> - <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack" /> - <view class="barText">信息详情</view> - <!-- <view > - <u-button type="text" @click="loginOut" style="color: blue;margin-right: 5px;">退出</u-button> - </view> --> - </view> - </view> - </view> -<!-- <video-player ref="playerRef" @update-time="handleUpdateTime"></video-player>--> - <view class="videoWrap" v-if="courseList && courseList.length>0 && detail.resourceType == 1"> - <video ref="videoRef" :key="moduleKey" id="myVideo" :poster="videoUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'" style="width: 100%" :src="videoUrl" @timeupdate="handleTimeChange" :initial-time="initTime" :play-strategy="2" @play="handlePlay" @pause="handlePause" @ended="handlePause" controls></video> -<!-- <view class="videoBox">--> -<!-- <template v-if="!videoPause">--> -<!-- <view class="masterPic">--> -<!-- <image class="img" :src="videoCover" mode="scaleToFill"></image>--> -<!-- </view>--> -<!-- <image class="startIcon" src="/static/image/bofang.png" mode="scaleToFill" @click="startFirstVideo"></image>--> -<!-- </template>--> -<!-- <template v-else>--> -<!-- <view class="video-js" ref="video" style="width: 100%;height: 100%;"></view>--> -<!-- </template>--> -<!-- </view>--> - <view class="viden-info" v-if="showDetail"> - <view class="viden-info-t">{{detail.name}}</view> - <view class="viden-info-i">创建时间:{{detail.createTime}}</view> - </view> - </view> - <view class="m-p-15" v-if="courseList && courseList.length>0"> - <view class="chapterList"> - <view class="chapterItem" v-for="(item,index) in courseList" :key="index"> - <view class="chapterName">{{item.chapterName }}</view> - <view class="courseList"> - <view class="courseItem" :class="{ selected: i.periodId === selectedPeriodId }" v-for="(i,idx) in item.studentStudyPeriodVOList" :key="idx" @click="getLesson(item.chapterId,item.courseId,i.periodId,i.resourceId,true)"> - <view class="c-i-l"> - <u-icon :name="i.resourceType == 1 ?'play-circle':'order'" :color="i.periodId == selectedPeriodId?'#fff':'#007aff'" size="24" style="margin-left: 0"></u-icon> - <view>{{i.periodName}}</view> - </view> - <view class="c-i-r" v-if="i.resourceType == 1"> - <u-line-progress style="width: 45px" height="10" :percentage="i.progress" activeColor="#19be6b"></u-line-progress> - <span>{{secondsToHms(i.period)}}</span> - </view> - </view> - </view> - </view> - </view> - </view> - <view v-else> - <u-empty - mode="list" - icon="http://cdn.uviewui.com/uview/empty/list.png" - > - </u-empty> - </view> - </view> -</template> - -<script> -import cover from '../../../static/defaultCover.jpg' -import {getClassList} from "../../../api"; -import {getCourseDetail, getLessonDetail, postNewStudy, postUpdateStudy} from "../../../api/current"; -export default { - components: { - - }, - data() { - return { - videoCover: cover, - showDetail: false, - bank: {}, - id: null, - phaseId: null, - currentTime: null, - selectedChapterId: null, - selectedCourseId: null, - selectedPeriodId: null, - selectedResourceId: null, - initTime: 0, - courseList: [], - course: {}, - detail: {}, - videoBaseUrl: 'http://192.168.2.16:9000/trainexam/', - videoUrl: '', - status: false, - beforeAudio: true, - duration: 0, - progress: 0, - xpjAudio: null, - videoPause: false, - removeArea:{ - x: 0, - y: 0, - }, - statusBarHeight: 0, - moduleKey: 0, - updateInterval: null, - }; - }, - onReady(){ - this.videoContext = uni.createVideoContext('myVideo') - }, - onLoad(e) { - this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; - this.bank = e.bank && JSON.parse(decodeURIComponent(e.bank)); - this.phaseId = this.bank.phaseId - this.id = this.bank.id - this.updateInterval = null - }, - onShow(){ - - }, - onHide(){ - this.clearUpdateInterval() - }, - onUnload(){ - this.clearUpdateInterval() - }, - mounted() { - this.getData(); - }, - computed: { - - }, - beforeUnmount() { - this.clearUpdateInterval() - }, - - beforeDestroy() { - this.clearUpdateInterval() - }, - - methods: { - videoErrorCallback: function(e) { - uni.showModal({ - content: e.target.errMsg, - showCancel: false - }) - }, - handleTimeChange(e){ - this.currentTime = e.target.currentTime - }, - handlePlay(){ - // this.clearUpdateInterval() - const data = { - chapterId: this.selectedChapterId, - courseId: this.selectedCourseId, - periodId: this.selectedPeriodId, - phaseId: this.phaseId, - studentId: uni.getStorageSync('uid') - } - postNewStudy(data).then(re=>{ - if(re.code == 200){ - this.studyId = re.data - if (!this.updateInterval) { // 避免重复设置定时器 - this.updateInterval = setInterval(() => { - this.handleUpdate(1); - }, 5000); - } - }else{ - uni.$u.toast(res.message) - } - }) - }, - handlePause(){ - // this.handleUpdate().then(()=>{ - this.clearUpdateInterval() - // }) - }, - handleUpdate(type){ - let data = {} - if(type == 1){ - data = { - id: this.studyId, - periodId: this.selectedPeriodId, - phaseId: this.phaseId, - resourceId: this.selectedResourceId, - chapterId: this.selectedChapterId, - courseId: this.selectedCourseId, - studentId: uni.getStorageSync('uid'), - currentDuration: this.currentTime - } - }else{ - data = { - id: this.studyId, - periodId: this.selectedPeriodId, - phaseId: this.phaseId, - resourceId: this.selectedResourceId, - chapterId: this.selectedChapterId, - courseId: this.selectedCourseId, - studentId: uni.getStorageSync('uid'), - currentDuration: null - } - } - return postUpdateStudy(data).then(res=>{ - if(res.code == 200){ - console.log('上报成功') - }else{ - uni.$u.toast(res.message) - this.clearUpdateInterval() - } - }) - }, - clearUpdateInterval() { - if(this.updateInterval){ - clearInterval(this.updateInterval) - this.updateInterval = null - console.log('清除计时') - } - console.log('无计时') - }, - getData(){ - getCourseDetail({phaseStudentId: this.id}).then(res => { - if(res.code == 200) { - if(res.data && res.data.length > 0){ - this.courseList = res.data - let chapterId = this.courseList[0].chapterId - let courseId = this.courseList[0].courseId - let id = this.courseList[0].studentStudyPeriodVOList[0].periodId - let resourceId = this.courseList[0].studentStudyPeriodVOList[0].resourceId - if(id && this.courseList[0].studentStudyPeriodVOList[0].resourceType == 1){ - this.getLesson(chapterId,courseId,id,resourceId,false) - } - }else { - this.courseList = [] - uni.showToast({ - title: '本课程暂无可学习内容', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }) - }, - - getLesson(chapterId,courseId,id,resourceId,isClick){ - this.clearUpdateInterval() - this.selectedChapterId = chapterId - this.selectedCourseId = courseId - this.selectedPeriodId = id; - this.selectedResourceId = resourceId - getLessonDetail({periodId: id}).then(res => { - if(res.code == 200) { - if(res.data){ - this.detail = res.data - this.showDetail = true - if(this.detail.resourceType == 1){ - this.$nextTick(() => { - // this.videoUrl = this.videoBaseUrl + this.detail.resourcePath - this.videoUrl = this.detail.resourcePath - this.moduleKey++ - this.$nextTick(() => { - if(isClick == true){ - uni.createVideoContext('myVideo', this).play(); - } - }) - }) - }else{ - const t = this - uni.downloadFile({ - url: this.detail.resourcePath, - success: function (res) { - const data = { - chapterId: chapterId, - courseId: courseId, - periodId: id, - phaseId: t.phaseId, - studentId: uni.getStorageSync('uid') - } - postNewStudy(data).then(re=>{ - if(re.code == 200){ - this.studyId = re.data - this.handleUpdate(3) - }else{ - uni.$u.toast(res.message) - } - }) - var filePath = res.tempFilePath - uni.openDocument({ - filePath: filePath, - showMenu: true, - success: function (res) { - console.log('打开文档成功'); - } - }) - } - }) - } - } - }else{ - uni.$u.toast(res.message) - } - }) - - }, - - goBack(){ - // uni.navigateBack({ - // delta: 1 - // }); - this.clearUpdateInterval() - uni.reLaunch({ - url: uni.getStorageSync("prevPage") || '/pages/tabBar/firstPage/firstPage' - }); - }, - - handleUpdateTime(time) { - console.log("当前播放时间:", time); - - // 你可以在这里处理传递过来的播放时间 - }, - - secondsToHms(seconds) { - seconds = Number(seconds); - const h = Math.floor(seconds / 3600); - const m = Math.floor(seconds % 3600 / 60); - const s = Math.floor(seconds % 3600 % 60); - - const hDisplay = h > 0 ? String(h).padStart(2, '0') : '00'; - const mDisplay = m > 0 ? String(m).padStart(2, '0') : '00'; - const sDisplay = s > 0 ? String(s).padStart(2, '0') : '00'; - return `${hDisplay}:${mDisplay}:${sDisplay}`; - }, - - changeSwiper() { - this.isVideoPlay = false; - }, - formatTime(num) { - num = Math.floor(num) - let second = num % 60; - if (second < 10) second = '0' + second; - let min = Math.floor(num / 60); - if (min < 10) min = '0' + min; - return min + ":" + second; - }, - } -}; -</script> - -<style lang="scss" scoped> -.navBarBox .navBar { - background-color:#fff; - height: 50px; - display: flex; - flex-direction: row; - justify-content: space-around; - align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); -} -.barText{ - margin-left: -20px; - flex: 1; - /* margin-left: 20px; */ - text-align: center; - width: 85%; - font-size: 16px; - /* text-align: center; */ - font-weight: 600; -} -.navBarBox .navBar .logo { - width: 82rpx; - height: 82rpx; - margin-right: 10rpx; -} -.videoWrap { - background: #fff; - border-radius: 0 0 20px 20px; - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); - - .videoBox { - width: 100%; - height: 260px; - position: relative; - } - - .viden-info{ - padding: 15px; - box-sizing: border-box; - - .viden-info-t{ - font-size: 32rpx; - font-weight: bold; - color: #007aff; - margin-bottom: 10px; - } - - .viden-info-i{ - color: #999; - } - } -} -.m-p-15{ - width: 100%; - padding: 0 15px; - box-sizing: border-box; -} -.chapterList{ - width: 100%; - background: #fff; - border-radius: 16px; - margin: 20px 0; - padding: 15px; - box-sizing: border-box; - box-shadow: 0 5px 10px rgba(150,150,150,.05); - - .chapterItem{ - padding-bottom: 15px; - margin-bottom: 15px; - border-bottom: 1px solid #f0f0f0; - box-sizing: border-box; - - &:last-of-type{ - margin-bottom: 0; - padding-bottom: 0; - border-bottom: none; - } - - .chapterName{ - font-size: 32rpx; - font-weight: bolder; - margin-bottom: 30rpx; - } - - .courseList{ - - .courseItem{ - height: 44rpx; - padding: 10px; - background: #f5f5f5; - border-radius: 4px; - margin-bottom: 10px; - display: flex; - align-items: center; - justify-content: space-between; - transition: .6s; - - .c-i-l{ - display: flex; - align-items: center; - view{ - font-size: 28rpx; - line-height: 44rpx; - margin-left: 10px; - } - } - .c-i-r{ - height: 100%; - display: flex; - justify-content: right; - align-items: center; - span{ - font-size: 13px; - margin-left: 10px; - } - } - } - .selected{ - background: #007aff; - color: #fff; - border-radius: 99rpx !important; - box-shadow: 3px 3px 12px rgba(51,133,217,.3), -2px -2px 6px #fff,inset 3px 3px 9px rgba(0,0,0,.1); - border: 1px solid #fff; - } - } - } -} -</style> diff --git a/pages/tabBar/current/video.vue b/pages/tabBar/current/video.vue deleted file mode 100644 index 546e65d..0000000 --- a/pages/tabBar/current/video.vue +++ /dev/null @@ -1,43 +0,0 @@ -<template> - <view class="content"> - <video id="myVideo" style="width: 100%" preload=“auto” :src="videoUrl" @timeupdate="handleTimeChange" controls></video> - </view> -</template> -<script> - -export default { - data() { - return { - player: null, - videoUrl: '', - info: {}, - baseUrl: 'http://192.168.2.16:9000/trainexam/', - videoContext: null - } - }, - onReady(){ - - }, - mounted() { - - }, - created() { - - }, - methods: { - handleTimeChange(e){ - this.$emit('update-time', e.target.currentTime); - }, - reloadVideo(detail){ - if (this.videoContext) { - this.videoContext.stop(); - this.videoContext = null; - } - this.videoContext = uni.createVideoContext('myVideo') - this.videoUrl = this.baseUrl + detail.resourcePath - this.videoContext.src = this.baseUrl + detail.resourcePath - this.videoContext.play() - } - } -} -</script> \ No newline at end of file diff --git a/pages/tabBar/firstPage/exam.vue b/pages/tabBar/firstPage/exam.vue deleted file mode 100644 index 2171269..0000000 --- a/pages/tabBar/firstPage/exam.vue +++ /dev/null @@ -1,771 +0,0 @@ -<template> - <view style="display: flex;flex-direction: column;height: 100%;"> - <!-- 自定义导航栏 --> - <view class="navBarBox"> - <!-- 状态栏占位 --> - <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> - <!-- 真正的导航栏内容 --> - <view style="display: flex; flex-direction: column;"> - <view class="navBar"> - <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack"/> - <view class="barText">题目内容</view> - <!-- <view > - <u-button type="text" @click="loginOut" style="color: blue;margin-right: 5px;">退出</u-button> - </view> --> - </view> - </view> - </view> - <view class="m-p-15"> - <view class="timer" v-if="viewType == 1 && bank.examPaper.limited == 1"> - <u--image :showLoading="true" :src="sandPic" width="18px" height="18px"></u--image> - <view class="timer-b"> - <span>剩余时间:</span> - <span>{{ formattedTime }}</span> - </view> - </view> - <view class="top"> - <view class="ind">{{'第 ' + (curTotalIndex+1) + ' 题'}}</view> - <view class="panelBtn" @click="openPanel">答题卡</view> - </view> - <view class="questions"> - <view class="title"> - <span>【{{currentQ.questionType == 1?'单选题':currentQ.questionType == 2?'多选题':'判断题'}}】</span> - {{currentQ.title}} - </view> - <view class="content"> - <u-checkbox-group - v-if="viewType == 1 && currentQ.questionType==2" - v-model="currentB" - placement="column" - class="myRadio" - iconPlacement="right" - @change="checkboxChange" - > - <u-checkbox - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - :class="{'picked': currentB.includes(item.prefix)}" - > - </u-checkbox> - </u-checkbox-group> - - <u-checkbox-group - v-if="viewType == 2 && currentQ.questionType==2" - v-model="currentB" - placement="column" - class="myRadio" - iconPlacement="right" - disabled - @change="checkboxChange" - > - <u-checkbox - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - :class="{'picked': currentQ.answer.includes(item.prefix),'wronged': currentB.includes(item.prefix) && !currentQ.answer.includes(item.prefix)}" - > - </u-checkbox> - </u-checkbox-group> - - <u-radio-group v-model="currentA" class="myRadio" iconPlacement="right" placement="column" @change="groupChange" v-if="viewType == 1 && (currentQ.questionType==1||currentQ.questionType==3)"> - <u-radio - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - shape="square" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - @change="radioChange" - :class="{'picked': currentA == item.prefix}" - > - </u-radio> - </u-radio-group> - - <u-radio-group v-model="currentA" class="myRadio" iconPlacement="right" placement="column" @change="groupChange" v-if="viewType == 2 && (currentQ.questionType==1||currentQ.questionType==3)" disabled> - <u-radio - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - shape="square" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - @change="radioChange" - :class="{'picked': currentQ.answer == item.prefix, 'wronged': currentA == item.prefix && currentA != currentQ.answer}" - > - </u-radio> - </u-radio-group> - - <u--textarea v-model="currentA" v-if="viewType == 1 &&(currentQ.questionType==4)" style="margin-bottom: 15px" :maxlength="-1" placeholder="请输入答案" autoHeight @focus="openAnswer"></u--textarea> - <u--textarea v-model="currentA" v-if="viewType == 2 &&(currentQ.questionType==4)" :class="currentQ.answer == currentA?'pickedText':'wrongText'" style="margin-bottom: 15px" :maxlength="-1" placeholder="请输入答案" autoHeight disabled></u--textarea> - - <u-button style="width: 80%;margin: 5px auto 15px" - v-if="currentQ.questionType==2 && currentB.length>0 && viewType ==1" - type="primary" shape="circle" text="确认答案" @click="confirmAnswer(2)"></u-button> - <view class="answers" v-if="viewType == 2"> - <view>你的答案: - <span :class="(currentQ.studentAnswer && currentQ.studentAnswer.answer) && (currentQ.answer == currentQ.studentAnswer.answer)?'right':'wrong'">{{(currentQ.studentAnswer && currentQ.studentAnswer.answer)?currentQ.studentAnswer.answer:'暂未作答'}}</span> -<!-- <span v-else :class="currentQ.answer == currentQ.studentAnswer.answer?'right':'wrong'">{{currentQ.studentAnswer.answer}}</span>--> - </view> - <view>正确答案:<span class="right">{{currentQ.answer}}</span></view> - </view> - </view> - </view> - </view> - <view class="btns"> - <u-button style="width: 30%" type="error" shape="circle" size="small" text="上一题" @click="prevQ"></u-button> - <u-button v-if="viewType == 1" style="width: 30%" type="primary" shape="circle" size="small" text="交卷" @click="endExam"></u-button> - <u-button v-if="curTotalIndex < idList.length - 1" style="width: 30%" type="error" shape="circle" size="small" text="下一题" @click="nextQ"></u-button> - <u-button v-if="curTotalIndex == idList.length - 1 && viewType == 2" style="width: 30%" type="primary" shape="circle" size="small" text="退出" @click="goBack"></u-button> - </view> - <u-popup :show="showPanel" :round="40" mode="bottom" @close="close" @open="open"> - <view class="panel" v-if="viewType == 1"> - <view :class="item.state==1?'right-a':''" v-for="(item,index) in idList" @click="toQuestion(item,index)"> - {{index + 1}} - </view> - </view> - <view class="panel" v-else> - <view :class="item.passed==1?'right-a':item.passed==0?'wrong-a':''" v-for="(item,index) in idList" @click="toQuestion(item,index)"> - {{index + 1}} - </view> - </view> - </u-popup> - <u-popup :show="showInput" :round="40" mode="bottom" @close="closeInput" @open="openInput"> - <view class="panelTwo"> - <u--textarea v-model="currentA" :maxlength="-1" placeholder="请输入答案"></u--textarea> - <u-button shape="circle" type="primary" style="width: 80%;margin-top: 20px" text="确认答案" @click="confirmAnswer(1)"></u-button> - </view> - </u-popup> - </view> -</template> - -<script> -import { - getExamIdIdList, - getExamListByIds, - postExamAnswer, - postEndExam, - getQuestionIdList, - getErrorsIdList, - getQuestionByIds, - postExerciseAnswer -} from '../../../api/wearhouse.js' -import Vue from 'vue' -import {loginOut} from "../../../api"; -import sand from '../../../static/sand.gif' - -export default { - components: { - - }, - data() { - return { - statusBarHeight: 0, - sandPic: sand, - bank: {}, - idList: [], - questionList: [], - curTotalIndex: 0, - currentQ: {}, - currentA: '', - currentB: [], - viewType: null, - startTime: null, - elapsedTime: 0, - timerInterval: null, - showPanel: false, - showInput: false, - limitTime: 0 - } - }, - onReady(){ - }, - onLoad(e) { - this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'] - this.bank = e.bank && JSON.parse(decodeURIComponent(e.bank)) - this.viewType = e.type && JSON.parse(decodeURIComponent(e.type)) - this.startTime = this.bank.startTime?this.bank.startTime:0 - this.getQuestionIds(this.bank.paperId) - this.limitTime = this.bank.examPaper.limited == 1?this.bank.examPaper.limitTime:0 - if(this.viewType == 1){ - this.startTimer() - } - }, - onShow(){ - - }, - mounted() { - - }, - computed: { - formattedTime() { - const totalSeconds = Math.floor((this.limitTime * 60) - this.elapsedTime / 1000); - const hours = Math.floor(totalSeconds / 3600); - const minutes = Math.floor((totalSeconds % 3600) / 60); - const seconds = totalSeconds % 60; - return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; - } - }, - - beforeUnmount() { - - }, - - beforeDestroy() { - clearInterval(this.timerInterval) - }, - methods: { - async openPanel(){ - const t = this - t.showPanel = true - const res = await getExamIdIdList({paperId: this.bank.paperId,viewType: this.viewType}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // t.idList = list.sort((a, b) => a.id - b.id) - this.idList = list - }else{ - t.idList = [] - uni.showToast({ - title: '本题库暂无题目', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - openAnswer(){ - const t = this - t.showInput = true - }, - async toQuestion(item,index){ - this.curTotalIndex = index - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.currentId = this.idList[this.curTotalIndex].id - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - this.showPanel = false - }, - - open() { - // console.log('open'); - }, - close() { - this.showPanel = false - // console.log('close'); - }, - - openInput() { - // console.log('open'); - }, - closeInput(){ - this.showInput = false - }, - - updateTimer() { - const currentTime = Date.now(); - this.elapsedTime = currentTime - this.startTimestamp; - }, - startTimer() { - this.startTimestamp = this.startTime ? this.startTime : Date.now(); - this.timerInterval = setInterval(this.updateTimer, 1000); - }, - - async getQuestionIds(id){ - const res = await getExamIdIdList({paperId: id,viewType: this.viewType}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // this.idList = list.sort((a, b) => a.id - b.id) - this.idList = list - this.curTotalIndex = this.bank.questionId ? this.idList.findIndex(i=>i.id == this.bank.questionId):0 - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.currentId = this.idList[this.curTotalIndex].id - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - }else{ - this.idList = [] - uni.showToast({ - title: '本题库暂无题目', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - - async getErrorIds(id){ - const res = await getErrorsIdList({bankId: id}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // this.idList = list.sort((a, b) => a - b) - this.idList = list - this.curTotalIndex = 0 - const curIdList = this.idList.slice(0,20) - this.currentId = this.idList[0].id - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - }else{ - this.idList = [] - uni.showToast({ - title: '本题库暂无错题', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - - async getQuestionsByIds(idList){ - const res = await getExamListByIds({paperId: this.bank.paperId,questionIds: idList.map(i=>i.id)}) - if(res.code == 200){ - this.questionList = res.data.map(i=>{ - i.content = JSON.parse(i.content) - return i - }) - }else{ - uni.$u.toast(res.message) - } - }, - - checkboxChange(n) { - console.log('change', n); - }, - groupChange(n) { - if(this.currentA !== ''){ - this.confirmAnswer(1) - } - }, - radioChange(n) { - console.log('radioChange', n); - }, - - confirmAnswer(type){ - if(type == 1 && this.currentA == ''){ - uni.$u.toast('答案为空,请先作答') - return - } - const data = { - answer: this.currentQ.questionType==2?this.currentB.join(','):this.currentA, - paperId: this.bank.paperId, - questionId: this.currentQ.id, - studentId: uni.getStorageSync('uid') - } - postExamAnswer(data).then(res=>{ - if(res.code == 200){ - this.currentQ.passed = res.data - if (!this.currentQ.studentAnswer) { - Vue.set(this.currentQ, 'studentAnswer', {}); - } - Vue.set(this.currentQ.studentAnswer, 'answer', data.answer); - if(type == 2){ - this.nextQ() - } - if(this.showInput == true){ - this.showInput = false - } - // uni.$u.toast('答案已提交') - }else{ - uni.$u.toast(res.message) - } - }) - }, - - prevQ(){ - if(this.curTotalIndex - 1>=0){ - this.curTotalIndex-- - // if(this.curTotalIndex == 0){ - // this.getQuestionsByIds([this.idList[0]]).then(()=>{ - // // this.currentQ = this.questionList[this.questionList.length-1] - // this.$set(this, 'currentQ', this.questionList[this.questionList.length-1]) - // this.showAnswer() - // }) - // }else{ - this.currentId = this.idList[this.curTotalIndex].id - if(this.questionList.find(i=>i.id == this.currentId)){ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }else{ - const startIndex = Math.max(0, this.curTotalIndex - 19); - const curIdList = this.idList.slice(startIndex, this.curTotalIndex+1); - this.getQuestionsByIds(curIdList).then(()=>{ - // this.currentQ = this.questionList[this.questionList.length-1] - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }) - } - // } - }else{ - uni.showToast({ - title: '已经是第一题了', - duration: 1000 - }); - } - }, - - nextQ(){ - if(this.curTotalIndex + 1<this.idList.length){ - this.curTotalIndex++ - this.currentId = this.idList[this.curTotalIndex].id - if(this.questionList.find(i=>i.id == this.currentId)){ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }else{ - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.getQuestionsByIds(curIdList).then(()=>{ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - // this.$set(this, 'currentQ', this.questionList[0]) - this.showAnswer() - }) - } - }else{ - uni.showToast({ - title: '已经是最后一题了', - duration: 1000 - }); - } - }, - - showAnswer(){ - if(this.currentQ.studentAnswer && this.currentQ.studentAnswer.answer){ - if(this.currentQ.questionType == 2){ - this.currentB = this.currentQ.studentAnswer.answer.split(',') - }else{ - this.currentA = this.currentQ.studentAnswer.answer - } - }else{ - this.currentB = [] - this.currentA = '' - } - }, - - - - goBack(){ - clearInterval(this.timerInterval); - const url = uni.getStorageSync("prevPage"); - if(url){ - uni.reLaunch({ - url: url - }); - } else{ - uni.reLaunch({ - url: '/pages/tabBar/firstPage/firstPage' - }) - } - }, - - endExam(){ - const t = this - uni.showModal({ - title: '提示', - content: '交卷后将无法再次做题,是否继续?', - success: async function (res) { - if (res.confirm) { - const data = { - id: t.bank.id, - } - postEndExam(data).then(res=>{ - if(res.code == 200){ - uni.showToast({ - title: '本次考试结束', - duration: 1500 - }) - clearInterval(this.timerInterval) - setTimeout(()=>{ - const url = uni.getStorageSync("prevPage"); - if(url){ - if(url == '/pages/tabBar/firstPage/firstPage'){ - uni.reLaunch({ - url:'/pages/tabBar/firstPage/firstPage' - }); - }else{ - uni.navigateTo({ - url: url - }) - } - } else{ - uni.reLaunch({ - url: '/pages/tabBar/firstPage/firstPage' - }) - } - },1500) - }else{ - uni.$u.toast(res.message) - } - }) - } else if (res.cancel) { - console.log('用户点击取消'); - } - } - }) - } - } -}; -</script> - -<style lang="scss" scoped> -.navBarBox .navBar { - background-color:#fff; - height: 50px; - display: flex; - flex-direction: row; - justify-content: space-around; - align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); -} -.barText{ - margin-left: -20px; - flex: 1; - /* margin-left: 20px; */ - text-align: center; - width: 85%; - font-size: 16px; - /* text-align: center; */ - font-weight: 600; -} -.navBarBox .navBar .logo { - width: 82rpx; - height: 82rpx; - margin-right: 10rpx; -} - -.panel{ - height: 60vh; - background: #f2f2f2; - overflow-y: auto; - padding: 15px; - box-sizing: border-box; - display: grid; - grid-template-columns: repeat(5, 1fr); - gap: 15px; - grid-auto-rows: min-content; - - &>view{ - padding: 5px; - box-sizing: border-box; - min-width: 33px; - border-radius: 4px; - text-align: center; - background: rgba(41,121,255,0); - border: 1px solid #fff; - color: #333; - background: #f2f2f2; - transition: all 100ms cubic-bezier(0.175, 0.885, 0.32, 1.275); - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - cursor: pointer; - - &:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); - &:after { - box-shadow: inset 0px -2px 5px rgb(255, 255, 255), - inset 0px 2px 5px rgba(0, 0, 0, 0.15); - } - } - - } - - .right-a{ - background: rgba(41,121,255,.1); - border: 1px solid #2979ff; - color: #2979ff; - } - - .wrong-a{ - background: rgba(237,100,100,.1); - border: 1px solid #ed6464; - color: #ed6464; - } -} - -.panelTwo{ - height: 60vh; - background: #f2f2f2; - padding: 15px; - box-sizing: border-box; - - /deep/ .u-textarea__field{ - height: calc(60vh - 110px) !important; - } -} - -.m-p-15{ - width: 100%; - padding: 0 15px; - box-sizing: border-box; - - .timer{ - background: #fff; - width: auto; - margin: 10px auto; - padding: 10px; - display: flex; - justify-content: center; - align-items: center; - border-radius: 99px; - - .timer-b{ - margin-left: 5px; - display: flex; - align-items: center; - span:last-of-type{ - font-size: 16px; - font-weight: bold; - color: #0f7ff9; - } - } - - } - - .top{ - display: flex; - align-items: center; - justify-content: space-between; - margin: 20px 0; - - .ind{ - font-size: 16px; - font-weight: bold; - color: #2979ff - } - .panelBtn{ - width: 25%; - margin: 0; - text-align: center; - padding: 4px 0; - border-radius: 4px; - color: #2979ff; - background: #f5f7fa; - border: 1px solid rgba(41,121,255,.2); - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - transition: box-shadow .25s ease !important; - } - .panelBtn:active{ - background: #f5f7fa; - border: 1px solid rgba(41,121,255,1); - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); - } - } - - .questions{ - width: 100%; - margin-top: 40rpx; - .title{ - font-size: 16px; - margin-bottom: 20px; - } - .content{ - padding-left: 10rpx; - - .pickedText{ - border: 1.5px solid #2979ff !important; - } - .wrongText{ - border: 1.5px solid #ed6464 !important; - } - - /deep/ .u-textarea__field{ - min-height: 80px; - } - - .answers{ - background: #ecf5ff; - padding: 10px; - &>view{ - margin-bottom: 5px; - } - - span{ - width: 100%; - display: block; - white-space: pre-wrap; - font-weight: bolder; - word-break: break-word; - } - .right{ - color: #3c9cff - } - .wrong{ - color: #e45656 - } - } - } - } -} -.btns{ - width: 100%; - position: fixed; - display: flex; - align-items: center; - justify-content: space-around; - z-index: 99; - bottom: 20px; - left: 0; -} - -/deep/ .u-checkbox{ - background: #fff; - padding: 10px; - box-sizing: border-box; - border-radius: 8px; -} - -/deep/ .u-radio,.u-checkbox{ - padding: 12px 10px; - box-sizing: border-box; - border-radius: 8px; - background: #f5f7fa; - border: 1.5px solid #fff; - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - transition: box-shadow .25s ease !important; -} - -.myRadio{ - /deep/ .picked{ - border: 1.5px solid #2979ff; - - .u-radio__icon-wrap,.u-checkbox__icon-wrap{ - border-color: #fff !important; - span{ - color: #fff !important; - } - } - span{ - color: #2979ff - } - } - /deep/ .wronged{ - border: 1.5px solid #ed6464; - - .u-radio__icon-wrap,.u-checkbox__icon-wrap{ - border-color: #fff !important; - span{ - color: #fff !important; - } - } - span{ - color: #ed6464 - } - } -} - -/deep/ .u-checkbox:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); -} - -/deep/ .u-radio:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); -} - -</style> diff --git a/pages/tabBar/firstPage/firstPage.vue b/pages/tabBar/firstPage/firstPage.vue index 12619cf..039b813 100644 --- a/pages/tabBar/firstPage/firstPage.vue +++ b/pages/tabBar/firstPage/firstPage.vue @@ -12,82 +12,102 @@ <!-- </view>--> </view> </view> - <view style="width: 100%;padding: 0 15px;box-sizing: border-box;margin: 20px 0"> - <u-swiper :list="swiperList" indicatorMode="dot" circular height="160" indicator previousMargin="30" nextMargin="30"></u-swiper> - </view> - - <scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" - @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:calc(100vh - 335px)"> - <view class="m-p-15"> - <view class="card" style="width:100%"> - <view class="card-t"> - <span class="card-t-l">我的线上课程</span> - <span class="card-t-r" @click="toCourses">查看全部</span> - </view> - <view class="card-c"> - <view class="card-i" v-for="(item,index) in classList" :key="index"> - <u-image radius="16px" width="200rpx" height="200rpx" :show-loading="true" :src="getImageUrl(item.course.logo)" mode="aspectFill"> - </u-image> - <!-- <view class="card-i-t">目前已学:{{item.totalProgress}}分钟</view>--> - <view class="card-i-r"> - <view class="card-i-r-t"> - <view>{{item.phaseName + '-' + item.course.name}}</view> - <span style="color: #999;font-size: 12px;display: flex;align-items: center"><u-icon name="account" color="#999" size="18" style="margin-bottom: 0;margin-right: 2px"></u-icon>{{item.createName +'('+ item.createTime +')'}}</span> - </view> - <view class="card-i-r-b"> - <u-tag icon="clock" :text="secondsToHms(item.course.period)" type="success" size="mini" shape="circle" plain plainFill></u-tag> - <u-button class="study-button" type="primary" text="开始学习" shape="circle" size="small" @click="toStudy(item)"></u-button> - </view> - </view> + <u-toast ref="uToast"></u-toast> + <view class="cardList"> + <view class="switchPanel"> + <view class="switchBtns"> + <view class="btnItem" @click="changeTab(1)"> + 危化品 + </view> + <view class="btnItem" @click="changeTab(2)"> + 成品 </view> </view> - </view> - </view> - <view class="m-p-15"> - <view class="card" style="width:100%"> - <view class="card-t"> - <span class="card-t-l">我的考试</span> - <uni-data-select - v-model="examParams.state" - placeholder="完成状态" - :localdata="examSelect" - :clear="true" - @change="changeExam" - ></uni-data-select> - </view> - <view class="card-c card-d" v-if="examList && examList.length>0"> - <view class="paper-card" v-for="(item,index) in examList" :key="index"> - <view class="paper-card-t"><span :class="item.state == 0?'blue':item.state == 1?'red':'green'">[{{item.state == 0?'待考试':item.state == 1?'待批阅':'批阅完成'}}]</span>{{item.examPaper.name}}</view> - <u-tag style="margin-right: 20rpx;display: inline-block" :text="item.examPaper.categoryName" size="mini"></u-tag> - <u-tag style="display: inline-block" :text="item.examPaper.limited == 1?'时长:' + item.examPaper.limitTime + '分钟':'不限时'" plain plainFill size="mini"></u-tag> - <view class="paper-card-b"> - <view style="font-size: 12px;margin-top: 10px;color: #999"> - <view>创建人:{{item.createName}}</view> - <view>截止日期:{{item.examPaper.deadline.substring(0,10)}}</view> - </view> - <view> - <u-button v-if="item.state == 0" @click="toExam(item,1)" class="exam-button" type="primary" text="开始考试" shape="circle" size="small"></u-button> - <u-button v-if="item.state == 2" @click="toExam(item,2)" class="exam-button" type="primary" text="查看" shape="circle" size="small"></u-button> - </view> - </view> - </view> - </view> - <view class="card-c card-d" v-else> - <u-empty text="该状态暂无记录" mode="data"></u-empty> + <view class="colBlock" :style="blockStyle"> + {{blockText}} </view> </view> </view> - - </scroll-view> + <view class="cardList" v-show="tabNum == 1"> + <view class="cardItem" v-for="(item,index) in cardList1" :key="index" @click="scanCode(item.title)"> + <u-image radius="16px" width="140rpx" height="140rpx" :show-loading="true" :src="item.icon" mode="aspectFill"> + </u-image> + <view class="cardTit"> + {{item.title}} + </view> + </view> + </view> + <view class="cardList" v-show="tabNum == 2"> + <view class="cardItem" v-for="(item,index) in cardList2" :key="index" @click="scanCode(item.title)"> + <u-image radius="16px" width="140rpx" height="140rpx" :show-loading="true" :src="item.icon" mode="aspectFill"> + </u-image> + <view class="cardTit"> + {{item.title}} + </view> + </view> + </view> + <u-modal :show="showModal" :title="modalTitle" :showConfirmButton="false" :closeOnClickOverlay="true" ref="uModal" :asyncClose="true" @close="closeModal()"> + <view v-if="tabNum == 1" style="font-size: 32rpx;font-weight: bold;margin-bottom: 10px"> + {{hazmat.hazmatBasic?hazmat.hazmatBasic.name:'--'}}({{hazmat.hazmatBasic?hazmat.hazmatBasic.productSn:'--'}}) + </view> + <view v-if="tabNum == 2" style="font-size: 32rpx;font-weight: bold;margin-bottom: 10px"> + {{product.productBasic?product.productBasic.name:'--'}}({{product.productBasic?product.productBasic.productSn:'--'}}) + </view> + <view> + 二维码识别号:{{tabNum == 1?hazmat.code:product.code}} + </view> + <view> + 入库时间:{{tabNum == 1?hazmat.createTime:product.createTime}} + </view> + <view v-if="modalTitle == '取用' || modalTitle == '扫码作废'"> + <span v-if="tabNum == 1">当前包装存量:{{hazmat.remaining}}{{hazmat.hazmatBasic?hazmat.hazmatBasic.unit:''}}</span> + <span v-else>当前包装存量:{{product.remaining}}{{product.productBasic?product.productBasic.unit:''}}</span> + </view> + <view v-if="modalTitle == '归还' || modalTitle == '用尽登记'"> + 取用时存量:{{hazmat.remaining}}{{hazmat.hazmatBasic?hazmat.hazmatBasic.unit:''}} + </view> + <br> + <view v-if="modalTitle == '归还'"> + 请输入归还剩余量: + <u--form labelPosition="left" :model="hazmatBack" :rules="rules" ref="uForm"> + <u-form-item + prop="remaining" + ref="remaining" + > + <u--input + v-model="hazmatBack.remaining" + :placeholder="'必填(单位:' + (hazmat.hazmatBasic?hazmat.hazmatBasic.unit:'') + ')'" + type="number" + ></u--input> + </u-form-item> + </u--form> + </view> + <u-button v-if="modalTitle == '取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake()"></u-button> + <u-button v-if="modalTitle == '归还'" type="primary" style="margin-top: 20px" text="确认归还" @click="confirmBack()"></u-button> + <u-button v-if="modalTitle == '用尽登记'" type="warning" style="margin-top: 20px" text="确认用尽登记" @click="confirmCheck()"></u-button> + <u-button v-if="modalTitle == '销售'" type="primary" style="margin-top: 20px" text="确认销售" @click="confirmSell()"></u-button> + <u-button v-if="modalTitle == '扫码作废'" type="error" style="margin-top: 20px" text="确认作废该二维码" @click="confirmCancle()"></u-button> + </u-modal> <tabBar :currentPagePath="page"></tabBar> </view> </template> <script> import tabBar from '../tabBarIndex.vue' - import {getClassList, getExamList, getSwiperList} from '../../../api/index.js' + import { + getHazmatByCode, + postHazmatReturn, + postHazmatUse, + postHazmatUsed, + postHazmatDiscard, + postProductDiscard, getProductByCode, postProductSold + } from '../../../api/index.js' import VUE_APP_BASE_URL from 'common/constant.js' -import { Value } from 'sass'; + import take from '../../../static/take.png' + import takeBack from '../../../static/return.png' + import check from '../../../static/check.png' + import del from '../../../static/delete.png' + import sell from '../../../static/sell.png' import {postEndExam} from "../../../api/wearhouse"; export default { components:{ @@ -95,36 +115,63 @@ }, data() { return { - swiperList: [ - '/static/home/swiperPic.png','/static/home/swiperPic.png','/static/home/swiperPic.png' - ], - titleList:[ - { - label: '默认排序', - value: 1, - } - ], - classList: [], - examList: [], - totalPage: 0, page: 'pages/tabBar/firstPage/firstPage', statusBarHeight: '', - classParams:{ - pageNum: 1, - pageSize: 3, - }, - examParams: { - pageNum: 1, - pageSize: 10, - state: 0 - }, - examSelect: [ - { value: 0, text: "待考试" }, - { value: 1, text: "待批阅" }, - { value: 2, text: "批阅完成" }, + cardList1: [ + { + icon: take, + title: '取用', + type: 1 + }, + { + icon: takeBack, + title: '归还', + type: 2 + }, + { + icon: check, + title: '用尽登记', + type: 3 + }, + { + icon: del, + title: '扫码作废', + type: 4 + } ], - role: '', - realname:'' + cardList2: [ + { + icon: sell, + title: '销售', + type: 1 + }, + { + icon: del, + title: '扫码作废', + type: 4 + } + ], + showModal: false, + modalTitle: '取用', + hazmat: {}, + product: {}, + hazmatBack: { + id: null, + remaining: '' + }, + rules: { + remaining: { + type: 'string', + required: true, + message: '归还剩余量不可为空', + trigger: ['blur', 'change'] + } + }, + tabNum: 1, + blockText: '原材料', + blockStyle: { + transform: 'translateX(0px)' + } } }, @@ -132,12 +179,6 @@ //获取手机状态栏高度 this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; // uni.hideTabBar(); - this.examList = [] - this.classParams.pageNum = 1 - this.examParams.pageNum = 1 - this.getSwiper() - this.getClass() - this.getExamList() }, onShow(){ // this.role = uni.getStorageSync('roleName'); @@ -148,63 +189,225 @@ created(){ uni.hideTabBar() }, + mounted() { + + }, methods: { - loginOut() { - uni.clearStorageSync(); - uni.clearStorage(); - uni.navigateTo({ - url: '/pages/index/index' - }) - }, - - changeExam(e) { - this.examParams.pageNum = 1 - this.getExamList() - }, - - async getSwiper(){ - const res = await getSwiperList() - if(res.code == 200){ - let list = res.data.list || [] - if(list.length>0){ - this.swiperList = list.map(i=>VUE_APP_BASE_URL + '/api/' + i.imgUrl) - } - }else{ - uni.$u.toast(res.message) - } - }, - - getClass(){ - getClassList(this.classParams).then(res => { - if(res.code == 200) { - if(res.data && res.data.list.length > 0){ - this.classList = res.data.list - }else { - this.classList = [] - } - }else{ - uni.$u.toast(res.message) - } - }) - }, - getExamList(){ - getExamList(this.examParams).then(res => { - if(res.code == 200) { - let list = res.data.list?res.data.list: []; - if (res.data.pageNum != 1) { - this.examList = this.examList.concat(list) - } else { - this.examList = res.data.list + scanCode(title){ + const t = this + t.modalTitle = title + uni.scanCode({ + autoZoom: false, + success: function (res) { + if(res && res.result){ + if(t.tabNum == 1){ + getHazmatByCode({code: res.result}).then((re)=>{ + if(re.code == 200){ + t.hazmat = re.data + t.showModal = true + }else{ + t.$refs.uToast.show({ + type: 'default', + message: re.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + }else{ + getProductByCode({code: res.result}).then((re)=>{ + if(re.code == 200){ + t.product = re.data + t.showModal = true + }else{ + t.$refs.uToast.show({ + type: 'default', + message: re.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + } + }else{ + t.$refs.uToast.show({ + type: 'default', + message: '该二维码已失效或不包含条码信息', + }) } - this.totalPage = res.data.totalPage - }else{ - uni.$u.toast(res.message) } }) }, - getImageUrl(logo) { - return logo ? VUE_APP_BASE_URL + '/api/' + logo : '/static/defaultCover.jpg'; + confirmTake(){ + const t = this + postHazmatUse(t.hazmat.id).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + t.showModal = false + }, + + confirmBack() { + const t = this + t.$refs.uForm.validate().then(res => { + t.hazmatBack.id = t.hazmat.id + t.hazmatBack.remaining = Number(t.hazmatBack.remaining) + postHazmatReturn(t.hazmatBack).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + t.showModal = false + t.hazmatBack.remaining = '' + }).catch(errors => { + uni.$u.toast('请完善必填信息') + }) + }, + + confirmCheck(){ + const t = this + postHazmatUsed(t.hazmat.id).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + t.showModal = false + }, + + confirmSell(){ + const t = this + postProductSold(t.product.id).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + t.showModal = false + }, + + confirmCancle(){ + const t = this + if(t.tabNum == 1){ + postHazmatDiscard(t.hazmat.id).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + }else{ + postProductDiscard(t.product.id).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + } + t.showModal = false + }, + + closeModal(){ + this.hazmat = {} + this.product = {} + this.hazmatBack={ + id: null, + remaining: '' + } + this.showModal = false + }, + + changeTab(num){ + this.tabNum = num + if(num == 1){ + this.blockStyle.transform = 'translateX(0px)' + this.blockText = '危化品' + }else{ + this.blockStyle.transform = 'translateX(calc(100% - 2px))' + this.blockText = '成品' + } + console.log(this.tabNum,'num') }, toStudy(item) { @@ -212,59 +415,6 @@ uni.navigateTo({ url: `/pages/tabBar/current/detail?bank=` + encodeURIComponent(JSON.stringify(item)) }) - }, - - toExam(item,type){ - if(type == 1 && !item.startTime && item.examPaper.limited == 1){ - uni.showModal({ - title: '提示', - content: '该考试限制时长为:' + item.examPaper.limitTime + '分钟,进入后开始计时,计时结束自动交卷,是否继续?', - success: function (res) { - if (res.confirm) { - uni.setStorageSync("prevPage", '/pages/tabBar/firstPage/firstPage'); - uni.navigateTo({ - url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) - }) - } else if (res.cancel) { - console.log('用户点击取消'); - } - } - }) - }else{ - uni.setStorageSync("prevPage", '/pages/tabBar/firstPage/firstPage'); - uni.navigateTo({ - url: `/pages/tabBar/firstPage/exam?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) - }) - } - }, - - secondsToHms(seconds) { - seconds = Number(seconds); - const h = Math.floor(seconds / 3600); - const m = Math.floor(seconds % 3600 / 60); - const s = Math.floor(seconds % 3600 % 60); - - const hDisplay = h > 0 ? String(h).padStart(2, '0') : '00'; - const mDisplay = m > 0 ? String(m).padStart(2, '0') : '00'; - const sDisplay = s > 0 ? String(s).padStart(2, '0') : '00'; - return `${hDisplay}:${mDisplay}:${sDisplay}`; - }, - - upper(e) { - // console.log(e) - }, - lower(e) { - //并且让页码+1,调用获取数据的方法获取第二页数据 - this.examParams.pageNum++ - //此处调用自己获取数据列表的方法 - if (this.examParams.pageNum > this.totalPage){ - uni.$u.toast('已加载全部数据') - return - } - this.getExamList() - }, - scrollView(e) { - // console.log(e) }, toCourses(){ @@ -278,7 +428,7 @@ </script> -<style lang="scss"> +<style lang="scss" scoped> .navBarBox .navBar { background-color:#fff; height: 50px; @@ -286,8 +436,7 @@ flex-direction: row; justify-content: center; align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); - + box-shadow: 0 3px 12px rgba(0,0,0,0.05); } .fix{ position: sticky; @@ -302,187 +451,107 @@ font-size: 16px; font-weight: 600; flex: 2; - margin-left: 45%; + text-align: center; } .statusBar{ background-color:lightgrey; } -.m-p-15{ - width: 100%; - box-sizing: border-box; - padding: 0 15px; +/deep/ .u-toast__content{ + white-space: pre-wrap !important; + word-break: break-all !important; + word-wrap: break-word !important; } -.card{ - width: 100%; - margin-bottom: 40rpx; +/deep/ .u-modal__content{ + display: flex; + flex-direction: column !important; + align-items: center; + text-align: left; - .card-t{ + &>view{ width: 100%; - padding: 0 6rpx; - box-sizing: border-box; + } +} +.switchPanel{ + width: 100%; + height: 84rpx; + position: relative; + border: 2px solid #fff; + box-sizing: border-box; + border-radius: 8px; + box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.05) inset !important; + + .switchBtns{ + width: 100%; + height: 80rpx; + position: absolute; + top: 0; + left: 0; display: flex; align-items: center; justify-content: space-between; - margin-bottom: 20rpx; + z-index: 99; - .card-t-l{ - font-size: 32rpx; - font-weight: bold; - } - .card-t-r{ - color: #999; - cursor: pointer; - } - /deep/ .uni-stat__select{ - display: flex; - flex: 0; - justify-content: right; - .uni-stat-box{ - display: flex; - - flex: 0; - justify-content: right; - .uni-select{ - width: 320rpx; - border-radius: 99px; - padding: 0 10px; - background: #fff; - - .uni-select__input-placeholder{ - color: #999; - } - } - } - + .btnItem{ + width: 50%; + height: 100%; + box-sizing: border-box; + text-align: center; + line-height: 80rpx; } } - .card-c{ - background: #fff; - border-radius: 20px; - padding: 15px; - - .card-i{ - padding-bottom: 15px; - margin-bottom: 15px; - border-bottom: 1px solid #f0f0f0; - position: relative; - display: flex; - align-items: flex-start; - box-sizing: border-box; - - &:last-of-type{ - margin-bottom: 0; - padding-bottom: 0; - border-bottom: none; - } - .card-i-t{ - position: absolute; - width: 250rpx; - height: 30px; - border-radius: 8rpx; - line-height: 30px; - color: #fff; - padding: 0 10rpx; - box-sizing: border-box; - left: 0; - bottom: 0; - background: rgba(0,0,0,.4); - } - .card-i-r{ - width: 100%; - height: 200rpx; - margin-left: 20rpx; - display: flex; - flex-direction: column; - justify-content: space-between; - .card-i-r-t{ - view{ - font-size: 32rpx; - margin-bottom: 10rpx; - font-family: "PingFang SC"; - font-weight: 800; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - } - } - .card-i-r-b{ - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; - - .study-button{ - width: 220rpx; - margin: 0; - box-shadow: 3px 3px 12px rgba(51,133,217,.3), -2px -2px 6px #fff; - border: 1px solid rgba(255,255,255,.8); - } - } - } - } - } - .card-d{ - background: none; - padding: 0 0 15px; - .paper-card{ - background: #fff; - margin-bottom: 15px; - padding: 15px; - box-sizing: border-box; - position: relative; - border-radius: 20px; - - &:last-of-type{ - margin-bottom: 0; - } - - .paper-card-t{ - font-size: 32rpx; - margin-bottom: 10rpx; - font-family: "PingFang SC"; - font-weight: 800; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - .blue{ - font-size: 28rpx; - color: #0f7ff9 - } - - .green{ - font-size: 28rpx; - color: #5ac725 - } - .red{ - font-size: 28rpx; - color: #f56c6c - } - } - - .paper-card-b{ - display: flex; - align-items: flex-end; - justify-content: space-between; - - .exam-button{ - width: 220rpx; - margin: 0; - box-shadow: 3px 3px 12px rgba(51,133,217,.3), -2px -2px 6px #fff; - border: 1px solid rgba(255,255,255,.8); - } - } - } + .colBlock{ + position: absolute; + top: 5rpx; + left: 0; + z-index: 999; + width: 50%; + height: 70rpx; + border-radius: 8px; + background: rgb(0,172,238); + background: linear-gradient(0deg, rgba(0,172,238,1) 0%, rgba(2,126,251,1) 100%); + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important; + transition: .4s; + text-align: center; + line-height: 70rpx; + color: #fff; + font-weight: bold; + letter-spacing: 2px; + border: 2rpx solid #fff; } } +.cardList{ + width: 100%; + box-sizing: border-box; + padding: 0 15px; + margin-top: 20px; + display: flex; + flex-direction: column; + align-items: center; + flex-wrap: wrap; -.badge span{ - text-align: center; - width: 100%; + .cardItem{ + width: 100%; + padding: 15px 30px; + box-sizing: border-box; + margin-bottom: 15px; + background: #fff; + border-radius: 40rpx; + display: flex; + align-items: center; + box-shadow: 0 10rpx 20rpx rgba(0,0,0,.05); + transition: box-shadow .15s ease !important; + + &:active{ + box-shadow: none; + } + + .cardTit{ + font-size: 36rpx; + font-weight: bold; + margin-left: 30px; + } + } } </style> \ No newline at end of file diff --git a/pages/tabBar/tabBarIndex.vue b/pages/tabBar/tabBarIndex.vue index fba257b..ea10807 100644 --- a/pages/tabBar/tabBarIndex.vue +++ b/pages/tabBar/tabBarIndex.vue @@ -65,8 +65,13 @@ border-radius: 99px; overflow: hidden; box-shadow: 0 -6px 10px rgba(150, 150, 150, 0.1), 0 6px 10px rgba(150, 150, 150, 0.1); - backdrop-filter: blur(10px); - -webkit-backdrop-filter: blur(10px); + + /deep/ .u-tabbar__content{ + background-color: rgba(255,255,255,.4); + backdrop-filter: blur(5px); + -webkit-backdrop-filter: blur(5px); + border: 1px solid rgba(255,255,255,.8); + } /deep/ .u-tabbar .u-border-top{ border-color: rgba(0,0,0,0) !important; diff --git a/pages/tabBar/utils/tabBar.js b/pages/tabBar/utils/tabBar.js index 194fc09..8e81cca 100644 --- a/pages/tabBar/utils/tabBar.js +++ b/pages/tabBar/utils/tabBar.js @@ -9,13 +9,7 @@ "pagePath": "pages/tabBar/current/current", "iconPath": "/static/notice.png", "selectedIconPath": "/static/notice-sel.png", - "text": "课程" - }, - { - "pagePath": "pages/tabBar/wearhouse/wearhouse", - "iconPath": "/static/wearhouse.png", - "selectedIconPath": "/static/wearhouse_sel.png", - "text": "刷题" + "text": "记录查询" }, { "pagePath": "pages/tabBar/count/count", @@ -27,10 +21,28 @@ const user_other = [ { + "pagePath": "pages/tabBar/notice/notice", + "iconPath": "/static/notice.png", + "selectedIconPath": "/static/notice-sel.png", + "text": "工作通知" + }, + { + "pagePath": "pages/tabBar/response/response", + "iconPath": "/static/mine1.png", + "selectedIconPath": "/static/mine1-selected.png", + "text": "我的叫应" + }, + { "pagePath": "pages/tabBar/current/current", "iconPath": "/static/send.png", "selectedIconPath": "/static/send_selected.png", "text": "我发布的" + }, + { + "pagePath": "pages/tabBar/information/information", + "iconPath": "/static/send.png", + "selectedIconPath": "/static/send_selected.png", + "text": "信息发布" } ] diff --git a/pages/tabBar/wearhouse/questions.vue b/pages/tabBar/wearhouse/questions.vue deleted file mode 100644 index c2be645..0000000 --- a/pages/tabBar/wearhouse/questions.vue +++ /dev/null @@ -1,689 +0,0 @@ -<template> - <view style="display: flex;flex-direction: column;height: 100%;"> - <!-- 自定义导航栏 --> - <view class="navBarBox"> - <!-- 状态栏占位 --> - <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> - <!-- 真正的导航栏内容 --> - <view style="display: flex; flex-direction: column;"> - <view class="navBar"> - <u-icon name="arrow-left" color="black" size="17" style="margin-left: 8px;" @click="goBack"/> - <view class="barText">题目内容</view> - <!-- <view > - <u-button type="text" @click="loginOut" style="color: blue;margin-right: 5px;">退出</u-button> - </view> --> - </view> - </view> - </view> - <view class="m-p-15" v-if="idList && idList.length>0"> - <view class="top"> - <view class="ind">{{'第 ' + (curTotalIndex+1) + ' 题'}}</view> - <view v-if="type == 1 || type == 2" class="panelBtn" @click="openPanel">答题卡</view> - </view> - <view class="questions"> - <view class="title"> - <span>【{{currentQ.questionType == 1?'单选题':currentQ.questionType == 2?'多选题':currentQ.questionType == 3?'判断题':'简答题'}}】</span> - {{currentQ.title}} - </view> - <view class="content"> - <u-checkbox-group - v-if="(type == 1 || type == 2)&& currentQ.questionType==2" - v-model="currentB" - placement="column" - iconPlacement="right" - @change="checkboxChange" - class="myRadio" - > - <u-checkbox - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - :class="{'picked': currentB.includes(item.prefix)}" - > - </u-checkbox> - </u-checkbox-group> - - <u-checkbox-group - v-if="type == 3 && currentQ.questionType==2" - v-model="currentB" - placement="column" - iconPlacement="right" - @change="checkboxChange" - disabled - class="myRadio" - > - <u-checkbox - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - :class="{'picked': currentQ.answer.includes(item.prefix),'wronged': currentB.includes(item.prefix) && !currentQ.answer.includes(item.prefix)}" - > - </u-checkbox> - </u-checkbox-group> - - <u-radio-group v-model="currentA" class="myRadio" iconPlacement="right" placement="column" @change="groupChange" v-if="(type == 1 || type == 2)&&(currentQ.questionType==1||currentQ.questionType==3)"> - <u-radio - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - shape="square" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - @change="radioChange" - :class="{'picked': currentA == item.prefix}" - > - </u-radio> - </u-radio-group> - - <u-radio-group v-model="currentA" class="myRadio" iconPlacement="right" placement="column" @change="groupChange" v-if="type == 3 && (currentQ.questionType==1||currentQ.questionType==3)" disabled> - <u-radio - :customStyle="{marginBottom: '15px'}" - v-for="(item, index) in currentQ.content.items" - :key="index" - shape="square" - :label="item.prefix +':'+ item.content" - :name="item.prefix" - @change="radioChange" - :class="{'picked': currentQ.answer == item.prefix, 'wronged': currentA == item.prefix && currentA != currentQ.answer}" - > - </u-radio> - </u-radio-group> - - <u--textarea v-model="currentA" v-if="(type == 1 || type == 2)&&(currentQ.questionType==4)" style="margin-bottom: 15px" :maxlength="-1" placeholder="请输入答案" autoHeight @focus="openAnswer"></u--textarea> - <u--textarea v-model="currentA" v-if="type == 3&&(currentQ.questionType==4)" :class="currentQ.answer == currentA?'pickedText':'wrongText'" style="margin-bottom: 15px" :maxlength="-1" placeholder="请输入答案" autoHeight disabled></u--textarea> - - <u-button style="width: 80%;margin: 5px auto 15px" - v-if="currentQ.questionType==2 && currentB.length>0 && type !== 3" - type="primary" shape="circle" text="确认答案" @click="confirmAnswer(2)"></u-button> - <view class="answers" v-if="currentA !==''||currentB.length>0"> - <view>你的答案: - <span v-if="currentQ.questionType==2" :class="currentQ.answer == currentB.join(',')?'right':'wrong'">{{currentB.join(',')}}</span> - <span v-else :class="currentQ.answer == currentA?'right':'wrong'">{{currentA}}</span> - </view> - <view>正确答案:<span class="right">{{currentQ.answer}}</span></view> - </view> - </view> - </view> - </view> - <view class="btns" v-if="idList && idList.length>0"> - <u-button style="width: 30%" type="error" shape="circle" size="small" text="上一题" @click="prevQ"></u-button> -<!-- <u-button style="width: 30%" type="error" shape="circle" plain size="small" text="查看答案" @click="showA"></u-button>--> - <u-button v-if="curTotalIndex < idList.length - 1" style="width: 30%" type="error" shape="circle" size="small" text="下一题" @click="nextQ"></u-button> - <u-button v-if="curTotalIndex == idList.length - 1" style="width: 30%" type="primary" shape="circle" size="small" text="退出" @click="goBack"></u-button> - </view> - <view v-else> - <u-empty - mode="list" - icon="http://cdn.uviewui.com/uview/empty/list.png" - > - </u-empty> - </view> - <u-popup :show="showPanel" :round="40" mode="bottom" @close="close" @open="open"> - <view class="panel"> - <view :class="item.passed==1?'right-a':item.passed==0?'wrong-a':''" v-for="(item,index) in idList" @click="toQuestion(item,index)"> - {{index + 1}} - </view> - </view> - </u-popup> - <u-popup :show="showInput" :round="40" mode="bottom" @close="closeInput" @open="openInput"> - <view class="panelTwo"> - <u--textarea v-model="currentA" :maxlength="-1" placeholder="请输入答案"></u--textarea> - <u-button shape="circle" type="primary" style="width: 80%;margin-top: 20px" text="确认答案" @click="confirmAnswer(1)"></u-button> - </view> - </u-popup> - </view> -</template> - -<script> -import {getQuestionIdList,getQuestionByIds,postExerciseAnswer,getErrorsIdList} from '../../../api/wearhouse.js' - -export default { - components: { - - }, - data() { - return { - statusBarHeight: 0, - bank: {}, - idList: [], - questionList: [], - curTotalIndex: 0, - currentId: null, - currentQ: {}, - currentA: '', - currentB: [], - type: '', - showPanel: false, - showInput: false - } - }, - onReady(){ - }, - onLoad(e) { - this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'] - this.bank = e.bank && JSON.parse(decodeURIComponent(e.bank)) - this.type = e.type && JSON.parse(decodeURIComponent(e.type)) - if(this.type == '1' || this.type == '2'){ - this.getQuestionIds(this.bank.id) - }else{ - this.getErrorIds(this.bank.id) - } - }, - onShow(){ - - }, - mounted() { - - }, - computed: { - - }, - beforeUnmount() { - - }, - - beforeDestroy() { - - }, - - methods: { - async openPanel(){ - const t = this - t.showPanel = true - const res = await getQuestionIdList({bankId: t.bank.id}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // t.idList = list.sort((a, b) => a.id - b.id) - this.idList = list - }else{ - t.idList = [] - uni.showToast({ - title: '本题库暂无题目', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - openAnswer(){ - const t = this - t.showInput = true - }, - async toQuestion(item,index){ - this.curTotalIndex = index - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.currentId = this.idList[this.curTotalIndex].id - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - this.showPanel = false - }, - - open() { - // console.log('open'); - }, - close() { - this.showPanel = false - // console.log('close'); - }, - openInput() { - // console.log('open'); - }, - closeInput(){ - this.showInput = false - }, - async getQuestionIds(id){ - const res = await getQuestionIdList({bankId: id}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // this.idList = list.sort((a, b) => a.id - b.id) - this.idList = list - this.curTotalIndex = this.bank.questionId ? this.idList.findIndex(i=>i.id == this.bank.questionId):0 - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.currentId = this.idList[this.curTotalIndex].id - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - }else{ - this.idList = [] - uni.showToast({ - title: '本题库暂无题目', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - - async getErrorIds(id){ - const res = await getErrorsIdList({bankId: id}) - if(res.code == 200){ - let list = res.data || [] - if(list.length>0){ - // this.idList = list.sort((a, b) => a - b) - this.idList = list - this.curTotalIndex = 0 - const curIdList = this.idList.slice(0,20) - this.currentId = this.idList[0] - await this.getQuestionsByIds(curIdList) - this.currentQ = this.questionList.find(i=>i.id == this.currentId) - this.showAnswer() - }else{ - this.idList = [] - uni.showToast({ - title: '本题库暂无错题', - duration: 1000 - }); - } - }else{ - uni.$u.toast(res.message) - } - }, - - async getQuestionsByIds(idList){ - let list = [] - if(this.type == 3){ - list = idList - }else{ - list = idList.map(i=>i.id) - } - const res = await getQuestionByIds({questionIds: list}) - if(res.code == 200){ - this.questionList = res.data.map(i=>{ - i.content = JSON.parse(i.content) - return i - }) - }else{ - uni.$u.toast(res.message) - } - }, - - checkboxChange(n) { - console.log('change', n); - }, - groupChange(n) { - if(this.currentA !== ''){ - this.confirmAnswer(1) - } - }, - radioChange(n) { - console.log('radioChange', n); - }, - - confirmAnswer(type){ - if(type == 1 && this.currentA == ''){ - uni.$u.toast('答案为空,请先作答') - return - } - const data = { - answer: this.currentQ.questionType==2?this.currentB.join(','):this.currentA, - bankId: this.bank.id, - questionId: this.currentQ.id - } - postExerciseAnswer(data).then(res=>{ - if(res.code == 200){ - this.currentQ.exExerciseAnswer.passed = res.data.passed - this.currentQ.exExerciseAnswer.answer = res.data.answer - if(type == 2){ - this.nextQ() - } - if(this.showInput == true){ - this.showInput = false - } - // uni.$u.toast('答案已提交') - }else{ - uni.$u.toast(res.message) - } - }) - }, - - prevQ(){ - if(this.curTotalIndex - 1>=0){ - this.curTotalIndex-- - // if(this.curTotalIndex == 0){ - // this.getQuestionsByIds([this.idList[0]]).then(()=>{ - // this.currentQ = this.questionList[this.questionList.length-1] - // // this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - // this.showAnswer() - // }) - // }else{ - if(this.type == 3){ - this.currentId = this.idList[this.curTotalIndex] - }else{ - this.currentId = this.idList[this.curTotalIndex].id - } - if(this.questionList.find(i=>i.id == this.currentId)){ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }else{ - const startIndex = Math.max(0, this.curTotalIndex - 19); - const curIdList = this.idList.slice(startIndex, this.curTotalIndex+1); - this.getQuestionsByIds(curIdList).then(()=>{ - // this.currentQ = this.questionList[this.questionList.length-1] - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }) - } - // } - }else{ - uni.showToast({ - title: '已经是第一题了', - duration: 1000 - }); - } - }, - - nextQ(){ - if(this.curTotalIndex + 1<this.idList.length){ - this.curTotalIndex++ - if(this.type == 3){ - this.currentId = this.idList[this.curTotalIndex] - }else{ - this.currentId = this.idList[this.curTotalIndex].id - } - if(this.questionList.find(i=>i.id == this.currentId)){ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - this.showAnswer() - }else{ - const curIdList = this.idList.slice(this.curTotalIndex,this.curTotalIndex + 20) - this.getQuestionsByIds(curIdList).then(()=>{ - this.$set(this, 'currentQ', this.questionList.find(i=>i.id == this.currentId)) - // this.currentQ = this.questionList[0] - this.showAnswer() - }) - } - }else{ - uni.showToast({ - title: '已经是最后一题了', - duration: 1000 - }); - } - }, - - showAnswer(){ - if(this.currentQ.exExerciseAnswer && this.currentQ.exExerciseAnswer.answer){ - if(this.currentQ.questionType == 2){ - this.currentB = this.currentQ.exExerciseAnswer.answer.split(',') - }else{ - this.currentA = this.currentQ.exExerciseAnswer.answer - } - }else{ - this.currentB = [] - this.currentA = '' - } - }, - - showA(){ - uni.showModal({ - title: '正确答案', - content: this.currentQ.answer, - showCancel: false, - success: function (res) { - if (res.confirm) { - console.log('用户点击确定'); - } - } - }); - }, - - goBack(){ - const url = uni.getStorageSync("prevPage"); - if(url){ - if(url == '/pages/tabBar/wearhouse/wearhouse'){ - uni.reLaunch({ - url:'/pages/tabBar/wearhouse/wearhouse' - }); - }else{ - uni.navigateTo({ - url: url - }) - } - } else{ - uni.reLaunch({ - url: '/pages/tabBar/wearhouse/wearhouse' - }) - } - } - } -}; -</script> - -<style lang="scss" scoped> -.navBarBox .navBar { - background-color:#fff; - height: 50px; - display: flex; - flex-direction: row; - justify-content: space-around; - align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); -} -.barText{ - margin-left: -20px; - flex: 1; - /* margin-left: 20px; */ - text-align: center; - width: 85%; - font-size: 16px; - /* text-align: center; */ - font-weight: 600; -} -.navBarBox .navBar .logo { - width: 82rpx; - height: 82rpx; - margin-right: 10rpx; -} - -.panel{ - height: 60vh; - background: #f2f2f2; - overflow-y: auto; - padding: 15px; - box-sizing: border-box; - display: grid; - grid-template-columns: repeat(5, 1fr); - gap: 15px; - grid-auto-rows: min-content; - - &>view{ - padding: 5px; - box-sizing: border-box; - min-width: 33px; - border-radius: 4px; - text-align: center; - background: rgba(41,121,255,0); - border: 1px solid #fff; - color: #333; - background: #f2f2f2; - transition: all 100ms cubic-bezier(0.175, 0.885, 0.32, 1.275); - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - cursor: pointer; - - &:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); - &:after { - box-shadow: inset 0px -2px 5px rgb(255, 255, 255), - inset 0px 2px 5px rgba(0, 0, 0, 0.15); - } - } - - } - - .right-a{ - background: rgba(41,121,255,.1); - border: 1px solid #2979ff; - color: #2979ff; - } - - .wrong-a{ - background: rgba(237,100,100,.1); - border: 1px solid #ed6464; - color: #ed6464; - } -} - -.panelTwo{ - height: 60vh; - background: #f2f2f2; - padding: 15px; - box-sizing: border-box; - - /deep/ .u-textarea__field{ - height: calc(60vh - 110px) !important; - } -} - -.m-p-15{ - width: 100%; - padding: 0 15px; - box-sizing: border-box; - - .top{ - display: flex; - align-items: center; - justify-content: space-between; - margin: 20px 0; - - .ind{ - font-size: 18px; - font-weight: bold; - color: #2979ff; - } - - .panelBtn{ - width: 25%; - margin: 0; - text-align: center; - padding: 4px 0; - border-radius: 4px; - color: #2979ff; - background: #f5f7fa; - border: 1px solid rgba(41,121,255,.2); - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - transition: box-shadow .25s ease !important; - } - .panelBtn:active{ - background: #f5f7fa; - border: 1px solid rgba(41,121,255,1); - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); - } - } - .questions{ - width: 100%; - margin-top: 40px; - .title{ - font-size: 16px; - margin-bottom: 20px; - } - .content{ - padding-left: 10rpx; - - .pickedText{ - border: 1.5px solid #2979ff !important; - } - .wrongText{ - border: 1.5px solid #ed6464 !important; - } - - /deep/ .u-textarea__field{ - min-height: 80px; - } - - .answers{ - background: #ecf5ff; - padding: 10px; - - &>view{ - margin-bottom: 5px; - } - - span{ - width: 100%; - display: block; - white-space: pre-wrap; - font-weight: bolder; - word-break: break-word; - } - .right{ - color: #3c9cff - } - .wrong{ - color: #e45656 - } - } - } - } -} -.btns{ - width: 100%; - position: fixed; - display: flex; - align-items: center; - justify-content: space-around; - z-index: 99; - bottom: 20px; - left: 0; -} - -/deep/ .u-checkbox{ - background: #fff; - padding: 10px; - box-sizing: border-box; - border-radius: 8px; -} - -/deep/ .u-radio,.u-checkbox{ - padding: 12px 10px; - box-sizing: border-box; - border-radius: 8px; - background: #f5f7fa; - border: 1.5px solid #fff; - box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1); - transition: box-shadow .25s ease,box-width .25s ease !important; -} - -.myRadio{ - /deep/ .picked{ - border: 1.5px solid #2979ff; - - .u-radio__icon-wrap,.u-checkbox__icon-wrap{ - border-color: #fff !important; - span{ - color: #fff !important; - } - } - span{ - color: #2979ff - } - } - /deep/ .wronged{ - border: 1.5px solid #ed6464; - - .u-radio__icon-wrap,.u-checkbox__icon-wrap{ - border-color: #fff !important; - span{ - color: #fff !important; - } - } - span{ - color: #ed6464 - } - } -} - -/deep/ .u-checkbox:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); -} - -/deep/ .u-radio:active { - box-shadow: 0 15px 20px rgba(0, 0, 0, 0.02); -} -</style> \ No newline at end of file diff --git a/pages/tabBar/wearhouse/wearhouse.vue b/pages/tabBar/wearhouse/wearhouse.vue deleted file mode 100644 index 1606c59..0000000 --- a/pages/tabBar/wearhouse/wearhouse.vue +++ /dev/null @@ -1,270 +0,0 @@ -<template> - <view class="box"> - <!-- 自定义导航栏 --> - <view class="navBarBox fix"> - <!-- 状态栏占位 --> - <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> - <!-- 真正的导航栏内容 --> - <view class="navBar"> -<!-- <u-icon style=" margin-left: 13px;" name="arrow-left" color="black" size="17" @click="goBack"/>--> - <view class="barText">刷题</view> -<!-- <view >--> -<!-- <u-button type="text" @click="loginOut" style="color: #1890ff;margin-right: 5px;width: 65px;">退出</u-button>--> -<!-- </view>--> - </view> - </view> - <!-- 页面内容 --> - <view class="m-p-15"> - <view class="cardList"> - <scroll-view scroll-y="true" class="scroll-Y" @scrolltoupper="upper" - @scrolltolower="lower" lower-threshold="150" @scroll="scrollView" style="height:100%"> - <view style="padding: 20px 0 20px"> - <view class="card-i" v-for="(item,index) in quizList" :key="index"> - <view class="card-i-l"> - <view>{{item.name}}</view> - <span style="display:block;color: #999;font-size: 12px;margin-bottom: 20px;">已刷{{item.exerciseCount}}/{{item.totalCount}}</span> - <span style="display:flex;align-items: center;color: #999;font-size: 12px;"><u-icon name="clock" color="#999" size="18" style="margin-bottom: 0;margin-right: 2px"></u-icon>{{item.createTime}}</span> - </view> - <view class="card-i-r"> - <u-button v-if="item.exerciseCount == 0" class="study-button" type="success" text="开始刷题" shape="circle" size="small" @click="getQuestionIds(item,1)"></u-button> - <u-button v-if="item.exerciseCount > 0" class="study-button" type="success" text="继续刷题" shape="circle" size="small" @click="getQuestionIds(item,2)"></u-button> - <u-button class="study-button" type="error" text="查看错题" shape="circle" size="small" @click="getQuestionIds(item,3)"></u-button> - <u-button class="study-button" text="重置" shape="circle" size="small" @click="reSet(item.id)"></u-button> - </view> - </view> - </view> - </scroll-view> - </view> - </view> - <tabBar :currentPagePath="page"></tabBar> - </view> -</template> - -<script> - import tabBar from '../tabBarIndex.vue' - import {getQuizHouse,getCleanRecord} from '../../../api/wearhouse.js' - import tebBar from '../tabBarIndex.vue' - import VUE_APP_BASE_URL from "../../../common/constant"; - export default { - components:{ - tabBar - }, - data() { - return { - page: 'pages/tabBar/wearhouse/wearhouse', - statusBarHeight: 0, - classParams: { - pageNum: 1, - pageSize: 10, - }, - quizList: [], - totalPage: 0, - } - }, - onLoad() { - // this.unitType = uni.getStorageSync('unittype') + 1; - //获取手机状态栏高度 - this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; - this.classParams.pageNum = 1 - this.getQuizList() - }, - onShow() { - // this.role = uni.getStorageSync('roleName'); - }, - created(){ - uni.hideTabBar() - }, - mounted(){ - - }, - methods: { - loginOut() { - uni.clearStorageSync(); - uni.clearStorage(); - uni.navigateTo({ - url: '/pages/index/index' - }) - }, - goBack() { - uni.switchTab({ - url:'/pages/tabBar/firstPage/firstPage' - }); - }, - - getQuizList(){ - const t = this - getQuizHouse(t.classParams).then(res => { - if(res.code == 200) { - let list = res.data.list?res.data.list: []; - if (res.data.pageNum != 1) { - t.quizList = t.quizList.concat(list) - } else { - t.quizList = list - } - t.totalPage = res.data.totalPage - }else{ - uni.$u.toast(res.message) - } - }) - }, - - async getQuestionIds(item,type){ - if(item.totalCount == 0){ - uni.showToast({ - title: '该题库暂无题目', - duration: 1000 - }); - return - } - // if(type == 2 && item.totalCount == item.exerciseCount){ - // uni.showToast({ - // title: '该题库所有题目已刷完', - // duration: 1000 - // }); - // return - // } - uni.setStorageSync("prevPage", '/pages/tabBar/wearhouse/wearhouse'); - uni.navigateTo({ - url: `/pages/tabBar/wearhouse/questions?bank=` + encodeURIComponent(JSON.stringify(item)) + `&type=` + encodeURIComponent(JSON.stringify(type)) - }) - }, - - reSet(id){ - const t = this - uni.showModal({ - title: '提示', - content: '是否重置所选题库的刷题记录?', - success: async function (res) { - if (res.confirm) { - const res = await getCleanRecord({bankId: id}) - if(res.code == 200){ - uni.showToast({ - title: '刷题记录已重置', - duration: 1000 - }); - // t.classParams.pageNum = 1 - // t.getQuizList() - uni.reLaunch({ - url: '/pages/tabBar/wearhouse/wearhouse' - }) - }else{ - uni.showToast({ - title: '记录重置失败,请稍后再试', - duration: 1000 - }); - } - } else if (res.cancel) { - console.log('用户点击取消'); - } - } - }) - }, - upper(e) { - // console.log(e) - }, - lower(e) { - //并且让页码+1,调用获取数据的方法获取第二页数据 - this.classParams.pageNum++ - //此处调用自己获取数据列表的方法 - if (this.classParams.pageNum > this.totalPage){ - uni.$u.toast('已加载全部数据') - return - } - this.getQuizList() - }, - scrollView(e) { - // console.log(e) - } - } - } - -</script> - -<style lang="scss" scoped> -.navBarBox .navBar { - background-color:#fff; - height: 50px; - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - box-shadow: 0 3px 12px rgba(0,0,0,0.05); - -} -.fix{ - position: sticky; - top: 0; - left: 0; - right: 0; - width: 100%; - z-index: 1; -} -.barText{ - /* text-align: center; */ - font-size: 16px; - font-weight: 600; - flex: 2; - margin-left: 45%; -} -.statusBar{ - background-color:lightgrey; -} - -.m-p-15{ - width: 100%; -} -.cardList{ - width: 100%; - height: calc(100vh - 130px); - box-sizing: border-box; - - .card-i{ - width: calc(100% - 30px); - background: #fff; - border-radius: 20px; - padding: 15px; - margin: 0 auto 15px; - position: relative; - display: flex; - align-items: flex-start; - box-sizing: border-box; - box-shadow: 4px 4px 12px rgba(150,150,150,.05); - - &:last-of-type{ - margin-bottom: 0; - } - - .card-i-l{ - width: 75%; - &>view{ - width: 100%; - font-size: 32rpx; - font-family: "PingFang SC"; - font-weight: 800; - margin-bottom: 10rpx; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - } - } - .card-i-r{ - width: 25%; - height: 100%; - display: flex; - flex-direction: column; - justify-content: space-between; - .study-button{ - width: 100%; - margin-bottom: 10rpx; - - &:last-of-type{ - margin-bottom: 0; - } - } - } - } -} - -</style> \ No newline at end of file diff --git a/static/bg.jpeg b/static/bg.jpeg deleted file mode 100644 index 2d698e6..0000000 --- a/static/bg.jpeg +++ /dev/null Binary files differ diff --git a/static/check.png b/static/check.png new file mode 100644 index 0000000..d7ca7ea --- /dev/null +++ b/static/check.png Binary files differ diff --git a/static/companyLogo.png b/static/companyLogo.png new file mode 100644 index 0000000..b01a93a --- /dev/null +++ b/static/companyLogo.png Binary files differ diff --git a/static/defaultCover.jpg b/static/defaultCover.jpg deleted file mode 100644 index a0d2154..0000000 --- a/static/defaultCover.jpg +++ /dev/null Binary files differ diff --git a/static/delete.png b/static/delete.png new file mode 100644 index 0000000..3787959 --- /dev/null +++ b/static/delete.png Binary files differ diff --git a/static/examine.png b/static/examine.png deleted file mode 100644 index 6f45ca5..0000000 --- a/static/examine.png +++ /dev/null Binary files differ diff --git a/static/info.png b/static/info.png deleted file mode 100644 index 1809549..0000000 --- a/static/info.png +++ /dev/null Binary files differ diff --git a/static/loginTop1.png b/static/loginTop1.png index 73cc538..6ccff42 100644 --- a/static/loginTop1.png +++ b/static/loginTop1.png Binary files differ diff --git a/static/mine1-selected.png b/static/mine1-selected.png deleted file mode 100644 index 9926047..0000000 --- a/static/mine1-selected.png +++ /dev/null Binary files differ diff --git a/static/mine1.png b/static/mine1.png deleted file mode 100644 index c35f7dc..0000000 --- a/static/mine1.png +++ /dev/null Binary files differ diff --git a/static/my-bg.jpg b/static/my-bg.jpg new file mode 100644 index 0000000..6eba343 --- /dev/null +++ b/static/my-bg.jpg Binary files differ diff --git a/static/my-bg.png b/static/my-bg.png deleted file mode 100644 index 1861734..0000000 --- a/static/my-bg.png +++ /dev/null Binary files differ diff --git a/static/pic.png b/static/pic.png deleted file mode 100644 index e1d2c34..0000000 --- a/static/pic.png +++ /dev/null Binary files differ diff --git a/static/return.png b/static/return.png new file mode 100644 index 0000000..c9bf4b6 --- /dev/null +++ b/static/return.png Binary files differ diff --git a/static/sell.png b/static/sell.png new file mode 100644 index 0000000..923c0e6 --- /dev/null +++ b/static/sell.png Binary files differ diff --git a/static/send.png b/static/send.png deleted file mode 100644 index a825cd9..0000000 --- a/static/send.png +++ /dev/null Binary files differ diff --git a/static/send_selected.png b/static/send_selected.png deleted file mode 100644 index b46d9c3..0000000 --- a/static/send_selected.png +++ /dev/null Binary files differ diff --git a/static/take.png b/static/take.png new file mode 100644 index 0000000..92a9f3e --- /dev/null +++ b/static/take.png Binary files differ diff --git a/static/wearhouse.png b/static/wearhouse.png deleted file mode 100644 index f9473ed..0000000 --- a/static/wearhouse.png +++ /dev/null Binary files differ diff --git a/static/wearhouse_sel.png b/static/wearhouse_sel.png deleted file mode 100644 index db1c8a8..0000000 --- a/static/wearhouse_sel.png +++ /dev/null Binary files differ -- Gitblit v1.9.2