Browse Source

文件浏览

master
xyiege 5 months ago
parent
commit
b5977b29d7
  1. 29
      aufs/core/AuFile.go
  2. 3
      aufs/main.go
  3. 11
      vue/afvue/src/api/scinfo.js
  4. 7
      vue/afvue/src/views/Flist.vue

29
aufs/core/AuFile.go

@ -0,0 +1,29 @@
package core
import (
"fmt"
"net/http"
"net/rpc/jsonrpc"
)
// 文件操作
func Flist(w http.ResponseWriter, r *http.Request) {
// 获取需要监听的服务器
// sc := r.Form.Get("srcip")
// 测试JSONRPC
service := "192.168.66.92:9098"
client, err := jsonrpc.Dial("tcp", service)
if err != nil {
fmt.Fprintf(w, "jsonrpc dial faild %v", err)
return
}
// 调用远程方法
var reply string
var args = Args{"/www/xt"}
err = client.Call("FileRpcService.GetFilePath", args, &reply)
if err != nil {
fmt.Fprintf(w, "jsonrpc call faild %v", err)
return
}
}

3
aufs/main.go

@ -44,7 +44,8 @@ func startWeb() {
http.HandleFunc("/scdetail", core.Scdetail)
// 编辑
http.HandleFunc("/scedit", core.Scedit)
// 文件列表
http.HandleFunc("/flsit", core.Flist)
// 内存信息
http.HandleFunc("/dtmem", core.Dtmem)

11
vue/afvue/src/api/scinfo.js

@ -41,4 +41,13 @@ export function Scedit(data){
method: 'POST',
data
})
}
}
// 文件列表
export function Flist(data){
return axios({
url: '/flist',
method: 'POST',
data
})
}

7
vue/afvue/src/views/Flist.vue

@ -5,6 +5,8 @@
</template>
<script>
import { Flist } from '@/api/scinfo'
export default {
name: 'Flist',
data() {
@ -16,10 +18,13 @@ export default {
},
mounted() {
this.srcip = this.$route.query.srcip
this.getFlist()
},
methods: {
getFlist() {
this.$http.get('/api/flist?srcip='+this.srcip).then(res => {
Flist({
srcip: this.srcip
}).then(res => {
this.flist = res.data
})
}

Loading…
Cancel
Save