Browse Source

添加应用

gzb
guozhongbo 9 months ago
parent
commit
249af4c6cc

+ 1
- 1
public/config.js View File

3
   ? {
3
   ? {
4
       // 测试环境
4
       // 测试环境
5
       baseUrl: "http://mcapitest.xhkjedu.com/",
5
       baseUrl: "http://mcapitest.xhkjedu.com/",
6
-      baseImageUrl: "http://49.4.26.249:8331/",
6
+      baseImageUrl: "http://mcapitest.xhkjedu.com/",
7
       showImageUrl: "https://mcapitest.xhkjedu.com/",
7
       showImageUrl: "https://mcapitest.xhkjedu.com/",
8
       axiosApiTimeout: 60, // 接口超时时间 单位秒
8
       axiosApiTimeout: 60, // 接口超时时间 单位秒
9
       axiosFileTimeout: 120, // 上传文件超时时间 单位秒
9
       axiosFileTimeout: 120, // 上传文件超时时间 单位秒

+ 4
- 0
src/api/region.js View File

13
  */
13
  */
14
 export const region_list_sel_pt = (data) =>
14
 export const region_list_sel_pt = (data) =>
15
   setRequest("region/list_sel_pt", data);
15
   setRequest("region/list_sel_pt", data);
16
+/**
17
+ * 2.1.1.2区域--区域学校选择列表
18
+ */
19
+export const region_list_rs = (data) => setRequest("region/list_rs", data);
16
 /**
20
 /**
17
  * 2.2区域--添加
21
  * 2.2区域--添加
18
  */
22
  */

BIN
src/assets/img/guanbi_red.png View File


+ 113
- 0
src/components/Checkbox/CheckboxDevice.vue View File

1
+<template>
2
+  <div class="index">
3
+    <CheckboxGroup style="flex-shrink: 0">
4
+      <Checkbox
5
+        class="checkbox_style"
6
+        :indeterminate="indeterminate"
7
+        :value="checkAll"
8
+        :label="module.dgroupid"
9
+        @click.prevent.native="handleCheckAll(module.devices)"
10
+        ><span style="font-size: 14px; color: #333; font-weight: 700">{{
11
+          module.dgname
12
+        }}</span>
13
+      </Checkbox>
14
+    </CheckboxGroup>
15
+    <CheckboxGroup
16
+      v-model="checkAllSingleGroup"
17
+      @on-change="checkAllSingleGroupChange"
18
+    >
19
+      <Checkbox
20
+        v-for="mc in module.devices"
21
+        :key="mc.deviceid"
22
+        :label="mc.deviceid"
23
+      >
24
+        <span>{{ mc.deviceModel }}</span>
25
+      </Checkbox>
26
+    </CheckboxGroup>
27
+  </div>
28
+</template>
29
+<script>
30
+export default {
31
+  name: "CheckboxDevice",
32
+  props: ["module", "lsbid", "initdata"],
33
+  data() {
34
+    return {
35
+      checkAll: false,
36
+      indeterminate: false, //全选
37
+      checkAllSingleGroup: [] //当前选中
38
+    };
39
+  },
40
+  watch: {
41
+    checkAllSingleGroup: function (val) {
42
+      this.$emit("CheckboxDevice", this.module.dgroupid, val);
43
+    },
44
+    //清空回显
45
+    initdata: function () {
46
+      if (this.initdata) {
47
+        this.checkAllSingleGroup = [];
48
+        this.checkAll = false;
49
+        this.indeterminate = false;
50
+      }
51
+    }
52
+  },
53
+  methods: {
54
+    //全选或者全不选
55
+    handleCheckAll(arr) {
56
+      if (this.indeterminate) {
57
+        this.checkAll = false;
58
+      } else {
59
+        this.checkAll = !this.checkAll;
60
+      }
61
+      this.indeterminate = false;
62
+      let singleCheckedGroup = [];
63
+      let singleObj = {};
64
+      if (!Array.isArray(arr)) {
65
+        return;
66
+      }
67
+
68
+      for (let i = 0; i < arr.length; i++) {
69
+        singleObj = arr[i];
70
+        singleCheckedGroup.push(singleObj.deviceid);
71
+      }
72
+
73
+      if (this.checkAll) {
74
+        this.checkAllSingleGroup = singleCheckedGroup;
75
+      } else {
76
+        this.checkAllSingleGroup = [];
77
+      }
78
+    },
79
+    //老师单独选择
80
+    checkAllSingleGroupChange(data) {
81
+      if (data.length === this.module.devices.length && data.length != 0) {
82
+        this.indeterminate = false;
83
+        this.checkAll = true;
84
+      } else if (data.length > 0) {
85
+        this.indeterminate = true;
86
+        this.checkAll = false;
87
+      } else {
88
+        this.indeterminate = false;
89
+        this.checkAll = false;
90
+      }
91
+    },
92
+    //设置默认选中
93
+    getCheckedRole(val) {
94
+      this.checkAllSingleGroup = [];
95
+      this.module.devices.forEach((item) => {
96
+        val.map((value) => {
97
+          if (value.deviceid === item.deviceid) {
98
+            this.checkAllSingleGroup.push(value.deviceid);
99
+          }
100
+        });
101
+      });
102
+      this.checkAllSingleGroupChange(this.checkAllSingleGroup);
103
+    }
104
+  }
105
+};
106
+</script>
107
+<style lang="less" scoped>
108
+.index {
109
+  .checkbox_style {
110
+    line-height: 36px;
111
+  }
112
+}
113
+</style>

+ 93
- 0
src/utils/fileConfig.js View File

1
+//文件上传格式
2
+export const ACCEPT_CONFIG = {
3
+  image: [".png", ".jpg", ".jpeg"], // ".gif", ".bmp"
4
+  client: [".exe"],
5
+  app: [".apk"],
6
+  audio: [".mp3", ".wav"],
7
+  video: [".mp4", ".flv"],
8
+  document: [".doc", ".docx", ".ppt", ".pptx", ".pdf"],
9
+  // ".class", ".dsc",
10
+  documentClass: [".doc", ".docx", ".ppt", ".pptx", ".pdf"],
11
+  zipFile: [".zip", ".rar"],
12
+  getPreview() {
13
+    return [...this.document, ...this.image, ...this.audio, ...this.video];
14
+  },
15
+  getAll() {
16
+    return [
17
+      ...this.image,
18
+      ...this.video,
19
+      ...this.document,
20
+      ...this.audio,
21
+      ...this.documentClass,
22
+      ...this.zipFile
23
+    ];
24
+  },
25
+  getClient() {
26
+    return [...this.client];
27
+  },
28
+  getApp() {
29
+    return [...this.app];
30
+  },
31
+  getImg() {
32
+    return [...this.image];
33
+  },
34
+  getAudio() {
35
+    return [...this.audio];
36
+  },
37
+  getVideo() {
38
+    return [...this.video];
39
+  },
40
+  getDocument() {
41
+    return [...this.document];
42
+  },
43
+  getDocumentClass() {
44
+    return [...this.documentClass];
45
+  },
46
+  getZipFile() {
47
+    return [...this.zipFile];
48
+  }
49
+};
50
+//定义分片大小
51
+export const CHUNK_SIZE = {
52
+  chunkSize: 5 * 1024 * 1024,
53
+  getSize() {
54
+    return this.chunkSize;
55
+  }
56
+};
57
+export const CONFIG_SUFFIX = {
58
+  image: ["png", "jpg", "jpeg"], // "gif", "bmp"
59
+  audio: ["mp3", "wav"],
60
+  app: ["apk"],
61
+  video: ["mp4", "flv"],
62
+  document: ["doc", "docx", "ppt", "pptx", "pdf"],
63
+  documentClass: ["class", "dsc", "doc", "docx", "ppt", "pptx", "pdf"],
64
+  zipFile: ["zip", "rar"],
65
+  getApp() {
66
+    return [...this.app];
67
+  },
68
+  getImg() {
69
+    return [...this.image];
70
+  },
71
+  getAudio() {
72
+    return [...this.audio];
73
+  },
74
+  getVideo() {
75
+    return [...this.video];
76
+  },
77
+  getDocument() {
78
+    return [...this.document];
79
+  },
80
+  getDocumentClass() {
81
+    return [...this.documentClass];
82
+  },
83
+  getZipFile() {
84
+    return [...this.zipFile];
85
+  }
86
+};
87
+//教材上传封面格式
88
+export const MATERIAL_IMG_SUFFIX = {
89
+  image: ["png", "jpg", "jpeg"],
90
+  getImg() {
91
+    return [...this.image];
92
+  }
93
+};

+ 1
- 1
src/views/regionSection/applicationManage/applicationGroup.vue View File

273
       }
273
       }
274
       let formData = new FormData();
274
       let formData = new FormData();
275
       formData.append("file", file);
275
       formData.append("file", file);
276
-      formData.append("savefolder", "headpic");
276
+      formData.append("savefolder", "app");
277
       formData.append("isrename", "1");
277
       formData.append("isrename", "1");
278
       let Url = this.$api.baseImageUrl + "up/upfile";
278
       let Url = this.$api.baseImageUrl + "up/upfile";
279
       this.showLoading = true;
279
       this.showLoading = true;

+ 387
- 84
src/views/regionSection/applicationManage/applicationManage.vue View File

2
   <div class="main_root">
2
   <div class="main_root">
3
     <div class="search_header">
3
     <div class="search_header">
4
       <div class="search_left">
4
       <div class="search_left">
5
+        <Select
6
+          :transfer="true"
7
+          v-model="searchForm.appgroupid"
8
+          style="width: 120px; margin: 0 10px"
9
+          placeholder="请选择分组"
10
+        >
11
+          <template v-if="group_list.length > 0">
12
+            <Option
13
+              v-for="item in group_list"
14
+              :value="item.appgroupid"
15
+              :key="item.appgroupid"
16
+              >{{ item.appgroupName }}</Option
17
+            >
18
+          </template>
19
+        </Select>
5
         <Input
20
         <Input
6
           v-model="searchForm.name"
21
           v-model="searchForm.name"
7
           placeholder="请输入名称"
22
           placeholder="请输入名称"
57
         :label-width="130"
72
         :label-width="130"
58
         inline
73
         inline
59
       >
74
       >
60
-        <FormItem label="名称" prop="areaname" style="width: 100%">
75
+        <FormItem label="名称" prop="appName" style="width: 100%">
61
           <Input
76
           <Input
62
-            v-model="wallpaperInfo.appgroupName"
77
+            v-model="wallpaperInfo.appName"
63
             placeholder="请输入名称"
78
             placeholder="请输入名称"
64
           ></Input>
79
           ></Input>
65
         </FormItem>
80
         </FormItem>
66
-        <FormItem label="分组" prop="areaname" style="width: 100%">
81
+        <FormItem label="分组" prop="appgroupid" style="width: 100%">
67
           <Select
82
           <Select
68
             v-model="wallpaperInfo.appgroupid"
83
             v-model="wallpaperInfo.appgroupid"
69
             placeholder="请选择分组"
84
             placeholder="请选择分组"
71
             @on-change="groupChange()"
86
             @on-change="groupChange()"
72
           >
87
           >
73
             <template v-if="group_list.length > 0">
88
             <template v-if="group_list.length > 0">
74
-              <Option v-for="item in group_list" :value="item.id" :key="item.id"
75
-                >{{ item.id }}
76
-              </Option>
89
+              <Option
90
+                v-for="item in group_list"
91
+                :value="item.appgroupid"
92
+                :key="item.appgroupid"
93
+                >{{ item.appgroupName }}</Option
94
+              >
77
             </template>
95
             </template>
78
           </Select>
96
           </Select>
79
         </FormItem>
97
         </FormItem>
109
         </FormItem>
127
         </FormItem>
110
         <FormItem label="可信任" style="width: 100%">
128
         <FormItem label="可信任" style="width: 100%">
111
           <div class="comm">
129
           <div class="comm">
112
-            <RadioGroup v-model="wallpaperInfo.whited">
130
+            <RadioGroup v-model="wallpaperInfo.trusted">
113
               <Radio :label="1">是</Radio>
131
               <Radio :label="1">是</Radio>
114
               <Radio :label="0">否</Radio>
132
               <Radio :label="0">否</Radio>
115
             </RadioGroup>
133
             </RadioGroup>
120
         </FormItem>
138
         </FormItem>
121
         <FormItem label="隐藏图标" style="width: 100%">
139
         <FormItem label="隐藏图标" style="width: 100%">
122
           <div class="comm">
140
           <div class="comm">
123
-            <RadioGroup v-model="wallpaperInfo.whited">
141
+            <RadioGroup v-model="wallpaperInfo.showico">
124
               <Radio :label="1">是</Radio>
142
               <Radio :label="1">是</Radio>
125
               <Radio :label="0">否</Radio>
143
               <Radio :label="0">否</Radio>
126
             </RadioGroup>
144
             </RadioGroup>
129
         </FormItem>
147
         </FormItem>
130
         <FormItem label="允许清空缓存" style="width: 100%">
148
         <FormItem label="允许清空缓存" style="width: 100%">
131
           <div class="comm">
149
           <div class="comm">
132
-            <RadioGroup v-model="wallpaperInfo.whited">
150
+            <RadioGroup v-model="wallpaperInfo.cached">
133
               <Radio :label="1">是</Radio>
151
               <Radio :label="1">是</Radio>
134
               <Radio :label="0">否</Radio>
152
               <Radio :label="0">否</Radio>
135
             </RadioGroup>
153
             </RadioGroup>
138
         </FormItem>
156
         </FormItem>
139
         <FormItem label="添加到已有策略" style="width: 100%">
157
         <FormItem label="添加到已有策略" style="width: 100%">
140
           <div class="comm">
158
           <div class="comm">
141
-            <RadioGroup v-model="wallpaperInfo.whited">
159
+            <RadioGroup v-model="wallpaperInfo.strategy">
142
               <Radio :label="1">是</Radio>
160
               <Radio :label="1">是</Radio>
143
               <Radio :label="0">否</Radio>
161
               <Radio :label="0">否</Radio>
144
             </RadioGroup>
162
             </RadioGroup>
148
           </div>
166
           </div>
149
         </FormItem>
167
         </FormItem>
150
         <FormItem label="适配设备" style="width: 100%" class="require">
168
         <FormItem label="适配设备" style="width: 100%" class="require">
169
+          <div v-for="item in device_list" :key="item.dgroupid">
170
+            <CheckboxDevice
171
+              @CheckboxDevice="CheckboxDevice"
172
+              :module="item"
173
+            ></CheckboxDevice>
174
+          </div>
151
         </FormItem>
175
         </FormItem>
152
-        <FormItem label="应用上传" style="width: 320px">
153
-          <div class="logo">
154
-            <Upload
155
-              action
156
-              :show-upload-list="false"
157
-              :before-upload="
158
-                (file) => {
159
-                  upLoadUserpic(file);
160
-                  return false;
161
-                }
162
-              "
163
-              accept=".png,.jpeg,.jpg"
176
+        <FormItem label="应用上传" class="require" style="width: 400px">
177
+          <div class="upload_box">
178
+            <uploader
179
+              ref="uploader"
180
+              :options="options"
181
+              :autoStart="true"
182
+              :file-status-text="statusText"
183
+              @file-added="onFileAdded"
184
+              @file-progress="onFileProgress"
185
+              @file-success="onFileSuccess"
186
+              @file-error="onFileError"
164
             >
187
             >
165
-              <Button type="primary" class="primary_btn">上传应用</Button>
166
-            </Upload>
167
-            <span>支持apk文件</span>
188
+              <uploader-unsupport></uploader-unsupport>
189
+              <uploader-btn
190
+                id="global_uploader_btn"
191
+                :attrs="attrs"
192
+                ref="uploadBtn"
193
+              >
194
+                <div class="primary_btn">上传应用</div>
195
+              </uploader-btn>
196
+            </uploader>
168
           </div>
197
           </div>
169
-          <div class="app_img">
170
-            <img
171
-              v-if="wallpaperInfo.iconPath"
172
-              :src="$api.showImageUrl + wallpaperInfo.iconPath"
173
-            />
198
+          <div class="upProgress" v-if="file_list.length > 0">
199
+            <div v-for="file in file_list" key="file1">
200
+              <div class="file_name" :title="wallpaperInfo.appPackage">
201
+                <div class="show_name">
202
+                  {{ wallpaperInfo.appPackage }}
203
+                </div>
204
+              </div>
205
+              <Progress
206
+                hide-info
207
+                :stroke-width="8"
208
+                :percent="getUploadProgress(file)"
209
+                status="active"
210
+              />
211
+            </div>
174
           </div>
212
           </div>
175
         </FormItem>
213
         </FormItem>
176
-        <FormItem label="应用图标">
214
+        <FormItem label="应用图标" class="require">
177
           <div class="logo">
215
           <div class="logo">
178
             <Upload
216
             <Upload
179
               action
217
               action
180
               :show-upload-list="false"
218
               :show-upload-list="false"
181
               :before-upload="
219
               :before-upload="
182
                 (file) => {
220
                 (file) => {
183
-                  upLoadUserpic(file);
221
+                  upLoadUserpic(file,1);
184
                   return false;
222
                   return false;
185
                 }
223
                 }
186
               "
224
               "
190
             </Upload>
228
             </Upload>
191
             <span>支持图片格式:jpg、jgeg、png</span>
229
             <span>支持图片格式:jpg、jgeg、png</span>
192
           </div>
230
           </div>
193
-          <div class="app_img">
231
+          <div class="app_img" style="border-radius: 20px">
194
             <img
232
             <img
195
-              v-if="wallpaperInfo.iconPath"
196
-              :src="$api.showImageUrl + wallpaperInfo.iconPath"
233
+              v-if="wallpaperInfo.appIcon"
234
+              :src="$api.showImageUrl + wallpaperInfo.appIcon"
197
             />
235
             />
198
           </div>
236
           </div>
199
         </FormItem>
237
         </FormItem>
204
               :show-upload-list="false"
242
               :show-upload-list="false"
205
               :before-upload="
243
               :before-upload="
206
                 (file) => {
244
                 (file) => {
207
-                  upLoadUserpic(file);
245
+                  upLoadUserpic(file,2);
208
                   return false;
246
                   return false;
209
                 }
247
                 }
210
               "
248
               "
211
               accept=".png,.jpeg,.jpg"
249
               accept=".png,.jpeg,.jpg"
212
             >
250
             >
213
-              <Button type="primary" class="primary_btn">上传图</Button>
251
+              <Button type="primary" class="primary_btn">上传图</Button>
214
             </Upload>
252
             </Upload>
215
             <span>支持图片格式:jpg、jgeg、png</span>
253
             <span>支持图片格式:jpg、jgeg、png</span>
216
           </div>
254
           </div>
217
-          <div class="app_img">
218
-            <img
219
-              v-if="wallpaperInfo.iconPath"
220
-              :src="$api.showImageUrl + wallpaperInfo.iconPath"
221
-            />
255
+          <div class="img_list">
256
+            <div class="app_img"
257
+                 v-for="(img,idx) in wallpaperInfo.appImg"
258
+                 :key="idx">
259
+              <img
260
+                  :src="$api.showImageUrl + img"
261
+              />
262
+              <img class="del" src="../../../assets/img/guanbi_red.png" />
263
+            </div>
222
           </div>
264
           </div>
265
+
223
         </FormItem>
266
         </FormItem>
224
         <FormItem
267
         <FormItem
225
           label="版本名称"
268
           label="版本名称"
227
           style="width: calc(50% - 10px)"
270
           style="width: calc(50% - 10px)"
228
         >
271
         >
229
           <Input
272
           <Input
230
-            v-model="wallpaperInfo.appgroupName"
273
+            v-model="wallpaperInfo.versionName"
231
             placeholder="请输入版本名称"
274
             placeholder="请输入版本名称"
232
           ></Input>
275
           ></Input>
233
         </FormItem>
276
         </FormItem>
234
         <FormItem label="版本号码" style="width: calc(50% - 10px)">
277
         <FormItem label="版本号码" style="width: calc(50% - 10px)">
235
           <Input
278
           <Input
236
-            v-model="wallpaperInfo.appgroupName"
279
+            v-model="wallpaperInfo.versionNum"
237
             placeholder="请输入版本号码"
280
             placeholder="请输入版本号码"
238
           ></Input>
281
           ></Input>
239
         </FormItem>
282
         </FormItem>
243
           style="width: calc(50% - 10px)"
286
           style="width: calc(50% - 10px)"
244
         >
287
         >
245
           <Input
288
           <Input
246
-            v-model="wallpaperInfo.appgroupName"
289
+            v-model="wallpaperInfo.appSize"
247
             placeholder="请输入应用大小"
290
             placeholder="请输入应用大小"
248
           ></Input>
291
           ></Input>
249
         </FormItem>
292
         </FormItem>
250
         <FormItem label="开发者" style="width: calc(50% - 10px)">
293
         <FormItem label="开发者" style="width: calc(50% - 10px)">
251
           <Input
294
           <Input
252
-            v-model="wallpaperInfo.appgroupName"
295
+            v-model="wallpaperInfo.appDeveloper"
253
             placeholder="请输入开发者"
296
             placeholder="请输入开发者"
254
           ></Input>
297
           ></Input>
255
         </FormItem>
298
         </FormItem>
256
-        <FormItem label="唯一码" style="width: 100%">
299
+        <FormItem label="应用包名" style="width: 100%">
257
           <Input
300
           <Input
258
-            v-model="wallpaperInfo.appgroupName"
259
-            placeholder="请输入唯一码"
301
+            v-model="wallpaperInfo.appPackage"
302
+            placeholder="请输入应用包名"
260
           ></Input>
303
           ></Input>
261
         </FormItem>
304
         </FormItem>
262
         <FormItem label="描述信息" style="width: 100%">
305
         <FormItem label="描述信息" style="width: 100%">
263
           <Input
306
           <Input
264
-            v-model="wallpaperInfo.comm"
307
+            v-model="wallpaperInfo.appAbbr"
265
             type="textarea"
308
             type="textarea"
266
             :maxlength="255"
309
             :maxlength="255"
267
             :rows="4"
310
             :rows="4"
270
         </FormItem>
313
         </FormItem>
271
         <FormItem label="更新" style="width: 100%">
314
         <FormItem label="更新" style="width: 100%">
272
           <Input
315
           <Input
273
-            v-model="wallpaperInfo.comm"
316
+            v-model="wallpaperInfo.appRenew"
274
             type="textarea"
317
             type="textarea"
275
             :rows="4"
318
             :rows="4"
276
             :maxlength="1000"
319
             :maxlength="1000"
277
-            placeholder="请输入更新"
320
+            placeholder="请输入更新内容"
278
           ></Input>
321
           ></Input>
279
         </FormItem>
322
         </FormItem>
280
-        <FormItem label="选择学校" style="width: 100%">
323
+        <FormItem label="选择学校" style="width: 100%" class="require">
281
           <RadioGroup v-model="wallpaperInfo.targetSchool">
324
           <RadioGroup v-model="wallpaperInfo.targetSchool">
282
             <Radio :label="1">所有学校</Radio>
325
             <Radio :label="1">所有学校</Radio>
283
             <Radio :label="2">自定义学校</Radio>
326
             <Radio :label="2">自定义学校</Radio>
284
           </RadioGroup>
327
           </RadioGroup>
285
-          <div class="targetSchool" v-if="wallpaperInfo.targetSchool === 1">
328
+          <div class="targetSchool" v-if="wallpaperInfo.targetSchool === 2">
286
             <div class="allSchool">
329
             <div class="allSchool">
287
               <Input
330
               <Input
288
-                v-model="wallpaperInfo.appgroupName"
331
+                v-model="wallpaperInfo.schoolname"
289
                 placeholder="请输入关键字"
332
                 placeholder="请输入关键字"
290
                 search
333
                 search
291
                 @on-search="getSchool"
334
                 @on-search="getSchool"
292
               ></Input>
335
               ></Input>
293
-              <div class="school_list"></div>
336
+              <div class="school_list">
337
+                <Tree @on-check-change="getSelectedNodes" :data="school_list" show-checkbox></Tree>
338
+              </div>
294
             </div>
339
             </div>
295
             <div class="selectSchool">
340
             <div class="selectSchool">
296
               <div class="school_num">已选<span class="num">1</span>所学校</div>
341
               <div class="school_num">已选<span class="num">1</span>所学校</div>
331
 </template>
376
 </template>
332
 
377
 
333
 <script>
378
 <script>
334
-import { date_format } from "@/utils";
379
+import { date_format, uuid } from "@/utils";
335
 import axios from "axios";
380
 import axios from "axios";
336
-import {appgroup_list} from "@/api/appgroup";
381
+import { appgroup_list, device_list } from "@/api/appgroup";
382
+import CheckboxDevice from "@/components/Checkbox/CheckboxDevice";
383
+import { ACCEPT_CONFIG, CHUNK_SIZE, CONFIG_SUFFIX } from "@/utils/fileConfig";
384
+import { compressImg } from "@/utils";
385
+import {region_list_rs} from "@/api/region";
337
 export default {
386
 export default {
387
+  components: {
388
+    CheckboxDevice
389
+  },
338
   data() {
390
   data() {
339
     return {
391
     return {
340
       date_format,
392
       date_format,
393
+      fileDetail: {
394
+        show: false,
395
+        file: {}
396
+      },
397
+      file_list: [],
398
+      upTimer: null,
399
+      options: {
400
+        singleFile: false, //批量上传
401
+        target: this.$api.baseImageUrl + "chunk/up", //地址
402
+        chunkSize: CHUNK_SIZE.getSize(), //分块大小
403
+        fileParameterName: "file", //上传文件名,
404
+        maxChunkRetries: 3, //最大自动失败重试上传次数
405
+        testChunks: false //是否开启服务器分片校验
406
+      },
407
+      attrs: {
408
+        accept: ACCEPT_CONFIG.getApp()
409
+      },
410
+      statusText: {
411
+        success: "上传成功",
412
+        error: "上传失败",
413
+        uploading: "上传中",
414
+        paused: "等待中", //暂停中
415
+        waiting: "等待中"
416
+      },
341
       showLoading: false,
417
       showLoading: false,
342
       searchForm: {
418
       searchForm: {
343
-        showDrop: false,
344
-        dropList: [],
345
-        areaname: "",
346
-        areaid: null,
347
-        state: 0,
419
+        appgroupid: 0,
348
         page: 1,
420
         page: 1,
349
         size: 10,
421
         size: 10,
350
         list: [],
422
         list: [],
366
         strategy: 1,
438
         strategy: 1,
367
         apkPath: "",
439
         apkPath: "",
368
         appIcon: "",
440
         appIcon: "",
369
-        appImg: "",
441
+        appImg: [],
370
         versionName: "",
442
         versionName: "",
371
         versionNum: "",
443
         versionNum: "",
372
         appSize: "",
444
         appSize: "",
373
         appDeveloper: "",
445
         appDeveloper: "",
374
-        uniqueCode: "",
446
+        appPackage: "",
375
         appAbbr: "",
447
         appAbbr: "",
376
         appRenew: "",
448
         appRenew: "",
377
-        targetSchool: 1,
449
+        targetSchool: 2,
378
         deviceids: [],
450
         deviceids: [],
379
         schoolids: []
451
         schoolids: []
380
       },
452
       },
417
         ]
489
         ]
418
       },
490
       },
419
       group_list: [],
491
       group_list: [],
492
+      device_list: [],
493
+      curRegion: [],
494
+      school_list: [],
495
+      userInfo: {},
420
       columns: [
496
       columns: [
421
         {
497
         {
422
           title: "序号",
498
           title: "序号",
487
     };
563
     };
488
   },
564
   },
489
   created() {
565
   created() {
566
+    this.userInfo = JSON.parse(
567
+        localStorage.getItem("xh_control_userInfo")
568
+    ).content;
490
     this.init();
569
     this.init();
491
     this.searchList();
570
     this.searchList();
492
   },
571
   },
493
   methods: {
572
   methods: {
494
-    init(){
573
+    getSelectedNodes(data){
574
+      console.log(data)
575
+
576
+    },
577
+    getUploadProgress(file) {
578
+      let progress = file.progress();
579
+      if (!progress) {
580
+        progress = 0;
581
+      }
582
+      return progress * 100;
583
+    },
584
+    async onFileAdded(file) {
585
+      let that = this;
586
+      let { name } = file.file;
587
+      file.uniqueIdentifier = uuid();
588
+      file.suffix = that.getFileSuffix(name);
589
+      let deviceIndex = that.getArrIndex(file.suffix, CONFIG_SUFFIX.getApp());
590
+      if (deviceIndex == -1) {
591
+        this.$Message.error("文件格式不正确");
592
+        return false;
593
+      }
594
+      let fname = file.name;
595
+      let resourcename = fname.substring(0, fname.lastIndexOf("."));
596
+      file.resourcename = resourcename;
597
+      this.file_list = [file];
598
+      console.log(file);
599
+    },
600
+    //查找下标
601
+    getArrIndex(obj, arr) {
602
+      for (let h = 0; h < arr.length; h++) {
603
+        if (obj == arr[h]) {
604
+          return h;
605
+        }
606
+      }
607
+      return -1;
608
+    },
609
+    getFileSuffix(fileName) {
610
+      let dotIndex = fileName.lastIndexOf(".");
611
+      let fileType = fileName.slice(dotIndex + 1);
612
+      return fileType.toLowerCase();
613
+    },
614
+    onFileProgress(rootFile, file) {
615
+      file.progress();
616
+      this.showLiading = true;
617
+    },
618
+    onFileSuccess(rootFile, file, response) {
619
+      let res = JSON.parse(response);
620
+      // 服务器自定义的错误(即虽返回200,但是是错误的情况),这种错误是Uploader无法拦截的
621
+      if (res.code === 0) {
622
+        //合并
623
+        let url = this.$api.baseImageUrl + "chunk/merge_app";
624
+        let formData = new FormData();
625
+        formData.append("identifier", file.uniqueIdentifier);
626
+        formData.append("filename", `${file.resourcename}.${file.suffix}`);
627
+        formData.append("savefolder", "app");
628
+        // 进行post 请求
629
+        axios({
630
+          method: "post",
631
+          timeout: 1000 * window._config.axiosFileTimeout,
632
+          url,
633
+          data: formData,
634
+          headers: {
635
+            "Content-Type": "application/x-www-form-urlencoded"
636
+          }
637
+        })
638
+          .then((response) => {
639
+            let res = response.data;
640
+            if (res.code === 0) {
641
+              console.log(res.obj);
642
+              this.wallpaperInfo.apkPath = res.obj.apkPath;
643
+              this.wallpaperInfo.appIcon = res.obj.appIcon;
644
+              this.wallpaperInfo.appPackage = res.obj.appPackage;
645
+              this.wallpaperInfo.apkPath = res.obj.apkPath;
646
+              this.wallpaperInfo.appSize = res.obj.appSize;
647
+              this.wallpaperInfo.versionName = res.obj.versionName;
648
+              this.wallpaperInfo.versionNum = res.obj.versionNum;
649
+              this.showLiading = false;
650
+            } else {
651
+              this.$Message.error(`${file.name} ${res.msg}`);
652
+              this.showLiading = false;
653
+            }
654
+          })
655
+          .catch(() => {
656
+            this.$Message.error("上传失败");
657
+            this.showLiading = false;
658
+          });
659
+      } else {
660
+        this.$Message.error(`${file.name} ${res.msg}`);
661
+        this.showLiading = false;
662
+      }
663
+    },
664
+    onFileError(rootFile, file, response) {
665
+      let res = JSON.parse(response);
666
+      this.$Message.error(`${file.name} ${res.msg}`);
667
+      this.showLiading = false;
668
+    },
669
+    CheckboxDevice(dgroupid, val) {
670
+      console.log(dgroupid, val);
671
+    },
672
+    init() {
495
       //获取分组列表
673
       //获取分组列表
496
       appgroup_list({
674
       appgroup_list({
497
         page: 1,
675
         page: 1,
499
         appgroupName: ""
677
         appgroupName: ""
500
       }).then((res) => {
678
       }).then((res) => {
501
         if (res.code === 0) {
679
         if (res.code === 0) {
502
-          this.group_list = res.obj;
680
+          this.group_list = res.obj.data;
681
+          console.log(this.group_list);
682
+        } else {
683
+          this.$Message.error(res.msg);
684
+        }
685
+      });
686
+      //获取分组下设备
687
+      device_list({}).then((res) => {
688
+        if (res.code === 0) {
689
+          this.device_list = res.obj;
690
+          console.log(res.obj);
691
+        } else {
692
+          this.$Message.error(res.msg);
693
+        }
694
+      });
695
+
696
+      //获取区域学校
697
+      region_list_rs({regionid:this.userInfo.regionid}).then((res) => {
698
+        if (res.code === 0) {
699
+          this.getHandleData(res.obj[0])
700
+          this.curRegion = res.obj;
701
+          this.school_list = res.obj;
702
+          console.log( this.school_list);
703
+
704
+
705
+        } else {
706
+          this.$Message.error(res.msg);
707
+        }
708
+      });
709
+    },
710
+    getHandleData(node){
711
+      node.title = node.regionName;
712
+      node.expand = true;
713
+      node.selected = false;
714
+      if(node.children && node.children.length>0){
715
+        for(let child of node.children){
716
+          this.getHandleData(child)
717
+        }
718
+      }
719
+    },
720
+    getSchool() {
721
+      //wallpaperInfo.schoolname
722
+      //获取区域学校
723
+      region_list_rs({regionid:this.userInfo.regionid,
724
+        regionName:wallpaperInfo.schoolname}).then((res) => {
725
+        if (res.code === 0) {
726
+          this.getHandleData(res.obj[0])
727
+          this.curRegion = res.obj;
728
+          this.school_list = res.obj;
729
+          console.log( this.school_list);
730
+
731
+
503
         } else {
732
         } else {
504
           this.$Message.error(res.msg);
733
           this.$Message.error(res.msg);
505
         }
734
         }
506
       });
735
       });
507
     },
736
     },
508
-    getSchool() {},
509
     //gengx
737
     //gengx
510
     toRenew(row) {
738
     toRenew(row) {
511
       console.log(row);
739
       console.log(row);
512
     },
740
     },
513
-    groupChange() {},
514
-    upLoadUserpic(file) {
741
+    groupChange() {
742
+
743
+    },
744
+    upLoadUserpic(file,type) {
745
+      //type 1图标/2截图
515
       console.log(file);
746
       console.log(file);
516
-      let size = file.size / 1024 / 1024;
517
       let str = file.name.split(".");
747
       let str = file.name.split(".");
518
       let suffix = str[str.length - 1];
748
       let suffix = str[str.length - 1];
519
       suffix = suffix.toLowerCase();
749
       suffix = suffix.toLowerCase();
521
         this.$Message.warning("请上传png、jpeg、jpg类型的文件");
751
         this.$Message.warning("请上传png、jpeg、jpg类型的文件");
522
         return false;
752
         return false;
523
       }
753
       }
524
-      if (size > 10) {
525
-        this.$Message.error("图片太大,不能超过5M!");
526
-        return false;
754
+      if(type === 2){
755
+        console.log(this.wallpaperInfo.appImg)
756
+        if(this.wallpaperInfo.appImg.length>5 ){
757
+          this.$Message.warning("最多上传五张截图!");
758
+          return false;
759
+        }
760
+
527
       }
761
       }
528
       let formData = new FormData();
762
       let formData = new FormData();
529
       formData.append("file", file);
763
       formData.append("file", file);
530
-      formData.append("savefolder", "headpic");
764
+      formData.append("savefolder", "app");
531
       formData.append("isrename", "1");
765
       formData.append("isrename", "1");
532
       let Url = this.$api.baseImageUrl + "up/upfile";
766
       let Url = this.$api.baseImageUrl + "up/upfile";
533
       this.showLoading = true;
767
       this.showLoading = true;
537
         })
771
         })
538
         .then((res) => {
772
         .then((res) => {
539
           this.showLoading = false;
773
           this.showLoading = false;
774
+          console.log(res)
540
           if (res.data.code === 0) {
775
           if (res.data.code === 0) {
541
-            console.log(res.obj);
542
-            this.wallpaperInfo.iconPath = res.obj;
776
+            if(type === 1){
777
+              //图标
778
+              this.wallpaperInfo.appIcon = res.data.obj;
779
+            }else {
780
+              //截图
781
+              this.wallpaperInfo.appImg.push(res.data.obj)
782
+              console.log(this.wallpaperInfo.appImg)
783
+            }
784
+
785
+            this.$Message.success(res.data.msg);
543
           } else {
786
           } else {
544
             this.$Message.error(res.data.msg);
787
             this.$Message.error(res.data.msg);
545
           }
788
           }
614
         strategy: 1,
857
         strategy: 1,
615
         apkPath: "",
858
         apkPath: "",
616
         appIcon: "",
859
         appIcon: "",
617
-        appImg: "",
860
+        appImg: [],
618
         versionName: "",
861
         versionName: "",
619
         versionNum: "",
862
         versionNum: "",
620
         appSize: "",
863
         appSize: "",
621
         appDeveloper: "",
864
         appDeveloper: "",
622
-        uniqueCode: "",
865
+        appPackage: "",
623
         appAbbr: "",
866
         appAbbr: "",
624
         appRenew: "",
867
         appRenew: "",
625
-        targetSchool: 1,
868
+        targetSchool: 2,
626
         deviceids: [],
869
         deviceids: [],
627
         schoolids: []
870
         schoolids: []
628
       };
871
       };
742
       color: #7c8db5;
985
       color: #7c8db5;
743
     }
986
     }
744
   }
987
   }
988
+  .img_list{
989
+    height: 90px;
990
+    display: flex;
991
+  }
745
   .app_img {
992
   .app_img {
746
     margin-top: 10px;
993
     margin-top: 10px;
747
     width: 90px;
994
     width: 90px;
748
     height: 90px;
995
     height: 90px;
749
-    border-radius: 20px;
996
+    margin-right: 20px;
750
     opacity: 1;
997
     opacity: 1;
751
     border: 1px solid #e5e5e5;
998
     border: 1px solid #e5e5e5;
752
     background: #ffffff;
999
     background: #ffffff;
753
     overflow: hidden;
1000
     overflow: hidden;
1001
+    position: relative;
754
     img {
1002
     img {
755
       width: 100%;
1003
       width: 100%;
756
       height: 100%;
1004
       height: 100%;
757
       object-fit: cover;
1005
       object-fit: cover;
758
     }
1006
     }
1007
+    .del{
1008
+      width: 20px;
1009
+      height: 20px;
1010
+      object-fit: cover;
1011
+      position: absolute;
1012
+      right: 6px;
1013
+      top: 6px;
1014
+      cursor: pointer;
1015
+    }
759
   }
1016
   }
760
   .targetSchool {
1017
   .targetSchool {
761
     width: 100%;
1018
     width: 100%;
769
       width: 50%;
1026
       width: 50%;
770
       padding: 10px;
1027
       padding: 10px;
771
       .school_list {
1028
       .school_list {
772
-        height: calc(100% - 52px);
1029
+        margin-top: 10px;
1030
+        height: calc(100% - 42px);
773
         overflow-y: auto;
1031
         overflow-y: auto;
774
       }
1032
       }
775
     }
1033
     }
787
         }
1045
         }
788
       }
1046
       }
789
       .school_list {
1047
       .school_list {
790
-        height: calc(100% - 52px);
1048
+        margin-top: 10px;
1049
+        height: calc(100% - 42px);
791
         overflow-y: auto;
1050
         overflow-y: auto;
792
       }
1051
       }
793
     }
1052
     }
794
   }
1053
   }
1054
+  .upload_box {
1055
+    /deep/ .uploader-btn {
1056
+      border: navajowhite;
1057
+      &:hover {
1058
+        background-color: transparent;
1059
+      }
1060
+    }
1061
+  }
1062
+  .upProgress {
1063
+    display: flex;
1064
+    justify-content: center;
1065
+    align-items: center;
1066
+    text-align: center;
1067
+    > div {
1068
+      margin: 0 10px;
1069
+      width: 100%;
1070
+    }
1071
+  }
1072
+  .file_name {
1073
+    height: 32px;
1074
+    margin-top: 10px;
1075
+    .show_name {
1076
+      font-size: 14px;
1077
+      color: #333;
1078
+      text-align: left;
1079
+      white-space: nowrap;
1080
+      text-overflow: ellipsis;
1081
+      overflow: hidden;
1082
+      line-height: 32px;
1083
+      cursor: pointer;
1084
+    }
1085
+  }
1086
+}
1087
+
1088
+.primary_btn {
1089
+  border-radius: 8px;
1090
+  color: white;
1091
+  line-height: 35px;
1092
+  padding: 0 15px;
1093
+  height: 35px;
1094
+  font-size: 14px;
1095
+  background: linear-gradient(180deg, #30e5fc 0%, #34a4ff 100%);
1096
+  box-shadow: inset 0 1px 2px 0 #ffffffb3, inset 0 -2px 3px 0 #ffffff4d,
1097
+    0 3px 5px 0 #339dff80, inset 0 -2px 0 0 #2b89e0;
795
 }
1098
 }
796
 </style>
1099
 </style>

Loading…
Cancel
Save