Dim e As RequestEventArgs = args(0)
Dim path As String = "foxtableAppTest"
Dim wb As New weui
wb.InsertHTML("<!DOCTYPE html>")
wb.InsertHTML("<html>")
wb.InsertHTML("<head>")
wb.InsertHTML("<meta charset='utf-8'>")
wb.InsertHTML("<meta name='viewport' c />")
wb.InsertHTML("<title></title>")
wb.InsertHTML("<script src='../mui/js/mui.js'></script>")
wb.InsertHTML("<script src='../mui/js/xc.js'></script>")
wb.InsertHTML("<link href='../mui/css/mui.css' rel='stylesheet'/>")
wb.InsertHTML("<script Type='text/javascript' charset='utf-8'>mui.init();</script>")
wb.InsertHTML("</head>")
wb.InsertHTML("<body>")
wb.InsertHTML("<header class='mui-bar mui-bar-nav mui-bar-nav-bg'>")
wb.InsertHTML("<a id='icon-menu' class='mui-action-back mui-icon mui-icon-left-nav mui-pull-left'></a>")
'wb.InsertHTML ("<a class='mui-action-back mui-icon mui-icon-home mui-pull-right mui-a-color'></a>")
wb.InsertHTML("<h1 class='mui-title'>我的照片</h1>")
wb.InsertHTML("</header>")
wb.InsertHTML("<div class='mui-content'>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
wb.AddForm("","form1","xpcj.htm")
If e.PostValues.Count = 0 Then
wb.InsertHTML("form1","<div style='height: 150px;'><span style='position:absolute;margin-top:60px;margin-left:20px;'>我的照片:</span><img alt='你还没有照片' src='./xp/" & e.Cookies("username") & ".jpg' style='height: 150px;width:120px;margin-left:120px;max-height:100%'></div><br>")
If ReadSex(e.Cookies("username"))= "女"
wb.InsertHTML("form1","<div style='height: 170px'><span style='position:absolute;margin-top:70px;margin-left:20px;'>样板照片:</span><div id='imgs'><img src='./xp/yb.jpg' style='height:150px;width:120px;margin-top:20px;margin-left:120px;max-height:100%;'></div></div><br/>")
End If
If ReadSex(e.Cookies("username"))= "男"
wb.InsertHTML("form1","<div style='height:150px'><span style='position:absolute;margin-top:70px;margin-left:20px;'>样板照片:</span><div id='imgs' style='widht:120px;height:150px;'><img src='./xp/yb1.jpg' style='height:150px;width:120px;margin-left:120px;max-height:100%;'></div></div><br/>")
End If
With wb.AddPageFooter("form1","pf1","")
With wb.AddButtonGroup("form1","btg1",False)
Dim bt1= .Add("btn1", "拍照", "button")
bt1.Attribute = "onclick=getImageByCamera('imgs') style='border:1px solid black;border-radius:40px;padding:0px;'"
bt1.kind=1
Dim bt2= .Add("btn2", "相册", "button")
bt2.Attribute = "onclick=galleryImg('imgs') style='border:1px solid black;border-radius:40px;padding:0px;'"
bt2.kind=1
Dim bt3=.Add("btn3", "上传")
bt3.kind=1
bt3.attribute="style='border:1px solid black;border-radius:40px;padding:0px;'onclick=javascript:mui.toast('正在上传,请等待');"
End With
End With
Else
For Each key As String In e.PostValues.Keys
If key.Contains("imgs_") Then
Dim bs As Byte() = Convert.FromBase64String(e.PostValues(key).split(",")(1))
Dim stream As System.IO.Stream = New System.IO.MemoryStream(bs)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
bmp.Save("c:\web\xp\" & e.Cookies("username") & ".jpg", ImageFormat.Jpeg)
Dim slt As String ="c:\web\xp\" & e.Cookies("username") & ".jpg"
Dim img1 As image = getImage(slt)
Dim bmp1 As bitmap
If img1.width > 400 Then
If 400 * (img1.height / img1.width) > 300 Then
bmp1 = new bitmap(img1, 400*(300/(400*(img1.height/img1.width))), 300)
Else
bmp1 = new bitmap(img1, 300, 300 * (img1.height / img1.width))
End If
End If
bmp1.save(slt, ImageFormat.Jpeg)
' bmp1.Dispose
End If
Next
With wb.AddMsgPage("","msgpage","上传成功", "") '生成成功提示页
Dim bt1=.AddButton("btn1","确定","xpcj.htm")
bt1.kind=1
bt1.Attribute = "style='border:1px solid black;border-radius:20px;padding:0px;width:50%'"
End With
End If
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/common.js'></script>", True)
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/camera.js'></script>")
e.WriteString(wb.Build)
e.Handled = True
Case "xpcj.htm"
e.AsyncExecute = True
Functions.Execute("xpcj",e) '学生个人成绩
Functions.AsyncExecute("xpcj", e)
老师,是这样吧?现在还是存在两个问题,
第一个是当上传大一点的图片在上传时还没提示上传成功就自动关闭,要重启才行。
第二个点顶部返回没问题,但点手机返回就自动关闭,但其他页面点顶部返回和手机返回都可以并不出现自动关闭的问题,是哪里有问题呢