xunCha.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" title="巡查" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <view>
  5. <view class="xxxc_box">
  6. <view style="display: flex; align-items: center; font-size: 30rpx; font-weight: 600; color: #b75830; margin-bottom: 10rpx">
  7. <uni-icons type="sound" size="22" color="#b75830"></uni-icons>
  8. <view>任务公告</view>
  9. </view>
  10. <view>
  11. <view style="color: #90592a">
  12. <view class="">
  13. <text>{{ taskDetails.type_text || '暂无任务' }}:</text>
  14. <text>{{ taskDetails.desc }}</text>
  15. </view>
  16. <view v-if="taskDetails.progress != 0">巡查时间:{{ taskDetails.submit_time }}</view>
  17. </view>
  18. <view style="margin-top: 10rpx; font-size: 28rpx; color: #c0a991">请按任务要求填写巡查报告</view>
  19. </view>
  20. </view>
  21. <!-- <view class="map_tit">
  22. <image style="width: 186rpx; height: 40rpx" src="/static/img/right_img.png"></image>
  23. <view class="">文物监控</view>
  24. <image style="width: 186rpx; height: 40rpx" src="/static/img/left_img.png"></image>
  25. </view> -->
  26. <!-- 监控 -->
  27. <!-- <view class="jk_box">
  28. <view @click="openVideo('3e8744121f434332b057391d4ae682d8')" class="jk_item">
  29. <image :src="videoSrc + '3e8744121f434332b057391d4ae682d8' + '.jpg'" class="img"></image>
  30. </view>
  31. <view @click="openVideo('7c078920874f4bd9812224f44a2c8d02')" class="jk_item">
  32. <image :src="videoSrc + '7c078920874f4bd9812224f44a2c8d02' + '.jpg'" class="img"></image>
  33. </view>
  34. </view> -->
  35. <!-- <view class="gui-card-list gui-margin gui-margin-top gui-flex gui-rows gui-wrap gui-space-between">
  36. <view class="gui-card-item" hover-class="gui-tap" v-for="(item, index) in item.device_list" :key="index">
  37. <view class="gui-card-img" @click="openVideo(item.camera_index_code)">
  38. <gui-image :width="330" :height="180" :src="videoSrc + item.camera_index_code + '.jpg'" mode="aspectFit"></gui-image>
  39. </view>
  40. <text class="gui-card-title gui-block-text gui-text gui-primary-color">{{ item.name }}</text>
  41. </view>
  42. </view> -->
  43. </view>
  44. <!-- 线下巡查 -->
  45. <view class="map_tit">
  46. <image style="width: 186rpx; height: 40rpx" src="/static/img/right_img.png"></image>
  47. <view class="">{{ taskDetails.cr_title }}</view>
  48. <image style="width: 186rpx; height: 40rpx" src="/static/img/left_img.png"></image>
  49. </view>
  50. <view v-if="taskDetails.progress == '-1'" style="margin-left: 10%; font-size: 36rpx; color: red">驳回原因:{{ taskDetails.feedback }}</view>
  51. <view class="" style="width: 90%; margin: auto">
  52. <view class="" style="display: flex; align-items: center">
  53. <view class="dw" @click="dwBtn">
  54. <uni-icons type="location" size="18" color="#ffffff"></uni-icons>
  55. <view style="margin-left: 10rpx">签到</view>
  56. </view>
  57. <view v-if="longitude != ''" :style="{ color: dwShow ? '#07c160' : 'red' }" style="width: 340rpx; margin-left: 20rpx; font-size: 24rpx">
  58. 当前经纬度{{ latitude }},{{ longitude }}
  59. </view>
  60. <view v-else style="margin-left: 20rpx; color: rgba(68, 68, 68, 0.6)">请点击左侧签到按钮获取当前经纬度</view>
  61. </view>
  62. </view>
  63. <view class="zk_box">
  64. <view @click="AssetBtn(item)" class="zk_item" v-for="(item, index) in assetList" :key="item.id">
  65. <!-- 调整 -->
  66. <view class="top_box" style="">
  67. <view>
  68. <view v-if="item.image != ''">
  69. <image :src="item.image" style="width: 280rpx; height: 200rpx"></image>
  70. </view>
  71. <view v-else style="width: 280rpx; height: 200rpx">
  72. <image
  73. v-if="item.title == '文保牌'"
  74. src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/wbp2.png"
  75. style="width: 280rpx; height: 200rpx"
  76. ></image>
  77. <image v-else src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/zwtp.png" style="width: 280rpx; height: 200rpx"></image>
  78. </view>
  79. </view>
  80. <view @click="AssetShow = true" class="" style="display: flex; align-items: center">
  81. <view style="margin-left: 20rpx">
  82. <view style="font-size: 32rpx; color: #444444; font-weight: 600">文物{{ item.type_text }}状况</view>
  83. <view style="height: 150rpx; overflow: scroll; margin-top: 20rpx; font-size: 28rpx; font-weight: 400; color: rgba(68, 68, 68, 0.6)">
  84. {{ item.type == 1 ? '文物本体' : item.title }}:{{ item.desc }}
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 调整 -->
  90. <view class="" style="margin-top: 30rpx; display: flex; justify-content: space-between">
  91. <view style="width: 100%; margin: auto">
  92. <!-- <Segmented activeColor="#EDA98E" :current="item.status" :target="item" :values="displayedItems" @clickItem="onClickItem" styleType="button"></Segmented> -->
  93. <!-- 默认选中未知 -->
  94. <Segmented
  95. activeColor="#c87d5a"
  96. :current="item.segCurrent ? item.segCurrent : 0"
  97. :target="item"
  98. :values="displayedItems"
  99. @clickItem="onClickItem"
  100. styleType="button"
  101. ></Segmented>
  102. <!-- 每项上传的照片 -->
  103. <view class="" style="display: flex; flex-wrap: wrap; justify-content: start; margin-top: 20rpx">
  104. <image
  105. @click="clickImg(item.extraImages, index2)"
  106. v-for="(item2, index2) in item.extraImages"
  107. :src="item2.url"
  108. :key="item2.index2"
  109. style="width: 210rpx; height: 120rpx; margin-left: 10rpx; margin-top: 10rpx"
  110. ></image>
  111. </view>
  112. <!-- 每项的描述 -->
  113. <!-- :style="{ height: item.describeVal != undefined ? '80rpx' : '0rpx' }" -->
  114. <view style="font-weight: normal; font-size: 30rpx; margin-top: 10rpx; line-height: 40rpx; color: rgba(68, 68, 68, 0.6)">
  115. {{ item.describeVal || '' }}
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <u-popup :show="show" @close="close" mode="center" :closeable="true" bgColor="#f9dbbf" round="5">
  122. <view class="pop_box">
  123. <view v-if="normal">
  124. <view style="display: flex; align-items: center">
  125. <view style="margin-top: 20rpx">事件类型</view>
  126. <view class="lx" @click="showType = true" :style="{ color: Evtsituation ? '#000000' : '' }">
  127. {{ Evtsituation ? Evtsituation : '点击选择类型' }}
  128. <u-icon name="arrow-down" color="#d67b54" size="20"></u-icon>
  129. </view>
  130. </view>
  131. <view style="display: flex; align-items: center">
  132. <view style="margin-top: 20rpx">事件等级</view>
  133. <view class="lx" @click="showPicker = true" :style="{ color: Evtsituation ? '#000000' : '' }">
  134. {{ situation ? situation : '点击选择等级' }}
  135. <u-icon name="arrow-down" color="#d67b54" size="20"></u-icon>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="tit_box">
  140. <view class="title" style="margin-top: -120rpx; margin-right: 70rpx" :class="{ miaoshu: !normal }">描述</view>
  141. <u--textarea v-model.trim="describeVal" count></u--textarea>
  142. </view>
  143. <!-- 图片 -->
  144. <view style="height: 400rpx; overflow: scroll">
  145. <!-- 上传照片 -->
  146. <view>
  147. <SCimage :fileList="fileList" @childEvent="handleChildEvent"></SCimage>
  148. </view>
  149. </view>
  150. <view class="zque" @click="isOk">确认</view>
  151. </view>
  152. </u-popup>
  153. <!-- 事件类型 -->
  154. <u-picker :show="showType" keyName="title" @cancel="showType = false" :columns="Evtcolumns" @close="close" :closeOnClickOverlay="true" @confirm="evtConfirm"></u-picker>
  155. <!-- 事件等级 -->
  156. <u-picker :show="showPicker" keyName="title" @cancel="showPicker = false" :columns="columns" @close="close" :closeOnClickOverlay="true" @confirm="confirm"></u-picker>
  157. <!-- 文物资产详情 -->
  158. <u-popup :show="AssetShow" @close="close" mode="center" :closeable="true" bgColor="#f9dbbf" round="5">
  159. <view class="pop_box">
  160. <view style="text-align: center; margin-right: 20rpx; margin-bottom: 20rpx; font-size: 32rpx">{{ assetDetails.title }}</view>
  161. <view>状况:{{ assetDetails.status_text }}</view>
  162. <view>位置:{{ assetDetails.position ? assetDetails.position : '暂未显示' }}</view>
  163. <view>
  164. <image style="width: 180rpx; height: 140rpx" :src="assetDetails.image"></image>
  165. </view>
  166. </view>
  167. </u-popup>
  168. <view class="tjxc" @click="submitTo">提交巡查</view>
  169. </view>
  170. </template>
  171. <script>
  172. var md5 = require('@/common/md5.js');
  173. let that;
  174. export default {
  175. data() {
  176. return {
  177. dwShow: true,
  178. position: '',
  179. longitude: '',
  180. latitude: '',
  181. showType: false,
  182. distance: null /* 判断用户距离 */,
  183. cr_id: '' /* 文物id */,
  184. cr_code: '' /* 文物编号 */,
  185. videoSrc: 'https://huli-app.wenlvti.net/map_source/static/images/video/',
  186. taskDetails: {} /* 任务详情 */,
  187. taskId: '' /* 任务id */,
  188. submitStatus: 1 /* 提交状态*/,
  189. eventTypeId: '' /* 异常事件类型id */,
  190. stateId: '' /* 状态id */,
  191. items: [{ title: '未知' }, { title: '正常', status: 1 }, { title: '异常', status: 2 }],
  192. displayedItems: [],
  193. current: 0,
  194. assetList: [] /* 资产列表 */,
  195. postList: [],
  196. assetDetails: {} /* 资产详情 */,
  197. AssetShow: false,
  198. normal: false,
  199. describeVal: '',
  200. show: false,
  201. showPicker: false,
  202. situation: '',
  203. Evtsituation: '',
  204. // 弹层Tab
  205. popTab: [],
  206. columns: [
  207. [
  208. {
  209. title: '一般',
  210. id: 1
  211. },
  212. {
  213. title: '较大',
  214. id: 2
  215. },
  216. {
  217. title: '重大',
  218. id: 3
  219. },
  220. {
  221. title: '非常重大',
  222. id: 4
  223. }
  224. ]
  225. ],
  226. Evtcolumns: [],
  227. // 上传的图片
  228. fileList: []
  229. };
  230. },
  231. onLoad(o) {
  232. console.log(o, 'ooo');
  233. that = this;
  234. this.taskId = o.id; /* 任务id */
  235. this.cr_id = o.cr_id; /* 文物id */
  236. this.cr_code = o.cr_code;
  237. // 处理状态
  238. this.displayedItems = this.items.map((item) => item.title);
  239. this.getPatrolTaskDetails(o.id);
  240. this.loadGlobalFont();
  241. },
  242. methods: {
  243. // 监控
  244. // openVideo(camera_index_code) {
  245. // console.log(camera_index_code);
  246. // var t = Date.parse(new Date()) / 1000;
  247. // var key = md5.md5(t + '@feichenghuli');
  248. // this.webViedoUrl = encodeURIComponent('https://wenwu.16fw.cn/hik_monitor/mobile_monitor.html?t=' + t.toString() + '&key=' + key + '&index_code=' + camera_index_code);
  249. // console.log(this.webViedoUrl);
  250. // this.$common.navigateTo('/shouhu_fenbao/shouHu/webview?url=' + this.webViedoUrl);
  251. // return;
  252. // },
  253. // 打卡
  254. dwBtn() {
  255. uni.getLocation({
  256. type: 'gcj02',
  257. isHighAccuracy: true,
  258. success: function (data) {
  259. that.$api.distanceCheck({ cr_id: that.cr_id, longitude: data.longitude, latitude: data.latitude }, function (res) {
  260. //存储经纬度
  261. that.position = res.longitude + ',' + res.latitude;
  262. if (res.data === false && res.code == 0) {
  263. that.dwShow = false;
  264. that.longitude = data.longitude;
  265. that.latitude = data.latitude;
  266. that.$common.errorToShow(res.msg);
  267. console.log(res, '不是特殊文物距离过远');
  268. } else {
  269. that.longitude = data.longitude;
  270. that.latitude = data.latitude;
  271. that.$common.successToShow('签到成功');
  272. // console.log('当前位置的经度:' + res.longitude);
  273. // console.log('当前位置的纬度:' + res.latitude);
  274. }
  275. });
  276. },
  277. fail: function (res) {
  278. //1.2 拒绝授权
  279. uni.showModal({
  280. content: '检测到您没打开获取位置权限,是否去设置打开?',
  281. confirmText: '确认',
  282. cancelText: '取消',
  283. success: (res) => {
  284. if (res.confirm) {
  285. uni.openSetting({
  286. success: (res) => {
  287. console.log(res);
  288. uni.getLocation();
  289. }
  290. });
  291. } else {
  292. // console.log('取消');
  293. return false;
  294. }
  295. }
  296. });
  297. }
  298. });
  299. },
  300. // 接受子组件上传的图片
  301. handleChildEvent(data) {
  302. // console.log('Received data from child component:', data);
  303. this.fileList = data;
  304. },
  305. // 任务详情
  306. getPatrolTaskDetails(id) {
  307. this.$api.getPatrolTaskDetails({ main_body_id: 1, task_id: id, cr_id: this.cr_id }, function (res) {
  308. // console.log(res, '任务详情');
  309. that.taskDetails = res.data;
  310. that.cr_id = that.taskDetails.cr_id;
  311. that.cr_code = that.taskDetails.cr_code;
  312. that.taskId = that.taskDetails.id;
  313. that.getCrProperty();
  314. });
  315. },
  316. // 文物资产列表
  317. getCrProperty() {
  318. this.$api.getCrProperty({ main_body_id: 1, cr_id: this.cr_id }, function (res) {
  319. // console.log(res, 'resres');
  320. if (res.code === 1) {
  321. // that.assetList = res.data;
  322. //这边是巡查记录给资产赋值,如果有资产巡查记录,则改变显示的资产信息
  323. let alist = res.data;
  324. that.taskDetails.patrolTaskAnnexList.forEach((requestItem, index) => {
  325. // console.log(alist, '999999');
  326. alist.forEach((item, i) => {
  327. if (item.id == requestItem.property_id) {
  328. // console.log(item, '3333333333');
  329. // console.log(alist[i], '1111111111');
  330. alist[i].describeVal = requestItem.desc;
  331. alist[i].extraImages = [];
  332. requestItem.images.forEach((img, imgidx) => {
  333. alist[i].extraImages.push({ url: img });
  334. });
  335. alist[i].status_text = requestItem.status_text;
  336. //状态高光
  337. alist[i].segCurrent = requestItem.status;
  338. }
  339. });
  340. });
  341. alist.forEach((item, i) => {
  342. //如果资产是特殊文物,则提交状态改为特殊文物
  343. if (item.is_special == 1) {
  344. alist[i].submitStatus = 2;
  345. that.submitStatus = 2;
  346. }
  347. });
  348. that.assetList = alist;
  349. that.postList = { main_body_id: 1, task_id: that.taskId, submit_status: that.submitStatus, property_list: [] };
  350. } else {
  351. console.log(res.msg);
  352. }
  353. });
  354. },
  355. // 状态事件
  356. onClickItem(e) {
  357. // console.log(e, '修改w');
  358. this.assetDetails = e.target;
  359. // console.log(this.assetDetails, 'item');
  360. this.stateId = e.currentIndex;
  361. var tarIndex = -1;
  362. for (var i = 0; i < this.postList.property_list.length; i++) {
  363. if (this.postList.property_list[i].id == this.assetDetails.id) {
  364. tarIndex = i;
  365. // console.log(this.postList.property_list[i], '11111111');
  366. }
  367. }
  368. if (tarIndex >= 0) {
  369. console.log(this.postList.property_list[tarIndex]);
  370. this.fileList = this.postList.property_list[tarIndex].images;
  371. } else {
  372. // 关闭弹层将相关内容清空
  373. if (typeof this.assetDetails.extraImages != 'undefined') {
  374. this.fileList = [...this.assetDetails.extraImages];
  375. } else {
  376. this.fileList = [];
  377. }
  378. this.describeVal = '';
  379. this.situation = '';
  380. this.situationId = '';
  381. this.eventTypeId = '';
  382. this.Evtsituation = '';
  383. }
  384. if (this.items[e.currentIndex].title === '异常') {
  385. // 文物分类列表
  386. this.describeVal = '';
  387. this.$api.getCulturalRelicCategory({ main_body_id: 1, type: 42 }, function (res) {
  388. // console.log(res, '事件类型');
  389. that.Evtcolumns = [res.data];
  390. });
  391. // 弹层
  392. this.show = true;
  393. // 异常弹层布局
  394. this.normal = true;
  395. } else if (this.items[e.currentIndex].title === '正常') {
  396. this.show = true;
  397. // this.describeVal = '未发现异常';
  398. }
  399. },
  400. // 文物资产项
  401. AssetBtn(item) {
  402. this.assetDetails = item;
  403. this.describeVal = item.describeVal;
  404. // console.log(this.assetDetails, 'this.assetDetails');
  405. },
  406. // 弹层确认
  407. isOk() {
  408. this.describeVal = this.describeVal;
  409. // console.log(this.items[this.stateId].status, '状态');
  410. // 文物本体
  411. var tarIndex = -1;
  412. for (var i = 0; i < this.postList.property_list.length; i++) {
  413. if (this.postList.property_list[i].id == this.assetDetails.id) {
  414. tarIndex = i;
  415. }
  416. }
  417. if (tarIndex < 0) {
  418. this.postList.property_list.push({
  419. id: this.assetDetails.id,
  420. images: [],
  421. desc: '',
  422. event_level: '',
  423. event_type: '',
  424. status: this.normal ? 2 : 1
  425. });
  426. tarIndex = this.postList.property_list.length - 1;
  427. }
  428. this.postList.property_list[tarIndex].images = this.fileList;
  429. this.postList.property_list[tarIndex].desc = this.describeVal;
  430. this.postList.property_list[tarIndex].event_level = this.situationId;
  431. this.postList.property_list[tarIndex].event_type = this.eventTypeId;
  432. // 检查描述和图片是否已填写
  433. let property = this.postList.property_list[tarIndex];
  434. // 检查描述是否已填写
  435. if (!property.desc || property.desc.trim() === '') {
  436. // 新加
  437. if (this.normal) {
  438. this.$common.errorToShow('请填写问题描述');
  439. } else {
  440. this.describeVal = '未发现异常';
  441. }
  442. // this.$common.errorToShow('请填写问题描述');
  443. return;
  444. }
  445. // 检查是否有至少一张图片
  446. if (property.images.length === 0) {
  447. this.$common.errorToShow('请上传图片');
  448. return;
  449. }
  450. // 检查描述和图片是否已填写end
  451. this.show = false;
  452. this.normal = false;
  453. // console.log('kkk', this.postList); /* 参数 */
  454. // console.log('上传的照片66', this.fileList); /* 照片 */
  455. let arr = [];
  456. //显示每项上传的图片, 遍历this.fileList,为每个项创建包含url属性的对象,并推送到新数组
  457. // this.assetList.forEach((obj) => {
  458. // //当前资产图片清空重新写入(还存在一个问题,删掉不另外增加图片,无法触发this.fileList的修改,导致单纯删某张图片删不掉)
  459. // if (obj.id == this.postList.property_list[tarIndex].id) {
  460. // obj.extraImages = [];
  461. // }
  462. // const uniqueUrls = new Set();
  463. // const deduplicatedExtraImages = [];
  464. // obj.extraImages.forEach((imageObj) => {
  465. // const url = imageObj.url;
  466. // if (!uniqueUrls.has(url)) {
  467. // uniqueUrls.add(url);
  468. // deduplicatedExtraImages.push(imageObj);
  469. // }
  470. // });
  471. // obj.extraImages = deduplicatedExtraImages;
  472. // });
  473. this.assetList.forEach((obj) => {
  474. if (obj.id === this.assetDetails.id) {
  475. //先将当前资产图片清空,再重新写入
  476. obj.extraImages = [];
  477. this.postList.property_list.forEach((item) => {
  478. obj.describeVal = item.desc;
  479. });
  480. // 遍历this.fileList,为每个项创建包含url属性的对象,检查其是否已存在于obj.extraImages中,
  481. // 若不存在则推送到obj.extraImages
  482. this.fileList.forEach((fileItem) => {
  483. const url = fileItem.url;
  484. const isDuplicate = obj.extraImages.some((imageObj) => imageObj.url === url);
  485. if (!isDuplicate) {
  486. obj.extraImages.push({ url });
  487. }
  488. });
  489. }
  490. });
  491. // console.log(this.assetList, '每项添加照片和描述');
  492. },
  493. // 提交巡查
  494. submitTo() {
  495. // 判断图片和描述有没有填写
  496. let allItemsValid = true;
  497. let incompleteItems = []; // 用于存储需要完善信息的文物类型
  498. this.assetList.forEach((item) => {
  499. const hasExtraImages = item.hasOwnProperty('extraImages') && item.extraImages !== null && item.extraImages !== undefined;
  500. const hasDescribeVal = item.hasOwnProperty('describeVal') && item.describeVal !== null && item.describeVal !== undefined;
  501. if (!hasExtraImages || !hasDescribeVal) {
  502. incompleteItems.push(item.type_text); // 将需要完善信息的文物类型添加到数组中
  503. allItemsValid = false; // 遇到不符合条件的对象时,标记为不通过
  504. }
  505. });
  506. // 移除的域名
  507. if (allItemsValid) {
  508. const prefixToKeep = '/uploads/';
  509. // 检查 postList 和其 property_list 是否存在并结构正确
  510. if (this.postList && Array.isArray(this.postList.property_list)) {
  511. // 遍历每个 property
  512. this.postList.property_list.forEach((property) => {
  513. // 检查 images 是否存在并是一个数组
  514. if (property.images && Array.isArray(property.images)) {
  515. // 更新每个图片的 URL
  516. property.images.forEach((imageObj) => {
  517. // 检查 URL 是否包含需要保留的前缀
  518. if (imageObj.url && imageObj.url.includes(prefixToKeep)) {
  519. // 获取 "uploads" 在 URL 中的位置
  520. const index = imageObj.url.indexOf(prefixToKeep);
  521. // 从 "uploads" 开始截取 URL
  522. imageObj.url = imageObj.url.substring(index);
  523. }
  524. });
  525. }
  526. });
  527. }
  528. // 需要移除的域名end
  529. let mypost = JSON.parse(JSON.stringify(this.postList));
  530. for (var i = 0; i < this.postList.property_list.length; i++) {
  531. let images = '';
  532. for (var j = 0; j < this.postList.property_list[i].images.length; j++) {
  533. if (images == '') images += this.postList.property_list[i].images[j].url;
  534. else images += ',' + this.postList.property_list[i].images[j].url;
  535. }
  536. mypost.property_list[i].images = images;
  537. }
  538. mypost.property_list = JSON.stringify(mypost.property_list);
  539. console.log(mypost, '提交参数');
  540. // 获取位置判断距离文物多远,不是特殊文物需判断距离
  541. if (that.assetList[0].is_special === 0) {
  542. uni.getLocation({
  543. type: 'gcj02',
  544. isHighAccuracy: true,
  545. success: function (res) {
  546. that.position = res.longitude + ',' + res.latitude;
  547. mypost.position = that.position;
  548. // console.log(mypost, '提交参数22222222');
  549. // console.log(that.position, '提交位置');
  550. that.$api.distanceCheck({ cr_id: that.cr_id, longitude: res.longitude, latitude: res.latitude }, function (res) {
  551. if (res.data === false && res.code == 0) {
  552. that.$common.errorToShow(res.msg);
  553. // console.log(res, '不是特殊文物距离过远');
  554. } else {
  555. // console.log(res, '不是特殊文物距离ok');
  556. that.$api.submitTask(mypost, function (res) {
  557. if (res.code == 1) {
  558. // console.log(res, '提交成功');
  559. that.$common.successToShow(res.msg);
  560. setTimeout(() => {
  561. uni.switchTab({
  562. url: '/pages/shouhu/shouhu'
  563. });
  564. }, 1000);
  565. } else {
  566. that.$common.errorToShow(res.msg);
  567. }
  568. });
  569. }
  570. });
  571. },
  572. fail: function (err) {
  573. console.log(err, '定位失败');
  574. }
  575. });
  576. } else {
  577. // 特殊文物不用判断距离
  578. console.log('特殊文物不用判断距离');
  579. //提交参数传入经纬度
  580. mypost.position = that.position;
  581. that.$api.submitTask(mypost, function (res) {
  582. if (res.code == 1) {
  583. // console.log(res, '提交成功');
  584. that.$common.successToShow(res.msg);
  585. setTimeout(() => {
  586. uni.switchTab({
  587. url: '/pages/shouhu/shouhu'
  588. });
  589. }, 1000);
  590. } else {
  591. that.$common.errorToShow(res.msg);
  592. }
  593. });
  594. }
  595. } else {
  596. const message = `请完善文物${incompleteItems.join(', ')}巡查信息`;
  597. that.$common.errorToShow(message);
  598. }
  599. },
  600. confirm(e) {
  601. // console.log('confirm', e);
  602. this.situation = e.value[0].title;
  603. this.situationId = e.value[0].id;
  604. this.showPicker = false;
  605. },
  606. evtConfirm(e) {
  607. console.log('confirm', e);
  608. this.Evtsituation = e.value[0].title;
  609. this.eventTypeId = e.value[0].id;
  610. this.showType = false;
  611. },
  612. // 历史记录
  613. jiluBtn() {
  614. uni.navigateTo({
  615. url: '/shouhu_fenbao/xunCha/jiLu'
  616. });
  617. },
  618. // 图片预览
  619. clickImg(item, i) {
  620. let img = [];
  621. item.forEach((item) => {
  622. img.push(item.url);
  623. });
  624. uni.previewImage({
  625. urls: img, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  626. current: img[i] // 当前显示图片的http链接,默认是第一个
  627. });
  628. },
  629. close() {
  630. this.show = false;
  631. this.showPicker = false;
  632. this.normal = false;
  633. this.AssetShow = false;
  634. this.showType = false;
  635. },
  636. // 加载字体
  637. loadGlobalFont() {
  638. try {
  639. uni.loadFontFace({
  640. family: 'MyGlobalFont', // 自定义字体名
  641. source: 'url("https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/songTi.ttf")',
  642. success() {
  643. console.log('全局字体加载成功');
  644. }
  645. });
  646. } catch (error) {
  647. console.error('全局字体加载异常', error);
  648. }
  649. }
  650. }
  651. };
  652. </script>
  653. <style>
  654. .box {
  655. min-height: 100%;
  656. height: auto;
  657. width: 100%;
  658. padding-bottom: 50rpx;
  659. /* background-color: #fff9e9; */
  660. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  661. background-repeat: repeat-y;
  662. background-size: 100% 100%;
  663. font-family: 'MyGlobalFont';
  664. }
  665. .u-textarea__field.data-v-09988a29 {
  666. color: #000000 !important;
  667. }
  668. .u-textarea.data-v-09988a29 {
  669. background-color: #f1bd8e !important;
  670. }
  671. .active {
  672. color: #fae5bb !important;
  673. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/cy_tit1.png') !important;
  674. }
  675. /deep/.u-textarea.data-v-09988a29 {
  676. background-color: #f1bd8e !important;
  677. border-radius: 0;
  678. }
  679. /deep/.u-textarea.data-v-09988a29 {
  680. background-color: #f1bd8e !important;
  681. }
  682. .tab_active {
  683. background-color: #b75830 !important;
  684. }
  685. .u-textarea__count.data-v-09988a29 {
  686. background-color: transparent !important;
  687. }
  688. .u-upload__button.data-v-69e2a36e {
  689. background-color: #f1bd8e !important;
  690. }
  691. .dw {
  692. display: flex;
  693. align-items: center;
  694. width: 160rpx;
  695. height: 80rpx;
  696. color: #ffffff;
  697. line-height: 80rpx;
  698. font-size: 28rpx;
  699. border-radius: 10rpx;
  700. justify-content: center;
  701. background-color: #c87d5a;
  702. }
  703. .filter-box {
  704. padding: 30upx 50upx 0 50upx;
  705. margin-bottom: 30upx;
  706. display: flex;
  707. align-items: center;
  708. justify-content: space-between;
  709. }
  710. .miaoshu {
  711. margin-top: -260rpx !important;
  712. margin-right: 0 !important;
  713. }
  714. .filter-box .b-item {
  715. width: 278rpx;
  716. height: 80rpx;
  717. font-size: 30rpx;
  718. color: #ffefc4;
  719. font-weight: 600;
  720. text-align: center;
  721. line-height: 80rpx;
  722. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/cy_tit2.png');
  723. background-size: 100% 100%;
  724. }
  725. .map_tit {
  726. display: flex;
  727. align-items: center;
  728. margin-left: 125rpx;
  729. margin-top: 50rpx;
  730. margin-bottom: 20rpx;
  731. font-size: 36rpx;
  732. font-weight: 900;
  733. line-height: 52rpx;
  734. color: #444444;
  735. }
  736. .map_tit2 {
  737. position: relative;
  738. top: -176rpx;
  739. }
  740. .jk_box {
  741. display: flex;
  742. flex-wrap: wrap;
  743. justify-content: space-between;
  744. width: 90%;
  745. margin: auto;
  746. }
  747. .img {
  748. width: 100%;
  749. height: 100%;
  750. }
  751. .jk_item {
  752. width: 310rpx;
  753. height: 230rpx;
  754. margin-top: 40rpx;
  755. }
  756. .zk_box {
  757. width: 90%;
  758. margin: auto;
  759. margin-top: 30rpx;
  760. }
  761. .zk_item {
  762. /* justify-content: space-between;
  763. display: flex; */
  764. font-size: 30rpx;
  765. font-weight: 600;
  766. margin-top: 40rpx;
  767. }
  768. .zk_item2 {
  769. display: block !important;
  770. font-size: 30rpx;
  771. font-weight: 600;
  772. margin-top: 40rpx;
  773. }
  774. .tjxc {
  775. width: 670rpx;
  776. height: 88rpx;
  777. margin: auto;
  778. font-size: 32rpx;
  779. font-weight: 600;
  780. color: #fef3e1;
  781. margin-top: 50rpx;
  782. line-height: 82rpx;
  783. text-align: center;
  784. background-color: #c87d5a;
  785. }
  786. .pop_box {
  787. width: 635rpx;
  788. padding: 80rpx 40rpx 40rpx 40rpx;
  789. font-size: 30rpx;
  790. font-weight: 600;
  791. }
  792. .pop_item {
  793. height: 60rpx;
  794. border-radius: 10rpx;
  795. text-align: center;
  796. padding: 10rpx;
  797. border: 2rpx solid #d67b54;
  798. }
  799. .lx {
  800. display: flex;
  801. justify-content: space-between;
  802. width: 410rpx;
  803. height: 70rpx;
  804. margin: auto;
  805. margin-top: 30rpx;
  806. border: 2rpx solid #d67b54;
  807. border-radius: 10rpx;
  808. line-height: 70rpx;
  809. padding-left: 20rpx;
  810. padding-right: 20rpx;
  811. color: #7b6d67;
  812. }
  813. .tit_box {
  814. width: 540rpx;
  815. display: flex;
  816. justify-content: space-between;
  817. align-items: center;
  818. margin-top: 40rpx;
  819. }
  820. .tit_box2 {
  821. width: 630rpx;
  822. display: flex;
  823. justify-content: space-between;
  824. align-items: center;
  825. margin-top: 40rpx;
  826. margin-left: 80rpx;
  827. }
  828. .zque {
  829. width: 260rpx;
  830. height: 70rpx;
  831. margin: auto;
  832. text-align: center;
  833. line-height: 70rpx;
  834. color: #ffffff;
  835. background-color: #c87d5a;
  836. border-radius: 10rpx;
  837. }
  838. .xxxc_box {
  839. /* height: 400rpx; */
  840. margin: auto;
  841. padding: 50rpx 70rpx 80rpx 90rpx;
  842. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xxxc_top.png');
  843. background-size: 100% 100%;
  844. }
  845. .wwmc {
  846. display: flex;
  847. align-items: center;
  848. justify-content: space-around;
  849. }
  850. .wwmc_left {
  851. display: flex;
  852. align-items: center;
  853. justify-content: space-around;
  854. width: 250rpx;
  855. height: 60rpx;
  856. line-height: 60rpx;
  857. background-color: #f1bd8e;
  858. border-radius: 10rpx;
  859. font-size: 30rpx;
  860. }
  861. .wwmc_right {
  862. width: 250rpx;
  863. height: 60rpx;
  864. text-align: center;
  865. line-height: 60rpx;
  866. background-color: #f1bd8e;
  867. border-radius: 6rpx;
  868. font-size: 30rpx;
  869. }
  870. .wwmc_right2 {
  871. width: 250rpx;
  872. height: 60rpx;
  873. text-align: center;
  874. /* line-height: 60rpx; */
  875. background-color: #f1bd8e;
  876. border-radius: 6rpx;
  877. font-size: 30rpx;
  878. }
  879. .top_box {
  880. padding: 20rpx;
  881. width: 100%;
  882. margin: auto;
  883. display: flex;
  884. border: 2rpx solid #ebc9a9;
  885. background-color: #fefdfb;
  886. }
  887. </style>