SpringBoot 在线协同办公小程序开发 全栈式项目实战

download:SpringBoot 在线协同办公小程序开发 全栈式项目实战

将来,在线协同办公将成为一种常态化的工做方式。本课程将采用最流行的先后端分离架构设计,应用 SpringBoot+uniapp 技术栈开发一款在线协同办公的小程序。让你掌握将来趋势型业务 + 先后端综合技术栈,带你实现全技术栈的综合提高。html

技术要求
1.HTML / CSS 基础 2.JS 交互知识 3.基本的 Vue 知识 4.JavaWeb 相关知识
环境参数
SpringBoot 2.三、uni-app2.9 开发工具:IDEA、HBuilderX小程序

1。四位数字字母验证码的生成实例后端

复制代码
1 import random
2 if name =="main": #四位数字字母验证码的生成
3 checkcode="" #保存验证码的变量
4 for i in range(4):
5 index=random.randrange(0,4) #生成一个0~3中的数
6 if index!=i and index +1 !=i:
7 checkcode +=chr(random.randint(97,122)) # 生成a~z中的一个小写字母
8 elif index +1==i:
9 checkcode +=chr(random.randint(65,90) ) # 生成A~Z中的一个大写字母
10 else:
11 checkcode +=str(random.randint(1,9)) # 数字1-9
12 print(checkcode)
复制代码
输出为:m47A、8wQ九、vugS架构


2。格式化时间函数app

1 def formatTime(longtime):
2 '''格式化时间的函数'''
3 import time
4 return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(longtime))

3。记录显示登陆日志实例前后端分离

复制代码
import timedom

def show_info():
print('''输入提示数字,执行相应操做
0:退出
1:查看登陆日志
''')ide

def write_loginfo(username):
"""
将用户名和登陆时间写入日志
:param username: 用户名
"""
with open('log.txt','a') as f:
string = "用户名:{} 登陆时间:{}\n".format(username ,time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
f.write(string)函数

def read_loginfo():
"""
读取日志
"""
with open('log.txt','r') as f:
while True:
line = f.readline()
if line == '':
break # 跳出循环
print(line) # 输出一行内容工具

if name == "main":

输入用户名

username = input('请输入用户名:')
# 检测用户名
while len(username) < 2 :
    print('用户名长度应很多于2位')
    username = input('请输入用户名:')
# 输入密码
password = input('请输入密码:')
# 检测密码
while len(passw ord) < 6 :
    print('密码长度应很多于6位')
    password = input('请输入密码:')

print('登陆成功')
write_loginfo(username)  # 写入日志
show_info()              # 提示信息
num = int(input('输入操做数字:')) # 输入数字
while True:
    if num == 0:
        print('退出成功')
        break
    elif num == 1:
        print('查看登陆日志')
        read_loginfo()
        show_info()
        num = int(input('输入操做数字:'))
    else:
        print('您输入的数字有误')
        show_info()
        num = int(input('输入操做数字:'))

3。模拟淘宝客服自动回复
复制代码
1 # 任务2:模拟淘宝客服自动回复
2
3 def find_answer(question):
4 with open('reply.txt','r') as f :
5 while True:
6 line=f.readline()
7 if not line: #也能够为if line==''
8 break
9 keyword=line.split('|')[0]
10 reply=line.split('|')[1]
11 if keyword in question:
12 return reply
13 return '对不起,没有你想要找的问题'
14
15 if name =='main':
16 question=input('请输入想要提问的内容:')
17 while True:
18 if question=='bye':
19 break
20 reply=find_answer(question)
21 if not reply:
22 question=input("小蜜不懂您在说什么,您能够问一些与订单、帐户和支付相关的内容(退出请输入bye):")
23 else:
24 print(reply)
25 question=input("您能够问一些与订单、帐户和支付相关的内容(退出请输入bye):")
26 print('谢谢,再见!')
27
复制代码

复制代码

4。求最大公约数和最小公倍数 (展转相除法)
最大公约数:指两个或多个整数共有约数中最大的一个

最小公倍数:两个或多个整数公有的倍数叫作它们的公倍数,其中除0之外最小的一个公倍数就叫作这几个整数的最小公倍数

两者关系:两个数之积=最小公倍数*最大公约数

复制代码1 a=int(input('输入数字1:'))2 b=int(input('输入数字2:'))3 s=a*b4 while a%b!=0:5 a,b=b,(a%b)6 print(a)7 print(b)8 else:9 print(b,'is the maximum common divisor最大公约数')10 print(s//b,'is the least common multiple,最小公倍数')

相关文章
相关标签/搜索