index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. <template>
  2. <view class="content">
  3. <!-- <navigation-custom :config="config" :scrollTop="scrollTopNav" @customConduct="customConduct" :scrollMaxHeight="scrollMaxHeight" /> -->
  4. <scroll-view
  5. id="scrollview"
  6. class="chat-box"
  7. :style="{ height: style.contentViewHeight + 'px' }"
  8. scroll-y="true"
  9. :scroll-with-animation="false"
  10. :scroll-top="scrollTop"
  11. @scrolltoupper="lower()"
  12. >
  13. <view class="auth" v-if="!isAuth">
  14. <text>对不起,您还未登录!请</text>
  15. <button open-type="getUserInfo" @getuserinfo="getUserInfo">授权登录</button>
  16. </view>
  17. <!-- <view class="tips-box">
  18. {{nowTime}}
  19. </view> -->
  20. <!-- <view class="tips-box tips-title">
  21. 您好,智能投顾很高兴为您服务!
  22. </view> -->
  23. <!-- <view class="talk-box">
  24. <view class="talk-head-box">
  25. <image src="../../static/rabotHead.png" mode="" class="talk-head"></image>
  26. </view>
  27. <view class="talk-content">您好,欢迎您使用阿拉灯神丁。我可以给您提供股票投资建议,快来试试吧。</view>
  28. </view> -->
  29. <view v-for="chat in talkList" :key="chat.talkType" class="m-item">
  30. <view class="talk-box talk-box-end" v-show="chat.content">
  31. <view class="talk-reply">{{ chat.content }}</view>
  32. <view class="talk-head-box"><image :src="userHeadUrl" mode="" class="talk-head" @click.stop="goUserSelf"></image></view>
  33. </view>
  34. <view class="talk-box">
  35. <view class="talk-head-box"><image :src="rabotHeadImg" mode="" class="talk-head"></image></view>
  36. <view class="talk-content">
  37. {{ chat.reply }}
  38. <text class="goRechargeText" v-if="chat.isRecharge" @click.stop="goSharePage()">去分享</text>
  39. </view>
  40. </view>
  41. </view>
  42. </scroll-view>
  43. <view class="send-box" :style="{ 'padding-bottom': isShowKeyBoard + 'px' }">
  44. <image :src="[!isVoiceType ? '/static/icon/voice-icon.png' : '/static/icon/keyBoard-icon.png']" @click.stop="tabVoice()"></image>
  45. <view class="voice-mode" v-if="isVoiceType" @click="asrStart">语音识别</view>
  46. <!-- <view>{{arsRes}}</view> -->
  47. <!-- 语音识别 -->
  48. <wechat-asr ref="weixinAsr" @callback="asrResult" />
  49. <input
  50. type="text"
  51. v-if="!isVoiceType"
  52. class="enter-box"
  53. v-model="inputInfo"
  54. :adjust-position="true"
  55. @focus="isNeedAuth()"
  56. :style="{ width: inputWidth }"
  57. confirm-hold="true"
  58. confirm-type="send"
  59. @confirm="sendInputInfo"
  60. />
  61. <!-- @input='isInputing' -->
  62. <!-- <button type="primary" class="submit-message" @click="sendInputInfo()" v-if='isShowSend'>发送</button> -->
  63. <image src="/static/setIcon.png" @click.stop="openModal()" v-if="isShowSetCenter"></image>
  64. </view>
  65. <view>
  66. <uni-popup ref="showCountsModal" type="center" :custom="true">
  67. <view class="uni-tip everyDay-box">
  68. <image src="/static/rabotHead.png" mode="aspectFit"></image>
  69. <view>恭喜你获取{{ everyDayCounts }}次查询机会</view>
  70. <button type="default" @click.stop="addEveryDayCounts">我知道啦</button>
  71. </view>
  72. </uni-popup>
  73. </view>
  74. <!-- 录音UI效果
  75. <view class="record" :class="recording?'':'hidden'">
  76. <view class="ing" :class="willStop?'hidden':''"><image src="../../static/icon/send-icon.png" style="width: 64rpx;height: 64rpx;"></image></view>
  77. <view class="cancel" :class="willStop?'':'hidden'"><image src="../../static/icon/cancel-icon.png" style="width: 64rpx;height: 64rpx;"></image></view>
  78. <view class="tis" :class="willStop?'change':''">{{recordTis}}</view>
  79. </view> -->
  80. <!-- <drag-button :isDock="true" :existTabBar="true" @btnClick="goUserSelf" /> -->
  81. <uni-popup ref="popup" type="bottom">
  82. <view class="uni-share">
  83. <view class="uni-share-content">
  84. <view class="uni-share-content-box" @click.stop="goUserSelf">
  85. <view class="uni-share-content-image"><image src="/static/icon/userSetIcon.png" class="image" /></view>
  86. <view class="uni-share-content-text">个人中心</view>
  87. </view>
  88. <view class="uni-share-content-box" @click.stop="goSharePage">
  89. <view class="uni-share-content-image"><image src="/static/icon/share-icon.png" class="image" /></view>
  90. <view class="uni-share-content-text">去分享</view>
  91. </view>
  92. <!-- <view class="uni-share-content-box" @click.stop='tabVoice' >
  93. <view class="uni-share-content-image">
  94. <image src="/static/icon/userSetIcon.png" class="image" />
  95. </view>
  96. <view class="uni-share-content-text">语音输入</view>
  97. </view> -->
  98. <view class="uni-share-content-box" @click.stop="cleanChatRecord()">
  99. <view class="uni-share-content-image"><image src="/static/icon/clean-icon.png" class="image" /></view>
  100. <view class="uni-share-content-text">清空</view>
  101. </view>
  102. <!-- <view class="uni-share-content-box" @click.stop='goRecharge' v-if="!isIos">
  103. <view class="uni-share-content-image">
  104. <image src="/static/icon/recharge.png" class="image" />
  105. </view>
  106. <view class="uni-share-content-text">去充值</view>
  107. </view> -->
  108. </view>
  109. <view class="uni-share-btn" @click="cancelModal()">取消</view>
  110. </view>
  111. </uni-popup>
  112. </view>
  113. </template>
  114. <script>
  115. import uniPopup from "@/components/uni-popup/uni-popup.vue"
  116. import WechatAsr from '../chat/chat.vue';
  117. var md5 = require("../../common/md5.js");
  118. var page = 1;
  119. const recorderManager = uni.getRecorderManager();
  120. const innerAudioContext = uni.createInnerAudioContext();
  121. export default {
  122. data() {
  123. return {
  124. isShowSend:false,
  125. isShowSetModal:false,
  126. isShowSetCenter:true,
  127. isShowRecharge:false,
  128. inputWidth:'70%',
  129. title: 'RABOT',
  130. nowTime: '',
  131. nowHeight: '622px',
  132. inputInfo: '',
  133. isShowKeyBoard:0,
  134. rabotHeadImg: "../../static/rabotHead.png",
  135. userHeadUrl: getApp().globalData.user_headUrl || '../../static/userDefault.png',
  136. talkList: [],
  137. scrollTopNav: 0, // 当linear为true的时候需要通过onpagescroll传递参数
  138. scrollMaxHeight: 200 ,//滑动的高度限制,超过这个高度即背景全部显示
  139. scrollTop:0,
  140. scrollRequestEnable: true,
  141. pageSize:10,
  142. isIos:Boolean,
  143. style: {
  144. pageHeight: 0,
  145. contentViewHeight: 0,
  146. footViewHeight: 90,
  147. mitemHeight: 0
  148. },
  149. isAuth:true,
  150. iv:'',
  151. session_key:'',
  152. encryptedData:'',
  153. //录音相关参数
  154. isVoiceType:false,
  155. RECORDER:uni.getRecorderManager(),
  156. isVoice:false,
  157. voiceTis:'按住 说话',
  158. recordTis:"手指上滑 取消发送",
  159. recording:false,
  160. willStop:false,
  161. initPoint:{identifier:0,Y:0},
  162. recordTimer:null,
  163. recordLength:0,
  164. //播放语音相关参数
  165. AUDIO:uni.createInnerAudioContext(),
  166. playMsgid:null,
  167. VoiceTimer:null,
  168. voicePath: '',
  169. arsRes: '',
  170. inviteId:'',
  171. everyDayCounts:''
  172. }
  173. },
  174. components: {
  175. uniPopup,
  176. WechatAsr
  177. },
  178. onPageScroll(e) {
  179. this.scrollTopNav = e.scrollTop;
  180. },
  181. onShareAppMessage(){
  182. return {
  183. title: '阿拉灯神丁',
  184. path: '/pages/index/index?inviteId=' + getApp().globalData.user_id
  185. }
  186. },
  187. onLoad(options) {
  188. if(options.inviteId){
  189. this.inviteId = options.inviteId;
  190. }
  191. this.userLogin();
  192. this.getEquipmentHeight();
  193. },
  194. onShow() {
  195. //this.getNowTime();
  196. this.userHeadUrl = getApp().globalData.user_headUrl || '../../static/userDefault.png',
  197. getApp().globalData.isAuth ? this.isAuth = true : this.isAuth = false ;
  198. getApp().globalData.user_id ? this.getUserStorage(): this.isAuth = false ;
  199. getApp().globalData.isAuth ? this.getHistory() : this.isAuth = false ;
  200. },
  201. methods: {
  202. userLogin(){
  203. uni.showLoading({})
  204. uni.login({
  205. success: (res) => {
  206. this.getCodeRabot(res)
  207. }
  208. });
  209. },
  210. // 获取用户信息
  211. getUserInfo(e) {
  212. console.log(e);
  213. if (e.detail.errMsg == "getUserInfo:ok") {
  214. this.iv = e.detail.iv;
  215. this.encryptedData = e.detail.encryptedData;
  216. this.loginUserInfo()
  217. } else {
  218. console.log("用户信息授权失败");
  219. this.isShowAuthBtn = true;
  220. }
  221. },
  222. loginUserInfo(){
  223. let that = this;
  224. uni.request({
  225. url:getApp().globalData.shareUrl, //需要设置为全局
  226. method: 'POST',
  227. header: {
  228. 'content-type': 'application/x-www-form-urlencoded'
  229. },
  230. data: {
  231. method: 'auth',
  232. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  233. uid:getApp().globalData.user_id,
  234. sign: md5('auth' + getApp().globalData.globalTimestamp),
  235. nickname:getApp().globalData.user_name,
  236. headimg:getApp().globalData.user_headUrl,
  237. iv:that.iv,
  238. session_key:that.session_key,
  239. encryptedData:that.encryptedData,
  240. invited:that.inviteId
  241. },
  242. success: res => {
  243. that.isAuth = true;
  244. getApp().globalData.user_id = res.data.msg.id;
  245. getApp().globalData.open_id = res.data.msg.openid;
  246. getApp().globalData.isAuth = that.isAuth;
  247. getApp().globalData.times = res.data.msg.times;
  248. getApp().globalData.total_times = res.data.msg.total_times;
  249. getApp().globalData.user_headUrl = res.data.msg.headimg;
  250. getApp().globalData.user_name = res.data.msg.name;
  251. that.userHeadUrl = res.data.msg.headimg || '../../static/userDefault.png';
  252. that.getUserStorage();
  253. that.getHistory();
  254. }
  255. });
  256. },
  257. getCodeRabot(res){
  258. let that = this;
  259. uni.request({
  260. url:getApp().globalData.shareUrl, //需要设置为全局
  261. method: 'POST',
  262. header: {
  263. 'content-type': 'application/x-www-form-urlencoded'
  264. },
  265. data: {
  266. method: 'login',
  267. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  268. code: res.code,
  269. sign: md5('login' + getApp().globalData.globalTimestamp),
  270. },
  271. success: res => {
  272. var isAuth = res.data.msg.isauth === 1;
  273. that.session_key = res.data.msg.session_key;
  274. if(isAuth){
  275. this.isAuth = true;
  276. getApp().globalData.user_id = res.data.msg.id;
  277. getApp().globalData.open_id = res.data.msg.openid;
  278. getApp().globalData.isAuth = true;
  279. getApp().globalData.times = res.data.msg.times;
  280. getApp().globalData.total_times = res.data.msg.total_times;
  281. getApp().globalData.user_headUrl = res.data.msg.headimg;
  282. getApp().globalData.user_name = res.data.msg.name;
  283. that.userHeadUrl = res.data.msg.headimg || '../../static/userDefault.png';
  284. that.getUserStorage();
  285. that.getHistory();
  286. }else{
  287. getApp().globalData.session_key = res.data.msg.session_key;
  288. that.isAuth = isAuth;
  289. getApp().globalData.isAuth = isAuth;
  290. wx.hideLoading();
  291. }
  292. }
  293. });
  294. },
  295. getNowTime() {
  296. let time = new Date();
  297. let y = time.getFullYear();
  298. let m = time.getMonth() + 1;
  299. let d = time.getDate();
  300. let h = time.getHours();
  301. let i = time.getMinutes();
  302. i = i > 10 ? i : '0' + i;
  303. this.nowTime = y + "年" + m + "月" + d + "日" + " " + h + ":" + i
  304. },
  305. getUserStorage(){
  306. let that = this
  307. uni.getStorage({
  308. key: 'getTime',
  309. success: function (res) {
  310. let nowTime = Date.now();
  311. let lastTime = res.data;
  312. if(nowTime - lastTime >= 86400000){
  313. that.getEveryDayCounts()
  314. }else {
  315. return false
  316. }
  317. },
  318. fail:function () {
  319. that.getEveryDayCounts()
  320. }
  321. });
  322. },
  323. getEveryDayCounts(){
  324. let that = this;
  325. uni.request({
  326. url: getApp().globalData.shareUrl, //需要设置为全局
  327. method: 'POST',
  328. header: {
  329. 'content-type': 'application/x-www-form-urlencoded'
  330. },
  331. data: {
  332. method: 'add_freegive_times',
  333. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  334. uid: getApp().globalData.user_id,
  335. sign: md5('add_freegive_times' + getApp().globalData.globalTimestamp),
  336. },
  337. success: res => {
  338. if(res.data.code === 200){
  339. that.everyDayCounts = res.data.msg.times;
  340. that.$refs.showCountsModal.open();
  341. uni.setStorage({
  342. key: 'getTime',
  343. data:Date.now(),
  344. success: function () {
  345. console.log('success');
  346. //that.$refs.showCountsModal.close()
  347. }
  348. });
  349. }
  350. else {
  351. uni.showToast({
  352. title:res.data.msg,
  353. icon:'none',
  354. duration:1500
  355. })
  356. }
  357. }
  358. });
  359. },
  360. addEveryDayCounts(){
  361. console.log('已领取');
  362. this.$refs.showCountsModal.close()
  363. },
  364. getEquipmentHeight() {
  365. const height = uni.getSystemInfoSync().windowHeight;
  366. this.nowHeight = height + 'px';
  367. getApp().globalData.glbalHeight = this.nowHeight;
  368. this.style.pageHeight = height;
  369. this.style.contentViewHeight = height - uni.getSystemInfoSync().screenWidth / 750 * (100) -7; //像素 因为给出的是像素高度 然后我们用的是upx 所以换算一下
  370. },
  371. scrollToBottom() {
  372. let that = this;
  373. let query = uni.createSelectorQuery();
  374. query.selectAll('.m-item').boundingClientRect();
  375. query.select('#scrollview').boundingClientRect();
  376. query.exec((res) => {
  377. that.style.mitemHeight = 0;
  378. res[0].forEach((rect) => that.style.mitemHeight = that.style.mitemHeight + rect.height + 40) //获取所有内部子元素的高度
  379. // 因为vue的虚拟DOM 每次生成的新消息都是之前的,所以采用异步setTimeout 主要就是添加了这红字
  380. that.scrollTop = that.style.mitemHeight - that.style.contentViewHeight
  381. // setTimeout(() => {
  382. // if (that.style.mitemHeight > (that.style.contentViewHeight - 100)) { //判断子元素高度是否大于显示高度
  383. // that.scrollTop = that.style.mitemHeight - that.style.contentViewHeight //用子元素的高度减去显示的高度就获益获得序言滚动的高度
  384. // }
  385. // }, 100)
  386. })
  387. },
  388. getHistory(isShow) {
  389. // if(getApp.globalData.isAuth){this.isAuth = true}
  390. let that = this;
  391. uni.request({
  392. url: getApp().globalData.shareUrl, //需要设置为全局
  393. method: 'POST',
  394. header: {
  395. 'content-type': 'application/x-www-form-urlencoded'
  396. },
  397. data: {
  398. method: 'question_list',
  399. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  400. uid: getApp().globalData.user_id,
  401. sign: md5('question_list' + getApp().globalData.globalTimestamp),
  402. page: page || 1,
  403. pageSize: 10,
  404. },
  405. success: res => {
  406. uni.hideLoading()
  407. that.isIos = getApp().globalData.isIos;
  408. if(isShow){
  409. res.data.msg[0].isRecharge = 1
  410. }
  411. if(page === 1){
  412. that.scrollRequestEnable = true;
  413. that.talkList = ((res.data.msg).reverse());
  414. setTimeout(()=>{
  415. that.scrollToBottom()
  416. },100)
  417. }else if (page > 1 && res.data.msg.length === that.pageSize) {
  418. that.scrollRequestEnable = true;
  419. that.talkList.unshift(...((res.data.msg).reverse()));
  420. }else if (page > 1 && (res.data.msg.length > 0) && (res.data.msg.length < that.pageSize)){
  421. that.scrollRequestEnable = true;
  422. that.talkList.unshift(...((res.data.msg).reverse()));
  423. }else if (page > 1 && res.data.msg.length == 0){
  424. that.scrollRequestEnable = false;
  425. }
  426. }
  427. });
  428. },
  429. goUserSelf() {
  430. this.$refs.popup.close()
  431. uni.navigateTo({
  432. url: '../selfInfo/selfInfo'
  433. })
  434. },
  435. goRecharge() {
  436. this.$refs.popup.close()
  437. uni.navigateTo({
  438. url: '../selfInfo/payList/payList'
  439. })
  440. },
  441. sendMsgRequest(msg) {
  442. if(getApp().globalData.user_id=='') return false;
  443. let that = this;
  444. uni.request({
  445. url: getApp().globalData.shareUrl, //需要设置为全局
  446. method: 'POST',
  447. header: {
  448. 'content-type': 'application/x-www-form-urlencoded'
  449. },
  450. data: {
  451. method: 'question',
  452. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  453. uid: getApp().globalData.user_id,
  454. sign: md5('question' + getApp().globalData.globalTimestamp),
  455. content: msg
  456. },
  457. success: res => {
  458. if(res.data.code === 100){
  459. that.isShowRecharge = true;
  460. that.inputInfo = '';
  461. that.getHistory('show');
  462. }else {
  463. that.inputInfo = '';
  464. that.getHistory();
  465. that.isShowRecharge = false
  466. }
  467. }
  468. });
  469. },
  470. sendInputInfo() {
  471. // this.inputWidth = '80%';
  472. // this.isShowSend = false;
  473. // this.isShowSetCenter = true;
  474. if (!this.inputInfo) {
  475. uni.showToast({
  476. title: '请输入股票代码',
  477. icon: 'none'
  478. });
  479. } else {
  480. page = 1;
  481. this.sendMsgRequest(this.inputInfo)
  482. }
  483. },
  484. isInputing(){
  485. if (this.inputInfo) {
  486. this.inputWidth = '72%';
  487. this.isShowSend = true;
  488. this.isShowSetCenter = false;
  489. } else {
  490. this.inputWidth = '80%';
  491. this.isShowSend = false;
  492. this.isShowSetCenter = true;
  493. }
  494. },
  495. isNeedAuth(){
  496. console.log(this.isAuth)
  497. if(!this.isAuth){
  498. setTimeout(()=>{
  499. uni.navigateTo({
  500. url: '../auth/index',
  501. success: res => {},
  502. fail: () => {},
  503. complete: () => {}
  504. });
  505. },500)
  506. }
  507. },
  508. // 滚动至底部触发的事件
  509. lower() {
  510. if (this.scrollRequestEnable) {
  511. // 允许滚动时,触底page加一,重新请求数据
  512. console.log(666)
  513. page++;
  514. this.getHistory();
  515. } else {
  516. // 不允许滚动时,只显示"到底了"提示
  517. // this.showBottem = true
  518. console.log('noData')
  519. }
  520. },
  521. getInputFocus(e){
  522. //this.isShowKeyBoard = e.detail.height
  523. },
  524. getInputBlur(){
  525. //this.isShowKeyBoard = 0
  526. },
  527. goSharePage(){
  528. uni.navigateTo({
  529. url: '../share/sharePage',
  530. success: res => {},
  531. fail: () => {},
  532. complete: () => {}
  533. });
  534. },
  535. tabVoice(){
  536. this.isVoiceType = !this.isVoiceType;
  537. },
  538. clearChat(){
  539. },
  540. openModal(){
  541. // 需要在 popup 组件,指定 ref 为 popup
  542. if(!this.isAuth){
  543. uni.navigateTo({
  544. url: '../auth/index',
  545. success: res => {},
  546. fail: () => {},
  547. complete: () => {}
  548. });
  549. }else {
  550. this.$refs.popup.open();
  551. }
  552. },
  553. cancelModal(){
  554. // 需要在 popup 组件,指定 ref 为 popup
  555. this.$refs.popup.close();
  556. },
  557. //情况聊天记录
  558. cleanChatRecord(){
  559. if(getApp().globalData.user_id=='') return false;
  560. let that = this;
  561. uni.request({
  562. url: getApp().globalData.shareUrl, //需要设置为全局
  563. method: 'POST',
  564. header: {
  565. 'content-type': 'application/x-www-form-urlencoded'
  566. },
  567. data: {
  568. method: 'clear_question',
  569. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  570. uid: getApp().globalData.user_id,
  571. sign: md5('clear_question' + getApp().globalData.globalTimestamp),
  572. },
  573. success: res => {
  574. console.log(res)
  575. if(res.data.code === 200){
  576. uni.showToast({
  577. title: '清除成功',
  578. icon:'none',
  579. duration:1500
  580. });
  581. that.$refs.popup.close();
  582. page = 1;
  583. that.getHistory();
  584. }else{
  585. uni.showToast({
  586. title: res.data.msg,
  587. icon:'none',
  588. duration:1500
  589. });
  590. }
  591. }
  592. });
  593. },
  594. // 语音识别
  595. asrStart () {
  596. this.$refs.weixinAsr.show();
  597. },
  598. asrResult (res) {
  599. //this.arsRes = res;
  600. res = res.substring(0,res.length-1)
  601. page = 1;
  602. this.sendMsgRequest(res)
  603. }
  604. },
  605. onShareAppMessage(){
  606. }
  607. }
  608. </script>
  609. <style>
  610. .content {
  611. text-align: center;
  612. }
  613. .chat-box {
  614. background: #f4f5f7;
  615. padding-top: 3%;
  616. /* padding-bottom: 100upx; */
  617. }
  618. .tips-box {
  619. background: #d5d5da;
  620. font-size: 28upx;
  621. color: #fff;
  622. border-radius: 30upx;
  623. width: 50%;
  624. margin: 0 auto;
  625. height: 50rpx;
  626. line-height: 50rpx;
  627. }
  628. .tips-title {
  629. width: 70%;
  630. margin-top: 5%;
  631. font-size: 30rpx;
  632. height: 70rpx;
  633. line-height: 70rpx;
  634. }
  635. .send-box {
  636. width: 100%;
  637. height: 90rpx;
  638. position: fixed;
  639. bottom: 0;
  640. background: #f4f0ed;
  641. display: flex;
  642. align-items: center;
  643. padding: 2upx;
  644. }
  645. .talk-box {
  646. display: flex;
  647. justify-content: flex-start;
  648. align-items: center;
  649. margin-top: 3%;
  650. }
  651. .talk-box-end {
  652. justify-content: flex-end;
  653. }
  654. .talk-head-box {
  655. width: 80rpx;
  656. height: 80rpx;
  657. border-radius: 30rpx;
  658. margin-left: 2%;
  659. margin-right: 2%;
  660. }
  661. .talk-head {
  662. width: 100%;
  663. height: 100%;
  664. border-radius: 50%;
  665. }
  666. .talk-content {
  667. padding: 2%;
  668. background: #fff;
  669. font-size: 28rpx;
  670. border-top-right-radius: 20rpx;
  671. border-bottom-left-radius: 20rpx;
  672. border-bottom-right-radius: 20rpx;
  673. text-align: left;
  674. max-width: 70%;
  675. }
  676. .talk-reply {
  677. padding: 2%;
  678. background: #9eea6a;
  679. font-size: 28rpx;
  680. border-top-left-radius: 20rpx;
  681. border-bottom-left-radius: 20rpx;
  682. border-bottom-right-radius: 20rpx;
  683. text-align: left;
  684. max-width: 70%;
  685. }
  686. .goRechargeText {
  687. color: #0a98d5;
  688. }
  689. .enter-box {
  690. height: 70rpx;
  691. background: #fff;
  692. border-radius: 1%;
  693. text-align: left;
  694. margin: 8px;
  695. margin-bottom: 10px;
  696. padding-left: 8px;
  697. }
  698. .send-box image {
  699. width: 60rpx;
  700. height: 60rpx;
  701. margin-right: 10upx;
  702. margin-left: 10upx;
  703. }
  704. .submit-message {
  705. width: 18%;
  706. margin-right: 20upx;
  707. height: 70rpx;
  708. font-size: 28rpx;
  709. line-height: 70rpx;
  710. color: #fff;
  711. background-color: #0a98d5 !important;
  712. }
  713. .logo {
  714. height: 200upx;
  715. width: 200upx;
  716. margin-top: 200upx;
  717. margin-left: auto;
  718. margin-right: auto;
  719. margin-bottom: 50upx;
  720. }
  721. .text-area {
  722. display: flex;
  723. justify-content: center;
  724. }
  725. .title {
  726. font-size: 36upx;
  727. color: #8f8f94;
  728. }
  729. .uniFab {
  730. width: 98px;
  731. height: 36px;
  732. background: rgba(231, 247, 236, 1);
  733. box-shadow: -6px 5px 74px 0px rgba(60, 188, 99, 0.08);
  734. border-radius: 100px 0px 0px 100px;
  735. right: 0upx;
  736. position: fixed;
  737. z-index: 9999;
  738. top: 50%;
  739. display: flex;
  740. justify-content: center;
  741. align-items: center;
  742. }
  743. .uniFab text {
  744. width: 64px;
  745. font-size: 16px;
  746. font-family: PingFangSC;
  747. font-weight: 600;
  748. color: rgba(60, 188, 99, 1);
  749. text-shadow: 0px 1px 2px rgba(12, 39, 20, 0.2);
  750. }
  751. .uni-share-content {
  752. display: flex;
  753. flex-wrap: wrap;
  754. padding: 15px;
  755. /* justify-content: center */
  756. }
  757. .uni-share-content-box {
  758. display: flex;
  759. flex-direction: column;
  760. align-items: center;
  761. width: 25%;
  762. box-sizing: border-box;
  763. }
  764. .uni-share-content-image {
  765. display: flex;
  766. justify-content: center;
  767. align-items: center;
  768. width: 60upx;
  769. height: 60upx;
  770. overflow: hidden;
  771. border-radius: 10upx;
  772. }
  773. .uni-share-content-image .image {
  774. width: 100%;
  775. height: 100%;
  776. }
  777. .uni-share-content-text {
  778. font-size: 26upx;
  779. color: #333;
  780. padding-top: 5px;
  781. padding-bottom: 10px;
  782. }
  783. .uni-share-btn {
  784. height: 90upx;
  785. line-height: 90upx;
  786. border-top: 1px #f5f5f5 solid;
  787. text-align: center;
  788. color: #666;
  789. font-size: 30rpx;
  790. }
  791. /* .placeHolder {
  792. padding:2px
  793. } */
  794. .auth {
  795. display: flex;
  796. flex-direction: row;
  797. font-size: 14px;
  798. justify-content: center;
  799. align-items: center;
  800. background-color: #eee;
  801. }
  802. .auth button {
  803. font-size: 14px;
  804. padding: 0px;
  805. margin: 0px;
  806. color: #007aff;
  807. background-color: #eee;
  808. }
  809. .auth button:after {
  810. border: 0px;
  811. }
  812. .voice-mode {
  813. width: 70%;
  814. height: 70rpx;
  815. background: #fff;
  816. border-radius: 1%;
  817. text-align: left;
  818. margin: 8px;
  819. margin-bottom: 10px;
  820. padding-left: 8px;
  821. text-align: center;
  822. line-height: 70upx;
  823. font-size: 30upx;
  824. }
  825. .icon {
  826. font-family: 'HMfont-home' !important;
  827. font-size: 56upx;
  828. font-style: normal;
  829. color: #333;
  830. }
  831. .hidden {
  832. display: none !important;
  833. }
  834. .record {
  835. width: 40vw;
  836. height: 40vw;
  837. position: fixed;
  838. top: 55%;
  839. left: 30%;
  840. background-color: rgba(0, 0, 0, 0.6);
  841. border-radius: 20upx;
  842. }
  843. .ing {
  844. width: 100%;
  845. height: 30vw;
  846. display: flex;
  847. justify-content: center;
  848. align-items: center;
  849. // 模拟录音音效动画
  850. }
  851. @keyframes volatility {
  852. 0% {
  853. background-position: 0% 130%;
  854. }
  855. 20% {
  856. background-position: 0% 150%;
  857. }
  858. 30% {
  859. background-position: 0% 155%;
  860. }
  861. 40% {
  862. background-position: 0% 150%;
  863. }
  864. 50% {
  865. background-position: 0% 145%;
  866. }
  867. 70% {
  868. background-position: 0% 150%;
  869. }
  870. 80% {
  871. background-position: 0% 155%;
  872. }
  873. 90% {
  874. background-position: 0% 140%;
  875. }
  876. 100% {
  877. background-position: 0% 135%;
  878. }
  879. }
  880. .cancel {
  881. width: 100%;
  882. height: 30vw;
  883. display: flex;
  884. justify-content: center;
  885. align-items: center;
  886. }
  887. .icon {
  888. background-image: linear-gradient(to bottom, #f09b37, #fff 50%);
  889. background-size: 100% 200%;
  890. animation: volatility 1.5s ease-in-out -1.5s infinite alternate;
  891. -webkit-background-clip: text;
  892. -webkit-text-fill-color: transparent;
  893. font-size: 150upx;
  894. color: #f09b37;
  895. }
  896. .tis {
  897. width: 100%;
  898. height: 10vw;
  899. display: flex;
  900. justify-content: center;
  901. font-size: 28upx;
  902. color: #fff;
  903. }
  904. .change {
  905. color: #f09b37;
  906. }
  907. .everyDay-box {
  908. background: #fff;
  909. padding: 20px;
  910. border-radius: 5%;
  911. }
  912. .everyDay-box image {
  913. width: 240rpx;
  914. height: 240rpx;
  915. }
  916. .everyDay-box view {
  917. font-size: 28rpx;
  918. }
  919. .everyDay-box button {
  920. font-size: 28rpx;
  921. margin-top: 5%;
  922. color: #fff;
  923. background: #00bfff;
  924. }
  925. </style>