painting.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  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. </view>
  227. </template>
  228. <script>
  229. import {
  230. mapMutations,
  231. mapActions,
  232. mapState,
  233. mapGetters
  234. } from 'vuex';
  235. let interstitialAd = null,
  236. timer,
  237. time2;
  238. import noticeBar from '@/components/noticeBar/index.vue'
  239. import vastwuBarrage from '@/components/vastwu-barrage/vastwu-barrage.vue'
  240. const isWechat = () => {
  241. return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
  242. }
  243. import {
  244. init
  245. } from "@/common";
  246. export default {
  247. components: {
  248. noticeBar,
  249. vastwuBarrage
  250. },
  251. data() {
  252. return {
  253. showlead: false,
  254. showlead1: true,
  255. showFixInfo: false,
  256. current: 0,
  257. playState: 'play',
  258. // current: 0,
  259. addRotate: false,
  260. signTitle: '',
  261. signShow: false,
  262. selectornot: 0,
  263. onTabbar: false,
  264. isShowAnimate: false,
  265. valuechat: '请写一篇西游记续集,里面包含一个角色马斯克',
  266. platform: this.$platform.get(),
  267. h5share: false,
  268. windowHeight: 0,
  269. placeholder: '您可以向AI提出任何问题...',
  270. tapsubmit: ' 获取答案',
  271. //模型
  272. // paintingmode:false,
  273. showsheet: false,
  274. titlesheet: '切换模型',
  275. //是否为gpt4模型
  276. showchat4: false,
  277. showchat35: false,
  278. // #ifdef H5
  279. sheetlist: [{
  280. index: 0,
  281. name: 'ChatGPT 4.0',
  282. subname: "超级高效沟通·简单提问",
  283. disabled: false
  284. },
  285. {
  286. index: 1,
  287. name: 'ChatGPT 3.5',
  288. subname: "高效沟通·简单提问",
  289. // color: '#207CF7',
  290. disabled: false
  291. },
  292. {
  293. index: 2,
  294. name: '文心一言',
  295. subname: "便捷沟通·简单提问",
  296. // color: '#207CF7',
  297. disabled: false
  298. },
  299. {
  300. index: 3,
  301. name: '讯飞火星',
  302. subname: "极速沟通·便捷提问",
  303. // color: '#207CF7',
  304. disabled: false
  305. },
  306. ],
  307. // #endif
  308. // 消耗
  309. plan: {},
  310. currentmodel: '',
  311. switchmodel: false,
  312. is_aipainting: '',
  313. showconcern: false,
  314. gzhqrcode: '',
  315. showchatBaidu: false,
  316. templateData: [],
  317. applayList: [],
  318. homeTemplate1: null,
  319. appInfo: {}
  320. };
  321. },
  322. computed: {
  323. ...mapGetters(['isLogin', 'userInfo', 'homeTemplate', 'userData']),
  324. isPc() {
  325. return navigator.userAgent.indexOf('Mobile') > -1 ? false : true
  326. },
  327. isWx() {
  328. return isWechat()
  329. }
  330. },
  331. async onLoad(o) {
  332. if (o.uniacid) {
  333. uni.setStorageSync('uniacid', o.uniacid)
  334. console.log('onload获取的应用ID----index', uni.getStorageSync('uniacid'));
  335. }
  336. var that = this;
  337. uni.getSystemInfo({
  338. success: function(res) {}
  339. });
  340. setTimeout(() => {
  341. that.onTabbar = true;
  342. that.isShowAnimate = true;
  343. }, 500);
  344. // this.getTemplateData()
  345. },
  346. onReady() {
  347. let that = this;
  348. // #ifdef MP-WEIXIN
  349. clearTimeout(timer);
  350. // 在适合的场景显示插屏广告
  351. timer = setTimeout(function() {
  352. // 在页面onLoad回调事件中创建插屏广告实例
  353. if (wx.createInterstitialAd && that.appInfo.interstitial_status == 1) {
  354. interstitialAd = wx.createInterstitialAd({
  355. adUnitId: that.appInfo.interstitial_id
  356. });
  357. interstitialAd.onLoad(() => {});
  358. interstitialAd.onError(err => {});
  359. interstitialAd.onClose(() => {
  360. if (that.appInfo.interstitial_infinite_status && that.appInfo
  361. .interstitial_infinite_status == 1) {
  362. that.showInterstitial();
  363. } else {
  364. interstitialAd.show().catch(err => {
  365. console.error(err);
  366. });
  367. }
  368. });
  369. interstitialAd.show().catch(err => {
  370. console.error(err);
  371. });
  372. }
  373. }, 4000);
  374. // #endif
  375. },
  376. async onShow() {
  377. let params = 'system.config';
  378. let Res = await this.$http('conf.getGroupConf', {
  379. group: params
  380. })
  381. if (Res.code == 0) {
  382. this.appInfo = Res.data
  383. }
  384. console.log('首页---appInfo', Res);
  385. // 生成固定通过链接分享信息
  386. if (uni.getStorageSync('token') && uni.getStorageSync('uniacid')) {
  387. let shareInfo = `uniacid=${uni.getStorageSync('uniacid')}&spm=` + this.$store.getters.userInfo.id +
  388. '.1.0.' + (['H5', 'wxOfficialAccount', 'wxMiniProgram', 'App'].indexOf(this.platform) + 1) +
  389. '.1'
  390. uni.setStorageSync('shareInfo', shareInfo)
  391. console.log('首页分享链接信息----------------------2:', shareInfo);
  392. }
  393. this.getTemplateData()
  394. this.$http('user.info').then(res => {
  395. if (res.code == 0) {
  396. console.log('用户是否是首次支付成功,但未填写手机号', res.data.is_new);
  397. this.showFixInfo = res.data.is_new;
  398. // this.showFixInfo = true;
  399. }
  400. })
  401. if (this.isLogin) {
  402. this.getUserData()
  403. }
  404. this.currentmodel = uni.getStorageSync("prestore") || "大学生"
  405. if (uni.getStorageSync("prestore") == '文心一言') {
  406. this.showchat4 = false
  407. this.showchat35 = false
  408. this.showchatBaidu = true
  409. this.sheetlist[2].color = "#207CF7"
  410. this.sheetlist[0].color = "black"
  411. this.sheetlist[1].color = "black"
  412. this.sheetlist[3].color = "black"
  413. } else if (uni.getStorageSync("prestore") == '研究生') {
  414. this.showchat4 = true
  415. this.showchat35 = false
  416. this.showchatBaidu = false
  417. this.sheetlist[0].color = "#207CF7"
  418. this.sheetlist[2].color = "black"
  419. this.sheetlist[1].color = "black"
  420. this.sheetlist[3].color = "black"
  421. } else if (uni.getStorageSync("prestore") == '讯飞火星') {
  422. this.sheetlist[3].color = "#207CF7"
  423. this.sheetlist[0].color = "black"
  424. this.sheetlist[2].color = "black"
  425. this.sheetlist[1].color = "black"
  426. this.showchat4 = false
  427. this.showchat35 = false
  428. this.showchatBaidu = false
  429. } else {
  430. this.sheetlist[1].color = "#207CF7"
  431. this.sheetlist[0].color = "black"
  432. this.sheetlist[2].color = "black"
  433. this.sheetlist[3].color = "black"
  434. this.showchat35 = true
  435. this.showchatBaidu = false
  436. this.showchat4 = false
  437. }
  438. this.init(this.currentmodel)
  439. this.windowHeight = uni.$u.sys().windowHeight
  440. this.systemwechat()
  441. // let oldHerfUrl = JSON.stringify(location.herf ? location.herf : '')
  442. // let oldHerfQuery = JSON.stringify(location.search)
  443. // location.href = JSON.parse(oldHerfUrl + oldHerfQuery + '&a=123466')
  444. // console.log('location.search', oldHerfQuery);
  445. // window.onhashchange() {
  446. // }
  447. // return
  448. },
  449. onUnload() {
  450. clearInterval(time2);
  451. // clearInterval(this.timer);
  452. },
  453. beforeDestroy() {
  454. // clearInterval(this.timer);
  455. },
  456. methods: {
  457. ...mapActions(['getUserInfo', 'showAuthModal', 'getUserData', 'logout']),
  458. goLead() {
  459. uni.navigateTo({
  460. url: '/pages/user/public/lead'
  461. })
  462. },
  463. closeLead2() {
  464. this.showlead = false
  465. uni.setStorageSync('isLead', 'yes')
  466. },
  467. handleCancel() {
  468. this.showFixInfo = false
  469. this.logout()
  470. // uni.clearStorage()
  471. uni.reLaunch({
  472. url: '/pages/user/signin'
  473. })
  474. },
  475. handleConfirm() {
  476. uni.navigateTo({
  477. url: '/pages/user/userinfo?isNewUser=true'
  478. })
  479. },
  480. handleOver() {
  481. if (!this.isPc) return
  482. this.playState = 'paused'
  483. },
  484. handleOut() {
  485. if (!this.isPc) return
  486. this.playState = 'play'
  487. },
  488. async getTemplateData() {
  489. let whereIn = [187, 171, 179, 181]
  490. let res = await this.$http('common.template', {
  491. whereIn: whereIn.join(',')
  492. })
  493. if (res.code == 0) {
  494. this.templateData = res.data.hot
  495. this.applayList = res.data.template
  496. this.homeTemplate1 = res.data
  497. // this.$store.commit('TEMPLATE', res.data);
  498. console.log('首页热门提问:', this.templateData);
  499. console.log('首页应用列表:', this.applayList);
  500. console.log('首页homeTemplate1:', this.homeTemplate1);
  501. // uni.setStorageSync('homeTemplate1', res.data);
  502. if (!uni.getStorageSync('isLead') && res.data.hot.length) {
  503. this.showlead = true
  504. }
  505. }
  506. },
  507. handleTo(item) {
  508. if (item.name == '绘画') {
  509. uni.switchTab({
  510. url: '/pages/painting/painting'
  511. })
  512. } else if (item.name == '我的') {
  513. uni.switchTab({
  514. url: '/pages/user/user'
  515. })
  516. } else if (item.name == '充值') {
  517. uni.setStorageSync('chargeFromIndex', true)
  518. uni.navigateTo({
  519. url: '/pages/user/member/member'
  520. })
  521. } else if (item.name == '应用') {
  522. uni.switchTab({
  523. url: '/pages/template/template'
  524. })
  525. }
  526. },
  527. startScroll() {
  528. this.timer = setInterval(() => {
  529. this.offset += this.step
  530. if (this.offset >= this.itemWidth) {
  531. this.offset = 0
  532. this.noticeList.push(this.noticeList.shift())
  533. }
  534. // document.querySelector('.notice-content').style.transform = `translateX(-${this.offset}px)`
  535. }, this.speed)
  536. },
  537. ...mapActions(['appInit', 'logout', 'getUserInfo', 'getUserData']),
  538. init(preModal) {
  539. var that = this;
  540. return Promise.all([this.appInit()]).then(res => {
  541. that.is_aipainting = that.appInfo.is_aipainting
  542. uni.setNavigationBarTitle({
  543. title: that.appInfo.site_name
  544. });
  545. that.getPlan(preModal);
  546. });
  547. },
  548. systemwechat() {
  549. this.$http('conf.getGroupConf', {
  550. group: 'system.wechat'
  551. }).then(res => {
  552. if (res.code == 0) {
  553. this.gzhqrcode = res.data.qrcode_path
  554. const focuson = uni.getStorageSync('focuson');
  555. // console.log(focuson);
  556. if (!focuson) {
  557. if (this.gzhqrcode) {
  558. if (this.appInfo.is_show_index_qrcode == 1) {
  559. this.showconcern = true
  560. }
  561. if (this.isLogin && this.appInfo.is_show_logged_qrcode == 1) {
  562. this.showconcern = true
  563. }
  564. }
  565. }
  566. }
  567. })
  568. },
  569. concernclose() {
  570. this.showconcern = false
  571. },
  572. onselect(e) {
  573. this.showcontext = false
  574. this.switchmodel = this.selectornot == e ? true : false
  575. this.selectornot = e;
  576. },
  577. showInterstitial() {
  578. time2 = setInterval(
  579. function() {
  580. interstitialAd.show().catch(err => {
  581. console.error(err);
  582. });
  583. },
  584. this.appInfo.gap ? this.appInfo.gap * 1000 : 12000
  585. );
  586. },
  587. //选择模型
  588. selectClick(index) {
  589. for (var a = 0; a < this.sheetlist.length; a++) {
  590. this.sheetlist[a].color = '#000'
  591. }
  592. // #ifdef MP-WEIXIN
  593. this.sheetlist[index.index - 1].color = '#207CF7'
  594. // #endif
  595. // #ifdef H5
  596. this.sheetlist[index.index].color = '#207CF7'
  597. // #endif
  598. this.showchat4 = index.index == 0 ? true : false
  599. this.showchat35 = index.index == 1 ? true : false
  600. this.showchatBaidu = index.index == 2 ? true : false
  601. // this.showchat4 = false
  602. this.getcurrentmodel()
  603. },
  604. getPlan(preModal) {
  605. let that = this;
  606. this.$http('conf.getGroupConf', {
  607. group: 'system.plan'
  608. }).then(res => {
  609. if (res.code == 0) {
  610. this.plan = res.data
  611. let gpt = this.appInfo;
  612. // #ifdef H5
  613. // if (gpt.is_gpt4 == 2) {
  614. // this.sheetlist.shift()
  615. // this.sheetlist[0].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  616. // this.sheetlist[0].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  617. // this.sheetlist[1].name = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  618. // this.sheetlist[1].subname = gpt.gpt3_intro ? gpt.gpt3_intro : '便捷沟通·简单提问'
  619. // this.sheetlist[2].name = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  620. // this.sheetlist[2].subname = gpt.gpt2_intro ? gpt.gpt2_intro : '极速沟通·便捷提问'
  621. // } else {
  622. // this.sheetlist[0].name = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
  623. // this.sheetlist[0].subname = gpt.gpt4_intro ? gpt.gpt4_intro : '高效沟通·简单提问'
  624. // this.sheetlist[1].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  625. // this.sheetlist[1].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  626. // this.sheetlist[2].name = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  627. // this.sheetlist[2].subname = gpt.gpt3_intro ? gpt.gpt3_intro : '便捷沟通·简单提问'
  628. // this.sheetlist[3].name = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  629. // this.sheetlist[3].subname = gpt.gpt2_intro ? gpt.gpt2_intro : '极速沟通·便捷提问'
  630. // }
  631. // #endif
  632. // #ifdef MP-WEIXIN
  633. // this.sheetlist[0].name = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  634. // this.sheetlist[0].subname = gpt.gpt35_intro ? gpt.gpt35_intro : '高效沟通·简单提问'
  635. // this.sheetlist[0].name = 'ChatGPT 4.0'
  636. // this.sheetlist[0].subname = '高效沟通·简单提问'
  637. // this.sheetlist[1].name = 'ChatGPT 3.5'
  638. // this.sheetlist[1].subname = '高效沟通·简单提问'
  639. // this.sheetlist[2].name =: '文心一言'
  640. // this.sheetlist[2].subname = '便捷沟通·简单提问'
  641. // #endif
  642. // this.getcurrentmodel1(preModal)
  643. }
  644. })
  645. },
  646. // getcurrentmodel1(preModal) {
  647. // },
  648. getcurrentmodel() {
  649. let gpt = this.appInfo;
  650. if (this.showchat4) {
  651. this.currentmodel = gpt.gpt4_alias ? gpt.gpt4_alias : 'ChatGPT 4.0'
  652. } else if (this.showchat35) {
  653. this.currentmodel = gpt.gpt35_alias ? gpt.gpt35_alias : 'ChatGPT 3.5'
  654. } else if (this.showchatBaidu) {
  655. this.currentmodel = gpt.gpt3_alias ? gpt.gpt3_alias : '文心一言'
  656. } else {
  657. this.currentmodel = gpt.gpt2_alias ? gpt.gpt2_alias : '讯飞火星'
  658. }
  659. uni.setStorageSync('prestore', this.currentmodel);
  660. },
  661. updateTemplate() {
  662. // this.$store.dispatch('getTemplate');
  663. this.getTemplateData()
  664. this.addRotate = true
  665. setTimeout((item, index) => {
  666. this.addRotate = false
  667. }, 1000)
  668. },
  669. onToForm() {
  670. uni.navigateTo({
  671. url: '/pages/chat/chat'
  672. });
  673. },
  674. onhelper() {
  675. uni.switchTab({
  676. url: '/pages/template/template'
  677. });
  678. },
  679. focustextarea() {
  680. if (!this.isLogin) {
  681. uni.navigateTo({
  682. url: '/pages/user/signin'
  683. });
  684. uni.setStorageSync('route', '/pages/index/index');
  685. return;
  686. }
  687. if (this.valuechat == "请写一篇西游记续集,里面包含一个角色马斯克") {
  688. this.valuechat = ''
  689. }
  690. },
  691. ondraw() {
  692. // uni.navigateTo({
  693. // url: '/pages/chat/chat?draw=1'
  694. // });
  695. uni.switchTab({
  696. url: '/pages/painting/painting'
  697. })
  698. },
  699. signSign() {
  700. uni.navigateTo({
  701. url: '/pages/user/member/member'
  702. });
  703. this.signShow = false
  704. },
  705. onSubmit(e) {
  706. console.log('通过点击热门提问的问题:', e);
  707. var that = this;
  708. if (!that.isLogin) {
  709. uni.navigateTo({
  710. url: '/pages/user/signin'
  711. });
  712. uni.setStorageSync('route', '/pages/index/index');
  713. return;
  714. }
  715. if (!e) {
  716. uni.showToast({
  717. title: '请输入关键词或问题',
  718. icon: 'none'
  719. });
  720. return;
  721. }
  722. if (that.appInfo.time_member && that.appInfo.time_member == 1) {
  723. if (that.showchat4) {
  724. if (that.userData.vip_info && that.userData.is_validity > 0 && that.userData.vip_info
  725. .gpt4_used ==
  726. that.userData.vip_info.gpt4_times && that.userData.coin < that.plan.lock_gpt4) {
  727. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  728. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  729. // "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  730. this.signTitle =
  731. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  732. that.plan.lock_gpt4 + "</span><span>" + alias +
  733. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  734. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  735. this.signShow = true
  736. return;
  737. }
  738. if (that.userData.is_validity == 0 && that.userData.coin < that.plan.lock_gpt4) {
  739. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  740. this.signTitle =
  741. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  742. that.plan.lock_gpt4 + "</span><span>" + alias +
  743. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  744. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  745. this.signShow = true
  746. return;
  747. }
  748. } else {
  749. if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData
  750. .vip_info
  751. .gpt35_times && that.userData.coin <= 0) {
  752. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  753. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  754. // "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  755. this.signTitle =
  756. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  757. 1 + "</span><span>" + alias +
  758. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  759. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  760. this.signShow = true
  761. return;
  762. }
  763. if (that.userData.is_validity == 0 && that.userData.coin <= 0) {
  764. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  765. this.signTitle =
  766. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  767. 1 + "</span><span>" + alias +
  768. "</span></p><p style='padding-top: 10px;'>您的提问<span>" + alias +
  769. "</span>不足或会员套餐内剩余次数不足,无法发起提问</p>"
  770. this.signShow = true
  771. return;
  772. }
  773. }
  774. } else {
  775. if (that.showchat4 && that.userData.coin < that.plan.lock_gpt4) {
  776. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  777. this.signTitle =
  778. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  779. that.plan.lock_gpt4 + "</span><span>" + alias +
  780. "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
  781. that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" +
  782. alias +
  783. "</span>吧</p>"
  784. this.signShow = true
  785. return;
  786. }
  787. if (!that.showchat4 && that.userData.coin <= 0) {
  788. var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  789. this.signTitle =
  790. "<p style='font-weight: 550;font-size: 16px;'>提问需要<span style='color: #26b3a0;padding: 0 4px;'>" +
  791. 1 + "</span><span>" + alias +
  792. "</span></p><p style='padding-top: 10px;'>您当前有<span style='color: #26b3a0;padding: 0 4px;'>" +
  793. that.userData.coin + "</span><span>" + alias + "</span>,无法发起提问,快去获取<span>" +
  794. alias +
  795. "</span>吧</p>"
  796. this.signShow = true
  797. return;
  798. }
  799. }
  800. // if(that.showchat4){
  801. // if(that.userData.coin < that.plan.lock_gpt4){
  802. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  803. // 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>"
  804. // this.signShow = true
  805. // return;
  806. // }
  807. // }
  808. // if (that.appInfo.time_member && that.appInfo.time_member == 1) {
  809. // if (that.userData.is_validity > 0 && that.userData.vip_info.gpt35_used == that.userData.vip_info.gpt35_times && that.userData.coin <= 0) {
  810. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  811. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>"+alias+"</span>/会员套餐内剩余次数不足</p>"
  812. // this.signShow = true
  813. // return;
  814. // }
  815. // if (that.userData.is_validity == 0) {
  816. // if (that.userData.coin <= 0) {
  817. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  818. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  819. // "</span>/会员套餐已到期</p>"
  820. // this.signShow = true
  821. // return;
  822. // }
  823. // }
  824. // } else {
  825. // if (that.userData.coin <= 0) {
  826. // var alias = that.appInfo.number_alias ? that.appInfo.number_alias : '点数';
  827. // this.signTitle = "<p style='font-weight: 550;font-size: 16px;'>您的提问<span>" + alias +
  828. // "</span>不足</p>"
  829. // this.signShow = true
  830. // return;
  831. // }
  832. // }
  833. if (this.currentmodel == '研究生') {
  834. that.showchat4 = true
  835. } else if (this.currentmodel == '大学生') {
  836. that.showchat35 = true
  837. }
  838. if (that.showchat4) {
  839. uni.navigateTo({
  840. url: '/pages/chat/chat?showchat4=' + e + '&chat4=1'
  841. });
  842. that.valuechat = ''
  843. return;
  844. } else if (that.showchat35) {
  845. uni.navigateTo({
  846. url: '/pages/chat/chat?question=' + e + '&selectornot=' + that.selectornot +
  847. '&showchat35=true'
  848. });
  849. } else if (that.showchatBaidu) {
  850. // 文心一言
  851. uni.navigateTo({
  852. url: '/pages/chat/chat?showchat3=' + e + '&chat3=1'
  853. });
  854. that.valuechat = ''
  855. return;
  856. } else {
  857. // 讯飞火星
  858. uni.navigateTo({
  859. url: '/pages/chat/chat?showchat2=' + e + '&chat2=1'
  860. });
  861. that.valuechat = ''
  862. return;
  863. }
  864. }
  865. }
  866. };
  867. </script>
  868. <style lang="scss">
  869. @import './painting.scss';
  870. </style>