mark-score.vue 6.2 KB

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