lua網橋和路由模式資料的設定

2021-08-21 02:59:50 字數 4606 閱讀 6410

以下是自行寫的lua網橋和路由模式資料的設定。警供參考:

module("luci.controller.wizard", package.seeall)

function index()

entry(, call("action"), "設定嚮導", 6)

entry(, call("commit"))

entry(, call("action_first"), "設定嚮導下一步", 6)

entry(, call("commit_first"))

entry(, call("action_first_first"), "設定嚮導下一步", 6)

entry(, call("commit_first_first"))

entry(, call("action_first_second"), "設定嚮導下一步", 6)

entry(, call("commit_first_second"))

entry(, call("action_second"), "設定嚮導再下一步", 6)

entry(, call("commit_second"))

entry(, call("action_last"), "設定嚮導最後一步", 6)

entry(, call("commit_last"))

end--設定設定嚮導頁面

function action()

luci.template.render("admin_setting/wizard")

end--設定嚮導基本設定

function commit()

end--設定設定嚮導下一步頁面

function action_first()

luci.template.render("admin_setting/wizard1")

end--設定嚮導下一步基本設定

function commit_first()

end--設定設定嚮導下一步頁面

function action_first_first()

luci.template.render("admin_setting/wizard1.1")

end--設定嚮導下一步基本設定

function commit_first_first()

end--設定設定嚮導下一步頁面

function action_first_second()

luci.template.render("admin_setting/wizard1.2")

end--設定嚮導下一步基本設定

function commit_first_second()

end--設定設定嚮導頁面

function action_second()

luci.template.render("admin_setting/wizard2")

end--設定嚮導基本設定

function commit_second()

end--設定嚮導最後一步頁面

function action_last()

luci.template.render("admin_setting/wizard3")

end--設定嚮導最後一步基本設定

--網橋和路由模式的判斷

if mode=="route" then

--路由模式

--pppoe撥號

if pppoe ~= "undefined" then

local pppoe = json.decode(pppoe)

uci:set("network","wan1","inte***ce")

uci:set("network","wan1","ifname",pppoe["ifname"])

uci:set("network","wan1","proto",pppoe['proto'])

uci:set("network","wan1","username",pppoe['username'])

uci:set("network","wan1","password",pppoe['password'])

end--dhcp客戶端設定

if dhcp_client ~= "undefined" then

local dhcp_client = json.decode(dhcp_client)

end--ip靜態

if static ~= "undefined" then

local static = json.decode(static)

end--lan口設定

if lan ~= "undefined" then

local lan = json.decode(lan)

uci:set("network","lan1","inte***ce")

uci:set("network","lan1","ifname",lan["ifname"])

uci:set("network","lan1","type",lan["type"])

uci:set("network","lan1","mode",lan["mode"])

uci:set("network","lan1","proto",lan['proto'])

uci:set("network","lan1","ipaddr",lan['ipaddr'])

uci:set("network","lan1","netmask",lan['netmask'])

end--dhcp服務端設定

if dhcp ~= "undefined" then

local dhcp = json.decode(dhcp)

uci:set("dhcp","lan1","dhcp")

uci:set("dhcp","lan1","inte***ce",dhcp["inte***ce"])

uci:set("dhcp","lan1","start",dhcp["start"])

uci:set("dhcp","lan1","limit",dhcp["limit"])

uci:set("dhcp","lan1","leasetime",dhcp['leasetime'])

uci:set("dhcp","lan1","force",dhcp['force'])

uci:delete("dhcp","lan1","ignore")

enduci:delete("network","lan1","gateway")

uci:delete("network","lan1","dns")

else

--網橋模式

if bridge ~= "undefined" then

local bridge = json.decode(bridge)

uci:set("network","lan1","inte***ce")

uci:set("network","lan1","ifname",bridge["ifname"])

uci:set("network","lan1","proto",bridge["proto"])

uci:set("network","lan1","mode",bridge["mode"])

uci:set("network","lan1","ipaddr",bridge['ipaddr'])

uci:set("network","lan1","netmask",bridge['netmask'])

uci:set("network","lan1","gateway",bridge['gateway'])

uci:set("network","lan1","dns",bridge['dns'])

uci:set("dhcp","lan1","dhcp")

uci:set("dhcp","lan1","ignore",bridge['ignore'])

uci:delete("dhcp","lan1","force")

uci:delete("network","wan1")

endend

uci:commit("network")

uci:commit("dhcp")

end

路由的hash和history模式

為了構建 spa 單頁面應用 需要引入前端路由系統,這也就是 vue router 存在的意義。前端路由的核心,就在於 改變檢視的同時不會向後端發出請求。為了達到這種目的,瀏覽器當前提供了以下兩種支援 history 利用了 html5 history inte ce 中新增的 pushstate ...

vue的路由hash模式和history模式區別

1.直觀區別 hash模式url帶 號,history模式不帶 號。2.深層區別 hash模式url裡面永遠帶著 號,我們在開發當中預設使用這個模式。如果使用者考慮url的規範那麼就需要使用history模式,因為history模式沒有 號,是個正常的url適合推廣宣傳 但是使用history模式還...

vue 路由的hash模式和history模式

這兩種模式都是屬於前端路由。前端路由,顧名思義,前端使用的路由,路由不會觸發向後端請求的操作,而只是為了管理前端頁面。當路由路徑改變時,載入相應的內容。一 hash模式 url中會帶有 本質是使用window.onhashchange來監聽url的變化 本質是 後邊內容的變化 並根據url的不同載入...