|
|
@@ -143,6 +143,40 @@ M.menu_top = function()
|
|
|
</nav>
|
|
|
]]
|
|
|
end
|
|
|
+M.teacher_photos = function()
|
|
|
+ require("app.app")
|
|
|
+ local conn = db_conn()
|
|
|
+ local edu_id = edu_id()
|
|
|
+ local edu_teacher = require("app.function.edu_teacher")
|
|
|
+ local edu_setting = require("app.function.edu_setting")
|
|
|
+ local teacher_info = edu_teacher.get_by_id(pint("id"),edu_id,conn)
|
|
|
+ if teacher_info == nil then
|
|
|
+ conn:close()
|
|
|
+ return ""
|
|
|
+ end
|
|
|
+ local domain_assets_cn = edu_setting.get_assets_domain_cn(edu_id,conn)
|
|
|
+ local photos = {}
|
|
|
+ if teacher_info.photo and type(teacher_info.photo) == "string" and teacher_info.photo ~= "" then
|
|
|
+ local ok, decoded = pcall(function() return cjson.decode(teacher_info.photo) end)
|
|
|
+ if ok and type(decoded) == "table" then
|
|
|
+ photos = decoded
|
|
|
+ end
|
|
|
+ end
|
|
|
+ local content = "<div><div class='home-img'><img src='"..domain_assets_cn.."/".. teacher_info.avatar.."' class='img-fluid bg-img' alt=''></div></div>"
|
|
|
+ for i,v in ipairs(photos) do
|
|
|
+ if type(v) == "string" then
|
|
|
+ content = content..[[<div>
|
|
|
+ <div class="home-img">
|
|
|
+ <img src="]]..domain_assets_cn.."/"..v..[[" class="img-fluid bg-img" alt="">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ]]
|
|
|
+ end
|
|
|
+ end
|
|
|
+ conn:close()
|
|
|
+ return content
|
|
|
+ -- return "<h1>卧槽</h1>"
|
|
|
+end
|
|
|
M.regist = function(env)
|
|
|
for key, value in pairs(M) do
|
|
|
if type(value) == "function" and key ~= "functions" and key ~= "get_all_functions" then
|