courseQRcode.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <!-- 课程-扫码 -->
  2. <template>
  3. <view class="course">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="basics">
  6. <view class="basics_li">
  7. <view class="basics_li_l">课程名称:</view>
  8. <view class="basics_li_r"><text>{{infoData.courseName}}</text></view>
  9. </view>
  10. <view class="basics_li">
  11. <view class="basics_li_l">主讲老师:</view>
  12. <view class="basics_li_r">{{infoData.lecturerName}}</view>
  13. </view>
  14. <view class="basics_li">
  15. <view class="basics_li_l">上课日期:</view>
  16. <view class="basics_li_r">{{infoData.coStartDate}}</view>
  17. </view>
  18. <view class="basics_li">
  19. <view class="basics_li_l">上课时间:</view>
  20. <view class="basics_li_r">{{infoData.coStartTime}}-{{infoData.coEndTime}}</view>
  21. </view>
  22. <view class="basics_li">
  23. <view class="basics_li_l">上课地点:</view>
  24. <view class="basics_li_r">{{(infoData.subId && infoData.subId !=-1)?infoData.subName+'-'+infoData.subRoom:infoData.position}}</view>
  25. </view>
  26. <view class="basics_li" style="border: none;">
  27. <view class="basics_li_l">课程内容:</view>
  28. <view class="basics_li_r2"><text>{{infoData.content?infoData.content:''}}</text></view>
  29. </view>
  30. </view>
  31. <view class="statistics">
  32. <view class="statistics_li">
  33. <text>预约人数:</text>
  34. <text>{{infoData.peopleCount}}人</text>
  35. </view>
  36. <view class="statistics_li" style="background: #0183FA;">
  37. <text>签到人数:</text>
  38. <text>{{signPeople}}人</text>
  39. </view>
  40. </view>
  41. </scroll-view>
  42. <!-- 遮罩 -->
  43. <view class="shade" v-if="dialogVisible">
  44. <view class="null-box" @click="dialogOutfire()"></view>
  45. <view class="shade_n" v-if="shadeStatus==0">
  46. <view class="shade_n_t" v-if="isCourse"><text>是否确认签到</text></view>
  47. <view class="shade_n_t" v-if="!isCourse"><img src="@/pages/images/icon_kcxq_ts.png"><text>您不在当前课程名单中,是否确定签到</text></view>
  48. <view class="shade_n_b">
  49. <text @click="dialogOutfire()">取消</text>
  50. <text @click="handleClick('signSubmit')">确认</text>
  51. </view>
  52. </view>
  53. <view class="shade_n_tow" v-if="shadeStatus==1">
  54. <view class="shade_n_tow_t" v-if="isSucceed"><img src="@/pages/images/icon_kcxq_cg.png"><text>签到成功</text></view>
  55. <view class="shade_n_tow_t" v-if="!isSucceed"><img src="@/pages/images/icon_kcxq_sb.png"><text>签到失败</text></view>
  56. <view class="shade_n_tow_b" @click="dialogOutfire()">确认</view>
  57. </view>
  58. </view>
  59. <view class="btn">
  60. <view class="btn_l" @click="handleClick('cancel')">取消</view>
  61. <view v-if="isSign" class="forbidden">签到</view>
  62. <view v-if="!isSign" class="btn_r" @click="handleClick('sign')">签到</view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import { config } from '@/api/request/config.js'
  68. import {courseQRcodeDetail,courseQRcodeSignCount,courseQRcodeIsSign,courseQRcodeIsPlanSign,courseQRcodeSign} from '@/api/apiDemo/index.js'
  69. export default {
  70. name: "rectifyList",
  71. components: {
  72. },
  73. data() {
  74. return {
  75. baseUrl:config.base_url,
  76. pageType:0,
  77. form:{
  78. },
  79. infoData:{},
  80. dialogVisible:false,
  81. isSign:false,//是否签到
  82. isCourse:false,//是否在当前课程名单中
  83. isSucceed:false,//签到成功失败
  84. shadeStatus:0,//遮罩层状态 0是否确认签到 1签到成功或失败
  85. courseId:'',//课程id
  86. signPeople:0,//签到人数
  87. userId:uni.getStorageSync('userId'),//用户id
  88. }
  89. },
  90. onLoad(option) {
  91. this.courseId=option.code;
  92. },
  93. onShow() {
  94. wx.hideHomeButton()
  95. },
  96. mounted(){
  97. this.courseQRcodeIsSign();//是否签到
  98. this.courseQRcodeIsPlanSign();//是否计划内签到
  99. this.courseQRcodeSignCount();//签到人数
  100. this.courseQRcodeDetail();//签到详情
  101. },
  102. methods: {
  103. //滚动事件
  104. scrollGet(){},
  105. handleClick(doType){
  106. let self=this;
  107. if(doType=='sign'){//签到遮罩层
  108. this.dialogVisible=true;
  109. }else if(doType=='signSubmit'){//确认签到
  110. this.submitForm()
  111. }else if(doType=='cancel'){//取消返回小程序首页
  112. let data=uni.getStorageSync('gentleIdentifierData')
  113. if(!data.adminGentle && !data.applyGentle && !data.rectifyGentle){
  114. uni.redirectTo({
  115. url: '/pages/mine',
  116. });
  117. }else{
  118. uni.redirectTo({
  119. url: '/pages/home',
  120. });
  121. }
  122. }
  123. },
  124. //关闭弹窗
  125. dialogOutfire() {
  126. this.dialogVisible = !this.dialogVisible
  127. },
  128. //是否签到
  129. async courseQRcodeIsSign(){
  130. let _this = this;
  131. const {data} = await courseQRcodeIsSign({courseId:this.courseId,userId:this.userId});
  132. if(data.code == 200){
  133. this.isSign=data.data;
  134. }
  135. },
  136. //是否计划内签到
  137. async courseQRcodeIsPlanSign(){
  138. let _this = this;
  139. const {data} = await courseQRcodeIsPlanSign({courseId:this.courseId,userId:this.userId});
  140. if(data.code == 200){
  141. this.isCourse=data.data;
  142. }
  143. },
  144. //详情
  145. async courseQRcodeDetail(){
  146. let _this = this;
  147. const {data} = await courseQRcodeDetail(this.courseId);
  148. if(data.code == 200){
  149. this.infoData=data.data;
  150. if(data.data.subId){
  151. this.infoData.site=data.data.subName+data.data.subRoom
  152. }else{
  153. this.infoData.site=data.data.position
  154. }
  155. }
  156. },
  157. //获取签到人数
  158. async courseQRcodeSignCount(){
  159. let _this = this;
  160. const {data} = await courseQRcodeSignCount({courseId:this.courseId,isSing:1});
  161. if(data.code == 200){
  162. this.signPeople=data.total
  163. }
  164. },
  165. //提交
  166. async submitForm(){
  167. let _this = this;
  168. let obj={
  169. courseId:this.courseId,
  170. userId:this.userId,
  171. singType:this.isCourse?'0':'1',//0计划内 1计划外
  172. }
  173. const {data} = await courseQRcodeSign(obj);
  174. if(data.code == 200){
  175. if(data.data==1){//签到成功
  176. this.isSucceed=true;
  177. }else{//签到失败
  178. this.isSucceed=false;
  179. }
  180. _this.shadeStatus=1;
  181. _this.courseQRcodeSignCount();//签到人数
  182. setTimeout(function () {
  183. _this.dialogVisible=false;
  184. _this.isSign=true;
  185. }, 3000);
  186. }else{
  187. _this.shadeStatus=1;
  188. this.isSucceed=false;
  189. setTimeout(function () {
  190. _this.dialogVisible=false;
  191. }, 3000);
  192. }
  193. },
  194. }
  195. }
  196. </script>
  197. <style lang="stylus" scoped>
  198. .course{
  199. height:100%;
  200. display flex;
  201. box-sizing: border-box;
  202. .info-max-box{
  203. flex: 1;
  204. overflow: scroll;
  205. padding-bottom: 128rpx;
  206. box-sizing: border-box;
  207. }
  208. /* 遮罩 */
  209. .shade{
  210. height: 100%;
  211. width: 100%;
  212. position: fixed;
  213. display: flex;
  214. flex-direction: column;
  215. z-index: 10;
  216. background: rgba(0, 0, 0, 0.2);
  217. .null-box {
  218. flex: 1;
  219. }
  220. .shade_n{
  221. width: 550rpx;
  222. height: 350rpx;
  223. background: #FFFFFF;
  224. border-radius: 20rpx;
  225. position: absolute;
  226. top: 490rpx;
  227. left: 100rpx;
  228. .shade_n_t{
  229. width: 100%;
  230. position: absolute;
  231. top: 80rpx;
  232. padding:0 48rpx 0 58rpx;
  233. box-sizing: border-box;
  234. display: flex;
  235. text-align: center;
  236. >img{
  237. width: 48rpx;
  238. height: 48rpx;
  239. margin-right:22rpx;
  240. }
  241. >text{
  242. flex: 1;
  243. font-size: 34rpx;
  244. font-family: PingFang SC-Medium, PingFang SC;
  245. font-weight: 400;
  246. color: #333333;
  247. line-height: 48rpx;
  248. display:inline-block;
  249. text-align: justify;
  250. }
  251. }
  252. .shade_n_b{
  253. position: absolute;
  254. top: 220rpx;
  255. >text{
  256. display: inline-block;
  257. width: 230rpx;
  258. height: 90rpx;
  259. border-radius: 10rpx 10rpx 10rpx 10rpx;
  260. }
  261. >text:nth-of-type(1){
  262. border: 2rpx solid #E0E0E0;
  263. font-size: 30rpx;
  264. font-family: PingFang SC-Medium, PingFang SC;
  265. font-weight: 400;
  266. color: #333333;
  267. line-height: 90rpx;
  268. text-align: center;
  269. margin-right: 20rpx;
  270. margin-left: 34rpx;
  271. }
  272. >text:nth-of-type(2){
  273. background: #0183FA;
  274. font-size: 30rpx;
  275. font-family: PingFang SC-Medium, PingFang SC;
  276. font-weight: 400;
  277. color: #FFFFFF;
  278. line-height: 90rpx;
  279. text-align: center;
  280. }
  281. }
  282. }
  283. .shade_n_tow{
  284. width: 550rpx;
  285. height: 528rpx;
  286. background: #FFFFFF;
  287. border-radius: 20rpx;
  288. position: absolute;
  289. top: 310rpx;
  290. left: 100rpx;
  291. .shade_n_tow_t{
  292. >img{
  293. width: 230rpx;
  294. height: 230rpx;
  295. margin: 60rpx 0 0 160rpx;
  296. }
  297. >text{
  298. display: block;
  299. width: 100%;
  300. font-size: 34rpx;
  301. font-family: PingFang SC-Medium, PingFang SC;
  302. font-weight: 400;
  303. color: #333333;
  304. line-height: 48rpx;
  305. text-align: center;
  306. margin-top:46rpx;
  307. }
  308. }
  309. .shade_n_tow_b{
  310. width: 100%;
  311. height: 100rpx;
  312. border-top: 1px solid #E0E0E0;
  313. font-size: 30rpx;
  314. font-family: PingFang SC-Medium, PingFang SC;
  315. font-weight: 400;
  316. color: #0183FA;
  317. line-height: 100rpx;
  318. text-align: center;
  319. margin-top: 42rpx;
  320. }
  321. }
  322. }
  323. .basics{
  324. width: 750rpx;
  325. background: #FFFFFF;
  326. padding: 30rpx 30rpx 0rpx;
  327. box-sizing: border-box;
  328. .basics_li{
  329. width: 690rpx;
  330. height: auto;
  331. border-bottom: 1rpx solid #D8D8D8;
  332. padding: 20rpx 0;
  333. box-sizing: border-box;
  334. display: flex;
  335. justify-content: space-between;
  336. .basics_li_l{
  337. font-size: 28rpx;
  338. font-family: PingFang SC-Medium, PingFang SC;
  339. font-weight: 400;
  340. color: #666666;
  341. line-height: 40rpx;
  342. }
  343. .basics_li_r{
  344. flex: 1;
  345. text-align: right;
  346. font-size: 28rpx;
  347. font-family: PingFang SC-Medium, PingFang SC;
  348. font-weight: 400;
  349. color: #333333;
  350. line-height: 40rpx;
  351. }
  352. .basics_li_r2{
  353. flex: 1;
  354. text-align: right;
  355. >text{
  356. display:inline-block;
  357. text-align: justify;
  358. font-size: 28rpx;
  359. font-family: PingFang SC-Medium, PingFang SC;
  360. font-weight: 400;
  361. color: #333333;
  362. line-height: 40rpx;
  363. }
  364. }
  365. }
  366. }
  367. .statistics{
  368. display: flex;
  369. justify-content: space-between;
  370. margin: 70rpx 30rpx 0;
  371. .statistics_li{
  372. width: 330rpx;
  373. height: 150rpx;
  374. background: #FFBD4C;
  375. border-radius: 10rpx 10rpx 10rpx 10rpx;
  376. display: flex;
  377. justify-content: center;
  378. align-items: center;
  379. >text:nth-of-type(1){
  380. font-size: 28rpx;
  381. font-family: PingFang SC-Medium, PingFang SC;
  382. font-weight: 400;
  383. color: #FFFFFF;
  384. line-height: 28rpx;
  385. margin-right: 32rpx;
  386. }
  387. >text:nth-of-type(2){
  388. font-size: 42rpx;
  389. font-family: PingFang SC-Heavy, PingFang SC;
  390. font-weight: 400;
  391. color: #FFFFFF;
  392. line-height: 42rpx;
  393. }
  394. }
  395. }
  396. .btn{
  397. position: fixed;
  398. bottom: 0;
  399. display: flex;
  400. justify-content: space-between;
  401. .btn_l{
  402. width: 375rpx;
  403. height: 90rpx;
  404. background: #FFFFFF;
  405. font-size: 30rpx;
  406. font-family: PingFang SC-Medium, PingFang SC;
  407. font-weight: 400;
  408. color: #333333;
  409. line-height: 90rpx;
  410. text-align: center;
  411. }
  412. .btn_r{
  413. width: 375rpx;
  414. height: 90rpx;
  415. background: #0183FA;
  416. font-size: 30rpx;
  417. font-family: PingFang SC-Medium, PingFang SC;
  418. font-weight: 400;
  419. color:#FFFFFF;
  420. line-height: 90rpx;
  421. text-align: center;
  422. }
  423. .forbidden{
  424. width: 375rpx;
  425. height: 90rpx;
  426. font-size: 30rpx;
  427. font-family: PingFang SC-Medium, PingFang SC;
  428. font-weight: 400;
  429. line-height: 90rpx;
  430. text-align: center;
  431. background: #E0E0E0;
  432. color: #FFFFFF;
  433. }
  434. }
  435. }
  436. </style>