douyin-scrollview.nvue 51 KB

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