index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view>
  3. <!-- <view class="header-index">
  4. <text class="header-title">智疗助手</text>
  5. <navigator v-if="name" @click="to_home" class="header-login">您好:{{name}}</navigator>
  6. <navigator v-else url="/pages/login/login" class="header-login">登录/注册</navigator>
  7. </view> -->
  8. <!-- <uv-swiper class="button-all"
  9. bgColor="background-color: rgba(0, 0, 0, 0);"
  10. style="margin:0 -15px;height: calc(25vh - 15px);" height="25vh" imgMode="aspectFill" indicator indicatorMode="dot" :list="list">
  11. </uv-swiper> -->
  12. <image class="top-img" src="@/static/img/lbt1.jpg"></image>
  13. <view class="container">
  14. <!-- <view class="search-bar">
  15. <input type="text" placeholder="请输入关键词搜索" />
  16. </view> -->
  17. <view @click="to_ai()" class="large-button button-all" style="background-color: #d4f4c2;"><!-- blanchedalmond -->
  18. <view class="align-center flex justify-between">
  19. <image style="height: 25vw; width: 25vw; margin-left: 0vw;" src="@/static/img/ai-talk.png"></image>
  20. <p style="color: #5c6a7c; font-size: 30px; margin-left: 3vw;">AI 问诊</p>
  21. </view>
  22. </view>
  23. <view @click="$util.navigateTo('/pages/img_process/img_process')" class="large-button button-all" style="background-color: blanchedalmond;"><!-- blanchedalmond -->
  24. <view class="align-center flex justify-between">
  25. <image style="height: 23vw; width: 23vw; margin-left: 0vw;" src="@/static/img/识别.png"></image>
  26. <p style="color: #5c6a7c; font-size: 28px; margin-left: 3vw;">病例识别</p>
  27. </view>
  28. </view>
  29. <view @click="$util.navigateTo('/pages/BMI/BMI')" class="large-button button-all" style="background-color: aliceblue;">
  30. <view class="align-center flex justify-between">
  31. <image style="height: 25vw; width: 25vw; margin-left: 0vw;" src="@/static/img/bmi.png"></image>
  32. <p style="color: #5c6a7c; font-size: 30px; margin-left: 12vw;">B M I</p>
  33. </view>
  34. </view>
  35. <view>
  36. <image style="height: 30vw;width: 30vw; margin-top: auto; position: fixed; bottom: 0vh; left: -2vw;" src="@/static/img/doctor.png"></image>
  37. <view v-if="isTalking" :style="{ width: talkWidth }" class="talk">{{message}}</view>
  38. </view>
  39. <!-- <uv-button @click="$util.navigateTo('/pages/test/test')"></uv-button> -->
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. onLoad() {
  46. this.$user_api.check_login();
  47. },
  48. mounted(){
  49. this.talk();
  50. },
  51. onShow() {
  52. this.name = uni.getStorageSync("name");
  53. },
  54. onPullDownRefresh() {
  55. this.name = uni.getStorageSync("name");
  56. setTimeout(() => {uni.stopPullDownRefresh();}, 1000);
  57. },
  58. data() {
  59. return {
  60. name: null,
  61. time: 1,
  62. message: '您好 !',
  63. message_num: 0,
  64. talkWidth: '30vw',
  65. isTalking: true
  66. // list: [
  67. // '../../static/img/lbt1.jpg',
  68. // '../../static/img/lbt2.jpg',
  69. // '../../static/img/lbt3.jpg'
  70. // ]
  71. };
  72. },
  73. methods: {
  74. to_ai(){
  75. uni.switchTab({
  76. url: '/pages/ai/ai'
  77. })
  78. },
  79. to_home(){
  80. uni.switchTab({
  81. url: '/pages/my/my'
  82. })
  83. },
  84. talk(){
  85. return new Promise((resolve, reject) => {
  86. if(this.message_num < 6){
  87. if(this.message_num == 1) {
  88. this.talkWidth = '30vw';
  89. const hour = new Date().getHours();
  90. console.log('hour: ',hour);
  91. if (hour >= 4 && hour < 8) {
  92. this.message = '早上好 !'; // 早上
  93. } else if (hour >= 8 && hour < 12) {
  94. this.message = '上午好 !'; // 上午
  95. } else if (hour >= 12 && hour < 18) {
  96. this.message = '下午好 !'; // 下午
  97. } else {
  98. this.message = '晚上好 !'; // 晚上
  99. }
  100. this.applyAnimation();
  101. }
  102. if(this.message_num == 2) {
  103. this.talkWidth = '60vw';
  104. this.message = '希望您今天过得愉快。';
  105. this.applyAnimation();
  106. }
  107. if(this.message_num == 3) {
  108. this.talkWidth = '65vw';
  109. this.message = '有什么我可以帮您的吗?';
  110. this.applyAnimation();
  111. }
  112. if(this.message_num == 4) {
  113. this.talkWidth = '60vw';
  114. this.message = '注意休息,保持健康。';
  115. this.applyAnimation();
  116. }
  117. this.message_num = this.message_num + 1;
  118. // console.log('this.message_num: ',this.message_num);
  119. setTimeout(() => this.talk(), 3000);
  120. }
  121. else{
  122. this.message_num = 0;
  123. setTimeout(() => this.talk(), 3000);
  124. }
  125. })
  126. },
  127. applyAnimation() {
  128. this.isTalking = false;
  129. setTimeout(() => this.isTalking = true, 100);
  130. },
  131. }
  132. };
  133. </script>
  134. <!--
  135. background-image: url('@/static/img/background.jpg');
  136. background-position: top center; /* 图片定位到顶部中心 */
  137. background-repeat: no-repeat; /* 防止图片重复 */
  138. background-size: 100% auto; /* 宽度覆盖整个容器,高度按比例调整 */-->
  139. <style>
  140. page {
  141. height: 100vh;
  142. }
  143. .container {
  144. background-color: #ffffff;
  145. margin: 0 15px;
  146. display: flex;
  147. flex-direction: column;
  148. height: 80vh;
  149. }
  150. .header-index {
  151. width: 100%;
  152. padding: 10px;
  153. display: flex;
  154. justify-content: space-between;
  155. align-items: center;
  156. color: #ee4863;
  157. font-weight: 1000;
  158. backdrop-filter: blur(10px); /* 高斯模糊效果 */
  159. background-color: #f8df72; /* 半透明背景 */
  160. border: none;
  161. }
  162. .header-title {
  163. font-size: 20px;
  164. }
  165. .header-login {
  166. color: white;
  167. text-decoration: none;
  168. font-size: 16px;
  169. }
  170. .search-bar {
  171. width: 100%;
  172. }
  173. .search-bar input {
  174. font-size: 16px;
  175. width: 100%;
  176. height: 5vh;
  177. padding: 10px;
  178. box-sizing: border-box;
  179. border-radius: 5px;
  180. }
  181. .button-group {
  182. font-weight: 1000;
  183. margin-top: 20px;
  184. width: 100%;
  185. display: flex;
  186. justify-content: space-between;
  187. gap: 20px;
  188. }
  189. .square-button {
  190. width: 100%;
  191. height: 18vh;
  192. line-height: 100px;
  193. text-align: center;
  194. color: #5bae23;
  195. border: none;
  196. border-radius: 5px;
  197. }
  198. .large-button {
  199. color: #fff;
  200. z-index: 0;
  201. display: flex;
  202. justify-content: center;
  203. align-items: center;
  204. width: 100%;
  205. height: 16vh;
  206. margin-top: 20px;
  207. width: 100%;
  208. font-weight: 1000;
  209. }
  210. .talk {
  211. position: fixed;
  212. bottom: 4vh;
  213. left: 30vw;
  214. width: 30vw;
  215. height: 40px;
  216. color: #5c6a7c;
  217. font-size: 20px;
  218. font-weight: 1000;
  219. border-radius: 8px;
  220. background-color: #ffece3;
  221. display: flex; /* 使用flex布局来实现居中 */
  222. justify-content: center; /* 水平居中 */
  223. align-items: center; /* 垂直居中 */
  224. }
  225. .talk::before {
  226. content: "";
  227. position: absolute;
  228. top: 50%; /* 三角形位于元素下方 */
  229. right: 100%; /* 水平居中 */
  230. width: 0;
  231. height: 0;
  232. border-top: 6px solid transparent;
  233. border-bottom: 6px solid transparent;
  234. border-right: 10px solid #ffece3; /* 使用变量 */
  235. transform: translateY(-50%); /* 确保三角形的中心点位于 .active 元素的中心 */
  236. }
  237. .talk {
  238. opacity: 0; /* 初始透明度 */
  239. animation: fadeInLeft 1s ease-in-out forwards;
  240. }
  241. /* 箭头淡入动画 */
  242. @keyframes fadeInLeft {
  243. 0% {
  244. opacity: 0;
  245. transform: translateX(100%);
  246. }
  247. 100% {
  248. opacity: 1;
  249. transform: translateX(0);
  250. }
  251. }
  252. </style>