liyongli 2 年 前
コミット
248fec92e5

BIN
src/assets/img/chat/bg.png


+ 1 - 1
src/config/index.js

@@ -8,7 +8,7 @@ const base = {
 }
 
 if(process.env.VUE_APP_ENV==="Dev"){
-    base.chat= "http://172.17.17.206/"
+    // base.chat= "http://172.17.17.206/"
 }
 
 

+ 4 - 34
src/view/chatGptChat/index.js

@@ -11,43 +11,13 @@ document.title = window.$originData.orginParames.title || '';
 window.weixin_Share_Init(
   window.$originData.orginParames.title,
   '',
-  'https://cxzx.smcic.net/topic/highSpeed/img/logo3.png',
+  'https://cxzx.smcic.net/topic/qinshufa/assets/logp.png',
   'https://cxzx.smcic.net/topic/activity/chatGptChat.html?' + Date.now()
 );
-
 window.appLoginSuccess = () => {
-    console.log("登录");
-    window.location.reload();
-  };
-// var SL = new window.SmcicLogger('shanshipin', 'c6124d95');
-// SL.Util.SetUrl('https://collect.smcic.net:8443/');
-// SL.Systematic.Init({
-//   appid: 'c6124d95',
-//   channel: 'shanshipin',
-//   model: '',
-//   os: '',
-//   os_version: '',
-//   carrier: '',
-//   network_type: '',
-//   ip: '',
-//   app_name: '',
-//   app_version: '',
-//   build_version: '',
-//   platform_type: '',
-// });
-// SL.Content.CommodityDetail({
-//   commodity_detail_source: '活动',
-//   commodity_id: '',
-//   commodity_name: document.title,
-//   publisher_name: '',
-//   publisher_id: '',
-//   review_count: 0,
-//   comment_count: 0,
-//   collect_count: 0,
-//   share_count: 0,
-//   like_count: 0,
-//   tag: [],
-// });
+  console.log('登录');
+  window.location.reload();
+};
 
 !window.$shanshipin || !window.$shanshipin.Phone
   ? getUser(() => createApp(App).mount('#app'))

+ 47 - 24
src/view/chatGptChat/index.vue

@@ -1,25 +1,19 @@
 <template>
-  <div class="chatGptChat" ref="chatEle">
-    <!-- <div v-for="(item, index) in chat" :key="index">
-      <div v-if="item.text && item.type === 'robot'" class="chat">
-        <van-image width="35px" height="35px" fit="contain" :src="robot" />
-        <div class="cahtText" v-html="item.text">
-        </div>
-      </div>
-      <div v-if="item.text && item.type === 'user'" class="chat chatRight">
-        <div class="cahtText" v-text="item.text"></div>
-        <van-image width="35px" height="35px" fit="contain" :src="user" />
-      </div>
-    </div> -->
+  <div :class="{ chatGptChat: true, ortherP: !userData.UserId }" ref="chatEle">
     <div v-for="(item, index) in chat" :key="index">
       <div v-if="item.text && item.type === 'robot'" class="chat">
         <van-image width="35px" height="35px" fit="contain" :src="robot" />
         <div class="cahtText">
-            <textShow :text="item.text" />
+          <textShow :text="item.text" />
         </div>
       </div>
       <div v-if="item.text && item.type === 'user'" class="chat chatRight">
-        <van-image width="35px" height="35px" fit="contain" :src="userData.UserAvatar || user" />
+        <van-image
+          width="35px"
+          height="35px"
+          fit="contain"
+          :src="userData.UserAvatar || user"
+        />
         <div class="cahtText" v-text="item.text"></div>
       </div>
     </div>
@@ -47,11 +41,14 @@
         </van-button>
       </template>
     </van-field>
+    <shanshipin v-if="!userData.UserId" />
   </div>
 </template>
 <script setup>
+import shanshipin from '../../components/shanshipin.vue';
 import robot from '../../assets/img/chat/robot_2.png';
 import user from '../../assets/img/chat/user.png';
+import { showToast } from 'vant';
 import { ref, nextTick } from 'vue';
 
 import textShow from './textShow.vue';
@@ -71,12 +68,25 @@ const chat = ref([]);
 const load = ref(false);
 const chatEle = ref(null);
 const inputText = ref('');
+
+if (!userData.value.UserId) {
+  chat.value.push(
+    ...[
+      {
+        text: '闪视频是什么?',
+        type: 'user',
+      },
+      {
+        text: '“闪视频”是全新打造的视听新媒体平台,专注于以视频形式传播陕西文化、讲好陕西故事,汇聚陕西省内党政机关、主流媒体、企事业单位内容资源,深度聚焦移动互联网时代的陕西省域文化建设,为全体关注陕西、热爱陕西的移动互联网用户提供了解陕西、展示自我的窗口和舞台,内容主要以视频内容为主。\n客服联系方式:\n联系电话:18502918086\n邮箱:service_ssp@163.com',
+        type: 'robot',
+      },
+    ]
+  );
+}
+
 function saveText() {
+  if (!userData.value.UserId) return showToast('请下载闪视频进行完整体验');
   if (!inputText.value) return;
-  chat.value.push({
-    text: inputText.value,
-    type: 'user',
-  });
   load.value = true;
   nextTick(() => {
     // 滚动到最底层
@@ -84,7 +94,6 @@ function saveText() {
       chatEle.value.scrollTop = chatEle.value.scrollHeight;
     }
   });
-  inputText.value = '';
   let prompt = [];
   const startIndex = chat.value.length > 10 ? chat.value.length - 10 : 0;
   for (let i = startIndex; i < chat.value.length; i++) {
@@ -96,10 +105,14 @@ function saveText() {
     userName: userData.value.UserName || '',
   })
     .then(r => {
-      console.log(r);
       load.value = false;
       chat.value.push({
-        text: (r.result || ''),
+        text: inputText.value,
+        type: 'user',
+      });
+      inputText.value = '';
+      chat.value.push({
+        text: r.result || '',
         type: 'robot',
       });
       nextTick(() => {
@@ -122,7 +135,9 @@ function saveText() {
   height: 100vh;
   position: relative;
   padding-bottom: 55px;
-  background-color: #ffffff;
+  background: url('../../assets/img/chat/bg.png') no-repeat;
+  background-size: 100% 10%;
+  background-position: center center;
   overflow-y: auto;
   .van-field {
     background-color: #eee;
@@ -139,7 +154,7 @@ function saveText() {
   .chat {
     padding: 1em 1.5em;
     width: 100%;
-    background-color: #f4f4f6;
+    background-color: #f4f4f680;
     .cahtText {
       text-align: left;
       line-height: 1.5em;
@@ -160,7 +175,7 @@ function saveText() {
   }
 
   .chatRight {
-    background: #ffffff;
+    background: #ffffff80;
   }
 
   .loading {
@@ -185,6 +200,14 @@ function saveText() {
     }
   }
 }
+
+.ortherP {
+  padding-top: 70px;
+  .shanshipin {
+    top: 0;
+    background-color: #eee;
+  }
+}
 @keyframes load {
   from {
     background-color: #aaa;