12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260 |
- <template>
- <view>
- <view style="color: #000;">
- <tn-nav-bar backgroundColor="#fff">{{ zhuangtai }}
- <!-- <view slot="right" class='tn-custom-nav-bar__back' @click="goBack"> -->
- <!-- #ifdef H5 -->
- <!-- <text class='tn-icon tn-icon-align' style="font-size: 42rpx;margin-right: 22rpx;"></text> -->
- <!-- #endif -->
- <!-- #ifdef MP-WEIXIN -->
- <!-- <text class='tn-icon tn-icon-align' style="font-size: 42rpx;font-weight: bold;color: #26b3a0d6;"></text> -->
- <!-- #endif -->
- <!-- </view> -->
- </tn-nav-bar>
- <view :style="{ height: tobheight + 'px' }"></view>
- </view>
- <view class="content" @touchmove="touchmove">
- <view class="msg-list">
- <view class="row">
- <block>
- <view class="other">
- <view class="left" v-if="appInfo.is_show_gpt_avatar_nickname == 1"
- @click="switchmodel = true">
- <u-image :src="
- homeTemplate.mode && homeTemplate.mode[0].img_file != null &&homeTemplate.mode[0].img_file.path
- ? homeTemplate.mode[0].img_file.path
- : '/static/images/open.png'
- " mode="aspectFill" radius="5" width="40" height="40"></u-image>
- </view>
- <view class="right">
- <view class="username">
- <view class="name"></view>
- <view class="time">{{ homeTemplate.mode && homeTemplate.mode.length>0&& homeTemplate.mode[0].img_file != null && homeTemplate.mode[0].name
- ?homeTemplate.mode[0].name :'ai问答机器人' }}</view>
- </view>
- <view class="bubble">
- <view class="content mytheme">
- <view style="font-size: 32rpx;">您可以点击下方示例直接提问......</view>
- <block v-for="(item, index) in homeTemplate.hot" :key="index">
- <view class="ask" @click="send(item.text)">{{ item.text }}</view>
- </block>
- <view @click="commontemplate" class="tn-flex align-center"
- style="justify-content: flex-end;margin-top: 15rpx;margin-bottom: 15rpx;">
- <view style="color: #9e9e9e;margin-right: 10rpx;">换一换</view>
- <u-icon name="reload" color="#9e9e9e" size="18"></u-icon>
- </view>
- <u-button size="small" @click="switchmodel = true" type="primary"
- text="切换角色"></u-button>
- </view>
- </view>
- </view>
- </view>
- </block>
- </view>
- <block v-for="(row, index) in talkList" :key="index" :id="'msg' + row.id">
- <view class="row">
- <block>
- <view class="my" v-if="row.fromid == userInfo.id">
- <view class="left">
- <view class="username">
- <view class="name">{{ row.nickname }}</view>
- </view>
- <view class="u-flex u-flex-nowrap justify-between" style="align-items: center;">
- <!-- v-if="row.content !='该问题已被隐藏!'" -->
- <view class="mycopy u-flex justify-center align-center">
- <u-icon @click="copyText(index)"
- name="file-text" top="1" color="#fff" size="18"></u-icon>
- </view>
-
- <view v-if="row.type == 1" class="bubble mytheme" style="color: #fff;">
- <!-- <rich-text :nodes="row.content" @longtap="copy" :data-text="row.content"
- selectable="true"></rich-text> -->
- <!-- <zero-markdown-view :themeColor="themeColor"
- :markdown="row.content"></zero-markdown-view> -->
- <u-parse :content="row.content" scrollTable :tag-style="parse_style" selectable style="width: 100%;"></u-parse>
- <!-- <mp-html :content="row.content" /> -->
- </view>
- </view>
- </view>
-
- <view class="right">
- <u-image :src="row.avatar ? row.avatar : '/static/images/head.jpg'" mode="aspectFill"
- radius="5" width="42" height="42"></u-image>
- </view>
- </view>
- <!-- GPT -->
- <view class="other" v-if="row.fromid != userInfo.id">
- <view class="left" v-if="appInfo.is_show_gpt_avatar_nickname == 1"
- @click="switchmodel = true">
- <u-image :src="row.avatar" mode="aspectFill" radius="5" width="42"
- height="42"></u-image>
- </view>
- <view class="right">
- <view class="username" v-if="appInfo.is_show_gpt_avatar_nickname == 1">
- <view class="name"></view>
- <view class="time">{{ row.nickname }}</view>
- </view>
- <view v-if="row.type == 1" class="bubble"
- style="display: block;position: relative;">
- <view class="mytheme">
- <!-- <zero-markdown-view
- v-if="(row.done && row.content.indexOf('```') != -1) || (row.done && row.content.indexOf('/*') != -1 || row.content.indexOf('---') != -1)"
- :themeColor="themeColor" :markdown="row.content"></zero-markdown-view>
- <text v-else @longtap="copy"
- :data-text="row.content">{{ row.content.replace(/^\s+|\s+$/g, '') }}</text>
- <text v-if="row.content == '正在思考中...'">{{ second }}s</text>
- <text class="flash" v-if="row.show_flash">│</text> -->
- <view class="u-flex align-center flex-wrap">
- <text
- v-if="row.content == '正在思考中...'||row.content == '请等我几秒钟,正在输入回答...'">{{row.content}}</text>
- <!-- <zero-markdown-view v-else :themeColor="themeColor"
- :markdown="row.content"></zero-markdown-view> -->
- <u-parse v-else :content="row.content" :tag-style="parse_style" scrollTable selectable style="width: 100%;"></u-parse>
- <!-- <mp-html v-else :content="row.content" /> -->
- <text v-if="row.content == '正在思考中...'">{{ second }}s</text>
- <view
- :style="{marginLeft: row.content == '正在思考中...'||row.content == '请等我几秒钟,正在输入回答...'?20+'rpx':0+'rpx',marginTop: row.content != '正在思考中...'||row.content != '请等我几秒钟,正在输入回答...'?10+'rpx':0+'rpx'}"
- v-if="row.show_flash">
- <view style="margin-top: -5rpx;">
- <u-loading-icon size="17" mode="circle" color="#00ca88" :duration="300"></u-loading-icon>
- </view>
-
- </view>
- </view>
-
- </view>
- <view v-if="row.done && !row.donec" class="tn-flex align-center justify-between operate">
- <view @click="send(talkList[index-1].content)" hover-class="hoversubmit"
- class="tn-flex justify-center align-center dialogue" style="margin-right: 10px;">
- <u-icon name="reload" top="1" color="#fff" size="18"></u-icon>
- <!-- <view class="duplicate">复制回答</view> -->
- </view>
- <view class="tn-flex align-center">
- <view @click="copyText(index)" hover-class="hoversubmit"
- class="tn-flex justify-center align-center dialogue">
- <u-icon name="file-text" top="1" color="#fff" size="18"></u-icon>
- <!-- <view class="duplicate">复制回答</view> -->
- </view>
-
- <view @click="createPoster(index)" hover-class="hoversubmit"
- class="tn-flex justify-center align-center dialogue" style="margin-left: 10px;">
- <u-icon name="share-square" top="1" color="#fff" size="18"></u-icon>
- <!-- <view class="share">分享对话</view> -->
- </view>
-
- <view v-if="appInfo.is_vop&&appInfo.is_vop == 1" class="eliseaudio">
- <elise-audio @aittsjob="aittsjob" :audioId="'audioId'+index"
- :url="row.audiolink" audioColor="#68d7bb" :durationS="5"
- :content="row.backups" :index="index" :cancel="cancel"></elise-audio>
- </view>
- </view>
-
- </view>
- </view>
- <!-- <view v-if="row.type == 2" class="bubble"
- style="display: block;position: relative;">
- <view class="u-flex align-center">
- <text style="margin-right: 20rpx;">{{row.content}}</text>
- <u-loading-icon size="17"></u-loading-icon>
- </view>
- </view> -->
- <!-- <view v-if="row.type == 3" class="bubbleimg">
- <image @click="preview(index)" :src="row.img" mode="aspectFill"></image>
- </view> -->
-
- </view>
- </view>
- </block>
- </view>
- </block>
- </view>
- <view class="bottomheight"></view>
- <view class="env"></view>
- </view>
- <view class="box-2">
- <view class="flex_col">
- <view class="flex_grow">
- <!-- height="45" -->
- <u--textarea height="45" @blur="blurinput" @focus="focusinput" fixed :showConfirmBar="false"
- v-model="content" :placeholder="'请输入您的问题...'"
- :maxlength="-1" border="none" :cursorSpacing="80"></u--textarea>
- </view>
- <!-- <u-icon name="close-circle-fill" color="#ededed"
- size="20"></u-icon> -->
- <u-icon v-if="appInfo.is_vop&&appInfo.is_vop == 1" @click="openmicrophone" name="mic" color="#ff9800"
- size="30"></u-icon>
- <button class="send"
- @click.prevent="send(content)">{{'发送'}}</button>
- </view>
- </view>
- <u-popup :show="showexpand" zIndex="1" mode="bottom" bgColor="transparent" :overlay="false"
- @close="showexpand = false">
- <scroll-view class="scroll-view_H" scroll-x="true">
- <view class="expand u-flex">
- <view @click="showsheet = true" class="surplus u-flex align-center">
- <u-icon name="grid-fill" color="#26b3a0d6" size="18" top="1"></u-icon>
- <!-- <view class="item">
- {{currentmodel}}{{userData.is_validity>0&&!this.showchat4&&userData.vip_info&&userData.vip_info.gpt35_times>0?' - 今日限量:'+userData.vip_info.gpt35_used+'/'+userData.vip_info.gpt35_times:''}}
- </view> -->
- <view v-if="showchat4" class="item">{{currentmodel}}{{userData.vip_info&&userData.is_validity>0?(userData.vip_info.gpt4_type == 'time'?' - 今日':' - 会员')+'剩余提问:'+(userData.vip_info.gpt4_times == -1?'无限量':userData.vip_info.gpt4_times-userData.vip_info.gpt4_used+'次'):''}} ></view>
- <view v-else class="item">{{currentmodel}}{{userData.vip_info&&userData.is_validity>0?(userData.vip_info.gpt35_type == 'time'?' - 今日':' - 会员')+'剩余提问:'+(userData.vip_info.gpt35_times == -1?'无限量':userData.vip_info.gpt35_times-userData.vip_info.gpt35_used+'次'):''}} ></view>
- </view>
- <!-- <block v-if="!showchat4"> -->
- <navigator @click="getroute"
- :url="isLogin ?'/pages/user/member/member?id=2':'/pages/user/signin'"
- class="surplus u-flex align-center"
- v-if="appInfo.time_member && appInfo.time_member == 1">
- <u-icon name="clock-fill" color="#607d8b" size="18" top="1"></u-icon>
- <view class="item">
- 会员套餐:{{ userData.is_validity == 1 ? (userData.vip_time == 9999?'永久':userData.countdown+'天') : '0天' }}
- </view>
- </navigator>
- <!-- </block> -->
- <block v-if="appInfo.number_member">
- <navigator @click="getroute"
- :url="isLogin ?'/pages/user/member/member?id=1':'/pages/user/signin'"
- class="surplus u-flex align-center" v-if="appInfo.number_member == 1">
- <u-icon name="question-circle-fill" color="#ff9800" size="18" top="1"></u-icon>
- <view class="item">
- {{appInfo.number_alias?appInfo.number_alias+':':'点数:'}}{{ userData.coin ? userData.coin : 0 }}
- </view>
- </navigator>
- </block>
- <block v-else>
- <navigator @click="getroute"
- :url="isLogin ?'/pages/user/member/member?id=1':'/pages/user/signin'"
- class="surplus u-flex align-center">
- <u-icon name="question-circle-fill" color="#ff9800" size="18" top="1"></u-icon>
- <view class="item">
- {{appInfo.number_alias?appInfo.number_alias+':':'点数:'}}{{ userData.coin ? userData.coin : 0 }}
- </view>
- </navigator>
- </block>
-
- <!-- <view class="surplus">分享好友赚佣金</view> -->
- <navigator @click="getroute" :url="isLogin ?'/pages/user/member/member?id=3':'/pages/user/signin'"
- class="surplus u-flex align-center">
- <u-icon name="more-circle-fill" color="#2979ff" size="18" top="1"></u-icon>
- <view class="item">免费领{{appInfo.number_alias?appInfo.number_alias:'点数'}}</view>
- </navigator>
- <view class="surplus u-flex align-center" style="background: #fff0;padding: 1rpx;">
- </view>
- </view>
- </scroll-view>
- </u-popup>
- <!-- <wike-skeleton count="4" type="user" v-if="homeTemplate.length === 0"></wike-skeleton> -->
- <u-no-network></u-no-network>
- <!-- <navigator v-if="is_commission == 1" class="neckBtn_view" url="/pages/user/commission/index">
- <text class="free_view">分享</text>
- 赚佣金
- </navigator> -->
- <u-action-sheet @select="selectClick" :round="10" :actions="sheetlist" :title="titlesheet" :show="showsheet"
- safeAreaInsetBottom @close="showsheet = false" cancelText="关闭"></u-action-sheet>
- <!-- <u-popup :show="showPoster" mode="bottom" :round="10" safeAreaInsetTop @close="showPoster = false">
- <view class="poster">
- <wike-painter :board="posterObj" @success="posterSuccess" ref="painter"></wike-painter>
- <view class="footer-btn">
- <view class="" @click="showPoster = false">退出</view>
- <view class="save" @click="toSave">保存/分享</view>
- </view>
- </view>
- </u-popup> -->
- <u-popup :show="showPoster" mode="bottom" @close="showPoster = false">
- <scroll-view scroll-y="true" :style="{maxHeight: (posterheight) +'px'}">
- <wike-painter :board="posterObj" @done="posterSuccess" ref="painter"></wike-painter>
- <view style="height: 78px;"></view>
- <view class="dygbhg" >
- <view class="whole" @click="showPoster = false">取消</view>
- <view class="distinguish" @click="toSave">保存/分享</view>
- </view>
- </scroll-view>
- </u-popup>
- <u-popup :show="soundrecording" mode="bottom" :round="20" safeAreaInsetTop @close="soundrecording = false">
- <view class="soundrecording u-flex justify-center">
- <view v-if="showlongpress" class="waveform">
- <image :src="'https://s1.voicecloud.cn/activity/imeVoiceShare/img/yuyin.gif'" mode="aspectFill">
- </image>
- </view>
- <view class="operation u-flex">
- <!-- <view class="affirm">
- <image src="/static/tf-speech-recognizer/cancel.png"></image>
- </view> -->
- <view @touchstart="startrecording" @touchend="stoprecording" class="longpress"
- hover-class="hoversubmit">
- <!-- <image disabled src="/static/tf-speech-recognizer/recording.png"></image> -->
- <u-icon name="mic" color="#fff" size="35"></u-icon>
- </view>
- <!-- <view class="affirm">
- <image src="/static/tf-speech-recognizer/confirm.png"></image>
- </view> -->
- </view>
- <view class="discriminate">长按识别语音</view>
- </view>
- </u-popup>
- <wike-loading-page :isLoading="isLoading"></wike-loading-page>
- <!-- 生成的图片 -->
- <u-popup type="center" mode="center">
- <view class="poster-img">
- <text @click="closePopup"></text>
- <!-- <image :src="path" mode="" @click="previewImg"></image> -->
- <!-- #ifdef H5 -->
- <view class="">长按图片保存到手机</view>
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view class="">点击图片保存到手机</view>
- <!-- #endif -->
- </view>
- </u-popup>
- <u-popup :show="switchmodel" @close="switchmodel = false" :round="15" closeable>
- <view class="select u-flex justify-center"><text>选择角色</text></view>
- <scroll-view scroll-y="true"
- :style="{ height: homeTemplate.mode&&homeTemplate.mode.length > 6 ? 700 + 'rpx' : 'auto' }">
- <block v-for="(item, index) in homeTemplate.mode" :key="index">
- <view class="u-flex justify-between model_view">
- <u-avatar
- :src="item.img_file != null&&item.img_file.path?item.img_file.path:'/static/images/open.png'"
- shape="square" mode="aspectFill" size="60"></u-avatar>
- <view class="modelname">
- <view class="name">{{ item.name }}</view>
- <view class="modeldetails">{{ item.intro }}</view>
- </view>
- <view @click="onselect(index)" class="modelselect"
- :style="{ background: selectornot == index ? '#9e9e9e' : '' }">
- {{ selectornot == index ? '已选择' : '选择' }}
- </view>
- </view>
- </block>
- <view style="height: 30rpx;"></view>
- </scroll-view>
- </u-popup>
- <wike-model v-if="signShow" :authorize="false" :title="signTitle" btnText="立即获取" @save="signSign"
- @close="signShow = false"></wike-model>
- <wike-modal-qrcode :qrcode="gzhqrcode" :showconcern="showconcern" @concernclose="concernclose"></wike-modal-qrcode>
- </view>
- </template>
- <script>
- const {
- marked
- } = require('marked');
- import hljs from "highlight.js";
- import "highlight.js/scss/atom-one-dark.scss";
- import {
- Socket
- } from 'dgram';
- import {
- mapMutations,
- mapActions,
- mapState,
- mapGetters
- } from 'vuex';
- import {
- apiurl,
- } from '@/common/request/request';
- import {
- API_STEROOT,
- } from '@/common/request/request';
- import MumuRecorder from '@/uni_modules/mumu-recorder/components/mumu-recorder/mumu-recorder.vue';
- import eliseAudio from '@/components/elise-audio/elise-audio.vue';
- import {
- toPx,
- base64ToPath,
- pathToBase64,
- isBase64,
- sleep,
- getImageInfo
- } from '@/components/wike-painter/utils';
- // #ifdef H5
- import Recorder from 'recorder-core';
- import 'recorder-core/src/engine/wav'
- // #endif
- let down, delay;
- let interstitialAd = null,
- timer,
- time2,
- timingr;
- // const innerAudioContext = uni.createInnerAudioContext();
- const recorderManager = uni.getRecorderManager();
- export default {
- components: {
- MumuRecorder,
- eliseAudio,
- // #ifdef H5
- Recorder
- // #endif
- },
- data() {
- return {
- // API_ROOT: API_ROOT,
- signShow: false,
- signTitle: '',
- talkList: [],
- toid: 1,
- content: '',
- thecontent: '',
- image: '',
- // scrollTop: 999999,
- // scrollAnimation: false,
- // text1: ['您好,ChatGPT为您服务', '长按对话即可复制'],
- tobheight: 45,
- zhuangtai: 'AI智能问答机器人',
- platform: this.$platform.get(),
- // isFlash:false,
- showPoster: false,
- posterObj: {},
- switchmodel: false,
- selectornot: 0,
- // modeldata: [],
- qrcode: '',
- haddressurl: '',
- haddresssk: '',
- // scrollToView: '',
- question_index: 0,
- answer_index: 0,
- themeColor: '#007AFF',
- // codeBgColor: '#26B3A0',
- showexpand: true,
- second: 11,
- showanswer: false,
- h5question: '',
- followornot: true,
- // eights: false,
- spmplatform: 0,
- is_commission: 0,
- timing: 30,
- showcontext: true,
- showfetch: true,
- //倒计时
- showdirect: true,
- //通道
- thoroughfare: 0,
-
- //弹出录音
- soundrecording: false,
- //是否长按
- showlongpress: false,
- //音频
- innerAudioContextsrc: '',
- //取消音频加载
- cancel: false,
- //第一次录
- firstrecording: 0,
- //加载
- isLoading: true,
- //模型
- showsheet: false,
- //当前模型
- currentmodel: '',
- titlesheet: '切换模型',
- //是否为gpt4模型
- showchat4: false,
- //模型数据
- // #ifdef MP-WEIXIN
- sheetlist: [{
- index: 1,
- name: 'ChatGPT 3.5',
- subname: "高效沟通·简单提问",
- color: '#26b3a0d6',
- disabled: false
- },
- ],
- // #endif
- // #ifdef H5
- sheetlist: [
- {
- index: 0,
- name: 'ChatGPT 4.0',
- subname: "超级高效沟通·简单提问",
- disabled: false
- },
- {
- index: 1,
- name: 'ChatGPT 3.5',
- subname: "高效沟通·简单提问",
- color: '#26b3a0d6',
- disabled: false
- },
- ],
- // #endif
- // 消耗
- plan: {},
- chatgpturl: '',
- showconcern:false,
- gzhqrcode:'',
- posterheight:'',
- parse_style: {
- // 字符串的形式
- p: 'margin-bottom:0rpx;',
- // 一级标题
- h1: `
- margin:25px 0;
- font-size: 24px;
- text-align: center;
- font-weight: bold;
- color: #00ca88;
- padding:3px 10px 1px;
- border-bottom: 2px solid #00ca88;
- border-top-right-radius:3px;
- border-top-left-radius:3px;
- `,
- // 二级标题
- h2: `
- margin:40px 0 20px 0;
- font-size: 20px;
- text-align:center;
- color:#00ca88;
- font-weight:bolder;
- padding-left:10px;
- border:1px solid #00ca88;
- `,
- // 三级标题
- h3: `
- margin:30px 0 10px 0;
- font-size: 18px;
- color: #00ca88;
- padding-left:10px;
- border-left:3px solid #00ca88;
- `,
- // 四级标题
- h4: `
- margin:20px 0 10px 0;
- font-size: 16px;
- color: #00ca88;
- padding-left:10px;
- border-left:3px solid #00ca88;
- `,
- // 五级标题
- h5: `
- margin:10px 0 10px 0;
- font-size: 14px;
- color: #00ca88;
- padding-left:10px;
- border-left:3px solid #00ca88;
- `,
- // 六级标题
- h6: `
- margin:10px 0 10px 0;
- font-size: 12px;
- color: #00ca88;
- padding-left:10px;
- border-left:3px solid #00ca88;
- `,
- ul: 'margin:24rpx;color: #555;',
- ol: 'margin:12rpx;color:#555;',
- li: `
- margin: 12rpx 0;
- color: #555;
- `,
- // 链接
- a: `
- color: #00ca88;`,
- // 加粗
- strong: `
- font-weight: border;
- color: #00ca88;
- `,
- // 斜体
- em: `
- color: #00ca88;
- letter-spacing:0.3em;
- `,
- // code: 'width:90%;',
-
- // pre: 'white-space: pre;overflow: auto;background: #2d2d2d;border-radius: 4rpx;border: none;color: #ccc;margin: 12rpx;padding:20rpx;',
- // 'pre code': 'margin:0;padding:0;background: none;color: #ccc;',
- blockquote: 'padding: 15rpx;margin:0 0 12rpx 0;border-radius: 6rpx;color: #555;border-left: 4px solid #dddddd;',
-
- hr: `height:1px;padding:0;border:none;text-align:center;background-image:linear-gradient(to right,rgba(248,57,41,0),${'#9e9e9e'},rgba(248,57,41,0));`,
- table: 'border-spacing:0;overflow:auto;min-width:100%;margin:10px 0;border-collapse: collapse;',
- th: 'background-color: whitesmoke;border: 1px solid #2d2d2d;padding:10rpx;',
- td: 'border: 1px solid #2d2d2d;padding:10rpx;',
- pre: `
- color: #c7254e;
- padding: 20rpx;
- border-radius: 5px;
- white-space: pre;
- overflow: auto;
- margin:12rpx 0;
- font-size:13px;
- background: #2d2d2d;
- `,
- },
- };
- },
- computed: {
- ...mapGetters(['appInfo', 'isLogin', 'userInfo', 'homeTemplate', 'userData'])
- },
- watch: {
- appInfo: function(e) {
- let that = this;
- // uni.setNavigationBarTitle({
- // title: that.appInfo.site_name
- // });
- // console.log(that.appInfo.site_logo_path);
- // that.$base64.imageUrlToBase64(that.appInfo.site_logo_path)
- }
- },
- onReady() {
- let that = this;
- // #ifdef MP-WEIXIN
- clearTimeout(timer);
- // 在适合的场景显示插屏广告
- timer = setTimeout(function() {
- // 在页面onLoad回调事件中创建插屏广告实例
- if (wx.createInterstitialAd && that.appInfo.interstitial_status == 1) {
- interstitialAd = wx.createInterstitialAd({
- adUnitId: that.appInfo.interstitial_id
- });
- interstitialAd.onLoad(() => {});
- interstitialAd.onError(err => {});
- interstitialAd.onClose(() => {
- if (that.appInfo.interstitial_infinite_status && that.appInfo
- .interstitial_infinite_status == 1) {
- that.showInterstitial();
- } else {
- interstitialAd.show().catch(err => {
- console.error(err);
- });
- }
- });
- interstitialAd.show().catch(err => {});
- }
- }, 4000);
- // #endif
- },
- onLoad() {
- var that = this;
- if (that.platform == 'wxMiniProgram') {
- var menumtop = uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight;
- var paddingtop = uni.getSystemInfoSync().statusBarHeight + menumtop;
- that.tobheight = menumtop + paddingtop + uni.getMenuButtonBoundingClientRect().height;
- }
- this.posterheight = uni.$u.sys().windowHeight-this.tobheight
- if (that.$Route.query.chat4) {
- that.showchat4 = true
- this.sheetlist[1].color = '#000'
- this.sheetlist[0].color = '#26b3a0d6'
- if (this.$Route.query.showchat4) {
- // console.log(this.$Route.query.showchat4);
- // this.send(this.$Route.query.showchat4);
- // #ifdef H5
- this.h5question = this.$Route.query.showchat4;
- // this.eventsource()
- this.aigetAddress();
- // #endif
- }
- }
- if (this.$Route.query.question) {
- if (this.$Route.query.selectornot) {
- this.selectornot = this.$Route.query.selectornot
- }
- // #ifdef MP-WEIXIN
- this.send(this.$Route.query.question);
- // #endif
- // #ifdef H5
- this.h5question = this.$Route.query.question;
- // this.eventsource()
- this.aigetAddress();
- // #endif
- }
- this.spmplatform = ['H5', 'wxOfficialAccount', 'wxMiniProgram', 'App'].indexOf(this.platform) + 1;
- this.followornot = true;
- // #ifdef H5
- this.toaigetAddress();
- // #endif
- this.isLoading = false
- this.initGpt();
- this.getCommissionSetting()
- this.onmessage();
- uni.onSocketError(function(res) {});
- // #ifdef MP-WEIXIN
- let self = this;
- recorderManager.onStop(function(res) {
- self.aiaudiocheck(res.tempFilePath)
- });
- // #endif
- this.initHighLight();
- },
- onShow: function() {
- if (this.isLogin) {
- this.getUserData();
- }
- this.getPlan();
- this.systemwechat()
- },
- onUnload() {
- this.followornot = false;
- clearInterval(time2);
- clearTimeout(timingr);
- uni.$emit('stop')
- if (this.$ws.socketStatus()) {
- this.$ws.completeClose();
- }
- },
- onHide() {
- if (this.$ws.socketStatus()) {
- this.$ws.completeClose();
- }
- },
- onReachBottom() {},
- methods: {
- ...mapActions(['getUserInfo', 'showAuthModal', 'getUserData']),
- systemwechat(){
- this.$http('conf.getGroupConf', { group: 'system.wechat' }).then(res => {
- if (res.code == 0) {
- this.gzhqrcode = res.data.qrcode_path
- const focuson = uni.getStorageSync('focuson');
- // console.log(focuson);
- if(!focuson){
- if(this.gzhqrcode){
- if(this.isLogin&&this.appInfo.is_show_logged_qrcode == 1 ){
- this.showconcern = true
- }
- }
- }
- }
- })
- },
- initHighLight() {
- hljs.configure({
- useBR: true,
- tabReplace: " ",
- });
- marked.setOptions({
- renderer: new marked.Renderer(),
- gfm: true,
- tables: true,
- breaks: false,
- pedantic: false,
- highlight: function(code, lang) {
- if (lang && hljs.getLanguage(lang)) {
- return hljs.highlight(lang, code, true).value;
- } else {
- return hljs.highlightAuto(code).value;
- }
- },
- });
- },
- concernclose(){
- this.showconcern = false
- },
- // 角色角色初始化
- switcmode() {
- // #ifdef MP-WEIXIN
- this.zhuangtai = this.appInfo.site_name ? this.appInfo.site_name :
- 'AI问答机器人';
- // #endif
- // #ifdef H5
- uni.setNavigationBarTitle({
- title: this.appInfo.site_name ? this.appInfo.site_name : 'AI问答机器人'
- });
- this.zhuangtai = this.homeTemplate.mode && this.homeTemplate.mode.length >
- 0 ? this.homeTemplate.mode[this
- .selectornot].name : 'AI问答机器人';
- // #endif
-
- this.Audio()
- this.$nextTick(() => {
- // 清空内容框中的内容
- this.content = '';
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- });
- },
- //选择模型
- selectClick(index) {
- for (var a = 0; a < this.sheetlist.length; a++) {
- this.sheetlist[a].color = '#000'
- }
- // #ifdef H5
- this.sheetlist[index.index].color = '#26b3a0d6'
- // #endif
- // #ifdef MP-WEIXIN
- this.sheetlist[index.index - 1].color = '#26b3a0d6'
- // #endif
- if (index.index == 0) {
- this.showchat4 = true
-
- } else {
-
- this.showchat4 = false
- }
- this.switcmode()
- this.getcurrentmodel()
- },
- //开始录音的方法
- uploadRecord() {
- // 开始录音
- if (!this.rec) {
- uni.showToast({
- title: '未打开录音权限'
- })
- return;
- }
- this.rec.start();
- this.showlongpress = true
- },
- //结束录音的方法
- h5btn_sub_stop() {
- var This = this;
- var rec = This.rec;
- This.rec = null;
- if (!rec) {
- uni.showToast({
- title: '未打开录音'
- })
- return;
- }
- rec.stop(function(blob, duration) {
- var reader = new FileReader();
- reader.addEventListener("load", function() {
- if (reader.result.length > 100) {
- This.he_show = true
- }
- }, false);
- reader.readAsDataURL(blob);
- // console.log(blob,duration,'blob')
- let blobURL = window.URL.createObjectURL(blob)
- // console.log(blobURL, '--------')
- This.aiaudiocheck(blobURL)
- }, function(s) {
- This.showlongpress = false
- }, true); //自动close
- },
- //登录
- getroute() {
- if (!this.isLogin) {
- uni.setStorageSync('route', '/pages/chat/chat');
- }
- this.Audio()
- },
- //关闭语音输出
- Audio() {
- uni.$emit('stop')
- },
- //语音识别
- aiaudiocheck(e) {
- var that = this;
- // console.log(e, '5');
- uni.showLoading({
- title: '识别中'
- })
- uni.uploadFile({
- url: apiurl('ai/recognizer'),
- filePath: e,
- name: 'speech',
- header: {
- platform: that.platform
- },
- success: res2 => {
- uni.hideLoading();
- let a = JSON.parse(res2.data);
- if (a.code == 0) {
- uni.showToast({
- title: '识别成功',
- })
- this.content += a.data.result[0]
- this.thecontent += a.data.result[0]
- } else {
- uni.showToast({
- title: '识别失败',
- icon: 'none'
- })
- }
- }
- });
- },
- //语音输入
- openmicrophone() {
- var that = this;
- this.Audio()
- this.cancel = true
- if (!this.isLogin) {
- uni.navigateTo({
- url: '/pages/user/signin'
- });
- uni.setStorageSync('route', '/pages/chat/chat');
- return;
- }
- // #ifdef H5
- let This = this;
- let rec = This.rec = Recorder({
- type: "wav", // wav格式, 需要使用的type类型,需提前把格式支持文件加载进来
- bitRate: 16, // 比特率kbps,越大音质越好
- sampleRate: 16000, // 采样率hz,每秒音波震动次数,越大细节越丰富
- onProcess: function(buffers, powerLevel, duration, sampleRate) {
- if (duration > 60000) {
- This.h5btn_sub_stop()
- This.showlongpress = false
- This.soundrecording = false
- }
- } //录音实时回调,大约1秒调用12次回调
- });
- rec.open(function() {
- // console.log('打开成功:');
- // 渲染音频波形图
- This.soundrecording = true
- }, function(msg, isUserNotAllow) {
- uni.showToast({
- title: '麦克风已拒绝打开',
- icon: 'none'
- })
- // 浏览器不支持录音、用户拒绝麦克风权限、或者非安全环境(非https、file等
- // console.log((isUserNotAllow ? "UserNotAllow," : "") + "无法录音:" + msg);
- });
- // #endif
- // #ifdef MP-WEIXIN
- uni.getSetting({
- success: (res) => {
- if (res.authSetting['scope.record'] == false) {
- uni.showModal({
- confirmText: '去打开',
- content: '请先开启麦克风授权',
- title: '提示',
- confirmColor: '#26B3A0',
- success(res) {
- // console.log(res);
- if (res.confirm) {
- uni.openSetting({
- success: function(ress) {
- // console.log(ress);
- }
- });
- }
- }
- })
- return false
- } else {
- uni.authorize({
- scope: 'scope.record',
- success: (res) => {
- that.soundrecording = true
- },
- fail: (res) => {
- uni.showToast({
- title: '麦克风打开失败',
- icon: 'none'
- })
- }
- })
- }
- },
- })
- // #endif
- },
- startrecording() {
- // console.log('开始录音');
- // #ifdef H5
- // this.$refs.recorder.start()
- this.uploadRecord()
- // #endif
- // #ifdef MP-WEIXIN
- recorderManager.start({
- sampleRate: 16000,
- numberOfChannels: 1,
- format: 'aac',
- duration: 60000
- })
- this.showlongpress = true
- // #endif
- },
- stoprecording() {
- // console.log('停止录音');
- // #ifdef H5
- // this.$refs.recorder.stop()
- this.h5btn_sub_stop()
- // #endif
- // #ifdef MP-WEIXIN
- recorderManager.stop();
- // #endif
- this.showlongpress = false
- this.soundrecording = false
- },
- //语音输出
- aittsjob(res) {
- this.talkList[res.index].audiolink = res.speech_url
- },
- //ai绘画信息
- initGpt() {
- // console.log(this.homeTemplate.mode);
- // #ifdef MP-WEIXIN
- this.zhuangtai = this.appInfo.site_name ? this.appInfo
- .site_name :
- 'AI问答机器人';
- // #endif
- // #ifdef H5
- uni.setNavigationBarTitle({
- title: this.appInfo.site_name ? this.appInfo.site_name : 'AI问答机器人'
- });
- this.zhuangtai = this.homeTemplate.mode && this.homeTemplate.mode.length >
- 0 ? this
- .homeTemplate.mode[this
- .selectornot].name : 'AI问答机器人';
- // #endif
- this.commonqrcodePath();
- //
- // this.onmessage();
- },
- // 关闭跟随
- touchmove() {
- this.followornot = false;
- },
- // 是否显示分销按钮
- getCommissionSetting() {
- this.$http('conf.getGroupConf', {
- group: 'system.commission'
- }).then(res => {
- if (res.code == 0) {
- this.is_commission = res.data.is_commission
- }
- });
- },
- // 上下文倒计时
- getcontext() {
- var that = this;
- that.timing--;
- // console.log(that.timing);
- if (that.timing == 0) {
- // console.log('关闭上下文定时器');
- clearTimeout(timingr);
- that.timing = that.appInfo.text_expire_time ? Number(that.appInfo.text_expire_time) :
- 30;
- // console.log('取消下文关联');
- that.showcontext = false
- return;
- }
- timingr = setTimeout(() => {
- that.getcontext();
- }, 1000);
- },
- // 监听WebSocket是否打开
- waitWss() {
- return new Promise((resolve, reject) => {
- uni.onSocketOpen(function(res) {
- // console.log('WebSocket连接已打开!');
- resolve(1);
- });
- });
- },
- // 监听WebSocket是否关闭
- waitClose() {
- return new Promise((resolve, reject) => {
- uni.onSocketClose(function(res) {
- // console.log('WebSocket 已关闭!');
- resolve(1);
- });
- });
- },
- // fetch模式url
- aigetAddress() {
- var that = this;
- let uniacid = uni.getStorageSync("uniacid") || "";
- that.chatgpturl = API_STEROOT + 'api.ai/chatgpt?uniacid=' + uniacid;
- that.send(that.h5question);
- },
- // fetch模式url
- toaigetAddress() {
- var that = this;
- let uniacid = uni.getStorageSync("uniacid") || "";
- that.chatgpturl = API_STEROOT + 'api.ai/chatgpt?uniacid=' + uniacid;
- },
- // 海报二维码
- commonqrcodePath() {
- let spm = this.userInfo.id + '.1.0.' + this.spmplatform + '.1';
- this.$http('common.qrcodePath', {
- spm: spm
- }).then(res => {
- if (res.code == 0) {
- this.qrcode = res.data;
- }
- });
- },
- //长按复制
- copy(e) {
- var that = this;
- var text = e.currentTarget.dataset.text;
- uni.setClipboardData({
- data: text,
- success(res) {
- uni.getClipboardData({
- success(res) {}
- });
- }
- });
- },
- //输入框聚焦操作
- focusinput() {
- this.showexpand = false;
- this.$nextTick(() => {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- });
- if (!this.isLogin) {
- uni.navigateTo({
- url: '/pages/user/signin'
- });
- uni.setStorageSync('route', '/pages/chat/chat');
- return;
- }
- },
- signSign() {
- uni.navigateTo({
- url: '/pages/user/member/member'
- });
- this.signShow = false
- },
- //功能按钮显示
- blurinput() {
- this.showexpand = true;
- },
- //角色角色
- commontemplate() {
- this.$store.dispatch('getTemplate');
- },
- //敏感词过滤检测
- getcheckText() {
- var that = this;
- return new Promise((resolve, reject) => {
- that.$http('ai.checkText', {
- prompt: that.thecontent
- }).then(res => {
- if (res.code == 0) {
- resolve(1);
- } else {
- let data = {
- id: new Date().getTime(),
- content: '该问题已被隐藏!',
- type: 1,
- toid: that.toid,
- fromid: that.userInfo.id,
- avatar: that.userInfo.avatar,
- nickname: that.userInfo.nickname,
- done: true
- };
- that.talkList.push(data);
- let chat_data = {
- id: new Date().getTime(),
- content: res.msg,
- type: 1,
- toid: this.toid,
- fromid: -1,
- avatar: this.homeTemplate.mode && this.homeTemplate.mode.length > 0 &&
- this.homeTemplate.mode[this.selectornot].img_file != null && this
- .homeTemplate.mode[this.selectornot].img_file.path,
- nickname: this.homeTemplate.mode && this.homeTemplate.mode.length >
- 0 && this.homeTemplate.mode[this.selectornot].name,
- show_flash: false,
- done: true,
- donec: true
- };
- this.talkList.push(chat_data);
- this.$nextTick(() => {
- // 清空内容框中的内容
- this.content = '';
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- });
- }
- })
- });
- },
- getPlan() {
- let that = this;
- this.$http('conf.getGroupConf', {
- group: 'system.plan'
- }).then(res => {
- if (res.code == 0) {
- this.plan = res.data
- let gpt = this.appInfo;
- // #ifdef H5
- // this.sheetlist[0].disabled = gpt.is_gpt4 == 1 ? false : true
- // this.sheetlist[0].name = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
- // this.sheetlist[0].subname = gpt.gpt4_intro ? gpt.gpt4_intro : '高效沟通·简单提问'
- // this.sheetlist[1].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
- // this.sheetlist[1].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
- if(gpt.is_gpt4 == 2){
- this.sheetlist.shift()
- this.sheetlist[0].name = gpt.gpt35_alias?gpt.gpt35_alias:'ChatGPT 3.5'
- this.sheetlist[0].subname = gpt.gpt35_intro?gpt.gpt35_intro:'高效沟通·简单提问'
- }else{
- this.sheetlist[0].name = gpt.gpt4_alias?gpt.gpt4_alias:'ChatGPT 4.0'
- this.sheetlist[0].subname = gpt.gpt4_intro?gpt.gpt4_intro:'高效沟通·简单提问'
-
- this.sheetlist[1].name = gpt.gpt35_alias?gpt.gpt35_alias:'ChatGPT 3.5'
- this.sheetlist[1].subname = gpt.gpt35_intro?gpt.gpt35_intro:'高效沟通·简单提问'
- }
- // #endif
- // #ifdef MP-WEIXIN
- this.sheetlist[0].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
- this.sheetlist[0].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
- // #endif
- this.getcurrentmodel()
- }
- })
- },
- getcurrentmodel() {
- let gpt = this.appInfo;
- if (this.showchat4) {
- this.currentmodel = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
- }else {
- this.currentmodel = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
- }
- },
- // 发送信息
- async send(e) {
- let that = this;
- if (!that.isLogin) {
- uni.navigateTo({
- url: '/pages/user/signin'
- });
- uni.setStorageSync('route', '/pages/chat/chat');
- return;
- }
- if (that.appInfo.time_member && that.appInfo.time_member == 1) {
- if (that.showchat4) {
- if (that.userData.vip_info && that.userData.is_validity > 0 && that.userData.vip_info.gpt4_used ==
- that.userData.vip_info.gpt4_times && that.userData.coin < that.plan.lock_gpt4) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
- // "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- that.plan.lock_gpt4 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +"</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
- this.signShow = true
- return;
- }
- if (that.userData.is_validity == 0&&that.userData.coin < that.plan.lock_gpt4) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- that.plan.lock_gpt4 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +"</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
- this.signShow = true
- return;
- }
- } else {
- if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData.vip_info
- .gpt35_times && that.userData.coin <= 0) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
-
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- 1 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +"</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
- this.signShow = true
- return;
- }
- if (that.userData.is_validity == 0&&that.userData.coin <= 0) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- 1 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +"</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
- this.signShow = true
- return;
- }
- }
- } else {
- if (that.showchat4 && that.userData.coin < that.plan.lock_gpt4) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- that.plan.lock_gpt4 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
- that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" + alias +
- "</span>吧</p>"
- this.signShow = true
- return;
- }
- if (!that.showchat4 && that.userData.coin <= 0) {
- var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- this.signTitle =
- "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- 1 + "</span><span>" + alias +
- "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
- that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" + alias +
- "</span>吧</p>"
- this.signShow = true
- return;
- }
- }
- // if (that.showchat4) {
- // if (that.userData.coin < that.plan.lock_gpt4) {
- // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- // this.signTitle =
- // "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
- // that.plan.lock_gpt4 + "</span><span>" + alias +
- // "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
- // that.userData.coin + "</span><span>" + alias + "</span>,此模型不支持会员套餐,无法发起提问,快去获取<span>" + alias +
- // "</span>吧</p>"
- // this.signShow = true
- // return;
- // }
- // }
- // if (that.appInfo.time_member && that.appInfo.time_member == 1) {
- // if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData.vip_info.gpt35_times && that.userData.coin <= 0) {
- // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>"+alias+"</span>/会员套餐内剩余次数不足</p>"
- // this.signShow = true
-
- // return;
- // }
- // if (that.userData.is_validity == 0) {
- // if (that.userData.coin <= 0) {
- // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
- // "</span>/会员套餐不足</p>"
- // this.signShow = true
- // return;
- // }
- // }
- // } else {
- // if (that.userData.coin <= 0) {
- // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
- // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
- // "</span>/会员套餐不足</p>"
- // this.signShow = true
- // return;
- // }
- // }
- if (that.talkList.length > 1 && !that.talkList[that.talkList.length - 1].done) {
- uni.showToast({
- title: '正在输入回答,请等待输入完成',
- icon: 'none'
- });
- return;
- }
- if (!e) {
- uni.showToast({
- title: '请输入有效的内容',
- icon: 'none'
- });
- return;
- }
- that.thecontent = e;
- // console.log('提问内容检测');
- uni.showLoading({})
- // #ifdef H5
- let check = this.appInfo.is_h5_filter && this.appInfo.is_h5_filter == 1 ? await this.getcheckText() :
- 1;
- // #endif
- // #ifdef MP-WEIXIN
- let check = await this.getcheckText();
- // #endif
- if (check == 1) {
- uni.hideLoading();
- // 将当前发送信息 添加到消息列表。
- let data = {
- id: new Date().getTime(),
- content: e,
- type: 1,
- toid: this.toid,
- fromid: this.userInfo.id,
- avatar: this.userInfo.avatar,
- nickname: this.userInfo.nickname,
- done: true
- };
- this.talkList.push(data);
- // console.log(this.homeTemplate.mode[this.selectornot]);
- // #ifdef MP-WEIXIN
- if (this.showchat4) {
- let chat_data = {
- id: new Date().getTime(),
- content: '正在输入中,请等待...',
- type: 2,
- toid: this.toid,
- fromid: -1,
- avatar: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].img_file !=
- null && this.homeTemplate.mode[this.selectornot].img_file.path ? this.homeTemplate
- .mode[this.selectornot].img_file.path : '/static/images/head.jpg',
- nickname: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].name ?
- this.homeTemplate.mode[this.selectornot].name : 'AI问答机器人',
- };
- this.talkList.push(chat_data);
- } else {
- let chat_data = {
- id: new Date().getTime(),
- content: '正在思考中...',
- type: 1,
- toid: this.toid,
- fromid: -1,
- avatar: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].img_file !=
- null && this.homeTemplate.mode[this.selectornot].img_file.path ? this.homeTemplate
- .mode[this.selectornot].img_file.path : '/static/images/open.png',
- nickname: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].name ?
- this.homeTemplate.mode[this.selectornot].name : 'AI问答机器人',
- show_flash: true,
- done: false
- };
- this.talkList.push(chat_data);
- }
- // #endif
- // #ifdef H5
- let chat_data = {
- id: new Date().getTime(),
- content: '正在思考中...',
- type: 1,
- toid: this.toid,
- fromid: -1,
- avatar: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].img_file !=
- null && this.homeTemplate.mode[this.selectornot].img_file.path ? this.homeTemplate
- .mode[this.selectornot].img_file.path : '/static/images/open.png',
- nickname: this.homeTemplate.mode && this.homeTemplate.mode[this.selectornot].name ? this
- .homeTemplate.mode[this.selectornot].name : 'AI问答机器人',
- show_flash: true,
- done: false
- };
- this.talkList.push(chat_data);
- // #endif
- // console.log(this.talkList);
- this.$nextTick(() => {
- // 清空内容框中的内容
- this.content = '';
- uni.pageScrollTo({
- scrollTop: 999999,
- duration: 300
- });
- });
- // 重置是否来数据的判断
- this.showanswer = false;
- // 允许跟随到最底部
- this.followornot = true;
- // 关闭重置上下文的秒倒计时
- // clearTimeout(timingr);
- // this.timing = this.appInfo.text_expire_time ? Number(this.appInfo.text_expire_time) : 30;
- // #ifdef MP-WEIXIN
- // 判断是否连接wss
- if (!this.$ws.socketStatus()) {
- // 重置倒计时15秒后的wss未返数据走直连模式
- this.showdirect = true;
- // console.log('15秒倒计时开始');
- this.countdown();
- // console.log('重连wss');
- this.$ws.init();
- let re = await this.waitWss();
- if (re == 1) {
- // console.log('等待wss打开后执行');
- this.getChatGPT(e);
- }
- } else {
- // 关闭wss
- that.$ws.completeClose();
- // console.log('15秒倒计时开始');
- this.countdown();
- let answer = '';
- if (that.talkList.length > 2) {
- // answer = that.talkList[that.talkList.length - 4].content + '\n' + that
- // .talkList[that
- // .talkList.length - 3].content;
- answer = that.talkList[that.talkList.length - 3].content;
- }
- // console.log('倒计时15秒后不再走直连模式');
- this.showdirect = false;
- this.directGpt(that.thecontent, answer);
- }
- // #endif
- // #ifdef H5
- this.showdirect = true;
- // console.log('15秒倒计时开始');
- this.countdown();
- // console.log('走方案2');
- that.fetchmodel(that.thecontent);
- // #endif
- }
- },
- //定时器
- countdown() {
- var that = this;
- that.second--;
- if (that.second == 0) {
- if (!that.showanswer) {
- let answer = '';
- if (that.talkList.length > 2) {
- answer = that.talkList[that.talkList.length - 3].content;
- }
- uni.showLoading({
- title: '加载中...'
- });
- // clearTimeout(down);
- // console.log('关闭定时器');
- // #ifdef MP-WEIXIN
- if (that.$ws.socketStatus()) {
- // console.log('关闭直连');
- that.$ws.completeClose();
- }
- // #endif
- if (that.showdirect) {
- setTimeout(() => {
- uni.hideLoading();
- that.second = 11;
- that.directGpt(that.thecontent, answer);
- }, 1500);
- } else {
- uni.hideLoading();
- that.second = 11;
- if (that.talkList[that.question_index].content == '正在思考中...') {
- that.talkList[that.question_index].content = '请等我几秒钟,正在输入回答...';
- }
- }
- return;
- } else {
- that.second = 11;
- clearTimeout(down);
- // console.log('关闭定时器');
- }
- // clearTimeout(down);
- return;
- }
- down = setTimeout(() => {
- // console.log(that.showanswer);
- if (that.showanswer) {
- clearTimeout(down);
- // console.log('关闭定时器');
- that.second = 11;
- return;
- }
- that.countdown();
- }, 1000);
- // console.log(second);
- },
- //wss返回数据
- onmessage() {
- let that = this,
- message = '';
- uni.onSocketMessage(function(res) {
- that.showanswer = true;
- let a = res.data;
- if (a.indexOf('wike_err:') != -1) {
- uni.showToast({
- title: '报错:' + a,
- icon: 'none'
- });
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].content = '报错:' + a;
- that.talkList[that.question_index].done = true;
- return;
- }
- if (!that.$ws.socketStatus()) {
- uni.showToast({
- title: '连接错误',
- icon: 'none'
- });
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].content = '报错';
- return;
- }
- if (a.indexOf('[DONE]') != -1) {
- that.$nextTick(() => {
- // that.timing = that.appInfo.text_expire_time ? Number(that.appInfo
- // .text_expire_time) : 30;
- // that.showcontext = true;
- // that.getcontext()
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.record(that.talkList[that.answer_index].content, message);
- message = '';
- if (that.$ws.socketStatus()) {
- that.$ws.completeClose();
- }
- that.$nextTick(() => {
- if (that.followornot) {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- }
- });
- });
- } else {
- var b = a.split('data:').filter(w => !!w.trim() && w.trim() !== '[DONE]');
- var c = '';
- b.map(w => JSON.parse(w))
- .map(w => (c = w.choices[0].delta.content))
- .join('');
- if (that.followornot) {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 0
- });
- }
- if (c != undefined) {
- message += c;
- }
- if (that.thoroughfare == 1) {
- that.talkList[that.question_index].backups = message;
- that.talkList[that.question_index].content = marked(message);
- }
- }
- });
- },
- //wss模式
- getChatGPT(e) {
- var that = this;
- let i = 1,
- message = '';
- this.question_index = that.talkList.length - 1;
- this.answer_index = that.talkList.length - 2;
- let answer = '';
- if (that.talkList.length > 2 ) {
- answer = that.talkList[that.question_index - 2].content;
- }
- var ty = {
- prompt: e,
- guide: that.homeTemplate.mode[that.selectornot].guide,
-
- answer: answer,
- key: that.appInfo.sk ? that.appInfo.sk : '',
- lines: that.appInfo.connect_lines ? this.appInfo.connect_lines : 1,
- temperature: that.appInfo.temperature ? this.appInfo.temperature : 0,
- presence_penalty: that.appInfo.presence_penalty ? this.appInfo.presence_penalty : 0,
- frequency_penalty: that.appInfo.frequency_penalty ? this.appInfo.frequency_penalty : 0,
- };
- var json = JSON.stringify(ty);
- that.thoroughfare = 1
- that.$ws.send(json);
- },
- //php模式
- directGpt(e, answer) {
- // console.log('走方案3');
- let that = this;
- this.question_index = that.talkList.length - 1;
- if (this.showdirect) {
- that.talkList[that.question_index].content = '请等我几秒钟,正在输入回答...';
- }
- // this.showdirect = false;
- that.showanswer = this.showdirect;
- that.thoroughfare = 3
- // var url =
- that.$http(that.showchat4 ? 'ai.chat4' : 'ai.chat', {
- prompt: e,
- guide: that.homeTemplate.mode[that.selectornot].guide,
- answer: answer
- }).then(res => {
- if (that.thoroughfare == 3) {
- if (res.code == 0) {
- that.talkList[that.question_index].backups = res.data.trim();
- that.talkList[that.question_index].content = marked(res.data.trim());
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.talkList[that.question_index].type = 1;
- } else if (res.code == 3 || res.code == 1) {
- that.talkList[that.question_index].content = res.msg;
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.talkList[that.question_index].type = 1;
- } else {
- that.talkList[that.question_index].content = res.msg;
- that.talkList[that.question_index - 1].content = '该问题已被隐藏!';
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.talkList[that.question_index].type = 1;
- }
- that.showanswer = true;
- that.getUserData();
- // that.timing = that.appInfo.text_expire_time ? Number(that.appInfo
- // .text_expire_time) : 30;
-
- // that.getcontext();
- that.$nextTick(() => {
- // 清空内容框中的内容
- that.content = '';
- if (that.followornot) {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- }
- });
- }
- });
- },
- //fetch模式
- fetchmodel(e) {
- // console.log('走方案2');
- var that = this;
- let i = 1,
- message = '';
- let answer = '';
- that.thoroughfare = 2;
- this.question_index = that.talkList.length - 1;
- this.answer_index = that.talkList.length - 2;
- if (that.talkList.length > 2) {
- answer = that.talkList[that.question_index - 2].content;
- }
- // let param = {
- // max_tokens: 3000,
- // model: 'gpt-3.5-turbo-0301',
- // stream: true,
- // messages: [{
- // role: 'assistant',
- // content: answer
- // },
- // {
- // role: 'system',
- // content: that.homeTemplate.mode[that.selectornot].guide
- // },
- // {
- // role: 'user',
- // content: e
- // }
- // ]
- // };
- let param = {
- type: that.showchat4 ? 'gpt4' : 'gpt35',
- prompt: e,
- answer: answer,
- guide: that.homeTemplate.mode[that.selectornot].guide,
- // messages: [{
- // role: 'assistant',
- // content: answer
- // },
- // {
- // role: 'system',
- // content: that.homeTemplate.mode[that.selectornot].guide
- // },
- // {
- // role: 'user',
- // content: e
- // }
- // ]
- };
- let headers = {
- 'token': uni.getStorageSync("token") || "",
- 'platform': this.platform,
- 'Content-Type': 'application/json',
- }
- fetch(that.chatgpturl, {
- method: 'POST',
- body: JSON.stringify(param),
- headers: headers
- })
- .then(x => {
- // console.log(x);
- if (x.status === 404) {
- // that.showdirect = true;
- this.showdirect = false;
- that.directGpt(e, answer)
- return;
- }
- if (x.status === 200) return x.body;
- throw x;
- })
- .then(x => {
- const k = x.getReader();
- return new ReadableStream({
- start(V) {
- function F() {
- k.read().then(({
- done: E,
- value: U
- }) => {
- if (E) {
- // console.log('s');
- if (that.talkList[that.question_index].content ==
- '正在思考中...' || that.talkList[that.question_index]
- .content == '请等我几秒钟,正在输入回答...') {
- return;
- }
- // that.timing = that.appInfo.text_expire_time ? Number(that
- // .appInfo.text_expire_time) : 30;
- // that.showcontext = true;
- // that.getcontext();
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.getUserData();
- // console.log(that.talkList);
- // console.log(that.userData.vip_info);
- // if(that.userData.is_validity > 0&&that.userData.vip_info&&that.userData.vip_info.gpt4_used == 1 || that.userData.is_validity > 0&&that.userData.vip_info&&that.userData.vip_info.gpt35_used == 1){
- // var sty = '会员套餐内当前提问次数已用完,继续提问将会消耗您的'+that.appInfo.number_alias?that.appInfo.number_alias:'点数'
- // uni.showModal({
- // showCancel:false,
- // title:'提示',
- // confirmColor:'#26B3A0',
- // confirmText:'我知道了',
- // content:sty
- // })
- // }
- setTimeout(() => {
- if (that.followornot) {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- }
- }, 100);
- return;
- }
-
- V.enqueue(U);
- // console.log(U);
- const L = new TextDecoder().decode(U);
- const N = L;
- // console.log(L);
- // console.log('5');
- that.showanswer = true;
- if (N != undefined) {
- message += N;
- }
-
- if (that.thoroughfare == 2) {
- if (N == '内容包含敏感信息,不予展示。') {
- that.talkList[that.question_index - 1].content =
- '该问题已被隐藏!';
- that.talkList[that.question_index].content =
- '内容包含敏感信息,不予展示。';
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- return;
- }
- // console.log(JSON.parse(N));
- that.talkList[that.question_index].backups = message;
- that.talkList[that.question_index].content = marked(message);
- // console.log(marked(message));
- }
- if (that.followornot) {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 0
- });
- }
- F();
- });
- }
- F();
- }
- });
- })
- .then(x =>
- new Response(x, {
- headers: {
- 'Content-Type': 'text/html'
- }
- }).text()
- );
- },
- // 记录回答
- record(question, answer) {
- let that = this,type = that.showchat4 ? 'gpt4' : 'gpt35';
- this.$http('question.add', {
- question,
- answer,
- type
- }).then(res => {
- if (res.code == 0) {
- that.getUserData();
- // console.log(that.getUserData());
- } else {
- that.talkList[that.question_index].content = res.msg;
- that.talkList[that.question_index - 1].content = '该问题已被隐藏!';
- that.talkList[that.question_index].show_flash = false;
- that.talkList[that.question_index].done = true;
- that.talkList[that.question_index].donec = true;
- }
- });
- },
- // 复制文本
- copyText(e) {
- // console.log(marked(this.talkList[e].content));
- uni.setClipboardData({
- data: this.talkList[e].backups,
- success: function() {
- // console.log('success');
- uni.showToast({
- title: '复制成功'
- });
- }
- });
- },
- // 插屏广告显示时间
- showInterstitial() {
- time2 = setInterval(
- function() {
- interstitialAd.show().catch(err => {
- // console.error(err);
- });
- },
- this.appInfo.gap ? this.appInfo.gap * 1000 : 12000
- );
- },
- // 生成图片
- toSave() {
- uni.showLoading({
- title: '海报生成中'
- });
- this.$refs.painter.canvasToTempFilePathSync({
- // 在nvue里是jpeg
- fileType: 'jpg',
- quality: 1,
- success: res => {
- // H5 提示用户长按图另存
- // #ifdef MP-WEIXIN
- wx.showShareImageMenu({
- path: res.tempFilePath
- })
- this.showPoster = false;
- uni.hideLoading();
- // #endif
- // #ifdef H5
- this.showPoster = false;
- uni.hideLoading();
- uni.showModal({
- confirmColor: '#26B3A0',
- confirmText: '查看图片',
- title: '提示',
- content: '查看图片后长按图片即可保存或分享',
- success(src) {
- if (src.confirm) {
- uni.previewImage({
- urls: [res.tempFilePath]
- });
- } else if (src.cancel) {
- this.showPoster = true;
- }
- }
- });
- // #endif
- }
- });
- },
-
- //选择角色
- onselect(e) {
- if (this.selectornot != e) {
- let data = {
- content: uni.$u.trim(this.homeTemplate.mode[e].greetings),
- type: 1,
- toid: this.toid,
- fromid: -1,
- avatar: this.homeTemplate.mode[e].img_file.path,
- nickname: this.homeTemplate.mode[e].name,
- done: true,
- donec: true
- };
- this.talkList.push(data);
- this.$nextTick(() => {
- uni.pageScrollTo({
- scrollTop: 99999,
- duration: 300
- });
- });
- }
- // this.showcontext = false
- this.switchmodel = this.selectornot == e ? true : false;
- this.selectornot = e;
- // #ifdef H5
- this.zhuangtai = this.homeTemplate.mode[e].name;
- // #endif
- },
- getdownload(e,type){
- return new Promise((resolve, reject) => {
- // uni.getImageInfo({
- // src: e,
- // success: res => {
- // uni.downloadFile({
- // url: e,
- // success: (res) => {
- // if (res.statusCode === 200) {
- // resolve(res.tempFilePath);
- // }
- // if(res.statusCode === 404){
- // let head = '/static/images/head.jpg',open = '/static/images/open.png';
- // if(type == 1){
- // resolve(head);
- // }else{
- // resolve(open);
- // }
- // }
- // }
- // });
- // },
- // fail: err => {
- // let head = '/static/images/head.jpg',open = '/static/images/open.png';
- // if(type == 1){
- // resolve(head);
- // }else{
- // resolve(open);
- // }
- // }
- // })
- uni.request({
- url: e,
- method:'GET',
- responseType:'arraybuffer',
- success: ress => {
- let base64 = wx.arrayBufferToBase64(ress.data);
- base64 = 'data:image/jpeg;base64,' + base64
- resolve(base64);
- },
- fail: (e) => {
- let head = '/static/images/head.jpg',open = '/static/images/open.png';
- if(type == 1){
- resolve(head);
- }else{
- resolve(open);
- }
- }
- })
- });
- },
- posterSuccess(){
- uni.hideLoading();
- },
- // 海报绘制
- async createPoster(e) {
- let that = this;
- let site_logo = '';
- uni.showLoading({
- title: '海报渲染中'
- });
- let avatar_logo = that.userInfo.avatar ? await this.getdownload(that.userInfo.avatar,1):'/static/images/head.jpg';
- if(that.appInfo.site_logo_path.indexOf("https") < 0){
- site_logo = that.appInfo.site_logo_path ? await that.getdownload(that.appInfo.site_logo_path.replace("http:", "https:"),2):'/static/images/open.png';
- }else{
- site_logo = that.appInfo.site_logo_path ? await that.getdownload(that.appInfo.site_logo_path,2):'/static/images/open.png';
- }
- (this.posterObj = {
- width: uni.$u.sys().windowWidth+ 'px',
- background: 'linear-gradient(to right, #00ca88 0%, #00BCD4 100%)',
- css: {
- // 根节点若无尺寸,自动获取父级节点
- width: uni.$u.sys().windowWidth+ 'px',
- },
- views: [{
- type: 'view',
- css: {
- marginTop: '20rpx',
- paddingLeft: '10rpx',
- display: 'flex'
- },
- views: [{
- type: 'image',
- src: avatar_logo,
- css: {
- marginTop: '10rpx',
- marginLeft: '20rpx',
- borderRadius: '16rpx',
- width: '80rpx',
- height: '80rpx',
- border: '2rpx solid #fff',
- objectFit: 'cover'
- }
- },
- {
- type: 'view',
- css: {
- marginTop: '10rpx',
- marginLeft: '20rpx'
- // display:'flex',
- // flexDirection:'column'
- },
- views: [{
- type: 'view',
- views: [{
- type: 'text',
- text: this.userInfo.nickname ? this
- .userInfo
- .nickname : '提问者',
- css: {
- marginTop: '10rpx',
- fontSize: '28rpx',
- fontWeight: 'bold',
- color: '#32324A',
- lineHeight: '28rpx'
- }
- }]
- },
- {
- type: 'view',
- views: [{
- type: 'text',
- text: '我的提问❓',
- css: {
- marginTop: '15rpx',
- fontSize: '20rpx',
-
- color: '#fff',
- lineHeight: '25rpx',
- }
- }]
- }
- ]
- }
- ]
- },
- {
- type: 'view',
- css: {
- marginTop: '20rpx',
- width: (uni.$u.sys().windowWidth - 48) + 'px',
- padding: '15rpx',
- background: '#fff',
- borderRadius: '16rpx',
- marginLeft: '30rpx',
- },
- views: [{
- type: 'text',
- text: that.talkList[e - 1].content,
- css: {
- fontSize: '28rpx',
- color: '#000',
- // lineHeight: '45rpx',
- // lineClamp: 2,
- // padding: '10rpx',
- // paddingRight: '10rpx',
- width: (uni.$u.sys().windowWidth - 48) + 'px',
- // padding:'10rpx'
- }
- }]
- },
- {
- type: 'view',
- css: {
- marginTop: '20rpx',
- paddingLeft: '10rpx',
- display: 'flex'
- },
- views: [{
- type: 'image',
- src: site_logo,
- css: {
- marginTop: '10rpx',
- marginLeft: '20rpx',
- borderRadius: '16rpx',
- width: '80rpx',
- height: '80rpx',
- border: '2rpx solid #fff',
- objectFit: 'cover'
- }
- },
- {
- type: 'view',
- css: {
- marginTop: '10rpx',
- marginLeft: '20rpx'
- // display:'flex',
- // flexDirection:'column'
- },
- views: [{
- type: 'view',
- views: [{
- type: 'text',
- text: this.appInfo.site_name ? this
- .appInfo
- .site_name : 'AI智能问答机器人',
- css: {
- marginTop: '10rpx',
- fontSize: '28rpx',
- fontWeight: 'bold',
- color: '#32324A',
- lineHeight: '28rpx'
- }
- }]
- },
- {
- type: 'view',
- views: [{
- type: 'text',
- text: '回答结果📝',
- css: {
- marginTop: '15rpx',
- fontSize: '20rpx',
-
- color: '#fff',
- lineHeight: '25rpx',
-
- }
- }]
- }
- ]
- }
- ]
- },
- {
- type: 'view',
- css: {
- marginTop: '20rpx',
- width: (uni.$u.sys().windowWidth - 48) + 'px',
- padding: '15rpx',
- background: '#fff',
- borderRadius: '16rpx',
- marginLeft: '30rpx',
-
- },
- views: [{
- type: 'text',
- text: uni.$u.trim(that.talkList[e].backups),
- css: {
- fontSize: '28rpx',
- color: '#000',
- // lineHeight: '45rpx',
- // lineClamp: 11,
- width: (uni.$u.sys().windowWidth - 48) + 'px',
- // padding: '10rpx',
- }
- }]
- },
- {
- type: 'view',
- css: {
- marginTop: '30rpx',
- width: '100%',
- textAlign: 'center'
- },
- // #ifdef H5
- views: [{
- type: 'qrcode',
- text: this.qrcode,
- css: {
- width: '200rpx',
- height: '200rpx',
- borderRadius: '16rpx',
- }
- }],
- // #endif
- // #ifdef MP-WEIXIN
- views: [{
- type: 'image',
- src: this.qrcode,
- css: {
- width: '200rpx',
- height: '200rpx',
- borderRadius: '16rpx',
- }
- }]
- // #endif
- },
- {
- type: 'text',
- text: '———— ' + '长按识别 | 欢迎使用' + ' ————',
- css: {
- marginTop: '20rpx',
- marginBottom: '20rpx',
- width: '100%',
- textAlign: 'center',
- fontSize: '24rpx',
- color: '#fff',
- lineHeight: '33rpx'
- }
- }
- ]
- }),
- (this.showPoster = true);
- }
- }
- };
- </script>
- <style lang="scss">
- @import '@/pages/chat/global.scss';
- page {
- background-color: #f1f1f1;
- font-size: 28rpx;
- }
- .ask {
- color: #26b3a0;
- margin-top: 22rpx;
- }
- /* 加载数据提示 */
- .tips {
- // bottom: ;
- position: fixed;
- left: 0;
- top: var(--window-top);
- width: 100%;
- z-index: 9;
- background-color: rgba(0, 0, 0, 0.15);
- height: 72rpx;
- line-height: 72rpx;
- transform: translateY(-80rpx);
- transition: transform 0.3s ease-in-out 0s;
- &.show {
- transform: translateY(0);
- }
- }
- .box-1 {
- width: 100%;
- height: auto;
- padding-bottom: 138rpx;
- box-sizing: content-box;
- /* 兼容iPhoneX */
- margin-bottom: 0;
- margin-bottom: constant(safe-area-inset-bottom);
- margin-bottom: env(safe-area-inset-bottom);
- }
- .box-2 {
- position: fixed;
- left: 0;
- width: 100%;
- bottom: 0;
- height: auto;
- // border-radius: 30rpx 30rpx 0 0;
- z-index: 2;
- border-top: #9e9e9e38 solid 1px;
- // border-bottom: #e5e5e5 solid 1px;
- box-sizing: content-box;
- background-color: #ffffff;
- /* 兼容iPhoneX */
- padding-bottom: 0;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- >view {
- padding: 0 20rpx;
- height: 150rpx;
- }
- .content {
- background-color: #f1f1f1;
- height: 64rpx;
- width: 100%;
- padding: 15rpx 20rpx 0;
- border-radius: 32rpx;
- // font-size: 28rpx;
- }
- .send {
- background: linear-gradient(to right, #00ca88, #00BCD4);
- color: #fff;
- height: 75rpx;
- margin-left: 20rpx;
- border-radius: 50rpx;
- padding: 0;
- width: 138rpx;
- font-size: 30rpx;
- font-weight: bold;
- line-height: 75rpx;
- &:active {
- background-color: #26b3a08a;
- }
- }
- }
- .talk-list {
- padding-bottom: 20rpx;
- /* 消息项,基础类 */
- .item {
- padding: 20rpx 20rpx 0 20rpx;
- align-items: flex-start;
- align-content: flex-start;
- color: #333;
- .pic {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- border: #fff solid 1px;
- }
- .content {
- font-weight: bold;
- padding: 15rpx 25rpx;
- border-radius: 4px;
- max-width: 500rpx;
- word-break: break-all;
- line-height: 52rpx;
- position: relative;
- }
- /* 收到的消息 */
- &.pull {
- .time {
- margin-left: 22rpx;
- font-size: 24rpx;
- margin-bottom: 15rpx;
- color: #9e9e9e;
- position: absolute;
- width: 300rpx;
- top: 0rpx;
- left: 0rpx;
- }
- .content {
- margin-left: 22rpx;
- background-color: #fff;
- border-radius: 0px 8px 8px 8px;
- margin-top: 45rpx;
- // &::after{
- // content: '';
- // display: block;
- // width: 0;
- // height: 0;
- // border-top: 16rpx solid transparent;
- // border-bottom: 16rpx solid transparent;
- // border-right: 20rpx solid #fff;
- // position: absolute;
- // top: 30rpx;
- // left: -18rpx;
- // }
- }
- .sentpictures {
- width: 300rpx;
- // height: 237.5rpx;
- margin-left: 22rpx;
- border-radius: 0px 8px 8px 8px;
- margin-top: 46rpx;
- }
- }
- /* 发出的消息 */
- &.push {
- /* 主轴为水平方向,起点在右端。使不修改DOM结构,也能改变元素排列顺序 */
- flex-direction: row-reverse;
- .time {
- margin-right: 22rpx;
- font-size: 24rpx;
- margin-bottom: 15rpx;
- color: #9e9e9e;
- position: absolute;
- width: 300rpx;
- top: 0rpx;
- right: 0rpx;
- display: flex;
- justify-content: flex-end;
- }
- .content {
- margin-right: 22rpx;
- background-color: #26b3a0;
- color: #fff;
- border-radius: 8px 0px 8px 8px;
- margin-top: 45rpx;
- }
- .sentpictures {
- width: 300rpx;
- margin-right: 22rpx;
- border-radius: 8px 0 8px 8px;
- margin-top: 46rpx;
- }
- }
- }
- }
- .flex_photo {
- // width: 80rpx;
- border-radius: 50%;
- background: #f1f1f1;
- padding: 12rpx;
- margin-right: 20rpx;
- }
- .content {
- width: 100%;
- .msg-list {
- // width: 95%;
- // padding: 38rpx 20rpx 237rpx 20rpx;
- padding: 20rpx;
- // position: absolute;
- // top: 0rpx;
- // bottom: 130rpx;
- // margin-bottom: constant(safe-area-inset-bottom);
- // margin-bottom: env(safe-area-inset-bottom);
- .loading {
- //loading动画
- display: flex;
- justify-content: center;
- @keyframes stretchdelay {
- 0%,
- 40%,
- 100% {
- transform: scaleY(0.6);
- }
- 20% {
- transform: scaleY(1);
- }
- }
- .spinner {
- margin: 20rpx 0;
- width: 60rpx;
- height: 100rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- view {
- background-color: #f06c7a;
- height: 50rpx;
- width: 6rpx;
- border-radius: 6rpx;
- animation: stretchdelay 1.2s infinite ease-in-out;
- }
- .rect2 {
- animation-delay: -1.1s;
- }
- .rect3 {
- animation-delay: -1s;
- }
- .rect4 {
- animation-delay: -0.9s;
- }
- .rect5 {
- animation-delay: -0.8s;
- }
- }
- }
- .row {
- .system {
- display: flex;
- justify-content: center;
- view {
- padding: 0 30rpx;
- height: 50rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- background-color: #c9c9c9;
- color: #fff;
- font-size: 24rpx;
- border-radius: 40rpx;
- }
- .red-envelope {
- image {
- margin-right: 5rpx;
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- &:first-child {
- // margin-top: 20rpx;
- }
- padding: 15rpx 0;
- .my .left,
- .other .right {
- width: 86%;
- display: flex;
- .bubble {
- max-width: 90%;
- min-height: 50rpx;
- // border-radius: 13rpx;
- // padding: 22rpx 30rpx;
- display: flex;
- align-items: center;
- font-size: 30rpx;
- word-break: break-word;
- &.img {
- background-color: transparent;
- padding: 0;
- overflow: hidden;
- image {
- max-width: 300rpx;
- // max-height: 350rpx;
- }
- }
- &.red-envelope {
- background-color: transparent;
- padding: 0;
- overflow: hidden;
- position: relative;
- justify-content: center;
- align-items: flex-start;
- image {
- width: 250rpx;
- height: 313rpx;
- }
- .tis {
- position: absolute;
- top: 6%;
- font-size: 26rpx;
- color: #9c1712;
- }
- .blessing {
- position: absolute;
- bottom: 14%;
- color: #e9b874;
- width: 80%;
- text-align: center;
- overflow: hidden;
- // 最多两行
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- }
- }
- &.voice {
- .icon {
- font-size: 40rpx;
- display: flex;
- align-items: center;
- }
- .icon:after {
- content: ' ';
- width: 53rpx;
- height: 53rpx;
- border-radius: 100%;
- position: absolute;
- box-sizing: border-box;
- }
- .length {
- font-size: 28rpx;
- }
- }
- }
- }
- .my .right,
- .other .left {
- flex-shrink: 0;
- // width: 84rpx;
- // height: 84rpx;
- // image {
- // width: 80rpx;
- // height: 80rpx;
- // border-radius: 50%;
- // }
- }
- .my {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- .left {
- min-height: 80rpx;
- flex-wrap: wrap;
- align-items: center;
- justify-content: flex-end;
- .bubbleimg {
- image {
- height: 300rpx;
- width: 400rpx;
- border-radius: 10px 0px 10px 10px;
- }
- }
- .bubble {
- border-radius: 20rpx 0rpx 20rpx 20rpx;
- }
- .username {
- width: 100%;
- height: 48rpx;
- font-size: 26rpx;
- color: #999;
- display: flex;
- justify-content: flex-end;
- .name {
- // margin-right: 50rpx;
- }
- }
- .bubble {
- background: linear-gradient(to right, #00ca88, #00BCD4);
- color: #000;
- font-size: 30rpx;
- &.voice {
- .icon {
- color: #fff;
- }
- .length {
- margin-right: 20rpx;
- }
- }
- &.play {
- @keyframes my-play {
- 0% {
- transform: translateX(80%);
- }
- 100% {
- transform: translateX(0%);
- }
- }
- .icon:after {
- border-left: solid 10rpx rgba(240, 108, 122, 0.5);
- animation: my-play 1s linear infinite;
- }
- }
- }
- }
- .right {
- margin-left: 22rpx;
- }
- }
- .other {
- width: 100%;
- display: flex;
- .bubbleimg {
- image {
- width: 400rpx;
- height: 300rpx;
- border-radius: 0px 10px 10px 10px;
- }
- }
- .bubble {
- border-radius: 0rpx 20rpx 20rpx 20rpx;
- }
- .left {
- margin-right: 22rpx;
- }
- .tip {
- display: flex;
- flex-direction: column;
- position: absolute;
- justify-content: space-between;
- right: -50rpx;
- bottom: 0;
- height: 92rpx;
- }
- .right {
- flex-wrap: wrap;
- .username {
- width: 100%;
- height: 48rpx;
- font-size: 26rpx;
- color: #999;
- display: flex;
- .name {
- // margin-right: 50rpx;
- }
- }
- .bubble {
- // background-color: #fff;
- color: #333;
- &.voice {
- .icon {
- color: #333;
- }
- .length {
- margin-left: 20rpx;
- }
- }
- &.play {
- @keyframes other-play {
- 0% {
- transform: translateX(-80%);
- }
- 100% {
- transform: translateX(0%);
- }
- }
- .icon:after {
- border-right: solid 10rpx rgba(255, 255, 255, 0.8);
- animation: other-play 1s linear infinite;
- }
- }
- }
- }
- }
- .exchange {
- font-weight: bold;
- font-size: 30rpx;
- background: #00000014;
- padding: 15rpx 35rpx;
- border-radius: 45rpx;
- .launch {
- margin-right: 35rpx;
- }
- .agree {
- color: #4095e5;
- margin-right: 25rpx;
- }
- .refuse {
- color: #fe7058;
- }
- }
- }
- }
- }
- .ability {
- width: 100%;
- position: fixed;
- top: 0;
- height: 115rpx;
- background: #ffffff;
- z-index: 9;
- border-bottom: #e5e5e5 solid 1px;
- .item_ability {
- width: 20%;
- .t_ability {
- font-size: 26rpx;
- margin-top: 6rpx;
- }
- }
- }
- .flash {
- margin-left: 2px;
- animation: flash 0.8s linear infinite;
- }
- // 实现光标闪烁
- @keyframes flash {
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
- }
- .neckBtn_view {
- align-items: center;
- display: flex;
- justify-content: center;
- position: fixed;
- flex-direction: column;
- background: linear-gradient(-45deg, #26b3a0, #3edd3e);
- border-radius: 100rpx 0 0 100rpx;
- box-shadow: 0rpx 10rpx 10rpx 0rpx rgba(0, 0, 0, 0.2);
- box-sizing: border-box;
- color: #fff;
- font-size: 25rpx;
- line-height: 30rpx;
- padding: 10rpx 25rpx 10rpx;
- right: 0;
- text-align: center;
- bottom: 415rpx;
- .free_view {
- font-size: 28rpx;
- margin-bottom: 6rpx;
- }
- }
- .poster-img {
- width: 670rpx;
- height: 928rpx;
- position: relative;
- text {
- background: url('https://s.yun-live.com/images/20210201/5c4ef9d86bc5eec90f2f915683d9db08.png') no-repeat;
- background-size: 100% 100%;
- display: inline-block;
- width: 50rpx;
- height: 50rpx;
- position: absolute;
- top: -60rpx;
- right: 0;
- }
- image {
- width: 100%;
- height: 100%;
- }
- view {
- font-size: 32rpx;
- font-family: PingFang-SC-Bold, PingFang-SC;
- font-weight: bold;
- color: #ffffff;
- line-height: 32rpx;
- text-align: center;
- margin-top: 28rpx;
- }
- }
- .poster {
- padding: 40rpx;
- .footer-btn {
- margin-top: 24rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- view {
- width: 319rpx;
- height: 66rpx;
- border-radius: 40rpx;
- border: 1px solid #4070ff;
- font-size: 26rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #4070ff;
- line-height: 66rpx;
- text-align: center;
- }
- .save {
- background: #4070ff;
- color: #ffffff;
- }
- }
- }
- .poster-btn {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 140rpx;
- background: #ffffff;
- border-radius: 32rpx 32rpx 0px 0px;
- display: flex;
- align-items: center;
- justify-content: space-around;
- >view {
- width: 80rpx;
- height: 80rpx;
- position: relative;
- border-radius: 10rpx;
- border: 4rpx solid #fff;
- &.is-check {
- border: 4rpx solid #4070ff;
- }
- image {
- width: 100%;
- height: 100%;
- }
- view {
- width: 30rpx;
- height: 30rpx;
- position: absolute;
- right: -15rpx;
- bottom: -15rpx;
- background: url('https://s.yun-live.com/images/20210201/311c01265c1aa508418f6bae10d67602.png') no-repeat;
- background-size: 100% 100%;
- }
- }
- }
- .select {
- font-weight: bold;
- font-size: 32rpx;
- margin: 30rpx;
- }
- .model_view {
- margin: 30rpx;
- .modelname {
- font-size: 32rpx;
- font-weight: bold;
- width: 56%;
- .name {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .modeldetails {
- font-size: 26rpx;
- font-weight: 500;
- margin-top: 12rpx;
- color: #9e9e9e;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- }
- .modelselect {
- background: #03a9f4;
- border-radius: 14rpx;
- color: #fff;
- width: 58px;
- height: 30px;
- line-height: 30px;
- text-align: center;
- }
- }
- .expand {
- // padding: 20rpx;
- // margin: 20rpx 20rpx 155rpx 20rpx;
- // padding-bottom: env(safe-area-inset-bottom);
- margin-left: 20rpx;
- .surplus {
- font-size: 26rpx;
- background: #fff;
- border-radius: 50rpx;
- padding: 8rpx 12rpx;
- margin-right: 20rpx;
- border: 1px solid #ededed;
- // box-shadow: 0px 0px 10px 3px #f1f1f1;
- .item {
- margin-left: 10rpx;
- }
- // display: inline-block;
- }
- }
- .scroll-view_H {
- white-space: nowrap;
- width: 100%;
- margin-bottom: 177rpx;
- }
- .operate {
- // width: 90%;
- // max-width: 90%;
- margin-top: 12rpx;
- position: relative;
- .dialogue {
- // width: 140rpx;
- // white-space: nowrap;
- // margin-right: 50rpx;
- width: 24px;
- height: 24px;
- background: #68d7bb;
- border-radius: 50%;
- // margin-right: 20rpx;
- }
- .duplicate {
- font-size: 26rpx;
- margin-left: 6rpx;
- color: #9e9e9e;
- }
- .eliseaudio {
- margin-left: 10px;
- }
- .share {
- font-size: 26rpx;
- margin-left: 6rpx;
- color: #9e9e9e;
- }
- .broadcast {
- background: #fff;
- width: 150rpx;
- height: 40rpx;
- border-radius: 60rpx;
- // padding: 0 5rpx;
- .play {
- border-radius: 50%;
- }
- image {
- width: 150rpx;
- height: 40rpx;
- border-radius: 60rpx;
- }
- }
- .hoversubmit {
- background: #9e9e9e61;
- }
- }
- .bottomheight {
- width: 100%;
- height: 217rpx;
- }
- .soundrecording {
- flex-direction: column;
- .discriminate {
- color: #9e9e9e;
- margin-bottom: 30rpx;
- }
- }
- .waveform {
- image {
- width: 468rpx;
- height: 168rpx;
- }
- }
- .operation {
- margin: 60rpx 0 30rpx;
- .affirm {
- margin: 0 42rpx;
- image {
- width: 60rpx;
- height: 60rpx;
- }
- }
- .longpress {
- background: red;
- border-radius: 50%;
- padding: 30rpx;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- .hoversubmit {
- background: #9e9e9e61;
- }
- }
- .env {
- padding-bottom: env(safe-area-inset-bottom);
- }
- .dygbhg {
- background: #ffffff;
- border-radius: 15rpx 15rpx 0 0;
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- box-shadow: 0px 0px 10px #00000024;
- display: flex;
- align-items: center;
- justify-content: space-evenly;
- }
- .whole{
- width: 45%;
- height: 88rpx;
- display: flex;
- color: #ffffff;
- align-items: center;
- justify-content: center;
- background: #f3f3f3;
- font-weight: bold;
- border-radius: 60rpx;
- color: #3d7eff;
- }
- .distinguish {
- width: 45%;
- height: 88rpx;
- display: flex;
- color: #ffffff;
- align-items: center;
- justify-content: center;
- background: #3d7eff;
- font-weight: bold;
- border-radius: 60rpx;
- margin: 38rpx 0;
- margin-left: 4%;
- }
- .mytheme{
- padding: 12px 16px;
- background: #fff;
- border-radius: 0px 11px 11px 11px;
- // overflow: auto;
- }
- .mycopy{
- width: 24px;
- height: 24px;
- background: #4c4c4c30;
- border-radius: 50%;
- margin-right: 12rpx;
- }
- </style>
|