Browse Source

Merge branch 'master' of gitee.com:godoos/godoos

master
秋田弘 6 months ago
parent
commit
d98631590e
  1. 1
      cloud/.gitignore
  2. 29
      cloud/README.md
  3. 36
      cloud/build.sh
  4. 4
      frontend/src/components/chat/ChatMenu.vue
  5. 4
      frontend/src/system/config.ts
  6. 4
      frontend/src/system/index.ts
  7. 11
      frontend/src/util/goutil.ts
  8. 3
      frontend/vite.config.ts

1
cloud/.gitignore

@ -1,3 +1,4 @@
tmp tmp
deps/dist deps/dist
deps/*.zip deps/*.zip
dist/

29
cloud/README.md

@ -0,0 +1,29 @@
## 安装帮助
### 第一步:安装nodejs
```
cd ../frontend
npm i
npm run build
```
- 打包成功后复制/godo/deps/dist目录下所有文件到cloud/deps/dist目录
### 第二步:安装golang环境打包
#### linux/mac环境下打包
```
sudo chmod +x build.sh
./build.sh
```
#### windows环境下打包
- 首先安装mingw-w64,进入命令行界面
```
./build.sh
```
- 打包成功后每个系统的版本在dist目录下

36
cloud/build.sh

@ -0,0 +1,36 @@
#!/bin/bash
# 定义要构建的平台
PLATFORMS=("linux/amd64" "windows/amd64" "darwin/amd64" "linux/arm64" "windows/arm64" "darwin/arm64")
# 定义版本号
SCRIPT_VERSION="1.0.0"
# 获取当前脚本的绝对路径
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
for PLATFORM in "${PLATFORMS[@]}"; do
# 分割平台字符串
OS=$(echo $PLATFORM | cut -d '/' -f 1)
ARCH=$(echo $PLATFORM | cut -d '/' -f 2)
# 设置后缀
case $OS in
"windows") SUFFIX=".exe" ;;
*) SUFFIX="" ;;
esac
OUT_PATH="./dist/"
if [ ! -d "$OUT_PATH" ]; then
mkdir "$OUT_PATH"
fi
# 输出文件名
OUTPUT_FILE="${OUT_PATH}godocloud_${OS}_${ARCH}${SUFFIX}"
# 设置GOOS和GOARCH环境变量
export GOOS=$OS
export GOARCH=$ARCH
export GODOTOPTYPE="web"
# 执行编译命令,并处理可能的错误
go build -ldflags="-s -w" -o "$OUTPUT_FILE" ./main.go || { echo "编译 $OS/$ARCH 失败,请检查错误并尝试解决。"; continue; }
echo "编译 $OS/$ARCH 成功,生成文件: $OUTPUT_FILE"
done

4
frontend/src/components/chat/ChatMenu.vue

@ -51,7 +51,7 @@
</div> </div>
</el-row> </el-row>
<el-row @click="store.setCurrentNavId(2)"> <!-- <el-row @click="store.setCurrentNavId(2)">
<div class="menu-icon-box"> <div class="menu-icon-box">
<el-icon <el-icon
v-if="store.currentNavId === 2" v-if="store.currentNavId === 2"
@ -66,7 +66,7 @@
<Monitor /> <Monitor />
</el-icon> </el-icon>
</div> </div>
</el-row> </el-row> -->
<!-- 设置按钮固定在底部 --> <!-- 设置按钮固定在底部 -->
<el-row <el-row

4
frontend/src/system/config.ts

@ -309,9 +309,13 @@ export const setSystemConfig = (config: any) => {
}; };
export const clearSystemConfig = () => { export const clearSystemConfig = () => {
const config = getSystemConfig();
if (config.userType === 'person') {
const storetype = localStorage.getItem('GodoOS-storeType') || 'local'; const storetype = localStorage.getItem('GodoOS-storeType') || 'local';
localStorage.clear() localStorage.clear()
localStorage.setItem('GodoOS-storeType', storetype) localStorage.setItem('GodoOS-storeType', storetype)
}
//localStorage.removeItem('GodoOS-config'); //localStorage.removeItem('GodoOS-config');
}; };
// function bin2hex(s: string) { // function bin2hex(s: string) {

4
frontend/src/system/index.ts

@ -123,10 +123,12 @@ export class System {
upgradeStore.onlineMessage(); upgradeStore.onlineMessage();
// upgradeStore.userChatMessage(); // upgradeStore.userChatMessage();
}, 3000); }, 3000);
} }else{
setTimeout(() => { setTimeout(() => {
upgradeStore.systemMessage() upgradeStore.systemMessage()
}, 6000); }, 6000);
}
} }
/** /**

11
frontend/src/util/goutil.ts

@ -1,4 +1,4 @@
import { getSystemKey } from "@/system/config"; import { getSystemConfig } from "@/system/config";
export async function OpenDirDialog() { export async function OpenDirDialog() {
if ((window as any).go) { if ((window as any).go) {
return (window as any)['go']['app']['App']['OpenDirDialog'](); return (window as any)['go']['app']['App']['OpenDirDialog']();
@ -19,12 +19,17 @@ export async function checkUrl(url: string) {
} }
export function RestartApp() { export function RestartApp() {
if (!(window as any).go) { if (!(window as any).go) {
const apiUrl = getSystemKey("apiUrl"); const config = getSystemConfig();
fetch(apiUrl + "/system/restart").then(() => { if (config.userType == 'person') {
fetch(config.apiUrl + "/system/restart").then(() => {
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 1000); }, 1000);
}) })
} else {
window.location.reload();
}
//window.location.reload(); //window.location.reload();
} else { } else {
return (window as any)['go']['app']['App']['RestartApp'](); return (window as any)['go']['app']['App']['RestartApp']();

3
frontend/vite.config.ts

@ -43,5 +43,6 @@ export default defineConfig(async () => ({
} }
}, },
outDir: '../godo/deps/dist', outDir: '../godo/deps/dist',
} },
base: './',
})); }));

Loading…
Cancel
Save