douyin-scrollview.vue 46 KB

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