Browse Source

fix(bugs): 修改

tangning 3 years ago
parent
commit
c7f163b332

BIN
src/assets/images/header.jpg


+ 7 - 7
src/components/Upload/src/data.tsx

@@ -124,10 +124,10 @@ export function createPreviewColumns(): BasicColumn[] {
 
 export function createPreviewActionColumn({
   handleRemove,
-  handleDownload,
-}: {
+}: // handleDownload,
+{
   handleRemove: Fn;
-  handleDownload: Fn;
+  // handleDownload: Fn;
 }): BasicColumn {
   return {
     width: 160,
@@ -141,10 +141,10 @@ export function createPreviewActionColumn({
           color: 'error',
           onClick: handleRemove.bind(null, record),
         },
-        {
-          label: t('component.upload.download'),
-          onClick: handleDownload.bind(null, record),
-        },
+        // {
+        //   label: t('component.upload.download'),
+        //   onClick: handleDownload.bind(null, record),
+        // },
       ];
 
       return <TableAction actions={actions} outside={true} />;

+ 6 - 6
src/layouts/default/header/components/user-dropdown/index.vue

@@ -11,13 +11,13 @@
 
     <template #overlay>
       <Menu @click="handleMenuClick">
-        <!-- <MenuItem
+        <MenuItem
           key="setting"
-          :text="t('layout.header.personalSetting')"
+          :text="t('layout.header.userSetting')"
           icon="ion:document-text-outline"
           v-if="getShowDoc"
-        /> -->
-        <MenuDivider v-if="getShowDoc" />
+        />
+        <!-- <MenuDivider v-if="getShowDoc" /> -->
         <MenuItem
           v-if="getUseLockPage"
           key="lock"
@@ -63,7 +63,7 @@
       Dropdown,
       Menu,
       MenuItem: createAsyncComponent(() => import('./DropMenuItem.vue')),
-      MenuDivider: Menu.Divider,
+      // MenuDivider: Menu.Divider,
       LockAction: createAsyncComponent(() => import('../lock/LockModal.vue')),
     },
     props: {
@@ -100,7 +100,7 @@
       // go setting
       function openSetting() {
         // openWindow(DOC_URL);
-        go('/account');
+        go('/account/index');
       }
 
       function handleMenuClick(e: { key: MenuEvent }) {

+ 1 - 1
src/layouts/default/header/index.vue

@@ -50,7 +50,7 @@
 
       <UserDropDown :theme="getHeaderTheme" />
 
-      <SettingDrawer v-if="getShowSetting" :class="`${prefixCls}-action__item`" />
+      <SettingDrawer v-if="true" :class="`${prefixCls}-action__item`" />
     </div>
   </Header>
 </template>

+ 1 - 0
src/locales/lang/zh-CN/layout.ts

@@ -20,6 +20,7 @@ export default {
 
     home: '首页',
     personalSetting: '个人设置',
+    userSetting: '账户设置',
   },
   multipleTab: {
     reload: '重新加载',

+ 1 - 0
src/locales/lang/zh-CN/sys.ts

@@ -83,6 +83,7 @@ export default {
     // placeholder
     accountPlaceholder: '请输入账号',
     passwordPlaceholder: '请输入密码',
+    passwordFormat: '输入密码格式有误',
     smsPlaceholder: '请输入验证码',
     mobilePlaceholder: '请输入手机号码',
     policyPlaceholder: '勾选后才能注册',

+ 3 - 3
src/views/corporation/index.vue

@@ -46,7 +46,7 @@
         />
       </template>
       <template #expirationTime="{ record }">
-        <Time v-if="record.expirationTime" :value="record.expirationTime" mode="datetime" />
+        <Time v-if="record.expirationTime" :value="record.expirationTime" mode="date" />
       </template>
 
       <template #cameraNum="{ record }">
@@ -202,8 +202,8 @@
         labelWidth: 100,
         schemas: [
           {
-            field: 'id',
-            label: 'id',
+            field: 'name',
+            label: '企业名称',
             component: 'Input',
             colProps: {
               xl: 5,

+ 1 - 1
src/views/member/list.vue

@@ -154,7 +154,7 @@ weixinOpenid: "oeADe5U9uLeMYsNigq98zdu8J96A"
       };
 
       const [registerTable] = useTable({
-        title: '会员列表',
+        title: '微信用户列表',
         api: ListApi,
         columns: columns,
         useSearchForm: true,

+ 2 - 0
src/views/product/addCategoryModal.vue

@@ -106,10 +106,12 @@ wapBannerUrl: "https://4dkk.4dage.com/shop/huafa/20220302/23135195983e96.png?x-o
       field: 'wapBannerUrl',
       component: 'Upload',
       label: '手机banner',
+      show: false,
       rules: [{ required: true, message: '请选择上传文件' }],
       componentProps: {
         api: uploadBannerApi,
         maxNumber: 1,
+        maxSize: 5,
         afterFetch: function (data) {
           Reflect.set(data, 'url', data.message.url);
           return data;

+ 3 - 1
src/views/product/editCategoryModal.vue

@@ -7,7 +7,7 @@ name: "test"
 type: 0
 wapBannerUrl: "https://4dkk.4dage.com/shop/huafa/20220302/23135195983e96.png?x-oss-process=image/resize,m_fixed,w_100,h_100" -->
 <template>
-  <BasicModal v-bind="$attrs" @register="register" title="新 增" @ok="handleOk">
+  <BasicModal v-bind="$attrs" @register="register" title="编  辑" @ok="handleOk">
     <div class="pt-3px pr-3px">
       <BasicForm @register="registerForm" />
     </div>
@@ -114,6 +114,7 @@ wapBannerUrl: "https://4dkk.4dage.com/shop/huafa/20220302/23135195983e96.png?x-o
     {
       field: 'wapBannerUrl',
       component: 'Upload',
+      show: false,
       label: '手机banner',
       rules: [{ required: true, message: '请选择上传文件' }],
       itemProps: {
@@ -122,6 +123,7 @@ wapBannerUrl: "https://4dkk.4dage.com/shop/huafa/20220302/23135195983e96.png?x-o
       componentProps: {
         api: uploadBannerApi,
         maxNumber: 1,
+        maxSize: 5,
         afterFetch: function (data) {
           Reflect.set(data, 'url', data.message.url);
           return data;

+ 46 - 28
src/views/setting/BaseSetting.vue

@@ -1,10 +1,13 @@
 <template>
   <CollapseContainer title="基本设置" :canExpan="false">
     <a-row :gutter="24">
-      <a-col :span="14">
+      <a-col :span="10">
         <BasicForm @register="register" />
+        <div class="px-5 py-15 flex justify-center">
+          <Button type="primary" @click="handleSubmit"> 修改密码 </Button>
+        </div>
       </a-col>
-      <a-col :span="10">
+      <!-- <a-col :span="10">
         <div class="change-avatar">
           <div class="mb-2">头像</div>
           <CropperAvatar
@@ -16,26 +19,27 @@
             width="150"
           />
         </div>
-      </a-col>
+      </a-col> -->
     </a-row>
-    <Button type="primary" @click="handleSubmit"> 更新基本信息 </Button>
   </CollapseContainer>
 </template>
 <script lang="ts">
   import { Button, Row, Col } from 'ant-design-vue';
-  import { computed, defineComponent, onMounted } from 'vue';
+  import { defineComponent, onMounted } from 'vue';
   import { BasicForm, useForm } from '/@/components/Form/index';
   import { CollapseContainer } from '/@/components/Container';
-  import { CropperAvatar } from '/@/components/Cropper';
+  // import { CropperAvatar } from '/@/components/Cropper';
 
   import { useMessage } from '/@/hooks/web/useMessage';
-
-  import headerImg from '/@/assets/images/header.jpg';
-  import { accountInfoApi } from '/@/api/account/index';
+  // import headerImg from '/@/assets/images/header.jpg';
+  // import { accountInfoApi } from '/@/api/account/index';
   import { baseSetschemas } from './data';
   import { useUserStore } from '/@/store/modules/user';
-  import { uploadApi } from '/@/api/sys/upload';
+  import { updatePasswordApi } from '/@/api/sys/user';
+  import { encodeStr } from '/@/utils/encodeUtil';
 
+  import { useI18n } from '/@/hooks/web/useI18n';
+  const { t } = useI18n();
   export default defineComponent({
     components: {
       BasicForm,
@@ -43,42 +47,56 @@
       Button,
       ARow: Row,
       ACol: Col,
-      CropperAvatar,
+      // CropperAvatar,
     },
     setup() {
       const { createMessage } = useMessage();
       const userStore = useUserStore();
 
-      const [register, { setFieldsValue }] = useForm({
+      const [register, { validate }] = useForm({
         labelWidth: 120,
         schemas: baseSetschemas,
         showActionButtonGroup: false,
       });
 
       onMounted(async () => {
-        const data = await accountInfoApi();
-        setFieldsValue(data);
+        // const data = await accountInfoApi();
+        // setFieldsValue(data);
       });
 
-      const avatar = computed(() => {
-        const { avatar } = userStore.getUserInfo;
-        return avatar || headerImg;
-      });
+      // const avatar = computed(() => {
+      //   const { avatar } = userStore.getUserInfo;
+      //   return avatar || headerImg;
+      // });
 
-      function updateAvatar(src: string) {
-        const userinfo = userStore.getUserInfo;
-        userinfo.avatar = src;
-        userStore.setUserInfo(userinfo);
+      // function updateAvatar(src: string) {
+      //   const userinfo = userStore.getUserInfo;
+      //   userinfo.avatar = src;
+      //   userStore.setUserInfo(userinfo);
+      // }
+      async function handleSubmit() {
+        try {
+          const values = await validate();
+          const userInfo = userStore.getUserInfo;
+          console.log('userInfo', values, userInfo);
+          const res = await updatePasswordApi({
+            id: userInfo.id,
+            password: encodeStr(window.btoa(values.password)),
+            newPassword: encodeStr(window.btoa(values.newPassword)),
+          });
+          console.log('res', res);
+          createMessage.success(t('common.optSuccess'));
+          userStore.logout(true);
+        } catch (error) {}
       }
 
       return {
-        avatar,
+        // avatar,
         register,
-        uploadApi: uploadApi as any,
-        updateAvatar,
-        handleSubmit: () => {
-          createMessage.success('更新成功!');
-        },
+        // uploadApi: uploadApi as any,
+        // updateAvatar,
+        handleSubmit,
+        t,
       };
     },
   });

+ 60 - 44
src/views/setting/data.ts

@@ -16,55 +16,71 @@ export const settingList = [
     name: '基本设置',
     component: 'BaseSetting',
   },
-  {
-    key: '2',
-    name: '安全设置',
-    component: 'SecureSetting',
-  },
-  {
-    key: '3',
-    name: '账号绑定',
-    component: 'AccountBind',
-  },
-  {
-    key: '4',
-    name: '新消息通知',
-    component: 'MsgNotify',
-  },
+  // {
+  //   key: '2',
+  //   name: '安全设置',
+  //   component: 'SecureSetting',
+  // },
+  // {
+  //   key: '3',
+  //   name: '账号绑定',
+  //   component: 'AccountBind',
+  // },
+  // {
+  //   key: '4',
+  //   name: '新消息通知',
+  //   component: 'MsgNotify',
+  // },
 ];
 
 // 基础设置 form
 export const baseSetschemas: FormSchema[] = [
   {
-    field: 'email',
-    component: 'Input',
-    label: '邮箱',
-    colProps: { span: 18 },
-  },
-  {
-    field: 'name',
-    component: 'Input',
-    label: '昵称',
-    colProps: { span: 18 },
-  },
-  {
-    field: 'introduction',
-    component: 'InputTextArea',
-    label: '个人简介',
-    colProps: { span: 18 },
-  },
-  {
-    field: 'phone',
-    component: 'Input',
-    label: '联系电话',
-    colProps: { span: 18 },
-  },
-  {
-    field: 'address',
-    component: 'Input',
-    label: '所在地区',
-    colProps: { span: 18 },
-  },
+    field: 'password',
+    component: 'StrengthMeter',
+    label: '旧密码',
+    labelWidth: 60,
+    required: true,
+    // colProps: { span: 18 },
+  },
+  {
+    field: 'newPassword',
+    component: 'StrengthMeter',
+    label: '新密码',
+    labelWidth: 60,
+    required: true,
+    // colProps: { span: 18 },
+  },
+  // {
+  //   field: 'email',
+  //   component: 'Input',
+  //   label: '邮箱',
+  //   colProps: { span: 18 },
+  // },
+  // {
+  //   field: 'name',
+  //   component: 'Input',
+  //   label: '昵称',
+  //   colProps: { span: 18 },
+  // },
+  // {
+  //   field: 'introduction',
+  //   component: 'InputTextArea',
+  //   label: '个人简介',
+  //   colProps: { span: 18 },
+  // },
+  // {
+  //   field: 'phone',
+  //   component: 'Input',
+  //   label: '联系电话',
+  //   colProps: { span: 18 },
+  // },
+  // {
+  //   field: 'address',
+  //   component: 'Input',
+  //   label: '所在地区',
+  //   colProps: { span: 18 },
+  // },
 ];
 
 // 安全设置 list

+ 7 - 7
src/views/staff/list.vue

@@ -103,13 +103,13 @@
           sorter: true,
           width: 80,
         },
-        {
-          title: t('common.state'),
-          dataIndex: 'status',
-          slots: { customRender: 'status' },
-          // sorter: true,
-          width: 80,
-        },
+        // {
+        //   title: t('common.state'),
+        //   dataIndex: 'status',
+        //   slots: { customRender: 'status' },
+        //   // sorter: true,
+        //   width: 80,
+        // },
 
         {
           title: t('routes.staff.createTime'),

+ 19 - 3
src/views/sys/login/useLogin.ts

@@ -42,14 +42,27 @@ export function useFormRules(formData?: Recordable) {
   const { t } = useI18n();
 
   const getAccountFormRule = computed(() => createRule(t('sys.login.accountPlaceholder')));
-  const getPasswordFormRule = computed(() => createRule(t('sys.login.passwordPlaceholder')));
+  const getPasswordFormRule = computed(() => {
+    return [
+      ...createRule(t('sys.login.passwordPlaceholder')),
+      { validator: validatePassword(), trigger: 'change' },
+    ];
+  });
   const getSmsFormRule = computed(() => createRule(t('sys.login.smsPlaceholder')));
   const getMobileFormRule = computed(() => createRule(t('sys.login.mobilePlaceholder')));
 
   const validatePolicy = async (_: RuleObject, value: boolean) => {
     return !value ? Promise.reject(t('sys.login.policyPlaceholder')) : Promise.resolve();
   };
-
+  const validatePassword = () => {
+    return async (_: RuleObject, value: string) => {
+      const reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
+      if (reg.test(value)) {
+        return Promise.reject(t('sys.login.passwordFormat'));
+      }
+      return Promise.resolve();
+    };
+  };
   const validateConfirmPassword = (password: string) => {
     return async (_: RuleObject, value: string) => {
       if (!value) {
@@ -77,7 +90,10 @@ export function useFormRules(formData?: Recordable) {
       case LoginStateEnum.REGISTER:
         return {
           account: accountFormRule,
-          password: passwordFormRule,
+          password: [
+            ...passwordFormRule,
+            { validator: validatePassword(formData?.password), trigger: 'change' },
+          ],
           confirmPassword: [
             { validator: validateConfirmPassword(formData?.password), trigger: 'change' },
           ],

+ 7 - 7
src/views/system/role/index.vue

@@ -53,13 +53,13 @@
         showTableSetting: true,
         bordered: true,
         showIndexColumn: false,
-        // actionColumn: {
-        //   width: 80,
-        //   title: '操作',
-        //   dataIndex: 'action',
-        //   slots: { customRender: 'action' },
-        //   fixed: undefined,
-        // },
+        actionColumn: {
+          width: 80,
+          title: '操作',
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+          fixed: undefined,
+        },
       });
 
       function handleCreate() {

+ 1 - 1
src/views/system/role/role.data.ts

@@ -110,7 +110,7 @@ export const formSchema: FormSchema[] = [
     field: 'companyId',
     label: '公司',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     itemProps: {
       validateTrigger: 'blur',
     },