admin管理员组

文章数量:1662092

环境Linux系统,必须可访问外网,且能被访问

官方部署教程:Spire.Cloud 私有化部署教程(一) - CentOS 7 系统Spire.Cloud支持的Linux服务器系统包括CentOS和Ubuntu(推荐使用CentOS 7和Ubuntu 18版本),本教程主要介绍如何在CentOS 7系统上实现Spire.Cloud私有化部署。 详细步骤如下: 一、安装CentOS 7系统 首先,需要在服务器上安装CentOS 7...https://cloud.e-iceblue/index.php/tutorials/cloud/privatization/spirecloud-privatization-deployment-centos-7

爬坑过程:

1、虚拟机做Centos部署后,需要执行su root 切换到root账户,且需要配置静态IP,且需要做内网访问,详细教程见下

centos 设置静态IP_Teln_小凯的博客-CSDN博客右键进入CMDcd 到系统文件位置cd /etc/sysconfig/network-scripts输入ls 查看系统文件名然后管了这个窗口,在打开一个,切换到root账号,要不然没权限修改配置文件su root打开配置文件vi /etc/sysconfig/network-scripts/ifcfg-ens33按Insert键开始编辑,将bootproto的值改为static,并在末尾加上IP地址,子网掩码,网关和DNS服务器。编辑完之后按ESC键退出编辑.https://blog.csdn/qq873113580/article/details/124039578

2、通过阿里云等申请的Linux系统,则不需要做静态ip

3、保证网络正常,很重要,要不然你都不知道哪里安装错了!!!!

4、cd /root (虚拟机系统需要执行,阿里云那种不需要)

4、先执行这个脚本,要不然安装mysql会报错(官方教程没有,研究半天)

 rpm --import https://repo.mysql/RPM-GPG-KEY-mysql-2022

5、执行教程里面的安装,大概半小时+

sh install_centos7.sh

6、执行教程里面的绑定license

sh binding_license.sh

 出现ServerInfo代表成功了

 7、配置预览地址(官方教程没有)

8、最好再执行下这句,后面遇到问题找技术人员说的 (官方教程没有)

sh genallfonts.sh

9、重启云服务,不知道什么原因执行他自带的服务命令,报错了,来个了狠的直接重启linux服务器,私有云环境就算搭建好了

reboot   

上面搞完,DEMO也就能跑了,下面开始做文件上传、预览、编辑等

1、文件上传的位置在这个目录

/root/spire.cloud/example/public/files

2、文件上传的代码教程,虽然官方给的java版,但是NET的类也支持这个

Spire.Cloud.Storage 上传、移动、复制、下载及删除文件https://cloud.e-iceblue/index.php/tutorials/cloud/webapi/java/spire-cloud-storage-j/spire-cloud-storage-operate-files

NET类的引用

通过 NuGet 安装 Spire.Cloud Web APIhttps://cloud.e-iceblue/index.php/tutorials/cloud/webapi/net/nuget-spire-cloud-web-api

3、代码调用在线预览和编辑参考这个

私有化部署前端调用 Spire.Cloud 快速接入https://cloud.e-iceblue/index.php/tutorials/cloud/privatization/spire-cloud-quick-guide

具体参数介绍

快速接入https://cloud.e-iceblue/index.php/tutorials/cloud/writeonline/quick-guide4、默认开启留痕编辑

     JS版本,代码调用的时候写:

editorConfig: {
                        mode: 'True',
                        lang: lang,
                        callbackUrl: "",
                        user: {
                            id: "",
                            name: "e-iceblue",
                            token: token,
                            appid: appid,
                            appkey: appkey
                        },
                        customization: {
                            goback: {
                                url: ""
                            },
                            "openReviewChanges": true,//开启留痕编辑
                        }
                    },

基础配置版,用在他自带的Demo里面:

 5、在线编辑保存功能

前台核心代码

var callbackfn = function (result) {
            if (result && result.data) {
                var data = result.data,
                    fileName = data[0],
                    url = data[1];
                if (fileName.indexOf('=') > -1)
                    fileName = fileName.split('=')[1];
                ajax({
                    url: '/Word/Save',
                    type: 'post',
                    data: { 'filename': fileName, 'fileuri': url },
                    dataType: 'json',
                    async: false,
                    success: function (json) {
                        if (json.code == 200 || json.code == '200') {
                            alert('保存成功');
                        } else {
                            this.error(json, '保存失败');
                        }
                    },
                    error: function (json, msg) {
                        alert(msg);
                    }
                });
            }
        };

后台NET代码

[HttpPost]
        public ActionResult Save(string fileName,
                     string fileuri)
        {
            VerSon++;
            string file = Server.MapPath("/Content/File/" + VerSon +"_"+ fileName);
            WebClient client = new WebClient();
            client.Credentials = CredentialCache.DefaultCredentials;
            client.DownloadFile(fileuri, file);

            string path = VerSon + "_" + fileName;
            string localFilePath = file;
            System.IO.Stream data = new FileStream(localFilePath, FileMode.Open);
            string storageName = null;
            var response = fileApi.UploadFile(path, data, storageName);
            data.Close();
            return Json(new { code = 200, msg = "Save Success" });
        }

历史版本的思路:

1、每次保存都需要把远程的文件下载到本地

2、本地做历史版本记录后,再上传到云端

3、然后从云端查看和继续编辑新的版本

历史版本示意

 打开后示意

4、关于自带历史版本的补充

需要在打开的时候,新增两个参数值

本文标签: 过程iceblueoffice