uniapp将聊天页面定位始终定位到最底部展示

在制作IM即时通讯的时候,常常因为发出的消息不能定位到最底部,对于新手来说比较烦恼,复制下面这段代码就能实现聊天始终定位在最底部

 this.$nextTick(() => {
  
                 // document.getElementById("scrolldIV2").scrollIntoView();     //h5端定位到指定位置    
                 setTimeout(() => {
                     uni.createSelectorQuery().select(".cu-chat").boundingClientRect(function(res) { //定位到你要的class的位置
                         console.log("标签获取====>", res)
                         uni.pageScrollTo({
                             scrollTop: res.height,
                             duration: 0
                         });
                     }).exec()
  
                 }, 50)
  
                 //this.viewIndex = "im_" + this.ChatList.length;
  
             })

代码上传到阿里云codeup上

1.需要先注册阿里云的codeup
2.创建仓库
3.设置https密码


4.推送代码

为了标识身份,建议先完成 Git 全局设置

git config --global user.name "xxx" 
git config --global user.email "xxxx@qq.com" 
cd existing_folder
# 在本地的代码库下,新建Git的管理目录
git init
# 添加Git连接的网址
git remote add origin https://codeup.aliyun.com/662exx07/xx.git
#提交改动代码
git add .
# 提交代码带暂存区
git commit -m 'xxxx'
#拉取远程数据
git pull origin master 
# 推送到远程仓库
git push -u origin master

# 使 Git 在检出文件时将 LF 转换为 CRLF,并在提交时将 CRLF 转换回 LF
git config --global core.autocrlf true

Git在push推送时,报错提示信息如下:

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

原因分析:

是由于本地和远程仓库两者代码文件不同步,因此需要先pull,进行合并然后再进行push

解决方法:
1、先使用pull命令:

git pull --rebase origin master

2、再使用push命令:

git push -u origin master

nginx代理 minio

## 客户端
upstream minio {
        ##minio服务器1,权重越高被分配到的几率越大
        server 192.168.0.37:9001 weight=1;
        ##minio服务器2
        server 192.168.0.38:9001 weight=1;
        ##minio服务器3
        server 192.168.0.39:9001 weight=1;
 }
 server{
    listen       9001;
    server_name  localhost;
    location / {
            proxy_pass http://minio;
            # 添加websocket支持
            proxy_http_version      1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
            proxy_set_header        Host  $http_host;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }
 }
 # 客户端请求服务器最大允许大小-不限(文件大小)
 client_max_body_size 0; 
 ## 服务端
 upstream minioServer {
        ##minio服务器1,权重越高被分配到的几率越大
        server 192.168.0.37:9000 weight=1;
        ##minio服务器2
        server 192.168.0.38:9000 weight=1;
        ##minio服务器3
        server 192.168.0.39:9000 weight=1;
 }
 server{
    listen       9000;
    server_name  localhost;
    location / {
            proxy_pass http://minioServer;
            # 添加websocket支持
            proxy_http_version      1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
            proxy_set_header        Host  $http_host;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }
 }
 

docker-compose: 在容器中添加中文字体

docker-compose 配置

先上 docker-compose.yml 的内容

 hh-job:
   image: hh-job
   container_name: hh-job
   environment:
     # 时区上海
     TZ: Asia/Shanghai
     LANG: C.UTF-8
     LC_ALL: C.UTF-8
   ports:
     - "9209:9209"
   volumes:
     # 配置文件
     - /docker/hh-job/logs/:/hh-job/logs
     - /data/fonts:/usr/share/fonts
   privileged: true
   restart: always
   networks:
     ruoyi_net:
       ipv4_address: 172.30.0.113

1)可以进入到容器查看当前字体是什么。
命令:locale -a


(2)查看已经安装的中文字体
命令:fc-list :lang=zh

(3)手动重载系统字体
命令:fc-cache -fv