comment.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. <template>
  2. <view :class="['comment-popup']" :style="'width:'+boxWidth+'px;height;486px;'">
  3. <u-popup class="popup-box popup-setting popup-profile" :show="show" @close="closeComment" :zIndex="996"
  4. :safeAreaInsetTop="true" bgColor="#fff" round="20rpx" :closeOnClickOverlay="true" mode="bottom"
  5. :overlayStyle="{'z-index': 98}" :mask-custom-style="{backgroundColor:'transparent !important'}"
  6. @touchmove.stop.prevent
  7. :customStyle="{overflowY: 'scroll',border:'1rpx solid #fff',borderColor:'#333',top: 0,width: (boxWidth)+'px',height: '486px'}">
  8. <view :class="['popup-main','popup-main-'+device,'popup-main-'+(isH5?'h5':'app')]"
  9. :style="'width:'+boxWidth+'px;486px'">
  10. <view class="comment-box">
  11. <view class="comment-title">
  12. <text class="comment-title_text">{{params.total||0}}{{$tt('条评论')}}</text>
  13. </view>
  14. <view class="comment-list">
  15. <scroll-view class="scroll-box" @scrolltolower="loadMore" scroll-y>
  16. <view class="scroll-wrap">
  17. <view class="comment-item" v-for="(v,k) in dataList" :key="k">
  18. <view class="comment-user-avatar"
  19. @click="gotoPage('/pages/user/home?id='+v.user_id)">
  20. <image class="user-avatar_image" :src="v.member?v.member.avatar:''"
  21. mode="aspectFill">
  22. </image>
  23. </view>
  24. <view class="info-box" :style="'width:'+(boxWidth-60)+'px;'">
  25. <view class="user-name" @longpress="showDelete(v,k,-1)">
  26. <text class="user-name_text">{{v.member? v.member.nickname:''}}</text>
  27. <image class="del-icon"
  28. v-if="(userInfo.id == v.user_id || liveUserId==userInfo.id) && v.show_delete "
  29. src="../../static/icons/user/icon-del.png" mode="aspectFill"></image>
  30. </view>
  31. <view class="comment-content-box" @longpress="showDelete(v,k,-1)">
  32. <view class="content-info">
  33. <text class="content-info_text">{{v.content||''}}</text>
  34. </view>
  35. <view class="content-image-box" v-if="v.albums.length>0">
  36. <image class="image-box_image" @click="previewImage(ak,v.albums)"
  37. :src="va.url" v-for="(va,ak) in v.albums" :key="ak" mode="widthFix"
  38. :lazy-load="true">
  39. </image>
  40. </view>
  41. <view class="comment-time">
  42. <view class="desc-box">
  43. <text class="comment-time_text">{{v.time_text}}</text>
  44. <text class="comment-reply_text"
  45. @click="replyTo(v,k,0)">{{$tt('回复')}}</text>
  46. </view>
  47. <view class="like-box" @click="like(v,k,-1)">
  48. <image class="comment-like_icon" v-if="v.is_like"
  49. src="../../static/icons/user/icon-like-red.png" mode="">
  50. </image>
  51. <image v-else class="comment-like_icon"
  52. src="../../static/icons/user/icon-like-gray.png" mode="">
  53. </image>
  54. <text class="like-num">{{getNumText(v.like_num)}}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="reply-show-btn" v-if="v.reply_count>0 && !v.reply_show"
  59. @click="showMore(v,k)">
  60. <text
  61. class="show-more_text">{{$tt('展开')}}{{v.reply_count||0}}{{'条评论'}}</text>
  62. <image class="show-icon" src="../../static/icons/user/icon-down-arrow.png"
  63. mode="">
  64. </image>
  65. </view>
  66. <view class="reply-show-btn" v-else-if="v.reply_count>v.reply_list.length"
  67. @click="showMore(v,k)">
  68. <text class="show-more_text">{{$tt('展开更多评论')}}</text>
  69. <image class="show-icon" src="../../static/icons/user/icon-down-arrow.png"
  70. mode="">
  71. </image>
  72. </view>
  73. <view class="comment-reply-list" v-if="v.reply_count>0 && v.reply_show">
  74. <view class="comment-item reply-item" v-for="(vv,kk) in v.reply_list"
  75. :key="kk">
  76. <view class="comment-user-avatar reply-user-avatar"
  77. @click="gotoPage('/pages/user/home?id='+vv.user_id)">
  78. <image class="user-avatar_image reply-user-avatar_image"
  79. :src="vv.member?vv.member.avatar:''" mode="aspectFill">
  80. </image>
  81. </view>
  82. <view class="info-box" :style="'width:'+(boxWidth-90)+'px;'">
  83. <view class="user-name" @longpress="showDelete(vv,k,kk)">
  84. <text
  85. class="user-name_text">{{vv.member? vv.member.nickname:''}}</text>
  86. <image @click="deleteRow(vv,k,kk)" class="del-icon"
  87. v-if="(userInfo.id == v.user_id || liveUserId == userInfo.id) && vv.show_delete"
  88. src="../../static/icons/user/icon-del.png"
  89. mode="aspectFill"></image>
  90. </view>
  91. <view class="comment-content-box" @longpress="showDelete(vv,k,kk)">
  92. <view class="content-info">
  93. <text
  94. class="content-info_text reply-info_text">{{vv.content||''}}</text>
  95. </view>
  96. <view class="content-image-box" v-if="vv.albums.length>0">
  97. <image class="image-box_image" :src="va.url"
  98. v-for="(va,ak) in vv.albums" :key="ak" mode="aspectFit"
  99. :lazy-load="true"></image>
  100. </view>
  101. <view class="comment-time">
  102. <view class="desc-box">
  103. <text class="comment-time_text">{{vv.time_text}}</text>
  104. <text class="comment-reply_text"
  105. @click="replyTo(v,k,vv)">{{$tt('回复')}}</text>
  106. </view>
  107. <view class="like-box" @click="like(vv,k,kk)">
  108. <image class="comment-like_icon" v-if="vv.is_like"
  109. src="../../static/icons/user/icon-like-red.png"
  110. mode="">
  111. </image>
  112. <image v-else class="comment-like_icon"
  113. src="../../static/icons/user/icon-like-gray.png"
  114. mode="">
  115. </image>
  116. <text
  117. class="like-num">{{getNumText(vv.like_num)}}</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="reply-show-btn" v-if="v.reply_show" @click="showUp(v,k)">
  125. <text class="close-reply">{{$tt('收起')}}</text>
  126. <image class="show-icon" src="../../static/icons/user/icon-up-arrow.png"
  127. mode="">
  128. </image>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="scroll-block">
  133. </view>
  134. </view>
  135. </scroll-view>
  136. </view>
  137. </view>
  138. <view class="input-box" :style="'width:'+boxWidth+'px;'">
  139. <view class="photo-box" v-if="formData.albums.length>0">
  140. <view class="image-box" v-for="(v,k) in formData.albums" :key="k">
  141. <image class="photo-image" :src="v.url" mode="aspectFill"
  142. @click="previewImage(k,formData.albums)"></image>
  143. <image class="icon-image-close" src="../../static/icons/user/icon-close.png"
  144. mode="aspectFill" @click="deletePic(k)"></image>
  145. </view>
  146. </view>
  147. <view class="send-box">
  148. <u-input class="input-btn" type="text" v-model="formData.content" shape="circle"
  149. fontSize="28rpx" color="#fff" confirmType="send"
  150. :placeholder="formData.reply_name?$tt('回复')+':'+formData.reply_name:$tt('说点什么')+'...'"
  151. border="none" :maxlength="150" clearable @focus="showGiftIcon=false" :holdKeyboard="true"
  152. cursorSpacing="30" @clear="clearInput()" @confirm="publishSubmit">
  153. </u-input>
  154. <!-- <u-upload class="photo-upload" :action="uploadConfig.url" :header="uploadConfig.header"
  155. :accept="'image'" @afterRead="afterRead" :uploadText="$tt('图片')" imageMode="aspectFit"
  156. :width="0" :height="0" :file-list="formData.albums" name="albums" multiple :maxCount="3"
  157. :previewImage="false">
  158. <image class="icon-photo" src="../../static/icons/user/icon-photo.png" mode="aspectFill">
  159. </image>
  160. </u-upload> -->
  161. <!-- <image class="icon-photo" @click="chooseImage" src="../../static/icons/user/icon-photo.png"
  162. mode="aspectFill">
  163. </image> -->
  164. <text @click="publishSubmit" class="input-send">{{$tt('发送')}}</text>
  165. </view>
  166. </view>
  167. </view>
  168. </u-popup>
  169. <u-loading-icon class="loading" :show="loading" size="60" color="#14ECCC"
  170. custom-style="position:absolute; top: 30rpx;z-index: 10099;left:0;right:0;margin: 0 auto;">
  171. </u-loading-icon>
  172. </view>
  173. </template>
  174. <script>
  175. import {
  176. getToken
  177. } from '../../config/cache.js';
  178. import request from '../../config/request.js'
  179. let app = getApp().globalData;
  180. export default {
  181. name: "play",
  182. props: ['id', 'show', 'videoIndex', 'liveUserId'],
  183. data() {
  184. return {
  185. loading: false,
  186. boxWidth: 360,
  187. boxHeight: 800,
  188. isH5: false,
  189. device: '',
  190. userInfo: {
  191. id: 0
  192. },
  193. params: {
  194. page: 1,
  195. pageSize: 18,
  196. total: 0,
  197. video_id: 0,
  198. reply_id: 0,
  199. loaded: false,
  200. },
  201. formData: {
  202. video_id: 0,
  203. reply_id: 0,
  204. reply_uid: 0,
  205. reply_index: -1,
  206. reply_name: '',
  207. albums: [],
  208. content: '',
  209. },
  210. dataList: [],
  211. fileList: [],
  212. uploadConfig: {
  213. url: this.baseUrl + '/api/v1/uploadImage',
  214. header: {
  215. Authorization: "Bearer " + getToken()
  216. }
  217. },
  218. }
  219. },
  220. created() {
  221. const windowInfo = uni.getWindowInfo();
  222. this.boxHeight = windowInfo.windowHeight
  223. this.boxWidth = windowInfo.windowWidth
  224. this.params.video_id = this.id
  225. this.formData.video_id = this.id
  226. this.device = uni.getSystemInfoSync().osName;
  227. // #ifdef H5 || MP-WEIXIN
  228. this.isH5 = true
  229. // #endif
  230. this.getInfo()
  231. this.getList();
  232. },
  233. methods: {
  234. $tt(text, arr = {}) {
  235. return app.$t(text, arr);
  236. },
  237. gotoPage(url) {
  238. uni.navigateTo({
  239. url: url
  240. })
  241. },
  242. loadData() {
  243. this.dataList = []
  244. this.params.page = 1
  245. this.params.loaded = false
  246. this.getList()
  247. },
  248. loadMore() {
  249. if (!this.params.loaded) {
  250. this.params.page++;
  251. this.getList()
  252. }
  253. },
  254. closeComment() {
  255. uni.$emit('close-comment', true);
  256. },
  257. // 数字格式化
  258. getNumText(num) {
  259. return num > 10000 ? (num / 10000).toFixed(1) + this.$tt('万') : num;
  260. },
  261. // 预览
  262. previewImage(index, urls) {
  263. let arr = [];
  264. if (urls.length <= 0) {
  265. return false;
  266. }
  267. urls.forEach((item, k) => {
  268. arr.push(item.url)
  269. })
  270. console.log(index, urls)
  271. uni.previewImage({
  272. current: index,
  273. urls: arr ? arr : [],
  274. loop: true
  275. })
  276. },
  277. showUp(row, index) {
  278. this.dataList[index].reply_show = 0
  279. },
  280. showMore(row, index) {
  281. this.getReplyList(row.id)
  282. this.dataList[index].reply_show = 1
  283. },
  284. clearInput() {
  285. this.formData.content = '';
  286. this.formData.reply_uid = 0;
  287. this.formData.reply_name = '';
  288. this.formData.reply_id = 0;
  289. this.formData.reply_index = -1;
  290. },
  291. // 回复
  292. replyTo(row, index, reply_row) {
  293. console.log('回复', row)
  294. if (reply_row) {
  295. this.formData.reply_uid = reply_row.user_id;
  296. this.formData.reply_name = typeof(reply_row.member.nickname) != 'undefined' ? reply_row.member
  297. .nickname : '';
  298. } else {
  299. this.formData.reply_name = typeof(row.member.nickname) != 'undefined' ? row.member.nickname : '';
  300. }
  301. this.formData.reply_id = typeof(row.id) != 'undefined' ? row.id : 0;
  302. this.formData.reply_index = index;
  303. },
  304. // 用户信息
  305. async getInfo() {
  306. let _this = this
  307. const res = await request.api('/user/info', {
  308. type: 'info',
  309. })
  310. if (res.success == true) {
  311. this.userInfo = res.data
  312. }
  313. },
  314. // 列表
  315. async getList() {
  316. this.loading = true;
  317. const res = await request.api('/video/comment/index', this.params)
  318. this.loading = false;
  319. this.params.total = typeof(res.data.all_total) != 'undefined' ? res.data.all_total : 0
  320. if (res.success == true && res.data.list.length > 0) {
  321. if (this.params.page == 1) {
  322. this.dataList = res.data.list
  323. } else {
  324. this.dataList = this.dataList.concat(res.data.list)
  325. }
  326. if (this.formData.reply_index > 0) {
  327. let index = this.formData.reply_index;
  328. this.dataList[index].reply_show = 1
  329. }
  330. this.$forceUpdate()
  331. } else if (res.code == 403) {
  332. uni.showToast({
  333. title: this.$tt('请先登录'),
  334. icon: 'none'
  335. })
  336. } else {
  337. if (this.params.page != 1) {
  338. this.params.loaded = true
  339. uni.showToast({
  340. title: this.$tt('暂时没有更多了'),
  341. icon: 'none'
  342. })
  343. }
  344. }
  345. },
  346. // 加载回复列表
  347. async getReplyList(reply_id, index) {
  348. this.loading = true;
  349. let params = Object.assign({}, this.params);
  350. params.reply_id = reply_id
  351. const res = await request.api('/video/comment/index', params)
  352. this.loading = false;
  353. this.dataList[index].reply_count = typeof(res.data.total) != 'undefined' ? res.data.total : 0
  354. if (res.success == true && res.data.list.length > 0) {
  355. let dataList = this.dataList[index]['reply_list']
  356. if (dataList.length <= 0) {
  357. dataList = res.data.list
  358. } else {
  359. dataList = dataList.concat(res.data.list)
  360. }
  361. this.dataList[index]['reply_list'] = dataList
  362. this.$forceUpdate()
  363. }
  364. },
  365. // 发布
  366. async publishSubmit() {
  367. if (this.formData.content == '' && this.formData.albums.length <= 0) {
  368. }
  369. this.loading = true;
  370. const res = await request.api('/video/comment/publish', this.formData)
  371. this.loading = false;
  372. this.params.total = typeof(res.data.total) != 'undefined' ? res.data.total : 0
  373. if (res.success == true) {
  374. this.formData.content = ''
  375. this.formData.albums = []
  376. this.loadData()
  377. uni.hideKeyboard()
  378. uni.$emit('load.comment_num', {
  379. index: this.videoIndex,
  380. num: 1
  381. })
  382. } else if (res.code == 403) {
  383. uni.showModal({
  384. title: this.$tt('操作提示'),
  385. content: this.$tt('请先登录账号后使用'),
  386. cancelText: this.$tt('暂不登录'),
  387. confirmText: this.$tt('立即登录'),
  388. confirmColor: '#14ECCC',
  389. success: function(result) {
  390. if (result.confirm) {
  391. uni.navigateTo({
  392. url: '/pages/login/login'
  393. })
  394. } else {
  395. uni.navigateTo({
  396. url: '/pages/index/index'
  397. })
  398. }
  399. }
  400. })
  401. } else {
  402. uni.showToast({
  403. title: this.$tt(res.msg),
  404. icon: 'none'
  405. })
  406. }
  407. },
  408. // 点赞
  409. async like(data, index, index1) {
  410. let row = Object.assign({}, data)
  411. if (this.loading) {
  412. return false;
  413. }
  414. this.loading = true;
  415. const res = await request.api('/video/comment/like', {
  416. id: row.id,
  417. status: row.is_like == 1 ? 2 : 1,
  418. })
  419. this.loading = false;
  420. if (res.code == 403) {
  421. uni.showModal({
  422. title: this.$tt('操作提示'),
  423. content: this.$tt('请先登录账号后使用'),
  424. cancelText: this.$tt('暂不登录'),
  425. confirmText: this.$tt('立即登录'),
  426. confirmColor: '#14ECCC',
  427. success: function(result) {
  428. if (result.confirm) {
  429. uni.navigateTo({
  430. url: '/pages/login/login'
  431. })
  432. } else {
  433. uni.navigateTo({
  434. url: '/pages/index/index'
  435. })
  436. }
  437. }
  438. })
  439. } else {
  440. // this.loadData()
  441. if (index1 >= 0) {
  442. this.dataList[index].reply_show = 1
  443. this.dataList[index]['reply_list'][index1].is_like = row.is_like == 1 ? 0 : 1
  444. let num = this.dataList[index]['reply_list'][index1].like_num
  445. this.dataList[index]['reply_list'][index1].like_num = (row.is_like == 1 ? (num - 1 > 0 ? num -
  446. 1 : 0) : num + 1)
  447. } else {
  448. this.dataList[index].is_like = row.is_like == 1 ? 0 : 1
  449. let num = this.dataList[index].like_num
  450. this.dataList[index].like_num = (row.is_like == 1 ? (num - 1 > 0 ? num - 1 : 0) : num + 1)
  451. }
  452. this.$forceUpdate()
  453. }
  454. },
  455. //
  456. showDelete(row, index, index1) {
  457. return false;
  458. let _this = this
  459. uni.showModal({
  460. title: _this.$tt('操作提示'),
  461. content: _this.$tt('是否删除该条评论?不可恢复,谨慎操作~'),
  462. cancelText: _this.$tt('取消'),
  463. confirmText: _this.$tt('确定'),
  464. confirmColor: '#14ECCC',
  465. success: function(res) {
  466. if (res.confirm) {
  467. _this.deleteRow(row, index, index1)
  468. }
  469. }
  470. })
  471. },
  472. // 删除
  473. async deleteRow(data, index, index1) {
  474. let row = Object.assign({}, data)
  475. if (this.loading) {
  476. return false;
  477. }
  478. this.loading = true;
  479. const res = await request.api('/video/comment/delete', {
  480. id: row.id,
  481. })
  482. this.loading = false;
  483. if (res.success == true) {
  484. if (index1 > 0) {
  485. this.dataList[index]['reply_list'].splice(index1, 1)
  486. } else {
  487. this.dataList.splice(index1, 1)
  488. }
  489. this.params.total = (this.params.total > 1) ? this.params.total - 1 : 0
  490. uni.$emit('load.comment_num', {
  491. index: this.videoIndex,
  492. num: -1
  493. })
  494. } else if (res.code == 403) {
  495. uni.showModal({
  496. title: this.$tt('操作提示'),
  497. content: this.$tt('请先登录账号后使用'),
  498. cancelText: this.$tt('暂不登录'),
  499. confirmText: this.$tt('立即登录'),
  500. confirmColor: '#14ECCC',
  501. success: function(result) {
  502. if (result.confirm) {
  503. uni.navigateTo({
  504. url: '/pages/login/login'
  505. })
  506. } else {
  507. uni.navigateTo({
  508. url: '/pages/index/index'
  509. })
  510. }
  511. }
  512. })
  513. } else {
  514. uni.showToast({
  515. title: this.$tt(res.msg),
  516. icon: 'none'
  517. })
  518. }
  519. },
  520. async chooseImage(name) {
  521. let _this = this
  522. uni.chooseImage({
  523. count: 3,
  524. success: function(res) {
  525. let urls = res.tempFilePaths;
  526. console.log(res)
  527. _this.catchImageUpload(name, urls)
  528. }
  529. })
  530. },
  531. async catchImageUpload(name, urls) {
  532. let _this = this
  533. if (urls.length > 0) {
  534. for (let i = 0; i < urls.length; i++) {
  535. let res = await _this.uploadFilePromise(urls[i], name);
  536. _this.formData[name][i] = res;
  537. }
  538. }
  539. },
  540. // 删除图片
  541. async deletePic(index) {
  542. this.formData['albums'].splice(index, 1)
  543. },
  544. // 读取图片
  545. async afterRead(event) {
  546. console.log(event)
  547. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  548. let lists = [].concat(event.file)
  549. let fileListLen = this.formData[event.name].length
  550. lists.map((item) => {
  551. this.formData[event.name].push({
  552. ...item,
  553. status: 'uploading',
  554. message: this.$tt('上传中')
  555. })
  556. })
  557. for (let i = 0; i < lists.length; i++) {
  558. const result = await this.uploadFilePromise(lists[i].url)
  559. let item = this.formData[event.name][fileListLen]
  560. if (result) {
  561. this.formData[event.name].splice(fileListLen, 1, Object.assign(
  562. item, {
  563. status: 'success',
  564. message: this.$tt('上传成功'),
  565. url: result.url
  566. }))
  567. fileListLen++
  568. } else {
  569. this.formData[event.name].splice(fileListLen, 1, Object.assign(
  570. item, {
  571. status: 'fail',
  572. message: this.$tt('上传失败'),
  573. }))
  574. }
  575. }
  576. },
  577. blobToBase64(blob, callback) {
  578. // 创建FileReader对象
  579. let reader = new FileReader();
  580. reader.onload = function(e) {
  581. // 当读取操作完成时,调用callback函数并传入转换后的Base64字符串
  582. callback(e.target.result);
  583. };
  584. reader.readAsDataURL(blob); // 读取Blob对象
  585. },
  586. uploadFilePromise(url) {
  587. let _this = this
  588. console.log(url)
  589. _this.loading = true
  590. plus.io.resolveLocalFileSystemURL(url, function(entry) {
  591. entry.file(function(file) {
  592. var reader = new plus.io.FileReader();
  593. reader.onloadend = function(e) {
  594. // 这里的e.target.result就是文件的blob数据
  595. var blob = new Blob([e.target.result], {
  596. type: file.type
  597. });
  598. console.log('文件', blob)
  599. }
  600. })
  601. })
  602. return new Promise((resolve, reject) => {
  603. let a = uni.uploadFile({
  604. url: _this.baseUrl + '/api/v1/uploadImage',
  605. filePath: url,
  606. fileType: 'image',
  607. header: _this.uploadConfig.header,
  608. name: 'file',
  609. formData: {},
  610. success: (res) => {
  611. console.log('上传结果', res)
  612. _this.loading = false
  613. let result = JSON.parse(res.data)
  614. if (result.success == true) {
  615. resolve(result.data)
  616. } else {
  617. uni.showToast({
  618. title: this.$tt('上传失败'),
  619. style: 'z-index:10078',
  620. icon: 'none',
  621. })
  622. }
  623. }
  624. });
  625. })
  626. },
  627. }
  628. }
  629. </script>
  630. <style scoped>
  631. .comment-popup {
  632. position: fixed;
  633. z-index: 996;
  634. background-color: transparent;
  635. /* bottom: -2rpx; */
  636. }
  637. .popup-main {
  638. overflow: hidden;
  639. background-color: #303030;
  640. height: 600px;
  641. /* position: absolute; */
  642. bottom: 0;
  643. left: -1rpx;
  644. border-top-left-radius: 10rpx;
  645. border-top-right-radius: 10rpx;
  646. }
  647. .popup-main-app {
  648. position: absolute;
  649. }
  650. .popup-main-android {
  651. /* position: absolute; */
  652. padding-bottom: 120rpx;
  653. }
  654. .popup-main-h5 {
  655. padding-bottom: 120rpx;
  656. }
  657. .comment-title {
  658. display: flex;
  659. align-items: center;
  660. padding: 30rpx 0;
  661. border-bottom: 1rpx solid #666;
  662. }
  663. .comment-title_text {
  664. height: 36rpx;
  665. line-height: 36rpx;
  666. color: #fff;
  667. font-size: 28rpx;
  668. }
  669. .comment-list {
  670. height: 486px;
  671. padding: 30rpx 0rpx 130rpx;
  672. }
  673. .scroll-box {
  674. height: 600px;
  675. }
  676. .scroll-wrap {
  677. padding: 20rpx 30rpx 60rpx;
  678. }
  679. .scroll-block {
  680. width: 100%;
  681. height: 200rpx;
  682. }
  683. .comment-item {
  684. display: flex;
  685. flex-direction: row;
  686. /* align-items: center; */
  687. margin-bottom: 20rpx;
  688. }
  689. .comment-user-avatar {
  690. width: 42rpx;
  691. height: 42rpx;
  692. margin-right: 20rpx;
  693. border-radius: 100rpx;
  694. }
  695. .user-avatar_image {
  696. width: 42rpx;
  697. height: 42rpx;
  698. border-radius: 200rpx;
  699. }
  700. .reply-user-avatar {
  701. width: 28rpx;
  702. height: 28rpx;
  703. border-radius: 200rpx;
  704. margin-right: 10rpx;
  705. }
  706. .reply-user-avatar_image {
  707. width: 28rpx;
  708. height: 28rpx;
  709. border-radius: 200rpx;
  710. }
  711. .info-box {}
  712. .user-name {
  713. display: flex;
  714. flex-direction: row;
  715. align-items: center;
  716. }
  717. .user-name_text {
  718. font-size: 24rpx;
  719. color: #666;
  720. /* flex: 1; */
  721. }
  722. .del-icon {
  723. width: 38rpx;
  724. height: 38rpx;
  725. margin-left: 30rpx;
  726. }
  727. .content-info {
  728. padding: 8rpx 0;
  729. }
  730. .content-info_text {
  731. font-size: 26rpx;
  732. color: #e4e4e4;
  733. }
  734. .reply-info_text {
  735. font-size: 26rpx;
  736. }
  737. .content-image-box {
  738. display: flex;
  739. flex-direction: row;
  740. align-items: center;
  741. padding-bottom: 10rpx;
  742. }
  743. .image-box_image {
  744. width: 150rpx;
  745. margin-right: 20rpx;
  746. }
  747. .comment-time {
  748. display: flex;
  749. flex-direction: row;
  750. align-items: center;
  751. margin-bottom: 12rpx;
  752. }
  753. .desc-box {
  754. flex: 1;
  755. display: flex;
  756. flex-direction: row;
  757. align-items: center;
  758. }
  759. .comment-time_text {
  760. font-size: 24rpx;
  761. color: #666;
  762. }
  763. .comment-reply_text {
  764. margin-left: 20rpx;
  765. font-size: 24rpx;
  766. color: #999;
  767. }
  768. .like-box {
  769. display: flex;
  770. flex-direction: row;
  771. align-items: center;
  772. margin-right: 30rpx;
  773. }
  774. .comment-like_icon {
  775. width: 38rpx;
  776. height: 38rpx;
  777. }
  778. .like-num {
  779. margin-left: 4rpx;
  780. font-size: 24rpx;
  781. color: #999;
  782. }
  783. .reply-show-btn {
  784. display: flex;
  785. flex-direction: row;
  786. align-items: center;
  787. }
  788. .close-reply {
  789. margin-left: 4rpx;
  790. font-size: 24rpx;
  791. color: #999;
  792. }
  793. .show-more_text {
  794. margin-left: 4rpx;
  795. font-size: 24rpx;
  796. color: #999;
  797. }
  798. .show-icon {
  799. margin-left: 10rpx;
  800. width: 30rpx;
  801. height: 30rpx;
  802. }
  803. .input-box {
  804. /* width: 100%; */
  805. /* height: 48rpx; */
  806. position: absolute;
  807. background-color: #222;
  808. bottom: -2rpx;
  809. padding: 30rpx 30rpx;
  810. }
  811. .photo-box {
  812. padding: 10rpx 0;
  813. display: flex;
  814. flex-direction: row;
  815. align-items: center;
  816. }
  817. .image-box {
  818. position: relative;
  819. margin-right: 20rpx;
  820. }
  821. .photo-image {
  822. width: 64rpx;
  823. height: 64rpx;
  824. }
  825. .icon-image-close {
  826. width: 20rpx;
  827. height: 20rpx;
  828. position: absolute;
  829. top: 4rpx;
  830. right: 2rpx;
  831. background-color: #666;
  832. padding: 2rpx;
  833. }
  834. .send-box {
  835. display: flex;
  836. flex-direction: row;
  837. align-items: center;
  838. }
  839. .photo-upload {
  840. width: 42rpx;
  841. height: 42rpx;
  842. margin: 0rpx 30rpx;
  843. flex: 0;
  844. position: relative;
  845. }
  846. .icon-photo {
  847. width: 42rpx;
  848. height: 42rpx;
  849. /* margin: 0rpx 30rpx; */
  850. /* position: absolute; */
  851. /* top: -20rpx; */
  852. /* left: -40rpx; */
  853. }
  854. .input-btn {
  855. /* width: 320rpx; */
  856. height: 80rpx;
  857. line-height: 60rpx;
  858. font-size: 28rpx;
  859. color: #666;
  860. flex: 1;
  861. }
  862. .input-send {
  863. font-size: 28rpx;
  864. border-radius: 20rpx;
  865. padding: 10rpx 40rpx;
  866. color: #000;
  867. background-color: #14ECCC;
  868. }
  869. </style>