generate.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968
  1. <template>
  2. <view>
  3. <!-- <wike-skeleton :count="5" v-if="!applayList.length"></wike-skeleton> -->
  4. <!-- <view class="form u-flex align-center justify-center" :style="{height: windowHeight+'px'}"
  5. v-if="appInfo.page_template == 1 || !appInfo.page_template"> -->
  6. <view class="form u-flex align-center justify-center" :style="{height: windowHeight+'px'}"
  7. v-if="appInfo.page_template == 1">
  8. <view class="top-notice" v-if="appInfo && appInfo.notice"><u-notice-bar
  9. :text="appInfo.notice"></u-notice-bar></view>
  10. <view class="logo"><u--image :src="appInfo.site_logo_path?appInfo.site_logo_path:'/static/images/head.jpg'"
  11. shape="circle" width="200rpx" height="200rpx"></u--image></view>
  12. <u-transition :show="true" mode="slide-left">
  13. <view class="title">{{ appInfo.site_name?appInfo.site_name:'AI问答机器人' }}</view>
  14. </u-transition>
  15. <u-transition :show="true" mode="slide-right">
  16. <view class="desc">{{ appInfo.sub_title }}</view>
  17. </u-transition>
  18. <view class="btn-group">
  19. <view class="btn" @click="onToForm"><u-button shape="circle" iconColor="#ffffff" color="#207CF7"
  20. icon="chat" text="立即提问"></u-button></view>
  21. <view v-if="appInfo.is_aipainting&&appInfo.is_aipainting == 1" class="btn" @click="ondraw"><u-button
  22. shape="circle" iconColor="#ffffff" color="#ffc107" icon="edit-pen-fill" text="AI绘画"></u-button>
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if="appInfo.page_template == 2 || appInfo.page_template == 3" style="background:#F4F7FC;">
  27. <view class="newTop">
  28. <view class="topTitle" :style="{paddingTop:isWx?'0':'53rpx',marginBottom:isWx?'0':'32rpx'}">
  29. <view class="" v-if="!isWx">
  30. AI人工智能助手
  31. </view>
  32. </view>
  33. <view class="overBox" style="">
  34. <u-notice-bar style="" bgColor='#C6D6E4' color='#3F5465' v-if="appInfo && appInfo.notice"
  35. :text="appInfo.notice" :playState="playState" @over="handleOver"
  36. @out="handleOut"></u-notice-bar>
  37. </view>
  38. </view>
  39. <view class="directask">
  40. <view class="addBg" style="padding-left: 0;padding-right: 0;">
  41. <!-- 📝 -->
  42. <view class="askaquestion u-flex align-center justify-between quesTop" style="">
  43. <!-- 🔥 -->
  44. <view class="u-flex align-center" style="align-items:center;">
  45. <image src="/static/newIndex/quesIcon.png" mode="" style="width: 60rpx;height: 68rpx;">
  46. </image>
  47. <view class="quesRight" style="display: flex;align-items: center;">
  48. <view class="quesTxt">直接提问</view>
  49. <image src="/static/newIndex/dian.png" mode=""
  50. style="height: 30rpx; height: 12rpx;margin-left: 10rpx;">
  51. </image>
  52. </view>
  53. </view>
  54. <block v-if="showchat4">
  55. <view class="modalTag" @click="showsheet = true">
  56. <view class="tagTxt" :class="[!isPc?'mw':'']">
  57. {{currentmodel}}
  58. </view>
  59. <image style="width: 22rpx;height: 12rpx;margin-left: 14rpx;"
  60. src="/static/newIndex/arrDown.png" mode=""></image>
  61. </view>
  62. </block>
  63. <block v-else-if="showchat35">
  64. <view class="modalTag" @click="showsheet = true">
  65. <view class="tagTxt" :class="[!isPc?'mw':'']">
  66. {{currentmodel}}
  67. </view>
  68. <image style="width: 22rpx;height: 12rpx;margin-left: 14rpx;"
  69. src="/static/newIndex/arrDown.png" mode=""></image>
  70. </view>
  71. </block>
  72. <!-- 文心一言 -->
  73. <block v-else>
  74. <view class="modalTag" @click="showsheet = true">
  75. <view class="tagTxt" :class="[!isPc?'mw':'']">
  76. {{currentmodel}}
  77. </view>
  78. <image style="width: 22rpx;height: 12rpx;margin-left: 14rpx;"
  79. src="/static/newIndex/arrDown.png" mode="">
  80. </image>
  81. </view>
  82. </block>
  83. </view>
  84. <view class="textarea">
  85. <view class="inputTxtBox">
  86. <u--textarea @focus="focustextarea" maxlength="-1" v-model="valuechat" height="100"
  87. border="none" :placeholder="placeholder"></u--textarea>
  88. <image v-if="valuechat" @click="valuechat = ''" class="clearImg" src="/static/clear.png"
  89. mode=""></image>
  90. </view>
  91. <!-- <view class="operate u-flex align-center">
  92. <view v-if="appInfo.page_template == 3" style="margin-right: 32rpx;">
  93. <u--image :showLoading="true" :src="homeTemplate1.mode[selectornot].img_file.path"
  94. width="30" height="30" @click="switchmodel = true" shape="circle"></u--image>
  95. </view>
  96. </view> -->
  97. <view class="clearAndSumBtn">
  98. <view @click="onSubmit(valuechat)" hover-class="hoversubmit" class="submit">
  99. {{tapsubmit}}
  100. </view>
  101. <view class="rClear">
  102. <image @click.stop="goLead" src="/static/wenhao.png" mode=""
  103. style="width: 52rpx;height: 52rpx;"></image>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. <!-- <view v-if="appInfo.page_template == 3" style="margin-bottom: 16px">
  109. <u-alert :title="appInfo.notice" type="warning" effect="dark"></u-alert>
  110. </view> -->
  111. <block v-if="appInfo.page_template == 2">
  112. <view class="askaquestion u-flex align-center justify-between" style="margin-bottom: 4rpx;">
  113. <!-- 🔥 -->
  114. <view class="u-flex align-center">
  115. <image src="/static/newIndex/fire.png"
  116. style="width: 40rpx;height: 42rpx;margin-left: 10rpx;"></image>
  117. <text class="hotTxt">热门提问</text>
  118. </view>
  119. <view @click="updateTemplate" class="tn-flex align-center"
  120. style="justify-content: flex-end;margin-top: 15rpx;">
  121. <view style="" class="change">换一换</view>
  122. <image ref="hyh" id="img01" class="shuaxin" :class="{'go':addRotate}"
  123. src="/static/newIndex/change.png" style="width: 32rpx;height:28rpx;">
  124. </image>
  125. </view>
  126. </view>
  127. <view class="" style="padding-left: 10rpx;padding-right: 10rpx;">
  128. <vastwu-barrage @teplateItemClicked="onSubmit" :textList1='templateData' :minTime="70"
  129. :maxTime="100" :trackList='[14,86,158]' width="100%" height="230rpx"
  130. ref="vBarrage"></vastwu-barrage>
  131. </view>
  132. </block>
  133. <view class="" v-if="appInfo.page_template == 2" style="padding-left: 10rpx;padding-right: 10rpx;">
  134. <view class="addbox">
  135. <view class="askaquestion u-flex align-center justify-between ">
  136. <!-- 🛠️ -->
  137. <view class="u-flex align-center" style="align-items: flex-end;">
  138. <image style="width: 60rpx;height: 64rpx;margin-left: 10rpx;"
  139. src="/static/newIndex/quesTemp.png"></image>
  140. <text class="hotTxt" style="margin-bottom: -6rpx;">应用</text>
  141. </view>
  142. <view @click="onhelper" class="tn-flex align-center"
  143. style="justify-content: flex-end;margin-top: 15rpx;">
  144. <view class="moreBox">
  145. <view class="moretxt" style="padding-left: 20rpx;">
  146. 更多</view>
  147. <image src="/static/newIndex/yjt.png"
  148. style="width: 8rpx;height: 16rpx;margin-left: 8rpx;" mode="">
  149. </image>
  150. </view>
  151. </view>
  152. </view>
  153. <view style="margin-bottom: 10rpx;" class="mubanBox">
  154. <navigator class="helpme"
  155. :url="'/pages/template/detail?id=' + item.id+'&currentmodel='+currentmodel"
  156. v-for="(item, index) in applayList" :key="index">
  157. <view class="bottomBox">
  158. <view class="left">
  159. <view class="title">{{ item.title }}</view>
  160. <view class="sub_title">{{ item.sub_title }}</view>
  161. </view>
  162. <view class="right">
  163. <image v-if="index==0" src="/static/newIndex/mt.png"
  164. style="width: 48rpx;height: 48rpx;" mode="">
  165. </image>
  166. <image v-if="index==1" src="/static/newIndex/wa.png"
  167. style="width: 48rpx;height: 48rpx;" mode="">
  168. </image>
  169. <image v-if="index==2" src="/static/newIndex/qg.png"
  170. style="width: 48rpx;height: 48rpx;" mode="">
  171. </image>
  172. <image v-if="index==3" src="/static/newIndex/kd.png"
  173. style="width: 48rpx;height: 48rpx;" mode="">
  174. </image>
  175. </view>
  176. </view>
  177. </navigator>
  178. </view>
  179. </view>
  180. </view>
  181. <wike-ad></wike-ad>
  182. </view>
  183. </view>
  184. <!-- 研究所或大学生身份切换 -->
  185. <u-action-sheet @select="selectClick" :round="10" :actions="sheetlist" :title="titlesheet" :show="showsheet"
  186. safeAreaInsetBottom @close="showsheet = false" cancelText="关闭"></u-action-sheet>
  187. <!-- #ifdef H5 -->
  188. <!-- <u-popup :show="h5share" mode="center" @close="h5share = false">
  189. <view class="cu-dialog">
  190. <image class="guide-img" src="http://shopro.7wpp.com/imgs/modal/share_guide.png" mode=""></image>
  191. </view>
  192. </u-popup> -->
  193. <!-- #endif -->
  194. <wike-model v-if="signShow" :authorize="false" :title="signTitle" btnText="立即获取" @save="signSign"
  195. @close="signShow = false"></wike-model>
  196. <!-- <block v-if="is_aipainting"> -->
  197. <block>
  198. <wike-tabbar2 :currTabIndex='2' v-if="appInfo.page_template == 3" :onTabbar="onTabbar"
  199. :is_aipainting="is_aipainting" :isShowAnimate="isShowAnimate"
  200. :appInfos="appInfo.page_template"></wike-tabbar2>
  201. <wike-tabbar :currTabIndex='2' v-else :onTabbar="onTabbar" :is_aipainting="is_aipainting"
  202. :isShowAnimate="isShowAnimate" :appInfos="appInfo.page_template"></wike-tabbar>
  203. </block>
  204. <!-- 暂时注释 -->
  205. <wike-modal-qrcode :qrcode="gzhqrcode" :showconcern="showconcern"
  206. @concernclose="concernclose"></wike-modal-qrcode>
  207. <u-modal @cancel="handleCancel" @confirm="handleConfirm" cancelText='退出登录' showCancelButton :show="showFixInfo"
  208. confirmColor="#26b3a0" confirmText="完善信息" title="请完善个人手机号信息后使用本应用"
  209. content='您已充值,但未绑定手机号,请完善信息以方便为您提供进一步的服务'></u-modal>
  210. <!-- <view class="leadPic" v-if="showlead">
  211. <view class="lead1Box" v-show="showlead1">
  212. <view class="lead1">
  213. <image src="/static/images/lead1.png" mode=""></image>
  214. <view class="btn" @click="showlead1=false">
  215. </view>
  216. </view>
  217. </view>
  218. <view class="lead2Box" v-show="!showlead1">
  219. <view class="lead2">
  220. <image src="/static/images/lead2.png" mode=""></image>
  221. <view class="btn" @click="closeLead2">
  222. </view>
  223. </view>
  224. </view>
  225. </view> -->
  226. <!-- <video v-show="true"></video> -->
  227. <view class="video_show" v-if="show">
  228. <view class="content">
  229. <uni-icons type="close" size="30" @click="show= false"></uni-icons>
  230. <!-- <video-show ></video-show> -->
  231. <view class="video-box">
  232. <video-show></video-show>
  233. </view>
  234. <!-- <view class="video-content" ></view> -->
  235. </view>
  236. </view>
  237. </view>
  238. </template>
  239. <script>
  240. import {
  241. mapMutations,
  242. mapActions,
  243. mapState,
  244. mapGetters
  245. } from 'vuex';
  246. // import videoShow from '@/pages/user/public/lead.vue'
  247. let interstitialAd = null,
  248. timer,
  249. time2;
  250. import noticeBar from '@/components/noticeBar/index.vue'
  251. import vastwuBarrage from '@/components/vastwu-barrage/vastwu-barrage.vue'
  252. const isWechat = () => {
  253. return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
  254. }
  255. import {
  256. init
  257. } from "@/common";
  258. import videoShow from '@/pages/user/public/lead.vue'
  259. export default {
  260. components: {
  261. noticeBar,
  262. vastwuBarrage,
  263. videoShow
  264. },
  265. data() {
  266. return {
  267. show:false,
  268. showlead: false,
  269. showlead1: true,
  270. showFixInfo: false,
  271. current: 0,
  272. playState: 'play',
  273. // current: 0,
  274. addRotate: false,
  275. signTitle: '',
  276. signShow: false,
  277. selectornot: 0,
  278. onTabbar: false,
  279. isShowAnimate: false,
  280. valuechat: '请写一篇西游记续集,里面包含一个角色马斯克',
  281. platform: this.$platform.get(),
  282. h5share: false,
  283. windowHeight: 0,
  284. placeholder: '您可以向AI提出任何问题...',
  285. tapsubmit: ' 获取答案',
  286. //模型
  287. // paintingmode:false,
  288. showsheet: false,
  289. titlesheet: '切换模型',
  290. //是否为gpt4模型
  291. showchat4: false,
  292. showchat35: false,
  293. // #ifdef H5
  294. sheetlist: [{
  295. index: 0,
  296. name: 'ChatGPT 4.0',
  297. subname: "超级高效沟通·简单提问",
  298. disabled: false
  299. },
  300. {
  301. index: 1,
  302. name: 'ChatGPT 3.5',
  303. subname: "高效沟通·简单提问",
  304. // color: '#207CF7',
  305. disabled: false
  306. },
  307. {
  308. index: 2,
  309. name: '文心一言',
  310. subname: "便捷沟通·简单提问",
  311. // color: '#207CF7',
  312. disabled: false
  313. },
  314. {
  315. index: 3,
  316. name: '讯飞火星',
  317. subname: "极速沟通·便捷提问",
  318. // color: '#207CF7',
  319. disabled: false
  320. },
  321. ],
  322. // #endif
  323. // 消耗
  324. plan: {},
  325. currentmodel: '',
  326. switchmodel: false,
  327. is_aipainting: '',
  328. showconcern: false,
  329. gzhqrcode: '',
  330. showchatBaidu: false,
  331. templateData: [],
  332. applayList: [],
  333. homeTemplate1: null,
  334. appInfo: {}
  335. };
  336. },
  337. computed: {
  338. ...mapGetters(['isLogin', 'userInfo', 'homeTemplate', 'userData']),
  339. isPc() {
  340. return navigator.userAgent.indexOf('Mobile') > -1 ? false : true
  341. },
  342. isWx() {
  343. return isWechat()
  344. }
  345. },
  346. async onLoad(o) {
  347. if (o.uniacid) {
  348. uni.setStorageSync('uniacid', o.uniacid)
  349. console.log('onload获取的应用ID----index', uni.getStorageSync('uniacid'));
  350. }
  351. var that = this;
  352. uni.getSystemInfo({
  353. success: function(res) {}
  354. });
  355. setTimeout(() => {
  356. that.onTabbar = true;
  357. that.isShowAnimate = true;
  358. }, 500);
  359. // this.getTemplateData()
  360. },
  361. onReady() {
  362. let that = this;
  363. // #ifdef MP-WEIXIN
  364. clearTimeout(timer);
  365. // 在适合的场景显示插屏广告
  366. timer = setTimeout(function() {
  367. // 在页面onLoad回调事件中创建插屏广告实例
  368. if (wx.createInterstitialAd && that.appInfo.interstitial_status == 1) {
  369. interstitialAd = wx.createInterstitialAd({
  370. adUnitId: that.appInfo.interstitial_id
  371. });
  372. interstitialAd.onLoad(() => {});
  373. interstitialAd.onError(err => {});
  374. interstitialAd.onClose(() => {
  375. if (that.appInfo.interstitial_infinite_status && that.appInfo
  376. .interstitial_infinite_status == 1) {
  377. that.showInterstitial();
  378. } else {
  379. interstitialAd.show().catch(err => {
  380. console.error(err);
  381. });
  382. }
  383. });
  384. interstitialAd.show().catch(err => {
  385. console.error(err);
  386. });
  387. }
  388. }, 4000);
  389. // #endif
  390. },
  391. async onShow() {
  392. let params = 'system.config';
  393. let Res = await this.$http('conf.getGroupConf', {
  394. group: params
  395. })
  396. if (Res.code == 0) {
  397. this.appInfo = Res.data
  398. }
  399. console.log('首页---appInfo', Res);
  400. // 生成固定通过链接分享信息
  401. if (uni.getStorageSync('token') && uni.getStorageSync('uniacid')) {
  402. let shareInfo = `uniacid=${uni.getStorageSync('uniacid')}&spm=` + this.$store.getters.userInfo.id +
  403. '.1.0.' + (['H5', 'wxOfficialAccount', 'wxMiniProgram', 'App'].indexOf(this.platform) + 1) +
  404. '.1'
  405. uni.setStorageSync('shareInfo', shareInfo)
  406. console.log('首页分享链接信息----------------------2:', shareInfo);
  407. }
  408. this.getTemplateData()
  409. this.$http('user.info').then(res => {
  410. if (res.code == 0) {
  411. console.log('用户是否是首次支付成功,但未填写手机号', res.data.is_new);
  412. this.showFixInfo = res.data.is_new;
  413. // this.showFixInfo = true;
  414. }
  415. })
  416. if (this.isLogin) {
  417. this.getUserData()
  418. }
  419. this.currentmodel = uni.getStorageSync("prestore") || "大学生"
  420. if (uni.getStorageSync("prestore") == '文心一言') {
  421. this.showchat4 = false
  422. this.showchat35 = false
  423. this.showchatBaidu = true
  424. this.sheetlist[2].color = "#207CF7"
  425. this.sheetlist[0].color = "black"
  426. this.sheetlist[1].color = "black"
  427. this.sheetlist[3].color = "black"
  428. } else if (uni.getStorageSync("prestore") == '研究生') {
  429. this.showchat4 = true
  430. this.showchat35 = false
  431. this.showchatBaidu = false
  432. this.sheetlist[0].color = "#207CF7"
  433. this.sheetlist[2].color = "black"
  434. this.sheetlist[1].color = "black"
  435. this.sheetlist[3].color = "black"
  436. } else if (uni.getStorageSync("prestore") == '讯飞火星') {
  437. this.sheetlist[3].color = "#207CF7"
  438. this.sheetlist[0].color = "black"
  439. this.sheetlist[2].color = "black"
  440. this.sheetlist[1].color = "black"
  441. this.showchat4 = false
  442. this.showchat35 = false
  443. this.showchatBaidu = false
  444. } else {
  445. this.sheetlist[1].color = "#207CF7"
  446. this.sheetlist[0].color = "black"
  447. this.sheetlist[2].color = "black"
  448. this.sheetlist[3].color = "black"
  449. this.showchat35 = true
  450. this.showchatBaidu = false
  451. this.showchat4 = false
  452. }
  453. this.init(this.currentmodel)
  454. this.windowHeight = uni.$u.sys().windowHeight
  455. this.systemwechat()
  456. // let oldHerfUrl = JSON.stringify(location.herf ? location.herf : '')
  457. // let oldHerfQuery = JSON.stringify(location.search)
  458. // location.href = JSON.parse(oldHerfUrl + oldHerfQuery + '&a=123466')
  459. // console.log('location.search', oldHerfQuery);
  460. // window.onhashchange() {
  461. // }
  462. // return
  463. },
  464. onUnload() {
  465. clearInterval(time2);
  466. // clearInterval(this.timer);
  467. },
  468. beforeDestroy() {
  469. // clearInterval(this.timer);
  470. },
  471. methods: {
  472. ...mapActions(['getUserInfo', 'showAuthModal', 'getUserData', 'logout']),
  473. goLead() {
  474. // uni.navigateTo({
  475. // url: '/pages/user/public/lead'
  476. // })
  477. console.log(this.show)
  478. console.log(3333)
  479. this.show = true
  480. console.log(this.show)
  481. },
  482. closeLead2() {
  483. this.showlead = false
  484. uni.setStorageSync('isLead', 'yes')
  485. },
  486. handleCancel() {
  487. this.showFixInfo = false
  488. this.logout()
  489. // uni.clearStorage()
  490. uni.reLaunch({
  491. url: '/pages/user/signin'
  492. })
  493. },
  494. handleConfirm() {
  495. uni.navigateTo({
  496. url: '/pages/user/userinfo?isNewUser=true'
  497. })
  498. },
  499. handleOver() {
  500. if (!this.isPc) return
  501. this.playState = 'paused'
  502. },
  503. handleOut() {
  504. if (!this.isPc) return
  505. this.playState = 'play'
  506. },
  507. async getTemplateData() {
  508. let whereIn = [187, 171, 179, 181]
  509. let res = await this.$http('common.template', {
  510. whereIn: whereIn.join(',')
  511. })
  512. if (res.code == 0) {
  513. this.templateData = res.data.hot
  514. this.applayList = res.data.template
  515. this.homeTemplate1 = res.data
  516. // this.$store.commit('TEMPLATE', res.data);
  517. console.log('首页热门提问:', this.templateData);
  518. console.log('首页应用列表:', this.applayList);
  519. console.log('首页homeTemplate1:', this.homeTemplate1);
  520. // uni.setStorageSync('homeTemplate1', res.data);
  521. if (!uni.getStorageSync('isLead') && res.data.hot.length) {
  522. this.showlead = true
  523. }
  524. }
  525. },
  526. handleTo(item) {
  527. if (item.name == '绘画') {
  528. uni.switchTab({
  529. url: '/pages/painting/painting'
  530. })
  531. } else if (item.name == '我的') {
  532. uni.switchTab({
  533. url: '/pages/user/user'
  534. })
  535. } else if (item.name == '充值') {
  536. uni.setStorageSync('chargeFromIndex', true)
  537. uni.navigateTo({
  538. url: '/pages/user/member/member'
  539. })
  540. } else if (item.name == '应用') {
  541. uni.switchTab({
  542. url: '/pages/template/template'
  543. })
  544. }
  545. },
  546. startScroll() {
  547. this.timer = setInterval(() => {
  548. this.offset += this.step
  549. if (this.offset >= this.itemWidth) {
  550. this.offset = 0
  551. this.noticeList.push(this.noticeList.shift())
  552. }
  553. // document.querySelector('.notice-content').style.transform = `translateX(-${this.offset}px)`
  554. }, this.speed)
  555. },
  556. ...mapActions(['appInit', 'logout', 'getUserInfo', 'getUserData']),
  557. init(preModal) {
  558. var that = this;
  559. return Promise.all([this.appInit()]).then(res => {
  560. that.is_aipainting = that.appInfo.is_aipainting
  561. uni.setNavigationBarTitle({
  562. title: that.appInfo.site_name
  563. });
  564. that.getPlan(preModal);
  565. });
  566. },
  567. systemwechat() {
  568. this.$http('conf.getGroupConf', {
  569. group: 'system.wechat'
  570. }).then(res => {
  571. if (res.code == 0) {
  572. this.gzhqrcode = res.data.qrcode_path
  573. const focuson = uni.getStorageSync('focuson');
  574. // console.log(focuson);
  575. if (!focuson) {
  576. if (this.gzhqrcode) {
  577. if (this.appInfo.is_show_index_qrcode == 1) {
  578. this.showconcern = true
  579. }
  580. if (this.isLogin && this.appInfo.is_show_logged_qrcode == 1) {
  581. this.showconcern = true
  582. }
  583. }
  584. }
  585. }
  586. })
  587. },
  588. concernclose() {
  589. this.showconcern = false
  590. },
  591. onselect(e) {
  592. this.showcontext = false
  593. this.switchmodel = this.selectornot == e ? true : false
  594. this.selectornot = e;
  595. },
  596. showInterstitial() {
  597. time2 = setInterval(
  598. function() {
  599. interstitialAd.show().catch(err => {
  600. console.error(err);
  601. });
  602. },
  603. this.appInfo.gap ? this.appInfo.gap * 1000 : 12000
  604. );
  605. },
  606. //选择模型
  607. selectClick(index) {
  608. for (var a = 0; a < this.sheetlist.length; a++) {
  609. this.sheetlist[a].color = '#000'
  610. }
  611. // #ifdef MP-WEIXIN
  612. this.sheetlist[index.index - 1].color = '#207CF7'
  613. // #endif
  614. // #ifdef H5
  615. this.sheetlist[index.index].color = '#207CF7'
  616. // #endif
  617. this.showchat4 = index.index == 0 ? true : false
  618. this.showchat35 = index.index == 1 ? true : false
  619. this.showchatBaidu = index.index == 2 ? true : false
  620. // this.showchat4 = false
  621. this.getcurrentmodel()
  622. },
  623. getPlan(preModal) {
  624. let that = this;
  625. this.$http('conf.getGroupConf', {
  626. group: 'system.plan'
  627. }).then(res => {
  628. if (res.code == 0) {
  629. this.plan = res.data
  630. let gpt = this.appInfo;
  631. // #ifdef H5
  632. // if (gpt.is_gpt4 == 2) {
  633. // this.sheetlist.shift()
  634. // this.sheetlist[0].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  635. // this.sheetlist[0].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  636. // this.sheetlist[1].name = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  637. // this.sheetlist[1].subname = gpt.gpt3_intro ? gpt.gpt3_intro : '便捷沟通·简单提问'
  638. // this.sheetlist[2].name = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  639. // this.sheetlist[2].subname = gpt.gpt2_intro ? gpt.gpt2_intro : '极速沟通·便捷提问'
  640. // } else {
  641. // this.sheetlist[0].name = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
  642. // this.sheetlist[0].subname = gpt.gpt4_intro ? gpt.gpt4_intro : '高效沟通·简单提问'
  643. // this.sheetlist[1].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  644. // this.sheetlist[1].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  645. // this.sheetlist[2].name = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  646. // this.sheetlist[2].subname = gpt.gpt3_intro ? gpt.gpt3_intro : '便捷沟通·简单提问'
  647. // this.sheetlist[3].name = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  648. // this.sheetlist[3].subname = gpt.gpt2_intro ? gpt.gpt2_intro : '极速沟通·便捷提问'
  649. // }
  650. // #endif
  651. // #ifdef MP-WEIXIN
  652. // this.sheetlist[0].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  653. // this.sheetlist[0].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  654. // this.sheetlist[0].name = 'ChatGPT 4.0'
  655. // this.sheetlist[0].subname = '高效沟通·简单提问'
  656. // this.sheetlist[1].name = 'ChatGPT 3.5'
  657. // this.sheetlist[1].subname = '高效沟通·简单提问'
  658. // this.sheetlist[2].name =: '文心一言'
  659. // this.sheetlist[2].subname = '便捷沟通·简单提问'
  660. // #endif
  661. // this.getcurrentmodel1(preModal)
  662. }
  663. })
  664. },
  665. // getcurrentmodel1(preModal) {
  666. // },
  667. getcurrentmodel() {
  668. let gpt = this.appInfo;
  669. if (this.showchat4) {
  670. this.currentmodel = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
  671. } else if (this.showchat35) {
  672. this.currentmodel = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  673. } else if (this.showchatBaidu) {
  674. this.currentmodel = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  675. } else {
  676. this.currentmodel = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  677. }
  678. uni.setStorageSync('prestore', this.currentmodel);
  679. },
  680. updateTemplate() {
  681. // this.$store.dispatch('getTemplate');
  682. this.getTemplateData()
  683. this.addRotate = true
  684. setTimeout((item, index) => {
  685. this.addRotate = false
  686. }, 1000)
  687. },
  688. onToForm() {
  689. uni.navigateTo({
  690. url: '/pages/chat/chat'
  691. });
  692. },
  693. onhelper() {
  694. uni.switchTab({
  695. url: '/pages/template/template'
  696. });
  697. },
  698. focustextarea() {
  699. if (!this.isLogin) {
  700. uni.navigateTo({
  701. url: '/pages/user/signin'
  702. });
  703. uni.setStorageSync('route', '/pages/index/index');
  704. return;
  705. }
  706. if (this.valuechat == "请写一篇西游记续集,里面包含一个角色马斯克") {
  707. this.valuechat = ''
  708. }
  709. },
  710. ondraw() {
  711. // uni.navigateTo({
  712. // url: '/pages/chat/chat?draw=1'
  713. // });
  714. uni.switchTab({
  715. url: '/pages/painting/painting'
  716. })
  717. },
  718. signSign() {
  719. uni.navigateTo({
  720. url: '/pages/user/member/member'
  721. });
  722. this.signShow = false
  723. },
  724. onSubmit(e) {
  725. console.log('通过点击热门提问的问题:', e);
  726. var that = this;
  727. if (!that.isLogin) {
  728. uni.navigateTo({
  729. url: '/pages/user/signin'
  730. });
  731. uni.setStorageSync('route', '/pages/index/index');
  732. return;
  733. }
  734. if (!e) {
  735. uni.showToast({
  736. title: '请输入关键词或问题',
  737. icon: 'none'
  738. });
  739. return;
  740. }
  741. if (that.appInfo.time_member && that.appInfo.time_member == 1) {
  742. if (that.showchat4) {
  743. if (that.userData.vip_info && that.userData.is_validity > 0 && that.userData.vip_info
  744. .gpt4_used ==
  745. that.userData.vip_info.gpt4_times && that.userData.coin < that.plan.lock_gpt4) {
  746. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  747. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  748. // "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  749. this.signTitle =
  750. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  751. that.plan.lock_gpt4 + "</span><span>" + alias +
  752. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  753. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  754. this.signShow = true
  755. return;
  756. }
  757. if (that.userData.is_validity == 0 && that.userData.coin < that.plan.lock_gpt4) {
  758. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  759. this.signTitle =
  760. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  761. that.plan.lock_gpt4 + "</span><span>" + alias +
  762. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  763. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  764. this.signShow = true
  765. return;
  766. }
  767. } else {
  768. if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData
  769. .vip_info
  770. .gpt35_times && that.userData.coin <= 0) {
  771. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  772. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  773. // "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  774. this.signTitle =
  775. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  776. 1 + "</span><span>" + alias +
  777. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  778. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  779. this.signShow = true
  780. return;
  781. }
  782. if (that.userData.is_validity == 0 && that.userData.coin <= 0) {
  783. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  784. this.signTitle =
  785. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  786. 1 + "</span><span>" + alias +
  787. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  788. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  789. this.signShow = true
  790. return;
  791. }
  792. }
  793. } else {
  794. if (that.showchat4 && that.userData.coin < that.plan.lock_gpt4) {
  795. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  796. this.signTitle =
  797. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  798. that.plan.lock_gpt4 + "</span><span>" + alias +
  799. "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
  800. that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" +
  801. alias +
  802. "</span>吧</p>"
  803. this.signShow = true
  804. return;
  805. }
  806. if (!that.showchat4 && that.userData.coin <= 0) {
  807. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  808. this.signTitle =
  809. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  810. 1 + "</span><span>" + alias +
  811. "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
  812. that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" +
  813. alias +
  814. "</span>吧</p>"
  815. this.signShow = true
  816. return;
  817. }
  818. }
  819. // if(that.showchat4){
  820. // if(that.userData.coin < that.plan.lock_gpt4){
  821. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  822. // 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>"
  823. // this.signShow = true
  824. // return;
  825. // }
  826. // }
  827. // if (that.appInfo.time_member && that.appInfo.time_member == 1) {
  828. // if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData.vip_info.gpt35_times && that.userData.coin <= 0) {
  829. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  830. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>"+alias+"</span>/会员套餐内剩余次数不足</p>"
  831. // this.signShow = true
  832. // return;
  833. // }
  834. // if (that.userData.is_validity == 0) {
  835. // if (that.userData.coin <= 0) {
  836. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  837. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  838. // "</span>/会员套餐已到期</p>"
  839. // this.signShow = true
  840. // return;
  841. // }
  842. // }
  843. // } else {
  844. // if (that.userData.coin <= 0) {
  845. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  846. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  847. // "</span>不足</p>"
  848. // this.signShow = true
  849. // return;
  850. // }
  851. // }
  852. if (this.currentmodel == '研究生') {
  853. that.showchat4 = true
  854. } else if (this.currentmodel == '大学生') {
  855. that.showchat35 = true
  856. }
  857. if (that.showchat4) {
  858. uni.navigateTo({
  859. url: '/pages/chat/chat?showchat4=' + e + '&chat4=1'
  860. });
  861. that.valuechat = ''
  862. return;
  863. } else if (that.showchat35) {
  864. uni.navigateTo({
  865. url: '/pages/chat/chat?question=' + e + '&selectornot=' + that.selectornot +
  866. '&showchat35=true'
  867. });
  868. } else if (that.showchatBaidu) {
  869. // 文心一言
  870. uni.navigateTo({
  871. url: '/pages/chat/chat?showchat3=' + e + '&chat3=1'
  872. });
  873. that.valuechat = ''
  874. return;
  875. } else {
  876. // 讯飞火星
  877. uni.navigateTo({
  878. url: '/pages/chat/chat?showchat2=' + e + '&chat2=1'
  879. });
  880. that.valuechat = ''
  881. return;
  882. }
  883. }
  884. }
  885. };
  886. </script>
  887. <style lang="scss">
  888. @import './painting.scss';
  889. </style>