瀏覽代碼

Merge branch 'dev' of http://git.izouma.com/xiongzhu/9th into dev

panhui 4 年之前
父節點
當前提交
570c9d9a10

+ 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;
+}

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

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

+ 31 - 0
src/main/java/com/izouma/nineth/dto/InvitePhoneDTO.java

@@ -0,0 +1,31 @@
+package com.izouma.nineth.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.izouma.nineth.domain.User;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
+
+import java.time.LocalDateTime;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class InvitePhoneDTO {
+    @ExcelProperty(value = "昵称")
+    private String nickName;
+
+    @ExcelProperty(value = "手机号")
+    private String phone;
+
+    @ExcelProperty("注册时间")
+    private LocalDateTime createdAt;
+
+    @ExcelProperty("邀请人")
+    private String invitorName;
+
+    public InvitePhoneDTO(User user) {
+        BeanUtils.copyProperties(user, this);
+    }
+}

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

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

+ 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/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));
+    }
+}

+ 27 - 4
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;
@@ -66,6 +64,7 @@ public class UserService {
     private AdapayService     adapayService;
     private UserBankCardRepo  userBankCardRepo;
     private CacheService      cacheService;
+    private InviteRepo        inviteRepo;
 
     @CacheEvict(value = "user", key = "#user.username")
     public User update(User user) {
@@ -134,6 +133,30 @@ public class UserService {
         return user;
     }
 
+    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);
+        }
+        smsService.verify(phone, code);
+        User user = create(UserRegister.builder()
+                .authorities(Collections.singleton(Authority.get(AuthorityName.ROLE_USER)))
+                .username(name)
+                .nickname(name)
+                .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))
+                .inviteCode(Optional.ofNullable(invite).map(Invite::getCode).orElse(null))
+                .build());
+        if (invite != null) {
+            inviteRepo.increaseNum(invite.getId());
+        }
+        return user;
+    }
+
     public void del(Long id) {
         User user = userRepo.findById(id).orElseThrow(new BusinessException("用户不存在"));
         user.setDel(true);

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

@@ -65,8 +65,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);
+    }
+}
+

+ 11 - 4
src/main/java/com/izouma/nineth/web/UserController.java

@@ -2,10 +2,7 @@ package com.izouma.nineth.web;
 
 import com.huifu.adapay.core.exception.BaseAdaPayException;
 import com.izouma.nineth.domain.User;
-import com.izouma.nineth.dto.PageQuery;
-import com.izouma.nineth.dto.UserBankCard;
-import com.izouma.nineth.dto.UserDTO;
-import com.izouma.nineth.dto.UserRegister;
+import com.izouma.nineth.dto.*;
 import com.izouma.nineth.enums.AuthorityName;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.UserBankCardRepo;
@@ -231,6 +228,16 @@ public class UserController extends BaseController {
     public Map<String, Object> batchRegister(@RequestParam String phones, @RequestParam String defaultPassword) {
         return userService.batchRegister(phones, defaultPassword);
     }
+
+    @PreAuthorize("hasAnyRole('ADMIN')")
+    @PostMapping("/exportInvite")
+    @ResponseBody
+    public void exportInvite(HttpServletResponse response, @RequestBody PageQuery pageQuery) throws IOException {
+        List<InvitePhoneDTO> data = userService.all(pageQuery)
+                .map(InvitePhoneDTO::new)
+                .getContent();
+        ExcelUtils.export(response, data);
+    }
 }
 
 

+ 5 - 8
src/main/nine-space/src/router/index.js

@@ -6,14 +6,11 @@ import http from '../plugins/http';
 
 jsapiSign();
 function jsapiSign() {
-    setTimeout(() => {
-        if (/micromessenger/i.test(navigator.userAgent)) {
-            if (/localhost|(192\.168)/i.test(location.host)) {
-                return;
-            }
+    if (/micromessenger/i.test(navigator.userAgent) && !/localhost|(192\.168)/i.test(location.host)) {
+        setTimeout(() => {
             let isIOS = /iphone|ipad/i.test(navigator.userAgent);
             http.http
-                .get('/wx/jsapiSign', { url: isIOS ? store.state.firstUrl : location.origin + location.href })
+                .get('/wx/jsapiSign', { url: isIOS ? store.state.firstUrl : location.origin + location.pathname })
                 .then(res => {
                     wx.config({
                         debug: false,
@@ -48,8 +45,8 @@ function jsapiSign() {
                     });
                 })
                 .catch(e => {});
-        }
-    }, 200);
+        }, 200);
+    }
 }
 jsapiSign();
 const routes = [

文件差異過大導致無法顯示
+ 18798 - 1
src/main/vue/package-lock.json


+ 1 - 0
src/main/vue/package.json

@@ -8,6 +8,7 @@
     "build-theme": "npx et -o src/styles/element_theme"
   },
   "dependencies": {
+    "@chenfengyuan/vue-qrcode": "^1.0.2",
     "@fortawesome/fontawesome": "^1.1.8",
     "@fortawesome/fontawesome-free-solid": "^5.0.13",
     "@fortawesome/vue-fontawesome": "^0.1.7",

+ 37 - 19
src/main/vue/src/router.js

@@ -352,51 +352,69 @@ const router = new Router({
                 {
                     path: '/commissionRecordEdit',
                     name: 'CommissionRecordEdit',
-                    component: () => import(/* webpackChunkName: "commissionRecordEdit" */ '@/views/CommissionRecordEdit.vue'),
+                    component: () =>
+                        import(/* webpackChunkName: "commissionRecordEdit" */ '@/views/CommissionRecordEdit.vue'),
                     meta: {
-                       title: '分销记录编辑',
-                    },
+                        title: '分销记录编辑'
+                    }
                 },
                 {
                     path: '/commissionRecordList',
                     name: 'CommissionRecordList',
-                    component: () => import(/* webpackChunkName: "commissionRecordList" */ '@/views/CommissionRecordList.vue'),
+                    component: () =>
+                        import(/* webpackChunkName: "commissionRecordList" */ '@/views/CommissionRecordList.vue'),
                     meta: {
-                       title: '分销记录',
-                    },
-               },
+                        title: '分销记录'
+                    }
+                },
                 {
                     path: '/recommendEdit',
                     name: 'RecommendEdit',
                     component: () => import(/* webpackChunkName: "recommendEdit" */ '@/views/RecommendEdit.vue'),
                     meta: {
-                       title: '首页推荐编辑',
-                    },
+                        title: '首页推荐编辑'
+                    }
                 },
                 {
                     path: '/recommendList',
                     name: 'RecommendList',
                     component: () => import(/* webpackChunkName: "recommendList" */ '@/views/RecommendList.vue'),
                     meta: {
-                       title: '首页推荐',
-                    },
-               },
+                        title: '首页推荐'
+                    }
+                },
                 {
                     path: '/activityEdit',
                     name: 'ActivityEdit',
                     component: () => import(/* webpackChunkName: "activityEdit" */ '@/views/ActivityEdit.vue'),
                     meta: {
-                       title: '活动编辑',
-                    },
+                        title: '活动编辑'
+                    }
                 },
                 {
                     path: '/activityList',
                     name: 'ActivityList',
                     component: () => import(/* webpackChunkName: "activityList" */ '@/views/ActivityList.vue'),
                     meta: {
-                       title: '活动',
-                    },
-               }
+                        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: '邀请码管理'
+                    }
+                }
                 /**INSERT_LOCATION**/
             ]
         },
@@ -437,7 +455,7 @@ router.beforeEach((to, from, next) => {
         window.open(url);
         return;
     }
-    if (!store.state.userInfo && to.path !== '/login' && to.path!=='/photoProcessing') {
+    if (!store.state.userInfo && to.path !== '/login' && to.path !== '/photoProcessing') {
         http.axios
             .get('/user/my')
             .then(res => {
@@ -456,4 +474,4 @@ router.beforeEach((to, from, next) => {
     }
 });
 
-export default router;
+export default router;

+ 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>

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

@@ -0,0 +1,274 @@
+<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="邀请人数">
+                <template slot="header" slot-scope="{ column }">
+                    <sortable-header :column="column" :current-sort="sort" @changeSort="changeSort"> </sortable-header>
+                </template>
+            </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" width="350">
+                <template slot-scope="{ row }">
+                    <el-button @click="detail(row)" size="mini">邀请列表</el-button>
+                    <el-button @click="showCode(row)" size="mini">二维码</el-button>
+                    <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>
+        <el-dialog :visible.sync="showDialog" title="邀请列表" width="800px" top="10vh">
+            <div>
+                <el-button
+                    style="margin: 0 10px 10px 25px"
+                    size="mini"
+                    type="primary"
+                    @click="downloadPhone"
+                    :disabled="downloading"
+                    >导出手机号</el-button
+                >
+                <created-at-picker
+                    v-model="createdAt"
+                    name="注册"
+                    @input="getInviteInfo"
+                    size="mini"
+                ></created-at-picker>
+            </div>
+            <el-table :data="list" v-loading="dialogLoading" height="60vh">
+                <el-table-column prop="id" label="ID" width="80"></el-table-column>
+                <el-table-column prop="nickname" label="昵称"></el-table-column>
+                <el-table-column prop="phone" label="手机"></el-table-column>
+                <el-table-column prop="createdAt" label="注册时间"></el-table-column>
+            </el-table>
+        </el-dialog>
+
+        <el-dialog :visible.sync="showCodeDialog" title="二维码" width="400px" center>
+            <vue-qrcode :value="codeValue" :options="{ width: 300, margin: 2 }" style="margin-left: 25px"></vue-qrcode>
+            <div style="margin-left: 40px; font-size: 16px">右键点击二维码可保存</div>
+        </el-dialog>
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex';
+import pageableTable from '@/mixins/pageableTable';
+import VueQrcode from '@chenfengyuan/vue-qrcode';
+export default {
+    name: 'InviteList',
+    mixins: [pageableTable],
+    components: { VueQrcode },
+    data() {
+        return {
+            multipleMode: false,
+            search: '',
+            url: '/invite/all',
+            downloading: false,
+            showDialog: false,
+            dialogLoading: false,
+            list: [],
+            showCodeDialog: false,
+            codeValue: 'Hello, World!',
+            inviteCode: '',
+            createdAt: ''
+        };
+    },
+    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);
+                    }
+                });
+        },
+        detail(row) {
+            this.list = [];
+            this.createdAt = '';
+            this.showDialog = true;
+            this.inviteCode = row.code;
+            this.getInviteInfo();
+        },
+        getInviteInfo() {
+            this.dialogLoading = true;
+            this.$http
+                .post(
+                    '/user/all',
+                    { size: 10000, sort: 'id,desc', query: { inviteCode: this.inviteCode, createdAt: this.createdAt } },
+                    { body: 'json' }
+                )
+                .then(res => {
+                    this.list = res.content;
+                    this.dialogLoading = false;
+                });
+        },
+        showCode(row) {
+            this.codeValue = 'https://nfttest.9space.vip/9th/?inviteCode=' + row.code;
+            this.showCodeDialog = true;
+        },
+        downloadPhone() {
+            this.downloading = true;
+            this.$axios
+                .post(
+                    '/user/exportInvite',
+                    { size: 10000, sort: 'id,desc', query: { inviteCode: this.inviteCode, createdAt: this.createdAt } },
+                    {
+                        responseType: 'blob'
+                    }
+                )
+                .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', '手机号.xlsx');
+                    document.body.appendChild(link);
+                    link.click();
+                    link.remove();
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.downloading = false;
+                    this.$message.error(e.error);
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+</style>

文件差異過大導致無法顯示
+ 321 - 321
src/main/vue/yarn.lock


部分文件因文件數量過多而無法顯示