mark-score.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <el-dialog :visible.sync="show" :title="`标记点评给 ${title}`" custom-class="content"
  3. style="background-color: #00142f63;backdrop-filter: blur(4px);" width="600px">
  4. <view class="ui-flex-column">
  5. <!-- <view class="ui-p" style="background: #022c5a80;border-bottom: 2px solid #051d37;">
  6. <text class="txt-white"> </text>
  7. </view> -->
  8. <view class="ui-flex-row">
  9. <view class="ui-flex-1 ui-flex-align-center ui-flex-row">
  10. <view class="ui-pl20">
  11. <view class="ui-flex-row ui-border-radius-20" @click="showType=true"
  12. style="background-color: #1C63A8;padding: 4px 8px;">
  13. <text class="txt-white f26 ui-mr10">全部类型</text>
  14. <u-icon color="#fff" name="list-dot"></u-icon>
  15. </view>
  16. </view>
  17. </view>
  18. <view style="width: 220px;" class="ui-p">
  19. <u-subsection :list="['表扬', '需改进']" mode="button" bgColor="#1b63a8" inactiveColor="#aec3ee"
  20. :current="curIndex" @change="change"></u-subsection>
  21. </view>
  22. <view class="ui-flex-1"></view>
  23. </view>
  24. <view style="background: #0000003b;">
  25. <u-tabs :list="courseList" :activeStyle="{
  26. color: '#fff',
  27. fontWeight: 'bold',
  28. transform: 'scale(1.2)'
  29. }" :inactiveStyle="{
  30. color: '#959595',
  31. transform: 'scale(1)'
  32. }" @change="changeCourse"></u-tabs>
  33. </view>
  34. <scroll-view scroll-y style="height: 400px;" show-scrollbar>
  35. <u-grid :col="6" :border="false">
  36. <u-grid-item @click="toActive(index,item)" v-for="(item, index) in list" :key="index" class="ui-p"
  37. v-if="course_id ? item.course_id == course_id : true"
  38. :class="{'no-select' : activeId >= 0 && activeId != index}">
  39. <u--image :src="item.img" width="46px" height="46px"></u--image>
  40. <view class="ui-pt10">
  41. <text class="grid-text txt-white f28">{{item.tab_name}}</text>
  42. </view>
  43. <u-badge v-if="activeId == index" absolute :offset="[0,10]" :value="score"></u-badge>
  44. </u-grid-item>
  45. </u-grid>
  46. </scroll-view>
  47. <view class="ui-p ui-flex" style="background-color: #1b63a870;justify-content: end;">
  48. <view class="ui-flex" style="width: 250px;">
  49. <u-button size="small" plain :text="score ? '取消选择' : '关闭点评'" @click="cancelAct"
  50. style="background-color: #0d4980;" class="ui-mr10"></u-button>
  51. <u-button size="small" :disabled="!score" type="primary" @click="submit" text="提交点评"></u-button>
  52. </view>
  53. </view>
  54. </view>
  55. <el-drawer append-to-body :visible.sync="showType" direction="ltr">
  56. <view class="ui-p" style="width: 400px;">
  57. <text>这里展示学生标签记录、以及类型切换</text>
  58. </view>
  59. <u-cell-group>
  60. <u-cell icon="setting-fill" isLink title="个人设置"></u-cell>
  61. <u-cell icon="integral-fill" isLink title="会员等级" value="新版本"></u-cell>
  62. </u-cell-group>
  63. </el-drawer>
  64. </el-dialog>
  65. </template>
  66. <script>
  67. // 标签缓存
  68. let tabList = {};
  69. import {
  70. getStudentTabs
  71. } from "@/common/api/studentTab.js"
  72. export default {
  73. props: {
  74. stuList: {
  75. type: Array,
  76. default: () => []
  77. },
  78. },
  79. data() {
  80. return {
  81. title : '',
  82. show: false,
  83. list : [],
  84. curIndex: 0,
  85. type: 0,
  86. score: 0, //加扣分分数
  87. activeId: -1, //选中项
  88. course_id : 0,
  89. itemTab: '',
  90. showType: false,
  91. courseList: [],
  92. }
  93. },
  94. watch: {
  95. show() {
  96. if (!this.show) {
  97. this.activeId = -1;
  98. this.score = 0;
  99. this.$emit('close')
  100. }
  101. }
  102. },
  103. methods: {
  104. change(e){
  105. this.curIndex = e
  106. this.getTipList();
  107. },
  108. changeCourse(item){
  109. this.course_id = item.id;
  110. // this.getTipList();
  111. },
  112. getTipList() {
  113. if(tabList[this.curIndex]){
  114. this.list = tabList[this.curIndex];
  115. return;
  116. }
  117. this.$api.sendRequest({
  118. url: `/mobile/studentTab/getStudentTabs`,
  119. method: "post",
  120. data: {
  121. teacher_id: this.$store.state.teacher_id,
  122. type: this.curIndex
  123. },
  124. success: res => {
  125. tabList[this.curIndex] = res.data;
  126. this.list = res.data
  127. }
  128. })
  129. },
  130. getStudentTabs() {
  131. this.$api.sendRequest({
  132. url: getStudentTabs,
  133. method: "post",
  134. data: {
  135. type: this.type
  136. },
  137. success: res => {
  138. console.log(res, "res");
  139. }
  140. })
  141. },
  142. // 外部访问使用
  143. open(title) {
  144. this.title = title;
  145. this.show = true;
  146. this.getTipList();
  147. if(this.courseList.length == 0){
  148. this.$api.sendRequest({
  149. url: '/mobile/systemBaseData/getAllCourse',
  150. method: "post",
  151. success: res => {
  152. console.log(res);
  153. this.courseList = [
  154. {
  155. id : 0,
  156. name : '全部'
  157. },
  158. ...res.data.map(item => {
  159. return {
  160. name : item.course_name,
  161. id : item.id
  162. }
  163. })
  164. ]
  165. }
  166. })
  167. }
  168. },
  169. toActive(index, item) {
  170. // 是否旧的选中项
  171. let always = this.activeId >= 0 && this.activeId == index;
  172. this.activeId = index;
  173. if (always) {
  174. this.score++;
  175. } else {
  176. this.score = 1;
  177. }
  178. this.itemTab = item
  179. },
  180. cancelAct() {
  181. if (this.score) {
  182. this.activeId = -1;
  183. this.score = 0;
  184. } else {
  185. this.show = false;
  186. this.$emit('close', false)
  187. }
  188. },
  189. submit() {
  190. let obj = {
  191. teacher_id: this.$store.state.teacher_id,
  192. stu_school_ids: this.stuList,
  193. tab_id: this.itemTab.tab_id,
  194. score: this.score
  195. }
  196. this.$api.sendRequest({
  197. url: '/mobile/studentTab/geiXueshengTianjiaBiaoqian',
  198. method: "post",
  199. data: obj,
  200. success: res => {
  201. if (res.code == 200) {
  202. uni.showToast({
  203. title: res.msg,
  204. 'icon': 'none',
  205. });
  206. this.show = false;
  207. this.activeId = -1;
  208. this.score = 0;
  209. this.$emit('close', res.data.batch_id)
  210. }
  211. }
  212. })
  213. },
  214. }
  215. }
  216. </script>
  217. <style>
  218. /deep/ .content {
  219. background-image: url('https://zhxy.obs.cn-hz1.ctyun.cn:443/static/desk_bg/class_bj.jpg');
  220. background-size: auto;
  221. border: 1px solid #0d5396;
  222. }
  223. /deep/ .el-dialog__header {
  224. background: #022c5a80;
  225. border-bottom: 2px solid #051d37;
  226. }
  227. /deep/ .el-dialog__title {
  228. color: #fff;
  229. }
  230. /deep/ .el-dialog__body {
  231. padding: 0;
  232. }
  233. .no-select {
  234. opacity: .5;
  235. }
  236. </style>