12345678910111213141516171819202122232425262728293031 |
- import { getVersions } from "@/services/login"
- import { Modal } from "antd"
- import React from 'react';
- //第一次登录
- async function versions() {
- let bdVersions = localStorage.getItem('versions') //本地
- let fwqVersions = ''//服务器版本
- let content = ''//版本更新内容
- await getVersions().then((res) => {
- if (res?.data) {
- fwqVersions = res?.data?.configValue
- content = res?.data?.remark?.replace(/\n/ig,'<br/>')
- }
- })
- if (fwqVersions && bdVersions !== fwqVersions) {//不一样
- //执行逻辑
- Modal.info({
- title: '版本更新!',
- content: React.createElement('div', { dangerouslySetInnerHTML: { __html: content } }),
- keyboard: false,
- cancelText: '稍后我自己刷新页面',
- okText: '现在就去刷新页面',
- onOk: () => {
- localStorage.setItem('versions', fwqVersions)//重新设置服务器版本
- location?.reload()
- },
- })
- }
- }
- export default versions
|