addVisit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <template>
  2. <div class="addVisit">
  3. <m-header v-if="statusList.headerStatus" :name="name" />
  4. <van-cell-group>
  5. <van-field label="回访老师" v-model="teacherName" readonly input-align="right" placeholder="请选择" />
  6. </van-cell-group>
  7. <van-cell-group>
  8. <van-field label="学员姓名" @click="onCheckStudent" v-model="studentName" readonly input-align="right" :is-link="id || userId || studentId ? false : true" placeholder="请选择">
  9. <template #right-icon>
  10. <a v-if="studentPhone" @click.stop="() => {}" class="phone_section" :href="'tel:' + studentPhone"><img src="../../assets/images/icon_phone.png" class="iconPhone" alt="" /></a>
  11. </template>
  12. </van-field>
  13. <van-field label="回访类型" @click="onChange('type')" v-model="form.type" readonly input-align="right" :is-link="id || userId ? false : true" placeholder="请选择" />
  14. <van-field label="回访目的" @click="onChange('purpose')" v-model="form.purpose" readonly input-align="right" :is-link="id || userId ? false : true" placeholder="请选择" />
  15. <van-field v-if="form.type == '小课回访'" label="学员状态" @click="onChange('feedbackType')" v-model="form.feedbackTypeName" readonly input-align="right" :is-link="id ? false : true" placeholder="请选择" />
  16. <van-field v-if="form.purpose == '考勤申诉'" label="家长反馈" @click="onChange('feedbackTypeDesc')" v-model="form.feedbackTypeDescName" readonly input-align="right" :is-link="id ? false : true" placeholder="请选择" />
  17. <van-field label="问题状态" @click="onChange('probStatus')" v-model="form.probStatusName" readonly input-align="right" :is-link="id ? false : true" placeholder="请选择" />
  18. </van-cell-group>
  19. <van-cell-group v-if="form.purpose!='考勤申诉'">
  20. <div class="dot"></div>
  21. <van-field label="当前学生情况" class="textarea" :readonly="id ? true : false" v-model="form.overview" rows="2" autosize type="textarea" maxlength="400" placeholder="请输入留言" :show-word-limit="id ? false : true" />
  22. </van-cell-group>
  23. <van-cell-group v-if="!form.feedbackTypeDescName || form.feedbackTypeDescName=='其他'">
  24. <div class="dot"></div>
  25. <van-field label="沟通后家长反馈" class="textarea" :readonly="id ? true : false" v-model="form.feedback" rows="2" autosize type="textarea" maxlength="400" placeholder="请输入留言" :show-word-limit="id ? false : true" />
  26. </van-cell-group>
  27. <van-cell-group>
  28. <van-field label="回访时间" class="visiTimer" v-model="form.visitTime" readonly @click="onEnListShow" input-align="right" :is-link="id ? false : true" placeholder="请选择" />
  29. </van-cell-group>
  30. <van-cell-group v-if="(id && uploader[0] && uploader[0].url) || !id">
  31. <div class="visiWrap">
  32. <p>回访图片</p>
  33. <!-- :before-delete="beforDelete" -->
  34. <van-uploader v-model="uploader" :before-read="beforeRead" :after-read="afterRead" :disabled="id ? true : false" :deletable="!id ? true : false" accept="image/*" multiple :max-count="5" />
  35. <p class="submit" v-if="!id">上传文件大小不能超过5MB且最多上传五张</p>
  36. </div>
  37. </van-cell-group>
  38. <div class="button-group" v-if="!id">
  39. <van-button type="primary" @click="onSubmit" round size="large">确认</van-button>
  40. </div>
  41. <van-action-sheet v-model="visit.status" :actions="visit.data" cancel-text="取消" @cancel="visit.status = false" @select="onModeSelect" />
  42. <van-popup v-model="dataForm.status" position="bottom">
  43. <van-datetime-picker v-model="dataForm.currentDate" type="date" :min-date="dataForm.minDate" :max-date="dataForm.maxDate" :formatter="formatter" @cancel="dataForm.status = false" @confirm="onCurrentConfirm" />
  44. </van-popup>
  45. <!-- 选择上课学生 -->
  46. <van-popup v-model="statusList.studentStatus" :lock-scroll="true" position="bottom" :style="{ height: '180%' }">
  47. <van-sticky>
  48. <van-search show-action shape="round" :left-icon="searchIcon" @search="onSearch" v-model="params.search" placeholder="请输入学生名或手机号">
  49. <template #action>
  50. <div @click="onSearch">搜索</div>
  51. </template>
  52. </van-search>
  53. </van-sticky>
  54. <div class="paddingB80">
  55. <van-list v-model="loading" class="studentContainer" v-if="dataShow" key="data" :finished="finished" finished-text="" @load="getStudent">
  56. <van-radio-group v-model="radioSelect">
  57. <van-cell-group>
  58. <van-cell v-for="(item, index) in dataList" :key="index" @click="onCheckboxSelect(item)" class="input-cell" :center="true">
  59. <template slot="icon">
  60. <img class="logo" v-if="item.avatar" :src="item.avatar" alt="" />
  61. <img class="logo" v-else src="@/assets/images/icon_student.png" alt="" />
  62. </template>
  63. <template slot="title">
  64. <div class="studentName">
  65. {{ item.userName }}
  66. </div>
  67. </template>
  68. <template slot="label">
  69. <span>{{ desensitPhone(item.phone) }}</span>
  70. </template>
  71. <template slot="default">
  72. <van-radio :name="item.userId"></van-radio>
  73. </template>
  74. </van-cell>
  75. </van-cell-group>
  76. </van-radio-group>
  77. </van-list>
  78. <m-empty class="empty" v-else key="data" />
  79. </div>
  80. <div class="button-group-popup">
  81. <span class="btn" @click="onPopupCancel">取消</span>
  82. <span class="btn primary" @click="onPopupSubmit">确认选择</span>
  83. </div>
  84. </van-popup>
  85. </div>
  86. </template>
  87. <script>
  88. import MHeader from "@/components/MHeader";
  89. import { browser } from "@/common/common";
  90. import MEmpty from "@/components/MEmpty";
  91. import dayjs from "dayjs";
  92. import { queryStudentsWithTeacher, visitAdd, visitGetInfo, queryUserById } from "@/api/teacher";
  93. import { queryUserInfo } from "@/api/app";
  94. import { policy } from "@/views/massMessage/api";
  95. import setLoading from "@/utils/loading";
  96. import axios from "axios";
  97. export default {
  98. name: "addVisit",
  99. components: {
  100. MHeader,
  101. MEmpty,
  102. },
  103. data() {
  104. const query = this.$route.query;
  105. return {
  106. id: query.id,
  107. name: query.name,
  108. userId: query.userId, // 如果有userId的时候说明是从评测详情进来的
  109. studentId: query.studentId, // 这个参数是从原生传过来的,单独做了处理
  110. beforeId: query.beforeId, // 如果有beforeId的时候说明是从待回访列表进来的
  111. inside: query.inside || 0,
  112. visitFlag: Number(query.visitFlag) || 0,
  113. uploader: [],
  114. isAttError:false,
  115. dataForm: {
  116. // 时间下拉框
  117. status: false,
  118. minDate: new Date(2000, 0, 1),
  119. maxDate: new Date(),
  120. currentDate: new Date(),
  121. },
  122. statusList: {
  123. // 散状态集合
  124. headerStatus: true, // 头部是否展示
  125. studentStatus: false, // 上课学生状态
  126. },
  127. typeList: [{ name: "课程推荐" }, { name: "常规回访" }, { name: "小课回访" }, { name: "云教练" }, { name: "其它" }],
  128. visit: {
  129. status: false,
  130. type: null,
  131. data: [],
  132. },
  133. studentName: query.username || null,
  134. studentPhone: query.phone || null,
  135. teacherName: null,
  136. form: {
  137. teacherId: null,
  138. studentId: query.userId || query.studentId || query.beforeId || null,
  139. type: query.userId ? "云教练" : query.beforeId ? "常规回访" : null,
  140. purpose: query.userId ? "体验回访" : query.beforeId ? "教学内容未达标" : null,
  141. overview: "",
  142. feedback: "",
  143. visitTime: query.userId || query.id || query.beforeId ? dayjs().format("YYYY年MM月DD日") : null,
  144. visiterType: "TEACHER",
  145. feedbackTypeDesc: "",
  146. feedbackType: "",
  147. probStatus: 0,
  148. probStatusName:'待跟进',
  149. objectId:''
  150. },
  151. loading: false,
  152. finished: false,
  153. params: {
  154. search: null,
  155. page: 1,
  156. rows: 20,
  157. },
  158. dataShow: true, // 是否有数据
  159. radioSelect: null,
  160. radioSelectName: null,
  161. radioSelectPhone: null,
  162. clickStatus: false,
  163. dataList: [],
  164. searchIcon: require("@/assets/images/search.png"),
  165. // ossUploadUrl: "https://ks3-cn-beijing.ksyuncs.com/daya",
  166. ossUploadUrl: "https://daya.ks3-cn-beijing.ksyuncs.com",
  167. dataObj: {
  168. policy: "",
  169. signature: "",
  170. key: "",
  171. KSSAccessKeyId: "",
  172. acl: "public-read",
  173. name: "",
  174. },
  175. feedbackTypeList: [
  176. { name: "在读", value: "NORMAL" },
  177. { name: "暂停", value: "PAUSE" },
  178. { name: "沉睡", value: "SLEEPY" },
  179. { name: "流失", value: "LOST" },
  180. { name: "假期上课", value: "HOLIDAY_COURSE" },
  181. ],
  182. feedbackTypeDescList: [{ name: "生病", value: "SICK" }, { name: "有事", value: "SOMETHING" }, { name: "不想参加", value: "NO_PARTICIPATE" }, { name: "其他", value: "OTHER" }],
  183. probStatusList: [
  184. { name: "已解决", value: 1 },
  185. { name: "待跟进", value: 0 },
  186. ],
  187. };
  188. },
  189. mounted() {
  190. let params = this.$route.query;
  191. if (params.Authorization) {
  192. localStorage.setItem("Authorization", decodeURI(params.Authorization));
  193. localStorage.setItem("userInfo", decodeURI(params.Authorization));
  194. }
  195. if (browser().android || browser().iPhone) {
  196. this.statusList.headerStatus = false;
  197. }
  198. if(params.isAttError){
  199. this.isAttError = params.isAttError
  200. this.studentName= params.info.username || null;
  201. // studentPhone: params.phone || null,
  202. this.form.studentId = params.info.userId || null;
  203. this.form.type = params.info.type
  204. this.form.purpose = params.info.purpose
  205. this.form.objectId = params.info.objectId
  206. }
  207. document.title = this.name || "新增回访记录";
  208. this.__init();
  209. },
  210. methods: {
  211. async __init() {
  212. let res = await queryUserInfo();
  213. let result = res.data;
  214. if (res.status == 200) {
  215. this.teacherName = result.realName;
  216. this.form.teacherId = result.id;
  217. } else {
  218. this.$toast(res.msg);
  219. }
  220. if (this.id) {
  221. setLoading(true);
  222. let queryInfo = await visitGetInfo({ id: this.id });
  223. const queryResult = queryInfo.data;
  224. let form = this.form;
  225. setLoading(false);
  226. if (queryResult.code == 200) {
  227. let tempData = queryResult.data;
  228. this.studentName = tempData.studentName;
  229. form.studentId = tempData.studentId;
  230. form.type = tempData.type;
  231. form.purpose = tempData.purpose;
  232. form.overview = tempData.overview;
  233. form.feedback = tempData.feedback;
  234. form.visitTime = dayjs(tempData.visitTime).format("YYYY年MM月DD日");
  235. form.visiterType = tempData.visiterType;
  236. form.feedbackType = tempData.feedbackType;
  237. form.feedbackTypeDesc = tempData.feedbackTypeDesc;
  238. form.probStatus = tempData.probStatus;
  239. if (form.feedbackType) {
  240. form.feedbackTypeName = "";
  241. this.feedbackTypeList.forEach((item) => {
  242. if (item.value == form.feedbackType) {
  243. form.feedbackTypeName = item.name;
  244. }
  245. });
  246. }
  247. if (form.feedbackTypeDesc) {
  248. form.feedbackTypeDescName = "";
  249. this.feedbackTypeDescList.forEach((item) => {
  250. if (item.value == form.feedbackTypeDesc) {
  251. form.feedbackTypeDescName = item.name;
  252. }
  253. });
  254. }
  255. if (form.probStatus) {
  256. form.probStatusName = "已解决";
  257. } else {
  258. form.probStatusName = "待跟进";
  259. }
  260. /**
  261. * form.feedbackTypeDescName = null;
  262. form.feedbackTypeDesc = null;
  263. form.probStatus = null;
  264. form.probStatusName = null;
  265. form.feedbackTypeDescName = null;
  266. form.feedbackTypeDesc = null;
  267. */
  268. form.probStatus = tempData.probStatus;
  269. let attrList = tempData.attachments.split(",");
  270. this.uploader = attrList.map((item) => {
  271. return { url: item };
  272. });
  273. // console.log(this.uploader);
  274. } else {
  275. this.$toast(res.msg);
  276. }
  277. }
  278. let userId = this.userId || this.studentId || this.beforeId;
  279. if (userId) {
  280. await queryUserById({ userId }).then((res) => {
  281. let result = res.data;
  282. this.studentPhone = result.phone;
  283. this.studentName = result.username;
  284. });
  285. }
  286. },
  287. async onSubmit() {
  288. let form = this.form;
  289. if (!form.studentId) {
  290. this.$toast("请选择学员");
  291. return;
  292. } else if (!form.type) {
  293. this.$toast("请选择回访类型");
  294. return;
  295. } else if (!form.purpose) {
  296. this.$toast("请选择回访目的");
  297. return;
  298. } else if (!form.visitTime) {
  299. this.$toast("请选择回访时间");
  300. return;
  301. } else if (!form.feedbackType && form.type == "小课回访") {
  302. this.$toast("请选择学员状态");
  303. return;
  304. } else if (!form.feedbackTypeDesc && form.purpose == "考勤申诉") {
  305. this.$toast("请选择家长反馈");
  306. return;
  307. } else if (!(form.probStatus+'')) {
  308. this.$toast("请选择问题状态");
  309. return;
  310. }else if(!form.feedback&&form.feedbackTypeDesc=='OTHER'){
  311. this.$toast("请填写家长反馈");
  312. return
  313. }
  314. if (this.clickStatus) {
  315. return;
  316. }
  317. this.clickStatus = true;
  318. setLoading(true);
  319. // let visitTime = this.form.visitTime.replace(/[^\d]/g,'/');
  320. // let someDate = new Date(visitTime)
  321. let visitTime = dayjs(this.dataForm.currentDate).format("YYYY-MM-DD");
  322. let attachmentsList = this.uploader.map((item) => {
  323. return item.url;
  324. });
  325. let params = {
  326. ...form,
  327. visitTime,
  328. attachments: attachmentsList.join(","),
  329. };
  330. // 待回访时要传的参数
  331. if (this.beforeId) {
  332. params.objectId = this.$route.query.objectId;
  333. }
  334. let res = await visitAdd({ ...params });
  335. let result = res.data;
  336. setLoading(false);
  337. if (result.code == 200) {
  338. this.$toast("添加成功");
  339. setTimeout(() => {
  340. if (this.inside) {
  341. this.onAppBack();
  342. }else if(this.isAttError){
  343. this.$router.back()
  344. } else if (this.userId) {
  345. let { visitFlag, ...query } = this.$route.query;
  346. visitFlag = 0;
  347. this.$router.replace({
  348. path: "/trainDetail",
  349. query: {
  350. ...query,
  351. visitFlag,
  352. },
  353. });
  354. } else if (this.beforeId) {
  355. let { ...query } = this.$route.query;
  356. this.$router.replace({
  357. path: "/visitList",
  358. query: {
  359. userId: this.beforeId,
  360. ...query,
  361. },
  362. });
  363. } else {
  364. this.$router.replace("visitList");
  365. }
  366. }, 800);
  367. } else {
  368. this.$toast(result.msg);
  369. this.clickStatus = false;
  370. return;
  371. }
  372. },
  373. onAppBack() {
  374. if (browser().android) {
  375. DAYA.postMessage(JSON.stringify({ api: "back" }));
  376. } else if (browser().iPhone) {
  377. window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({ api: "back" }));
  378. }
  379. },
  380. onCheckStudent() {
  381. if (this.id || this.userId || this.studentId || this.beforeId || this.isAttError) {
  382. return;
  383. }
  384. this.statusList.studentStatus = true;
  385. },
  386. onChange(type) {
  387. if (this.id) {
  388. return;
  389. }
  390. if ((this.userId || this.beforeId) && type != "probStatus") {
  391. return;
  392. }
  393. if(this.isAttError && (type=='type' || type=='purpose')){
  394. return
  395. }
  396. let visit = this.visit;
  397. let form = this.form;
  398. if (type == "type") {
  399. visit.data = this.typeList;
  400. } else if (type == "purpose") {
  401. if (form.type == "其它") {
  402. visit.data = [{ name: "其它" }, { name: "会员续费" }];
  403. } else if (form.type == "课程推荐") {
  404. visit.data = [{ name: "新课推荐" }, { name: "续费提醒" }];
  405. } else if (form.type == "常规回访") {
  406. visit.data = [{ name: "课后及作业回访" }, { name: "练习及乐团表现" }, { name: "考勤申诉" }, { name: "异常请假回访" }];
  407. } else if (form.type == "小课回访") {
  408. visit.data = [{ name: "续费类回访" }, { name: "服务回访" }, { name: "其他" }];
  409. } else if (form.type == "云教练") {
  410. visit.data = [{ name: "体验回访" }];
  411. } else {
  412. this.$toast("请选择回访类型");
  413. return;
  414. }
  415. } else if (type == "feedbackType") {
  416. visit.data = this.feedbackTypeList;
  417. } else if (type == "feedbackTypeDesc") {
  418. visit.data = this.feedbackTypeDescList;
  419. } else if (type == "probStatus") {
  420. visit.data = this.probStatusList;
  421. }
  422. visit.status = true;
  423. visit.type = type;
  424. },
  425. onSearch() {
  426. this.params.page = 1;
  427. this.dataList = [];
  428. this.dataShow = true;
  429. this.loading = true;
  430. this.finished = false;
  431. this.getStudent();
  432. },
  433. onCheckboxSelect(item) {
  434. this.radioSelect = item.userId;
  435. this.radioSelectName = item.userName;
  436. this.radioSelectPhone = item.phone;
  437. },
  438. onPopupCancel() {
  439. this.statusList.studentStatus = false;
  440. },
  441. onPopupSubmit() {
  442. this.form.studentId = this.radioSelect;
  443. this.studentName = this.radioSelectName;
  444. this.studentPhone = this.radioSelectPhone;
  445. this.statusList.studentStatus = false;
  446. },
  447. onCurrentConfirm(value) {
  448. if (value) {
  449. this.form.visitTime = dayjs(value).format("YYYY年MM月DD日");
  450. }
  451. this.dataForm.status = false;
  452. },
  453. onEnListShow() {
  454. // 从云教练统计来的,不许改时间,默认当前时间
  455. if (this.id || this.visitFlag) {
  456. return;
  457. }
  458. this.dataForm.status = true;
  459. },
  460. getStudent() {
  461. let params = this.params;
  462. queryStudentsWithTeacher(params).then((res) => {
  463. let result = res.data;
  464. this.loading = false;
  465. if (result.code == 200 && result.data) {
  466. params.page = result.data.pageNo;
  467. this.dataList = this.dataList.concat(result.data.rows);
  468. if (params.page >= result.data.totalPage) {
  469. this.finished = true;
  470. }
  471. this.params.page++;
  472. } else {
  473. this.finished = true;
  474. }
  475. // 判断是否有数据
  476. if (this.dataList.length <= 0) {
  477. this.dataShow = false;
  478. }
  479. });
  480. },
  481. onModeSelect(value) {
  482. let visit = this.visit;
  483. let form = this.form;
  484. if (visit.type == "type") {
  485. form.type = value.name;
  486. form.purpose = null;
  487. form.feedbackTypeDescName = null;
  488. form.feedbackTypeDesc = null;
  489. // form.probStatus = 0;
  490. // form.probStatusName = null;
  491. form.feedbackTypeDescName = null;
  492. form.feedbackTypeDesc = null;
  493. } else if (visit.type == "purpose") {
  494. form.purpose = value.name;
  495. } else if (visit.type == "feedbackType") {
  496. form.feedbackType = value.value;
  497. form.feedbackTypeName = value.name;
  498. } else if (visit.type == "feedbackTypeDesc") {
  499. form.feedbackTypeDescName = value.name;
  500. form.feedbackTypeDesc = value.value;
  501. form.feedback = ''
  502. } else if (visit.type == "probStatus") {
  503. form.probStatus = value.value;
  504. form.probStatusName = value.name;
  505. }
  506. visit.status = false;
  507. },
  508. formatter(type, value) {
  509. if (type === "year") {
  510. return `${value}年`;
  511. } else if (type === "month") {
  512. return `${value}月`;
  513. } else if (type === "day") {
  514. return `${value}日`;
  515. }
  516. return value;
  517. },
  518. desensitPhone(phone) {
  519. // 手机号脱敏
  520. let first = phone.substr(0, 3);
  521. let last = phone.substr(-4);
  522. return first + "****" + last;
  523. },
  524. beforeRead(file) {
  525. if (file.length) {
  526. file.map((item) => {
  527. const isLt2M = item.size / 1000 / 1000 < 5;
  528. if (!isLt2M) {
  529. this.$toast("上传文件大小不能超过 5MB");
  530. return false;
  531. }
  532. });
  533. } else {
  534. const isLt2M = file.size / 1000 / 1000 < 5;
  535. if (!isLt2M) {
  536. this.$toast("上传文件大小不能超过 5MB");
  537. return false;
  538. }
  539. }
  540. return true;
  541. },
  542. async uploadFile(file) {
  543. // console.log("uploadFile", file);
  544. try {
  545. file.status = "uploading";
  546. file.message = "上传中...";
  547. let tempName = file.file.name || "";
  548. const fileName = tempName && tempName.replace(/ /gi, "_");
  549. let key = new Date().getTime() + fileName;
  550. let objTemp = {
  551. filename: fileName,
  552. bucketName: this.bucket_name,
  553. postData: {
  554. filename: fileName,
  555. acl: "public-read",
  556. key: key,
  557. unknowValueField: [],
  558. },
  559. };
  560. const res = await policy(objTemp);
  561. const obj = {
  562. policy: res.data.policy,
  563. signature: res.data.signature,
  564. key: key,
  565. KSSAccessKeyId: res.data.kssAccessKeyId,
  566. acl: "public-read",
  567. name: fileName,
  568. };
  569. let formData = new FormData();
  570. for (let key in obj) {
  571. formData.append(key, obj[key]);
  572. }
  573. formData.append("file", file.file);
  574. // console.log(formData);
  575. await axios({
  576. method: "post",
  577. url: this.ossUploadUrl,
  578. data: formData,
  579. });
  580. const uploadUrl = this.ossUploadUrl + "/" + key;
  581. file.url = uploadUrl;
  582. file.status = "done";
  583. } catch (e) {
  584. console.log(e);
  585. file.status = "failed";
  586. file.message = "上传失败";
  587. this.uploader = [];
  588. }
  589. },
  590. async afterRead(file) {
  591. // 上传头像
  592. const form = this.form;
  593. try {
  594. if (file && file.length) {
  595. file.forEach((item) => {
  596. this.uploadFile(item);
  597. });
  598. } else {
  599. this.uploadFile(file);
  600. }
  601. } catch (e) {
  602. console.log(e);
  603. return false;
  604. }
  605. // this.$toast.loading({
  606. // duration: 0,
  607. // forbidClick: true,
  608. // message: "上传中...",
  609. // });
  610. //
  611. // try {
  612. // file.status = "uploading";
  613. // file.message = "上传中...";
  614. // let formData = new FormData();
  615. // formData.append("file", file.file);
  616. // let res = await uploadFile(formData);
  617. // this.$toast.clear();
  618. // let result = res.data;
  619. // if (result.code == 200) {
  620. // file.status = "done";
  621. // form.fileName = file.file.name;
  622. // form.fileUrl = result.data.url;
  623. // form.messageType = this.onCheckFileType(file.file.type);
  624. // } else {
  625. // file.status = "failed";
  626. // file.message = "上传失败";
  627. // this.$toast(result.msg);
  628. // form.fileName = "";
  629. // form.fileUrl = "";
  630. // return false;
  631. // }
  632. // } catch (err) {
  633. // this.$toast.clear();
  634. // file.status = "failed";
  635. // file.message = "上传失败";
  636. // form.fileName = "";
  637. // form.fileUrl = "";
  638. // return false;
  639. // }
  640. },
  641. },
  642. };
  643. </script>
  644. <style lang="less" scoped>
  645. @import url("../../assets/commonLess/variable.less");
  646. /deep/.van-popup--bottom {
  647. border-radius: 0px 0px 0px 0px !important;
  648. overflow: auto !important;
  649. }
  650. .addVisit {
  651. min-height: 100vh;
  652. }
  653. .vip-title {
  654. padding: 0.06rem 0.14rem 0.04rem;
  655. font-size: 0.14rem;
  656. color: #808080;
  657. }
  658. /deep/.van-cell-group {
  659. margin-bottom: 0.1rem;
  660. }
  661. /deep/.van-cell {
  662. display: flex;
  663. align-items: center;
  664. font-size: 0.16rem;
  665. line-height: 0.28rem;
  666. }
  667. /deep/.van-field__label,
  668. /deep/.van-cell__value {
  669. flex: 1 auto;
  670. }
  671. /deep/.van-field__word-limit {
  672. margin-top: 0px;
  673. position: absolute;
  674. top: -0.2rem;
  675. right: 5px;
  676. font-size: 0.14rem;
  677. }
  678. /deep/.van-field__control:disabled {
  679. color: #6a6969;
  680. }
  681. .textarea {
  682. display: flex;
  683. flex-direction: column;
  684. align-items: inherit;
  685. padding: 0.1rem 0.21rem;
  686. /deep/.van-field__label {
  687. width: 100%;
  688. }
  689. // /deep/.van-field__value {
  690. // border: 1px solid #ccc;
  691. // }
  692. }
  693. .button-group {
  694. margin: 0.3rem 0.26rem 0.2rem;
  695. .van-button--primary {
  696. background: @mColor;
  697. border: 1px solid @mColor;
  698. font-size: 0.18rem;
  699. height: 0.5rem;
  700. }
  701. }
  702. .studentContainer {
  703. /deep/.van-cell__title {
  704. font-size: 0.14rem;
  705. color: @mFontColor;
  706. // flex: 1 auto;
  707. }
  708. .logo {
  709. width: 0.42rem;
  710. height: 0.42rem;
  711. margin-right: 0.12rem;
  712. border-radius: 100%;
  713. }
  714. .input-cell {
  715. padding: 0.2rem 0.16rem;
  716. .van-radio {
  717. justify-content: flex-end;
  718. }
  719. }
  720. /deep/.van-cell__value {
  721. height: 0.2rem;
  722. }
  723. /deep/.van-radio__icon .van-icon {
  724. border-color: #d3d3d3;
  725. }
  726. /deep/.van-radio__icon--checked {
  727. .van-icon {
  728. border-color: @mColor;
  729. background: @mColor;
  730. }
  731. }
  732. .van-tag {
  733. margin-left: 0.08rem;
  734. }
  735. }
  736. /deep/.van-field__right-icon,
  737. .phone_section {
  738. display: flex;
  739. }
  740. .iconPhone {
  741. width: 0.17rem;
  742. height: 0.21rem;
  743. }
  744. .paddingB80 {
  745. padding-bottom: 0.8rem;
  746. }
  747. .button-group-popup {
  748. position: fixed;
  749. bottom: 0;
  750. padding: 0.2rem 0;
  751. width: 100%;
  752. text-align: center;
  753. background-color: #ffffff;
  754. .btn {
  755. line-height: 0.5rem;
  756. display: inline-block;
  757. border: 1px solid @mColor;
  758. width: 1.65rem;
  759. border-radius: 0.4rem;
  760. color: @mColor;
  761. background: #fff;
  762. font-size: 0.18rem;
  763. &.primary {
  764. color: #fff;
  765. background: @mColor;
  766. }
  767. }
  768. .btn + .btn {
  769. margin-left: 0.1rem;
  770. }
  771. }
  772. .studentColor {
  773. color: @mColor;
  774. }
  775. .visiTimer {
  776. /deep/.van-field__control {
  777. color: #333333 !important;
  778. font-size: 0.16rem;
  779. }
  780. }
  781. .studentName {
  782. font-size: 0.16rem;
  783. color: #1a1a1a;
  784. line-height: 0.22rem;
  785. }
  786. .dot {
  787. width: 4px;
  788. height: 0.17rem;
  789. background: #01c1b5;
  790. border-radius: 3px;
  791. position: absolute;
  792. z-index: 200;
  793. top: 0.14rem;
  794. left: 0.12rem;
  795. }
  796. .van-icon-search {
  797. color: @mColor;
  798. }
  799. .visiWrap {
  800. padding: 10px 16px;
  801. p {
  802. font-size: 0.16rem;
  803. line-height: 0.28rem;
  804. color: #646566;
  805. margin-bottom: 0.1rem;
  806. }
  807. .submit {
  808. color: red;
  809. font-size: 0.12rem;
  810. }
  811. }
  812. </style>