student.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542
  1. <template>
  2. <div class="pb_content" style="background: unset">
  3. <backPage v-if="gotype" tit="学生管理"></backPage>
  4. <div class="sm_box">
  5. <div class="sm_right">
  6. <div class="pb_content_body" style="
  7. background: #fff;
  8. padding: 0px 25px;
  9. box-sizing: border-box;
  10. border-radius: 5px;
  11. ">
  12. <div class="pb_head">
  13. <div>
  14. <span>学生管理</span>
  15. </div>
  16. </div>
  17. <div class="student_head">
  18. <div class="head_left">
  19. <el-input v-model="sPhoneUser" class="student_input" placeholder="请输入用户名"></el-input>
  20. <el-select v-model="cid" placeholder="请选择班级" class="student_input" @change="searchStudent">
  21. <el-option label="所有人" value=""></el-option>
  22. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name"
  23. :value="item.id"></el-option>
  24. </el-select>
  25. <el-button class="student_button" @click="searchStudent" type="primary">查询</el-button>
  26. </div>
  27. <div class="head_right">
  28. <el-button @click="addStudent" type="primary" class="student_button">添加学生</el-button>
  29. <el-upload class="upload-demo newCss" :http-request="handleChange" :on-remove="handleRemove" action="#"
  30. :file-list="fileListUpload" accept=".xlsx">
  31. <el-button size="primary" type="primary">批量添加</el-button>
  32. <div slot="tip" class="el-upload__tip" style="margin-left: 10px">
  33. 只能上传xlsx文件,且不超过500kb
  34. </div>
  35. </el-upload>
  36. <!-- <el-button @click="exportExcel">导出学生</el-button> -->
  37. <div @click="getExcel">xls 上传样例</div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="pb_content_body">
  42. <div class="student_table">
  43. <el-table ref="table" :data="tableData" border :height="tableHeight" :fit="true" v-loading="isLoading"
  44. style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
  45. :row-class-name="tableRowClassName">
  46. <el-table-column label="姓名" min-width="10" align="center">
  47. <template slot-scope="scope">
  48. <div class="userImg">
  49. <div class="tx">
  50. <img :src="scope.row.headportrait != null
  51. ? scope.row.headportrait
  52. : tx
  53. " alt />
  54. </div>
  55. <div style="
  56. width: 150px;
  57. text-align: left;
  58. white-space: nowrap;
  59. overflow: hidden;
  60. text-overflow: ellipsis;
  61. ">
  62. {{ scope.row.name }}
  63. </div>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="学生账号" min-width="15" align="center">
  68. <template slot-scope="scope">
  69. <div>{{ scope.row.un ? scope.row.un : "" }}</div>
  70. </template>
  71. </el-table-column>
  72. <!-- <el-table-column label="电话" min-width="15" align="center">
  73. <template slot-scope="scope">
  74. <div>{{scope.row.phonenumber ? scope.row.phonenumber : "" }}</div>
  75. </template>
  76. </el-table-column> -->
  77. <!-- <el-table-column prop="studentid" label="学号" min-width="10" align="center"></el-table-column> -->
  78. <!-- <el-table-column
  79. prop="school"
  80. label="学校"
  81. min-width="30"
  82. align="center"
  83. >
  84. </el-table-column>-->
  85. <el-table-column prop="classname2" label="班级" min-width="15" align="center">
  86. </el-table-column>
  87. <el-table-column label="操作" width="250px">
  88. <template slot-scope="scope">
  89. <div class="btnBox">
  90. <el-button class="de_button" type="primary" size="small" style="
  91. width: auto;
  92. padding: 5px !important;
  93. line-height: 15px;
  94. " @click="iniPassword(scope.row.userid)">初始化密码</el-button>
  95. <el-button class="de_button" type="primary" size="small"
  96. @click="updateStudentA(scope.row)">修改</el-button>
  97. <div class="delete">
  98. <img src="../../../../assets/remove.png" alt
  99. @click="deleteStudent(scope.row.userid, scope.row.state)" />
  100. </div>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. </div>
  106. <div class="student_page">
  107. <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
  108. @current-change="handleCurrentChange"></el-pagination>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <el-dialog :visible.sync="dialogVisible" :append-to-body="true" width="700px" :before-close="handleClose"
  114. class="add_student">
  115. <div slot="title" class="header-title">
  116. <div class="logoImg">
  117. <img src="../../../../assets/logo.png" alt />
  118. </div>
  119. <div class="title_add_student">添加学生</div>
  120. </div>
  121. <el-form>
  122. <el-form-item label="学生姓名" :label-width="formLabelWidth">
  123. <span>
  124. <el-input placeholder="请输入学生姓名" clearable v-model="sName" class="add_input"></el-input>
  125. </span>
  126. </el-form-item>
  127. <!-- <el-form-item label="学生学号" :label-width="formLabelWidth">
  128. <span>
  129. <el-input
  130. placeholder="请输入学生学号"
  131. clearable
  132. v-model="sId"
  133. class="add_input"
  134. ></el-input>
  135. </span>
  136. </el-form-item>
  137. <el-form-item label="学生手机号" :label-width="formLabelWidth">
  138. <span>
  139. <el-input
  140. placeholder="请输入学生手机号"
  141. clearable
  142. v-model="sPhone"
  143. class="add_input"
  144. ></el-input>
  145. </span>
  146. </el-form-item> -->
  147. <el-form-item label="学生账号" :label-width="formLabelWidth">
  148. <span>
  149. <el-input placeholder="请输入学生账号" clearable v-model="sMail" class="add_input"></el-input>
  150. </span>
  151. </el-form-item>
  152. <el-form-item label="所属学校" :label-width="formLabelWidth">
  153. <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
  154. </el-form-item>
  155. <el-form-item label="班级" :label-width="formLabelWidth">
  156. <el-select multiple collapse-tags v-model="sByClass" placeholder="请选择班级" filterable>
  157. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
  158. </el-select>
  159. </el-form-item>
  160. <div style="text-align: center; color: #adb3b7">
  161. 注:添加学生的账号密码为Coco1234
  162. </div>
  163. </el-form>
  164. <span slot="footer" class="dialog-footer flex">
  165. <el-button class="right" @click="insertStudent">确认</el-button>
  166. </span>
  167. </el-dialog>
  168. <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
  169. class="add_student">
  170. <div slot="title" class="header-title">
  171. <div class="logoImg">
  172. <img src="../../../../assets/logo.png" alt />
  173. </div>
  174. <div class="title_add_student">修改学生</div>
  175. </div>
  176. <el-form>
  177. <el-form-item label="学生名称" :label-width="formLabelWidth">
  178. <span>
  179. <el-input placeholder="请输入学生姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
  180. </span>
  181. </el-form-item>
  182. <!-- <el-form-item label="学生学号" :label-width="formLabelWidth">
  183. <span>
  184. <el-input placeholder="请输入学生学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
  185. </span>
  186. </el-form-item>
  187. <el-form-item label="学生手机号" :label-width="formLabelWidth">
  188. <span>
  189. <el-input placeholder="请输入学生手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
  190. </span>
  191. </el-form-item> -->
  192. <el-form-item label="学生账号" :label-width="formLabelWidth">
  193. <span>
  194. <el-input placeholder="请输入学生账号" clearable v-model="userinfo.un" class="add_input"></el-input>
  195. </span>
  196. </el-form-item>
  197. <el-form-item label="所属学校" :label-width="formLabelWidth">
  198. <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
  199. </el-form-item>
  200. <el-form-item label="班级" :label-width="formLabelWidth">
  201. <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择班级">
  202. <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
  203. </el-select>
  204. </el-form-item>
  205. <div style="text-align: center; color: #adb3b7">
  206. 注:添加学生的账号密码为Coco1234
  207. </div>
  208. </el-form>
  209. <span slot="footer" class="dialog-footer flex">
  210. <el-button class="right" @click="updateStudent">修改</el-button>
  211. </span>
  212. </el-dialog>
  213. </div>
  214. </template>
  215. <script>
  216. import $ from "jquery";
  217. import pinyin from "../../../../../node_modules/js-pinyin/index";
  218. import { myMixin } from "@/mixins/mixin.js"
  219. import backPage from "../components/backPage.vue";
  220. export default {
  221. mixins: [ myMixin ],
  222. components: {
  223. backPage
  224. },
  225. data() {
  226. return {
  227. gotype:sessionStorage.getItem('gotype'),
  228. tableHeight: "500px",
  229. isLoading: false,
  230. formLabelWidth: "100px",
  231. tableData: [],
  232. dialogVisible: false,
  233. dialogVisibleUpdate: false,
  234. userinfo: {},
  235. userinfoA: {},
  236. sName: "",
  237. sPhone: "",
  238. sId: "",
  239. schoolName: "",
  240. // sBySchool: [],
  241. // sBySchoolName:"",
  242. sByClass: "",
  243. sMail: "",
  244. schoolJuri: [],
  245. classJuri: [],
  246. fileListUpload: [],
  247. page: 1,
  248. total: 0,
  249. sPhoneUser: "",
  250. userid: this.$route.query.userid,
  251. oid: this.$route.query.oid,
  252. org: this.$route.query.org,
  253. role: this.$route.query.role,
  254. cid: "",
  255. tx: require("../../../../assets/avatar.png"),
  256. userSuffix: "",
  257. schoolChar: "",
  258. };
  259. },
  260. mounted() {
  261. this.$nextTick(function () {
  262. this.getUser()
  263. this.tableHeight =
  264. window.innerHeight - this.$refs.table.$el.offsetTop - 200;
  265. if (this.tableHeight <= 530) {
  266. this.tableHeight = 530;
  267. }
  268. // 监听窗口大小变化
  269. let self = this;
  270. window.onresize = function () {
  271. self.tableHeight =
  272. window.innerHeight - self.$refs.table.$el.offsetTop - 200;
  273. if (self.tableHeight <= 530) {
  274. self.tableHeight = 530;
  275. }
  276. };
  277. });
  278. },
  279. methods: {
  280. goTo(path) {
  281. this.$router.push(path);
  282. },
  283. getUser() {
  284. let params = {
  285. userid: this.userid
  286. }
  287. this.ajax
  288. .get(this.$store.state.api + "selectUser", params)
  289. .then((res) => {
  290. this.userSuffix = res.data[0][0].accountNumber.split("@")[1]
  291. })
  292. .catch((err) => {
  293. console.error(err);
  294. });
  295. },
  296. tableRowClassName({ row, rowIndex }) {
  297. if ((rowIndex + 1) % 2 === 0) {
  298. return "even_row";
  299. } else {
  300. return "";
  301. }
  302. },
  303. searchStudent() {
  304. this.page = 1;
  305. this.getStudent();
  306. },
  307. addStudent() {
  308. this.dialogVisible = true;
  309. (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
  310. this.getClass();
  311. // this.getSchool();
  312. },
  313. handleClose(done) {
  314. done();
  315. },
  316. getExcel(res) {
  317. require.ensure([], () => {
  318. const { export_json_to_excel } = require("../../../../common/Export2Excel");
  319. const tHeader = ["学生姓名", "学生账号", "班级"];//"学号", "学生手机号",
  320. const data = [];
  321. export_json_to_excel(tHeader, data, "上传学生样例");
  322. });
  323. },
  324. handleCurrentChange(val) {
  325. this.page = val;
  326. this.getStudent();
  327. },
  328. time() {
  329. if (!this.now) {
  330. this.now = new Date().getTime();
  331. return true;
  332. } else {
  333. let time = new Date().getTime();
  334. if (time - this.now > 3000) {
  335. this.now = time;
  336. return true;
  337. } else {
  338. return false;
  339. }
  340. }
  341. },
  342. //新增学生
  343. insertStudent() {
  344. this.dialogVisible = true;
  345. if (this.sName === "") {
  346. this.$message.error("学生姓名不能为空");
  347. return;
  348. } else if (this.sByClass === "") {
  349. this.$message.error("请为学生选择班级");
  350. return;
  351. } else if (
  352. this.sPhone != "" &&
  353. !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
  354. ) {
  355. this.$message.error("手机号格式不正确");
  356. return;
  357. } else if (
  358. // !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
  359. this.sMail === ""
  360. ) {
  361. // this.$message.error("邮箱格式不正确");
  362. this.$message.error("学生账号不能为空");
  363. return;
  364. }
  365. // else if (this.sId === "") {
  366. // this.$message.error("学生学号不能为空");
  367. // return;
  368. // } else if (this.sPhone === "") {
  369. // this.$message.error("学生手机号不能为空");
  370. // return;
  371. // }
  372. let mail = '';
  373. if(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)){
  374. mail = this.sMail;
  375. }else{
  376. if(this.org != "" && this.org != "null" && this.org != undefined && this.org && this.schoolChar){
  377. mail = this.sMail + "@" + this.schoolChar + '.' + this.userSuffix
  378. }else {
  379. mail = this.sMail + "@" + this.userSuffix
  380. }
  381. // mail = this.sMail + "@" + this.userSuffix
  382. }
  383. if (this.time()) {
  384. // let params = { un: this.sPhone };
  385. // this.ajax
  386. // .get(this.$store.state.api + "findPhone", params)
  387. // .then((res) => {
  388. // if (res.data[0].length > 0) {
  389. // this.$message.error("此学生手机号码已被注册");
  390. // } else {
  391. let params = { un: mail };
  392. this.ajax
  393. .get(this.$store.state.api + "findMail", params)
  394. .then((res) => {
  395. if (res.data[0].length > 0) {
  396. this.$message.error("此学生账号已被注册");
  397. } else {
  398. // let params = { un: this.sId };
  399. // this.ajax
  400. // .get(this.$store.state.api + "findSid", params)
  401. // .then((res) => {
  402. // if (res.data[0].length > 0) {
  403. // this.$message.error("此学生学号已被注册");
  404. // } else {
  405. this.add_Student();
  406. // }
  407. // })
  408. // .catch((err) => {
  409. // console.error(err);
  410. // });
  411. }
  412. })
  413. .catch((err) => {
  414. console.error(err);
  415. });
  416. // }
  417. // })
  418. // .catch((err) => {
  419. // console.error(err);
  420. // });
  421. }
  422. },
  423. add_Student() {
  424. let mail = '';
  425. if(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)){
  426. mail = this.sMail;
  427. }else{
  428. if(this.org != "" && this.org != "null" && this.org != undefined && this.org && this.schoolChar){
  429. mail = this.sMail + "@" + this.schoolChar + '.' + this.userSuffix
  430. }else {
  431. mail = this.sMail + "@" + this.userSuffix
  432. }
  433. }
  434. let params = [
  435. {
  436. username: mail,
  437. userpassword: 'Coco1234',
  438. alias: this.sName,
  439. oid: this.oid,
  440. ph: this.sPhone,
  441. sid: this.sId,
  442. cid: this.sByClass.join(","),
  443. org: this.org,
  444. },
  445. ];
  446. this.ajax
  447. .post(this.$store.state.api + "batchRegistrationOrg", params)
  448. .then((res) => {
  449. // console.log(res.data.uid, res.data.ph, res.data.oid, res.data.cid);
  450. // this.isLoading = false;
  451. // let params = [
  452. // {
  453. // userid: res.data.uid,
  454. // username: this.sName,
  455. // sid: this.sId,
  456. // type: 2,
  457. // oid: res.data.oid,
  458. // phone: res.data.ph,
  459. // cid: res.data.cid,
  460. // intro: "",
  461. // sex: "0",
  462. // org: this.org,
  463. // },
  464. // ];
  465. // this.ajax
  466. // // .post(this.$store.state.api + "updateUser", params)
  467. // .post(this.$store.state.api + "updateUserByEduOrg", params)
  468. // .then((res) => {
  469. // console.log(res);
  470. // })
  471. // .catch((err) => {
  472. // console.error(err);
  473. // });
  474. this.$message({
  475. message: "新增成功",
  476. type: "success",
  477. });
  478. this.dialogVisible = false;
  479. this.sPhone = "";
  480. this.sName = "";
  481. // this.sBySchool = [];
  482. this.sByClass = [];
  483. this.sMail = "";
  484. this.getStudent();
  485. this.addOp3('1', "", { type: "student_user_add" }, "success")
  486. })
  487. .catch((err) => {
  488. this.isLoading = false;
  489. this.addOp3('1', "", { type: "student_user_add" }, err)
  490. this.$message({
  491. message: "新增失败",
  492. type: "error",
  493. });
  494. console.error(err);
  495. });
  496. },
  497. //获取班级列表
  498. getClass() {
  499. this.isLoading = true;
  500. let params = {
  501. oid: this.oid,
  502. };
  503. this.ajax
  504. .get(this.$store.state.api + "selectClassBySchool", params)
  505. .then((res) => {
  506. this.isLoading = false;
  507. this.classJuri = res.data[0];
  508. })
  509. .catch((err) => {
  510. this.isLoading = false;
  511. console.error(err);
  512. });
  513. },
  514. // getSchool() {
  515. // this.isLoading = true;
  516. // let params = {
  517. // page: this.page,
  518. // };
  519. // this.ajax
  520. // .get(this.$store.state.api + "selectOrg", params)
  521. // .then((res) => {
  522. // this.isLoading = false;
  523. // this.schoolJuri = res.data[0];
  524. // })
  525. // .catch((err) => {
  526. // this.isLoading = false;
  527. // console.error(err);
  528. // });
  529. // },
  530. getStudent() {
  531. this.isLoading = true;
  532. let params = {
  533. oid: this.oid,
  534. cid: this.cid,
  535. cu: "",
  536. cn: this.sPhoneUser,
  537. page: this.page,
  538. };
  539. this.ajax
  540. .get(this.$store.state.api + "selectStudent2", params)
  541. .then((res) => {
  542. this.isLoading = false;
  543. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  544. this.tableData = res.data[0];
  545. })
  546. .catch((err) => {
  547. this.isLoading = false;
  548. console.error(err);
  549. });
  550. },
  551. handleChange(file) {
  552. this.fileTemp = file.file;
  553. if (this.fileTemp) {
  554. if (
  555. this.fileTemp.type ==
  556. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  557. this.fileTemp.type == "application/vnd.ms-excel"
  558. ) {
  559. this.importCount = 1;
  560. this.importfxx(this.fileTemp);
  561. this.addOp3('1', "", { type: "student_user_adds" }, "success")
  562. } else {
  563. this.addOp3('1', "", { type: "student_user_adds" }, "附件格式错误")
  564. this.$message({
  565. type: "warning",
  566. message: "附件格式错误,请删除后重新上传!",
  567. });
  568. }
  569. } else {
  570. this.$message({
  571. type: "warning",
  572. message: "请上传附件!",
  573. });
  574. }
  575. },
  576. handleRemove(file, fileList) {
  577. this.fileTemp = null;
  578. },
  579. exportExcel() {
  580. try {
  581. let params = {
  582. oid: this.oid,
  583. };
  584. this.ajax
  585. .get(this.$store.state.api + "selectUserBySchool", params)
  586. .then((res) => {
  587. var res = res.data[0];
  588. //如果value的json字段的key值和想要的headers值不一致时,可做如下更改
  589. //将和下面的Object.fromEntries结合,将json字段的key值改变为要求的excel的header值
  590. var array = [];
  591. for (var i = 0; i < res.length; i++) {
  592. var _json = {};
  593. _json["用户名"] = res[i].username;
  594. _json["姓名"] = res[i].alias ? res[i].alias : "";
  595. _json["班级"] = res[i].classid ? res[i].classid : "";
  596. array.push(_json);
  597. }
  598. var XLSX = require("xlsx");
  599. const workbook = XLSX.utils.book_new(); //创建一个新的工作簿对象
  600. let ws = XLSX.utils.json_to_sheet(array); //将json对象数组转化成工作表
  601. ws["!cols"] = [
  602. //设置每一列的宽度
  603. { wch: 50 },
  604. { wch: 50 },
  605. { wch: 50 },
  606. ];
  607. XLSX.utils.book_append_sheet(workbook, ws, "sheet1"); //把sheet添加到workbook里,第三个参数是sheet名
  608. XLSX.writeFile(workbook, "学生信息.xlsx");
  609. // const wopts = { bookType: "xlsx", bookSST: false, type: "array" };//写入的样式bookType:输出的文件类型,type:输出的数据类型,bookSST: 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
  610. // const wbout = XLSX.write(workbook, wopts);// 浏览器端和node共有的API,实际上node可以直接使用xlsx.writeFile来写入文件,但是浏览器没有该API
  611. // FileSaver.saveAs(new Blob([wbout], { type: "application/octet-stream" }), `${title} demo.xlsx`);//保存文件
  612. this.$message({
  613. message: "导出成功",
  614. type: "success",
  615. });
  616. })
  617. .catch((err) => {
  618. console.error(err);
  619. });
  620. } catch (e) {
  621. console.log(e, e.stack);
  622. }
  623. },
  624. importfxx(obj) {
  625. const loading = this.$loading.service({
  626. background: "rgba(255, 255, 255, 0.7)",
  627. target: document.body,
  628. });
  629. var _$ = $;
  630. this.importCount++;
  631. let _this = this;
  632. // 通过DOM取文件数据
  633. this.file = obj;
  634. var rABS = false; //是否将文件读取为二进制字符串
  635. var f = this.file;
  636. var reader = new FileReader();
  637. //if (!FileReader.prototype.readAsBinaryString) {
  638. FileReader.prototype.readAsBinaryString = function (f) {
  639. var binary = "";
  640. var rABS = false; //是否将文件读取为二进制字符串
  641. var pt = this;
  642. var wb; //读取完成的数据
  643. var outdata;
  644. var reader = new FileReader();
  645. reader.onload = function (e) {
  646. var bytes = new Uint8Array(reader.result);
  647. var length = bytes.byteLength;
  648. for (var i = 0; i < length; i++) {
  649. binary += String.fromCharCode(bytes[i]);
  650. }
  651. var XLSX = require("xlsx");
  652. if (rABS) {
  653. wb = XLSX.read(btoa(fixdata(binary)), {
  654. //手动转化
  655. type: "base64",
  656. });
  657. } else {
  658. wb = XLSX.read(binary, {
  659. type: "binary",
  660. });
  661. }
  662. outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); //outdata就是你想要的东西
  663. this.da = [...outdata];
  664. let arr = [];
  665. this.da.map((v) => {
  666. let obj = {};
  667. let a = "";
  668. var num = "";
  669. for (var cj = 0; cj < 3; cj++) {
  670. num += Math.floor(Math.random() * 10);
  671. }
  672. // a =
  673. // pinyin.getFullChars(v["学生姓名"]).toLowerCase() +
  674. // num +
  675. // "@cocorobo.cc";
  676. a =
  677. pinyin.getFullChars(v["学生姓名"]).toLowerCase() +
  678. num + _this.userSuffix;
  679. obj.sId = v["学号"];
  680. obj.name = v["学生姓名"];
  681. // obj.mail = v["学生账号"] ? v["学生账号"] : a;
  682. // console.log('v["学生账号"]',v["学生账号"]==true,v["学生账号"]);
  683. if (v["学生账号"]) {
  684. if(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(v["学生账号"])){
  685. obj.mail = v["学生账号"];
  686. }else{
  687. if(_this.org != "" && _this.org != "null" && _this.org != undefined && _this.org && _this.schoolChar){
  688. obj.mail = v["学生账号"] + "@" + _this.schoolChar + '.' + _this.userSuffix
  689. }else {
  690. obj.mail = v["学生账号"] + "@" + _this.userSuffix
  691. }
  692. // obj.mail = v["学生账号"] + "@" + _this.userSuffix
  693. }
  694. }else{
  695. obj.mail = a;
  696. }
  697. obj.phone = v["学生手机号"];
  698. obj.class = v["班级"];
  699. arr.push(obj);
  700. });
  701. console.log(arr);
  702. if(arr.length > 70){
  703. _this.$message.error("限制上传学生数量不能超过70个");
  704. _this.fileListUpload = [];
  705. loading.close();
  706. return;
  707. }
  708. let _b = 1;
  709. for (var i = 0; i < arr.length; i++) {
  710. let item = arr[i];
  711. if (item.class === "") {
  712. _b = 2;
  713. _this.$message.error("学生班级不能为空,请重新上传");
  714. break;
  715. } else if (item.name === "") {
  716. _b = 2;
  717. _this.$message.error("学生姓名不能为空,请重新上传");
  718. break;
  719. } else if (item.sId === "") {
  720. _b = 2;
  721. _this.$message.error("学生学号不能为空,请重新上传");
  722. }
  723. // else if (item.phone === "") {
  724. // _b = 1;
  725. // _this.$message.error("学生手机号不能为空,请重新上传");
  726. // break;
  727. // } else if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(item.phone)) {
  728. // _b = 1;
  729. // _this.$message.error("有学生手机号格式不正确,请重新上传");
  730. // break;
  731. // }
  732. else if (item.mail === "") {
  733. _b = 2;
  734. _this.$message.error("学生账号不能为空,请重新上传");
  735. break;
  736. } else if (
  737. !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
  738. item.mail
  739. )
  740. ) {
  741. _b = 2;
  742. _this.$message.error("有学生账号格式不正确,请重新上传");
  743. break;
  744. }
  745. //#region
  746. // else if (item.school === "") {
  747. // _b = 1;
  748. // _this.$message.error("学生学校不能为空,请重新上传");
  749. // break;
  750. // }
  751. // else if (item.sex === "") {
  752. // _b = 1;
  753. // _this.$message.error("学生性别不能为空,请重新上传");
  754. // break;
  755. // }
  756. // if (item.class != "") {
  757. // let _a;
  758. // let params = {
  759. // className: item.class,
  760. // };
  761. // _$.ajax({
  762. // url: _this.$store.state.api + "selectC", //url路径
  763. // type: "GET", //GET
  764. // async: false, //或false,是否异步
  765. // data: params,
  766. // timeout: 5000, //超时时间
  767. // dataType: "json", //返回的数据格式:
  768. // beforeSend: function (xhr) {},
  769. // success: function (res, textStatus, jqXHR) {
  770. // if (res[0].length == 0) {
  771. // _a = 1;
  772. // _this.$message.error(
  773. // "有学生班级不存在,请去添加后并重新上传"
  774. // );
  775. // } else {
  776. // item.classid = res[0][0].id;
  777. // }
  778. // },
  779. // error: function (xhr, textStatus) {
  780. // console.log(textStatus);
  781. // },
  782. // complete: function () {},
  783. // });
  784. // if (_a == 1) {
  785. // _b = 1;
  786. // break;
  787. // }
  788. // }
  789. // if (item.school != "") {
  790. // let _a;
  791. // let params = {
  792. // schoolName: item.school,
  793. // };
  794. // _$.ajax({
  795. // url: _this.$store.state.api + "selectS", //url路径
  796. // type: "GET", //GET
  797. // async: false, //或false,是否异步
  798. // data: params,
  799. // timeout: 5000, //超时时间
  800. // dataType: "json", //返回的数据格式:
  801. // beforeSend: function (xhr) {},
  802. // success: function (res, textStatus, jqXHR) {
  803. // if (res[0].length == 0) {
  804. // _a = 1;
  805. // _this.$message.error(
  806. // "有学生学校不存在,请去添加后并重新上传"
  807. // );
  808. // } else {
  809. // item.schoolid = res[0][0].id;
  810. // }
  811. // },
  812. // error: function (xhr, textStatus) {
  813. // console.log(textStatus);
  814. // },
  815. // complete: function () {},
  816. // });
  817. // if (_a == 1) {
  818. // _b = 1;
  819. // break;
  820. // }
  821. // }
  822. // for (var k = 0; k < arr.length; k++) {
  823. // if (item.phone != "") {
  824. // let params = { un: item.phone };
  825. // let _a;
  826. // _$.ajax({
  827. // url: _this.$store.state.api + "findPhone", //url路径
  828. // type: "GET", //GET
  829. // async: false, //或false,是否异步
  830. // data: params,
  831. // timeout: 5000, //超时时间
  832. // dataType: "json", //返回的数据格式:
  833. // beforeSend: function (xhr) {},
  834. // success: function (res, textStatus, jqXHR) {
  835. // if (res[0].length > 0) {
  836. // _this.$message.error("有学生手机号码已被注册");
  837. // _a = 1;
  838. // }
  839. // },
  840. // error: function (xhr, textStatus) {
  841. // console.log(textStatus);
  842. // },
  843. // complete: function () {},
  844. // });
  845. // if (_a == 1) {
  846. // _b = 1;
  847. // break;
  848. // }
  849. // }
  850. // if (item.mail != "") {
  851. // let params = { un: item.mail };
  852. // let _a;
  853. // _$.ajax({
  854. // url: _this.$store.state.api + "findMail", //url路径
  855. // type: "GET", //GET
  856. // async: false, //或false,是否异步
  857. // data: params,
  858. // timeout: 5000, //超时时间
  859. // dataType: "json", //返回的数据格式:
  860. // beforeSend: function (xhr) {},
  861. // success: function (res, textStatus, jqXHR) {
  862. // if (res[0].length > 0) {
  863. // _this.$message.error("有学生账号已被注册");
  864. // _a = 1;
  865. // }
  866. // },
  867. // error: function (xhr, textStatus) {
  868. // console.log(textStatus);
  869. // },
  870. // complete: function () {},
  871. // });
  872. // if (_a == 1) {
  873. // _b = 1;
  874. // break;
  875. // }
  876. // }
  877. // if (item.sId != "") {
  878. // let params = { un: item.sId };
  879. // let _a;
  880. // _$.ajax({
  881. // url: _this.$store.state.api + "findSid", //url路径
  882. // type: "GET", //GET
  883. // async: false, //或false,是否异步
  884. // data: params,
  885. // timeout: 5000, //超时时间
  886. // dataType: "json", //返回的数据格式:
  887. // beforeSend: function (xhr) {},
  888. // success: function (res, textStatus, jqXHR) {
  889. // if (res[0].length > 0) {
  890. // _this.$message.error("有学生学号重复");
  891. // _a = 1;
  892. // }
  893. // },
  894. // error: function (xhr, textStatus) {
  895. // console.log(textStatus);
  896. // },
  897. // complete: function () {},
  898. // });
  899. // if (_a == 1) {
  900. // _b = 1;
  901. // break;
  902. // }
  903. // }
  904. // _b = 2;
  905. // }
  906. // }
  907. // if (_b == 2) {
  908. // for (var i = 0; i < arr.length; i++) {
  909. // let _i = i;
  910. // let item = arr[i];
  911. // let params = [
  912. // {
  913. // alias: item.name,
  914. // username: item.mail,
  915. // userpassword: 123456,
  916. // oid: _this.oid,
  917. // ph: item.phone,
  918. // cid: item.class,
  919. // },
  920. // ];
  921. // _this.ajax
  922. // .post(_this.$store.state.api + "batchRegistration", params)
  923. // .then((res) => {
  924. // let params = [
  925. // {
  926. // userid: res.data.uid,
  927. // username: item.name,
  928. // sId: item.sId,
  929. // type: 2,
  930. // oid: res.data.oid,
  931. // phone: res.data.ph ? res.data.ph : "",
  932. // cid: res.data.cid ? res.data.cid : "",
  933. // intro: "",
  934. // sex: "0",
  935. // },
  936. // ];
  937. // _this.ajax
  938. // .post(_this.$store.state.api + "updateUserByEdu", params)
  939. // .then((res) => {
  940. // console.log(res);
  941. // })
  942. // .catch((err) => {
  943. // console.error(err);
  944. // });
  945. // loading.close();
  946. // // _this.$message({
  947. // // message: "新增成功",
  948. // // type: "success",
  949. // // });
  950. // _this.getStudent();
  951. // // if (_i == arr.length - 1) {
  952. // // loading.close();
  953. // // _this.$message({
  954. // // message: "上传成功",
  955. // // type: "success",
  956. // // });
  957. // // _this.getStudent();
  958. // // }
  959. // })
  960. // .catch((err) => {
  961. // _this.$message.error("上传失败");
  962. // console.error(err);
  963. // });
  964. // }
  965. // } else {
  966. // loading.close();
  967. //#endregion
  968. }
  969. if(_b == 2){
  970. _this.fileListUpload = [];
  971. loading.close();
  972. return
  973. }
  974. let z = 2;
  975. let newArr = JSON.stringify(arr);
  976. let params = [
  977. {
  978. arr: newArr,
  979. userpassword: 'Coco1234',
  980. oid: _this.oid,
  981. },
  982. ];
  983. _this.ajax
  984. .post(_this.$store.state.api + "batchRegistrationMore", params)
  985. .then((res) => {
  986. if (res.data.type == 1) {
  987. _this.$message.error("有学生手机号码已被注册");
  988. z = 1;
  989. }
  990. if (res.data.type == 2) {
  991. _this.$message.error("有学生账号已被注册");
  992. z = 1;
  993. }
  994. if (res.data.type == 3) {
  995. _this.$message.error("有学生学号重复");
  996. z = 1;
  997. }
  998. if (z == 2) {
  999. _this.$message({
  1000. message: "新增成功",
  1001. type: "success",
  1002. });
  1003. _this.getStudent();
  1004. }
  1005. loading.close();
  1006. })
  1007. .catch((err) => {
  1008. console.error(err);
  1009. });
  1010. _this.fileListUpload = [];
  1011. };
  1012. reader.readAsArrayBuffer(f);
  1013. };
  1014. if (rABS) {
  1015. reader.readAsArrayBuffer(f);
  1016. } else {
  1017. reader.readAsBinaryString(f);
  1018. }
  1019. },
  1020. getSchoolName() {
  1021. let params = {
  1022. oid: this.oid,
  1023. };
  1024. this.ajax
  1025. .get(this.$store.state.api + "selectSchoolName2", params)
  1026. .then((res) => {
  1027. this.schoolName = res.data[0][0].name;
  1028. const cleanedSchoolName = res.data[0][0].name.replace(/[,。;:!“”‘’()()]/g, ''); // 去掉标点符号
  1029. console.log(pinyin);
  1030. console.log(pinyin.getFullChars(cleanedSchoolName));
  1031. console.log(pinyin.getCamelChars(cleanedSchoolName));
  1032. this.schoolChar = pinyin.getCamelChars(cleanedSchoolName).toLowerCase()
  1033. })
  1034. .catch((err) => {
  1035. console.error(err);
  1036. });
  1037. },
  1038. deleteStudent(id, state) {
  1039. state = 0;
  1040. let params = [{ uid: id, state: state }];
  1041. this.$confirm("确定" + "删除" + "此学生吗?", "提示", {
  1042. confirmButtonText: "确定",
  1043. cancelButtonText: "取消",
  1044. type: "warning",
  1045. })
  1046. .then(() => {
  1047. this.ajax
  1048. .post(this.$store.state.api + "deleteStudent", params)
  1049. .then((res) => {
  1050. this.$message({
  1051. message: "操作成功",
  1052. type: "success",
  1053. });
  1054. this.getStudent();
  1055. })
  1056. .catch((err) => {
  1057. this.$message.error("操作失败");
  1058. console.error(err);
  1059. });
  1060. })
  1061. .catch(() => { });
  1062. },
  1063. iniPassword(id) {
  1064. this.$confirm("确定" + "初始化" + "此学生的密码吗?", "提示", {
  1065. confirmButtonText: "确定",
  1066. cancelButtonText: "取消",
  1067. type: "warning",
  1068. })
  1069. .then(() => {
  1070. let params = [
  1071. {
  1072. uid: id,
  1073. pa: 'Coco1234',
  1074. },
  1075. ];
  1076. this.ajax
  1077. .post(this.$store.state.api + "iniPassword", params)
  1078. .then((res) => {
  1079. this.$message({
  1080. message: "初始化密码成功!",
  1081. type: "success",
  1082. });
  1083. })
  1084. .catch((err) => {
  1085. console.error(err);
  1086. });
  1087. })
  1088. .catch(() => { });
  1089. },
  1090. updateStudentA(res) {
  1091. this.userinfo = JSON.parse(JSON.stringify(res));
  1092. this.userinfoA = JSON.parse(JSON.stringify(res));
  1093. this.userinfo.classid = this.userinfo.classid.split(",");
  1094. this.dialogVisibleUpdate = true;
  1095. },
  1096. updateStudent() {
  1097. if (this.userinfo.name === "") {
  1098. this.$message.error("学生姓名不能为空");
  1099. return;
  1100. } else if (!this.userinfo.classid) {
  1101. this.$message.error("请为学生选择班级");
  1102. return;
  1103. } else if (
  1104. this.userinfo.phonenumber &&
  1105. !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
  1106. ) {
  1107. this.$message.error("手机号格式不正确");
  1108. return;
  1109. } else if (
  1110. !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
  1111. this.userinfo.un
  1112. )
  1113. ) {
  1114. this.$message.error("邮箱格式不正确");
  1115. return;
  1116. }
  1117. if (this.time()) {
  1118. if (this.userinfoA.un != this.userinfo.un) {
  1119. let params = { un: this.userinfo.un };
  1120. this.ajax
  1121. .get(this.$store.state.api + "findMail", params)
  1122. .then((res) => {
  1123. if (res.data[0].length > 0) {
  1124. this.$message.error("此学生账号已被注册");
  1125. } else {
  1126. this.update_Student();
  1127. }
  1128. })
  1129. .catch((err) => {
  1130. console.error(err);
  1131. });
  1132. } else {
  1133. this.update_Student();
  1134. }
  1135. }
  1136. },
  1137. update_Student() {
  1138. let params = [
  1139. {
  1140. userid: this.userinfo.userid,
  1141. username: this.userinfo.un,
  1142. alias: this.userinfo.name,
  1143. ph: this.userinfo.phonenumber,
  1144. sid: this.userinfo.studentid,
  1145. cid: this.userinfo.classid.join(","),
  1146. },
  1147. ];
  1148. this.ajax
  1149. .post(this.$store.state.api + "updateStudentInfo", params)
  1150. .then((res) => {
  1151. this.$message({
  1152. message: "修改成功",
  1153. type: "success",
  1154. });
  1155. this.dialogVisibleUpdate = false;
  1156. this.getStudent();
  1157. })
  1158. .catch((err) => {
  1159. this.isLoading = false;
  1160. this.$message({
  1161. message: "修改失败",
  1162. type: "error",
  1163. });
  1164. console.error(err);
  1165. });
  1166. },
  1167. },
  1168. created() {
  1169. this.page = 1;
  1170. this.getStudent();
  1171. this.getSchoolName();
  1172. this.getClass();
  1173. },
  1174. };
  1175. </script>
  1176. <style scoped>
  1177. .pb_head>span:nth-child(2) {
  1178. font-size: 20px;
  1179. margin-left: 5px;
  1180. color: #828282;
  1181. }
  1182. .pb_head {
  1183. margin: 0 !important;
  1184. width: 100% !important;
  1185. }
  1186. .student_page {
  1187. margin-top: 10px;
  1188. display: flex;
  1189. justify-content: flex-end;
  1190. }
  1191. .student_head {
  1192. margin-top: 10px;
  1193. padding-bottom: 10px;
  1194. display: flex;
  1195. justify-content: space-between;
  1196. }
  1197. .head_left {
  1198. display: flex;
  1199. align-items: center;
  1200. line-height: 40px;
  1201. }
  1202. .head_right {
  1203. display: flex;
  1204. flex-direction: row;
  1205. flex-wrap: nowrap;
  1206. align-items: center;
  1207. }
  1208. .student_input>>>.el-input__inner {
  1209. height: 30px;
  1210. width: 190px;
  1211. font-size: 13px;
  1212. padding: 0 10px;
  1213. }
  1214. .student_button {
  1215. color: #fff;
  1216. background: #2268bc;
  1217. width: 60px;
  1218. height: 30px;
  1219. padding: 0 !important;
  1220. font-size: 12px;
  1221. line-height: 30px;
  1222. }
  1223. .head_right>button:nth-child(1) {
  1224. color: #fff;
  1225. background: #2268bc;
  1226. width: 70px;
  1227. height: 30px;
  1228. padding: 0 !important;
  1229. font-size: 12px;
  1230. line-height: 30px;
  1231. }
  1232. .head_right>button:nth-child(2) {
  1233. color: #fff;
  1234. background: #2268bc;
  1235. width: 70px;
  1236. height: 30px;
  1237. padding: 0 !important;
  1238. font-size: 12px;
  1239. line-height: 30px;
  1240. }
  1241. .head_right>div {
  1242. font-size: 12px;
  1243. line-height: 40px;
  1244. margin-left: 10px;
  1245. color: #2a6dbe;
  1246. text-decoration: underline;
  1247. cursor: pointer;
  1248. }
  1249. .student_table>>>.el-table--border td {
  1250. border-right: 0px !important;
  1251. }
  1252. .student_table>>>.el-table,
  1253. .student_table>>>.el-table__body-wrapper {
  1254. height: auto !important;
  1255. }
  1256. .el-table>>>.even_row {
  1257. background-color: #f1f1f1 !important;
  1258. }
  1259. .de_button {
  1260. color: #fff;
  1261. background: #5190fd;
  1262. width: 50px;
  1263. height: 25px;
  1264. padding: 0 !important;
  1265. font-size: 12px;
  1266. line-height: 25px;
  1267. }
  1268. .add_student>>>.el-dialog__header {
  1269. padding: 20px 20px 10px;
  1270. text-align: center;
  1271. background: #32455b;
  1272. }
  1273. .add_student>>>.el-dialog__title {
  1274. font-size: 14px !important;
  1275. color: #fff !important;
  1276. }
  1277. .add_student>>>.el-dialog__headerbtn {
  1278. font-size: 20px !important;
  1279. }
  1280. .add_student>>>.el-form-item__label {
  1281. margin-left: 65px;
  1282. }
  1283. .add_student>>>.el-form-item {
  1284. display: flex;
  1285. }
  1286. .add_student>>>.el-form-item__content {
  1287. margin: 0 !important;
  1288. }
  1289. .add_input {
  1290. width: 365px;
  1291. }
  1292. .add_student>>>.el-dialog__footer {
  1293. text-align: center !important;
  1294. }
  1295. .right {
  1296. width: 250px;
  1297. color: #fff;
  1298. background: #0e72e6;
  1299. margin-bottom: 20px;
  1300. }
  1301. .header-title {
  1302. display: flex;
  1303. }
  1304. .logoImg {
  1305. width: 30px;
  1306. }
  1307. .logoImg>img {
  1308. width: 100%;
  1309. height: 100%;
  1310. }
  1311. .title_add_student {
  1312. margin: 0 auto;
  1313. color: #fff;
  1314. }
  1315. .upload-demo {
  1316. line-height: 0px !important;
  1317. }
  1318. .upload-demo>>>.el-button {
  1319. color: #fff;
  1320. background: #2268bc;
  1321. width: 70px;
  1322. height: 30px;
  1323. padding: 0 !important;
  1324. font-size: 12px;
  1325. line-height: 0 !important;
  1326. }
  1327. .userImg {
  1328. display: flex;
  1329. flex-direction: row;
  1330. justify-content: center;
  1331. align-items: center;
  1332. }
  1333. .tx {
  1334. width: 40px;
  1335. margin-right: 10px;
  1336. }
  1337. .delete {
  1338. width: 25px;
  1339. height: 25px;
  1340. cursor: pointer;
  1341. margin-left: 10px;
  1342. }
  1343. .tx>img,
  1344. .delete>img {
  1345. width: 100%;
  1346. height: 100%;
  1347. }
  1348. .newCss {
  1349. display: flex;
  1350. flex-direction: row;
  1351. flex-wrap: nowrap;
  1352. align-items: baseline;
  1353. }
  1354. .student_input.el-input {
  1355. width: auto;
  1356. }
  1357. .student_input {
  1358. margin-right: 10px;
  1359. }
  1360. .student_input>>>.el-input__icon {
  1361. line-height: unset;
  1362. }
  1363. .btnBox {
  1364. display: flex;
  1365. align-items: center;
  1366. }
  1367. .sub_head {
  1368. position: relative;
  1369. }
  1370. .sub_head::after {
  1371. content: "";
  1372. width: 100%;
  1373. background: #5a9cea;
  1374. height: 2px;
  1375. position: absolute;
  1376. left: 0;
  1377. bottom: -10px;
  1378. }
  1379. .subClick {
  1380. /* font-size: 16px; */
  1381. font-size: 26px;
  1382. cursor: pointer;
  1383. /* margin-left: 17.5px; */
  1384. /* color: #ab582f; */
  1385. /* color: #409eff; */
  1386. color: #999;
  1387. }
  1388. .subClick:hover {
  1389. color: #000;
  1390. }
  1391. .sub_head+.subClick,
  1392. .subClick+.subClick,
  1393. .subClick+.sub_head {
  1394. margin-left: 17.5px;
  1395. }
  1396. .pb_content_body {
  1397. width: 100% !important;
  1398. }
  1399. .sm_box {
  1400. display: flex;
  1401. width: calc(100% - 20px);
  1402. margin: 0 auto;
  1403. padding: 0 90px;
  1404. box-sizing: border-box;
  1405. }
  1406. .sm_right {
  1407. width: 100%;
  1408. /* margin-left: 210px; */
  1409. }
  1410. .sm_left {
  1411. width: 200px;
  1412. background: #fff;
  1413. height: calc(100vh - 20px);
  1414. position: fixed;
  1415. left: 10px;
  1416. top: 10px;
  1417. border-radius: 5px;
  1418. overflow: hidden;
  1419. }
  1420. .nav {
  1421. height: 55px;
  1422. display: flex;
  1423. align-items: center;
  1424. justify-content: center;
  1425. cursor: pointer;
  1426. color: #777777;
  1427. transition: all .5s;
  1428. }
  1429. .nav:hover {
  1430. background: rgb(204, 204, 204);
  1431. }
  1432. .nav.active {
  1433. background: #3d67bc !important;
  1434. color: #fff;
  1435. }
  1436. .nav .icon {
  1437. width: 16px;
  1438. height: 16px;
  1439. margin-right: 5px;
  1440. background-size: 100% 100%;
  1441. }
  1442. .nav .name {}
  1443. .nav .icon.gradeI {
  1444. background-image: url(../../../../assets/icon/studentManage/grade.png);
  1445. }
  1446. .nav .icon.classI {
  1447. background-image: url(../../../../assets/icon/studentManage/class.png);
  1448. }
  1449. .nav .icon.studentI {
  1450. background-image: url(../../../../assets/icon/studentManage/student.png);
  1451. }
  1452. .nav.active .icon.gradeI {
  1453. background-image: url(../../../../assets/icon/studentManage/grade-a.png);
  1454. }
  1455. .nav.active .icon.classI {
  1456. background-image: url(../../../../assets/icon/studentManage/class-a.png);
  1457. }
  1458. .nav.active .icon.studentI {
  1459. background-image: url(../../../../assets/icon/studentManage/student-a.png);
  1460. }
  1461. </style>