xiongzhu 4 gadi atpakaļ
vecāks
revīzija
e6578403f4

+ 30 - 0
src/main/java/com/izouma/nineth/domain/Invite.java

@@ -0,0 +1,30 @@
+package com.izouma.nineth.domain;
+
+import com.izouma.nineth.annotations.Searchable;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Entity;
+
+@Data
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class Invite extends BaseEntity {
+    @Searchable
+    private String name;
+
+    @Searchable
+    private String phone;
+
+    @Searchable
+    private String code;
+
+    @Searchable
+    private String remark;
+
+    private int inviteNum;
+}

+ 4 - 0
src/main/java/com/izouma/nineth/domain/User.java

@@ -116,4 +116,8 @@ public class User extends BaseEntity implements Serializable {
     private String memberId;
 
     private String settleAccountId;
+
+    private String invitorName;
+
+    private String invitorPhone;
 }

+ 4 - 0
src/main/java/com/izouma/nineth/dto/UserRegister.java

@@ -36,4 +36,8 @@ public class UserRegister {
     private String email;
 
     private boolean admin;
+
+    private String invitorName;
+
+    private String invitorPhone;
 }

+ 16 - 0
src/main/java/com/izouma/nineth/repo/AppVersionRepo.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.AppVersion;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface AppVersionRepo extends JpaRepository<AppVersion, Long>, JpaSpecificationExecutor<AppVersion> {
+    @Query("update AppVersion t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+}

+ 24 - 0
src/main/java/com/izouma/nineth/repo/InviteRepo.java

@@ -0,0 +1,24 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.Invite;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+import java.util.Optional;
+
+public interface InviteRepo extends JpaRepository<Invite, Long>, JpaSpecificationExecutor<Invite> {
+    @Query("update Invite t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+
+    Optional<Invite> findFirstByCode(String code);
+
+    @Modifying
+    @Transactional
+    @Query("update Invite i set i.inviteNum = i.inviteNum + 1 where i.id = ?1")
+    void increaseNum(Long id);
+}

+ 20 - 0
src/main/java/com/izouma/nineth/service/AppVersionService.java

@@ -0,0 +1,20 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.domain.AppVersion;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.repo.AppVersionRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class AppVersionService {
+
+    private AppVersionRepo appVersionRepo;
+
+    public Page<AppVersion> all(PageQuery pageQuery) {
+        return appVersionRepo.findAll(JpaUtils.toSpecification(pageQuery, AppVersion.class), JpaUtils.toPageRequest(pageQuery));
+    }
+}

+ 20 - 0
src/main/java/com/izouma/nineth/service/InviteService.java

@@ -0,0 +1,20 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.domain.Invite;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.repo.InviteRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class InviteService {
+
+    private InviteRepo inviteRepo;
+
+    public Page<Invite> all(PageQuery pageQuery) {
+        return inviteRepo.findAll(JpaUtils.toSpecification(pageQuery, Invite.class), JpaUtils.toPageRequest(pageQuery));
+    }
+}

+ 13 - 5
src/main/java/com/izouma/nineth/service/UserService.java

@@ -7,15 +7,13 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
 import com.izouma.nineth.config.Constants;
 import com.izouma.nineth.domain.Follow;
 import com.izouma.nineth.domain.IdentityAuth;
+import com.izouma.nineth.domain.Invite;
 import com.izouma.nineth.domain.User;
 import com.izouma.nineth.dto.*;
 import com.izouma.nineth.enums.AuthStatus;
 import com.izouma.nineth.enums.AuthorityName;
 import com.izouma.nineth.exception.BusinessException;
-import com.izouma.nineth.repo.FollowRepo;
-import com.izouma.nineth.repo.IdentityAuthRepo;
-import com.izouma.nineth.repo.UserBankCardRepo;
-import com.izouma.nineth.repo.UserRepo;
+import com.izouma.nineth.repo.*;
 import com.izouma.nineth.security.Authority;
 import com.izouma.nineth.security.JwtTokenUtil;
 import com.izouma.nineth.security.JwtUserFactory;
@@ -65,6 +63,7 @@ public class UserService {
     private CollectionService collectionService;
     private AdapayService     adapayService;
     private UserBankCardRepo  userBankCardRepo;
+    private InviteRepo        inviteRepo;
 
     @CacheEvict(value = "user", key = "#user.username")
     public User update(User user) {
@@ -120,8 +119,12 @@ public class UserService {
         return userRepo.save(user);
     }
 
-    public User phoneRegister(String phone, String code, String password) {
+    public User phoneRegister(String phone, String code, String password, String inviteCode) {
         String name = "9th_" + RandomStringUtils.randomAlphabetic(8);
+        Invite invite = null;
+        if (StringUtils.isNotBlank(inviteCode)) {
+            invite = inviteRepo.findFirstByCode(inviteCode).orElse(null);
+        }
         User user = create(UserRegister.builder()
                 .authorities(Collections.singleton(Authority.get(AuthorityName.ROLE_USER)))
                 .username(name)
@@ -129,7 +132,12 @@ public class UserService {
                 .password(password)
                 .avatar(Constants.DEFAULT_AVATAR)
                 .phone(phone)
+                .invitorPhone(Optional.ofNullable(invite).map(Invite::getPhone).orElse(null))
+                .invitorName(Optional.ofNullable(invite).map(Invite::getName).orElse(null))
                 .build());
+        if (invite != null) {
+            inviteRepo.increaseNum(invite.getId());
+        }
         return user;
     }
 

+ 60 - 0
src/main/java/com/izouma/nineth/web/AppVersionController.java

@@ -0,0 +1,60 @@
+package com.izouma.nineth.web;
+import com.izouma.nineth.domain.AppVersion;
+import com.izouma.nineth.service.AppVersionService;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.AppVersionRepo;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/appVersion")
+@AllArgsConstructor
+public class AppVersionController extends BaseController {
+    private AppVersionService appVersionService;
+    private AppVersionRepo appVersionRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public AppVersion save(@RequestBody AppVersion record) {
+        if (record.getId() != null) {
+            AppVersion orig = appVersionRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return appVersionRepo.save(orig);
+        }
+        return appVersionRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<AppVersion> all(@RequestBody PageQuery pageQuery) {
+        return appVersionService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public AppVersion get(@PathVariable Long id) {
+        return appVersionRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        appVersionRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<AppVersion> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+}
+

+ 2 - 3
src/main/java/com/izouma/nineth/web/AuthenticationController.java

@@ -7,7 +7,6 @@ import com.izouma.nineth.security.JwtTokenUtil;
 import com.izouma.nineth.security.JwtUser;
 import com.izouma.nineth.security.JwtUserFactory;
 import com.izouma.nineth.service.UserService;
-import com.izouma.nineth.service.sms.SmsService;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -65,8 +64,8 @@ public class AuthenticationController {
 
     @PostMapping("/phoneRegister")
     @ApiOperation(value = "手机号密码注册")
-    public String phonePwdLogin(String phone, String code, String password) {
-        User user = userService.phoneRegister(phone, code, password);
+    public String phonePwdLogin(String phone, String code, String password, String inviteCode) {
+        User user = userService.phoneRegister(phone, code, password, inviteCode);
         return jwtTokenUtil.generateToken(JwtUserFactory.create(user));
     }
 

+ 68 - 0
src/main/java/com/izouma/nineth/web/InviteController.java

@@ -0,0 +1,68 @@
+package com.izouma.nineth.web;
+
+import com.izouma.nineth.domain.Invite;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.InviteRepo;
+import com.izouma.nineth.service.InviteService;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/invite")
+@AllArgsConstructor
+public class InviteController extends BaseController {
+    private InviteService inviteService;
+    private InviteRepo    inviteRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public Invite save(@RequestBody Invite record) {
+        if (record.getId() != null) {
+            Invite orig = inviteRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            inviteRepo.findFirstByCode(record.getCode()).ifPresent((i) -> {
+                if (!i.getId().equals(record.getId())) {
+                    throw new BusinessException("此邀请码已存在");
+                }
+            });
+            ObjUtils.merge(orig, record);
+            return inviteRepo.save(orig);
+        }
+        inviteRepo.findFirstByCode(record.getCode()).ifPresent((i) -> {
+            throw new BusinessException("此邀请码已存在");
+        });
+        return inviteRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<Invite> all(@RequestBody PageQuery pageQuery) {
+        return inviteService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public Invite get(@PathVariable Long id) {
+        return inviteRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        inviteRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<Invite> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+}
+

+ 1 - 0
src/main/resources/genjson/AppVersion.json

@@ -0,0 +1 @@
+{"tableName":"AppVersion","className":"AppVersion","remark":"APP版本管理","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/drew/Projects/Java/raex_back/src/main/java/com/izouma/nineth","viewPath":"/Users/drew/Projects/Java/raex_back/src/main/vue/src/views","routerPath":"/Users/drew/Projects/Java/raex_back/src/main/vue/src","resourcesPath":"/Users/drew/Projects/Java/raex_back/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"version","modelName":"version","remark":"version","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"build","modelName":"build","remark":"build","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"platform","modelName":"platform","remark":"platform","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"review","modelName":"review","remark":"review","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"downloadUrl","modelName":"downloadUrl","remark":"downloadUrl","showInList":true,"showInForm":true,"formType":"singleLineText"}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.nineth","tablePackage":"com.izouma.nineth.domain.AppVersion"}

+ 1 - 0
src/main/resources/genjson/Invite.json

@@ -0,0 +1 @@
+{"tableName":"Invite","className":"Invite","remark":"邀请码管理","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/drew/Projects/Java/raex_back/src/main/java/com/izouma/nineth","viewPath":"/Users/drew/Projects/Java/raex_back/src/main/vue/src/views","routerPath":"/Users/drew/Projects/Java/raex_back/src/main/vue/src","resourcesPath":"/Users/drew/Projects/Java/raex_back/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"name","modelName":"name","remark":"姓名","showInList":true,"showInForm":true,"formType":"singleLineText","required":true},{"name":"phone","modelName":"phone","remark":"手机","showInList":true,"showInForm":true,"formType":"singleLineText","required":true},{"name":"code","modelName":"code","remark":"邀请码","showInList":true,"showInForm":true,"formType":"singleLineText","required":true},{"name":"remark","modelName":"remark","remark":"备注","showInList":true,"showInForm":true,"formType":"singleLineText"},{"name":"inviteNum","modelName":"inviteNum","remark":"邀请人数","showInList":true,"showInForm":false,"formType":"singleLineText"}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.nineth","tablePackage":"com.izouma.nineth.domain.Invite"}

+ 32 - 0
src/main/vue/src/router.js

@@ -396,6 +396,38 @@ const router = new Router({
                     meta: {
                        title: '活动',
                     },
+               },
+                {
+                    path: '/inviteEdit',
+                    name: 'InviteEdit',
+                    component: () => import(/* webpackChunkName: "inviteEdit" */ '@/views/InviteEdit.vue'),
+                    meta: {
+                       title: '邀请码管理编辑',
+                    },
+                },
+                {
+                    path: '/inviteList',
+                    name: 'InviteList',
+                    component: () => import(/* webpackChunkName: "inviteList" */ '@/views/InviteList.vue'),
+                    meta: {
+                       title: '邀请码管理',
+                    },
+               },
+                {
+                    path: '/appVersionEdit',
+                    name: 'AppVersionEdit',
+                    component: () => import(/* webpackChunkName: "appVersionEdit" */ '@/views/AppVersionEdit.vue'),
+                    meta: {
+                       title: 'APP版本管理编辑',
+                    },
+                },
+                {
+                    path: '/appVersionList',
+                    name: 'AppVersionList',
+                    component: () => import(/* webpackChunkName: "appVersionList" */ '@/views/AppVersionList.vue'),
+                    meta: {
+                       title: 'APP版本管理',
+                    },
                }
                 /**INSERT_LOCATION**/
             ]

+ 120 - 0
src/main/vue/src/views/AppVersionEdit.vue

@@ -0,0 +1,120 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id"> 删除 </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form
+                    :model="formData"
+                    :rules="rules"
+                    ref="form"
+                    label-width="109px"
+                    label-position="right"
+                    size="small"
+                    style="max-width: 500px"
+                >
+                    <el-form-item prop="version" label="version">
+                        <el-input v-model="formData.version"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="build" label="build">
+                        <el-input v-model="formData.build"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="platform" label="platform">
+                        <el-select v-model="formData.platform">
+                            <el-option label="iOS" value="iOS">iOS</el-option>
+                            <el-option label="Android" value="Android">Android</el-option>
+                        </el-select>
+                    </el-form-item>
+                    <el-form-item prop="review" label="review">
+                        <el-switch v-model="formData.review"></el-switch>
+                    </el-form-item>
+                    <el-form-item prop="downloadUrl" label="downloadUrl">
+                        <el-input v-model="formData.downloadUrl"></el-input>
+                    </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    name: 'AppVersionEdit',
+    created() {
+        if (this.$route.query.id) {
+            this.$http
+                .get('appVersion/get/' + this.$route.query.id)
+                .then(res => {
+                    this.formData = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {
+                review: false
+            },
+            rules: {}
+        };
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            let data = { ...this.formData };
+
+            this.saving = true;
+            this.$http
+                .post('/appVersion/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.$message.error(e.error);
+                });
+        },
+        onDelete() {
+            this.$confirm('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/appVersion/del/${this.formData.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 188 - 0
src/main/vue/src/views/AppVersionList.vue

@@ -0,0 +1,188 @@
+<template>
+    <div class="list-view">
+        <page-title>
+            <el-button
+                @click="addRow"
+                type="primary"
+                icon="el-icon-plus"
+                :disabled="fetchingData || downloading"
+                class="filter-item"
+            >
+                新增
+            </el-button>
+            <el-button
+                @click="download"
+                icon="el-icon-upload2"
+                :loading="downloading"
+                :disabled="fetchingData"
+                class="filter-item"
+            >
+                导出
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-radio-group v-model="platform" size="small" class="filter-item">
+                <el-radio-button label="iOS"></el-radio-button>
+                <el-radio-button label="Android"></el-radio-button>
+            </el-radio-group>
+            <el-input
+                placeholder="搜索..."
+                v-model="search"
+                clearable
+                class="filter-item search"
+                @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table
+            :data="tableData"
+            row-key="id"
+            ref="table"
+            header-row-class-name="table-header-row"
+            header-cell-class-name="table-header-cell"
+            row-class-name="table-row"
+            cell-class-name="table-cell"
+            :height="tableHeight"
+            v-loading="fetchingData"
+        >
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
+            <el-table-column prop="id" label="ID" width="100"> </el-table-column>
+            <el-table-column prop="version" label="version"> </el-table-column>
+            <el-table-column prop="build" label="build"> </el-table-column>
+            <el-table-column prop="platform" label="platform"> </el-table-column>
+            <el-table-column prop="review" label="review"> </el-table-column>
+            <el-table-column prop="downloadUrl" label="downloadUrl"> </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" width="150">
+                <template slot-scope="{ row }">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination
+                background
+                @size-change="onSizeChange"
+                @current-change="onCurrentChange"
+                :current-page="page"
+                :page-sizes="[10, 20, 30, 40, 50]"
+                :page-size="pageSize"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="totalElements"
+            >
+            </el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+
+export default {
+    name: 'AppVersionList',
+    mixins: [pageableTable],
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/appVersion/all',
+            downloading: false,
+            platform: 'iOS'
+        };
+    },
+    computed: {
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        beforeGetData() {
+            return { search: this.search, query: { del: false, platform: this.platform } };
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        addRow() {
+            this.$router.push({
+                path: '/appVersionEdit',
+                query: {
+                    ...this.$route.query
+                }
+            });
+        },
+        editRow(row) {
+            this.$router.push({
+                path: '/appVersionEdit',
+                query: {
+                    id: row.id
+                }
+            });
+        },
+        download() {
+            this.downloading = true;
+            this.$axios
+                .get('/appVersion/excel', {
+                    responseType: 'blob',
+                    params: { size: 10000 }
+                })
+                .then(res => {
+                    console.log(res);
+                    this.downloading = false;
+                    const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                    const link = document.createElement('a');
+                    link.href = downloadUrl;
+                    link.setAttribute('download', res.headers['content-disposition'].split('filename=')[1]);
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/appVersion/del/${row.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                });
+        }
+    },
+    watch: {
+        
+    }
+};
+</script>
+<style lang="less" scoped>
+</style>

+ 155 - 0
src/main/vue/src/views/InviteEdit.vue

@@ -0,0 +1,155 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id"> 删除 </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form
+                    :model="formData"
+                    :rules="rules"
+                    ref="form"
+                    label-width="80px"
+                    label-position="right"
+                    size="small"
+                    style="max-width: 500px"
+                >
+                    <el-form-item prop="name" label="姓名">
+                        <el-input v-model="formData.name"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="phone" label="手机">
+                        <el-input v-model="formData.phone"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="code" label="邀请码">
+                        <div>
+                            <el-input v-model="formData.code" style="width: calc(100% - 100px)"></el-input>
+                            <el-button style="margin-left: 15px" @click="random">随机生成</el-button>
+                        </div>
+                    </el-form-item>
+                    <el-form-item prop="remark" label="备注">
+                        <el-input v-model="formData.remark"></el-input>
+                    </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+export default {
+    name: 'InviteEdit',
+    created() {
+        if (this.$route.query.id) {
+            this.$http
+                .get('invite/get/' + this.$route.query.id)
+                .then(res => {
+                    this.formData = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {},
+            rules: {
+                name: [
+                    {
+                        required: true,
+                        message: '请输入姓名',
+                        trigger: 'blur'
+                    }
+                ],
+                phone: [
+                    {
+                        required: true,
+                        message: '请输入手机号',
+                        trigger: 'blur'
+                    },
+                    {
+                        pattern: /^1[3-9]\d{9}$/,
+                        message: '请输入正确的手机号',
+                        trigger: 'blur'
+                    }
+                ],
+                code: [
+                    {
+                        required: true,
+                        message: '请输入邀请码',
+                        trigger: 'blur'
+                    }
+                ]
+            }
+        };
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            let data = { ...this.formData };
+
+            this.saving = true;
+            this.$http
+                .post('/invite/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.$message.error(e.error);
+                });
+        },
+        onDelete() {
+            this.$confirm('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/invite/del/${this.formData.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                });
+        },
+        random() {
+            function makeid(length) {
+                var result = '';
+                var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+                var charactersLength = characters.length;
+                for (var i = 0; i < length; i++) {
+                    result += characters.charAt(Math.floor(Math.random() * charactersLength));
+                }
+                return result;
+            }
+
+            this.$set(this.formData, 'code', makeid(6));
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 175 - 0
src/main/vue/src/views/InviteList.vue

@@ -0,0 +1,175 @@
+<template>
+    <div  class="list-view">
+        <page-title>
+            <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading" class="filter-item">
+                新增
+            </el-button>
+            <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData" class="filter-item">
+                导出
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                    placeholder="搜索..."
+                    v-model="search"
+                    clearable
+                    class="filter-item search"
+                    @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table :data="tableData" row-key="id" ref="table"
+                  header-row-class-name="table-header-row"
+                  header-cell-class-name="table-header-cell"
+                  row-class-name="table-row" cell-class-name="table-cell"
+                  :height="tableHeight" v-loading="fetchingData">
+            <el-table-column v-if="multipleMode" align="center" type="selection"
+                             width="50">
+            </el-table-column>
+            <el-table-column prop="id" label="ID" width="100">
+            </el-table-column>
+                                <el-table-column prop="name" label="姓名"
+>
+                    </el-table-column>
+                    <el-table-column prop="phone" label="手机"
+>
+                    </el-table-column>
+                    <el-table-column prop="code" label="邀请码"
+>
+                    </el-table-column>
+                    <el-table-column prop="remark" label="备注"
+>
+                    </el-table-column>
+                    <el-table-column prop="inviteNum" label="邀请人数"
+>
+                    </el-table-column>
+            <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right"
+                    width="150">
+                <template slot-scope="{row}">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination background @size-change="onSizeChange"
+                           @current-change="onCurrentChange" :current-page="page"
+                           :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize"
+                           layout="total, sizes, prev, pager, next, jumper"
+                           :total="totalElements">
+            </el-pagination>
+        </div>
+
+    </div>
+</template>
+<script>
+    import { mapState } from "vuex";
+    import pageableTable from "@/mixins/pageableTable";
+
+    export default {
+        name: 'InviteList',
+        mixins: [pageableTable],
+        data() {
+            return {
+                multipleMode: false,
+                search: "",
+                url: "/invite/all",
+                downloading: false,
+            }
+        },
+        computed: {
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            beforeGetData() {
+                return { search: this.search, query: { del: false } };
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            addRow() {
+                this.$router.push({
+                    path: "/inviteEdit",
+                    query: {
+                        ...this.$route.query
+                    }
+                });
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: "/inviteEdit",
+                    query: {
+                    id: row.id
+                    }
+                });
+            },
+            download() {
+                this.downloading = true;
+                this.$axios
+                    .get("/invite/excel", { 
+                        responseType: "blob",
+                        params: { size: 10000 }
+                    })
+                    .then(res => {
+                        console.log(res);
+                        this.downloading = false;
+                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                        const link = document.createElement("a");
+                        link.href = downloadUrl;
+                        link.setAttribute(
+                            "download",
+                            res.headers["content-disposition"].split("filename=")[1]
+                        );
+                        document.body.appendChild(link);
+                        link.click();
+                        link.remove();
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.downloading = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            },
+            deleteRow(row) {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/invite/del/${row.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>