chat.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. <template>
  2. <view>
  3. <view style="width: 100%; padding-bottom: 160rpx">
  4. <view style="display: flex; flex-direction: column" v-for="(item, index) in ListItem" :key="index">
  5. <view style="margin-top: 15rpx; width: 100%; text-align: center; font-size: 26rpx; color: #999999">
  6. {{ item.createTime }}
  7. </view>
  8. <view v-if="item.sendType === 2" style="width: 83%; margin-right: 15%">
  9. <view class="chat-listitem" style="float: left; margin-left: 10rpx">
  10. <view>
  11. <image src="https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png" class="chat-listitem-image"></image>
  12. </view>
  13. <view v-if="item.content && item.type === 1" class="chat-listitem-text" style="margin-left: 20rpx">{{ item.content }}</view>
  14. <image
  15. @tap="viewImg(item.content)"
  16. v-if="item.content && item.type === 2"
  17. :src="item.content"
  18. style="height: 200rpx; width: 200rpx; margin-left: 20rpx"
  19. ></image>
  20. </view>
  21. </view>
  22. <view v-if="item.sendType === 1" style="width: 83%; margin-left: 15%">
  23. <view class="chat-listitem" style="float: right">
  24. <view v-if="item.content && item.type === 1" @longpress="copy(item.content)" class="chat-listitem-text" style="margin-right: 20rpx">
  25. {{ item.content }}
  26. </view>
  27. <view
  28. v-if="item.content && item.type === 4"
  29. @click="goShop(item.content[3])"
  30. style="width: 400rpx; background: #ffffff; height: max-content; margin-right: 20rpx; margin-top: 10rpx; border-radius: 20rpx"
  31. >
  32. <image :src="item.content[0]" class="chat-listitem-image-type4" style="width: 400rpx; height: 350rpx"></image>
  33. <view style="padding: 10rpx; padding-bottom: 20rpx">
  34. <view style="color: #ed5732; font-size: 34rpx">
  35. <text style="font-size: 22rpx">¥</text>
  36. {{ item.content[2] }}
  37. </view>
  38. <view
  39. style="
  40. overflow: hidden;
  41. text-overflow: ellipsis;
  42. display: -webkit-box;
  43. -webkit-line-clamp: 2;
  44. -webkit-box-orient: vertical;
  45. width: 100%;
  46. height: 75upx;
  47. "
  48. >
  49. {{ item.content[1] }}
  50. </view>
  51. </view>
  52. </view>
  53. <view
  54. v-if="item.content && item.type === 3"
  55. style="width: 500rpx; background: #ffffff; height: max-content; margin-right: 20rpx; margin-top: 10rpx; border-radius: 20rpx; padding: 15rpx 10rpx"
  56. >
  57. <view style="color: #000000; font-weight: 600; margin-left: 10rpx">你正在咨询的订单</view>
  58. <view style="display: flex">
  59. <image :src="item.content[0]" class="chat-listitem-image-type4" style="margin-left: 7rpx; margin-top: 20rpx; width: 110rpx; height: 110rpx"></image>
  60. <view style="margin-top: 15rpx; padding: 10rpx 0rpx 5rpx 10rpx; width: 75%; background: #f5f5f5; margin-left: 10rpx">
  61. <view
  62. style="
  63. font-size: 28rpx;
  64. overflow: hidden;
  65. text-overflow: ellipsis;
  66. display: -webkit-box;
  67. -webkit-line-clamp: 2;
  68. -webkit-box-orient: vertical;
  69. height: 75upx;
  70. width: 100%;
  71. "
  72. >
  73. {{ item.content[1] }}
  74. </view>
  75. <view style="color: #ed5732; font-size: 28rpx">
  76. <text style="font-size: 22rpx">¥</text>
  77. {{ item.content[5] }}
  78. </view>
  79. </view>
  80. </view>
  81. <view style="color: #999999; margin-top: 10rpx; margin-left: 12rpx">
  82. <view>订单编号:{{ item.content[3] }}</view>
  83. <view style="margin-top: 10rpx">创建时间:{{ item.content[4] }}</view>
  84. </view>
  85. <view
  86. style="
  87. float: right;
  88. margin-right: 10rpx;
  89. margin-top: 15rpx;
  90. background: #f9221d;
  91. color: #ffffff;
  92. border-radius: 50rpx;
  93. width: 150rpx;
  94. height: 50rpx;
  95. font-size: 24rpx;
  96. text-align: center;
  97. line-height: 50rpx;
  98. "
  99. @click="goDingdanDetail(item.content[2])"
  100. >
  101. 查看
  102. </view>
  103. </view>
  104. <image
  105. @tap="viewImg(item.content)"
  106. v-if="item.content && item.type === 2"
  107. :src="item.content"
  108. style="height: 200rpx; width: 200rpx; margin-right: 20rpx"
  109. ></image>
  110. <view>
  111. <image v-if="item.chat.userHead" :src="item.chat.userHead" class="chat-listitem-image"></image>
  112. <image v-else src="https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png" class="chat-listitem-image"></image>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- <view v-if="item.sendType === 4" style="width: 83%;margin-left: 15%;">
  117. <view class="chat-listitem" style="float: right;">
  118. <view style="height: max-content;">
  119. <image :src="type4[0]" mode=""></image>
  120. </view>
  121. <image @tap="viewImg(item.content)" v-if="item.content && item.type === 2" :src="item.content" style="height: 200rpx;width: 170rpx;margin-right: 20rpx;"></image>
  122. <view>
  123. <image :src="item.chat.userHead" class="chat-listitem-image"></image>
  124. </view>
  125. </view>
  126. </view> -->
  127. </view>
  128. </view>
  129. <view
  130. v-if="ShopState"
  131. style="width: 95%; margin-left: 20rpx; height: 150upx; position: fixed; bottom: 120upx; z-index: 99; background-color: #ffffff; border-radius: 20rpx"
  132. >
  133. <view style="display: flex; width: 100%; color: #000000; padding: 20rpx">
  134. <image :src="Shopimage" style="width: 110rpx; height: 110rpx"></image>
  135. <view style="margin-left: 20rpx; width: 400rpx">
  136. <view style="font-size: 34rpx; color: #000000; overflow: hidden; text-overflow: ellipsis; flex-wrap: nowrap; white-space: nowrap; width: 98%">
  137. {{ ShopTitle }}
  138. </view>
  139. <view style="margin-top: 20rpx; color: #ed5732; font-size: 34rpx">¥{{ Shopmoney }}</view>
  140. </view>
  141. <view style="text-align: right">
  142. <image @click="ShopClose" src="../../static/images/msg/close.png" style="width: 30rpx; height: 30rpx"></image>
  143. <view
  144. style="
  145. margin-top: 20rpx;
  146. background: #f9221d;
  147. color: #ffffff;
  148. border-radius: 50rpx;
  149. width: 150rpx;
  150. height: 50rpx;
  151. font-size: 24rpx;
  152. text-align: center;
  153. line-height: 50rpx;
  154. "
  155. @click="goMaijia"
  156. >
  157. 发送给商家
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <view
  163. v-if="orderState"
  164. style="width: 95%; margin-left: 20rpx; height: 150upx; position: fixed; bottom: 120upx; z-index: 99; background-color: #ffffff; border-radius: 20rpx"
  165. >
  166. <view style="display: flex; width: 100%; color: #000000; padding: 20rpx">
  167. <image :src="orderimage" style="width: 110rpx; height: 110rpx"></image>
  168. <view style="margin-left: 20rpx; width: 400rpx">
  169. <view style="font-size: 34rpx; color: #000000; overflow: hidden; text-overflow: ellipsis; flex-wrap: nowrap; white-space: nowrap; width: 98%">
  170. 你可能想咨询该订单
  171. </view>
  172. <view style="margin-top: 20rpx; color: #ed5732; font-size: 34rpx">¥{{ ordermoney }}</view>
  173. </view>
  174. <view style="text-align: right">
  175. <image @click="orderClose" src="../../static/images/msg/close.png" style="width: 30rpx; height: 30rpx"></image>
  176. <view
  177. style="
  178. margin-top: 20rpx;
  179. background: #f9221d;
  180. color: #000000;
  181. border-radius: 50rpx;
  182. width: 150rpx;
  183. height: 50rpx;
  184. font-size: 24rpx;
  185. text-align: center;
  186. line-height: 50rpx;
  187. "
  188. @click="goDingdan"
  189. >
  190. 发送订单
  191. </view>
  192. </view>
  193. </view>
  194. </view>
  195. <!-- 底部聊天输入框 -->
  196. <view class="input-box">
  197. <view class="justify-between padding-lr" style="display: flex; width: 100%; height: 100%; background-color: #fff9ed; align-items: center">
  198. <image
  199. src="../../static/images/index/add.png"
  200. @click="chooseImage()"
  201. style="width: 50rpx; height: 50rpx; margin-top: 8rpx; margin-right: 12rpx; border-radius: 50upx"
  202. ></image>
  203. <input
  204. confirm-type="send"
  205. @confirm="setChatSave(1)"
  206. type="text"
  207. v-model="content"
  208. style="width: 72%; height: 70rpx; background: #fff; margin: 4rpx 10rpx 0; border-radius: 8rpx; padding-left: 10rpx; color: #000000"
  209. placeholder="请输入您的问题"
  210. />
  211. <view class="save" @tap="setChatSave(1)">发送</view>
  212. </view>
  213. </view>
  214. <!-- 用于图片压缩的canvas画布 -->
  215. <canvas
  216. :style="{
  217. width: cw + 'px',
  218. height: cw + 'px',
  219. position: 'absolute',
  220. zIndex: -1,
  221. left: '-10000rpx',
  222. top: '-10000rpx'
  223. }"
  224. canvas-id="zipCanvas"
  225. ></canvas>
  226. <!--画布结束-->
  227. </view>
  228. </template>
  229. <script>
  230. import configdata from '../../common/config.js'
  231. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  232. export default {
  233. data() {
  234. return {
  235. connected: false,
  236. connecting: false,
  237. msg: false,
  238. type4: [],
  239. listRight: {
  240. chat: {
  241. userHead: ''
  242. },
  243. content: '',
  244. sendType: 1,
  245. type: 1
  246. },
  247. content: '',
  248. chatId: '',
  249. type: 1,
  250. ListItem: [],
  251. ShopState: false,
  252. ShopordersId: '',
  253. Shopimage: '',
  254. Shopmoney: '',
  255. ShopTitle: '',
  256. orderState: false,
  257. ordersId: '',
  258. orderimage: '',
  259. orderNum: '',
  260. ordermoney: '',
  261. orderTitle: '',
  262. orderCreateTime: '',
  263. className: '',
  264. Shopsales: '',
  265. hand: 1,
  266. index: 0,
  267. page: 0,
  268. size: 1000,
  269. countDown: '',
  270. //画板边长默认是屏幕宽度,正方形画布
  271. cw: uni.getSystemInfoSync().windowWidth
  272. }
  273. },
  274. computed: {
  275. showMsg() {
  276. if (this.connected) {
  277. if (this.msg) {
  278. return '收到消息:' + this.msg
  279. } else {
  280. return '等待接收消息'
  281. }
  282. } else {
  283. return '尚未连接'
  284. }
  285. }
  286. },
  287. onUnload() {
  288. uni.closeSocket()
  289. uni.hideLoading()
  290. },
  291. onLoad(d) {
  292. if (d.className) {
  293. this.className = d.className
  294. if (d.className === 'shop') {
  295. this.ShopState = true
  296. this.ShopordersId = d.ordersId
  297. this.Shopimage = d.image
  298. this.Shopmoney = d.money
  299. this.Shopsales = d.sales
  300. this.ShopTitle = d.title
  301. } else if (d.className === 'order') {
  302. this.orderState = true
  303. this.ordersId = d.id
  304. this.orderimage = d.image
  305. this.ordermoney = d.money
  306. this.orderTitle = d.title
  307. this.orderNum = d.orderNum
  308. this.orderCreateTime = d.createTime
  309. }
  310. }
  311. this.getChatSave()
  312. this.connect()
  313. },
  314. onShow() {
  315. if (this.connected || this.connecting) {
  316. } else {
  317. this.connect()
  318. }
  319. },
  320. onHide() {
  321. uni.closeSocket()
  322. },
  323. methods: {
  324. copy(content) {
  325. uni.showModal({
  326. title: '温馨提示',
  327. content: '确认要复制此文字吗?',
  328. showCancel: true,
  329. cancelText: '取消',
  330. confirmText: '确认',
  331. success: (res) => {
  332. if (res.confirm) {
  333. uni.setClipboardData({
  334. data: content,
  335. success: (r) => {
  336. this.$queue.showToast('复制成功')
  337. }
  338. })
  339. }
  340. }
  341. })
  342. },
  343. h5Copy(content) {
  344. if (!document.queryCommandSupported('copy')) {
  345. // 不支持
  346. return false
  347. }
  348. let textarea = document.createElement('textarea')
  349. textarea.value = content
  350. textarea.readOnly = 'readOnly'
  351. document.body.appendChild(textarea)
  352. textarea.select() // 选择对象
  353. textarea.setSelectionRange(0, content.length) //核心
  354. let result = document.execCommand('copy') // 执行浏览器复制命令
  355. textarea.remove()
  356. return result
  357. },
  358. getDateDiff(data) {
  359. // 传进来的data必须是日期格式,不能是时间戳
  360. //var str = data;
  361. //将字符串转换成时间格式
  362. var timePublish = new Date(data)
  363. var timeNow = new Date()
  364. var minute = 1000 * 60
  365. var hour = minute * 60
  366. var day = hour * 24
  367. var month = day * 30
  368. var result = '2'
  369. var diffValue = timeNow - timePublish
  370. var diffMonth = diffValue / month
  371. var diffWeek = diffValue / (7 * day)
  372. var diffDay = diffValue / day
  373. var diffHour = diffValue / hour
  374. var diffMinute = diffValue / minute
  375. if (diffMonth > 3) {
  376. result = timePublish.getFullYear() + '-'
  377. result += timePublish.getMonth() + '-'
  378. result += timePublish.getDate()
  379. } else if (diffMonth > 1) {
  380. //月
  381. result = data.substring(0, 10)
  382. } else if (diffWeek > 1) {
  383. //周
  384. result = data.substring(0, 10)
  385. } else if (diffDay > 1) {
  386. //天
  387. result = data.substring(0, 10)
  388. } else if (diffHour > 1) {
  389. //小时
  390. result = parseInt(diffHour) + '小时前'
  391. } else if (diffMinute > 1) {
  392. //分钟
  393. result = parseInt(diffMinute) + '分钟前'
  394. } else {
  395. result = '刚刚'
  396. }
  397. return result
  398. },
  399. goDingdanDetail(id) {
  400. uni.navigateTo({
  401. url: '../member/orderdetail?id=' + id
  402. })
  403. },
  404. goShop(ordersId) {
  405. uni.navigateTo({
  406. url: './commoditydetail?ordersId=' + ordersId
  407. })
  408. },
  409. ShopClose() {
  410. this.ShopState = false
  411. },
  412. orderClose() {
  413. this.orderState = false
  414. },
  415. goDingdan() {
  416. this.orderState = false
  417. this.setChatSave(3)
  418. },
  419. goMaijia() {
  420. this.ShopState = false
  421. this.setChatSave(4)
  422. },
  423. connect() {
  424. let userId = this.$queue.getData('userId')
  425. if (this.connected || this.connecting) {
  426. uni.showModal({
  427. content: '正在连接或者已经连接,请勿重复连接',
  428. showCancel: false
  429. })
  430. return false
  431. }
  432. let token = uni.getStorageSync('token')
  433. this.connecting = true
  434. uni.showLoading({
  435. title: '连接中...',
  436. mask: true // 是否显示透明蒙层,防止触摸穿透
  437. })
  438. uni.connectSocket({
  439. // url: 'wss://game.shengqianxiong.com.cn/wss/websocket/' + userId,
  440. // url: 'ws://192.168.1.17:8180/sqx_fast/websocket/' + userId,
  441. url: this.config('WSHOST') + userId,
  442. data() {
  443. return {
  444. msg: 'Hello'
  445. }
  446. },
  447. header: {
  448. 'content-type': 'application/json',
  449. token: token
  450. },
  451. method: 'GET',
  452. success(res) {
  453. // 这里是接口调用成功的回调,不是连接成功的回调,请注意
  454. },
  455. fail(err) {
  456. // 这里是接口调用失败的回调,不是连接失败的回调,请注意
  457. }
  458. })
  459. uni.onSocketOpen((res) => {
  460. this.connecting = false
  461. this.connected = true
  462. uni.hideLoading()
  463. // uni.showToast({
  464. // icon: 'none',
  465. // title: '连接成功'
  466. // })
  467. console.log('onOpen', res)
  468. })
  469. uni.onSocketError((err) => {
  470. this.connecting = false
  471. this.connected = false
  472. uni.hideLoading()
  473. uni.showModal({
  474. content: '网络较差,请稍后再试',
  475. showCancel: false
  476. })
  477. console.log('onError', err)
  478. })
  479. uni.onSocketMessage((res) => {
  480. // let that = this;
  481. // let datas = JSON.parse(res.data)
  482. // let data = {
  483. // chat: {
  484. // userHead: 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
  485. // },
  486. // content: datas.content,
  487. // type: datas.type,
  488. // sendType: datas.sendType
  489. // }
  490. // that.ListItem.push(data);
  491. this.getTimeOrListItem1()
  492. console.log('onMessage', res)
  493. })
  494. uni.onSocketClose((res) => {
  495. this.connected = false
  496. this.startRecive = false
  497. this.msg = false
  498. console.log('onClose', res)
  499. })
  500. },
  501. close() {
  502. uni.closeSocket()
  503. },
  504. getTimeOrListItem1() {
  505. let data = {
  506. chatId: this.chatId
  507. }
  508. this.$Request.getT('/app/chats/list', data).then((res) => {
  509. this.ListItem = []
  510. if (res.data) {
  511. var time = ''
  512. res.data.forEach((d) => {
  513. d.createTime = this.getDateDiff(d.createTime)
  514. if (d.createTime === time) {
  515. d.createTime = ''
  516. } else {
  517. time = d.createTime
  518. }
  519. if (!d.chat.userHead) {
  520. // d.chat.userHead = 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png';
  521. let avatar = this.$queue.getData('avatar')
  522. d.chat.userHead = avatar
  523. }
  524. if (d.type === 4) {
  525. let data = d.content.split(',')
  526. d.content = data
  527. }
  528. if (d.type === 3) {
  529. let data = d.content.split(',')
  530. d.content = data
  531. }
  532. this.ListItem.push(d)
  533. })
  534. setTimeout(() => {
  535. uni.pageScrollTo({
  536. scrollTop: 99999,
  537. duration: 0
  538. })
  539. }, 50)
  540. }
  541. uni.hideLoading()
  542. })
  543. },
  544. getChatSave() {
  545. let userId = this.$queue.getData('userId')
  546. let phone = this.$queue.getData('phone')
  547. let userName = this.$queue.getData('userName')
  548. if (!phone) {
  549. phone = this.$queue.getData('userName')
  550. }
  551. let avatar = this.$queue.getData('avatar')
  552. let data = {
  553. userId: userId,
  554. userHead: avatar,
  555. userName: userName,
  556. storeId: '0',
  557. storeHead: '墨轩云商',
  558. storeName: ''
  559. }
  560. this.$Request.postJson('/app/chats/save', data).then((res) => {
  561. if (res.status === 0) {
  562. this.chatId = res.data.chatId
  563. uni.showLoading({
  564. title: '加载中...',
  565. mask: true // 是否显示透明蒙层,防止触摸穿透
  566. })
  567. this.getTimeOrListItem1()
  568. }
  569. })
  570. },
  571. setChatSave(type) {
  572. //type:1文字 2图片
  573. if (type === 1 && this.content == '') {
  574. this.$queue.showToast('请输入聊天内容')
  575. return
  576. }
  577. if (this.chatId == '' || this.chatId == undefined) {
  578. this.$queue.showToast('网络较差,请稍后再试')
  579. return
  580. }
  581. let userId = this.$queue.getData('userId')
  582. if (type === 4) {
  583. this.content = this.Shopimage + ',' + this.ShopTitle + ',' + this.Shopmoney + ',' + this.ShopordersId
  584. }
  585. if (type === 3) {
  586. this.content = this.orderimage + ',' + this.orderTitle + ',' + this.ordersId + ',' + this.orderNum + ',' + this.orderCreateTime + ',' + this.ordermoney
  587. }
  588. let data = {
  589. userId: userId,
  590. content: this.content,
  591. chatId: this.chatId,
  592. type: type,
  593. storeId: '0',
  594. sendType: '1'
  595. }
  596. data = JSON.stringify(data)
  597. let that = this
  598. uni.sendSocketMessage({
  599. data: data,
  600. success(res) {
  601. let avatar = that.$queue.getData('avatar')
  602. if (!avatar) {
  603. avatar = 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
  604. }
  605. setTimeout(() => {
  606. that.getTimeOrListItem1()
  607. }, 50)
  608. console.log(that.content)
  609. },
  610. fail(err) {
  611. console.log(err)
  612. }
  613. })
  614. this.content = ''
  615. },
  616. //发送图片
  617. chooseImage() {
  618. uni.chooseImage({
  619. count: 1,
  620. sourceType: ['album', 'camera'],
  621. success: (res) => {
  622. for (let i = 0; i < res.tempFiles.length; i++) {
  623. //这里的id和页面中写的html代码的canvas的id要一致
  624. let canvasId = 'zipCanvas'
  625. //原图的路径
  626. let imagePath = res.tempFiles[i].path
  627. //大小限制
  628. let limitSize = 1024 * 2
  629. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  630. let drawWidth = uni.getSystemInfoSync().windowWidth
  631. let that = this
  632. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  633. uni.showLoading({
  634. title: '上传中'
  635. })
  636. uni.uploadFile({
  637. url: this.config('APIHOST') + '/alioss/upload',
  638. filePath: resPath,
  639. name: 'file',
  640. success: (uploadFileRes) => {
  641. this.content = JSON.parse(uploadFileRes.data).data
  642. this.setChatSave(2)
  643. uni.hideLoading()
  644. },
  645. fail: () => {
  646. uni.showToast({
  647. title: '上传失败',
  648. icon: 'error'
  649. })
  650. }
  651. })
  652. })
  653. }
  654. }
  655. })
  656. },
  657. config: function (name) {
  658. var info = null
  659. if (name) {
  660. var name2 = name.split('.') //字符分割
  661. if (name2.length > 1) {
  662. info = configdata[name2[0]][name2[1]] || null
  663. } else {
  664. info = configdata[name] || null
  665. }
  666. if (info == null) {
  667. // let web_config = cache.get("web_config");
  668. // if (web_config) {
  669. // if (name2.length > 1) {
  670. // info = web_config[name2[0]][name2[1]] || null;
  671. // } else {
  672. // info = web_config[name] || null;
  673. // }
  674. // }
  675. }
  676. }
  677. return info
  678. },
  679. //查看大图
  680. viewImg(item) {
  681. let imgsArray = []
  682. imgsArray[0] = item
  683. uni.previewImage({
  684. current: 0,
  685. urls: imgsArray
  686. })
  687. }
  688. }
  689. }
  690. </script>
  691. <style>
  692. page {
  693. /* background: #1c1b20; */
  694. }
  695. .input-box {
  696. position: fixed;
  697. bottom: 0;
  698. left: 0;
  699. height: 160rpx;
  700. width: 100%;
  701. display: flex;
  702. box-sizing: content-box;
  703. z-index: 999;
  704. /* background-color: #ececec; */
  705. /* padding: 0 5rpx; */
  706. }
  707. .chat-listitem {
  708. display: flex;
  709. margin-top: 20rpx;
  710. padding: 10rpx;
  711. }
  712. .chat-listitem-text {
  713. color: #000000;
  714. background: #ffffff;
  715. margin-top: 10rpx;
  716. width: fit-content;
  717. padding: 15rpx;
  718. font-size: 30rpx;
  719. height: max-content;
  720. word-wrap: break-word;
  721. word-break: break-all;
  722. border-radius: 10rpx;
  723. }
  724. .chat-listitem-image-type4 {
  725. color: #000000;
  726. background: #ffffff;
  727. width: fit-content;
  728. font-size: 30rpx;
  729. height: max-content;
  730. word-wrap: break-word;
  731. word-break: break-all;
  732. border-top-left-radius: 20rpx;
  733. border-top-right-radius: 20rpx;
  734. }
  735. .chat-listitem-image {
  736. margin-top: 5rpx;
  737. width: 75rpx;
  738. height: 75rpx;
  739. border-radius: 5rpx;
  740. }
  741. .save {
  742. width: 130rpx;
  743. text-align: center;
  744. border-radius: 10rpx;
  745. height: 70rpx;
  746. color: #000;
  747. background: #75a599;
  748. margin: 5rpx 10rpx 0;
  749. line-height: 70rpx;
  750. }
  751. </style>