cview

package
v0.0.0-...-e0691d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Demo code for the Flex primitive.

A presentation of the tview package, implemented with tview.

Navigation

The presentation will advance to the next slide when the primitive demonstrated in the current slide is left (usually by hitting Enter or Escape). Additionally, the following shortcuts can be used:

  • Ctrl-N: Jump to next slide
  • Ctrl-P: Jump to previous slide

Index

Constants

This section is empty.

Variables

View Source
var Exclude_Check []string

不需要检查登录的页面

Functions

This section is empty.

Types

type CView

type CView struct {
	IsLogin       bool
	App           *tview.Application
	Pages         *tview.Pages
	CurrentSlide  string
	PreviousSlide string
	Slides        []Slide
	TabInfo       *tview.TextView
	Api           *http.Api
	FriendsList   []interface{}
	UserInfo      map[string]interface{}
	ChatToUserId  int                //当前聊天用户
	MessageList   map[int]*list.List //用户消息列表
	Ws            websocket.Ws
	TextView      *tview.TextView
}

func NewCView

func NewCView() *CView

初始化一个显示客户端

func (*CView) ApiLogin

func (c *CView) ApiLogin(form *tview.Form)

func (*CView) Chat

func (c *CView) Chat(nextSlide func()) (title string, content tview.Primitive)

func (*CView) ChatToUser

func (c *CView) ChatToUser(userid int, title string)

打开好友聊天

func (*CView) CheckJump

func (c *CView) CheckJump(passDone func(), slide string)

检查登录与跳转页面 passDone 检查通过后执行

func (*CView) CheckLogin

func (c *CView) CheckLogin() bool

func (*CView) Cover

func (c *CView) Cover(nextSlide func()) (title string, content tview.Primitive)

Cover returns the cover page.

func (*CView) Index

func (c *CView) Index()

Starting point for the presentation.

func (*CView) JumpTo

func (c *CView) JumpTo(pagename string)

跳转页面

func (*CView) Login

func (c *CView) Login(nextSlide func()) (title string, content tview.Primitive)

Form demonstrates forms.

func (*CView) ReadMessage

func (c *CView) ReadMessage()

从socket读取消息到视图

func (*CView) Reload

func (c *CView) Reload(index int, slide Slide)

重载页面 index 页面编号, slide 定义的视图方法

func (*CView) ScreenAndSave

func (c *CView) ScreenAndSave(userid int, name string, time string, message string)

发送到屏幕 并保存到本地

type ClientMessage

type ClientMessage struct {
	Name     string `json:"name"`
	Avator   string `json:"avator"`
	Id       string `json:"id"`
	Group    string `json:"group"`
	Time     string `json:"time"`
	ToId     string `json:"to_id"`
	Content  string `json:"content"`
	City     string `json:"city"`
	ClientIp string `json:"client_ip"`
	Refer    string `json:"refer"`
}

TypeMessage Data

type Slide

type Slide func(nextSlide func()) (title string, content tview.Primitive)

Slide is a function which returns the slide's main primitive and its title. It receives a "nextSlide" function which can be called to advance the presentation to the next slide.

type TypeMessage

type TypeMessage struct {
	Type interface{} `json:"type"` //内容分发类型:ping、init、message 等等
	Data interface{} `json:"data"`
}

发送内容content 载体

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL