detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view>
  3. <My_listbox ref="List" @getlist="getDetail" bottomHeight="75" :isShowEmpty="false">
  4. <view class="main">
  5. <view class="changeby-box">
  6. <view class="changeby">
  7. <image class="headpic"
  8. :src="detail.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'"
  9. mode="aspectFill" />
  10. <view class="name u-line-1">
  11. {{ detail.changeby || '--' }}
  12. </view>
  13. </view>
  14. <navigator class="iconfont icon-a-720quanjing-bai" v-if="detail.ispanorama"
  15. style="color: #C30D23;font-size: 24px;"
  16. :url="'/packageA/webView/webView?url=' + detail.panoramaurl" />
  17. </view>
  18. <view class="title" v-if="detail.title_c || detail.title">
  19. {{ detail.title_c || detail.title }}
  20. </view>
  21. <block v-for="item in files" :key="item.attachmentid">
  22. <image class="image" v-if="item.fileType == 'image'" :src="item.cover" mode="widthFix" lazy-load="true"
  23. @click="previewImg(item)" />
  24. <video v-else-if="item.fileType == 'video'" class="video" :poster="item.subfiles[0].url"
  25. :src="item.url" />
  26. </block>
  27. </view>
  28. <view class="comment-box">
  29. <view class="head">
  30. <view class="label">
  31. 评论
  32. </view>
  33. <view class="total">
  34. 共{{ detail.commentcount || 0 }}条
  35. </view>
  36. </view>
  37. <view class="comment" v-for="item in comments" :key="item.sys_datacommentid">
  38. <view class="user">
  39. <image class="headpic"
  40. :src="item.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'"
  41. mode="aspectFill" />
  42. <view class="name">
  43. {{ item.name }}
  44. </view>
  45. </view>
  46. <view class="content">
  47. {{ item.content }}
  48. </view>
  49. <view class="time">
  50. <text class="createdate">{{ item.createdate }}</text>
  51. <view v-if="userid == item.userid" class="iconfont icon-shanchu" hover-class="navigator-hover"
  52. @click="delectComment(item)" />
  53. </view>
  54. </view>
  55. <view v-if="comments.length == 0" style="padding-bottom: 25px;">
  56. <u-empty mode="data" />
  57. </view>
  58. </view>
  59. </My_listbox>
  60. <view class="footer">
  61. <view class="but" @click="loadings.like ? '' : handleCollect(2, detail.islike)">
  62. <u-loading-icon v-if="loadings.like" />
  63. <block v-else>
  64. <view v-if="detail.islike" style="color: #E3041F;" class="iconfont icon-yidianzan" />
  65. <view v-else style="color: #646566;" class="iconfont icon-weidianzan" />
  66. <view class="text">
  67. 点赞
  68. </view>
  69. </block>
  70. </view>
  71. <view class="but" @click="loadings.collect ? '' : handleCollect(1, detail.iscollect)">
  72. <u-loading-icon v-if="loadings.collect" />
  73. <block v-else>
  74. <view v-if="detail.iscollect" style="color: #FFC300;" class="iconfont icon-yishoucang" />
  75. <view v-else style="color: #646566;" class="iconfont icon-weishoucang" />
  76. <view class="text">
  77. 收藏
  78. </view>
  79. </block>
  80. </view>
  81. <view class="input-box" hover-class="navigator-hover">
  82. <input class="input" type="text" placeholder="评论" :value="commentText" maxlength="499"
  83. @input="changeComment" confirm-type="send" @confirm="onSend">
  84. <icon v-if="commentText" class="icon" type="clear" size="3.733vw" @click="onClear" />
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. import { viewImage, formattedFiles } from "../../utils/settleFiles"
  91. export default {
  92. data() {
  93. return {
  94. sat_sharematerialid: 0,
  95. detail: {},
  96. files: [],
  97. comments: [],
  98. "content": {
  99. "ownertable": "sat_sharematerial"
  100. },
  101. commentText: "",
  102. userid: uni.getStorageSync('userMsg').userid,
  103. loadings: {
  104. collect: false,
  105. like: false
  106. }
  107. }
  108. },
  109. onLoad(options) {
  110. this.sat_sharematerialid = options.id;
  111. this.getDetail(true);
  112. },
  113. onUnload() {
  114. this.$Http.setCount && delete this.$Http.setCount
  115. },
  116. methods: {
  117. previewImg(item) {
  118. viewImage(item.url)
  119. },
  120. getDetail(init = false) {
  121. this.getList(init)
  122. if (!init) return;
  123. this.$Http.basic({
  124. "id": 20240417104702,
  125. "content": {
  126. "sat_sharematerialid": this.sat_sharematerialid
  127. },
  128. }).then(res => {
  129. this.$refs.List.RefreshToComplete()
  130. console.log("设计实景详情", res)
  131. if (this.cutoff(res.msg)) return;
  132. this.files = formattedFiles(res.data.attinfos_pic.map(v => v.attinfos[0])).map(v => {
  133. if (v.fileType == 'image') v.cover = this.getSpecifiedImage(v, 'compressed')
  134. return v
  135. })
  136. this.detail = res.data;
  137. this.setCount()
  138. uni.setNavigationBarTitle({
  139. title: res.data.title_c || res.data.title || '详情'
  140. });
  141. })
  142. },
  143. getList(init = false) {
  144. if (this.paging(this.content, init)) return;
  145. this.content.ownerid = this.sat_sharematerialid;
  146. this.$Http.basic({
  147. "id": 20240417161702,
  148. content: this.content
  149. }).then(res => {
  150. console.log("获取评论列表", res)
  151. if (this.cutoff(res.msg)) return;
  152. this.comments = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  153. this.content = this.$refs.List.paging(this.content, res)
  154. })
  155. },
  156. changeComment(e) {
  157. this.commentText = e.detail.value;
  158. },
  159. onClear() {
  160. let that = this;
  161. uni.showModal({
  162. title: '提示',
  163. content: '是否确定清空评论?',
  164. success: ({ confirm }) => {
  165. if (confirm) that.commentText = ""
  166. },
  167. })
  168. },
  169. onSend() {
  170. if (this.commentText == '') return uni.showToast({
  171. title: '还未输入评论内容!',
  172. duration: 2000,
  173. icon: "none"
  174. });
  175. this.$Http.basic({
  176. "id": 20240417161502,
  177. "content": {
  178. "ownertable": "sat_sharematerial",
  179. "ownerid": this.sat_sharematerialid,
  180. "contentstr": this.commentText
  181. },
  182. }).then(res => {
  183. console.log("发送评论", res)
  184. if (this.cutoff(res.msg, '评论成功')) return;
  185. this.commentText = '';
  186. this.getDetail(true)
  187. })
  188. },
  189. delectComment(item) {
  190. let that = this;
  191. uni.showModal({
  192. title: '提示',
  193. content: "是否确定删除该评论?",
  194. success: ({ confirm }) => {
  195. if (confirm) that.$Http.basic({
  196. "id": 20240417161602,
  197. "content": {
  198. "sys_datacommentid": item.sys_datacommentid,
  199. "ownertable": "sat_sharematerial",
  200. "ownerid": item.ownerid
  201. },
  202. }).then(res => {
  203. console.log("删除评论", res)
  204. if (this.cutoff(res.msg, '删除成功')) return;
  205. that.detail.commentcount -= 1;
  206. that.comments = that.comments.filter(v => v.sys_datacommentid != item.sys_datacommentid);
  207. this.setCount()
  208. })
  209. },
  210. })
  211. },
  212. setCount() {
  213. this.$Http.setCount && this.$Http.setCount(this.detail)
  214. },
  215. handleCollect(type, value) {
  216. if (type == 1) {
  217. this.loadings.collect = true;
  218. } else {
  219. this.loadings.like = true;
  220. }
  221. this.$Http.basic({
  222. "id": 20240416133702,
  223. "content": {
  224. "ownertable": "sat_sharematerial",
  225. "ownerid": this.detail.sat_sharematerialid,
  226. type
  227. },
  228. }).then(res => {
  229. console.log(value ? '取消' : '添加', type == 1 ? "收藏" : "喜欢", res)
  230. if (type == 1) {
  231. this.loadings.collect = false;
  232. } else {
  233. this.loadings.like = false;
  234. }
  235. if (this.cutoff(res.msg)) return;
  236. if (type == 1) {
  237. this.detail.iscollect = value ? 0 : 1
  238. this.detail.collectcount = value ? this.detail.collectcount - 1 : this.detail.collectcount - 0 + 1
  239. } else {
  240. this.detail.islike = value ? 0 : 1
  241. this.detail.likecount = value ? this.detail.likecount - 1 : this.detail.likecount - 0 + 1
  242. }
  243. this.setCount();
  244. })
  245. },
  246. },
  247. }
  248. </script>
  249. <style lang="scss">
  250. .main {
  251. width: 355px;
  252. margin: 10px auto;
  253. .changeby-box {
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. .changeby {
  258. display: flex;
  259. align-items: center;
  260. .headpic {
  261. width: 24px;
  262. height: 24px;
  263. border-radius: 50%;
  264. margin-right: 5px;
  265. }
  266. .name {
  267. font-family: Source Han Sans SC, Source Han Sans SC;
  268. font-size: 12px;
  269. color: #333333;
  270. width: 200px;
  271. }
  272. }
  273. }
  274. .title {
  275. font-family: Source Han Sans SC, Source Han Sans SC;
  276. font-size: 12px;
  277. color: #333333;
  278. line-height: 20px;
  279. margin-top: 10px;
  280. }
  281. .image {
  282. width: 100%;
  283. border-radius: 5px;
  284. margin-top: 10px;
  285. }
  286. .video {
  287. width: 355px;
  288. height: 240px;
  289. border-radius: 5px;
  290. margin-top: 10px;
  291. }
  292. }
  293. .comment-box {
  294. background: #fff;
  295. margin-top: 10px;
  296. .head {
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: center;
  300. width: 100vw;
  301. height: 45px;
  302. .label {
  303. font-family: PingFang SC, PingFang SC;
  304. font-weight: bold;
  305. font-size: 16px;
  306. color: #333333;
  307. margin-left: 10px;
  308. }
  309. .total {
  310. font-family: PingFang SC, PingFang SC;
  311. font-size: 14px;
  312. color: #333333;
  313. margin-right: 10px;
  314. }
  315. }
  316. .comment {
  317. padding: 10px;
  318. .user {
  319. display: flex;
  320. align-items: center;
  321. height: 32px;
  322. .headpic {
  323. width: 32px;
  324. height: 32px;
  325. border-radius: 50%;
  326. }
  327. .name {
  328. margin-left: 10px;
  329. font-family: Source Han Sans SC,
  330. Source Han Sans SC;
  331. font-weight: 500;
  332. font-size: 14px;
  333. color: #666666;
  334. }
  335. }
  336. .content {
  337. width: 313px;
  338. margin-top: 4px;
  339. margin-left: 42px;
  340. line-height: 20px;
  341. font-family: Source Han Sans SC, Source Han Sans SC;
  342. font-size: 14px;
  343. color: #333333;
  344. }
  345. .time {
  346. display: flex;
  347. justify-content: space-between;
  348. width: 313px;
  349. margin-top: 10px;
  350. margin-left: 42px;
  351. .iconfont,
  352. .createdate {
  353. font-family: Source Han Sans SC, Source Han Sans SC;
  354. font-size: 12px;
  355. color: #999999;
  356. line-height: 17px;
  357. }
  358. .iconfont {
  359. padding: 0 5px;
  360. border-radius: 4px;
  361. }
  362. }
  363. }
  364. }
  365. .footer {
  366. display: flex;
  367. position: fixed;
  368. bottom: 0;
  369. left: 0;
  370. width: 375px;
  371. height: 70px;
  372. background: #FFFFFF;
  373. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  374. .but {
  375. width: 50px;
  376. text-align: center;
  377. padding-top: 13px;
  378. .iconfont {
  379. font-size: 16px;
  380. margin-bottom: 4px;
  381. }
  382. .text {
  383. font-family: PingFang SC, PingFang SC;
  384. font-size: 10px;
  385. color: #333333;
  386. height: 100%;
  387. box-sizing: border-box;
  388. }
  389. }
  390. .input-box {
  391. display: flex;
  392. align-items: center;
  393. width: 245px;
  394. height: 45px;
  395. background: #F7F7F7;
  396. border-radius: 50px;
  397. border: 1px solid #CCCCCC;
  398. margin-left: 20px;
  399. margin-top: 6px;
  400. padding: 0 10px 0 20px;
  401. box-sizing: border-box;
  402. .input {
  403. flex: 1;
  404. height: 45px;
  405. line-height: 45px;
  406. }
  407. .icon {
  408. margin-left: 5px;
  409. }
  410. }
  411. }
  412. </style>