appManagement.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  1. <template>
  2. <div class="appManagement">
  3. <div class="ac_left">
  4. <saveCard title="最近使用" :data="recentUse" :type="1" @saveClick="openApp"/>
  5. <saveCard title="收藏" :data="collect" :type="0" @saveClick="openApp"/>
  6. </div>
  7. <div class="ac_right">
  8. <div class="ac_header">
  9. <div class="ac_h_top">
  10. <span class="ac_h_t_active"> <!-- class="ac_h_t_active"-->
  11. <svg
  12. width="20"
  13. height="20"
  14. viewBox="0 0 20 20"
  15. xmlns="http://www.w3.org/2000/svg"
  16. >
  17. <path
  18. d="M14.0625 2.1875C11.9914 2.1875 10.3125 3.86643 10.3125 5.9375C10.3125 8.00857 11.9914 9.6875 14.0625 9.6875C16.1336 9.6875 17.8125 8.00857 17.8125 5.9375C17.8125 3.86643 16.1336 2.1875 14.0625 2.1875ZM11.5625 5.9375C11.5625 4.55679 12.6818 3.4375 14.0625 3.4375C15.4432 3.4375 16.5625 4.55679 16.5625 5.9375C16.5625 7.31821 15.4432 8.4375 14.0625 8.4375C12.6818 8.4375 11.5625 7.31821 11.5625 5.9375Z"
  19. />
  20. <path
  21. d="M2.5 3.75C2.5 3.05964 3.05964 2.5 3.75 2.5H8.125C8.81536 2.5 9.375 3.05964 9.375 3.75V8.125C9.375 8.81536 8.81536 9.375 8.125 9.375H3.75C3.05964 9.375 2.5 8.81536 2.5 8.125V3.75ZM3.75 3.75V8.125H8.125V3.75H3.75Z"
  22. />
  23. <path
  24. d="M2.5 11.875C2.5 11.1846 3.05964 10.625 3.75 10.625H8.125C8.81536 10.625 9.375 11.1846 9.375 11.875V16.25C9.375 16.9404 8.81536 17.5 8.125 17.5H3.75C3.05964 17.5 2.5 16.9404 2.5 16.25V11.875ZM3.75 11.875V16.25H8.125V11.875H3.75Z"
  25. />
  26. <path
  27. d="M10.625 11.875C10.625 11.1846 11.1846 10.625 11.875 10.625H16.25C16.9404 10.625 17.5 11.1846 17.5 11.875V16.25C17.5 16.9404 16.9404 17.5 16.25 17.5H11.875C11.1846 17.5 10.625 16.9404 10.625 16.25V11.875ZM11.875 16.25H16.25V11.875H11.875V16.25Z"
  28. />
  29. </svg>
  30. 应用管理</span
  31. >
  32. <span @click="changeShowPage(1)">
  33. <svg
  34. width="20"
  35. height="20"
  36. viewBox="0 0 20 20"
  37. xmlns="http://www.w3.org/2000/svg"
  38. >
  39. <rect width="20" height="20" fill="white" />
  40. <path
  41. fill-rule="evenodd"
  42. clip-rule="evenodd"
  43. d="M9.70072 1.32632C9.88727 1.22456 10.1127 1.22456 10.2993 1.32632L17.1743 5.07632C17.3751 5.18584 17.5 5.39628 17.5 5.625V14.375C17.5 14.6037 17.3751 14.8142 17.1743 14.9237L10.2993 18.6737C10.1127 18.7754 9.88727 18.7754 9.70072 18.6737L2.82572 14.9237C2.62493 14.8142 2.5 14.6037 2.5 14.375V5.625C2.5 5.39628 2.62493 5.18584 2.82572 5.07632L9.70072 1.32632ZM3.75 6.79282V14.004L9.375 17.0722V14.1039L6.55344 12.4109C6.36519 12.298 6.25 12.0945 6.25 11.875V8.45949L3.75 6.79282ZM7.5 8.47887V10.7711L9.375 9.64613V7.35387L7.5 8.47887ZM10.625 7.35387V9.64613L12.5 10.7711V8.47887L10.625 7.35387ZM13.75 8.45949V11.875C13.75 12.0945 13.6348 12.298 13.4466 12.4109L10.625 14.1039V17.0722L16.25 14.004V6.79282L13.75 8.45949ZM15.668 5.67854L10 2.58693L4.33205 5.67854L6.8926 7.38557L9.67844 5.71407C9.87637 5.59531 10.1236 5.59531 10.3216 5.71407L13.1074 7.38557L15.668 5.67854ZM10 13.0211L11.9102 11.875L10 10.7289L8.08978 11.875L10 13.0211Z"
  44. />
  45. </svg>
  46. 工作空间</span
  47. >
  48. <!-- <el-button
  49. type="primary"
  50. size="small"
  51. icon="el-icon-plus"
  52. style="position: absolute;right: 15px;"
  53. @click="addApp"
  54. >添加应用</el-button
  55. > -->
  56. </div>
  57. <div class="ac_h_banner" v-if="bannerObj">
  58. <img
  59. :src="bannerObj.poster"
  60. alt="banner图"
  61. />
  62. </div>
  63. <div class="ac_h_bottom">
  64. <div class="ac_h_b_typeList">
  65. <span
  66. :class="{ ac_h_b_typeList_active: showType === '' }"
  67. @click="changeType('')"
  68. >全部</span
  69. >
  70. <span
  71. v-for="item in typeList"
  72. :key="item.id"
  73. :class="{ ac_h_b_typeList_active: showType === item.id }"
  74. @click="changeType(item.id)"
  75. >{{ item.name }}</span
  76. >
  77. </div>
  78. <div class="ac_h_b_selectList">
  79. <el-select
  80. v-model="selectJuri"
  81. placeholder="请选择"
  82. @change="changeSelectType"
  83. style="width: 150px;margin-right: 10px;"
  84. >
  85. <el-option
  86. v-for="item in selectList"
  87. :key="item.index"
  88. :label="item.label"
  89. :value="item.index"
  90. ></el-option>
  91. </el-select>
  92. <el-input
  93. v-model="searchText"
  94. style="width: 200px;"
  95. placeholder="请输入应用名称"
  96. @keyup.enter.native="getData"
  97. clearable
  98. />
  99. <el-button
  100. type="primary"
  101. style="margin-left: 10px;"
  102. icon="el-icon-search"
  103. @click="getData"
  104. clearable
  105. ></el-button>
  106. <!-- <el-button type="primary" @click="releaseApp()">发布应用</el-button> -->
  107. </div>
  108. </div>
  109. </div>
  110. <div class="ac_content">
  111. <div
  112. class="ac_c_item"
  113. v-for="(item, index) in dataList"
  114. :key="item.id"
  115. @click="openApp(item)"
  116. >
  117. <div class="ac_c_i_top">
  118. <div class="ac_c_i_t_left">
  119. <svg
  120. v-if="
  121. isImageOrSvg(
  122. typeof item.json == 'object' ? item.json.icon : ''
  123. ) === 0
  124. "
  125. t="1732605901531"
  126. class="icon"
  127. viewBox="0 0 1024 1024"
  128. version="1.1"
  129. xmlns="http://www.w3.org/2000/svg"
  130. p-id="4275"
  131. width="200"
  132. height="200"
  133. >
  134. <path
  135. d="M179.2 153.6a51.2 51.2 0 0 0-51.2 51.2v128a51.2 51.2 0 0 0 51.2 51.2h128a51.2 51.2 0 0 0 51.2-51.2V204.8a51.2 51.2 0 0 0-51.2-51.2H179.2z m0-102.4h128a153.6 153.6 0 0 1 153.6 153.6v128a153.6 153.6 0 0 1-153.6 153.6H179.2a153.6 153.6 0 0 1-153.6-153.6V204.8a153.6 153.6 0 0 1 153.6-153.6z m0 614.4a51.2 51.2 0 0 0-51.2 51.2v128a51.2 51.2 0 0 0 51.2 51.2h128a51.2 51.2 0 0 0 51.2-51.2V716.8a51.2 51.2 0 0 0-51.2-51.2H179.2z m0-102.4h128a153.6 153.6 0 0 1 153.6 153.6v128a153.6 153.6 0 0 1-153.6 153.6H179.2a153.6 153.6 0 0 1-153.6-153.6V716.8a153.6 153.6 0 0 1 153.6-153.6z m611.84-403.4048a51.2 51.2 0 0 0-72.3968 0L646.144 232.2432a51.2 51.2 0 0 0 0 72.3968l72.448 72.3968a51.2 51.2 0 0 0 72.3968 0l72.3968-72.3968a51.2 51.2 0 0 0 0-72.3968L791.04 159.744z m72.3968-72.3968l72.3968 72.3968a153.6 153.6 0 0 1 0 217.2416l-72.3968 72.3968a153.6 153.6 0 0 1-217.2416 0l-72.3968-72.3968a153.6 153.6 0 0 1 0-217.2416l72.3968-72.3968a153.6 153.6 0 0 1 217.2416 0zM699.7504 896a51.2 51.2 0 0 1 0 102.4A162.1504 162.1504 0 0 1 537.6 836.2496v-110.8992A162.1504 162.1504 0 0 1 699.7504 563.2h110.8992a162.1504 162.1504 0 0 1 162.1504 162.1504v8.448a51.2 51.2 0 0 1-102.4 0v-8.448c0-33.024-26.7264-59.7504-59.7504-59.7504h-110.8992c-33.024 0-59.7504 26.7264-59.7504 59.7504v110.8992c0 33.024 26.7264 59.7504 59.7504 59.7504z"
  136. fill="#2C6DD2"
  137. p-id="4276"
  138. ></path>
  139. <path
  140. d="M791.4496 160a51.2 51.2 0 0 0-72.3968 0l-72.448 72.3968a51.2 51.2 0 0 0 0 72.3968l72.448 72.3968a51.2 51.2 0 0 0 72.3968 0l72.3968-72.3968a51.2 51.2 0 0 0 0-72.3968l-72.3968-72.3968z"
  141. fill="#20C997"
  142. p-id="4277"
  143. ></path>
  144. </svg>
  145. <span
  146. v-if="
  147. isImageOrSvg(
  148. typeof item.json == 'object' ? item.json.icon : ''
  149. ) === 1
  150. "
  151. v-html="item.json.icon"
  152. ></span>
  153. <el-image
  154. v-if="
  155. isImageOrSvg(
  156. typeof item.json == 'object' ? item.json.icon : ''
  157. ) === 2
  158. "
  159. style="width: 100%; height: 100%"
  160. :src="item.json.icon"
  161. fit="cover"
  162. ></el-image>
  163. </div>
  164. <div class="ac_c_i_t_right">
  165. <div>{{ item.name }}</div>
  166. <span>{{ item.label}}</span>
  167. <!-- <span>@{{ item.username }}</span> -->
  168. </div>
  169. <div class="ac_c_i_t_popover">
  170. <div
  171. class="ac_c_i_t_p_box"
  172. v-if="editAppCard === item.id"
  173. v-click-outside="handleBlur"
  174. >
  175. <div
  176. @click.stop="cancelCollectApp(item)"
  177. v-if="collect.map(i => i.id).includes(item.id)"
  178. >
  179. 取消收藏
  180. </div>
  181. <div @click.stop="collectApp(item)" v-else>收藏</div>
  182. <div
  183. @click.stop="copyApp(item)"
  184. v-if="item.json && item.json.copy === '1'"
  185. >
  186. 复制
  187. </div>
  188. <div
  189. @click.stop="updateApp(item)"
  190. v-if="item.userid === userId"
  191. >
  192. 修改
  193. </div>
  194. <div @click.stop="delApp(item)" v-if="item.userid === userId">
  195. 删除
  196. </div>
  197. </div>
  198. <svg
  199. t="1732786015570"
  200. @click.stop="updateCard(item.id)"
  201. class="icon"
  202. viewBox="0 0 1024 1024"
  203. version="1.1"
  204. xmlns="http://www.w3.org/2000/svg"
  205. p-id="9199"
  206. width="200"
  207. height="200"
  208. >
  209. <path
  210. d="M192 443.733333c-38.4 0-68.266667 29.866667-68.266667 68.266667 0 38.4 29.866667 68.266667 68.266667 68.266667s68.266667-29.866667 68.266667-68.266667c0-38.4-29.866667-68.266667-68.266667-68.266667zM512 443.733333c-38.4 0-68.266667 29.866667-68.266667 68.266667 0 38.4 29.866667 68.266667 68.266667 68.266667s68.266667-29.866667 68.266667-68.266667c0-38.4-29.866667-68.266667-68.266667-68.266667zM832 443.733333c-38.4 0-68.266667 29.866667-68.266667 68.266667 0 38.4 29.866667 68.266667 68.266667 68.266667s68.266667-29.866667 68.266667-68.266667c0-38.4-34.133333-68.266667-68.266667-68.266667z"
  211. fill="#111111"
  212. p-id="9200"
  213. ></path>
  214. </svg>
  215. </div>
  216. </div>
  217. <div class="ac_c_i_bottom">
  218. <div>{{ item.detail }}</div>
  219. <!-- <span @click="openApp(item.url)">{{ item.url }}</span> -->
  220. </div>
  221. </div>
  222. <div class="ac_c_empty" v-if="dataList.length === 0">
  223. <span>暂无数据...</span>
  224. </div>
  225. </div>
  226. </div>
  227. <addAppDialog
  228. ref="addAppDialogRef"
  229. :typeList="typeList"
  230. @success="addAppSuccess"
  231. />
  232. </div>
  233. </template>
  234. <script>
  235. const clickOutside = {
  236. bind(el, binding) {
  237. // 在元素上绑定一个点击事件监听器
  238. el.clickOutsideEvent = function(event) {
  239. // 检查点击事件是否发生在元素的内部
  240. if (!(el === event.target || el.contains(event.target))) {
  241. // 如果点击事件发生在元素的外部,则触发指令绑定的方法,将点击的event数据传过去
  242. binding.value(event);
  243. }
  244. };
  245. // 在文档上添加点击事件监听器
  246. document.addEventListener("click", el.clickOutsideEvent);
  247. },
  248. unbind(el) {
  249. // 在元素上解除点击事件监听器
  250. document.removeEventListener("click", el.clickOutsideEvent);
  251. }
  252. };
  253. import addAppDialog from "../dialog/addAppDialog.vue";
  254. import saveCard from "../dialog/saveCard.vue";
  255. // import collectCard from "./dialog/collectCard.vue";
  256. // import recentUseCard from "./dialog/recentUseCard.vue";
  257. export default {
  258. components: {
  259. addAppDialog,
  260. saveCard
  261. // collectCard,
  262. // recentUseCard
  263. },
  264. directives: {
  265. "click-outside": clickOutside // 注册自定义指令
  266. },
  267. data() {
  268. return {
  269. showType: "",
  270. searchText: "",
  271. selectJuri: 3,
  272. typeList: [],
  273. selectList: [
  274. { index: 1, label: "我的" },
  275. { index: 2, label: "组织" },
  276. { index: 3, label: "所有人" }
  277. ],
  278. userId: this.$route.query["userid"],
  279. org: this.$route.query["org"],
  280. oid: this.$route.query["oid"],
  281. getDataLoading: false,
  282. dataList: [],
  283. recentUse: [],
  284. collect: [],
  285. editAppCard: null,
  286. bannerObj:null
  287. };
  288. },
  289. computed: {
  290. isImageOrSvg() {
  291. return value => {
  292. let _result = 0; //啥也不是
  293. if (value) {
  294. const svgPattern = /<svg.*<\/svg>/;
  295. const imagePattern = /\.(jpeg|jpg|gif|png|svg|bmp|webp)$/i; // 图片链接的正则表达式
  296. const urlPattern = /^(http|https):\/\/[^ "]+$/; // 网络地址的正则表达式
  297. if (svgPattern.test(value)) {
  298. _result = 1;
  299. } else if (urlPattern.test(value) && imagePattern.test(value)) {
  300. _result = 2;
  301. }
  302. }
  303. return _result;
  304. };
  305. }
  306. },
  307. methods: {
  308. changeType(newIndex) {
  309. let flag = this.showType === newIndex;
  310. this.showType = newIndex;
  311. if (!flag) {
  312. this.getData();
  313. }
  314. },
  315. changeSelectType() {
  316. this.getData();
  317. },
  318. getData() {
  319. this.getDataLoading = true;
  320. let params = {
  321. uid: this.userId, //用户ID
  322. name: this.searchText, //应用名称搜索
  323. label: "", //应用的标签搜索
  324. type: this.showType, //应用的类型
  325. juri: this.selectJuri, //应用权限 1:我的 2:组织内 3:所有人
  326. stand: "cn" //cn站还是hk站
  327. };
  328. this.ajax
  329. .get(this.$store.state.api + "select_appStore", params)
  330. .then(res => {
  331. this.getDataLoading = false;
  332. let _data = res.data[0];
  333. if (_data.length > 0) {
  334. _data.forEach(i => {
  335. if (i.json) {
  336. i.json = JSON.parse(i.json);
  337. }
  338. });
  339. this.dataList = _data;
  340. } else {
  341. this.dataList = [];
  342. }
  343. })
  344. .catch(err => {
  345. this.getDataLoading = false;
  346. console.log(err);
  347. this.$message.error("获取应用失败");
  348. });
  349. },
  350. addApp() {
  351. this.$refs.addAppDialogRef.open({ type: 1 });
  352. },
  353. releaseApp(){
  354. this.$message.info("发布应用")
  355. },
  356. updateApp(data) {
  357. this.$refs.addAppDialogRef.open({
  358. type: 2,
  359. form: {
  360. id: data.id,
  361. name: data.name,
  362. label: data.label,
  363. detail: data.detail,
  364. url: data.url,
  365. type: data.type,
  366. juri: data.juri,
  367. stand: data.stand,
  368. json: data.json
  369. }
  370. });
  371. },
  372. // 收藏APP
  373. collectApp(item) {
  374. this.editAppCard = null;
  375. this.insertSave(item, 0);
  376. },
  377. //复制app
  378. copyApp(item) {
  379. this.$confirm(`确定复制《${item.name}》这个应用吗?`, "复制", {
  380. confirmButtonText: "确定",
  381. cancelButtonText: "取消",
  382. type: "warning"
  383. })
  384. .then(() => {
  385. let params = [
  386. {
  387. name: `${item.name}_copy`, //app名称
  388. userid: this.userId, //创建的用户ID
  389. label: item.label, //app标签
  390. detail: item.detail, //app简介
  391. url: item.url, //app链接
  392. type: item.type, //app类型
  393. juri: "1", //app权限 1:我的 2:组织 3:所有人
  394. stand: "cn", //语言
  395. json: JSON.stringify(item.json) //其他信息
  396. }
  397. ];
  398. this.ajax
  399. .post(this.$store.state.api + "insert_appStore", params)
  400. .then(res => {
  401. if (res.data == 1) {
  402. this.$message.success("复制成功");
  403. this.getData();
  404. } else {
  405. this.$message.error("复制失败");
  406. }
  407. })
  408. .catch(err => {
  409. console.log(err);
  410. this.$message.error("复制失败");
  411. });
  412. })
  413. .catch(_ => {
  414. console.log("取消复制");
  415. });
  416. },
  417. // 取消收藏
  418. cancelCollectApp(item) {
  419. this.editAppCard = null;
  420. let _data = this.collect.find(i => i.id === item.id);
  421. if (_data) {
  422. let params = [
  423. {
  424. sid: _data.sid
  425. }
  426. ];
  427. this.ajax
  428. .post(this.$store.state.api + "delete_appStoreSave", params)
  429. .then(res => {
  430. if (res.data) {
  431. this.$message.success("取消收藏成功");
  432. }
  433. this.getCollect();
  434. })
  435. .catch(e => {
  436. console.log(e);
  437. this.$message.error("取消收藏失败");
  438. this.getCollect();
  439. });
  440. } else {
  441. this.$message.error("取消收藏失败");
  442. this.getCollect();
  443. }
  444. },
  445. updateCard(id) {
  446. if (this.editAppCard === id) return (this.editAppCard = null);
  447. this.editAppCard = id;
  448. },
  449. handleBlur() {
  450. this.updateCard(null);
  451. },
  452. addAppSuccess(data, type) {
  453. if (type === 1) {
  454. //添加
  455. let params = [
  456. {
  457. name: data.name, //app名称
  458. userid: this.userId, //创建的用户ID
  459. label: data.label, //app标签
  460. detail: data.detail, //app简介
  461. url: data.url, //app链接
  462. type: data.type, //app类型
  463. juri: data.juri, //app权限 1:我的 2:组织 3:所有人
  464. stand: "cn", //语言
  465. json: JSON.stringify(data.json) //其他信息
  466. }
  467. ];
  468. this.ajax
  469. .post(this.$store.state.api + "insert_appStore", params)
  470. .then(res => {
  471. if (res.data == 1) {
  472. this.$message.success("添加成功");
  473. this.$refs.addAppDialogRef.close(true);
  474. this.getData();
  475. } else {
  476. this.$message.error("添加失败");
  477. this.$refs.addAppDialogRef.loading = false;
  478. }
  479. })
  480. .catch(err => {
  481. console.log(err);
  482. this.$message.error("添加失败");
  483. });
  484. } else if (type === 2) {
  485. let params = [
  486. {
  487. aid: data.id,
  488. name: data.name, //app名称
  489. userid: this.userId, //创建的用户ID
  490. label: data.label, //app标签
  491. detail: data.detail, //app简介
  492. url: data.url, //app链接
  493. type: data.type, //app类型
  494. juri: data.juri, //app权限 1:我的 2:组织 3:所有人
  495. stand: "cn", //语言
  496. json: JSON.stringify(data.json) //其他信息
  497. }
  498. ];
  499. this.ajax
  500. .post(this.$store.state.api + "update_appStore", params)
  501. .then(res => {
  502. if (res.data == 1) {
  503. this.$message.success("修改成功");
  504. this.$refs.addAppDialogRef.close(true);
  505. this.getData();
  506. } else {
  507. this.$message.error("修改失败");
  508. this.$refs.addAppDialogRef.loading = false;
  509. }
  510. })
  511. .catch(err => {
  512. console.log(err);
  513. this.$message.error("修改失败");
  514. });
  515. }
  516. },
  517. getTypeList() {
  518. let params = {
  519. suserid: this.userId, //用户ID
  520. sorg: this.org,
  521. soid: this.oid,
  522. sstand: "cn"
  523. };
  524. this.ajax
  525. .get(this.$store.state.api + "select_appStoreType", params)
  526. .then(res => {
  527. let data = res.data[0];
  528. if (data.length > 0) {
  529. this.typeList = data;
  530. }
  531. })
  532. .catch(err => {
  533. console.log(err);
  534. this.$message.error("获取应用类型失败");
  535. });
  536. },
  537. openApp(item,type=0) {
  538. window.open(item.url, "_blank");
  539. if (!(this.recentUse.length > 0 && item.id === this.recentUse[0].id) && type===0) {
  540. this.insertSave(item, 1);
  541. }
  542. },
  543. resetData() {
  544. this.searchText = "";
  545. this.selectJuri = 3;
  546. this.showType = "";
  547. this.getData();
  548. },
  549. getRecentUse() {
  550. let params = {
  551. uid: this.userId,
  552. type: 1,
  553. limit: 10
  554. };
  555. this.ajax
  556. .get(this.$store.state.api + "select_appStoreSave", params)
  557. .then(res => {
  558. let data = res.data[0];
  559. if (data.length > 0) {
  560. data.forEach(i => {
  561. if (i.json) {
  562. i.json = JSON.parse(i.json);
  563. }
  564. });
  565. this.recentUse = data;
  566. } else {
  567. this.recentUse = [];
  568. }
  569. })
  570. .catch(err => {
  571. console.log(err);
  572. console.log("获取最近使用失败");
  573. // this.$message.error("获取收藏应用失败")
  574. });
  575. },
  576. getCollect() {
  577. let params = {
  578. uid: this.userId,
  579. type: 0,
  580. limit: 0
  581. };
  582. this.ajax
  583. .get(this.$store.state.api + "select_appStoreSave", params)
  584. .then(res => {
  585. let data = res.data[0];
  586. if (data.length > 0) {
  587. data.forEach(i => {
  588. if (i.json) {
  589. i.json = JSON.parse(i.json);
  590. }
  591. });
  592. this.collect = data;
  593. } else {
  594. this.collect = [];
  595. }
  596. })
  597. .catch(err => {
  598. console.log(err);
  599. this.$message.error("获取收藏应用失败");
  600. });
  601. },
  602. insertSave(item, type) {
  603. let params = [
  604. {
  605. uid: this.userId,
  606. type: type,
  607. aid: item.id,
  608. json: ""
  609. }
  610. ];
  611. this.ajax
  612. .post(this.$store.state.api + "insert_appStoreSave", params)
  613. .then(res => {
  614. if (res.data) {
  615. if (type === 0) {
  616. this.$message.success("收藏成功");
  617. this.getCollect();
  618. } else if (type === 1) {
  619. this.getRecentUse();
  620. }
  621. }
  622. })
  623. .catch(err => {
  624. console.log(err);
  625. if (type === 0) this.$message.error("收藏失败");
  626. });
  627. },
  628. delApp(item) {
  629. this.$confirm(
  630. `确定要删除《${item.name}》这个应用吗,删除后无法找回!`,
  631. `确定删除应用`,
  632. {
  633. confirmButtonText: "确定",
  634. cancelButtonText: "取消",
  635. type: "warning"
  636. }
  637. )
  638. .then(() => {
  639. let params = [
  640. {
  641. uid: this.userId,
  642. aid: item.id
  643. }
  644. ];
  645. this.ajax
  646. .post(this.$store.state.api + "delete_appStore", params)
  647. .then(res => {
  648. if (res.data) {
  649. this.$message.success("删除成功");
  650. this.getData();
  651. } else {
  652. this.$message.error("删除失败");
  653. }
  654. })
  655. .catch(err => {
  656. console.log(err);
  657. this.$message.error("删除失败");
  658. });
  659. })
  660. .catch(() => {
  661. console.log("取消删除");
  662. });
  663. },
  664. changeShowPage(newPage) {
  665. this.$emit("changeShowCard", newPage);
  666. },
  667. getBanner(){
  668. let params = {
  669. uid:this.userId,
  670. oid:this.oid,
  671. org:this.org,
  672. type:4
  673. }
  674. this.ajax.get(this.$store.state.api+"select_bannerByoidORorg",params).then(res=>{
  675. let _data = res.data[0];
  676. if(_data[0]){
  677. this.bannerObj = _data[0];
  678. }else{
  679. this.bannerObj = null
  680. }
  681. }).catch(e=>{
  682. console.log("获取banner图失败")
  683. console.log(e)
  684. })
  685. }
  686. },
  687. mounted() {
  688. this.getTypeList();
  689. this.getData();
  690. this.getCollect();
  691. this.getRecentUse();
  692. this.getBanner()
  693. }
  694. };
  695. </script>
  696. <style scoped>
  697. .appManagement {
  698. width: 100vw;
  699. height: 100vh;
  700. background-color: #f2f4f7;
  701. margin: 0;
  702. overflow: auto;
  703. box-sizing: border-box;
  704. padding: 20px;
  705. display: flex;
  706. justify-content: space-between;
  707. }
  708. .ac_left {
  709. /* width: 280px;
  710. min-width: 280px; */
  711. width: clamp(150px,12vw,280px);
  712. min-width: 150px;
  713. margin-right: 20px;
  714. height: 100%;
  715. border-radius: 5px;
  716. background-color: #fff;
  717. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  718. box-sizing: border-box;
  719. padding: 10px;
  720. overflow: auto;
  721. }
  722. .ac_right {
  723. flex: 1;
  724. min-width: 800px;
  725. height: 100%;
  726. overflow-y: hidden;
  727. display: flex;
  728. flex-direction: column;
  729. }
  730. .ac_header {
  731. width: 100%;
  732. height: auto;
  733. border-radius: 5px;
  734. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  735. background-color: #fff;
  736. }
  737. .ac_h_top {
  738. width: 100%;
  739. height: 50px;
  740. display: flex;
  741. align-items: center;
  742. box-sizing: border-box;
  743. padding: 0 15px;
  744. border-bottom: 1px solid #eeeeee;
  745. position: relative;
  746. justify-content: center;
  747. }
  748. .ac_h_top > span {
  749. font-size: 22px;
  750. position: relative;
  751. margin-right: 25px;
  752. cursor: pointer;
  753. display: flex;
  754. align-items: center;
  755. }
  756. .ac_h_top > span>svg{
  757. width: 22px;
  758. height: 22px;
  759. fill: #1A1A1A;
  760. margin-right: 10px;
  761. }
  762. .ac_h_t_active{
  763. color: #0354D7;
  764. }
  765. .ac_h_t_active>svg{
  766. fill: #0354D7 !important;
  767. }
  768. /* .ac_h_t_active::after {
  769. content: "";
  770. position: absolute;
  771. width: 100%;
  772. height: 3px;
  773. border-radius: 4px;
  774. background-color: #409eff;
  775. left: 0;
  776. bottom: -5px;
  777. } */
  778. .ac_h_banner {
  779. width: 100%;
  780. height: clamp(100px,20vh,300px);
  781. border-radius: 5px;
  782. overflow: hidden;
  783. box-sizing: border-box;
  784. padding: 10px;
  785. }
  786. .ac_h_banner > img {
  787. width: 100%;
  788. height: 100%;
  789. object-fit: cover;
  790. border-radius: 5px;
  791. }
  792. .ac_h_bottom {
  793. width: 100%;
  794. height: auto;
  795. padding: 10px 15px 10px 15px;
  796. box-sizing: border-box;
  797. display: flex;
  798. justify-content: space-between;
  799. align-items: center;
  800. }
  801. .ac_h_b_typeList {
  802. width: calc(100% - 400px);
  803. height: auto;
  804. display: flex;
  805. flex-wrap: wrap;
  806. box-sizing: border-box;
  807. }
  808. .ac_h_b_typeList > span {
  809. font-size: 18px;
  810. margin-right: 20px;
  811. margin-top: 10px;
  812. margin-bottom: 5px;
  813. cursor: pointer;
  814. }
  815. .ac_h_b_typeList_active {
  816. color: #007aff;
  817. }
  818. .ac_h_b_selectList {
  819. margin-left: 15px;
  820. margin-bottom: 10px;
  821. display: flex;
  822. align-items: center;
  823. }
  824. .ac_content {
  825. width: 100%;
  826. flex: 1;
  827. height: auto;
  828. margin-top:10px;
  829. overflow: auto;
  830. min-height: 200px;
  831. }
  832. .ac_c_item {
  833. width: calc(100% / 5 - (15px * 4) / 5);
  834. height: 250px;
  835. background-color: #fff;
  836. border-radius: 10px;
  837. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  838. box-sizing: border-box;
  839. padding: 15px;
  840. margin-right: 15px;
  841. margin-bottom: 15px;
  842. float: left;
  843. cursor: pointer;
  844. font-size: calc(14px,20vh,16px);
  845. }
  846. @media screen and (min-width: 1400px) {
  847. .ac_c_item {
  848. width: calc(100% / 5 - (15px * 4) / 5) !important;
  849. }
  850. .ac_c_item:nth-child(5n) {
  851. margin-right: 0px !important;
  852. /* background-color: red; */
  853. }
  854. }
  855. @media screen and (max-width: 1380px) {
  856. .ac_c_item {
  857. width: calc(100% / 4 - (15px * 3) / 4) !important;
  858. }
  859. .ac_c_item:nth-child(4n) {
  860. margin-right: 0px !important;
  861. }
  862. /* .ac_c_item:nth-child(5n) {
  863. margin-right: 0 !important;
  864. } */
  865. }
  866. @media screen and (max-width: 1080px) {
  867. .ac_c_item {
  868. width: calc(100% / 3 - (15px * 2) / 3) !important;
  869. }
  870. .ac_c_item:nth-child(5n) {
  871. margin-right: 15px !important;
  872. }
  873. .ac_c_item:nth-of-type(4n) {
  874. margin-right: 15px !important;
  875. }
  876. .ac_c_item:nth-child(3n) {
  877. margin-right: 0 !important;
  878. }
  879. }
  880. .ac_c_empty {
  881. width: 100%;
  882. height: 40%;
  883. display: flex;
  884. box-sizing: border-box;
  885. padding-top: 2%;
  886. justify-content: center;
  887. /* align-items: center; */
  888. }
  889. .ac_c_i_top {
  890. width: 100%;
  891. height: 50px;
  892. display: flex;
  893. position: relative;
  894. /* flex-direction: column; */
  895. /* justify-content: space-evenly; */
  896. /* background-color: red */
  897. }
  898. .ac_c_i_t_popover {
  899. width: 30px;
  900. height: 30px;
  901. position: absolute;
  902. right: 0;
  903. top: 0;
  904. }
  905. .ac_c_i_t_popover svg {
  906. width: 25px;
  907. height: 25px;
  908. cursor: pointer;
  909. }
  910. .ac_c_i_t_p_box {
  911. position: absolute;
  912. height: auto;
  913. top: 100%;
  914. right: 0;
  915. padding: 8px;
  916. border-radius: 8px 0 8px 8px;
  917. background-color: #fff;
  918. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  919. width: auto;
  920. }
  921. .ac_c_i_t_p_box > div {
  922. width: 80px;
  923. height: 30px;
  924. cursor: pointer;
  925. transition: 0.3s;
  926. font-weight: bold;
  927. font-size: 0.9em;
  928. border-radius: 5px;
  929. display: flex;
  930. justify-content: center;
  931. align-items: center;
  932. position: relative;
  933. box-sizing: border-box;
  934. }
  935. .ac_c_i_t_p_box > div:hover {
  936. background-color: #f2f4f7;
  937. }
  938. .ac_c_i_t_left {
  939. width: 50px;
  940. height: 50px;
  941. border-radius: 8px;
  942. margin-right: 10px;
  943. box-sizing: border-box;
  944. padding: 5px;
  945. }
  946. .ac_c_i_t_left > svg {
  947. width: 100%;
  948. height: 100%;
  949. }
  950. .ac_c_i_t_left > span {
  951. width: 100%;
  952. height: 100%;
  953. display: block;
  954. }
  955. .ac_c_i_t_left > span >>> svg {
  956. width: 100%;
  957. height: 100%;
  958. }
  959. .ac_c_i_t_right {
  960. width: calc(100% - 60px);
  961. height: 100%;
  962. display: flex;
  963. flex-direction: column;
  964. justify-content: space-evenly;
  965. }
  966. .ac_c_i_t_right > div {
  967. font-size: 1.4em;
  968. font-weight: bold;
  969. max-width: 100%;
  970. overflow: hidden;
  971. text-overflow: ellipsis;
  972. white-space: nowrap;
  973. }
  974. .ac_c_i_t_right > span {
  975. font-size: 1.1em;
  976. /* font-weight: bold; */
  977. color: #8991a1;
  978. display: block;
  979. max-width: 100%;
  980. overflow: hidden;
  981. text-overflow: ellipsis;
  982. white-space: nowrap;
  983. }
  984. .ac_c_i_bottom {
  985. width: 100%;
  986. height: calc(100% - 60px);
  987. margin-top: 15px;
  988. }
  989. .ac_c_i_bottom > div {
  990. font-size: 1em;
  991. color: #8991a1;
  992. width: 100%;
  993. height: calc(100%);
  994. /* 第四行溢出显示... */
  995. display: -webkit-box;
  996. display: block;
  997. overflow: hidden;
  998. text-overflow: ellipsis;
  999. -webkit-line-clamp: 8;
  1000. -webkit-box-orient: vertical;
  1001. }
  1002. .ac_c_i_bottom > span {
  1003. margin-top: 5px;
  1004. font-size: 1em;
  1005. color: #409eff;
  1006. overflow: hidden;
  1007. display: block;
  1008. text-overflow: ellipsis;
  1009. white-space: nowrap;
  1010. cursor: pointer;
  1011. }
  1012. </style>