douyin-scrollview.vue 43 KB

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