Browse Source

上传 教材章节

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
7d167ca9f4

+ 33
- 0
Common/system/HttpHelper.cs View File

@@ -143,6 +143,39 @@ namespace Common.system
143 143
             }
144 144
             return null;
145 145
         }
146
+
147
+        /// <summary>
148
+        ///调用Post接口
149
+        /// </summary>
150
+        /// <param name="request"></param>
151
+        /// <returns></returns>
152
+        public static string HttpPost(string body, string Url)
153
+        {
154
+            try
155
+            {
156
+                Encoding encoding = Encoding.UTF8;
157
+
158
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
159
+                request.Method = "POST";
160
+                request.Accept = "text/html,application/xhtml+xml,*/*";
161
+                request.ContentType = "application/json";
162
+
163
+                byte[] buffer = encoding.GetBytes(body);
164
+                request.ContentLength = buffer.Length;
165
+                request.GetRequestStream().Write(buffer, 0, buffer.Length);
166
+
167
+                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
168
+                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
169
+                {
170
+                    return reader.ReadToEnd();
171
+                }
172
+            }
173
+            catch (Exception ex)
174
+            {
175
+                // LogHelper.Instance.Debug($"POST接口连接失败,请求参数:{ex.Message}");
176
+                return "POST报错:" + ex.Message;
177
+            }
178
+        }
146 179
         /// <summary>
147 180
         /// Post Http请求
148 181
         /// </summary>

+ 14
- 0
XHWK.Model/ComboBoxBean.cs View File

@@ -0,0 +1,14 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class ComboBoxBean
10
+    {
11
+        public int Key { get; set; }
12
+        public string Value { get; set; }
13
+    }
14
+}

+ 111
- 0
XHWK.Model/Model_DirectorList.cs View File

@@ -0,0 +1,111 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class Model_DirectorList
10
+    {
11
+        /// <summary>
12
+        /// id
13
+        /// </summary>
14
+        public int? id { get; set; }
15
+
16
+        /// <summary>
17
+        /// 创建人姓名
18
+        /// </summary>
19
+        public string createname { get; set; }
20
+
21
+        /// <summary>
22
+        /// id
23
+        /// </summary>
24
+        public int? page { get; set; }
25
+
26
+        /// <summary>
27
+        /// id
28
+        /// </summary>
29
+        public int? pageSize { get; set; }
30
+
31
+        /// <summary>
32
+        /// 章节id
33
+        /// </summary>
34
+        public int directorid { get; set; }
35
+
36
+        /// <summary>
37
+        /// 章节名称
38
+        /// </summary>
39
+        public string directorname { get; set; }
40
+
41
+        /// <summary>
42
+        /// 所属章节
43
+        /// </summary>
44
+        public int? directorpid { get; set; }
45
+
46
+        /// <summary>
47
+        /// 章节排序
48
+        /// </summary>
49
+        public int directororder { get; set; }
50
+
51
+        /// <summary>
52
+        /// 是否是叶子节点
53
+        /// </summary>
54
+        public int? leaf { get; set; }
55
+
56
+        /// <summary>
57
+        /// 教材id
58
+        /// </summary>
59
+        public int? lsbid { get; set; }
60
+
61
+        /// <summary>
62
+        /// 章节列表
63
+        /// </summary>
64
+        public int? directortype { get; set; }
65
+
66
+        /// <summary>
67
+        /// 创建人
68
+        /// </summary>
69
+        public int? createid { get; set; }
70
+
71
+        /// <summary>
72
+        /// 创建时间
73
+        /// </summary>
74
+        public int? createtime { get; set; }
75
+
76
+        /// <summary>
77
+        /// 学校id
78
+        /// </summary>
79
+        public int? schoolid { get; set; }
80
+
81
+        /// <summary>
82
+        /// 子章节
83
+        /// </summary>
84
+        public List<Model_DirectorList> children { get; set; }
85
+
86
+        /// <summary>
87
+        /// 章节归属级别
88
+        /// </summary>
89
+        public int? asknum { get; set; }
90
+
91
+        /// <summary>
92
+        /// 章节归属级别
93
+        /// </summary>
94
+        public int? correctRate { get; set; }
95
+
96
+        /// <summary>
97
+        /// 章节归属级别
98
+        /// </summary>
99
+        public int? selected { get; set; }
100
+
101
+        /// <summary>
102
+        /// 章节归属级别
103
+        /// </summary>
104
+        public int directorlevel { get; set; }
105
+
106
+        public override string ToString()
107
+        {
108
+            return $"{nameof(id)}: {id}, {nameof(createname)}: {createname}, {nameof(page)}: {page}, {nameof(pageSize)}: {pageSize},{nameof(directorid)}: {directorid}, {nameof(directorname)}: {directorname}, {nameof(directorpid)}: {directorpid}, {nameof(directororder)}: {directororder}, {nameof(leaf)}: {leaf}, {nameof(lsbid)}: {lsbid}, {nameof(directortype)}: {directortype}, {nameof(directorlevel)}: {directorlevel}, {nameof(createid)}: {createid}, {nameof(createtime)}: {createtime}, {nameof(schoolid)}: {schoolid}, {nameof(children)}: {children}, {nameof(asknum)}: {asknum}, {nameof(correctRate)}: {correctRate}, {nameof(selected)}: {selected}";
109
+        }
110
+    }
111
+}

+ 102
- 0
XHWK.Model/Model_ResourceAdd.cs View File

@@ -0,0 +1,102 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class Model_ResourceAdd
10
+    {
11
+        //        converted: 0
12
+        //createid: 80
13
+        //directorid: 1009
14
+        //duration: 39
15
+        //imgUrl: ""
16
+        //level: 2
17
+        //lsbid: 40
18
+        //mp4code: "h264"
19
+        //resourcebelong: 3
20
+        //resourceclass: 2
21
+        //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
22
+        //resourcename: "weather_pic"
23
+        //resourcesize: 6105268
24
+        //resourcetype: 0
25
+        //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
26
+        //schoolid: 12
27
+        //suffix: "mp4"
28
+        //uid: 80
29
+        /// <summary>
30
+        /// 是否转换0未转换1已转换
31
+        /// </summary>
32
+        public int converted { get; set; }
33
+        /// <summary>
34
+        /// 创建人id	
35
+        /// </summary>
36
+        public int createid { get; set; }
37
+        /// <summary>
38
+        /// 章节id
39
+        /// </summary>
40
+        public int directorid { get; set; }
41
+        /// <summary>
42
+        /// 视频时长(秒)
43
+        /// </summary>
44
+        public int duration { get; set; }
45
+        /// <summary>
46
+        /// 
47
+        /// </summary>
48
+        public string imgUrl { get; set; }
49
+        /// <summary>
50
+        /// 资源级别1校本2个人(备课)3导学案4视频库
51
+        /// </summary>
52
+        public int level { get; set; }
53
+        /// <summary>
54
+        /// 教材关系表id
55
+        /// </summary>
56
+        public int lsbid { get; set; }
57
+        /// <summary>
58
+        /// mp4文件编码:mpeg4网页端不能播放,h264网页端能播放
59
+        /// </summary>
60
+        public string mp4code { get; set; }
61
+        /// <summary>
62
+        /// 资源归属1平台2校本3个人
63
+        /// </summary>
64
+        public int resourcebelong { get; set; }
65
+        /// <summary>
66
+        /// 资源分类1音频2视频3图片4文档
67
+        /// </summary>
68
+        public int resourceclass { get; set; }
69
+        /// <summary>
70
+        /// 封面图地址
71
+        /// </summary>
72
+        public string resourcecover { get; set; }
73
+        /// <summary>
74
+        /// 资源名称
75
+        /// </summary>
76
+        public string resourcename { get; set; }
77
+        /// <summary>
78
+        /// 文件大小   zxy lx
79
+        /// </summary>
80
+        public long resourcesize { get; set; }
81
+        /// <summary>
82
+        /// 资源归类0未知1课件 2学案(导学案)3习题 4微课视频(视频库)5教学设计
83
+        /// </summary>
84
+        public int resourcetype { get; set; }
85
+        /// <summary>
86
+        /// 资源地址
87
+        /// </summary>
88
+        public string resourceurl { get; set; }
89
+        /// <summary>
90
+        /// 学校id
91
+        /// </summary>
92
+        public int schoolid { get; set; }
93
+        /// <summary>
94
+        /// 文件后缀
95
+        /// </summary>
96
+        public string suffix { get; set; }
97
+        /// <summary>
98
+        /// 
99
+        /// </summary>
100
+        public int uid { get; set; }
101
+    }
102
+}

+ 16
- 0
XHWK.Model/Model_ResourceAddTwo.cs View File

@@ -0,0 +1,16 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class Model_ResourceAddTwo 
10
+    {
11
+  public string videopath { get; set; }
12
+        public string coverpath { get; set; }
13
+        public int duration { get; set; }
14
+        public string mp4code { get; set; } 
15
+    }
16
+}

+ 47
- 0
XHWK.Model/Model_TsubjectbookList.cs View File

@@ -0,0 +1,47 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class Model_TsubjectbookList
10
+    {
11
+        private string tbid;
12
+        private int lsbid;
13
+        private string selected;
14
+        private int subjectid;
15
+        private string subjectname;
16
+        private string bookname;
17
+        private string coverpath;
18
+        /// <summary>
19
+        /// 教师教材关系id
20
+        /// </summary>
21
+        public string Tbid { get => tbid; set => tbid = value; }
22
+        /// <summary>
23
+        /// 教材关联关系表id
24
+        /// </summary>
25
+        public int Lsbid { get => lsbid; set => lsbid = value; }
26
+        /// <summary>
27
+        /// 是否选中:0未选中1已选中
28
+        /// </summary>
29
+        public string Selected { get => selected; set => selected = value; }
30
+        /// <summary>
31
+        /// 科目id
32
+        /// </summary>
33
+        public int Subjectid { get => subjectid; set => subjectid = value; }
34
+        /// <summary>
35
+        /// 科目名称
36
+        /// </summary>
37
+        public string Subjectname { get => subjectname; set => subjectname = value; }
38
+        /// <summary>
39
+        /// 册别名称
40
+        /// </summary>
41
+        public string Bookname { get => bookname; set => bookname = value; }
42
+        /// <summary>
43
+        /// 封面图地址
44
+        /// </summary>
45
+        public string Coverpath { get => coverpath; set => coverpath = value; }
46
+    }
47
+}

+ 5
- 0
XHWK.Model/XHWK.Model.csproj View File

@@ -50,11 +50,16 @@
50 50
     <Reference Include="System.Xml" />
51 51
   </ItemGroup>
52 52
   <ItemGroup>
53
+    <Compile Include="ComboBoxBean.cs" />
53 54
     <Compile Include="Model_App.cs" />
54 55
     <Compile Include="Model_Canvas.cs" />
56
+    <Compile Include="Model_DirectorList.cs" />
55 57
     <Compile Include="Model_DrawData.cs" />
56 58
     <Compile Include="Model_Page.cs" />
59
+    <Compile Include="Model_ResourceAddTwo.cs" />
60
+    <Compile Include="Model_ResourceAdd.cs" />
57 61
     <Compile Include="Model_Screenshot.cs" />
62
+    <Compile Include="Model_TsubjectbookList.cs" />
58 63
     <Compile Include="Model_UserInfo.cs" />
59 64
     <Compile Include="Model_Video.cs" />
60 65
     <Compile Include="Model_WKData.cs" />

+ 1
- 1
XHWK.WKTool/App.config View File

@@ -29,7 +29,7 @@
29 29
     文件上传: https://schoolfiletest.xhkjedu.com/
30 30
     展示文件:   https://schoolfiletest.xhkjedu.com/-->
31 31
     <!--摄像头位置 1.右上 2.左上 3.右下 4.左下-->
32
-    <add key="CameraPosition" value=""/>
32
+    <add key="CameraPosition" value="1"/>
33 33
     <!--上传每片大小 Mb-->
34 34
     <add key="UploadSliceLen" value="1"/>
35 35
   </appSettings>

+ 19
- 0
XHWK.WKTool/App.cs View File

@@ -77,6 +77,18 @@ namespace XHWK.WKTool
77 77
         /// 数据存放目录
78 78
         /// </summary>
79 79
         public static string DataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XHMicroLesson\\";
80
+        /// <summary>
81
+        /// 教材列表
82
+        /// </summary>
83
+        public static List<Model_TsubjectbookList> TsubjectbookList=null;
84
+        /// <summary>
85
+        /// 章节列表
86
+        /// </summary>
87
+        public static List<Model_DirectorList> DirectorList = null;
88
+        /// <summary>
89
+        /// 上传个人空间 入参
90
+        /// </summary>
91
+        public static Model_ResourceAddTwo ResourceAddTwo = null;
80 92
         #region 点阵笔
81 93
         /// <summary>
82 94
         /// 点阵笔
@@ -132,7 +144,14 @@ namespace XHWK.WKTool
132 144
         /// 提示窗口
133 145
         /// </summary>
134 146
         public static PromptWindow W_PromptWindow = null;
147
+        /// <summary>
148
+        /// loding页面
149
+        /// </summary>
135 150
         public static LoadDialog myloading;
151
+        /// <summary>
152
+        /// 上传页面
153
+        /// </summary>
154
+        public static UploadWindow W_UploadWindow = null;
136 155
         #endregion
137 156
         #endregion
138 157
 

+ 3
- 0
XHWK.WKTool/AppUpdateWin.xaml View File

@@ -15,6 +15,9 @@
15 15
     WindowStartupLocation="CenterScreen"
16 16
     WindowStyle="None"
17 17
     >
18
+    <Window.Effect>
19
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
20
+    </Window.Effect>
18 21
     <Grid>
19 22
         <Views:ZJClippingBorder
20 23
             Margin="10"

+ 48
- 7
XHWK.WKTool/DAL/DAL_Upload.cs View File

@@ -40,7 +40,7 @@ namespace XHWK.WKTool.DAL
40 40
             {
41 41
                 try
42 42
                 {
43
-                    JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/isexist", @"application/x-www-form-urlencoded", @"md5=" + MD5, "");
43
+                    JObject jo = HttpHelper.PostFunction(FileRequestAddress /*"http://192.168.2.18:8908"*/ + @"/chunkdb/isexist", @"application/x-www-form-urlencoded", @"md5=" + MD5, "");
44 44
                     //0成功,1失败
45 45
                     if (jo["code"].ToString() == "0")
46 46
                     {
@@ -87,14 +87,18 @@ namespace XHWK.WKTool.DAL
87 87
             {
88 88
                 try
89 89
                 {
90
-                    JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"savefolder=" + Savefolder + "&identifier=" + FileCode, "");
90
+                    JObject jo = HttpHelper.PostFunction(FileRequestAddress /*"http://192.168.2.18:8908"*/ + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"savefolder=" + Savefolder + "&identifier=" + FileCode, "");
91
+                    Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString()); ;
92
+                    APP.ResourceAddTwo = new Model_ResourceAddTwo();
91 93
                     //0成功,1失败
92
-                    if (jo["code"].ToString() == "0")
94
+                    if (resultObj.code == 0 && resultObj.obj != null)
93 95
                     {
96
+                        APP.ResourceAddTwo = resultObj.obj;
94 97
                         return true;
95 98
                     }
96 99
                     else
97 100
                     {
101
+                        //Message = "上传失败!";
98 102
                         Message = jo["msg"].ToString();
99 103
                         return false;
100 104
                     }
@@ -141,7 +145,7 @@ namespace XHWK.WKTool.DAL
141 145
                     ErrMessage = "未找到课程!";
142 146
                     return false;
143 147
                 }
144
-                string UploadUrl = FileRequestAddress + "/chunkdb/upchunk";
148
+                string UploadUrl = FileRequestAddress /*"http://192.168.2.18:8908" */+ "/chunkdb/upchunk";//zxyceshi
145 149
                 if (VideoInfo.IsUpload)
146 150
                 {
147 151
                     ErrMessage = "视频已上传";
@@ -167,12 +171,41 @@ namespace XHWK.WKTool.DAL
167 171
                         //已上传长度
168 172
                         long len = VideoInfo.Uploaded * VideoInfo.SliceLen;
169 173
                         string fileName = FileToolsCommon.GetFileName(VideoInfo.VideoPath);
174
+
175
+
176
+                        ////分块
177
+                        //for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
178
+                        //{
179
+                        //    len = VideoInfo.Uploaded * VideoInfo.SliceLen;
180
+                        //    //取指定长度的流
181
+                        //    byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, (int)VideoInfo.SliceLen);
182
+                        //    //参数
183
+                        //    NameValueCollection formFields = new NameValueCollection();
184
+                        //    formFields.Add("identifier", VideoInfo.FileGuid);
185
+                        //    formFields.Add("chunkNumber", (VideoInfo.Uploaded + 1).ToString());
186
+                        //    formFields.Add("filename", fileName);
187
+                        //    formFields.Add("totalchunk", VideoInfo.Block.ToString());
188
+                        //    formFields.Add("md5", VideoInfo.FileMD5);
189
+                        //    JObject jo = HttpHelper.UploadRequestflow(UploadUrl, byteArray, fileName, formFields);
190
+                        //    //0成功,1失败
191
+                        //    if (jo["code"].ToString() != "0")
192
+                        //    {
193
+                        //        ErrMessage = jo["msg"].ToString();
194
+                        //        return false;
195
+                        //    }
196
+                        //}
197
+
198
+
199
+
200
+
201
+
202
+
170 203
                         //分块
171
-                        for (; len + VideoInfo.SliceLen < filelen; VideoInfo.Uploaded++)
204
+                        do
172 205
                         {
173 206
                             len = VideoInfo.Uploaded * VideoInfo.SliceLen;
174 207
                             //取指定长度的流
175
-                            byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, 102400);
208
+                            byte[] byteArray = FileToolsCommon.ReadBigFileSpecifyLength(VideoInfo.VideoPath, len, (int)VideoInfo.SliceLen);
176 209
                             //参数
177 210
                             NameValueCollection formFields = new NameValueCollection();
178 211
                             formFields.Add("identifier", VideoInfo.FileGuid);
@@ -180,6 +213,14 @@ namespace XHWK.WKTool.DAL
180 213
                             formFields.Add("filename", fileName);
181 214
                             formFields.Add("totalchunk", VideoInfo.Block.ToString());
182 215
                             formFields.Add("md5", VideoInfo.FileMD5);
216
+                            VideoInfo.Uploaded++;
217
+                            //formFields.Add();///教材
218
+                            //if()//章节若没选不传
219
+                            //{
220
+                            //    formFields.Add();
221
+                            //}
222
+
223
+
183 224
                             JObject jo = HttpHelper.UploadRequestflow(UploadUrl, byteArray, fileName, formFields);
184 225
                             //0成功,1失败
185 226
                             if (jo["code"].ToString() != "0")
@@ -187,7 +228,7 @@ namespace XHWK.WKTool.DAL
187 228
                                 ErrMessage = jo["msg"].ToString();
188 229
                                 return false;
189 230
                             }
190
-                        }
231
+                        } while (len + VideoInfo.SliceLen < filelen);
191 232
                         //合并文件
192 233
                         bool isres = ReportFileMerge(APP.UserInfo.Schoolid.ToString() + "/resource", VideoInfo.FileGuid, out ErrMessage);
193 234
                         if (isres)

+ 146
- 73
XHWK.WKTool/DAL/Interface.cs View File

@@ -1,4 +1,5 @@
1 1
 using Common.system;
2
+using Newtonsoft.Json.Linq;
2 3
 using System;
3 4
 using System.Collections.Generic;
4 5
 using System.Linq;
@@ -43,78 +44,150 @@ namespace XHWK.WKTool.DAL
43 44
                 return 1;
44 45
             }
45 46
         }
46
-        ///// <summary>
47
-        ///// 教师教材列表
48
-        ///// </summary>
49
-        ///// <param name="request"></param>
50
-        ///// <returns></returns>
51
-        //public int TsubjectbookList()
52
-        //{
53
-        //    //RESP_TsubjectbookList returnObj = new RESP_TsubjectbookList();
54
-        //    try
55
-        //    {
56
-        //        string url = ZConfig.apiUrl + "/tsubjectbook/list";//地址
57
-        //        Dictionary<string, int> dic = new Dictionary<string, int>
58
-        //        {
59
-        //            { "teacherid",APP.UserInfo.Userid}
60
-        //        };
61
-        //        string body = ZJsonHelper.ToJson(dic);
62
-        //        ResultVo<List<RESP_TsubjectbookList>> result = ZHttpUtil.PostAndRespSignle<ResultVo<List<RESP_TsubjectbookList>>>(url, postData: body);
63
-        //        if (result != null)
64
-        //        {
65
-        //            Shared.ServerMsg = result.msg;
66
-        //            Shared.TeachingData.RESP_TsubjectbookList = result.obj;
67
-        //            return result.code;
68
-        //        }
69
-        //        else
70
-        //        {
71
-        //            Shared.ServerMsg = "网络异常!";
72
-        //            ZCommonData.loginUser = new LoginUser();
73
-        //            return 1;
74
-        //        }
75
-        //    }
76
-        //    catch (Exception ex)
77
-        //    {
78
-        //        LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
79
-        //        return 1;
80
-        //    }
81
-        //}
82
-        ///// <summary>
83
-        ///// 章节--列表
84
-        ///// </summary>
85
-        ///// <param name="request"></param>
86
-        ///// <returns></returns>
87
-        //public int DirectorList(REQ_DirectorList _request)
88
-        //{
89
-        //    try
90
-        //    {
91
-        //        string url = ZConfig.apiUrl + "/director/list";//地址
92
-        //        Dictionary<string, int> dic = new Dictionary<string, int>
93
-        //        {
94
-        //            { "lsbid", _request.lsbid },
95
-        //            { "directortype", _request.directortype },
96
-        //            { "createid", _request.createid }
97
-        //        };
98
-        //        string body = ZJsonHelper.ToJson(dic);
99
-        //        ResultVo<List<RESP_DirectorList>> result = ZHttpUtil.PostAndRespSignle<ResultVo<List<RESP_DirectorList>>>(url, postData: body);
100
-        //        if (result != null)
101
-        //        {
102
-        //            Shared.ServerMsg = result.msg;
103
-        //            Shared.TeachingData.RESP_DirectorList = result.obj;
104
-        //            return result.code;
105
-        //        }
106
-        //        else
107
-        //        {
108
-        //            Shared.ServerMsg = "网络异常!";
109
-        //            ZCommonData.loginUser = new LoginUser();
110
-        //            return 1;
111
-        //        }
112
-        //    }
113
-        //    catch (Exception ex)
114
-        //    {
115
-        //        LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
116
-        //        return 1;
117
-        //    }
118
-        //}
47
+        /// <summary>
48
+        /// 教师教材列表
49
+        /// </summary>
50
+        /// <param name="request"></param>
51
+        /// <returns></returns>
52
+        public int TsubjectbookList()
53
+        {
54
+            APP.TsubjectbookList = new List<Model_TsubjectbookList>();
55
+            try
56
+            {
57
+                string url = ZConfig.apiUrl + "/tsubjectbook/list";//地址
58
+                Dictionary<string, int> dic = new Dictionary<string, int>
59
+                {
60
+                    { "teacherid",APP.UserInfo.Userid}
61
+                };
62
+                string body = JsonHelper.ToJson(dic);
63
+                ResultVo<List<Model_TsubjectbookList>> result = HttpHelper.PostAndRespSignle<ResultVo<List<Model_TsubjectbookList>>>(url, postData: body);
64
+                if (result != null)
65
+                {
66
+                    APP.ServerMsg = result.msg;
67
+                    APP.TsubjectbookList = result.obj;
68
+                    return result.code;
69
+                }
70
+                else
71
+                {
72
+                    APP.ServerMsg = "网络异常!";
73
+                    return 1;
74
+                }
75
+            }
76
+            catch (Exception ex)
77
+            {
78
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
79
+                return 1;
80
+            }
81
+        }
82
+        /// <summary>
83
+        /// 章节--列表
84
+        /// </summary>
85
+        /// <param name="request"></param>
86
+        /// <returns></returns>
87
+        public int DirectorList(int lsbid,int directortype,int createid)
88
+        {
89
+            APP.DirectorList = new List<Model_DirectorList>();
90
+            try
91
+            {
92
+                string url = ZConfig.apiUrl + "/director/list";//地址
93
+                Dictionary<string, int> dic = new Dictionary<string, int>
94
+                {
95
+                    { "lsbid", lsbid },
96
+                    { "directortype", directortype },
97
+                    { "createid", createid }
98
+                };
99
+                string body = JsonHelper.ToJson(dic);
100
+                ResultVo<List<Model_DirectorList>> result = HttpHelper.PostAndRespSignle<ResultVo<List<Model_DirectorList>>>(url, postData: body);
101
+                if (result != null)
102
+                {
103
+                    APP.ServerMsg = result.msg;
104
+                    APP.DirectorList = result.obj;
105
+                    return result.code;
106
+                }
107
+                else
108
+                {
109
+                    APP.ServerMsg = "网络异常!";
110
+                    return 1;
111
+                }
112
+            }
113
+            catch (Exception ex)
114
+            {
115
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
116
+                return 1;
117
+            }
118
+        }
119
+        /// <summary>
120
+        /// 资源--添加
121
+        /// </summary>
122
+        /// <param name="request"></param>
123
+        /// <returns></returns>
124
+        public int ResourceAdd(Model_ResourceAdd model)
125
+        {
126
+            APP.DirectorList = new List<Model_DirectorList>();
127
+            try
128
+            {
129
+                string url = ZConfig.apiUrl + "/resource/add";//地址
130
+                Dictionary<string, object> dic = new Dictionary<string, object>();
131
+                //            converted: 0
132
+                //createid: 80
133
+                //directorid: 1009
134
+                //duration: 39
135
+                //imgUrl: ""
136
+                //level: 2
137
+                //lsbid: 40
138
+                //mp4code: "h264"
139
+                //resourcebelong: 3
140
+                //resourceclass: 2
141
+                //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
142
+                //resourcename: "weather_pic"
143
+                //resourcesize: 6105268
144
+                //resourcetype: 0
145
+                //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
146
+                //schoolid: 12
147
+                //suffix: "mp4"
148
+                //uid: 80
149
+                dic.Add("converted", model.converted);
150
+                dic.Add("createid", model.createid);
151
+                if(model.directorid!=999999)//章节上传可以不选
152
+                {
153
+                    dic.Add("directorid", model.directorid);
154
+                }
155
+                dic.Add("duration", model.duration);
156
+                dic.Add("imgUrl", model.imgUrl);
157
+                dic.Add("level", model.level);
158
+                dic.Add("lsbid", model.lsbid);
159
+                dic.Add("mp4code", model.mp4code);
160
+                dic.Add("resourcebelong", model.resourcebelong);
161
+                dic.Add("resourceclass", model.resourceclass);
162
+                dic.Add("resourcecover", model.resourcecover);
163
+                dic.Add("resourcename", model.resourcename);
164
+                dic.Add("resourcesize", model.resourcesize);
165
+                dic.Add("resourcetype", model.resourcetype);
166
+                dic.Add("resourceurl", model.resourceurl);
167
+                dic.Add("schoolid", model.schoolid);
168
+                dic.Add("suffix", model.suffix);
169
+                //dic.Add("uid", model.uid);
170
+
171
+
172
+                string body = JsonHelper.ToJson(dic);
173
+                string xmlDoc = HttpHelper.HttpPost(body, url);
174
+                JObject obj = JObject.Parse(xmlDoc);
175
+                if (obj != null)
176
+                {
177
+                    APP.ServerMsg = obj["msg"].ToString();
178
+                    return Convert.ToInt32(obj["code"].ToString());
179
+                }
180
+                else
181
+                {
182
+                    APP.ServerMsg = "网络异常!";
183
+                    return 1;
184
+                }
185
+            }
186
+            catch (Exception ex)
187
+            {
188
+                LogHelper.WriteErrLog("【调用接口(RegisterController)】错误日志:" + ex.Message, ex);
189
+                return 1;
190
+            }
191
+        }
119 192
     }
120 193
 }

+ 8
- 39
XHWK.WKTool/LoginWindow.xaml View File

@@ -8,26 +8,12 @@
8 8
         Title="LoginWindow" Height="358" Width="471"   AllowsTransparency="True"
9 9
     ShowInTaskbar="False"
10 10
     WindowStartupLocation="CenterOwner"
11
-    WindowStyle="None">
11
+    WindowStyle="None"  BorderThickness="7">
12
+    <Window.Effect>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14
+    </Window.Effect>
12 15
     <Viewbox>
13
-        <Border Background="#fefefe" Height="358" Width="471">
14
-            <Border Background="#fdfdfd" Height="357" Width="470">
15
-                <Border Background="#fcfcfc" Height="356" Width="469">
16
-                    <Border Background="#fafafa" Height="355" Width="468">
17
-                        <Border Background="#f9f9f9" Height="354" Width="467">
18
-                            <Border Background="#f6f6f6" Height="353" Width="466">
19
-                                <Border Background="#f3f3f3" Height="352" Width="465">
20
-                                    <Border Background="#eeeeee" Height="351" Width="464">
21
-                                        <Border Background="#e9e9e9" Height="350" Width="463">
22
-                                            <Border Background="#e2e2e2" Height="349" Width="462">
23
-                                                <Border Background="#dcdcdc" Height="348" Width="461">
24
-                                                    <Border Background="#d3d3d3" Height="347" Width="460">
25
-                                                        <Border Background="#cccccc" Height="346" Width="459">
26
-                                                            <Border Background="#bfbfbf" Height="345" Width="458">
27
-                                                                <Border Background="#aeaeae" Height="344" Width="457">
28
-                                                                    <Border Background="#bababa" Height="343" Width="456">
29
-                                                                        <!--<Border Background="#e4e4e4" Height="342" Width="455">-->
30
-                                                                        <Grid Height="343" Width="456" Background="#FFFFFF">
16
+        <Grid Height="358" Width="471" Background="#FFFFFF">
31 17
             <!--分5行-->
32 18
             <Grid.RowDefinitions>
33 19
                 <RowDefinition Height="45"/>
@@ -47,7 +33,7 @@
47 33
             <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="20,20,0,0">
48 34
                 <TextBlock Text="登陆" FontSize="18" Padding="2,15,10,0"/>
49 35
                 <!--输入框-->
50
-                                                                                <Border Background="#cccbce" Width="371" Height="43" CornerRadius="3">
36
+                <Border Background="#cccbce" Width="371" Height="43" CornerRadius="3">
51 37
                     <TextBox x:Name="txbAccountNumber" Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="369" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
52 38
                 </Border>
53 39
             </StackPanel>
@@ -55,7 +41,7 @@
55 41
             <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="20,20,0,0">
56 42
                 <TextBlock Text="密码" FontSize="18" Padding="2,15,10,0"/>
57 43
                 <!--输入框-->
58
-                                                                                <Border Background="#cccbce" Width="371" Height="43" CornerRadius="3">
44
+                <Border Background="#cccbce" Width="371" Height="43" CornerRadius="3">
59 45
                     <PasswordBox x:Name="pobPassword" FontSize="16" Foreground="#333333" PasswordChar="*" Padding="5,12,2,2" Width="369" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
60 46
                 </Border>
61 47
             </StackPanel>
@@ -65,7 +51,7 @@
65 51
                 </Viewbox>
66 52
                 <TextBlock Text="记住账号" FontSize="18" Height="30" Padding="5,3,0,0"/>
67 53
             </StackPanel>
68
-            
54
+
69 55
             <!--第五行 开始按钮-->
70 56
             <Button  Cursor="Hand" Grid.Row="4" x:Name="btnStart" Content="登录" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="418" Height="50" Margin="10,0,10,0" Click="BtnStart_Click">
71 57
                 <Button.Template>
@@ -84,22 +70,5 @@
84 70
                 </Button.Template>
85 71
             </Button>
86 72
         </Grid>
87
-                                                                        </Border>
88
-                                                                    </Border>
89
-                                                                </Border>
90
-                                                            </Border>
91
-                                                        </Border>
92
-                                                    </Border>
93
-                                                </Border>
94
-                                            </Border>
95
-                                        </Border>
96
-                                    </Border>
97
-                                </Border>
98
-                            </Border>
99
-                        </Border>
100
-                    </Border>
101
-                </Border>
102
-            </Border>
103
-        <!--</Border>-->
104 73
     </Viewbox>
105 74
 </Window>

+ 3
- 2
XHWK.WKTool/MessageWindow.xaml View File

@@ -7,9 +7,10 @@
7 7
         mc:Ignorable="d" 
8 8
         Title="星火微课" WindowStartupLocation="CenterScreen"
9 9
     WindowStyle="None" AllowsTransparency="True"    WindowState="Normal"
10
-    ShowInTaskbar="False" Topmost="True" ResizeMode="NoResize" d:DesignHeight="250" Width="600" Height="220" BorderThickness="5,5,5,5" MouseMove="Window_MouseMove">
10
+    ShowInTaskbar="False" Topmost="True" ResizeMode="NoResize" 
11
+        d:DesignHeight="250" Width="600" Height="220"  MouseMove="Window_MouseMove"  BorderThickness="7">
11 12
     <Window.Effect>
12
-        <DropShadowEffect BlurRadius="8" Color="#FF060606" Direction="80" ShadowDepth="0"/>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
13 14
     </Window.Effect>
14 15
     <Grid>
15 16
         <Grid.RowDefinitions>

+ 21
- 18
XHWK.WKTool/PrintWindow.xaml View File

@@ -8,7 +8,10 @@
8 8
         Title="PrintWindow" Height="600" Width="900" AllowsTransparency="True"
9 9
     ShowInTaskbar="False"
10 10
     WindowStartupLocation="CenterOwner"
11
-    WindowStyle="None">
11
+    WindowStyle="None"  BorderThickness="7">
12
+    <Window.Effect>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14
+    </Window.Effect>
12 15
     <Grid>
13 16
         <Grid.RowDefinitions>
14 17
             <RowDefinition Height="120"/>
@@ -19,26 +22,17 @@
19 22
             <Grid.RowDefinitions>
20 23
                 <RowDefinition Height="auto"/>
21 24
                 <RowDefinition Height="*"/>
22
-                <RowDefinition Height="50"/>
25
+                <RowDefinition Height="70"/>
23 26
             </Grid.RowDefinitions>
24
-            <TextBlock Grid.Row="0" Text="打印预览" Background="#2E8CF0" Foreground="#FFFFFF" Width="50" HorizontalAlignment="Left" Margin="10,5,0,0"/>
27
+            <!--<TextBlock Grid.Row="0" Text="打印预览" Background="#2E8CF0" Foreground="#FFFFFF" Width="50" HorizontalAlignment="Left" Margin="10,5,0,0"/>-->
25 28
             <StackPanel Grid.Row="1" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,10,0,0">
26 29
                 <TextBlock  Text="打印机:" Width="210" FontSize="20"/>
27
-                <TextBlock Text="份数:" FontSize="20" Margin="120,0,0,0"/>
28
-                <TextBlock x:Name="txbNumberOfCopies" Width="100" Text="1" FontSize="16" Padding="50,10,0,0" Background="White" />
29
-                <Grid>
30
-                    <Grid.RowDefinitions>
31
-                        <RowDefinition Height="auto"/>
32
-                        <RowDefinition Height="auto"/>
33
-                    </Grid.RowDefinitions>
34
-                    <Button Grid.Row="0" x:Name="btnLess"  Content="-" Click="BtnLess_Click"/>
35
-                    <Button Grid.Row="1" x:Name="btnAdd"  Content="+" Click="BtnAdd_Click"/>
36
-                </Grid>
37 30
             </StackPanel>
38
-            <Button Grid.Row="1" x:Name="btnClose" Background="#CC4848" Foreground="#FFFFFF" Content="×" FontSize="20" Width="30" Height="30" HorizontalAlignment="Right" Margin="0,0,20,0" Click="BtnClose_Click">
31
+
32
+            <Button Grid.Row="2" x:Name="btnClose" Background="#CC4848" Foreground="#FFFFFF" Content="×" FontSize="20" Width="30" Height="30" HorizontalAlignment="Right" Margin="0,0,20,0" Click="BtnClose_Click">
39 33
 
40 34
             </Button>
41
-            <StackPanel Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,2,0,0">
35
+            <StackPanel Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,2,0,0" Height="40">
42 36
                 <ComboBox Cursor="Hand" Width="210"
43 37
                                 x:Name="cmbClass"
44 38
                                 Padding="10,0,10,0"
@@ -48,11 +42,20 @@
48 42
                                 FontSize="14"
49 43
                                 SelectedValuePath="Key"
50 44
                                 />
51
-                <TextBlock Text="点型:" FontSize="20"  Margin="120,10,0,0"/>
45
+                <TextBlock Text="份数:" FontSize="20" Margin="120,0,0,0" Padding="0,10,0,0"/>
46
+                <TextBlock x:Name="txbNumberOfCopies" Width="100" Text="1" FontSize="16" Padding="50,10,0,0" Background="White"/>
47
+                <Grid>
48
+                    <Grid.RowDefinitions>
49
+                        <RowDefinition Height="auto"/>
50
+                        <RowDefinition Height="auto"/>
51
+                    </Grid.RowDefinitions>
52
+                    <Button Grid.Row="0" x:Name="btnLess"  Content="-" Click="BtnLess_Click"/>
53
+                    <Button Grid.Row="1" x:Name="btnAdd"  Content="+" Click="BtnAdd_Click"/>
54
+                </Grid>
55
+                <!--<TextBlock Text="点型:" FontSize="20"  Margin="120,10,0,0"/>
52 56
                 <RadioButton x:Name="rbnSquarePoint" Content="方点" FontSize="16"  Margin="0,15,0,0" IsChecked="True"/>
53
-                <RadioButton x:Name="rbnDots" Content="圆点" FontSize="16"  Margin="0,15,0,0"/>
57
+                <RadioButton x:Name="rbnDots" Content="圆点" FontSize="16"  Margin="0,15,0,0"/>-->
54 58
             </StackPanel>
55
-            <TextBlock Grid.Row="2" Text="关闭" HorizontalAlignment="Right" Margin="0,2,20,0"  Width="30" Height="30"/>
56 59
         </Grid>
57 60
         <Grid Grid.Row="1">
58 61
             <Image x:Name="imgPri"/>

+ 9
- 9
XHWK.WKTool/PrintWindow.xaml.cs View File

@@ -78,11 +78,11 @@ namespace XHWK.WKTool
78 78
             string msg = string.Empty;
79 79
             string outPut = string.Empty;
80 80
             int pyte = 0; //0为方点 1为圆点
81
-            if(rbnSquarePoint.IsChecked==false)
82
-            {
83
-                pyte = 1;
84
-            }
85
-            LatticeFileHelper.GeneratingPDF(pdf, tpf, out pr, out msg, out outPut, pyte);
81
+            //if(rbnSquarePoint.IsChecked==false)
82
+            //{
83
+            //    pyte = 1;
84
+            //}
85
+            LatticeFileHelper.GeneratingPDF(pdf, tpf, out pr, out msg, out outPut/*, pyte*/);
86 86
             if (pr == 0)
87 87
             {
88 88
                 outPut = outPut.Replace("[", "").Replace("]", "").Replace("\"", "").Trim();
@@ -100,10 +100,10 @@ namespace XHWK.WKTool
100 100
                 string standardError = string.Empty;
101 101
                 string standardOutput = string.Empty;
102 102
                 int frequency = Convert.ToInt32(txbNumberOfCopies.Text);
103
-                for (int i=0;i< frequency;i++)
104
-                {
105
-                    LatticeFileHelper.PrinterTPFFile(tpf, 1, cmbClass.Text, out printResult, out standardError, out standardOutput);
106
-                }
103
+                //for (int i=0;i< frequency;i++)
104
+                //{
105
+                    LatticeFileHelper.PrinterTPFFile(tpf, frequency, cmbClass.Text, out printResult, out standardError, out standardOutput);
106
+                //}
107 107
                 if(printResult==0)// 0为成功
108 108
                 {
109 109
                     MessageWindow.Show("打印成功", "", MessageBoxButton.OKCancel);

+ 4
- 1
XHWK.WKTool/PromptWindow.xaml View File

@@ -8,7 +8,10 @@
8 8
         Title="PromptWindow" Height="210" Width="553" WindowStartupLocation="CenterOwner"
9 9
     WindowStyle="None" AllowsTransparency="True"    WindowState="Normal"
10 10
     ShowInTaskbar="True"   ResizeMode="NoResize"
11
-  >
11
+    BorderThickness="7">
12
+    <Window.Effect>
13
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
14
+    </Window.Effect>
12 15
     <Grid Background="#FFFFFF">
13 16
         <Grid.RowDefinitions>
14 17
             <RowDefinition Height="auto"/>

+ 7
- 3
XHWK.WKTool/UploadWindow.xaml View File

@@ -7,7 +7,10 @@
7 7
         mc:Ignorable="d"
8 8
         Title="UploadWindow" Height="346" Width="457"   AllowsTransparency="True"
9 9
     WindowStartupLocation="CenterScreen"
10
-    WindowStyle="None" Loaded="Window_Loaded" Margin="0"  BorderThickness="5,5,5,5">
10
+    WindowStyle="None" Loaded="Window_Loaded" Margin="0"    BorderThickness="7">
11
+    <Window.Effect>
12
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
13
+    </Window.Effect>
11 14
     <Viewbox>
12 15
         <Grid Height="341" Width="454" >
13 16
             <!--分4行-->
@@ -22,7 +25,7 @@
22 25
             <Border Grid.Row="0" Background="#2D8CF0" MouseLeftButtonDown="Window_MouseLeftButtonDown">
23 26
                 <Grid>
24 27
                     <TextBlock Text="上传" Foreground="#FFFFFF" FontSize="16" Padding="10,13,0,0"/>
25
-                    <Button  Cursor="Hand" Grid.Row="0" x:Name="btnDown" Content="×" Foreground="#FFFFFF" FontSize="25" Padding="10,0,10,0" HorizontalAlignment="Right" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" />
28
+                    <Button  Cursor="Hand" Grid.Row="0" x:Name="btnDown" Content="×" Foreground="#FFFFFF" FontSize="25" Padding="10,0,10,0" HorizontalAlignment="Right" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="BtnDown_Click"/>
26 29
                 </Grid>
27 30
             </Border>
28 31
             <!--第三行 教材-->
@@ -38,6 +41,7 @@
38 41
                             FontSize="14"
39 42
                             ItemsSource="{Binding bookList}"
40 43
                             SelectedValuePath="Key"
44
+                      SelectionChanged="toolbar_list_SelectionChanged"
41 45
                           >
42 46
                 <ComboBox.Resources>
43 47
                     <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="WhiteSmoke" />
@@ -59,7 +63,7 @@
59 63
                             ItemsSource="{Binding zhangjieList}"
60 64
                             SelectedValuePath="Key" />
61 65
             <!--第四行 开始按钮-->
62
-            <Button  Cursor="Hand" Grid.Row="4" x:Name="btnStart" Content="确定" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="418" Height="43" Margin="10,0,10,0" >
66
+            <Button  Cursor="Hand" Grid.Row="4" x:Name="btnStart" Content="确定" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="418" Height="43" Margin="10,0,10,0" Click="BtnStart_Click">
63 67
                 <Button.Template>
64 68
                     <ControlTemplate TargetType="{x:Type Button}">
65 69
                         <Border

+ 225
- 1
XHWK.WKTool/UploadWindow.xaml.cs View File

@@ -1,5 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3
+using System.Collections.ObjectModel;
3 4
 using System.Linq;
4 5
 using System.Text;
5 6
 using System.Threading.Tasks;
@@ -11,6 +12,8 @@ using System.Windows.Input;
11 12
 using System.Windows.Media;
12 13
 using System.Windows.Media.Imaging;
13 14
 using System.Windows.Shapes;
15
+using XHWK.Model;
16
+using XHWK.WKTool.DAL;
14 17
 
15 18
 namespace XHWK.WKTool
16 19
 {
@@ -19,11 +22,138 @@ namespace XHWK.WKTool
19 22
     /// </summary>
20 23
     public partial class UploadWindow : Window
21 24
     {
25
+        /// <summary>
26
+        /// 调用接口
27
+        /// </summary>
28
+        private readonly Interface @interface = new Interface();
29
+        /// <summary>
30
+        /// 前台数据
31
+        /// </summary>
32
+        internal LoginPageData pageData = new LoginPageData();
33
+        /// <summary>
34
+        /// 文件名
35
+        /// </summary>
36
+        private string Resourcename = string.Empty;
37
+        /// <summary>
38
+        /// 文件大小
39
+        /// </summary>
40
+        private long Resourcesize = 0;
41
+        /// <summary>
42
+        /// 文件类型
43
+        /// </summary>
44
+        private string Suffix = string.Empty;
22 45
         public UploadWindow()
23 46
         {
24 47
             InitializeComponent();
25 48
         }
26
-
49
+        /// <summary>
50
+        /// 初始化
51
+        /// </summary>
52
+        public void Initialize(string _resourcename,long _resourcesize,string _suffix) 
53
+        {
54
+            Resourcename = _resourcename;
55
+            Resourcesize = _resourcesize;
56
+            Suffix = _suffix;
57
+            Tsubjectbook();
58
+        }
59
+        /// <summary>
60
+        /// 教材接口调用
61
+        /// </summary>
62
+        /// <returns></returns>
63
+        private void Tsubjectbook()
64
+        {
65
+            int code = @interface.TsubjectbookList();
66
+            if (code == 0)
67
+            {
68
+                for (int i = 0; i < APP.TsubjectbookList.Count; i++)
69
+                {
70
+                    pageData.bookList.Add(new ComboBoxBean()
71
+                    {
72
+                        Key = APP.TsubjectbookList[i].Lsbid,
73
+                        Value = $"{APP.TsubjectbookList[i].Subjectname}  {APP.TsubjectbookList[i].Bookname}"
74
+                    });
75
+                }
76
+                book_list.SelectedIndex = 0;
77
+                DataContext = pageData;
78
+                Director();
79
+            }
80
+            else
81
+            {
82
+                MessageWindow.Show(APP.ServerMsg);
83
+            }
84
+        }
85
+        /// <summary>
86
+        /// 章节接口调用
87
+        /// </summary>
88
+        private void Director()
89
+        {
90
+            int selectIndex = book_list.SelectedIndex;
91
+            if(selectIndex<0)
92
+            {
93
+                selectIndex = 0;
94
+            }
95
+            int code = @interface.DirectorList(APP.TsubjectbookList[selectIndex].Lsbid,2,APP.UserInfo.Userid);
96
+            if (code == 0)
97
+            {
98
+                pageData.zhangjieList.Clear();
99
+                //pageData.zhangjieList.Add(new ComboBoxBean()
100
+                //{
101
+                //    Key = 999999,
102
+                //    Value = "全部"
103
+                //});
104
+                for (int i = 0; i < APP.DirectorList.Count; i++)
105
+                {
106
+                    Model_DirectorList item = APP.DirectorList[i];
107
+                    pageData.zhangjieList.Add(new ComboBoxBean()
108
+                    {
109
+                        Key = item.directorid,
110
+                        Value = item.directorname
111
+                    });
112
+                    addChild(item);
113
+                }
114
+                cmbTeachingMaterial.SelectedIndex = 0;
115
+            }
116
+            else
117
+            {
118
+                MessageWindow.Show(APP.ServerMsg);
119
+            }
120
+        }
121
+        /// <summary>
122
+        /// 子章节递归
123
+        /// </summary>
124
+        /// <param name="directorList"></param>
125
+        private void addChild(Model_DirectorList directorList)
126
+        {
127
+            if (directorList.children != null && directorList.children.Count > 0)
128
+            {
129
+                foreach (Model_DirectorList child in directorList.children)
130
+                {
131
+                    pageData.zhangjieList.Add(new ComboBoxBean()
132
+                    {
133
+                        Key = child.directorid,
134
+                        Value = getSpace(child.directorlevel) + child.directorname
135
+                    });
136
+                    if (child.children != null && child.children.Count > 0)
137
+                    {
138
+                        addChild(child);
139
+                    }
140
+                }
141
+            }
142
+        }
143
+        /// <summary>
144
+        /// 章节是否加空格符
145
+        /// </summary>
146
+        /// <param name="num"></param>
147
+        /// <returns></returns>
148
+        private string getSpace(int num)
149
+        {
150
+            string str = "";
151
+            for (int i = 0; i < num; i++)
152
+            {
153
+                str += "  ";
154
+            }
155
+            return str;
156
+        }
27 157
         private void Window_Loaded(object sender, RoutedEventArgs e)
28 158
         {
29 159
 
@@ -33,5 +163,99 @@ namespace XHWK.WKTool
33 163
         {
34 164
 
35 165
         }
166
+        /// <summary>
167
+        /// 教材下拉框改变事件
168
+        /// </summary>
169
+        /// <param name="sender"></param>
170
+        /// <param name="e"></param>
171
+        private void toolbar_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
172
+        {
173
+            Director();
174
+        }
175
+
176
+        private void BtnDown_Click(object sender, RoutedEventArgs e)
177
+        {
178
+            this.Hide();
179
+        }
180
+        /// <summary>
181
+        /// 上传到个人空间
182
+        /// </summary>
183
+        /// <param name="sender"></param>
184
+        /// <param name="e"></param>
185
+        private void BtnStart_Click(object sender, RoutedEventArgs e)
186
+        {
187
+            //        converted: 0
188
+            //createid: 80
189
+            //directorid: 1009
190
+            //duration: 39
191
+            //imgUrl: ""
192
+            //level: 2
193
+            //lsbid: 40
194
+            //mp4code: "h264"
195
+            //resourcebelong: 3
196
+            //resourceclass: 2
197
+            //resourcecover: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.jpg"
198
+            //resourcename: "weather_pic"
199
+            //resourcesize: 6105268
200
+            //resourcetype: 0
201
+            //resourceurl: "12/resource/20200917/4f297df0-f8c0-11ea-adf5-81f24b97d4ff/weather_pic.mp4"
202
+            //schoolid: 12
203
+            //suffix: "mp4"
204
+            //uid: 80
205
+            Model_ResourceAdd model_ResourceAdd = new Model_ResourceAdd();
206
+            model_ResourceAdd.converted = 0;
207
+            model_ResourceAdd.createid = APP.UserInfo.Userid;
208
+            model_ResourceAdd.directorid= Convert.ToInt32(cmbTeachingMaterial.SelectedValue.ToString());
209
+            model_ResourceAdd.duration = APP.ResourceAddTwo.duration;
210
+            model_ResourceAdd.imgUrl = "";
211
+            model_ResourceAdd.level = 2;
212
+            model_ResourceAdd.lsbid= Convert.ToInt32(book_list.SelectedValue.ToString());
213
+            model_ResourceAdd.mp4code = APP.ResourceAddTwo.mp4code;
214
+            model_ResourceAdd.resourcebelong = 3;
215
+            model_ResourceAdd.resourceclass = 2;
216
+            model_ResourceAdd.resourcecover = APP.ResourceAddTwo.coverpath;
217
+            model_ResourceAdd.resourcename = Resourcename;
218
+            model_ResourceAdd.resourcesize = Resourcesize;//zxy 文件大小
219
+            model_ResourceAdd.resourcetype = 0;
220
+            model_ResourceAdd.resourceurl = APP.ResourceAddTwo.videopath;
221
+            model_ResourceAdd.schoolid = APP.UserInfo.Schoolid;
222
+            if(Suffix.Equals("FLV"))
223
+            {
224
+                Suffix = "flv";
225
+            }
226
+            else if(Suffix.Equals("AVI"))
227
+            {
228
+                Suffix = "avi";
229
+            }
230
+            else
231
+            {
232
+                Suffix = "mp4";
233
+            }
234
+
235
+            model_ResourceAdd.suffix = Suffix;
236
+            //model_ResourceAdd.uid = 0;//zxy
237
+            int code = @interface.ResourceAdd(model_ResourceAdd);
238
+            if(code==0)
239
+            {
240
+                MessageWindow.Show("视频上传成功!");
241
+                Hide();
242
+            }
243
+            else
244
+            {
245
+                MessageWindow.Show(APP.ServerMsg);
246
+            }
247
+        }
248
+    }
249
+    public class LoginPageData : NotifyModel
250
+    {
251
+        public ObservableCollection<ComboBoxBean> bookList { get; set; }
252
+
253
+        public ObservableCollection<ComboBoxBean> zhangjieList { get; set; }
254
+
255
+        public LoginPageData()
256
+        {
257
+            bookList = new ObservableCollection<ComboBoxBean>();
258
+            zhangjieList = new ObservableCollection<ComboBoxBean>();
259
+        }
36 260
     }
37 261
 }

+ 6
- 3
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

@@ -9,8 +9,11 @@
9 9
         xmlns:local="clr-namespace:XHWK.WKTool"
10 10
         mc:Ignorable="d"
11 11
         Title="星火微课系统" Height="1040" Width="1276" WindowStartupLocation="CenterScreen"
12
-    WindowStyle="None"    AllowsTransparency="True"  Background="#EFF1F8" ShowInTaskbar="True" ResizeMode="CanMinimize" BorderThickness="10"
13
-   >    
12
+    WindowStyle="None"    AllowsTransparency="True"  Background="#EFF1F8" ShowInTaskbar="True" ResizeMode="CanMinimize" 
13
+     BorderThickness="7">
14
+    <Window.Effect>
15
+        <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
16
+    </Window.Effect>
14 17
     <!--<Grid>
15 18
         <Border CornerRadius="0,0,0,0"
16 19
                 Background="White"
@@ -325,7 +328,7 @@
325 328
                             <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
326 329
                                 <TextBlock x:Name="txbCurrpage" Text="{Binding currpage}" TextAlignment="Center" FontSize="15"/>
327 330
                                 <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
328
-                                <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
331
+                                    <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
329 332
                             </StackPanel>
330 333
                         </StackPanel>
331 334
                     </Grid>

+ 65
- 6
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -469,9 +469,15 @@ namespace XHWK.WKTool
469 469
             {
470 470
                 gridUpload.Visibility = Visibility.Collapsed;
471 471
                 GridMain.Visibility = Visibility.Visible;
472
+                if(APP.pageData.pagenum>0)
473
+                {
474
+                    gridPage.Visibility = Visibility.Visible;
475
+                }
476
+                DataContext = APP.pageData;
472 477
             }
473 478
             else
474 479
             {
480
+                gridPage.Visibility = Visibility.Collapsed;
475 481
                 gridUpload.Visibility = Visibility.Visible;
476 482
                 GridMain.Visibility = Visibility.Collapsed;
477 483
                 InitializeUpload();
@@ -590,6 +596,19 @@ namespace XHWK.WKTool
590 596
             {
591 597
                 FileToolsCommon.SetConfigValue("CameraPosition", "4");
592 598
             }
599
+
600
+            if (rbnMP4.IsChecked == true)
601
+            {
602
+                FileToolsCommon.SetConfigValue("VideoType", "1");
603
+            }
604
+            else if (rbnFLV.IsChecked == true)
605
+            {
606
+                FileToolsCommon.SetConfigValue("VideoType", "2");
607
+            }
608
+            else if (rbnAVI.IsChecked == true)
609
+            {
610
+                FileToolsCommon.SetConfigValue("VideoType", "3");
611
+            }
593 612
             APP.CameraPosition = FileToolsCommon.GetConfigValue("CameraPosition");
594 613
             GridMain.Visibility = Visibility.Visible;
595 614
             gridSetUp.Visibility = Visibility.Collapsed;
@@ -636,6 +655,28 @@ namespace XHWK.WKTool
636 655
                 {
637 656
                     rbnLeftUnder.IsChecked = true;
638 657
                 }
658
+             string type=   FileToolsCommon.GetConfigValue("VideoType");//<!--视频格式 1、MP4 2、FlV 3、AVI-->
659
+                if ("1".Equals(type))
660
+                {
661
+                    rbnMP4.IsChecked = true;
662
+                }
663
+                else if ("2".Equals(type))
664
+                {
665
+                    rbnFLV.IsChecked = true;
666
+                }
667
+                else if ("3".Equals(type))
668
+                {
669
+                    rbnAVI.IsChecked = true;
670
+                }
671
+                string isSound = FileToolsCommon.GetConfigValue("IsSound");//<!--声音 true 有 false 无-->
672
+                if(isSound=="true")
673
+                {
674
+                    rbnY.IsChecked = true;
675
+                }
676
+                else
677
+                {
678
+                    rbnN.IsChecked = true;
679
+                }
639 680
             }
640 681
         }
641 682
         /// <summary>
@@ -2822,6 +2863,8 @@ namespace XHWK.WKTool
2822 2863
         /// <param name="e"></param>
2823 2864
         private void BtnUploads_Click(object sender, RoutedEventArgs e) 
2824 2865
         {
2866
+     
2867
+
2825 2868
             pageData.menuList[Subscript].IsEnabled = false;
2826 2869
             List<System.Windows.Controls.Button> buttons = FindChilds<System.Windows.Controls.Button>(listView1, "btnUpload");
2827 2870
             for (int i = 0; i < buttons.Count; i++)
@@ -2832,19 +2875,35 @@ namespace XHWK.WKTool
2832 2875
 
2833 2876
                     if (dAL_Upload.UploadVideo(pageData.menuList[i].FileGuid, out string ErrMessage))
2834 2877
                     {
2835
-                        pageData.menuList[i].Visi = "Visible";
2836
-                        pageData.menuList[i].Coll = "Collapsed";
2878
+                        //foreach (Model_WKData wKData in APP.WKDataList)
2879
+                        //{
2880
+                        //    if (wKData.VideoList == null)
2881
+                        //        continue;
2882
+                        //    //if()
2883
+                        //    //{
2884
+
2885
+                        //    //}
2886
+                        //}
2887
+                            pageData.menuList[i].Visi = "Collapsed";
2888
+                        pageData.menuList[i].Coll = "Visible";
2837 2889
 
2838 2890
                         DataContext = pageData;
2839 2891
 
2840
-                        System.Windows.MessageBox.Show("视频上传成功!");
2892
+                        //MessageWindow.Show("视频上传服务器成功!");
2893
+                        if (APP.W_UploadWindow == null)
2894
+                        {
2895
+                            APP.W_UploadWindow = new UploadWindow();
2896
+                            APP.W_UploadWindow.Owner = this;
2897
+                        }
2898
+                        //long size = Convert.ToInt64(FileToolsCommon.GetFileSizeByMB(pageData.menuList[i].FilePath));
2899
+                            APP.W_UploadWindow.Initialize(pageData.menuList[i].VideoName,11110 /*Convert.ToInt64(pageData.menuList[i].VideoSize)*/, pageData.menuList[i].VideoType);
2900
+                        APP.W_UploadWindow.ShowDialog();
2901
+                     
2841 2902
                     }
2842 2903
                     else
2843 2904
                     {
2844
-                        System.Windows.MessageBox.Show(ErrMessage);
2905
+                        MessageWindow.Show(ErrMessage);
2845 2906
                     }
2846
-
2847
-
2848 2907
                 }
2849 2908
             }
2850 2909
         }

+ 2
- 2
XHWK.WKTool/ZConfig.cs View File

@@ -13,9 +13,9 @@ namespace XHWK.WKTool.Config
13 13
         /// <summary>
14 14
         /// 当前版本号
15 15
         /// </summary>
16
-        public static int versionCode = 3;
16
+        public static int versionCode = 4;
17 17
 
18
-        public static string versionName = "1.0.2";
18
+        public static string versionName = "1.0.3";
19 19
 
20 20
         //接口地址
21 21
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : "http://schoolapi.xhkjedu.com";

Loading…
Cancel
Save