conductInspections.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. <!-- 开展检查 -->
  2. <template>
  3. <view class="inspectAdd">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="list">
  6. <view class="list-li srearch">
  7. <view class="srearch-l">{{newData.subName?newData.subName:'实验室名称'}}</view>
  8. </view>
  9. <view class="list-li" style="margin-bottom: 20rpx;border:none;">
  10. <view>
  11. {{newData.roomNum?newData.roomNum:''}}房间&{{newData.buildName?newData.buildName:'楼栋'}}&{{newData.deptName?newData.deptName:'学院单位'}}
  12. </view>
  13. </view>
  14. <view class="list-li">
  15. <view>现场照片</view>
  16. </view>
  17. <view v-if="form.photoList[0]" class="check-for-img-max-box">
  18. <view class="left-title-p"></view>
  19. <view class="right-img-box">
  20. <view class="img-box" v-for="(imgUrl,imgIndex) in form.photoList" :key="imgIndex">
  21. <img class="img-data" :src="baseUrl+imgUrl.fileUrl">
  22. <img class="position-img" :src="imagesUrl('commonality/icon_ssp_closure.png')"
  23. @click="delImg(imgIndex)">
  24. </view>
  25. <!-- <img class="add-button" :src="imagesUrl('safetyCheck/img_ssp_pz@1x.png')"
  26. @click="selectImage()" v-if="form.photoList.length<6"> -->
  27. </view>
  28. </view>
  29. <view class="list-li" @click="checkItemModuleButton('open')" style="border-bottom: none;">
  30. <view> {{newData.hazardCheckCode?newData.hazardCheckCode:''}}
  31. {{newData.hazardCheckName?newData.hazardCheckName:'检查项'}}
  32. </view>
  33. <view style="color: #0183FA;">
  34. <img :src="imagesUrl('commonality/icon_wd_gd@1x.png')">
  35. </view>
  36. </view>
  37. <view class="hazardCheckNum" @click="hiddenDangerClick()">
  38. <img class="hazardCheckNum-l" :src="imagesUrl('safetyCheck/icon_aqjc_yinhuan.png')">
  39. <view class="hazardCheckNum-r">{{'已连续出现'+hazardCheckNum+'次隐患'}} </view>
  40. </view>
  41. <view class="list-li" v-if="!form.checkFlag">
  42. <view>隐患描述</view>
  43. <view></view>
  44. </view>
  45. <view class="list-button-max-box">
  46. <view class="list-button-title-box">隐患级别</view>
  47. <view class="list-button-big-box"
  48. :class="form.dangerLevel == 1?'list-button-big-box-check':''"
  49. @click="checkDangerLevel(1)">
  50. <view class="check-left-button">
  51. <view></view>
  52. </view>
  53. <view>一般隐患</view>
  54. </view>
  55. <view class="list-button-big-box"
  56. :class="form.dangerLevel == 2?'list-button-big-box-check':''"
  57. @click="checkDangerLevel(2)">
  58. <view class="check-left-button">
  59. <view></view>
  60. </view>
  61. <view>重大隐患</view>
  62. </view>
  63. </view>
  64. <view class="describe">
  65. <textarea v-if="!form.checkFlag && !checkItemModuleType" cursor-spacing="40" class="describe-n" type="text"
  66. v-model="form.hazardDescribe" maxlength="200" placeholder="请填写隐患描述"
  67. placeholder-style="font-size:24rpx;color:#999;"></textarea>
  68. </view>
  69. </view>
  70. <view class="voice">
  71. <view class="voice_t">
  72. <view class="voice_t_t" v-if="!form.voiceList[0]"><text>语音备注:</text><text>按住话筒录音</text></view>
  73. <view class="voice_t_b" v-if="form.voiceList[0]">语音备注:({{form.voiceList.length}})</view>
  74. </view>
  75. <view class="voice_b" v-if="form.voiceList[0]" v-for="(voiceItem,voiceIndex) in form.voiceList"
  76. :key="voiceIndex">
  77. <view class="voice_b_l" @tap="voicePlay(voiceItem.fileUrl)">
  78. <img class="add-button" :src="imagesUrl('safetyCheck/icon_yybz_yy.png')" />
  79. {{voiceItem.fileLength}}″
  80. </view>
  81. <img class="voice_b_r" :src="imagesUrl('safetyCheck/icon_yybz_sc.png')"
  82. @tap="voiceDele('',voiceIndex)" />
  83. </view>
  84. <!-- <view class="voice-btn">
  85. <img class="voice_t_r" :src="imagesUrl('commonality/icon_sskz_azsh.png')"
  86. @longpress.stop="recordButton(item,$event)" @touchmove.stop="cancelButton"
  87. @touchend.stop="sendButton(item,$event)" />
  88. <text>按住说话</text>
  89. </view> -->
  90. </view>
  91. </scroll-view>
  92. <checkItemModule :propsData="propsData" v-if="checkItemModuleType"></checkItemModule>
  93. <!-- <view class="sub-btn">
  94. <view @click="submitForm(1)">保存草稿</view>
  95. <view @click="submitForm(2)">提交</view>
  96. </view> -->
  97. <view class="sub-btn" v-if="!checkItemModuleType">
  98. <img @longpress.stop="recordButton(item,$event)" @touchmove.stop="cancelButton"
  99. @touchend.stop="sendButton(item,$event)" :src="imagesUrl('safetyCheck/icon_aqjc_luyin.png')" />
  100. <img @click="selectImage()" :src="imagesUrl('safetyCheck/icon_aqjc_paizhao.png')" />
  101. <img @click="submitForm(2)" :src="imagesUrl('safetyCheck/icon_aqjc_tijiao.png')" />
  102. </view>
  103. <view v-if="!checkItemModuleType" class="inspectRecord" @click="inspectRecordClick()">检查记录</view>
  104. </view>
  105. </template>
  106. <script>
  107. const myaudio = uni.createInnerAudioContext();
  108. import {
  109. config
  110. } from '@/api/request/config.js'
  111. import {
  112. securityAppCheckPlanCheckInfo,
  113. securityAppCheckSetOptionCheckCommit,
  114. securityAppCheckPhotoGetCheckNumBySub,
  115. } from '@/pages_safetyCheck/api/index.js'
  116. import {
  117. checkItemModule
  118. } from '@/pages_safetyCheck/component/checkItemModule.vue'
  119. export default {
  120. name: "inspectAdd",
  121. components: {
  122. checkItemModule
  123. },
  124. data() {
  125. return {
  126. baseUrl: config.base_url,
  127. form: {
  128. dangerLevel:1,
  129. checkFlag: false,
  130. photoList: [],
  131. voiceList: [],
  132. },
  133. newData: {},
  134. radioList: [{
  135. id: 1,
  136. name: '符合',
  137. checked: false,
  138. },
  139. {
  140. id: 0,
  141. name: '不符合',
  142. checked: true,
  143. },
  144. ],
  145. pageType: '',
  146. sendLock: true, //发送锁,当为true时上锁,false时解锁发送
  147. recorderManager: wx.getRecorderManager(),
  148. optionData: null,
  149. //检查项组件数据
  150. checkItemModuleType: false,
  151. propsData: {},
  152. hazardCheckNum:0,
  153. }
  154. },
  155. onLoad(option) {
  156. let optionData = JSON.parse(decodeURIComponent(option.infoData));
  157. uni.setNavigationBarTitle({
  158. title: optionData.subName + '(' + (optionData.pageType == 0 ? (optionData.roomNum ? optionData
  159. .roomNum : '-') : (optionData
  160. .subRoom ? optionData
  161. .subRoom : '-')) + ')'
  162. })
  163. this.$set(this, 'pageType', optionData.pageType);
  164. this.$set(this, 'optionData', optionData);
  165. },
  166. onShow() {
  167. },
  168. mounted() {
  169. if (this.pageType == 0) {
  170. this.securityAppCheckPlanCheckInfo();
  171. this.securityAppCheckPhotoGetCheckNumBySub();
  172. }
  173. },
  174. methods: {
  175. //选择隐患级别
  176. checkDangerLevel(type){
  177. this.$set(this.form,'dangerLevel',type);
  178. },
  179. //折叠展开
  180. inspectDot() {
  181. this.newData.inspectDot = !this.newData.inspectDot
  182. },
  183. //检查记录
  184. inspectRecordClick(){
  185. let infoData = this.optionData;
  186. infoData.curTabTow=1;//已检查
  187. uni.navigateTo({
  188. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItems?infoData=' +
  189. encodeURIComponent(JSON
  190. .stringify(infoData))
  191. });
  192. },
  193. //获取提交详情
  194. async securityAppCheckPlanCheckInfo() {
  195. let obj = {
  196. setOptionId: this.optionData.setOptionId,
  197. manageId: this.optionData.manageId,
  198. }
  199. const {
  200. data
  201. } = await securityAppCheckPlanCheckInfo(obj);
  202. if (data.code == 200) {
  203. data.data.inspectDot = true;
  204. this.$set(this, 'newData', data.data);
  205. //编辑的时候
  206. this.$set(this.form, 'checkFlag', data.data.checkFlag ? data.data.checkFlag : false);
  207. if(data.data.hazardDescribe){
  208. this.$set(this.form, 'hazardDescribe', data.data.hazardDescribe);
  209. }else{
  210. this.$set(this.newData,'hazardCheckPro',this.optionData.hazardCheckPro);
  211. this.$set(this.newData,'hazardCheckCode',this.optionData.hazardCheckCode);
  212. this.$set(this.newData,'hazardCheckName',this.optionData.hazardCheckName);
  213. this.$set(this.newData,'hazardCheckPro1',this.optionData.hazardCheckPro1);
  214. this.$set(this.newData,'hazardCheckCode1',this.optionData.hazardCheckCode1);
  215. this.$set(this.newData,'hazardCheckName1',this.optionData.hazardCheckName1);
  216. this.$set(this.newData,'hazardCheckPro2',this.optionData.hazardCheckPro2);
  217. this.$set(this.newData,'hazardCheckCode2',this.optionData.hazardCheckCode2);
  218. this.$set(this.newData,'hazardCheckName2',this.optionData.hazardCheckName2);
  219. this.$set(this.newData,'hazardCheckPoint',this.optionData.hazardCheckPoint);
  220. this.$set(this.form,'hazardDescribe',this.optionData.hazardCheckPoint);
  221. // let list=[];
  222. // list=data.data.hazardCheckPoint.split('#');
  223. // this.$set(this.form, 'hazardDescribe', list[0]);
  224. }
  225. this.$set(this.form, 'dangerLevel', data.data.dangerLevel ? data.data.dangerLevel : 1);
  226. this.$set(this.form, 'photoList', data.data.photoList ? data.data.photoList : []);
  227. this.$set(this.form, 'voiceList', data.data.voiceList ? data.data.voiceList : []);
  228. }
  229. },
  230. hiddenDangerClick(row) {
  231. if(!this.hiddenDangerRecordStatus){
  232. let infoData = this.optionData;
  233. infoData.subName=this.newData.subName;
  234. infoData.roomNum=this.newData.roomNum;
  235. infoData.hiddenDangerRecordStatus = true;//判断是否跳转隐患列表
  236. uni.navigateTo({
  237. url: '/pages_safetyCheck/views/inspectManage/hiddenDangerRecord?infoData=' +
  238. encodeURIComponent(JSON.stringify(infoData))
  239. });
  240. }
  241. },
  242. checkItemModuleButton(type, item,keyPoint) {
  243. if (type == 'open') {
  244. let obj = {
  245. infoType: this.pageType,
  246. checkType: 0,
  247. editStatus:this.optionData.editStatus,
  248. editItem:{
  249. hazardCheckName:this.newData.hazardCheckName,
  250. hazardCheckName1:this.newData.hazardCheckName1,
  251. hazardCheckName2:this.newData.hazardCheckName2,
  252. hazardCheckCode:this.newData.hazardCheckCode,
  253. hazardCheckCode1:this.newData.hazardCheckCode1,
  254. hazardCheckCode2:this.newData.hazardCheckCode2,
  255. hazardCheckPoint:this.newData.hazardCheckPoint,
  256. hazardCheckPro:this.newData.hazardCheckPro,
  257. hazardCheckPro1:this.newData.hazardCheckPro1,
  258. hazardCheckPro2:this.newData.hazardCheckPro2,
  259. setOptionId:this.newData.setOptionId,
  260. }
  261. }
  262. if (this.pageType == 0) {
  263. //检查
  264. obj.manageId = this.optionData.manageId
  265. obj.planSetId = this.optionData.planSetId
  266. }
  267. this.$set(this, 'propsData', obj);
  268. this.$set(this, 'checkItemModuleType', true);
  269. } else if (type == 'out') {
  270. this.$set(this, 'checkItemModuleType', false);
  271. this.$set(this, 'propsData', {});
  272. } else if (type == 'submit') {
  273. this.$set(this.newData, 'hazardCheckPro', item.hazardCheckPro);
  274. this.$set(this.newData, 'hazardCheckCode', item.hazardCheckCode);
  275. this.$set(this.newData, 'hazardCheckName', item.hazardCheckName);
  276. this.$set(this.newData, 'hazardCheckPro1', item.hazardCheckPro1);
  277. this.$set(this.newData, 'hazardCheckCode1', item.hazardCheckCode1);
  278. this.$set(this.newData, 'hazardCheckName1', item.hazardCheckName1);
  279. this.$set(this.newData, 'hazardCheckPro2', item.hazardCheckPro2);
  280. this.$set(this.newData, 'hazardCheckCode2', item.hazardCheckCode2);
  281. this.$set(this.newData, 'hazardCheckName2', item.hazardCheckName2);
  282. this.$set(this.newData, 'hazardCheckPoint', item.hazardCheckPoint);
  283. this.$set(this.form, 'hazardDescribe', keyPoint);
  284. // this.$set(this.optionData, 'setOptionId', item.setOptionId);
  285. this.$set(this.optionData, 'hazardCheckPro', item.hazardCheckPro);
  286. this.$set(this, 'checkItemModuleType', false);
  287. this.securityAppCheckPhotoGetCheckNumBySub();
  288. //编辑的时候
  289. if(this.optionData.editStatus){
  290. if(this.optionData.setOptionId!=this.newData.setOptionId){
  291. this.$set(this.form, 'photoList', []);
  292. this.$set(this.form, 'voiceList', []);
  293. }
  294. }
  295. }
  296. },
  297. //提交
  298. async submitForm(status) {
  299. if (!this.form.checkFlag) {
  300. if (!this.form.hazardDescribe) {
  301. uni.showToast({
  302. title: '请填写隐患描述!',
  303. icon: "none",
  304. mask: true,
  305. duration: 2000
  306. });
  307. return
  308. }
  309. if (!this.form.photoList[0]) {
  310. uni.showToast({
  311. title: '请选择现场照片!',
  312. icon: "none",
  313. mask: true,
  314. duration: 2000
  315. });
  316. return
  317. }
  318. }
  319. let obj = {
  320. checkFlag: this.form.checkFlag,
  321. checkStatus: 1,
  322. dangerLevel: this.form.dangerLevel,
  323. hazardDescribe: this.form.hazardDescribe,
  324. photoList: this.form.photoList,
  325. voiceList: this.form.voiceList,
  326. manageId: this.optionData.manageId,
  327. hazardCheckPro: this.newData.hazardCheckPro,
  328. hazardCheckCode: this.newData.hazardCheckCode,
  329. hazardCheckName: this.newData.hazardCheckName,
  330. hazardCheckPro2: this.newData.hazardCheckPro2,
  331. hazardCheckCode2: this.newData.hazardCheckCode2,
  332. hazardCheckName2: this.newData.hazardCheckName2,
  333. hazardCheckPro1: this.newData.hazardCheckPro1,
  334. hazardCheckCode1: this.newData.hazardCheckCode1,
  335. hazardCheckName1: this.newData.hazardCheckName1,
  336. hazardCheckPoint: this.form.hazardDescribe,
  337. }
  338. if(this.optionData.setOptionId){
  339. obj.setOptionId = this.optionData.setOptionId;
  340. }
  341. const {
  342. data
  343. } = await securityAppCheckSetOptionCheckCommit(obj);
  344. if (data.code == 200) {
  345. uni.showToast({
  346. title: '提交成功!',
  347. icon: "none",
  348. mask: true,
  349. duration: 2000
  350. });
  351. let infoData = this.optionData;
  352. infoData.setOptionId = data.data;
  353. uni.redirectTo({
  354. url: '/pages_safetyCheck/views/itemsManage/hiddenDangerItemsDetail?infoData=' +
  355. encodeURIComponent(JSON
  356. .stringify(infoData))
  357. });
  358. }
  359. },
  360. //获取检查项在当前实验室出现的次数
  361. async securityAppCheckPhotoGetCheckNumBySub() {
  362. let obj = {
  363. subId: this.optionData.subId,
  364. hazardCheckPro: this.optionData.hazardCheckPro,
  365. }
  366. const {
  367. data
  368. } = await securityAppCheckPhotoGetCheckNumBySub(obj);
  369. if (data.code == 200) {
  370. this.$set(this, 'hazardCheckNum', data.data);
  371. }
  372. },
  373. //滚动事件
  374. scrollGet() {},
  375. //单选按钮
  376. radioClick(d) {
  377. let self = this;
  378. d.checked = !d.checked
  379. if (d.checked) {
  380. //如果有选中的,循环把其他选中的取消
  381. this.radioList.forEach(function(item) {
  382. if (item.id == d.id) {
  383. self.$set(self.form, 'checkFlag', item.id);
  384. } else {
  385. item.checked = false;
  386. }
  387. })
  388. } else {
  389. }
  390. },
  391. /******图片上传******/
  392. selectImage() {
  393. let self = this;
  394. let photoMaxNun = 0;
  395. if (this.form.photoList.length > 5) {
  396. uni.showToast({
  397. title: '最多上传6张图片',
  398. icon: "none",
  399. mask: true,
  400. duration: 2000
  401. });
  402. return
  403. }
  404. photoMaxNun = 6 - this.form.photoList.length;
  405. wx.chooseImage({
  406. count: photoMaxNun,
  407. sizeType: ["original", "compressed"],
  408. sourceType: ["album", "camera"],
  409. success: function(res) {
  410. if (res.tempFilePaths[0]) {
  411. res.tempFilePaths.forEach(function(item, index) {
  412. self.uploadImg(item);
  413. })
  414. }
  415. }
  416. });
  417. },
  418. async uploadImg(tempFilePaths) {
  419. var self = this;
  420. uni.showLoading({
  421. title: '上传中',
  422. mask: true
  423. });
  424. uni.uploadFile({
  425. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  426. header: {
  427. 'Authorization': uni.getStorageSync('token')
  428. },
  429. filePath: tempFilePaths,
  430. name: 'file',
  431. formData: {
  432. 'user': 'test'
  433. },
  434. success: (uploadFileRes) => {
  435. let res = JSON.parse(uploadFileRes.data);
  436. if (res.code == 200) {
  437. this.form.photoList.push({
  438. 'fileUrl': res.data.url,
  439. 'fileName': res.data.name
  440. });
  441. } else {
  442. uni.showToast({
  443. title: res.msg,
  444. icon: "none",
  445. mask: true,
  446. duration: 2000
  447. });
  448. }
  449. },
  450. fail: err => {},
  451. complete: () => {
  452. uni.hideLoading()
  453. }
  454. });
  455. },
  456. //删除图片
  457. delImg(minIndex) {
  458. this.form.photoList.splice(minIndex, 1);
  459. this.$forceUpdate();
  460. },
  461. /******语音备注 *******/
  462. //语音备忘播放
  463. async voicePlay(item) {
  464. myaudio.src = config.base_url + item;
  465. myaudio.play();
  466. },
  467. //语音备忘删除
  468. async voiceDele(item, voiceIndex) {
  469. let self = this;
  470. uni.showModal({
  471. title: '',
  472. cancelColor: '#999999',
  473. confirmColor: '#FF6E6E',
  474. content: '确定删除此语音吗?',
  475. success(res) {
  476. if (res.confirm) {
  477. console.log('用户点击确定')
  478. self.form.voiceList.splice(voiceIndex, 1);
  479. self.$forceUpdate();
  480. } else if (res.cancel) {
  481. console.log('用户点击取消')
  482. }
  483. }
  484. })
  485. },
  486. //录制
  487. recordButton(item, e) {
  488. console.log("按下")
  489. let self = this;
  490. if (this.form.voiceList.length >= 5) {
  491. uni.showToast({
  492. title: '语音备忘最多只能上传5条',
  493. icon: "none",
  494. mask: true,
  495. duration: 2000
  496. });
  497. return
  498. }
  499. this.liveType = true;
  500. console.log('录制', e)
  501. this.startPoint = e.touches[0]; //记录长按时开始点信息,后面用于计算上划取消时手指滑动的距离。
  502. const options = {
  503. duration: 60000,
  504. sampleRate: 16000,
  505. numberOfChannels: 1,
  506. encodeBitRate: 48000,
  507. format: 'mp3',
  508. frameSize: 50
  509. }
  510. this.recorderManager.start(options); //开始录音
  511. this.recorderManager.onStart(() => {
  512. console.log('recorder start')
  513. })
  514. this.recorderManager.onError((res) => {
  515. console.log(res);
  516. })
  517. wx.showToast({
  518. title: "正在录音,上划取消发送",
  519. icon: "none",
  520. duration: 60000 //先定义个60秒,后面可以手动调用wx.hideToast()隐藏
  521. });
  522. this.sendLock = false; //长按时是不上锁的。
  523. },
  524. //取消
  525. cancelButton(e) {
  526. console.log("移动")
  527. let self = this;
  528. this.liveType = false;
  529. console.log('取消', e)
  530. let moveLenght = e.touches[e.touches.length - 1].clientY - this.startPoint.clientY; //移动距离
  531. if (Math.abs(moveLenght) > 50) {
  532. wx.showToast({
  533. title: "松开手指,取消发送",
  534. icon: "none",
  535. duration: 60000
  536. });
  537. this.sendLock = true; //触发了上滑取消发送,上锁
  538. } else {
  539. wx.showToast({
  540. title: "正在录音,上划取消发送",
  541. icon: "none",
  542. duration: 60000
  543. });
  544. this.sendLock = false; //上划距离不足,依然可以发送,不上锁
  545. }
  546. },
  547. //发送
  548. sendButton(item, e) {
  549. console.log("松开")
  550. let self = this;
  551. this.liveType = false;
  552. console.log('发送', e)
  553. wx.hideToast(); //结束录音、隐藏Toast提示框
  554. this.recorderManager.stop(); //结束录音
  555. this.recorderManager.onStop((res) => {
  556. if (!this.sendLock) {
  557. this.uploadVoice(item, res.duration, res.tempFilePath);
  558. }
  559. console.log('停止录音', res.tempFilePath)
  560. console.log("sendLock", this.sendLock);
  561. })
  562. },
  563. //上传MP3
  564. async uploadVoice(item, times, tempFilePaths) {
  565. var self = this;
  566. uni.uploadFile({
  567. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  568. header: {
  569. 'Authorization': uni.getStorageSync('token')
  570. },
  571. filePath: tempFilePaths,
  572. name: 'file',
  573. formData: {
  574. 'user': 'test'
  575. },
  576. success: (uploadFileRes) => {
  577. let res = JSON.parse(uploadFileRes.data);
  578. if (res.code == 200) {
  579. console.log("上传成功", res)
  580. console.log(item)
  581. let seconds = Math.round((parseInt(times) % (1000 * 60)) / 1000);
  582. this.form.voiceList.push({
  583. 'fileLength': seconds,
  584. 'fileUrl': res.data.url,
  585. 'fileName': res.data.name
  586. })
  587. console.log(JSON.stringify(self.voice))
  588. //self.textParseUrlIps(res.data.url);
  589. // self.newData.imgList.push(res.data.url);
  590. } else {
  591. uni.showToast({
  592. title: res.msg,
  593. icon: "none",
  594. mask: true,
  595. duration: 2000
  596. });
  597. }
  598. },
  599. fail: err => {
  600. uni.hideLoading()
  601. },
  602. complete: () => {}
  603. });
  604. },
  605. }
  606. }
  607. </script>
  608. <style lang="stylus" scoped>
  609. .inspectAdd {
  610. height: 100%;
  611. display flex;
  612. box-sizing: border-box;
  613. padding-bottom: 230rpx;
  614. box-sizing: border-box;
  615. .tip {
  616. width: 750rpx;
  617. height: 80rpx;
  618. background: rgba(1, 131, 250, 0.2);
  619. font-weight: normal;
  620. font-size: 28rpx;
  621. color: #0183FA;
  622. line-height: 80rpx;
  623. text-align: center;
  624. }
  625. .list {
  626. width: 750rpx;
  627. margin: 20rpx 0rpx 0;
  628. border-radius: 20rpx 20rpx 20rpx 20rpx;
  629. overflow: hidden;
  630. .list-li {
  631. display: flex;
  632. justify-content: space-between;
  633. align-items: center;
  634. padding: 0 30rpx;
  635. box-sizing: border-box;
  636. border-bottom: 1rpx solid #E0E0E0;
  637. background: #fff;
  638. >view:nth-of-type(1) {
  639. font-size: 30rpx;
  640. color: #333333;
  641. line-height: 100rpx;
  642. text-align: left;
  643. overflow: hidden;
  644. text-overflow: ellipsis;
  645. white-space: nowrap;
  646. }
  647. >view:nth-of-type(2) {
  648. font-size: 28rpx;
  649. color: #666666;
  650. line-height: 100rpx;
  651. text-align: left;
  652. display: flex;
  653. justify-content: space-between;
  654. align-items: center;
  655. >img {
  656. width: 30rpx;
  657. height: 30rpx;
  658. margin-left: 10rpx;
  659. }
  660. }
  661. }
  662. .list-button-max-box{
  663. background-color: #fff;
  664. display: flex;
  665. .list-button-title-box{
  666. line-height:40rpx;
  667. width:200rpx;
  668. padding:30rpx 30rpx 0 30rpx;
  669. }
  670. .list-button-big-box{
  671. padding:30rpx 30rpx 0 0;
  672. margin-right:40rpx;
  673. display: flex;
  674. .check-left-button{
  675. width:28rpx;
  676. height:28rpx;
  677. border-radius:50%;
  678. border:1rpx solid #0183fa;
  679. margin:5rpx 20rpx 0 0;
  680. }
  681. view:nth-child(2){
  682. line-height:40rpx;
  683. }
  684. }
  685. .list-button-big-box-check{
  686. .check-left-button{
  687. view{
  688. margin:5rpx;
  689. width:20rpx;
  690. height:20rpx;
  691. background-color:#0183fa;
  692. border-radius:50%;
  693. }
  694. }
  695. view:nth-child(2){
  696. line-height:40rpx;
  697. }
  698. }
  699. }
  700. .hidden-content {
  701. width: 630rpx;
  702. min-height: 200rpx;
  703. background: #F5F5F5;
  704. border-radius: 20rpx 20rpx 20rpx 20rpx;
  705. margin: 20rpx 30rpx 0;
  706. padding: 20rpx;
  707. box-sizing: border-box;
  708. font-size: 28rpx;
  709. color: #666666;
  710. line-height: 39rpx;
  711. text-align: left;
  712. }
  713. .photo {
  714. display: flex;
  715. justify-content: flex-start;
  716. flex-wrap: wrap;
  717. margin-top: 20rpx;
  718. padding: 0 30rpx;
  719. box-sizing: border-box;
  720. >img {
  721. width: 150rpx;
  722. height: 150rpx;
  723. border-radius: 10rpx 10rpx 10rpx 10rpx;
  724. margin: 0 10rpx 10rpx 0;
  725. }
  726. >img:nth-of-type(4) {
  727. margin-right: 0;
  728. }
  729. }
  730. .describe {
  731. width: 750rpx;
  732. background: #fff;
  733. overflow: hidden;
  734. .describe-n {
  735. width: 690rpx;
  736. min-height: 180rpx;
  737. border-radius: 10rpx 10rpx 10rpx 10rpx;
  738. border: 1rpx solid #E0E0E0;
  739. margin: 40rpx;
  740. padding: 22rpx;
  741. box-sizing: border-box;
  742. background: #F5F5F5;
  743. }
  744. }
  745. .check-for-img-max-box {
  746. padding: 20px 28rpx;
  747. box-sizing: border-box;
  748. background: #fff;
  749. border-bottom: 2rpx solid #E0E0E0;
  750. .left-title-p {
  751. width: 100%;
  752. text-align: left;
  753. font-size: 30rpx;
  754. font-family: PingFang SC-Medium, PingFang SC;
  755. font-weight: 400;
  756. color: #333333;
  757. line-height: 80rpx;
  758. }
  759. .right-img-box {
  760. .img-box {
  761. display inline-block;
  762. height: 150rpx;
  763. width: 150rpx;
  764. position relative;
  765. margin: 0 10rpx 20rpx 0;
  766. border-radius 10rpx;
  767. overflow hidden;
  768. .img-data {
  769. height: 150rpx;
  770. width: 150rpx;
  771. }
  772. .position-img {
  773. position absolute;
  774. right: 0;
  775. top: 0;
  776. width: 36rpx;
  777. height: 36rpx;
  778. }
  779. }
  780. .img-box:nth-of-type(4n+4) {
  781. margin-right: 0rpx;
  782. }
  783. .add-button {
  784. margin: 0 0rpx 20rpx 0;
  785. border-radius 10rpx;
  786. overflow hidden;
  787. display inline-block;
  788. height: 150rpx;
  789. width: 150rpx;
  790. }
  791. }
  792. }
  793. .list-li:last-of-type {
  794. border: none;
  795. }
  796. .hazardCheckNum{
  797. border-bottom: 2rpx solid #E0E0E0;
  798. padding: 30rpx 40rpx 34rpx 40rpx;
  799. box-sizing: border-box;
  800. background: #fff;
  801. display: flex;
  802. justify-content: flex-end;
  803. align-items: center;
  804. .hazardCheckNum-l{
  805. width: 30rpx;
  806. height: 30rpx;
  807. margin-right: 18rpx;
  808. }
  809. .hazardCheckNum-r{
  810. font-size: 28rpx;
  811. color: #FF5900;
  812. line-height: 40rpx;
  813. text-align: left;
  814. }
  815. }
  816. }
  817. .srearch {
  818. display: flex;
  819. justify-content: space-between;
  820. align-items: center;
  821. .srearch-l {
  822. font-size: 30rpx;
  823. color: #333333;
  824. line-height: 100rpx;
  825. text-align: left;
  826. }
  827. .srearch-r {
  828. width: 30rpx;
  829. height: 30rpx;
  830. margin-right: 0rpx;
  831. }
  832. }
  833. /* 语音备注 */
  834. .voice {
  835. width: 750rpx;
  836. min-height: 100rpx;
  837. background: #FFFFFF;
  838. border-radius: 20rpx 20rpx 20rpx 20rpx;
  839. overflow: hidden;
  840. .voice_t {
  841. height: 100rpx;
  842. display: flex;
  843. justify-content: space-between;
  844. align-items: center;
  845. padding: 0 30rpx;
  846. box-sizing: border-box;
  847. border-top: 2rpx solid #E0E0E0;
  848. .voice_t_t {
  849. width: 100%;
  850. display: flex;
  851. justify-content: space-between;
  852. >text:nth-of-type(1) {
  853. font-size: 30rpx;
  854. color: #333333;
  855. line-height: 100rpx;
  856. }
  857. >text:nth-of-type(2) {
  858. font-size: 28rpx;
  859. color: #999999;
  860. line-height: 100rpx;
  861. }
  862. }
  863. .voice_t_b {
  864. width: 100%;
  865. font-size: 30rpx;
  866. font-family: PingFang SC-Medium, PingFang SC;
  867. font-weight: 400;
  868. color: #333333;
  869. line-height: 100rpx;
  870. text-align: left;
  871. }
  872. }
  873. .voice_b {
  874. display flex;
  875. justify-content flex-start;
  876. align-items center;
  877. margin-bottom: 20rpx;
  878. padding: 0 30rpx;
  879. box-sizing: border-box;
  880. .voice_b_l {
  881. width: 400rpx;
  882. height: 40rpx;
  883. background: #0183FA;
  884. border-radius: 10rpx;
  885. display flex;
  886. justify-content flex-start;
  887. align-items center;
  888. font-size: 24rpx;
  889. color: #FFFFFF;
  890. line-height: 30rpx;
  891. text-align: left;
  892. >img {
  893. width: 20rpx;
  894. height: 20rpx;
  895. margin-left: 16rpx;
  896. margin-right: 20rpx;
  897. }
  898. }
  899. .voice_b_r {
  900. width: 28rpx;
  901. height: 28rpx;
  902. margin-left: 20rpx;
  903. }
  904. }
  905. .voice-btn {
  906. width: 150rpx;
  907. height: 150rpx;
  908. position: fixed;
  909. right: 24rpx;
  910. bottom: 176rpx;
  911. >img {
  912. width: 150rpx;
  913. height: 150rpx;
  914. position: absolute;
  915. }
  916. >text {
  917. font-size: 24rpx;
  918. color: #999999;
  919. line-height: 30rpx;
  920. text-align: center;
  921. position: absolute;
  922. top: 84rpx;
  923. left: 26rpx;
  924. }
  925. }
  926. }
  927. }
  928. .sub-btn {
  929. display: flex;
  930. justify-content: space-between;
  931. position: fixed;
  932. bottom: 30rpx;
  933. width: 750rpx;
  934. padding: 0 46rpx;
  935. box-sizing: border-box;
  936. >img {
  937. width: 160rpx;
  938. height: 160rpx;
  939. }
  940. }
  941. .inspectRecord{
  942. position: fixed;
  943. top: 118rpx;
  944. right: 0;
  945. z-index: 200;
  946. width: 160rpx;
  947. height: 60rpx;
  948. background: #0183FA;
  949. border-radius: 50rpx 0rpx 0rpx 50rpx;
  950. font-size: 30rpx;
  951. color: #FFFFFF;
  952. line-height: 60rpx;
  953. text-align: center;
  954. }
  955. </style>