Parcourir la source

【模版目录】更新管理端源码

吴昊天 il y a 3 ans
Parent
commit
e67979ad7a

Fichier diff supprimé car celui-ci est trop grand
+ 147 - 1269
template/admin/package-lock.json


+ 22 - 0
template/admin/src/api/setting.js

@@ -1012,3 +1012,25 @@ export function saveType(type) {
     method: 'get',
   });
 }
+
+/**
+ * @description 多语言-语言类型列表
+ */
+ export function langTypeList(data) {
+  return request({
+    url: `setting/lang_type/list`,
+    method: 'get',
+    params: data,
+  });
+}
+
+/**
+ * @description 多语言-语言类型新增编辑
+ * @param {Number} param id {Number} 
+ */
+ export function langTypeForm(id) {
+  return request({
+    url: `setting/lang_type/form/${id}`,
+    method: 'get',
+  });
+}

+ 2 - 4
template/admin/src/pages/cms/addArticle/index.vue

@@ -41,9 +41,7 @@
             <FormItem label="文章分类:" label-for="cid" prop="cid">
               <div class="perW90">
                 <Select v-model="formValidate.cid">
-                  <Option v-for="item in treeData" :value="item.id" :key="item.id">{{
-                    item.html + item.title
-                  }}</Option>
+                  <Option v-for="item in treeData" :value="item.id" :key="item.id">{{ item.html + item.title }}</Option>
                 </Select>
               </div>
             </FormItem>
@@ -267,8 +265,8 @@ export default {
     },
     // 提交数据
     onsubmit(name) {
+      this.formValidate.content = this.content;
       this.$refs[name].validate((valid) => {
-        this.formValidate.content = this.content;
         if (valid) {
           cmsAddApi(this.formValidate)
             .then(async (res) => {

+ 145 - 0
template/admin/src/pages/setting/multiLanguage/list.vue

@@ -0,0 +1,145 @@
+<template>
+  <div>
+    <div class="i-layout-page-header">
+      <div class="i-layout-page-header">
+        <span class="ivu-page-header-title">{{ $route.meta.title }}</span>
+      </div>
+    </div>
+    <Card :bordered="false" dis-hover class="ivu-mt">
+      <Row type="flex">
+        <Col v-bind="grid">
+          <Button type="primary" icon="md-add" @click="add">添加语言</Button>
+        </Col>
+      </Row>
+      <Table
+        :columns="columns"
+        :data="list"
+        ref="table"
+        class="mt25"
+        :loading="loading"
+        highlight-row
+        no-userFrom-text="暂无数据"
+        no-filtered-userFrom-text="暂无筛选结果"
+      >
+        <template slot-scope="{ row, index }" slot="icons">
+          <div class="tabBox_img" v-viewer>
+            <img v-lazy="row.icon" />
+          </div>
+        </template>
+        <template slot-scope="{ row, index }" slot="action">
+          <a @click="del(row, '删除语言', index)">删除</a>
+        </template>
+      </Table>
+      <div class="acea-row row-right page">
+        <Page :total="total" show-elevator show-total @on-change="pageChange" :page-size="langFrom.limit" />
+      </div>
+    </Card>
+  </div>
+</template>
+
+<script>
+import { mapState } from 'vuex';
+import { langTypeList, langTypeForm } from '@/api/setting';
+export default {
+  name: 'user_group',
+  data() {
+    return {
+      grid: {
+        xl: 7,
+        lg: 7,
+        md: 12,
+        sm: 24,
+        xs: 24,
+      },
+      loading: false,
+      columns: [
+        {
+          title: 'ID',
+          key: 'id',
+          width: 200,
+        },
+        {
+          title: '语言名称',
+          key: 'language_name',
+          minWidth: 200,
+        },
+        {
+          title: '语言编码',
+          key: 'file_name',
+          minWidth: 200,
+        },
+        {
+          title: '操作',
+          slot: 'action',
+          fixed: 'right',
+          minWidth: 120,
+        },
+      ],
+      langFrom: {
+        page: 1,
+        limit: 15,
+      },
+      list: [],
+      total: 0,
+    };
+  },
+  computed: {
+    ...mapState('media', ['isMobile']),
+    labelWidth() {
+      return this.isMobile ? undefined : 75;
+    },
+    labelPosition() {
+      return this.isMobile ? 'top' : 'left';
+    },
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    // 添加
+    add() {
+      this.$modalForm(langTypeForm(0)).then(() => this.getList());
+    },
+    // 分组列表
+    getList() {
+      this.loading = true;
+      langTypeList(this.langFrom)
+        .then(async (res) => {
+          let data = res.data;
+          this.list = data.list;
+          this.total = data.count;
+          this.loading = false;
+        })
+        .catch((res) => {
+          this.loading = false;
+          this.$Message.error(res.msg);
+        });
+    },
+    pageChange(index) {
+      this.langFrom.page = index;
+      this.getList();
+    },
+    // 删除
+    del(row, tit, num) {
+      let delfromData = {
+        title: tit,
+        num: num,
+        url: `setting/lang_type/del/${row.id}`,
+        method: 'DELETE',
+        ids: '',
+      };
+      this.$modalSure(delfromData)
+        .then((res) => {
+          this.$Message.success(res.msg);
+          this.list.splice(num, 1);
+          this.getList();
+        })
+        .catch((res) => {
+          this.$Message.error(res.msg);
+        });
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus"></style>

+ 1 - 1
template/admin/src/pages/system/onlineUpgrade/index.vue

@@ -551,7 +551,7 @@ export default {
 };
 </script>
 
-<style lang="stylus">
+<style lang="stylus" scoped>
 .active {
   padding: 6px 0;
   background-color: #eee !important;

+ 9 - 0
template/admin/src/router/modules/setting.js

@@ -629,5 +629,14 @@ export default {
       },
       component: () => import('@/pages/setting/systemOutAccount/index'),
     },
+    {
+      path: 'lang/list',
+      name: `${pre}langList`,
+      meta: {
+        auth: ['admin-lang-list'],
+        title: '语言列表',
+      },
+      component: () => import('@/pages/setting/multiLanguage/list'),
+    },
   ],
 };

+ 1 - 1
template/admin/src/setting.js

@@ -1,5 +1,5 @@
 // 请求接口地址 如果没有配置自动获取当前网址路径
-const VUE_APP_API_URL =  process.env.VUE_APP_API_URL || `${location.origin}/adminapi`;
+const VUE_APP_API_URL = process.env.VUE_APP_API_URL || `${location.origin}/adminapi`;
 
 const Setting = {
   // 接口请求地址