学习笔记20230914

亮子 2023-09-14 00:44:15 13231 0 0 0

1、配置域名

  • a.shop.com 管理端
  • b.shop.com 买家端
  • s.shop.com 卖家端

2、nginx配置

	upstream cmsserver {
		server 127.0.0.1:9090 weight=10;
	}

	# E:\tmp\www\b
    server {
        listen       80;
        listen       [::]:80;
        server_name  b.shop.com;
        root    E:/tmp/www/b;

        location / {
          root    E:/tmp/www/b;
          index   index.html index.htm;
        }
		
		# 注意斜杠
        location /api/ {
            proxy_pass      http://cmsserver/;
            proxy_redirect  off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        
    }
	
	# E:\tmp\www\s
    server {
        listen       80;
        listen       [::]:80;
        server_name  s.shop.com;
        root    E:/tmp/www/s;

        location / {
          root    E:/tmp/www/s;
          index   index.html index.htm;
        }
		
		# 注意斜杠
        location /api/ {
            proxy_pass      http://cmsserver/;
            proxy_redirect  off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
	
	# E:\tmp\www\a
    server {
        listen       80;
        listen       [::]:80;
        server_name  a.shop.com;
        root    E:/tmp/www/a;

        location / {
          root    E:/tmp/www/a;
          index   index.html index.htm;
        }
		
		# 注意斜杠
        location /api/ {
            proxy_pass      http://cmsserver/;
            proxy_redirect  off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        
    }

3、引入vue

<script src="js/lib/vue/vue.js"></script>
<script src="js/lib/element-ui/lib/index.js"></script>

  <script>
    new Vue({
      el: '#app',
      data: function() {
        return { visible: false }
      }
    })
  </script>

4、引入axios

参考链接
https://www.axios-http.cn/docs/intro

<script src="js/lib/axios/axios.js"></script>

  <script>
    new Vue({
      el: '#app',
      data: function() {
        return { visible: false }
      }
    })
  </script>
                // 发送验证码
                axios.post(this.serverUrl + '/user/sendSms', {
                    mobile: this.loginForm.mobile,
                    code: this.loginForm.mobile
                  })
                  .then((res) => {
                    console.log(res);
                    if(res.data.code == 200) {
                        this.$message.success("验证码发送成功")
                    }
                    else {
                        this.$message.error(res.data.msg)
                    }
                  });

5、实现登录

6、实现列表