123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398 |
- <template>
- <view style="">
- <!-- <view style="height: 45upx;"></view> -->
- <!-- <image @click="closeSheet" class="closeBnt" :src="imgHost + '/statics/images/close.png'" mode=""></image> -->
- <text class="numberComment">{{pinlunNum}}条评论</text>
- <view
- :style="'width: '+ Width +'px; height: '+ (Height/num) +'px; margin-top: 20upx; background-color: #fff; display: flex; flex-direction: column;'">
- <text v-if="pinlunList.length == 0"
- :style="'font-size: 14px; font-weight: bold; color: #a3a1a4; margin-top: 150upx; margin-left: '+ (Width/2.9) +'px; position: absolute;'">
- ~ 快来评论吧 ~</text>
- <list :show-scrollbar="false" :scrollable="true" @loadmore="loadmore" @scroll="scrolls">
- <cell v-for="(list,index) in pinlunList">
- <view :style="'width: '+ Width +'px; display: flex; flex-direction: row;'">
- <!-- 1.用户的头像 -->
- <image :src="list.avatar" mode="aspectFill" class="pictrue"></image>
- <!-- 2.一级评论 -->
- <view
- :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: column; margin-top: 40upx; margin-left: 20upx;'">
- <!-- 3.用户名称,并自动判断是否为视频作者 -->
- <view style="display: flex; flex-direction: row;">
- <text class="name">{{list.nickname}}</text>
- <image v-if="list.is_money_level>0" class="vip" src="@/static/images/vip.png"></image>
- <!-- 4.如果是视频作者就显示 作者 -->
- <view v-if="list.uid == 0"
- style="background-color: #E43D33; border-radius: 5upx; margin-left: 15upx;height: 32upx;display: flex;align-items: center;flex-direction: row;">
- <text
- style="font-size: 9px; font-weight: bold; padding-left: 8upx; padding-right: 8upx; font-weight: bold; color: #FFFFFF;">商家</text>
- </view>
- </view>
- <!-- 5.
-
- 由于 rich-text 有很多 bug
- 所以这里已经摒弃了,
- 使用自研文本解析器
-
- -->
- <view @click="huifu(index)"
- :style="'width: '+ (Width*0.78) +'px; display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 8upx;'">
- <text
- :style="'width: '+ (Width*0.78) +'px;font-size: 28rpx; font-weight: 400; color: #333; margin-left: 0upx;'">{{list.content}}</text>
- <!-- <rich-text :nodes="list.content"></rich-text> -->
- </view>
- <!-- 7.这里就是 时间、回复、点赞、点赞量显示的地方 -->
- <view
- :style="'width: '+ (Width*0.8) +'px; height: 40upx; display: flex; flex-direction: row; margin-top: 25upx;'">
- <text style="font-size: 12px; color: #a3a1a4;">{{list.add_time}} · {{list.city?list.city:''}}</text>
- <text @click="huifu(index)" class="time">回复</text>
- <!-- <text v-if="userID == list.userID" @click="deletepinlun(index)" class="time">删除</text> -->
- <image v-if="!list.is_like" class="like" @click="tolike(list,index)"
- :src="imgHost + '/statics/images/zan01.png'"></image>
- <image v-if="list.is_like" class="like" @click="tolike(list,index)"
- :src="imgHost + '/statics/images/zan02.png'"></image>
- <text class="likeNum" @click="tolike(list,index)">{{list.like_num}}</text>
- </view>
- <!-- 8.用户回复的子评论会显示在这里
-
- 这里 update 用于刷新视图
-
- -->
- <block v-for="(li,inde) in list.reply" v-if="list.isShow">
- <view :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: row;'">
- <!-- 9.子评论 用户头像 -->
- <image :src="li.avatar" mode="aspectFill" class="childrenPic"></image>
- <!-- 10.动态计算宽度 子评论列表 -->
- <view
- :style="'width: '+ (Width*0.8*0.87) +'px; display: flex; flex-direction: column; margin-top: 40upx; margin-left: 20upx;'">
- <view style="display: flex; flex-direction: row;">
- <view style="display: flex; flex-direction: row;">
- <!-- 11.回复评论的人显示在这里 -->
- <text class="childrenName">{{li.nickname}}</text>
- <image v-if="li.is_money_level>0" class="vip"
- src="@/static/images/vip.png"></image>
- <!-- 12.同时要判断评论人是不是作者,如果是作者就在这里显示 -->
- <view v-if="li.uid==0"
- style="background-color: #E43D33; border-radius: 5upx; margin-left: 15upx;height: 32upx;display: flex;align-items: center;flex-direction: row;">
- <text
- style="font-size: 9px; font-weight: bold; padding-left: 8upx; padding-right: 8upx; font-weight: bold; color: #FFFFFF;">商家</text>
- </view>
- </view>
- <!-- 13.图片是一个向右的小图标 -->
- <!-- <image src="../../static/douyin/you-3.png" style="width: 20upx; height: 20upx; margin-top: 5upx; margin-left: 10upx;"></image> -->
- <!-- 14.被回复用户的名称 会显示在这里 -->
- <!-- <view style="display: flex; flex-direction: row; margin-left: 10upx;"> -->
- <!-- <text style="font-size: 12px; font-weight: bold; color: #a3a1a4;">{{li.gethuifuUser}}</text> -->
- <!-- 15.同时要判断评论人是不是作者,如果是作者就在这里显示 -->
- <!-- <view v-if="videouserID == li.gethuifuUserID" style="background-color: #E43D33; border-radius: 5upx; margin-left: 15upx;">
- <text style="font-size: 8px; font-weight: bold; padding: 5upx; padding-left: 8upx; padding-right: 8upx; font-weight: bold; color: #FFFFFF;">作者</text>
- </view> -->
- <!-- </view> -->
- </view>
- <!-- 16.
-
- 由于 rich-text 有很多 bug
- 所以这里已经摒弃了,
- 使用自研文本表情解析器
-
- -->
- <view
- :style="'width: '+ (Width*0.8*0.85) +'px; display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 8upx;word-break: break-all;'">
- <text
- :style="'width: '+ (Width*0.8*0.85) +'px;font-size: 28rpx; font-weight: 400; color: #333; margin-left: 0upx;'">{{li.content}}</text>
- </view>
- <!-- 17.如果 子评论 用户输入了 GIF 表情,就会在这里显示 -->
- <!-- <image v-if="li.imageURL !== ''" :src="li.imageURL" mode="aspectFill" style="width: 140upx; height: 140upx; margin-top: 20upx; border-radius: 10upx;"></image> -->
- <!-- 18.这里就是 时间、回复、点赞、点赞量显示的地方 -->
- <view
- :style="'width: '+ (Width*0.8*0.87) +'px; height: 40upx; display: flex; flex-direction: row; margin-top: 16upx;'">
- <text style="font-size: 12px; color: #a3a1a4;">{{li.add_time}} · {{li.city?li.city:''}}</text>
- <!-- <text @click="sonhuifu(index,inde)" style="font-size: 12px; font-weight: bold; color: #a3a1a4; margin-left: 20upx;">回复</text> -->
- <!-- <text v-if="userID == li.userID" @click="deletesonpinlun(index,inde)" class="time">删除</text> -->
- <image class="childrenLike" v-if="!li.is_like"
- @click="tosonlike(index,inde,li)"
- :src="imgHost + '/statics/images/zan01.png'"></image>
- <image class="childrenLike" v-if="li.is_like"
- @click="tosonlike(index,inde,li)"
- :src="imgHost + '/statics/images/zan02.png'"></image>
- <text class="childrenLikeNum"
- @click="tosonlike(index,inde,li)">{{li.like_num}}</text>
- </view>
- </view>
- </view>
- </block>
- <!-- 19。显示 【展开xx条评论】、【收起评论】 -->
- <view v-if="list.reply_count > 0"
- :style="'width: '+ (Width*0.8) +'px; display: flex; flex-direction: row; margin-top: 30upx;'">
- <view
- style="width: 60upx; height: 1px; background-color: #a3a1a4; opacity: 0.6; margin-top: 13upx;">
- </view>
- <text @click="zhangkai(index,list)" v-if="list.reply_count!=list.reply.length"
- style="font-size: 12px; font-weight: bold; color: #cdcbd4; margin-left: 12upx;">展开{{list.reply_count}}条回复</text>
- <text @click="shouqi(list)" v-if="list.reply.length"
- style="font-size: 12px; font-weight: bold; color: #cdcbd4; margin-left: 12upx;">收起</text>
- </view>
- </view>
- </view>
- <!-- 20.留一定的高度以免视图被遮挡 -->
- <view v-if="index == (pinlunList.length-1)" :style="'width: '+ Width +'px; height: 80px;'"></view>
- </cell>
- </list>
- </view>
- <!-- 21.底部,模拟假的输入框 -->
- <view v-if="show && ischangepinlun==false" @touchstart="parentPinglun"
- :style="'width: '+ Width +'px; height: '+ plHeight +'px; background-color: #fff; position: fixed; bottom: 0;'">
- <view
- :style="'width: '+ (Width-30) +'px; height: 32px; margin-left: 15px; margin-top: 14upx; background-color: #eee; border-radius: 100upx; display: flex; flex-direction: row;'">
- <text v-if="platform=='ios'"
- style="font-size: 14px; color: #999; margin-top: 17upx; margin-left: 30upx;">说点什么呗~</text>
- <text v-if="platform!=='ios'"
- style="font-size: 14px; color: #999; margin-top: 13upx; margin-left: 30upx;">说点什么呗~</text>
- <image :src="imgHost + '/statics/images/send01.png'"
- style="width: 40upx; margin-top: 15upx; height: 40upx; position: absolute; right: 25upx;"></image>
- </view>
- </view>
- <view v-if="show && ischangepinlun==true" @touchstart="parentPinglun"
- :style="'width: '+ Width +'px; height: 53px; background-color: #fff;position: fixed; bottom: 0;'">
- <view
- :style="'width: '+ (Width-30) +'px; height: 32px;margin-left: 15px; margin-top: 20upx; background-color: #eee; border-radius: 100upx; display: flex; flex-direction: row;'">
- <text v-if="platform=='ios'"
- style="font-size: 14px; color: #a3a1a4; margin-top: 17upx; margin-left: 30upx;">说点什么呗~</text>
- <text v-if="platform!=='ios'"
- style="font-size: 14px; color: #a3a1a4; margin-top: 13upx; margin-left: 30upx;">说点什么呗~</text>
- <image :src="imgHost + '/statics/images/send01.png'"
- style="width: 40upx; margin-top: 15upx; height: 40upx; position: absolute; right: 25upx;"></image>
- </view>
- </view>
- <!--
-
- 下面就是真正的评论框
-
- 包含:
- 1.输入框
- 2.表情输入框
- 3.GIF表情库
- 4.最近使用表情和全部表情
- 5.自己上传表情
- 6. @ 自己的好友
- 7.自带微博表情 和 QQ 表情
- 8.能记忆输入
-
- -->
- <uni-popup type="bottom" ref="openPinglun" @touchmove.stop.prevent="movehandle" @change="change">
- <view style="display: flex; flex-direction: column;">
- <view @click="openPinglun"
- :style="'width: '+ Width +'px; background-color: #FFFFFF; display: flex; flex-direction: row;'">
- <view
- :style="'width: '+ (Width-30)*percent +'px; margin-left: 15px; margin-top: 20upx; background-color: #f2f0f4; border-radius: '+ borderRadius +'upx; margin-bottom: 20upx; display: flex; flex-direction: row;'">
- <!--
- 9.输入框
- -->
- <textarea
- :style="'width: '+ (Width-60)*percent +'px; height: 20px; margin-bottom: 20upx; font-size: 15px; color: #000000; margin-top: 20upx; margin-left: 30upx;'"
- :placeholder="placeholder" :cursor-spacing="cursorSpacing" :auto-focus="autoFocus"
- :auto-height="autoHeight" :adjust-position="adjustPosition" v-model="value" maxlength="150"
- @linechange="linechange" @keyboardheightchange="keyboardheightchange" @focus="focus"
- @click="clickTextarea" @blur="blur"></textarea>
- <!-- <image src="@/static/douyin/atuser.png" style="width: 70upx; height: 70upx; position: absolute; right: 110upx; margin-top: 8upx;"></image> -->
- <!-- 10.点击表情展开评论框 -->
- <!-- <image v-if="!isopen" @click="toemoji" src="@/static/douyin/biaoqing-2.png" style="width: 50upx; margin-top: 15upx; height: 50upx; position: absolute; right: 25upx;"></image>
- <image v-if="isopen" @click="toemoji" src="@/static/douyin/jianpan.png" style="width: 50upx; margin-top: 15upx; height: 50upx; position: absolute; right: 25upx;"></image> -->
- </view>
- <!-- 11.发送按钮
-
- 符合:有内容、或者是输入 GIF 图片都可以通过
-
- -->
- <view v-if="(value!=='' || imageURL !== '') && isSend" @click="sendSMS"
- style="width: 30px; height: 30px; border-radius: 40px; margin-top: 30upx; margin-left: 20upx;">
- <image :src="imgHost + '/statics/images/send02.png'" style="width: 30px; height: 30px;"></image>
- </view>
- </view>
- </view>
- <!-- 12.用于显示用户选择的 GIF 图片 -->
- <view v-if="isShowImage" :style="'width: '+ Width +'px; height: 75px; background-color: #FFFFFF;'">
- <view style="display: flex; flex-direction: row;">
- <image :src="imageURL" mode="aspectFill"
- style="width: 120upx; height: 120upx; margin-top: 10upx; margin-left: 50upx;"></image>
- <!-- <image @click="deleteimageURL" src="../../static/douyin/zfxsc.png" style="width: 30upx; height: 30upx; position: absolute; margin-left: 140upx; margin-top: 12upx;"></image> -->
- </view>
- </view>
- <!-- 13.
-
- 表情 区
-
- -->
- <view :style="'width: '+ Width +'px; height: '+ emojiHeight +'px; background-color: #FFFFFF;'">
- <!--
- isToShow:这个参数用于控制显示,不动它即可
- -->
- <block v-if="isToShow">
- <!-- 14.表情选择栏:
-
- 最近输入的 GIF 图在:timeEmoji
- 默认展示的 表情 :nowEmoji
- 自己上传的图片:likeEmoji
- GIF 图片库:gifEmoji
-
- -->
- <!-- <scroll-view :style="'width: '+ Width +'px; height: 40px; background-color: #FFFFFF;'" :scroll-x="true" style="display: flex; flex-direction: row;" :show-scrollbar="false">
- <view :style="'display: flex; flex-direction: row; width: '+ Width +'px; padding-top: 10upx; padding-bottom: 10upx; border-bottom: 1upx solid #f3f1f4;'">
- <view :style="'width: 90upx; height: 60upx; border-radius: 60upx; position: absolute; background-color: #f8f4f7; margin-top: -8upx; margin-left: '+ (Width*0.04)*currentNum +'px;'"></view>
- <image @click="timeEmoji" src="../../static/douyin/time.png" style="width: 45upx; height: 45upx; margin-left: 50upx;"></image>
- <image @click="nowEmoji" src="../../static/douyin/biaoqing-2.png" style="width: 50upx; height: 50upx; margin-left: 50upx; margin-top: -5upx;"></image>
- <image @click="likeEmoji" src="../../static/douyin/xianxing.png" style="width: 55upx; height: 55upx; margin-left: 50upx; margin-top: -5upx;"></image>
- <view @click="gifEmoji" style="width: 45upx; height: 45upx; border-radius: 55upx; border: 2px solid #303133; margin-left: 52upx; margin-top: 0upx;">
- <image src="../../static/douyin/gif-2.png" style="width: 35upx; height: 35upx;"></image>
- </view>
- </view>
- </scroll-view> -->
- <!-- 15.表情选择栏:
-
- 最近输入的 GIF 图在:timeEmoji
- 默认展示的 表情 :nowEmoji
- 自己上传的图片:likeEmoji
- GIF 图片库:gifEmoji
-
- -->
- <swiper
- :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
- :current="current" @change="currentChange">
- <swiper-item>
- <scroll-view
- :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
- :scroll-y="true">
- <text v-if="nowImage.length !== 0" @click="qingkonGIF"
- style="font-size: 12px; margin-top: 20upx; position: absolute; right: 40upx; color: #007AFF;">清空</text>
- <view style="display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 40upx;">
- <block v-for="(list,index) in nowImage">
- <image @click="clicknowImage(index)" :src="list" mode="aspectFill"
- style="width: 120upx; height: 120upx; margin-top: 40upx; margin-left: 55upx;">
- </image>
- <!-- <image @click="deletenowImage(index)" src="../../static/douyin/zfxsc.png" style="width: 30upx; height: 30upx; position: absolute; right: 0; margin-top: 40upx;"></image> -->
- </block>
- <block v-if="nowImage.length == 0">
- <text
- :style="'font-size: 14px; color: #999999; margin-top: 200upx; margin-left: '+ (Width/3.2) +'px;'">~
- 您还没使用过图片 ~</text>
- </block>
- </view>
- <view :style="'width: '+ Width +'px; height: 80px;'"></view>
- </scroll-view>
- </swiper-item>
- <swiper-item>
- <scroll-view
- :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
- :scroll-y="true">
- <block v-if="nowTimeEmojiList.length !== 0">
- <text style="font-size: 12px; margin-top: 20upx; margin-left: 30upx;">最近使用</text>
- <text @click="qingkon"
- style="font-size: 12px; margin-top: 20upx; position: absolute; right: 40upx; color: #007AFF;">清空</text>
- <view
- style="display: flex; flex-direction: row; flex-wrap: wrap; margin-bottom: 20upx;">
- <!-- QQ - 表情包 -->
- <block v-for="(list,index) in nowTimeEmojiList">
- <image @click="clicknowTimeEmoji(index)"
- :src="'../../static/emojis/qq/'+list.url+''"
- style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;">
- </image>
- </block>
- <!-- 新浪微博 - 表情包 -->
- <!-- <block v-for="(list,index) in sinaEmojilist">
- <image @click="clicksinaEmoji(index)" :src="list.url" style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;"></image>
- </block> -->
- </view>
- </block>
- <text style="font-size: 12px; margin-top: 20upx; margin-left: 30upx;">全部表情</text>
- <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
- <!-- QQ - 表情包 -->
- <block v-for="(list,index) in emojilist">
- <image @click="clickEmoji(index)" :src="'../../static/emojis/qq/'+list.url+''"
- style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;">
- </image>
- </block>
- <!-- 新浪微博 - 表情包 -->
- <!-- <block v-for="(list,index) in sinaEmojilist">
- <image @click="clicksinaEmoji(index)" :src="list.url" style="width: 35px; height: 35px; margin-top: 30upx; margin-left: 36upx;"></image>
- </block> -->
- </view>
- <view :style="'width: '+ Width +'px; height: 80px;'"></view>
- </scroll-view>
- <view v-if="platform=='ios'"
- style="position: absolute; display: flex; flex-direction: row; bottom: 0; right: 0; width: 300upx; height: 160upx; background-color: #FFFFFF; box-shadow: -20px -40px 20px 60upx #FFFFFF; border-radius: 2upx;">
- <view @click="undo"
- style="width: 130upx; height: 60upx; margin-top: 20upx; border-radius: 40upx; border: 1upx solid #c6c5c8;">
- <!-- <image src="../../static/douyin/shanchu-3.png" style="width: 45upx; height: 30upx; margin-top: 15upx; margin-left: 40upx;"></image> -->
- </view>
- <!-- 16.发送按钮
-
- 符合:有内容、或者是输入 GIF 图片都可以通过
-
- -->
- <view v-if="(value!=='' || imageURL !== '') && isSend" @click="sendSMS"
- style="width: 130upx; height: 60upx; margin-top: 20upx; margin-left: 20upx; border-radius: 40upx; background-color: #ff1a63;">
- <text
- style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 10upx;">发送</text>
- </view>
- <view v-if="(value == '' && imageURL == '') && isSend"
- style="width: 130upx; height: 60upx; margin-top: 20upx; margin-left: 20upx; border-radius: 40upx; background-color: #bab9bb;">
- <text
- style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 10upx;">发送</text>
- </view>
- </view>
- <view v-if="platform!=='ios'"
- style="position: absolute; display: flex; flex-direction: row; bottom: 20upx; right: 20upx; width: 300upx; height: 80upx; padding: 10upx; background-color: #eceef1; border-radius: 20upx;">
- <view @click="undo"
- style="width: 130upx; height: 60upx; margin-top: 0; border-radius: 40upx; border: 1upx solid #c6c5c8;">
- <image src="../../static/douyin/shanchu-3.png"
- style="width: 45upx; height: 30upx; margin-top: 15upx; margin-left: 40upx;">
- </image>
- </view>
- <!-- 16.发送按钮
-
- 符合:有内容、或者是输入 GIF 图片都可以通过
-
- -->
- <view v-if="(value!=='' || imageURL !== '') && isSend" @click="sendSMS"
- style="width: 130upx; height: 60upx; margin-top: 0; margin-left: 20upx; border-radius: 40upx; background-color: #ff1a63;">
- <text
- style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 10upx;">发送</text>
- </view>
- <view v-if="(value == '' && imageURL == '') && isSend"
- style="width: 130upx; height: 60upx; margin-top: 0; margin-left: 20upx; border-radius: 40upx; background-color: #bab9bb;">
- <text
- style="font-size: 14px; font-weight: bold; text-align: center; color: #FFFFFF; padding-top: 10upx;">发送</text>
- </view>
- </view>
- </swiper-item>
- <swiper-item>
- <scroll-view
- :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
- :scroll-y="true">
- <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
- <view v-if="platform=='ios'" @click="addlikeImage"
- style="width: 120upx; height: 120upx; border-radius: 10upx; border: 1upx dashed #000000; margin-top: 40upx; margin-left: 55upx;">
- <!-- <image src="../../static/douyin/jia-9.png" style="width: 50upx; height: 50upx; margin-top: 35upx; margin-left: 35upx;"></image> -->
- </view>
- <view v-if="platform!=='ios'" @click="addlikeImage"
- style="width: 120upx; height: 120upx; border-radius: 10upx; border: 1px solid #000000; margin-top: 40upx; margin-left: 55upx;">
- <!-- <image src="../../static/douyin/jia-9.png" style="width: 50upx; height: 50upx; margin-top: 35upx; margin-left: 35upx;"></image> -->
- </view>
- <block v-for="(list,index) in likeImage">
- <image @click="clickLikeImage(index)" :src="list" mode="aspectFill"
- style="width: 120upx; height: 120upx; margin-top: 40upx; margin-left: 55upx;">
- </image>
- <!-- <image @click="deleteImage(index)" src="../../static/douyin/zfxsc.png" style="width: 30upx; height: 30upx; position: absolute; right: 0; margin-top: 40upx;"></image> -->
- </block>
- </view>
- <view :style="'width: '+ Width +'px; height: 80px;'"></view>
- </scroll-view>
- </swiper-item>
- <swiper-item>
- <scroll-view
- :style="'width: '+ Width +'px; height: '+ (emojiHeight-40) +'px; background-color: #FFFFFF;'"
- :scroll-y="true" @scrolltolower="scrolltolowerGIF">
- <view style="display: flex; flex-direction: row; flex-wrap: wrap;">
- <view v-if="platform=='ios'" @click="searchGIF"
- style="width: 120upx; height: 120upx; border-radius: 10upx; border: 1upx dashed #000000; margin-top: 40upx; margin-left: 55upx;">
- <!-- <image src="../../static/douyin/sousuo-7.png" style="width: 50upx; height: 50upx; margin-top: 35upx; margin-left: 35upx;"></image> -->
- </view>
- <view v-if="platform!=='ios'" @click="searchGIF"
- style="width: 120upx; height: 120upx; border-radius: 10upx; border: 1px solid #000000; margin-top: 40upx; margin-left: 55upx;">
- <!-- <image src="../../static/douyin/sousuo-7.png" style="width: 50upx; height: 50upx; margin-top: 35upx; margin-left: 35upx;"></image> -->
- </view>
- <block v-for="(list,index) in gifAndpnglist">
- <image @click="clickGIF(index)" :src="list.url" mode="aspectFill"
- style="width: 120upx; height: 120upx; margin-top: 40upx; margin-left: 55upx;">
- </image>
- </block>
- </view>
- <view :style="'width: '+ Width +'px; height: 80px;'"></view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </block>
- <block v-if="!isToShow">
- <!-- 这里为空即可,不加任何东西 -->
- </block>
- </view>
- </uni-popup>
- <!-- 1.
-
- 这个弹窗用于搜索 GIF
-
- -->
- <uni-popup type="bottom" ref="searchEmoji" @touchmove.stop.prevent="movesearch" @change="searchGIFChange">
- <view v-if="searchGIFValue !== ''"
- :style="'width: '+ Width +'px; height: 80px; border-bottom: 1upx solid #e3e1e5; background-color: #FFFFFF; border-top-left-radius: 20upx; border-top-right-radius: 20upx;'">
- <!-- 2.
-
- 搜出来的 GIF 都在这里
-
- -->
- <scroll-view
- :style="'width: '+ Width +'px; height: 80px; border-bottom: 1upx solid #e3e1e5; display: flex; flex-direction: row;'"
- :scroll-x="true" style="display: flex; flex-direction: row;" :show-scrollbar="false">
- <block v-for="(list,index) in GifList">
- <image @click="selectGIF(index)" :src="list.url" mode="aspectFill"
- style="width: 120upx; height: 120upx; margin-top: 20upx; margin-left: 20upx;"></image>
- </block>
- <view style="width: 20upx; height: 120upx; margin-left: 10upx;"></view>
- </scroll-view>
- </view>
- <!-- 3.
- 动态图输入框
- -->
- <view :style="'width: '+ Width +'px; background-color: #FFFFFF; display: flex; flex-direction: row;'">
- <view
- :style="'width: '+ (Width-30) +'px; margin-left: 15px; margin-top: 20upx; background-color: #FFFFFF; margin-bottom: 20upx; display: flex; flex-direction: row;'">
- <input
- :style="'width: '+ (Width*0.8) +'px; height: 20px; margin-bottom: 20upx; font-size: 15px; color: #000000; margin-top: 15upx; margin-left: 30upx;'"
- placeholder="搜索表情包" v-model="searchGIFValue" :auto-focus="false" :adjust-position="false"
- @blur="blurGIF" />
- <!-- <image v-if="searchGIFValue !== ''" @click="clearSearchValue" src="../../static/douyin/chacha-4.png" style=" width: 25upx; height: 25upx; margin-top: 20upx; margin-left: 30upx;"></image> -->
- </view>
- </view>
- <view v-if="platform=='ios'"
- :style="'width: '+ Width +'px; height: '+ (emojiHeight+40) +'px; background-color: #FFFFFF;'">
- <!-- 这里不要动就行 -->
- </view>
- <view v-if="platform!=='ios'"
- :style="'width: '+ Width +'px; height: '+ emojiHeight +'px; background-color: #FFFFFF;'">
- <!-- 这里不要动就行 -->
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- // 1.先引入表情库,(完全手撸,十分繁琐)(这个是 QQ 的表情库)
- // import emojiList from '../../common/emoji/biaoqin.js'
- // 2.这个表情库是新浪微博 的表情库
- // import sinaEmojiList from '../../common/emoji/sina.js'
- // 3.这个一定要引入进来,用来解析生成的 <html>【🌟🌟🌟🌟🌟】十分重要【这里已经对原来的文件进行了改编】
- import parsehtml from '../../common/html-parse/parse_html.js'
- // 4.这里引入时间函数 用来上传时用的
- import time from '../../common/time-utils/currentData.js'
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- import {
- commentList,
- markeComment,
- replyCommentList,
- replyCommentLike
- } from '@/api/short-video.js';
- import {
- mapGetters
- } from 'vuex';
- export default {
- name: "douyin-scrollview",
- props: {
- Width: {
- type: Number,
- default: 0
- },
- Height: {
- type: Number,
- default: 0
- },
- deleteIOSHeight: {
- type: Number,
- default: 0
- },
- deleteAndroidHeight: {
- type: Number,
- default: 0
- }
- },
- computed: mapGetters(['uid']),
- data() {
- return {
- videoID: 0,
- pinlunNum: 0,
- // 每一个参数都重要
- // 解释如下:
- // ----- start ----- 评论输入框部分
- num: 1.15, //用来处理评论的高度
- plHeight: 0, //评论高度
- value: "", //用户在输入框输入信息的数据
- autoHeight: false, //这个默认即可(用于评论框自动适应高度)
- borderRadius: 100, //评论框圆角大小
- lineheight: 0, //默认即可(用于处理评论框高度)
- percent: 1, //默认(用于处理发送按钮已经评论框宽度)
- show: true, //默认(是否显示评论框)
- emojiHeight: 0, //表情区域的高度
- emojiheight: 0, //用于处理表情区域的高度
- cursorSpacing: 20, //键盘距离输入框的距离
- autoFocus: true, //是否自动聚焦(默认聚焦)
- isopen: false, //(默认不展开)
- isToShow: false, //默认
- adjustPosition: false, //默认
- placeholder: "说点什么呗~",
- //
- current: 1, //当前切换的位置
- emojilist: [], //表情数组
- nowTimeEmojiList: [], //最近输入的表情
- sinaEmojilist: [], //新浪微博表情
- currentNum: 4.4, //默认
- likeImage: [], //默认
- nowImage: [], //默认
- gifAndpngList: [], //默认
- gifAndpnglist: [], //默认
- searchGIFValue: "", //默认
- isSearcopen: false, //默认
- GifList: [], //默认
- isShowImage: false, //默认
- imageURL: "", //默认
- platform: "", //默认
- systemVerson: "", //系统版本
- ischangepinlun: true, //默认显示全面屏手机评论样式
- // ----- end ----- 评论输入框部分
- // ----- start ----- 评论内容部分
- pinlunList: [], //用于在界面展示的 评论数组
- pinlunListX: [], //这个是用来存储原始评论数据的数组
- pinlun_list: [], //用于存储界面 评论数组 的副本
- isSend: true, //默认
- userID: "", //当前用户的 ID
- videouserID: "", //当前视频作者的 ID
- update: true, //用于刷新视图
- huifuUser: "", //回复信息的人的名字
- gethuifuUser: "", //被回复的人(也就是接收者的名字)
- gethuifuUserID: "", //被回复的人的 ID
- istohuifu: false, //是否是去回复(默认不是)
- huifuindex: -1, //回复信息所在下标
- iszhangkai: false, //默认不展开评论
- imgHost: HTTP_REQUEST_URL,
- // ----- end ----- 评论内容部分
- limit: 10,
- page: 1,
- pages: 1,
- parentNum: 0
- };
- },
- watch: {
- // 监听 输入表情值 并搜索 GIF 表情
- searchGIFValue(val) {
- this.isopen = false;
- if (val !== '') {
- var sms = []
- for (let i = 0; i < this.gifAndpngList.length; i++) {
- if (this.gifAndpngList[i].name.indexOf(val) !== -1) {
- sms.push(this.gifAndpngList[i]);
- }
- }
- this.GifList = sms;
- }
- },
- // 监听 输入框输入数据
- value(val) {
- if (val == "") {
- this.autoHeight = false
- if (this.imageURL !== '') {
- this.percent = 0.9
- } else {
- this.percent = 1
- }
- } else {
- this.autoHeight = true
- this.percent = 0.9
- }
- },
- // 监听 GIF图片(用户选择一个 GIF 图片以后这个值就会被赋值)
- imageURL(val) {
- if (val !== '') {
- this.percent = 0.9
- } else {
- if (this.value == '') {
- this.percent = 1
- }
- }
- },
- // 监听 输入框 高度变化
- lineheight(newVal, oldVal) {
- if (Math.abs(newVal) < 30) {
- this.borderRadius = 100
- } else {
- this.borderRadius = 30
- }
- }
- },
- /*
- 打开组件之后开始执行下面方法
- */
- created() {
- // 1.isToShow 用于输入框显示(默认不改)
- this.isToShow = false;
- // 2.判断当前设备信息
- var model = uni.getSystemInfoSync().model;
- // 3.判断当前设备信息
- this.platform = uni.getSystemInfoSync().platform;
- // 3.1 获取系统版本
- var systemVerson = uni.getSystemInfoSync().system
- if (systemVerson.split(' ')[0] == "Android") {
- if (systemVerson.split(' ')[1] < 9) {
- // 低端安卓机
- this.ischangepinlun = false //小于安卓 8
- this.windowHeight = uni.getSystemInfoSync().screenHeight;
- this.emojiHeight = this.windowHeight / 2.1 - this.deleteAndroidHeight;
- } else {
- // 全面屏安卓机
- this.ischangepinlun = true //全面屏
- this.windowHeight = uni.getSystemInfoSync().screenHeight;
- this.emojiHeight = this.windowHeight / 2.6 - this.deleteAndroidHeight;
- }
- } else {
- if (uni.getSystemInfoSync().platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !==
- 'iPhone7' || model !== 'iPhone8')) {
- // 全面屏iPhone
- this.ischangepinlun = true //全面屏
- this.windowHeight = uni.getSystemInfoSync().screenHeight;
- this.emojiHeight = this.windowHeight / 2.2 - this.deleteIOSHeight;
- } else {
- // 非全面屏iPhone
- this.ischangepinlun = false
- this.windowHeight = uni.getSystemInfoSync().screenHeight;
- this.emojiHeight = this.windowHeight / 2.1 - this.deleteIOSHeight;
- }
- }
- // 4.获取当前 视频 ID
- this.videoID = uni.getStorageSync("videoID");
- //4.1获取当前 视频 数量
- this.pinlunNum = uni.getStorageSync("pinlunNum");
- // 5.获取当前 用户 ID
- this.userID = uni.getStorageSync("user")._id;
- // 6.获取评论信息
- this.getnewpinlun();
- // 7.根据设备信息,处理评论区域高度
- if (uni.getSystemInfoSync().platform == 'ios' && (model !== 'iPhone6' || model !== 'iPhone6s' || model !==
- 'iPhone7' || model !== 'iPhone8')) {
- this.num = 1.25
- } else {
- this.num = 1.15
- }
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.adjustPosition = true
- } else {
- this.adjustPosition = false
- }
- this.plHeight = this.Height - (this.Height / this.num);
- console.log(this.plHeight);
- // 8.聚焦输入
- this.focus();
- // 9.判断是否有 GIF 图片
- if (this.imageURL !== '') {
- this.percent = 0.9
- }
- // 10.把之前准备好的 emoji 表情赋值给 数组,用于展示
- // this.emojilist = emojiList
- // this.sinaEmojilist = sinaEmojiList
- // 11.看看有没有喜欢的 GIF,有的话赋值
- this.likeImage = uni.getStorageSync("likeImage");
- // 11.看看有没有当前的 GIF,有的话赋值
- this.nowImage = uni.getStorageSync("nowImage");
- // 11.看看有没有当前的 emoji ,有的话赋值
- this.nowTimeEmojiList = uni.getStorageSync("nowTimeEmojiList");
- // 12.请求 GIF 表情库(这里的表情库都存在 json 文件里面了)
- /*
- 1.资源来源
-
- GitHub:https://github.com/zhaoolee/ChineseBQB
- Gitee:https://gitee.com/mirrors/ChineseBQB
-
- 这两个库 数据都是同步的,可以去参考,国内的话可以用 gitee 访问下载,如何丢到服务器里面
-
- */
- // uni.request({
- // url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-bdb24c6d-8c19-4f80-8e7e-c9c9f037f131/bf6f0d2e-e065-4685-a104-218c42add104.json',
- // success: (res) => {
- // var gifAndpngList = res.data.data
- // var sms = []
- // for(let i=0;i<gifAndpngList.length;i++){
- // /*
- // 它的资源很多,这里只获取 gif 部分
- // */
- // if(gifAndpngList[i].name.indexOf("gif") !== -1){
- // sms.push(gifAndpngList[i])
- // }
- // }
- // this.gifAndpngList = sms
- // }
- // })
- },
- methods: {
- /*
-
- ---- 第一段,这里面含有 http 后台真实请求,以及返回处理的操作以及数据
-
- 【🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟】
-
- ---- start ----
-
- */
- getnewpinlun() {
- // 这里是对评论信息做处理
- commentList(this.videoID, {
- limit: 10,
- page: this.pages
- }).then(res => {
- this.pages = this.pages + 1
- this.pinlunList = this.pinlunList.concat(res.data);
- }).catch(err => {
- return uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- });
- })
- },
- sendSMS() {
- this.isSend = false;
- uni.showLoading({
- title: '正在发送...'
- })
- let pid = this.parentNum ? 0 : this.pinlunList[this.huifuindex].id;
- let data = {
- id: this.videoID,
- pid: pid,
- content: this.value
- }
- markeComment(data).then(res => {
- uni.hideLoading();
- this.pinlunNum = this.pinlunNum + 1;
- this.$emit('pinlunFun', this.pinlunNum)
- this.value = "";
- this.imageURL = "";
- this.$refs.openPinglun.close();
- this.isSend = true;
- this.pages = 1;
- this.pinlunList = [];
- this.getnewpinlun();
- }).catch(err => {
- return uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- });
- });
- },
- loadmore() {
- this.getnewpinlun();
- },
- scrolls() {},
- tolike(item, index) {
- // 处理评论
- replyCommentLike('like', item.id).then(res => {
- this.pinlunList[index].is_like = !this.pinlunList[index].is_like
- const video = this.pinlunList[index];
- item.is_like ? video.like_num += 1 : video.like_num -= 1;
- }).catch(err => {
- return uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- });
- })
- },
- tosonlike(index, inde, item) {
- replyCommentLike('like', item.id).then(res => {
- this.pinlunList[index].reply[inde].is_like = !this.pinlunList[index].reply[inde].is_like
- const video = this.pinlunList[index].reply[inde];
- item.is_like ? video.like_num += 1 : video.like_num -= 1;
- }).catch(err => {
- return uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- });
- })
- },
- zhangkai(index, item) {
- // 1.点击展开评论,一开始是不展开的(如果点击展开,就把 评论的副本的子评论赋值给当前页面页面评论,这样当前页面就可以显示子评论了)
- if (item.isShow == undefined || item.isShow == 'undefined') {
- this.page = 1;
- }
- replyCommentList(item.id, {
- limit: this.limit,
- page: this.page
- }).then(res => {
- this.page = this.page + 1;
- item.reply = item.reply.concat(res.data);
- if (item.reply.length) {
- item.isShow = true;
- }
- this.$set(this, 'pinlunList', this.pinlunList);
- }).catch(err => {
- return uni.showToast({
- title: err,
- icon: 'none',
- duration: 2000
- });
- })
- },
- shouqi(item) {
- this.page = 1
- item.reply = [];
- item.isShow = false;
- this.$set(this, 'pinlunList', this.pinlunList);
- },
- deletesonpinlun(index, inde) {},
- // deletepinlun(index){
- // // 删除 评论(子评论也将被删除)
- // uni.showModal({
- // title: '确定删除?',
- // content: '删除后子评论将被删除',
- // success: (re) => {
- // if(re.confirm){
- // uni.showLoading({
- // title: "正在删除"
- // })
- // var sms = []
- // for(let i=0;i<this.pinlunListX.length;i++){
- // if(i !== ((this.pinlunListX.length-1)-index)){
- // sms.push(this.pinlunListX[i]);
- // }
- // }
- // // console.log(this.pinlunListX)
- // uni.request({
- // url: 'https://bdb24c6d-8c19-4f80-8e7e-c9c9f037f131.bspapp.com/video',
- // method: 'POST',
- // data:{
- // info: 'add_pinlun',
- // _id: this.videoID,
- // pinlun: sms
- // },
- // success: (resx) => {
- // uni.hideLoading();
- // this.getnewpinlun();
- // }
- // })
- // }
- // }
- // })
- // },
- addlikeImage() {
- uni.showModal({
- title: '⏰演示项目提醒⏰',
- content: '请前往 douyin-scrollview.nvue组件\naddlikeImage()函数进行配置',
- success: () => {}
- })
- },
- /*
- 【🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟🌟】
-
- ----- end -----
- */
- sonhuifu(index, inde) {
- // 1.子评论回复
- /*
- (1)先处理回复人信息
- (2)处理被回复人信息
- (3)改变 “发送” 状态
- (4)打开评论框
- */
- this.huifuUser = uni.getStorageSync("user").username;
- this.gethuifuUser = this.pinlunList[index].sonPinlun[inde].username;
- this.gethuifuUserID = this.pinlunList[index].sonPinlun[inde].userID;
- this.istohuifu = true;
- this.placeholder = "回复:" + this.gethuifuUser;
- this.huifuindex = index;
- this.openPinglun();
- },
- huifu(index) {
- // 1.评论回复
- /*
- (1)先处理回复人信息
- (2)处理被回复人信息
- (3)改变 “发送” 状态
- (4)打开评论框
- */
- this.parentNum = 0;
- this.placeholder = "回复:" + this.pinlunList[index].nickname;
- this.huifuindex = index;
- this.openPinglun();
- },
- clicknowImage(index) {
- // 点击 GIF 图片信息
- this.imageURL = this.nowImage[index];
- this.isShowImage = true;
- },
- selectGIF(index) {
- // 选择 GIF 图片
- /*
- (1)获取 GIF 链接
- (2)清理搜索的 GIF 输入框信息
- (3)缓存 GIF 图片信息
- */
- this.imageURL = this.GifList[index].url;
- this.isShowImage = true;
- this.searchGIFValue = ""
- this.$refs.searchEmoji.close();
- if (uni.getStorageSync("nowImage").length == 0) {
- this.nowImage = []
- this.nowImage.push(this.imageURL)
- uni.setStorageSync("nowImage", this.nowImage);
- } else {
- this.nowImage = uni.getStorageSync("nowImage");
- let isTrue = true;
- for (let i = 0; i < this.nowImage.length; i++) {
- if (this.imageURL == this.nowImage[i]) {
- isTrue = false;
- }
- }
- if (isTrue) {
- this.nowImage.push(this.imageURL)
- }
- uni.setStorageSync("nowImage", this.nowImage);
- }
- },
- deleteimageURL() {
- // 清理 GIF 图片
- this.imageURL = "";
- this.isShowImage = false;
- },
- clickGIF(index) {
- // 在选择 GIF 列表,点击 GIF 图片,选择图片
- /*
- (1)获取 GIF 链接
- (2)清理搜索的 GIF 输入框信息
- (3)缓存 GIF 图片信息
- */
- this.imageURL = this.gifAndpnglist[index].url;
- this.isShowImage = true;
- if (uni.getStorageSync("nowImage").length == 0) {
- this.nowImage = []
- this.nowImage.push(this.imageURL)
- uni.setStorageSync("nowImage", this.nowImage);
- } else {
- this.nowImage = uni.getStorageSync("nowImage");
- let isTrue = true;
- for (let i = 0; i < this.nowImage.length; i++) {
- if (this.imageURL == this.nowImage[i]) {
- isTrue = false;
- }
- }
- if (isTrue) {
- this.nowImage.push(this.imageURL)
- }
- uni.setStorageSync("nowImage", this.nowImage);
- }
- },
- clearSearchValue() {
- // 点击搜索 GIF 的小叉叉,清理输入的值
- this.searchGIFValue = ""
- },
- blurGIF() {
- // 搜索 GIF 图片失去聚焦时
- // 关闭 GIF 输入框
- if (this.searchGIFValue == '') {
- this.$refs.searchEmoji.close();
- }
- },
- searchGIF() {
- // 点击搜索 GIF 图片
- // 打开输入框
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.$refs.searchEmoji.open('bottom');
- } else {
- setTimeout(() => {
- this.$refs.searchEmoji.open('bottom');
- }, 500)
- }
- },
- deletenowImage(index) {
- // 删除当前图片
- var sms = []
- for (let i = 0; i < this.nowImage.length; i++) {
- if (this.nowImage[i] !== this.nowImage[index]) {
- sms.push(this.nowImage[i])
- }
- }
- this.nowImage = sms;
- uni.setStorageSync("nowImage", this.nowImage);
- },
- clickLikeImage(index) {
- // 点击喜欢的图片之后
- /*
- (1)获取图片信息
- (2)缓存图片 在本地
- */
- if (uni.getStorageSync("nowImage").length == 0) {
- this.nowImage = []
- this.nowImage.push(this.likeImage[index])
- uni.setStorageSync("nowImage", this.nowImage);
- } else {
- this.nowImage = uni.getStorageSync("nowImage");
- let isTrue = true;
- for (let i = 0; i < this.nowImage.length; i++) {
- if (this.likeImage[index] == this.nowImage[i]) {
- isTrue = false;
- }
- }
- if (isTrue) {
- this.nowImage.push(this.likeImage[index])
- }
- uni.setStorageSync("nowImage", this.nowImage);
- }
- },
- deleteImage(index) {
- // 删除 图片
- /*
- (1)更新当前 GIF 图片列表
- (2)同时去看看 最近使用图片里面有没有当前要删除的图片,
- 如果有的话就一同删除掉
- */
- uni.showModal({
- title: '确定删除?',
- success: (re) => {
- if (re.confirm) {
- uni.removeSavedFile({
- filePath: this.likeImage[index],
- success: () => {
- var sms = []
- for (let i = 0; i < this.likeImage.length; i++) {
- if (this.likeImage[i] !== this.likeImage[index]) {
- sms.push(this.likeImage[i])
- }
- }
- var smh = []
- for (let i = 0; i < this.nowImage.length; i++) {
- if (this.nowImage[i] !== this.likeImage[index]) {
- smh.push(this.nowImage[i])
- }
- }
- this.nowImage = smh;
- uni.setStorageSync("nowImage", this.nowImage);
- this.likeImage = sms;
- uni.setStorageSync("likeImage", this.likeImage);
- }
- });
- }
- }
- })
- },
- qingkonGIF() {
- // 清空当前 GIF 图片
- uni.showModal({
- title: '确定清空?',
- success: (re) => {
- if (re.confirm) {
- this.nowImage = []
- uni.removeStorageSync("nowImage");
- }
- }
- })
- },
- searchGIFChange(e) {
- },
- change(e) {
- // 输入框开关变化
- /*
- (1)如果打开输入框(show == true)
- - 此时请求 GIF 列表图片信息
- (2)如果关闭输入框
- - 恢复默认设置
- */
- this.isToShow = false;
- if (e.show == true) {
- this.show = false;
- this.getGif();
- } else {
- uni.hideKeyboard();
- this.show = true
- this.autoFocus = true;
- this.isopen = false;
- this.current = 1;
- this.currentNum = 4.4;
- this.isShowImage = false;
- this.cursorSpacing = 20;
- this.placeholder = "说点什么呗~";
- this.istohuifu = false;
- }
- },
- /*
-
- 以下方法都是输入框 状态变化,以及逻辑切换等信息
-
- 虽然不起眼但是很重要 【🌟🌟🌟🌟🌟】
-
- (如果是要复制的话都是要复制的)
-
- */
- // ------- start -------
- clickTextarea() {
- this.isopen = false;
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.autoFocus = false;
- setTimeout(() => {
- this.autoFocus = true;
- }, 200)
- }
- },
- closeSheet() {
- this.$emit('closeScrollview');
- },
- movehandle() {},
- movesearch() {},
- parentPinglun() {
- this.parentNum = 1;
- this.openPinglun();
- },
- openPinglun() {
- this.$refs.openPinglun.open('bottom')
- },
- linechange(event) {
- this.lineheight = event.detail.height
- },
- keyboardheightchange() {},
- blur() {
- uni.hideKeyboard();
- },
- focus() {
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.autoFocus = false;
- this.isopen = true;
- }
- setTimeout(() => {
- this.autoFocus = true;
- this.isopen = false;
- setTimeout(() => {
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.isToShow = true;
- }
- if (this.imageURL !== '') {
- this.isShowImage = true;
- }
- }, 1500)
- }, 20)
- },
- toemoji() {
- if (this.isopen == false) {
- this.isopen = true;
- setTimeout(() => {
- this.isToShow = true;
- }, 500)
- uni.hideKeyboard();
- } else {
- if (uni.getSystemInfoSync().platform == 'ios') {
- this.isShowImage = false;
- } else {
- this.isToShow = false;
- }
- this.isopen = false;
- this.autoFocus = false;
- setTimeout(() => {
- this.autoFocus = true;
- if (this.imageURL !== '') {
- setTimeout(() => {
- this.isShowImage = true;
- }, 1300)
- }
- }, 20)
- }
- },
- undo() {
- if (this.value !== "") {
- var str = ""
- for (let i = 0; i < this.value.length - 1; i++) {
- str += this.value[i]
- }
- this.value = str;
- }
- },
- timeEmoji() {
- this.currentNum = 1
- this.current = 0
- },
- nowEmoji() {
- this.currentNum = 4.3
- this.current = 1
- },
- likeEmoji() {
- this.currentNum = 7.6
- this.current = 2
- },
- gifEmoji() {
- this.currentNum = 11.0
- this.current = 3
- },
- qingkon() {
- uni.showModal({
- title: '确定清空?',
- success: (re) => {
- if (re.confirm) {
- this.nowTimeEmojiList = []
- uni.removeStorageSync("nowTimeEmojiList");
- }
- }
- })
- },
- clicknowTimeEmoji(index) {
- var str = this.nowTimeEmojiList[index].alt;
- this.value += str;
- },
- clickEmoji(index) {
- // console.log(this.emojilist[index])
- var str = this.emojilist[index].alt;
- this.value += str;
- if (uni.getStorageSync("nowTimeEmojiList").length == 0) {
- this.nowTimeEmojiList = []
- this.nowTimeEmojiList.push(this.emojilist[index])
- uni.setStorageSync("nowTimeEmojiList", this.nowTimeEmojiList);
- } else {
- this.nowTimeEmojiList = uni.getStorageSync("nowTimeEmojiList");
- let isTrue = true;
- for (let i = 0; i < this.nowTimeEmojiList.length; i++) {
- if (this.emojilist[index].alt == this.nowTimeEmojiList[i].alt) {
- isTrue = false;
- }
- }
- if (isTrue) {
- this.nowTimeEmojiList.push(this.emojilist[index])
- }
- uni.setStorageSync("nowTimeEmojiList", this.nowTimeEmojiList);
- }
- },
- clicksinaEmoji(index) {
- console.log(this.sinaEmojilist[index])
- },
- currentChange(e) {
- var num = e.detail.current + 1
- switch (num) {
- case 1:
- this.currentNum = 1
- break;
- case 2:
- this.currentNum = 4.3
- break;
- case 3:
- this.currentNum = 7.6
- break;
- case 4:
- this.currentNum = 11.0
- break;
- default:
- break;
- }
- },
- getGif() {
- var list = []
- for (let i = 0; i < 15; i++) {
- var num = Math.round(Math.random() * this.gifAndpngList.length);
- list.push(this.gifAndpngList[num]);
- }
- this.gifAndpnglist = list
- },
- scrolltolowerGIF() {
- for (let i = 0; i < 15; i++) {
- var num = Math.round(Math.random() * this.gifAndpngList.length);
- this.gifAndpnglist.push(this.gifAndpngList[num]);
- }
- }
- // ------- end -------
- }
- }
- </script>
- <style lang="scss">
- .vip {
- width: 56rpx;
- height: 20rpx;
- margin-top: 5rpx;
- margin-left: 16rpx;
- }
- .closeBnt {
- position: absolute;
- right: 30rpx;
- margin-top: 34rpx;
- width: 30rpx;
- height: 30rpx;
- }
- .numberComment {
- font-size: 26rpx;
- font-weight: 500;
- text-align: center;
- color: #333;
- margin-top: 34rpx;
- }
- .pictrue {
- width: 60rpx;
- height: 60rpx;
- border: 1px solid #fff;
- border-radius: 50rpx;
- margin-top: 20px;
- margin-left: 15px;
- }
- .name {
- font-size: 24rpx;
- font-weight: 500;
- color: #666;
- }
- .time {
- font-size: 12px;
- font-weight: 400;
- color: #999999;
- margin-left: 10px;
- margin-top: 2rpx;
- }
- .like {
- color: #999;
- position: absolute;
- right: 45rpx;
- margin-left: 5rpx;
- width: 26rpx;
- height: 26rpx;
- }
- .likeNum {
- font-size: 22rpx;
- color: #a3a1a4;
- position: absolute;
- right: 22rpx;
- margin-top: 2rpx;
- }
- .childrenPic {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- margin-top: 20px;
- }
- .childrenName {
- font-size: 24rpx;
- font-weight: 500;
- color: #666;
- }
- .childrenLike {
- color: #999;
- position: absolute;
- right: 20rpx;
- width: 27rpx;
- height: 27rpx;
- }
- .childrenLikeNum {
- font-size: 22rpx;
- color: #a3a1a4;
- position: absolute;
- right: 0rpx;
- margin-top: 2rpx;
- }
- </style>
|