course_detail.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view>
  3. <view>
  4. <my-coursedetail v-if="isShow" :item="item" :location="location" :marker="marker" :timeAM="timeAM" :timePM="timePM" :timeEvening="timeEvening" buttonMessage="用做模板" :isShowCollect="false" :isShowPrivate="true" :isShowBtn="showButton" @publishButton="publishButton"></my-coursedetail>
  5. </view>
  6. <view class="requires2">
  7. <uni-row >
  8. <text>待审条数:{{current}}</text>
  9. </uni-row>
  10. </view>
  11. <!-- 取消和提交按钮 -->
  12. <view class="suggestBtn" v-if="isShow">
  13. <button class="cancelBtn" @click="toRefuse">拒绝</button>
  14. <modal v-if="areaShow" title="拒绝原因必填" confirm-text="提交" cancel-text="取消" @cancel="cancelAdd" @confirm="confirmAdd">
  15. <input type="text" v-model="areaTxt" placeholder="至少5个字" maxlength="50" />
  16. </modal>
  17. <button class="confirmBtn" :disabled="disableButton" @click="toConfirm">同意</button>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { mapState } from 'vuex';
  23. import formTime from '@/mixins/form-time.js'
  24. export default {
  25. mixins: [formTime],
  26. computed: {
  27. ...mapState('m_user', ['token', 'userinfo'])
  28. },
  29. data() {
  30. return {
  31. areaShow: false,
  32. areaTxt:'',
  33. index: 0,
  34. current:0,
  35. item: {},
  36. datas: {},
  37. showButton: false,
  38. isShow: false,
  39. location: [],
  40. marker: [{
  41. id: 1,
  42. joinCluster:true,
  43. latitude: 0,
  44. longitude: 0,
  45. width: 40,
  46. height: 40,
  47. iconPath: '/static/location.png',
  48. }],
  49. };
  50. },
  51. onLoad(option) {
  52. this.getAllCheckingCourseInfo()
  53. },
  54. methods:{
  55. checkIsHaveNext(){
  56. this.current = this.current - 1
  57. this.index = this.index + 1
  58. if(this.current == 0){
  59. this.isShow = false
  60. }else{
  61. this.item = this.datas.list[this.index]
  62. this.formatForm()
  63. }
  64. },
  65. toConfirm(){
  66. // 开始向后端提交数据
  67. this.submitToBack(this.item.courseId,"已通过",this.userinfo.uid + "已通过","上架")
  68. this.checkIsHaveNext()
  69. },
  70. toRefuse(){
  71. this.areaShow = true
  72. },
  73. cancelAdd(){
  74. this.areaShow = false
  75. },
  76. confirmAdd(){
  77. this.areaShow = false
  78. var strRefuse = this.areaTxt.replace(/\ +/g,"")
  79. strRefuse = strRefuse.replace(/[\r\n]/g,"")
  80. if(strRefuse.length < 5){
  81. uni.$showMsg("有效字数少于5个,请增加!")
  82. }else{
  83. strRefuse = this.userinfo.uid + strRefuse
  84. // 开始向后端提交数据
  85. this.submitToBack(this.item.courseId,"未通过",strRefuse,"下架")
  86. this.checkIsHaveNext()
  87. }
  88. },
  89. async submitToBack(courseid,checkstatus,checktext,display) {
  90. // 准备参数对象
  91. const query = {
  92. courseid: courseid,
  93. checkstatus: checkstatus,
  94. checktext: checktext,
  95. display: display,
  96. }
  97. const {
  98. data: result
  99. } = await uni.$http.get('/education/teacher-courses/updateTeacherCourseInfo',query)
  100. //console.log(result)
  101. uni.$showMsg(result.message , 2000)
  102. },
  103. async getAllCheckingCourseInfo() {
  104. const { data: result } = await uni.$http.get('/education/teacher-courses/getAllCheckingCourseInfo')
  105. // console.log(result)
  106. this.current = result.data.list.length
  107. if(this.current > 0){
  108. this.datas = result.data
  109. this.item = this.datas.list[this.index ]
  110. // this.getPhotoes()
  111. this.formatForm()
  112. this.isShow = true
  113. }
  114. //console.log(this.item)
  115. },
  116. // // 获取课程详情
  117. // async getCourseDetailById(id) {
  118. // const {data: result} = await uni.$http.get('/education/teacher-courses/getPersonCourseDetailById', {courseId: id})
  119. // this.course = result.data.one
  120. // this.formatForm()
  121. // },
  122. // 上课表格格式化
  123. formatForm() {
  124. this.location = this.item.locationAl.split(",")
  125. this.marker[0].latitude = Number(this.location[0])
  126. this.marker[0].longitude = Number(this.location[1])
  127. this.courseWeekday = this.item.teachTime.split(",")
  128. this.parseCourseWeekday()
  129. },
  130. }
  131. }
  132. </script>
  133. <!-- 设置页面背景 -->
  134. <style lang="scss">
  135. page{
  136. height: 100%;
  137. // background-color: #FFF;
  138. }
  139. </style>
  140. <style lang="scss" scoped>
  141. .requires2 {
  142. background-color: #FFF;
  143. margin: 20rpx 20rpx;
  144. border-radius: 50rpx;
  145. font-size: 30rpx;
  146. padding: 20rpx 20rpx;
  147. //font-weight: bold;
  148. color: gray;
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. }
  153. /* 下方按钮 */
  154. .suggestBtn{
  155. display: flex;
  156. padding: 60rpx;
  157. justify-content: space-around;
  158. }
  159. .confirmBtn,
  160. .cancelBtn{
  161. font-size: 30rpx;
  162. height: 85rpx;
  163. width: 200rpx;
  164. line-height: 85rpx;
  165. border-radius: 50rpx;
  166. text-align: center;
  167. color: white;
  168. margin-top: 5rpx;
  169. }
  170. .confirmBtn{
  171. background-color: #35b882;
  172. }
  173. .cancelBtn{
  174. background-color: #3ed598;
  175. }
  176. </style>