douyin-scrollview.vue 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. <template>
  2. <view>
  3. <!-- <image @click="closeSheet" src="../../static/douyin/cuowu.png" style="width: 14px; height: 14px; opacity: 0.6; position: absolute; right: 15px; margin-top: 15px;"></image> -->
  4. <text class="numberComment">{{pinlunNum}}条评论 <image @click="closeSheet" class="iconfont"
  5. :src="imgHost + '/statics/images/close.png'" mode=""></image></text>
  6. <scroll-view @scrolltolower="scrolltolower"
  7. :style="'width: '+ Width +'px; height: 800rpx; background-color: #fff; display: flex; flex-direction: column;'"
  8. :scroll-y="true">
  9. <text v-if="pinlunList.length == 0"
  10. :style="'font-size: 14px; font-weight: bold; color: #a3a1a4; margin-top: 75px; margin-left: '+ (Width/2.9) +'px; position: absolute;'">
  11. ~ 快来评论吧 ~</text>
  12. <block v-for="(list,index) in pinlunList">
  13. <view :style="'width: '+ Width +'px; display: flex; flex-direction: row;'">
  14. <!-- 1.用户的头像 -->
  15. <image :src="list.avatar" mode="aspectFill" class="pictrue"></image>
  16. <!-- 2.一级评论 -->
  17. <view
  18. :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: column; margin-top: 20px; margin-left: 10px;'">
  19. <!-- 3.用户名称,并自动判断是否为视频作者 -->
  20. <view style="display: flex; flex-direction: row;">
  21. <text class="name">{{list.nickname}}</text>
  22. <image v-if="list.is_money_level>0" class="vip" src="@/static/images/vip.png"></image>
  23. <!-- 4.如果是视频作者就显示 作者 -->
  24. <view v-if="list.uid == 0"
  25. style="background-color: #E43D33; border-radius: 2.5px; margin-left: 7.5px;">
  26. <text
  27. style="font-size: 8px; font-weight: bold; padding: 2.5px; padding-left: 4px; padding-right: 4px; font-weight: bold; color: #FFFFFF;">商家</text>
  28. </view>
  29. </view>
  30. <!-- 5.
  31. 由于 rich-text 有很多 bug
  32. 所以这里已经摒弃了,
  33. 使用自研文本解析器
  34. -->
  35. <view @click="huifu(index)"
  36. :style="'width: '+ (Width*0.78) +'px; display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 8rpx; word-break: break-all;'">
  37. <text
  38. :style="'font-size: 28rpx; font-weight: 400; color: #333; margin-left: -1.5px;'">{{list.content}}</text>
  39. </view>
  40. <!-- 6.如果用户输入了 GIF 表情,就会在这里显示 -->
  41. <!-- <image v-if="list.imageURL !== ''" :src="list.imageURL" mode="aspectFill" style="width: 70px; height: 70px; margin-top: 10px; border-radius: 5px;"></image> -->
  42. <!-- 7.这里就是 时间、回复、点赞、点赞量显示的地方 -->
  43. <view
  44. :style="'width: '+ (Width*0.8) +'px; height: 20px; display: flex; flex-direction: row; margin-top: 16rpx;'">
  45. <text style="font-size: 12px; color: #a3a1a4;">{{list.add_time}} .
  46. {{list.city?list.city:''}}</text>
  47. <text @click="huifu(index)" class="time">回复</text>
  48. <!-- <text v-if="uid == list.uid" @click="deletepinlun(index)" class="time">删除</text> -->
  49. <image v-if="!list.is_like" class="like" @click="tolike(list,index)"
  50. :src="imgHost + '/statics/images/zan01.png'"></image>
  51. <image v-if="list.is_like" class="like" @click="tolike(list,index)"
  52. :src="imgHost + '/statics/images/zan02.png'"></image>
  53. <text class="likeNum" @click="tolike(list,index)">{{list.like_num}}</text>
  54. </view>
  55. <!-- 8.用户回复的子评论会显示在这里
  56. 这里 update 用于刷新视图
  57. -->
  58. <block v-for="(li,inde) in list.reply" v-if="list.isShow">
  59. <view :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: row;'">
  60. <!-- 9.子评论 用户头像 -->
  61. <image :src="li.avatar" mode="aspectFill" class="childrenPic"></image>
  62. <!-- 10.动态计算宽度 子评论列表 -->
  63. <view
  64. :style="'width: '+ (Width*0.8*0.85) +'px; display: flex; flex-direction: column; margin-top: 20px; margin-left: 10px;'">
  65. <view style="display: flex; flex-direction: row;">
  66. <view style="display: flex; flex-direction: row;">
  67. <!-- 11.回复评论的人显示在这里 -->
  68. <text class="childrenName">{{li.nickname}}</text>
  69. <image v-if="li.is_money_level>0" class="vip" src="@/static/images/vip.png">
  70. </image>
  71. <!-- 12.同时要判断评论人是不是作者,如果是作者就在这里显示 -->
  72. <view v-if="li.uid==0"
  73. style="background-color: #E43D33; border-radius: 2.5px; margin-left: 7.5px;">
  74. <text
  75. style="font-size: 8px; font-weight: 400; padding: 1px 4px; color: #fff;">商家</text>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 16.
  80. 由于 rich-text 有很多 bug
  81. 所以这里已经摒弃了,
  82. 使用自研文本表情解析器
  83. -->
  84. <view
  85. :style="'width: '+ (Width*0.8*0.85) +'px; display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 8rpx;word-break: break-all;'">
  86. <text
  87. :style="'font-size: 28rpx; font-weight: 400; color: #333; margin-left: -1.5px;'">{{li.content}}</text>
  88. </view>
  89. <!-- 17.如果 子评论 用户输入了 GIF 表情,就会在这里显示 -->
  90. <!-- <image v-if="li.imageURL !== ''" :src="li.imageURL" mode="aspectFill" style="width: 70px; height: 70px; margin-top: 10px; border-radius: 5px;"></image> -->
  91. <!-- 18.这里就是 时间、回复、点赞、点赞量显示的地方 -->
  92. <view
  93. :style="'width: '+ (Width*0.8*0.85) +'px; height: 20px; display: flex; flex-direction: row; margin-top: 16rpx;'">
  94. <text style="font-size: 12px; color: #a3a1a4;">{{li.add_time}} .
  95. {{li.city?li.city:''}}</text>
  96. <!-- <text v-if="userID == li.userID" @click="deletesonpinlun(index,inde)" class="time">删除</text> -->
  97. <image class="childrenLike" v-if="!li.is_like" @click="tosonlike(index,inde,li)"
  98. :src="imgHost + '/statics/images/zan01.png'"></image>
  99. <image class="childrenLike" v-if="li.is_like" @click="tosonlike(index,inde,li)"
  100. :src="imgHost + '/statics/images/zan02.png'"></image>
  101. <text class="childrenLikeNum"
  102. @click="tosonlike(index,inde,li)">{{li.like_num}}</text>
  103. </view>
  104. </view>
  105. </view>
  106. </block>
  107. <!-- 19。显示 【展开xx条评论】、【收起评论】 -->
  108. <view v-if="list.reply_count > 0"
  109. :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: row; margin-top: 15px;'">
  110. <view
  111. style="width: 30px; height: 1px; background-color: #a3a1a4; opacity: 0.6; margin-top: 6.5px;">
  112. </view>
  113. <text @click="zhangkai(index,list)" v-if="list.reply_count!=list.reply.length"
  114. style="font-size: 12px; font-weight: bold; color: #cdcbd4; margin-left: 6px;">展开{{list.reply_count}}条回复</text>
  115. <text @click="shouqi(list)" v-if="list.reply.length"
  116. style="font-size: 12px; font-weight: bold; color: #cdcbd4; margin-left: 6px;">收起</text>
  117. </view>
  118. </view>
  119. </view>
  120. <!-- 20.留一定的高度以免视图被遮挡 -->
  121. <view v-if="index == (pinlunList.length-1)" :style="'width: '+ Width +'px; height: 80px;'"></view>
  122. </block>
  123. </scroll-view>
  124. <!-- 21.底部,模拟假的输入框 -->
  125. <view v-if="show" @click="parentPinglun" :style="'width: '+ Width +'px; height: 46px; background-color: #fff;'">
  126. <view
  127. :style="'width: '+ (Width-30) +'px; height: 32px; margin-left: 15px; margin-top: 7px; background-color: #eee; border-radius: 50px; display: flex; flex-direction: row;'">
  128. <text style="font-size: 13px; color: #999; margin-top: 7px; margin-left: 15px;">说点什么呗~</text>
  129. <image :src="imgHost + '/statics/images/send01.png'"
  130. style="width: 40rpx; margin-top: 6px; height: 40rpx; position: absolute; right: 12.5px;"></image>
  131. </view>
  132. </view>
  133. <!-- <view v-if="show && platform!=='ios'" @click="openPinglun" :style="'width: '+ Width +'px; height: 46px; background-color: #fff;'">
  134. <view :style="'width: '+ (Width-30) +'px; height: 42px; margin-left: 15px; margin-top: 5px; background-color: #eee; border-radius: 50px; display: flex; flex-direction: row;'">
  135. <text style="font-size: 13px; color: #999; margin-top: 7px; margin-left: 15px;">说点什么呗777~</text>
  136. <image :src="imgHost + '/statics/images/send01.png'" style="width: 40rpx; margin-top: 7.5px; height: 40rpx; position: absolute; right: 12.5px;"></image>
  137. </view>
  138. </view> -->
  139. <!--
  140. 下面就是真正的评论框
  141. 包含:
  142. 1.输入框
  143. 2.表情输入框
  144. 3.GIF表情库
  145. 4.最近使用表情和全部表情
  146. 5.自己上传表情
  147. 6. @ 自己的好友
  148. 7.自带微博表情 和 QQ 表情
  149. 8.能记忆输入
  150. -->
  151. <uni-popup type="bottom" ref="openPinglun" @touchmove.stop.prevent="movehandle" @change="change">
  152. <view style="display: flex; flex-direction: column;">
  153. <view @click="openPinglun"
  154. :style="'width: '+ Width +'px; background-color: #FFFFFF; display: flex; flex-direction: row;'">
  155. <view
  156. :style="'width: '+ (Width-30)*percent +'px; margin-left: 15px; margin-top: 10px; background-color: #eee; border-radius: '+ borderRadius +'px; margin-bottom: 10px; display: flex; flex-direction: row;'">
  157. <!--
  158. 9.输入框
  159. -->
  160. <textarea
  161. :style="'width:100%; height: 20px; margin-bottom: 10px; font-size: 15px; color: #000000; margin-top: 10px; margin-left: 15px;'"
  162. :placeholder="placeholder" :cursor-spacing="cursorSpacing" :auto-focus="autoFocus"
  163. :auto-height="autoHeight" :adjust-position="adjustPosition" v-model="value"
  164. :disabled="disabled" maxlength="150" @linechange="linechange"
  165. @keyboardheightchange="keyboardheightchange" @focus="focus" @click="clickTextarea"
  166. @blur="blur"></textarea>
  167. </view>
  168. <!-- 11.发送按钮
  169. 符合:有内容、或者是输入 GIF 图片都可以通过
  170. -->
  171. <view v-if="(value!=='' || imageURL !== '') && isSend" @click="sendSMS"
  172. style="width: 30px; height: 30px; border-radius: 40px; margin-top: 30upx; margin-left: 20upx;">
  173. <image :src="imgHost + '/statics/images/send02.png'" style="width: 30px; height: 30px;"></image>
  174. </view>
  175. </view>
  176. </view>
  177. <!-- 12.用于显示用户选择的 GIF 图片 -->
  178. <view v-if="isShowImage" :style="'width: '+ Width +'px; height: 75px; background-color: #FFFFFF;'">
  179. <view style="display: flex; flex-direction: row;">
  180. <image :src="imageURL" mode="aspectFill"
  181. style="width: 60px; height: 60px; margin-top: 5px; margin-left: 25px;"></image>
  182. <!-- <image @click="deleteimageURL" src="../../static/douyin/zfxsc.png" style="width: 15px; height: 15px; position: absolute; margin-left: 70px; margin-top: 6px;"></image> -->
  183. </view>
  184. </view>
  185. <!-- 13.
  186. 表情 区
  187. -->
  188. <view :style="'width: '+ Width +'px; background-color: #FFFFFF;'">
  189. <!--
  190. isToShow:这个参数用于控制显示,不动它即可
  191. -->
  192. <block v-if="isToShow">
  193. <!-- 14.表情选择栏:
  194. 最近输入的 GIF 图在:timeEmoji
  195. 默认展示的 表情 :nowEmoji
  196. 自己上传的图片:likeEmoji
  197. GIF 图片库:gifEmoji
  198. -->
  199. <!-- <scroll-view :style="'width: '+ Width +'px; height: 40px; background-color: #FFFFFF;'" :scroll-x="true" style="display: flex; flex-direction: row;" :show-scrollbar="false">
  200. <view :style="'display: flex; flex-direction: row; width: '+ Width +'px; padding-top: 5px; padding-bottom: 5px; border-bottom: 0.5px solid #f3f1f4;'">
  201. <view :style="'width: 45px; height: 30px; border-radius: 30px; position: absolute; background-color: #f8f4f7; margin-top: -4px; margin-left: '+ (Width*0.04)*currentNum +'px;'"></view>
  202. <image @click="timeEmoji" src="../../static/douyin/time.png" style="width: 22.5px; height: 22.5px; margin-left: 25px;"></image>
  203. <image @click="nowEmoji" src="../../static/douyin/biaoqing-2.png" style="width: 25px; height: 25px; margin-left: 25px; margin-top: -2.5px;"></image>
  204. <image @click="likeEmoji" src="../../static/douyin/xianxing.png" style="width: 27.5px; height: 27.5px; margin-left: 25px; margin-top: -2.5px;"></image>
  205. <view @click="gifEmoji" style="width: 22.5px; height: 22.5px; border-radius: 27.5px; border: 2px solid #303133; margin-left: 26px; margin-top: 0upx;">
  206. <image src="../../static/douyin/gif-2.png" style="width: 17.5px; height: 17.5px;"></image>
  207. </view>
  208. </view>
  209. </scroll-view> -->
  210. <!-- 15.表情选择栏:
  211. 最近输入的 GIF 图在:timeEmoji
  212. 默认展示的 表情 :nowEmoji
  213. 自己上传的图片:likeEmoji
  214. GIF 图片库:gifEmoji
  215. -->
  216. <swiper
  217. :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
  218. :current="current" @change="currentChange">
  219. <swiper-item>
  220. <scroll-view
  221. :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
  222. :scroll-y="true">
  223. <text v-if="nowImage.length !== 0" @click="qingkonGIF"
  224. style="font-size: 12px; margin-top: -5px; z-index: 999; position: absolute; right: 20px; color: #007AFF;">清空</text>
  225. <view style="display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 20px;">
  226. <block v-for="(list,index) in nowImage">
  227. <view>
  228. <image @click="clicknowImage(index)" :src="list" mode="aspectFill"
  229. style="width: 60px; height: 60px; margin-top: 20px; margin-left: 27.5px;">
  230. </image>
  231. <!-- <image @click="deletenowImage(index)" src="../../static/douyin/zfxsc.png" style="width: 15px; height:15px; position: absolute; margin-left: 74px; margin-top: 20px;"></image> -->
  232. </view>
  233. </block>
  234. <block v-if="nowImage.length == 0">
  235. <text
  236. :style="'font-size: 14px; color: #999999; margin-top: 100px; margin-left: '+ (Width/3.2) +'px;'">~
  237. 您还没使用过图片 ~</text>
  238. </block>
  239. </view>
  240. <view :style="'width: '+ Width +'px; height: 80px;'"></view>
  241. </scroll-view>
  242. </swiper-item>
  243. <swiper-item>
  244. <scroll-view
  245. :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
  246. :scroll-y="true">
  247. <block v-if="nowTimeEmojiList.length !== 0">
  248. <text style="font-size: 12px; margin-top: 10px; margin-left: 15px;">最近使用</text>
  249. <text @click="qingkon"
  250. style="font-size: 12px; margin-top: 10px; position: absolute; right: 20px; color: #007AFF;">清空</text>
  251. <view
  252. style="display: flex; flex-direction: row; flex-wrap: wrap; margin-bottom: 10px;">
  253. <!-- QQ - 表情包 -->
  254. <block v-for="(list,index) in nowTimeEmojiList">
  255. <image @click="clicknowTimeEmoji(index)"
  256. :src="'../../static/emojis/qq/'+list.url+''"
  257. style="width: 35px; height: 35px; margin-top: 15px; margin-left: 18px;">
  258. </image>
  259. </block>
  260. <!-- 新浪微博 - 表情包 -->
  261. <!-- <block v-for="(list,index) in sinaEmojilist">
  262. <image @click="clicksinaEmoji(index)" :src="list.url" style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;"></image>
  263. </block> -->
  264. </view>
  265. </block>
  266. <text style="font-size: 12px; margin-top: 10px; margin-left: 15px;">全部表情</text>
  267. <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
  268. <!-- QQ - 表情包 -->
  269. <block v-for="(list,index) in emojilist">
  270. <image @click="clickEmoji(index)" :src="'../../static/emojis/qq/'+list.url+''"
  271. style="width: 35px; height: 35px; margin-top: 15px; margin-left: 18px;">
  272. </image>
  273. </block>
  274. <!-- 新浪微博 - 表情包 -->
  275. <!-- <block v-for="(list,index) in sinaEmojilist">
  276. <image @click="clicksinaEmoji(index)" :src="list.url" style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;"></image>
  277. </block> -->
  278. </view>
  279. <view :style="'width: '+ Width +'px; height: 80px;'"></view>
  280. </scroll-view>
  281. <view
  282. style="position: absolute; display: flex; flex-direction: row; bottom: 0; right: 0; width: 150px; height: 40px; background-color: #FFFFFF; box-shadow: -20px -40px 20px 30px #FFFFFF; border-radius: 1px;">
  283. <view @click="undo"
  284. style="width: 65px; height: 30px; margin-top: -20px; border-radius: 20px; border: 0.5px solid #c6c5c8;">
  285. <!-- <image src="../../static/douyin/shanchu-3.png" style="width: 22.5px; height: 15px; margin-top: 7.5px; margin-left: 20px;"></image> -->
  286. </view>
  287. <!-- 16.发送按钮
  288. 符合:有内容、或者是输入 GIF 图片都可以通过
  289. -->
  290. <view v-if="(value!=='' || imageURL !== '') && isSend" @click="sendSMS"
  291. style="width: 65px; height: 30px; margin-top: -20px; margin-left: 10px; border-radius: 20px; background-color: #ff1a63;">
  292. <text
  293. style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 5px;">发送</text>
  294. </view>
  295. <view v-if="(value == '' && imageURL == '') && isSend"
  296. style="width: 65px; height: 30px; margin-top: -20px; margin-left: 10px; border-radius: 20px; background-color: #bab9bb;">
  297. <text
  298. style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 5px;">发送</text>
  299. </view>
  300. </view>
  301. </swiper-item>
  302. <swiper-item>
  303. <scroll-view
  304. :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
  305. :scroll-y="true">
  306. <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
  307. <view @click="addlikeImage"
  308. style="width: 60px; height: 60px; border-radius: 10upx; border: 1px solid #000000; margin-top: 20px; margin-left: 27.5px;">
  309. <!-- <image src="../../static/douyin/jia-9.png" style="width: 25px; height: 25px; margin-top: 17.5px; margin-left: 17.5px;"></image> -->
  310. </view>
  311. <block v-for="(list,index) in likeImage">
  312. <image @click="clickLikeImage(index)" :src="list" mode="aspectFill"
  313. style="width: 60px; height: 60px; margin-top: 20px; margin-left: 27.5px;">
  314. </image>
  315. <!-- <image @click="deleteImage(index)" src="../../static/douyin/zfxsc.png" style="width: 15px; height: 15px; position: absolute; right: 0; margin-top: 20px;"></image> -->
  316. </block>
  317. </view>
  318. <view :style="'width: '+ Width +'px; height: 80px;'"></view>
  319. </scroll-view>
  320. </swiper-item>
  321. <swiper-item>
  322. <scroll-view
  323. :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
  324. :scroll-y="true" @scrolltolower="scrolltolowerGIF">
  325. <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
  326. <view @click="searchGIF"
  327. style="width: 60px; height: 60px; border-radius: 5px; border: 1px solid #000000; margin-top: 20px; margin-left: 27.5px;">
  328. <!-- <image src="../../static/douyin/sousuo-7.png" style="width: 25px; height: 25px; margin-top: 17.5px; margin-left: 17.5px;"></image> -->
  329. </view>
  330. <block v-for="(list,index) in gifAndpnglist">
  331. <image @click="clickGIF(index)" :src="list.url" mode="aspectFill"
  332. style="width: 60px; height: 60px; margin-top: 20px; margin-left: 27.5px;">
  333. </image>
  334. </block>
  335. </view>
  336. <view :style="'width: '+ Width +'px; height: 80px;'"></view>
  337. </scroll-view>
  338. </swiper-item>
  339. </swiper>
  340. </block>
  341. <block v-if="!isToShow">
  342. <!-- 这里为空即可,不加任何东西 -->
  343. </block>
  344. </view>
  345. </uni-popup>
  346. <!-- 1.
  347. 这个弹窗用于搜索 GIF
  348. -->
  349. <uni-popup type="bottom" ref="searchEmoji" @touchmove.stop.prevent="movesearch" @change="searchGIFChange">
  350. <view v-if="searchGIFValue !== ''"
  351. :style="'width: '+ Width +'px; height: 80px; border-bottom: 0.5px solid #e3e1e5; background-color: #FFFFFF; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  352. <!-- 2.
  353. 搜出来的 GIF 都在这里
  354. -->
  355. <scroll-view
  356. :style="'width: '+ Width +'px; height: 80px; border-bottom: 0.5px solid #e3e1e5; display: flex; flex-direction: row; white-space: nowrap;'"
  357. :scroll-x="true">
  358. <block v-for="(list,index) in GifList">
  359. <image @click="selectGIF(index)" :src="list.url" mode="aspectFill"
  360. style="width: 60px; height: 60px; margin-top: 10px; margin-left: 10px;"></image>
  361. </block>
  362. <view style="width: 10px; height: 60px; margin-left: 5px;"></view>
  363. </scroll-view>
  364. </view>
  365. <!-- 3.
  366. 动态图输入框
  367. -->
  368. <view :style="'width: '+ Width +'px; background-color: #FFFFFF; display: flex; flex-direction: row;'">
  369. <view
  370. :style="'width: '+ (Width-30) +'px; margin-left: 15px; margin-top: 10px; background-color: #FFFFFF; margin-bottom: 10px; display: flex; flex-direction: row;'">
  371. <input
  372. :style="'width: '+ (Width*0.8) +'px; height: 20px; margin-bottom: 10px; font-size: 15px; color: #000000; margin-top: 7.5px; margin-left: 15px;'"
  373. placeholder="搜索表情包" v-model="searchGIFValue" :auto-focus="false" :adjust-position="true"
  374. @blur="blurGIF" />
  375. <!-- <image v-if="searchGIFValue !== ''" @click="clearSearchValue" src="../../static/douyin/chacha-4.png" style=" width: 12.5px; height: 12.5px; margin-top: 10px; margin-left: 15px;"></image> -->
  376. </view>
  377. </view>
  378. <view v-if="platform=='ios'"
  379. :style="'width: '+ Width +'px; height: '+ (emojiHeight+40) +'px; background-color: #FFFFFF;'">
  380. <!-- 这里不要动就行 -->
  381. </view>
  382. <view v-if="platform!=='ios'"
  383. :style="'width: '+ Width +'px; height: '+ emojiHeight +'px; background-color: #FFFFFF;'">
  384. <!-- 这里不要动就行 -->
  385. </view>
  386. </uni-popup>
  387. </view>
  388. </template>
  389. <script>
  390. // 1.先引入表情库,(完全手撸,十分繁琐)(这个是 QQ 的表情库)
  391. // import emojiList from '../../common/emoji/biaoqin.js'
  392. // 2.这个表情库是新浪微博 的表情库
  393. // import sinaEmojiList from '../../common/emoji/sina.js'
  394. // 3.这个一定要引入进来,用来解析生成的 <html>【🌟🌟🌟🌟🌟】十分重要【这里已经对原来的文件进行了改编】
  395. import parsehtml from '../../common/html-parse/parse_html.js'
  396. // 4.这里引入时间函数 用来上传时用的
  397. import time from '../../common/time-utils/currentData.js'
  398. import {
  399. HTTP_REQUEST_URL
  400. } from '@/config/app';
  401. import {
  402. commentList,
  403. markeComment,
  404. replyCommentList,
  405. replyCommentLike
  406. } from '@/api/short-video.js';
  407. import {
  408. mapGetters
  409. } from 'vuex';
  410. export default {
  411. computed: mapGetters(['uid']),
  412. data() {
  413. return {
  414. replyList: [],
  415. // 每一个参数都重要
  416. // 解释如下:
  417. // ----- start ----- 评论输入框部分
  418. num: 1.15, //用来处理评论的高度
  419. plHeight: 0, //评论高度
  420. value: "", //用户在输入框输入信息的数据
  421. autoHeight: false, //这个默认即可(用于评论框自动适应高度)
  422. borderRadius: 50, //评论框圆角大小
  423. lineheight: 0, //默认即可(用于处理评论框高度)
  424. percent: 1, //默认(用于处理发送按钮已经评论框宽度)
  425. show: true, //默认(是否显示评论框)
  426. emojiHeight: 0, //表情区域的高度
  427. emojiheight: 0, //用于处理表情区域的高度
  428. emojihi: 0,
  429. cursorSpacing: 20, //键盘距离输入框的距离
  430. autoFocus: false, //是否自动聚焦(默认聚焦)
  431. isopen: false, //(默认不展开)
  432. isToShow: false, //默认
  433. adjustPosition: true, //默认
  434. placeholder: "说点什么呗~",
  435. disabled: false,
  436. //
  437. current: 1, //当前切换的位置
  438. emojilist: [], //表情数组
  439. nowTimeEmojiList: [], //最近输入的表情
  440. sinaEmojilist: [], //新浪微博表情
  441. currentNum: 4.4, //默认
  442. likeImage: [], //默认
  443. nowImage: [], //默认
  444. gifAndpngList: [], //默认
  445. gifAndpnglist: [], //默认
  446. searchGIFValue: "", //默认
  447. isSearcopen: false, //默认
  448. GifList: [], //默认
  449. isShowImage: false, //默认
  450. imageURL: "", //默认
  451. platform: "", //默认
  452. systemVerson: "", //系统版本
  453. ischangepinlun: true, //默认显示全面屏手机评论样式
  454. // ----- end ----- 评论输入框部分
  455. // ----- start ----- 评论内容部分
  456. pinlunList: [], //用于在界面展示的 评论数组
  457. pinlunListX: [], //这个是用来存储原始评论数据的数组
  458. pinlun_list: [], //用于存储界面 评论数组 的副本
  459. isSend: true, //默认
  460. userID: "", //当前用户的 ID
  461. update: true, //用于刷新视图
  462. huifuUser: "", //回复信息的人的名字
  463. gethuifuUser: "", //被回复的人(也就是接收者的名字)
  464. gethuifuUserID: "", //被回复的人的 ID
  465. huifuindex: -1, //回复信息所在下标
  466. iszhangkai: false, //默认不展开评论
  467. imgHost: HTTP_REQUEST_URL,
  468. // ----- end ----- 评论内容部分
  469. limit: 10,
  470. page: 1,
  471. pages: 1,
  472. videoIDs: 0,
  473. parentNum: 0
  474. }
  475. },
  476. name: "douyin-scrollview",
  477. props: {
  478. Width: {
  479. type: Number,
  480. default: 0
  481. },
  482. Height: {
  483. type: Number,
  484. default: 0
  485. },
  486. pinlunNum: {
  487. type: Number,
  488. default: 0
  489. },
  490. videoID: {
  491. type: Number,
  492. default: 0
  493. }
  494. },
  495. watch: {
  496. // 监听 输入表情值 并搜索 GIF 表情
  497. searchGIFValue(val) {
  498. this.isopen = false;
  499. if (val !== '') {
  500. var sms = []
  501. for (let i = 0; i < this.gifAndpngList.length; i++) {
  502. if (this.gifAndpngList[i].name.indexOf(val) !== -1) {
  503. sms.push(this.gifAndpngList[i]);
  504. }
  505. }
  506. this.GifList = sms;
  507. }
  508. },
  509. // 监听 输入框输入数据
  510. value(val) {
  511. if (val == "") {
  512. this.autoHeight = false
  513. if (this.imageURL !== '') {
  514. this.percent = 0.9
  515. } else {
  516. this.percent = 1
  517. }
  518. } else {
  519. this.autoHeight = true
  520. this.percent = 0.9
  521. }
  522. },
  523. // 监听 GIF图片(用户选择一个 GIF 图片以后这个值就会被赋值)
  524. imageURL(val) {
  525. if (val !== '') {
  526. this.percent = 0.9
  527. } else {
  528. if (this.value == '') {
  529. this.percent = 1
  530. }
  531. }
  532. },
  533. // 监听 输入框 高度变化
  534. lineheight(newVal, oldVal) {
  535. if (Math.abs(newVal) < 30) {
  536. this.borderRadius = 50
  537. } else {
  538. this.borderRadius = 10
  539. }
  540. }
  541. },
  542. created() {
  543. // 1.isToShow 用于输入框显示(默认不改)
  544. this.isToShow = false;
  545. // 2.判断当前设备信息
  546. var model = uni.getSystemInfoSync().model;
  547. // 3.判断当前设备信息
  548. this.platform = uni.getSystemInfoSync().platform;
  549. // 3.1 获取系统版本
  550. this.emojiHeight = 0;
  551. // 6.获取评论信息
  552. // #ifdef H5
  553. this.getnewpinlun();
  554. // #endif
  555. // 7.根据设备信息,处理评论区域高度
  556. if (uni.getSystemInfoSync().platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !==
  557. 'iPhone7' || model !== 'iPhone8')) {
  558. this.num = 1.25
  559. } else {
  560. this.num = 1.15
  561. }
  562. this.windowHeight = uni.getSystemInfoSync().screenHeight;
  563. this.emojiHeight = this.windowHeight / 2.1;
  564. this.adjustPosition = true;
  565. this.plHeight = this.Height - (this.Height / this.num);
  566. // 8.聚焦输入
  567. // this.focus();
  568. // 9.判断是否有 GIF 图片
  569. if (this.imageURL !== '') {
  570. this.percent = 0.9
  571. }
  572. // 10.把之前准备好的 emoji 表情赋值给 数组,用于展示
  573. // this.emojilist = emojiList
  574. // this.sinaEmojilist = sinaEmojiList
  575. // 11.看看有没有喜欢的 GIF,有的话赋值
  576. this.likeImage = uni.getStorageSync("likeImage");
  577. // 11.看看有没有当前的 GIF,有的话赋值
  578. this.nowImage = uni.getStorageSync("nowImage");
  579. // 11.看看有没有当前的 emoji ,有的话赋值
  580. this.nowTimeEmojiList = uni.getStorageSync("nowTimeEmojiList");
  581. // 12.请求 GIF 表情库(这里的表情库都存在 json 文件里面了)
  582. /*
  583. 1.资源来源
  584. GitHub:https://github.com/zhaoolee/ChineseBQB
  585. Gitee:https://gitee.com/mirrors/ChineseBQB
  586. 这两个库 数据都是同步的,可以去参考,国内的话可以用 gitee 访问下载,如何丢到服务器里面
  587. */
  588. // uni.request({
  589. // url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-bdb24c6d-8c19-4f80-8e7e-c9c9f037f131/bf6f0d2e-e065-4685-a104-218c42add104.json',
  590. // success: (res) => {
  591. // var gifAndpngList = res.data.data
  592. // var sms = []
  593. // for(let i=0;i<gifAndpngList.length;i++){
  594. // /*
  595. // 它的资源很多,这里只获取 gif 部分
  596. // */
  597. // if(gifAndpngList[i].name.indexOf("gif") !== -1){
  598. // sms.push(gifAndpngList[i])
  599. // }
  600. // }
  601. // this.gifAndpngList = sms
  602. // }
  603. // })
  604. },
  605. methods: {
  606. /*
  607. ---- 第一段,这里面含有 http 后台真实请求,以及返回处理的操作以及数据
  608. 【🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟】
  609. ---- start ----
  610. */
  611. getnewpinlun(id, type) {
  612. // #ifdef H5
  613. this.videoIDs = this.videoID;
  614. let ids = this.videoID
  615. // #endif
  616. // #ifdef MP
  617. this.videoIDs = id;
  618. let ids = id
  619. if (type) {
  620. this.pages = 1
  621. this.pinlunList = []
  622. }
  623. // #endif
  624. // 这里是对评论信息做处理
  625. commentList(ids, {
  626. limit: this.limit,
  627. page: this.pages
  628. }).then(res => {
  629. this.pages = this.pages + 1
  630. this.pinlunList = this.pinlunList.concat(res.data);
  631. }).catch(err => {
  632. return uni.showToast({
  633. title: err,
  634. icon: 'none',
  635. duration: 2000
  636. });
  637. })
  638. },
  639. sendSMS() {
  640. this.isSend = false;
  641. uni.showLoading({
  642. title: '正在发送...'
  643. })
  644. let pid = this.parentNum ? 0 : this.pinlunList[this.huifuindex].id;
  645. let data = {
  646. id: this.videoIDs,
  647. pid: pid,
  648. content: this.value
  649. }
  650. markeComment(data).then(res => {
  651. uni.hideLoading();
  652. this.$emit('pinlunFun', this.pinlunNum + 1, this.videoIDs);
  653. this.value = "";
  654. this.imageURL = "";
  655. this.$refs.openPinglun.close();
  656. this.isSend = true;
  657. this.pages = 1;
  658. this.pinlunList = [];
  659. this.getnewpinlun(this.videoIDs);
  660. }).catch(err => {
  661. return uni.showToast({
  662. title: err,
  663. icon: 'none',
  664. duration: 2000
  665. });
  666. });
  667. },
  668. tolike(item, index) {
  669. // 处理评论
  670. replyCommentLike('like', item.id).then(res => {
  671. this.pinlunList[index].is_like = !this.pinlunList[index].is_like
  672. const video = this.pinlunList[index];
  673. item.is_like ? video.like_num += 1 : video.like_num -= 1;
  674. }).catch(err => {
  675. return uni.showToast({
  676. title: err,
  677. icon: 'none',
  678. duration: 2000
  679. });
  680. })
  681. },
  682. tosonlike(index, inde, item) {
  683. replyCommentLike('like', item.id).then(res => {
  684. this.pinlunList[index].reply[inde].is_like = !this.pinlunList[index].reply[inde].is_like
  685. const video = this.pinlunList[index].reply[inde];
  686. item.is_like ? video.like_num += 1 : video.like_num -= 1;
  687. }).catch(err => {
  688. return uni.showToast({
  689. title: err,
  690. icon: 'none',
  691. duration: 2000
  692. });
  693. })
  694. },
  695. zhangkai(index, item) {
  696. // 1.点击展开评论,一开始是不展开的(如果点击展开,就把 评论的副本的子评论赋值给当前页面页面评论,这样当前页面就可以显示子评论了)
  697. if (item.isShow == undefined || item.isShow == 'undefined') {
  698. this.page = 1;
  699. }
  700. replyCommentList(item.id, {
  701. limit: this.limit,
  702. page: this.page
  703. }).then(res => {
  704. this.page = this.page + 1;
  705. item.reply = item.reply.concat(res.data);
  706. if (item.reply.length) {
  707. item.isShow = true;
  708. }
  709. this.$set(this, 'pinlunList', this.pinlunList);
  710. }).catch(err => {
  711. return uni.showToast({
  712. title: err,
  713. icon: 'none',
  714. duration: 2000
  715. });
  716. })
  717. },
  718. scrolltolower() {
  719. this.getnewpinlun(this.videoIDs);
  720. },
  721. shouqi(item) {
  722. this.page = 1
  723. item.reply = [];
  724. item.isShow = false;
  725. this.$set(this, 'pinlunList', this.pinlunList);
  726. },
  727. deletesonpinlun(index, inde) {},
  728. // deletepinlun(index){
  729. // uni.showModal({
  730. // title: '确定删除?',
  731. // content: '删除后子评论将被删除',
  732. // success: (res) => {
  733. // if(res.confirm){
  734. // uni.showLoading({
  735. // title: "正在删除"
  736. // })
  737. // commentDel().then(res=>{
  738. // uni.hideLoading();
  739. // this.getnewpinlun();
  740. // }).catch(err=>{
  741. // return this.$util.Tips({
  742. // title: err.msg
  743. // });
  744. // })
  745. // }
  746. // }
  747. // })
  748. // },
  749. addlikeImage() {
  750. uni.showModal({
  751. title: '⏰演示项目提醒⏰',
  752. content: '请前往 douyin-scrollview.nvue组件\naddlikeImage()函数进行配置',
  753. success: () => {}
  754. })
  755. },
  756. /*
  757. 【🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟】
  758. ----- end -----
  759. */
  760. sonhuifu(index, inde) {
  761. // 1.子评论回复
  762. /*
  763. (1)先处理回复人信息
  764. (2)处理被回复人信息
  765. (3)改变 “发送” 状态
  766. (4)打开评论框
  767. */
  768. this.huifuUser = uni.getStorageSync("user").username;
  769. this.gethuifuUser = this.pinlunList[index].sonPinlun[inde].username;
  770. this.gethuifuUserID = this.pinlunList[index].sonPinlun[inde].userID;
  771. this.placeholder = "回复:" + this.gethuifuUser;
  772. this.huifuindex = index;
  773. this.openPinglun();
  774. },
  775. huifu(index) {
  776. // 1.评论回复
  777. /*
  778. (1)先处理回复人信息
  779. (2)处理被回复人信息
  780. (3)改变 “发送” 状态
  781. (4)打开评论框
  782. */
  783. this.parentNum = 0;
  784. this.placeholder = "回复:" + this.pinlunList[index].nickname;
  785. this.huifuindex = index;
  786. this.openPinglun();
  787. },
  788. clicknowImage(index) {
  789. // 点击 GIF 图片信息
  790. this.imageURL = this.nowImage[index];
  791. this.isShowImage = true;
  792. },
  793. selectGIF(index) {
  794. // 选择 GIF 图片
  795. /*
  796. (1)获取 GIF 链接
  797. (2)清理搜索的 GIF 输入框信息
  798. (3)缓存 GIF 图片信息
  799. */
  800. this.imageURL = this.GifList[index].url;
  801. this.isShowImage = true;
  802. this.searchGIFValue = ""
  803. this.$refs.searchEmoji.close();
  804. if (uni.getStorageSync("nowImage").length == 0) {
  805. this.nowImage = []
  806. this.nowImage.push(this.imageURL)
  807. uni.setStorageSync("nowImage", this.nowImage);
  808. } else {
  809. this.nowImage = uni.getStorageSync("nowImage");
  810. let isTrue = true;
  811. for (let i = 0; i < this.nowImage.length; i++) {
  812. if (this.imageURL == this.nowImage[i]) {
  813. isTrue = false;
  814. }
  815. }
  816. if (isTrue) {
  817. this.nowImage.push(this.imageURL)
  818. }
  819. uni.setStorageSync("nowImage", this.nowImage);
  820. }
  821. },
  822. deleteimageURL() {
  823. // 清理 GIF 图片
  824. this.imageURL = "";
  825. this.isShowImage = false;
  826. },
  827. clickGIF(index) {
  828. // 在选择 GIF 列表,点击 GIF 图片,选择图片
  829. /*
  830. (1)获取 GIF 链接
  831. (2)清理搜索的 GIF 输入框信息
  832. (3)缓存 GIF 图片信息
  833. */
  834. this.imageURL = this.gifAndpnglist[index].url;
  835. this.isShowImage = true;
  836. if (uni.getStorageSync("nowImage").length == 0) {
  837. this.nowImage = []
  838. this.nowImage.push(this.imageURL)
  839. uni.setStorageSync("nowImage", this.nowImage);
  840. } else {
  841. this.nowImage = uni.getStorageSync("nowImage");
  842. let isTrue = true;
  843. for (let i = 0; i < this.nowImage.length; i++) {
  844. if (this.imageURL == this.nowImage[i]) {
  845. isTrue = false;
  846. }
  847. }
  848. if (isTrue) {
  849. this.nowImage.push(this.imageURL)
  850. }
  851. uni.setStorageSync("nowImage", this.nowImage);
  852. }
  853. },
  854. clearSearchValue() {
  855. // 点击搜索 GIF 的小叉叉,清理输入的值
  856. this.searchGIFValue = ""
  857. },
  858. blurGIF() {
  859. // 搜索 GIF 图片失去聚焦时
  860. // 关闭 GIF 输入框
  861. this.windowHeight = uni.getSystemInfoSync().screenHeight;
  862. this.emojiHeight = this.windowHeight / 2.1;
  863. if (this.searchGIFValue == '') {
  864. this.$refs.searchEmoji.close();
  865. }
  866. },
  867. searchGIF() {
  868. // 点击搜索 GIF 图片
  869. // 打开输入框
  870. this.emojiHeight = 0;
  871. if (uni.getSystemInfoSync().platform == 'ios') {
  872. this.$refs.searchEmoji.open('bottom');
  873. } else {
  874. setTimeout(() => {
  875. this.$refs.searchEmoji.open('bottom');
  876. }, 500)
  877. }
  878. },
  879. deletenowImage(index) {
  880. // 删除当前图片
  881. var sms = []
  882. for (let i = 0; i < this.nowImage.length; i++) {
  883. if (this.nowImage[i] !== this.nowImage[index]) {
  884. sms.push(this.nowImage[i])
  885. }
  886. }
  887. this.nowImage = sms;
  888. uni.setStorageSync("nowImage", this.nowImage);
  889. },
  890. clickLikeImage(index) {
  891. // 点击喜欢的图片之后
  892. /*
  893. (1)获取图片信息
  894. (2)缓存图片 在本地
  895. */
  896. if (uni.getStorageSync("nowImage").length == 0) {
  897. this.nowImage = []
  898. this.nowImage.push(this.likeImage[index])
  899. uni.setStorageSync("nowImage", this.nowImage);
  900. } else {
  901. this.nowImage = uni.getStorageSync("nowImage");
  902. let isTrue = true;
  903. for (let i = 0; i < this.nowImage.length; i++) {
  904. if (this.likeImage[index] == this.nowImage[i]) {
  905. isTrue = false;
  906. }
  907. }
  908. if (isTrue) {
  909. this.nowImage.push(this.likeImage[index])
  910. }
  911. uni.setStorageSync("nowImage", this.nowImage);
  912. }
  913. },
  914. deleteImage(index) {
  915. // 删除 图片
  916. /*
  917. (1)更新当前 GIF 图片列表
  918. (2)同时去看看 最近使用图片里面有没有当前要删除的图片,
  919. 如果有的话就一同删除掉
  920. */
  921. uni.showModal({
  922. title: '确定删除?',
  923. success: (re) => {
  924. if (re.confirm) {
  925. uni.removeSavedFile({
  926. filePath: this.likeImage[index],
  927. success: () => {
  928. var sms = []
  929. for (let i = 0; i < this.likeImage.length; i++) {
  930. if (this.likeImage[i] !== this.likeImage[index]) {
  931. sms.push(this.likeImage[i])
  932. }
  933. }
  934. var smh = []
  935. for (let i = 0; i < this.nowImage.length; i++) {
  936. if (this.nowImage[i] !== this.likeImage[index]) {
  937. smh.push(this.nowImage[i])
  938. }
  939. }
  940. this.nowImage = smh;
  941. uni.setStorageSync("nowImage", this.nowImage);
  942. this.likeImage = sms;
  943. uni.setStorageSync("likeImage", this.likeImage);
  944. }
  945. });
  946. }
  947. }
  948. })
  949. },
  950. qingkonGIF() {
  951. // 清空当前 GIF 图片
  952. uni.showModal({
  953. title: '确定清空?',
  954. success: (re) => {
  955. if (re.confirm) {
  956. this.nowImage = []
  957. uni.removeStorageSync("nowImage");
  958. }
  959. }
  960. })
  961. },
  962. searchGIFChange(e) {
  963. },
  964. change(e) {
  965. // 输入框开关变化
  966. /*
  967. (1)如果打开输入框(show == true)
  968. - 此时请求 GIF 列表图片信息
  969. (2)如果关闭输入框
  970. - 恢复默认设置
  971. */
  972. this.isToShow = false;
  973. if (e.show == true) {
  974. this.show = false;
  975. this.getGif();
  976. } else {
  977. uni.hideKeyboard();
  978. this.show = true
  979. this.autoFocus = true;
  980. this.isopen = false;
  981. this.current = 1;
  982. this.currentNum = 4.4;
  983. this.isShowImage = false;
  984. this.cursorSpacing = 20;
  985. this.placeholder = "说点什么呗~";
  986. }
  987. },
  988. /*
  989. 以下方法都是输入框 状态变化,以及逻辑切换等信息
  990. 虽然不起眼但是很重要 【🌟🌟🌟🌟🌟】
  991. (如果是要复制的话都是要复制的)
  992. */
  993. // ------- start -------\
  994. closeSheet() {
  995. this.$emit('closeScrollview');
  996. },
  997. movehandle() {},
  998. movesearch() {},
  999. parentPinglun() {
  1000. this.parentNum = 1;
  1001. this.openPinglun();
  1002. },
  1003. openPinglun() {
  1004. this.$refs.openPinglun.open('bottom')
  1005. },
  1006. linechange(event) {
  1007. this.lineheight = event.detail.height
  1008. },
  1009. keyboardheightchange() {},
  1010. blur() {
  1011. // uni.hideKeyboard();
  1012. },
  1013. clickTextarea() {
  1014. this.isopen = false;
  1015. this.disabled = false;
  1016. this.emojiHeight = 0;
  1017. },
  1018. focus() {
  1019. this.isopen = false;
  1020. this.emojiHeight = 0;
  1021. setTimeout(() => {
  1022. setTimeout(() => {
  1023. this.isToShow = false;
  1024. if (this.imageURL !== '') {
  1025. this.isShowImage = true;
  1026. }
  1027. }, 1500)
  1028. }, 20)
  1029. },
  1030. toemoji() {
  1031. if (this.isopen == false) {
  1032. this.windowHeight = uni.getSystemInfoSync().screenHeight;
  1033. this.emojiHeight = this.windowHeight / 2.1;
  1034. this.disabled = true;
  1035. setTimeout(() => {
  1036. this.isopen = true;
  1037. this.isToShow = true;
  1038. }, 500)
  1039. } else {
  1040. this.isShowImage = false;
  1041. this.isToShow = false;
  1042. this.isopen = false;
  1043. this.disabled = false;
  1044. this.emojiHeight = 0;
  1045. if (this.imageURL !== '') {
  1046. setTimeout(() => {
  1047. this.isShowImage = true;
  1048. }, 1300)
  1049. }
  1050. }
  1051. },
  1052. undo() {
  1053. if (this.value !== "") {
  1054. var str = ""
  1055. for (let i = 0; i < this.value.length - 1; i++) {
  1056. str += this.value[i]
  1057. }
  1058. this.value = str;
  1059. }
  1060. },
  1061. timeEmoji() {
  1062. this.currentNum = 1
  1063. this.current = 0
  1064. },
  1065. nowEmoji() {
  1066. this.currentNum = 4.3
  1067. this.current = 1
  1068. },
  1069. likeEmoji() {
  1070. this.currentNum = 7.6
  1071. this.current = 2
  1072. },
  1073. gifEmoji() {
  1074. this.currentNum = 11.0
  1075. this.current = 3
  1076. },
  1077. qingkon() {
  1078. uni.showModal({
  1079. title: '确定清空?',
  1080. success: (re) => {
  1081. if (re.confirm) {
  1082. this.nowTimeEmojiList = []
  1083. uni.removeStorageSync("nowTimeEmojiList");
  1084. }
  1085. }
  1086. })
  1087. },
  1088. clicknowTimeEmoji(index) {
  1089. var str = this.nowTimeEmojiList[index].alt;
  1090. this.value += str;
  1091. },
  1092. clickEmoji(index) {
  1093. // console.log(this.emojilist[index])
  1094. var str = this.emojilist[index].alt;
  1095. this.value += str;
  1096. if (uni.getStorageSync("nowTimeEmojiList").length == 0) {
  1097. this.nowTimeEmojiList = []
  1098. this.nowTimeEmojiList.push(this.emojilist[index])
  1099. uni.setStorageSync("nowTimeEmojiList", this.nowTimeEmojiList);
  1100. } else {
  1101. this.nowTimeEmojiList = uni.getStorageSync("nowTimeEmojiList");
  1102. let isTrue = true;
  1103. for (let i = 0; i < this.nowTimeEmojiList.length; i++) {
  1104. if (this.emojilist[index].alt == this.nowTimeEmojiList[i].alt) {
  1105. isTrue = false;
  1106. }
  1107. }
  1108. if (isTrue) {
  1109. this.nowTimeEmojiList.push(this.emojilist[index])
  1110. }
  1111. uni.setStorageSync("nowTimeEmojiList", this.nowTimeEmojiList);
  1112. }
  1113. },
  1114. clicksinaEmoji(index) {
  1115. console.log(this.sinaEmojilist[index])
  1116. },
  1117. currentChange(e) {
  1118. var num = e.detail.current + 1
  1119. switch (num) {
  1120. case 1:
  1121. this.currentNum = 1
  1122. break;
  1123. case 2:
  1124. this.currentNum = 4.3
  1125. break;
  1126. case 3:
  1127. this.currentNum = 7.6
  1128. break;
  1129. case 4:
  1130. this.currentNum = 11.0
  1131. break;
  1132. default:
  1133. break;
  1134. }
  1135. },
  1136. getGif() {
  1137. var list = []
  1138. for (let i = 0; i < 15; i++) {
  1139. var num = Math.round(Math.random() * this.gifAndpngList.length);
  1140. list.push(this.gifAndpngList[num]);
  1141. }
  1142. this.gifAndpnglist = list
  1143. },
  1144. scrolltolowerGIF() {
  1145. for (let i = 0; i < 15; i++) {
  1146. var num = Math.round(Math.random() * this.gifAndpngList.length);
  1147. this.gifAndpnglist.push(this.gifAndpngList[num]);
  1148. }
  1149. }
  1150. // ------- end -------
  1151. }
  1152. }
  1153. </script>
  1154. <style lang="scss">
  1155. .vip {
  1156. width: 56rpx;
  1157. height: 20rpx;
  1158. margin-top: 6rpx;
  1159. margin-left: 16rpx;
  1160. }
  1161. .numberComment {
  1162. font-size: 26rpx;
  1163. font-weight: 500;
  1164. text-align: center;
  1165. color: #333;
  1166. margin-top: 34rpx;
  1167. position: relative;
  1168. .iconfont {
  1169. position: absolute;
  1170. right: 30rpx;
  1171. width: 30rpx;
  1172. height: 30rpx;
  1173. }
  1174. }
  1175. .pictrue {
  1176. width: 60rpx;
  1177. height: 60rpx;
  1178. border: 1px solid #fff;
  1179. border-radius: 50rpx;
  1180. margin-top: 20px;
  1181. margin-left: 15px;
  1182. }
  1183. .name {
  1184. font-size: 24rpx;
  1185. font-weight: 500;
  1186. color: #666;
  1187. }
  1188. .time {
  1189. font-size: 20rpx;
  1190. font-weight: 400;
  1191. color: #999999;
  1192. margin-left: 10px;
  1193. }
  1194. .like {
  1195. color: #999;
  1196. position: absolute;
  1197. right: 45rpx;
  1198. margin-left: 5rpx;
  1199. width: 26rpx;
  1200. height: 26rpx;
  1201. top: 4rpx;
  1202. }
  1203. .likeNum {
  1204. font-size: 22rpx;
  1205. color: #a3a1a4;
  1206. position: absolute;
  1207. // #ifdef H5
  1208. right: 22rpx;
  1209. // #endif
  1210. // #ifdef MP
  1211. right: 15rpx;
  1212. // #endif
  1213. margin-top: 2rpx;
  1214. }
  1215. .childrenPic {
  1216. width: 40rpx;
  1217. height: 40rpx;
  1218. border-radius: 50%;
  1219. margin-top: 20px;
  1220. }
  1221. .childrenName {
  1222. font-size: 24rpx;
  1223. font-weight: 500;
  1224. color: #666;
  1225. }
  1226. .childrenLike {
  1227. color: #999;
  1228. position: absolute;
  1229. right: 10rpx;
  1230. width: 27rpx;
  1231. height: 27rpx;
  1232. }
  1233. .childrenLikeNum {
  1234. font-size: 22rpx;
  1235. color: #a3a1a4;
  1236. position: absolute;
  1237. right: -12rpx;
  1238. margin-top: 2rpx;
  1239. }
  1240. </style>