浏览代码

Merge branch 'dev' into 'master'

Dev

See merge request motive-power/yxl/yxl-web-admin-frontend!25
梁展鹏 3 年之前
父节点
当前提交
15f309ba8f

+ 13 - 0
src/api/app/index.js

@@ -0,0 +1,13 @@
+import api from '@/utils/request';
+
+export const getPage = params =>
+	api.post(`/yxl-back-end/framework/app/admin/page`, params);
+export const getItem = ({ id, ...params }) =>
+	api.get(`/yxl-back-end/admin/tweet/${id}`, params);
+export const saveItem = params => {
+	return api.post(`/yxl-back-end/framework/app`, params);
+};
+export const forceUpgradeItem = ({ id, ...params }) =>
+	api.put(`/yxl-back-end/framework/app/${id}/is-force-upgrade`, params);
+export const changeShowItem = ({ id, ...params }) =>
+	api.put(`/yxl-back-end/framework/app/${id}/show`, params);

+ 20 - 10
src/router/index.js

@@ -58,7 +58,7 @@ export const constantRoutes = [
         }
       }
     ]
-  },
+  }
 
   // // 404 page must be placed at the end !!!
   // {
@@ -123,7 +123,7 @@ export const asyncRoutes = [
         path: 'PhotoVerify',
         name: '摄影师', // add by 梁展鹏 20210723 因为只有一个菜单,所以暂时把菜单名称写到这里。实际上这里是"照片管理"
         component: () =>
-        import('@/views/photographerManagement/photoVerify/index'),
+          import('@/views/photographerManagement/photoVerify/index'),
         meta: {
           title: '摄影师',
           // icon: 'tree',
@@ -158,7 +158,7 @@ export const asyncRoutes = [
         path: 'ImageGoodsManagement',
         name: '照片商品管理',
         component: () =>
-        import('@/views/photoManagement/imageGoodsManagement/index'),
+          import('@/views/photoManagement/imageGoodsManagement/index'),
         meta: {
           title: '照片商品管理',
           // icon: 'table',
@@ -169,7 +169,7 @@ export const asyncRoutes = [
         path: 'PhotoVerifyManagement',
         name: '上传照片审核',
         component: () =>
-        import('@/views/photoManagement/photoVerifyManagement/index'),
+          import('@/views/photoManagement/photoVerifyManagement/index'),
         meta: {
           title: '上传照片审核',
           // icon: 'tree',
@@ -194,7 +194,7 @@ export const asyncRoutes = [
         path: 'PhotographerVerify',
         name: '摄影师认证审核',
         component: () =>
-        import('@/views/photographerManagement/photographerVerify/index'),
+          import('@/views/photographerManagement/photographerVerify/index'),
         meta: {
           title: '摄影师认证审核',
           // icon: 'table',
@@ -273,7 +273,7 @@ export const asyncRoutes = [
         path: 'OrderManagement',
         name: '订单列表',
         component: () =>
-        import('@/views/financialManagement/orderManagement/index'),
+          import('@/views/financialManagement/orderManagement/index'),
         meta: {
           title: '订单列表',
           // icon: 'table',
@@ -362,7 +362,7 @@ export const asyncRoutes = [
         path: 'BannerManagement',
         name: 'Banner管理',
         component: () =>
-        import('@/views/baseManagement/bannerManagement/index'),
+          import('@/views/baseManagement/bannerManagement/index'),
         meta: {
           title: 'Banner管理',
           // icon: 'table',
@@ -383,12 +383,22 @@ export const asyncRoutes = [
         path: 'ProblemFeedbackManagement',
         name: '问题管理',
         component: () =>
-        import('@/views/baseManagement/problemFeedbackManagement/index'),
+          import('@/views/baseManagement/problemFeedbackManagement/index'),
         meta: {
           title: '问题管理',
           // icon: 'tree',
           roles: ['admin', 'operate']
         }
+      },
+      {
+        path: 'UpdateListManagement',
+        name: '自更新管理',
+        component: () => import('@/views/baseManagement/updateList/index'),
+        meta: {
+          title: '自更新管理',
+          // icon: 'tree',
+          roles: ['admin', 'operate']
+        }
       }
     ]
   },
@@ -408,7 +418,7 @@ export const asyncRoutes = [
         path: 'AccountManagement',
         name: '账号列表',
         component: () =>
-        import('@/views/systemManagement/accountManagement/index'),
+          import('@/views/systemManagement/accountManagement/index'),
         meta: {
           title: '账号列表',
           // icon: 'table',
@@ -419,7 +429,7 @@ export const asyncRoutes = [
         path: 'RoleManagement',
         name: '角色列表',
         component: () =>
-        import('@/views/systemManagement/roleManagement/index'),
+          import('@/views/systemManagement/roleManagement/index'),
         meta: {
           title: '角色列表',
           // icon: 'tree',

+ 8 - 1
src/utils/dialog-helper.js

@@ -18,6 +18,7 @@ import ImageGoodsItem from 'views/photoManagement/imageGoodsManagement/modal/Ite
 import PhotoUpload from 'views/photographerManagement/photoVerify/modal/ItemModal.vue';
 import PhotoMultUpload from 'views/photographerManagement/photoVerify/modal/MultItemModal.vue';
 import AliOssMulti from 'views/photographerManagement/photoVerify/modal/ali-oss-multi.vue';
+import UpdateAppItem from 'views/baseManagement/updateList/modal/ItemModal.vue';
 
 const modal = (Component, props) => {
   let _component = null;
@@ -40,6 +41,13 @@ const modal = (Component, props) => {
   document.body.appendChild(_component.$el);
 };
 
+let UpdateAppItemModal = data => {
+  modal(UpdateAppItem, data);
+};
+Vue.prototype.$updateAppItemModal = params => {
+  UpdateAppItemModal(params);
+};
+
 let AliOssMultiModal = data => {
   modal(AliOssMulti, data);
 };
@@ -47,7 +55,6 @@ Vue.prototype.$AliOssMultiModal = params => {
   AliOssMultiModal(params);
 };
 
-
 let PhotoVerifyMultItemModal = data => {
   modal(PhotoVerifyMultItem, data);
 };

+ 169 - 0
src/views/baseManagement/updateList/index.vue

@@ -0,0 +1,169 @@
+<template>
+  <div class="">
+    <toolbar @on-filter="filterData" @on-reset="filterData" />
+
+    <div class="m-10 bg-w p-20 br-10">
+      <el-button type="primary" icon="el-icon-plus" @click="handleAdd"
+        >新增</el-button
+      >
+      <base-table
+        :columns="columns"
+        :items="items"
+        :pagination="pagination"
+        :page-change="pageChange"
+      />
+    </div>
+  </div>
+</template>
+
+<script>
+import toolbar from './toolbar';
+import mxFilterList from '@/mixins/filterList';
+import { getPage, changeShowItem, forceUpgradeItem } from '@/api/app';
+
+export default {
+  name: 'UpdateList',
+
+  components: { toolbar },
+
+  mixins: [
+    mxFilterList({
+      fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
+    })
+  ],
+
+  data() {
+    return {
+      columns: [
+        {
+          key: 'productName',
+          name: '版本名',
+          minWidth: this.$col.m
+        },
+        {
+          key: 'versionNumber',
+          name: '版本号',
+          minWidth: this.$col.b
+        },
+        {
+          key: 'platform',
+          name: '客户端',
+          width: this.$col.m
+        },
+        {
+          key: 'downloadUrl',
+          name: '下载地址',
+          minWidth: this.$col.m
+        },
+        {
+          key: 'upgradeDesc',
+          name: '升级描述',
+          minWidth: this.$col.b
+        },
+        {
+          key: 'isForceUpgrade',
+          name: '强制更新',
+          width: this.$col.b,
+          type: 'switch',
+          switchName: ['开启', '关闭'],
+          api: async row => {
+            const { success } = await forceUpgradeItem(row);
+            if (success) {
+              this.$success('修改成功!');
+            }
+            this.$g_emit('update_app_reload');
+          }
+        },
+        {
+          key: 'isShow',
+          name: '状态',
+          width: this.$col.b,
+          type: 'switch',
+          switchName: ['运行', '停止'],
+          api: async row => {
+            const { success } = await changeShowItem(row);
+            if (success) {
+              this.$success('修改成功!');
+            }
+            this.$g_emit('update_app_reload');
+          }
+        }
+        // {
+        //   key: 'action',
+        //   name: '操作',
+        //   width: '120',
+        //   render: (h, { row }) => {
+        //     const action = [];
+        //     action.push(
+        //       h(
+        //         'el-button',
+        //         {
+        //           props: {
+        //             type: 'text'
+        //           },
+        //           on: {
+        //             click: () =>
+        //               this.$TrendItemModal({
+        //                 id: row.id,
+        //                 info: {
+        //                   name: row.name,
+        //                   sort: row.sort,
+        //                   isShow: row.isShow
+        //                 }
+        //               })
+        //           }
+        //         },
+        //         '编辑'
+        //       )
+        //     );
+        //     action.push(
+        //       h(
+        //         'BaseBtn',
+        //         {
+        //           props: {
+        //             popip: true,
+        //             txt: '删除',
+        //             type: 'text'
+        //           },
+        //           class: 'ml-10',
+        //           on: {
+        //             ok: () => this.handleDelItem(row)
+        //           }
+        //         },
+        //         '删除'
+        //       )
+        //     );
+
+        //     return h('div', action);
+        //   }
+        // }
+      ]
+    };
+  },
+
+  created() {
+    this.$g_on('update_app_reload', this.reload);
+  },
+
+  beforeDestroy() {
+    this.$g_off('update_app_reload', this.reload);
+  },
+
+  methods: {
+    handleAdd() {
+      this.$updateAppItemModal();
+    },
+    async handleDelItem(item) {
+      const { success, msg } = await delItem({
+        id: item.id
+      });
+      if (success) {
+        this.$success('删除成功!');
+        this.$g_emit('trend_reload');
+      }
+    }
+  }
+};
+</script>
+
+<style type="scss" scoped></style>

+ 131 - 0
src/views/baseManagement/updateList/modal/ItemModal.vue

@@ -0,0 +1,131 @@
+<template>
+  <el-dialog
+    :title="title"
+    :visible.sync="modal"
+    width="500px"
+    :close-on-click-modal="false"
+    @close="
+      res => {
+        $emit('cancel');
+      }
+    "
+  >
+    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+      <el-form-item label="版本名" prop="productName">
+        <el-input v-model="form.productName"></el-input>
+      </el-form-item>
+
+      <el-form-item label="版本号" prop="versionNumber">
+        <el-input v-model="form.versionNumber"></el-input>
+      </el-form-item>
+
+      <el-form-item label="下载地址" prop="downloadUrl">
+        <el-input v-model="form.downloadUrl"></el-input>
+      </el-form-item>
+
+      <el-form-item label="客户端">
+        <el-radio-group v-model="form.platform" prop="platform">
+          <el-radio label="Android">Android</el-radio>
+          <!-- // todo 前端判断更改成大写IOS -->
+          <el-radio label="iOS">iOS</el-radio>
+        </el-radio-group>
+      </el-form-item>
+
+      <el-form-item label="强制更新">
+        <el-radio-group v-model="form.isForceUpgrade" prop="isForceUpgrade">
+          <el-radio :label="true">开启</el-radio>
+          <el-radio :label="false">关闭</el-radio>
+        </el-radio-group>
+      </el-form-item>
+
+      <el-form-item label="状态">
+        <el-radio-group v-model="form.isShow" prop="isShow">
+          <el-radio :label="true">运行</el-radio>
+          <el-radio :label="false">停止</el-radio>
+        </el-radio-group>
+      </el-form-item>
+
+      <el-form-item label="升级备注">
+        <el-input v-model="form.upgradeDesc"></el-input>
+      </el-form-item>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="modal = false">取消</el-button>
+      <el-button type="primary" @click="handleConfirm">确定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import { saveItem } from '@/api/app';
+
+export default {
+  name: 'UpdateAppItemModal',
+
+  props: {
+    id: {
+      type: String,
+      default: ''
+    }
+  },
+
+  data() {
+    return {
+      modal: true,
+
+      form: {
+        productName: '',
+        versionNumber: '',
+        downloadUrl: '',
+        isShow: false,
+        isForceUpgrade: false,
+        platform: 'Android',
+        upgradeDesc: null
+      },
+      rules: {
+        productName: [
+          { required: true, message: '请输入版本名', trigger: 'change' }
+        ],
+        versionNumber: [
+          { required: true, message: '请输入版本号', trigger: 'change' }
+        ],
+        downloadUrl: [
+          { required: true, message: '请输入下载地址', trigger: 'change' }
+        ]
+      }
+    };
+  },
+
+  computed: {
+    title() {
+      if (this.id) {
+        return '编辑App自更新';
+      } else {
+        return '新增App自更新';
+      }
+    }
+  },
+
+  mounted() {},
+
+  methods: {
+    handleConfirm() {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const params = Object.assign({}, this.form);
+          params.cover = '';
+          if (this.id) params.id = this.id;
+          const { success, msg } = await saveItem(params);
+          if (success) {
+            this.$success('保存成功!');
+            this.modal = false;
+            this.$g_emit('update_app_reload');
+          }
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 49 - 0
src/views/baseManagement/updateList/toolbar.vue

@@ -0,0 +1,49 @@
+<template>
+  <toolbar-container :fields="fields" v-on="$listeners" />
+</template>
+
+<script>
+import { setStatus } from '@/utils';
+
+export default {
+  name: 'UpdateListToolbar',
+
+  data() {
+    return {
+      fields: [
+        {
+          type: 'text',
+          name: 'platform',
+          label: '平台'
+        },
+        {
+          type: 'text',
+          name: 'productName',
+          label: '版本名'
+        },
+        {
+          type: 'text',
+          name: 'versionNumber',
+          label: '版本号'
+        },
+        {
+          type: 'select',
+          name: 'isForceUpgrade',
+          label: '强制更新',
+          options: setStatus(['开启', '关闭'], [true, false]),
+          format: val => (val !== null && val !== '' ? !!val : null)
+        },
+        {
+          type: 'select',
+          name: 'isShow',
+          label: '状态',
+          options: setStatus(['运行', '停止'], [true, false]),
+          format: val => (val !== null && val !== '' ? !!val : null)
+        }
+      ]
+    };
+  }
+};
+</script>
+
+<style type="scss" scoped></style>