Browse Source

fix:一轮测试修复

liyangbin 11 months ago
parent
commit
70f11a16c1
6 changed files with 100 additions and 62 deletions
  1. 1 1
      src/components/asideInfo.vue
  2. 40 23
      src/views/Create.vue
  3. 48 34
      src/views/FreeSign.vue
  4. 3 2
      src/views/Login.vue
  5. 7 1
      src/views/ProductManagement.vue
  6. 1 1
      vite.config.js

+ 1 - 1
src/components/asideInfo.vue

@@ -14,7 +14,7 @@ export default {
 </script>
 
 <template>
-  <div class="w-480px pt-28px pb-141px bg-[#F5FAFF] aside-bg" :class="{ 'IS-PB80': isPB80 }">
+  <div class="w-480px pt-28px pb-141px bg-[#F5FAFF] aside-bg rounded-l-16px" :class="{ 'IS-PB80': isPB80 }">
     <img src="@/assets/images/PDF_logo.png" alt="logo" class="w-251px px-28px">
     <slot name="title">
       <div class="mt-74px font-500 text-24px leading-36px px-80px text-[#101828]">Welcome to <br /> PDF Tech Admin

+ 40 - 23
src/views/Create.vue

@@ -68,7 +68,7 @@ export default {
         ],
         passwordConfirm: [
           // { required: true, validator: validatePass2, trigger: 'change' },
-          { min: 6, max: 24, message: 'Password must between 6-24 characters', trigger: ['blur'] }
+          // { min: 6, max: 24, message: 'Password must between 6-24 characters', trigger: ['blur'] }
         ],
       },
       errorSureMsg: ''
@@ -88,9 +88,7 @@ export default {
   methods: {
     createAccount() {
       this.verificationCodeError = false
-      //这里是个大坑,产品原来大部分校验是让后端做,所以返回信息只能一条一条展示
-      //后面改需求,要前端展示报错,现在只能疯狂加if
-      //前端校验勾选协议,邮件格式,密码位数,确认密码,必填信息
+      //自定义验证规则不生效
       this.$refs['ruleForm'].validate((valid) => {
         if (!this.checked) {
           this.checkBox = true
@@ -174,7 +172,7 @@ export default {
                   message: 'Create Successfully',
                   type: 'success'
                 })
-                this.$router.push('/login')
+                this.$router.push('/login?freeEmail=' + this.ruleForm.email)
               }
             })
           }
@@ -200,18 +198,8 @@ export default {
           type: "error"
         })
       } else {
-        let timerId = setInterval(() => {
-          this.CountDown--
-          this.isDisabled = true
-          this.buttonName = this.CountDown + 's'
-          if (this.CountDown <= 0) {
-            clearInterval(timerId)
-            this.buttonName = 'send'
-            this.CountDown = 60
-            this.isDisabled = false
-          }
-        }, 1000)
         if (!this.isDisabled) {
+          this.isDisabled = true
           //发送邮件
           get(
             '/pdf-tech/auth/getVerifyCode?action=0&type=0&receiver=' +
@@ -222,6 +210,29 @@ export default {
                 message: 'Email sent successfully',
                 type: "success"
               })
+              let timerId = setInterval(() => {
+                this.CountDown--
+                this.isDisabled = true
+                this.buttonName = this.CountDown + 's'
+                if (this.CountDown <= 0) {
+                  clearInterval(timerId)
+                  this.buttonName = 'send'
+                  this.CountDown = 60
+                  this.isDisabled = false
+                }
+              }, 1000)
+            } else if (
+              res.data.code === 700 &&
+              res.data.msg === 'Email has been created'
+            ) {
+              this.EmailCodeError = true
+              this.isDisabled = false
+              this.$message.error({
+                duration: 5000,
+                message: 'Account already exist, log in or change email?'
+              })
+            } else {
+              this.isDisabled = false
             }
           })
         }
@@ -238,9 +249,13 @@ export default {
       }
     },
     clear(val) {
-      this.$refs["ruleForm"].clearValidate([val])
-      if (val === 'verificationCode') {
-        this.verificationCodeError = false
+      if (val !== 'passwordConfirm') {
+        this.$refs["ruleForm"].clearValidate([val])
+        if (val === 'verificationCode') {
+          this.verificationCodeError = false
+        }
+      } else {
+        this.errorSureMsg = ""
       }
     },
   }
@@ -264,7 +279,7 @@ export default {
     </div>
     <div class="flex w-1184px py-40px">
       <AsideInfo />
-      <div class="w-704px bg-[#fff] flex justify-center">
+      <div class="w-704px bg-[#fff] flex justify-center rounded-r-16px">
         <div class="w-592px h-auto m-auto rounded-8px p-24px bg-[#fff] loginBox">
           <h1 class="text-24px font-bold mt-24px mb-8px">Sign up</h1>
           <div class="text-16px leading-24px text-[#404653] pb-8px border-b-1px border-[#E2E3E5]">
@@ -281,7 +296,7 @@ export default {
               <div class="flex items-center relative">
                 <el-input v-model.trim="ruleForm.email" placeholder="Please enter email address." @focus="clear('email')">
                 </el-input>
-                <button type="button" :class="isDisabled ? 'bgColor' : ''" :disabled=isDisabled @click="sendEmail()"
+                <button type="button" :class="isDisabled || ruleForm.email === '' ? 'bgColor' : ''" :disabled=isDisabled @click="sendEmail()"
                   class="absolute top-0.5px right-0px w-80px h-39px bg-[#0773ED] text-center rounded-tr-4px rounded-br-4px font-500 text-[16px] text-[#fff] leading-32px hover:bg-[#3091FF] cursor-pointer">
                   {{ buttonName }}
                 </button>
@@ -371,7 +386,8 @@ export default {
           </div>
           <div class="flex items-start mt-8px">
             <input type="checkbox" v-model="checked" name="type" />
-            <span class="ml-8px text-12px leading-14px" :class="checkBox ? 'text-[#FF5054]' : 'text-[#101828]'">Read and Agree to
+            <span class="ml-8px text-12px leading-14px" :class="checkBox ? 'text-[#FF5054]' : 'text-[#101828]'">Read and
+              Agree to
               <a href="https://www.pdfreaderpro.com/privacy-policy" target="_blank" class="text-[#0773ED]">PRIVACY
                 POLICY </a>
               and
@@ -390,7 +406,7 @@ export default {
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="changeEmail">Change Email</el-button>
-        <el-button type="primary" @click="$router.push('/login')">Sign in</el-button>
+        <el-button type="primary" @click="$router.push(`/login?freeEmail=${ruleForm.email}`)">Sign in</el-button>
       </span>
     </el-dialog>
   </div>
@@ -400,6 +416,7 @@ export default {
 .bgColor {
   background-color: rgba(20, 96, 243, 0.2);
   border: none;
+  cursor: not-allowed;
 }
 
 .bg {

+ 48 - 34
src/views/FreeSign.vue

@@ -52,30 +52,30 @@ export default {
       },
       rules: {
         email: [
-          { required: true, message: 'Please enter email address.', trigger: ['change'] },
+          { required: true, message: 'Please enter email address.', trigger: ['blur'] },
           { type: 'email', message: 'Please enter a valid Email Address', trigger: [''] }
         ],
         verificationCode: [
-          { required: true, message: 'Please enter the verification code.', trigger: ['change'] }
+          { required: true, message: 'Please enter the verification code.', trigger: ['blur'] }
         ],
         industry: [
-          { required: true, message: 'Please select industry.', trigger: 'change' }
+          { required: true, message: 'Please select industry.', trigger: 'blur' }
         ],
         organization: [
-          { required: true, message: 'Please enter organization name.', trigger: ['change'] }
+          { required: true, message: 'Please enter organization name.', trigger: ['blur'] }
         ],
         job: [
-          { required: true, message: 'Please enter job title.', trigger: ['change'] }
+          { required: true, message: 'Please enter job title.', trigger: ['blur'] }
         ],
         name: [
-          { required: true, message: 'Please enter user name.', trigger: ['change'] }
+          { required: true, message: 'Please enter user name.', trigger: ['blur'] }
         ],
         password: [
-          { required: true, validator: validatePass, trigger: 'change' },
+          { required: true, validator: validatePass, trigger: 'blur' },
           { min: 6, max: 24, message: 'Password must between 6-24 characters', trigger: ['blur'] }
         ],
         passwordConfirm: [
-          { required: true, validator: validatePass2, trigger: 'change' },
+          { required: true, validator: validatePass2, trigger: 'blur' },
           { min: 6, max: 24, message: 'Password must between 6-24 characters', trigger: ['blur'] }
         ],
         platform: [
@@ -158,6 +158,15 @@ export default {
                 duration: 5000,
                 message: 'Invited users only'
               })
+            } else if (
+              res.data.code === 700 &&
+              res.data.msg === 'Organization has been created'
+            ) {
+              this.ruleForm.organization = ''
+              this.$message.error({
+                duration: 5000,
+                message: 'Organization has been created'
+              })
             } else if (
               res.data.code === 700 &&
               res.data.msg === 'Password must between 6-24 characters'
@@ -197,18 +206,8 @@ export default {
     sendEmail() {
       const regEmail = /^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,4})$/
       if (regEmail.test(this.ruleForm.email) && this.ruleForm.email !== '') {
-        let timerId = setInterval(() => {
-          this.CountDown--
-          this.isDisabled = true
-          this.buttonName = this.CountDown + 's'
-          if (this.CountDown <= 0) {
-            clearInterval(timerId)
-            this.buttonName = 'send'
-            this.CountDown = 60
-            this.isDisabled = false
-          }
-        }, 1000)
         if (!this.isDisabled) {
+          this.isDisabled = true
           //发送邮件
           get(
             '/pdf-tech/auth/getVerifyCode?action=0&type=0&receiver=' +
@@ -219,17 +218,34 @@ export default {
                 message: 'Email sent successfully',
                 type: "success"
               })
+              let timerId = setInterval(() => {
+                this.CountDown--
+                this.isDisabled = true
+                this.buttonName = this.CountDown + 's'
+                if (this.CountDown <= 0) {
+                  clearInterval(timerId)
+                  this.buttonName = 'send'
+                  this.CountDown = 60
+                  this.isDisabled = false
+                }
+              }, 1000)
+            } else if (
+              res.data.code === 700 &&
+              res.data.msg === 'Email has been created'
+            ) {
+              this.dialogVisible = true
+              this.isDisabled = false
+            } else {
+              this.isDisabled = false
             }
           })
         }
-      } else {
+      } else if (!regEmail.test(this.ruleForm.email)) {
         this.$refs.ruleForm.validateField('email')
       }
     },
     changeDialogVisible() {
-      this.dialogVisible = False
-      this.ruleForm.email = ''
-      this.ruleForm.verificationCode = ''
+      this.dialogVisible = false
     }
   }
 }
@@ -253,7 +269,7 @@ export default {
           </div>
         </template>
       </AsideInfo>
-      <div class="w-704px bg-[#fff] flex justify-center">
+      <div class="w-704px bg-[#fff] flex justify-center rounded-r-16px">
         <div class="w-592px h-auto m-auto rounded-8px p-24px bg-[#fff] loginBox">
           <h1 class="text-24px font-500 mb-8px leading-36px">Sign up</h1>
           <div class="text-16px leading-24px text-[#404653] pb-8px border-b-1px border-[#E2E3E5]">
@@ -269,7 +285,7 @@ export default {
                   placeholder="Please enter email address."></el-input>
                 <div
                   class="absolute top-0.5px right-1px w-80px h-31px bg-[#0773ED] text-center rounded-tr-4px rounded-br-4px font-500 text-[16px] text-[#fff] leading-32px hover:bg-[#3091FF] cursor-pointer"
-                  :class="isDisabled ? 'bgColor' : ''" @click="sendEmail">{{ buttonName }}</div>
+                  :class="isDisabled || ruleForm.email === '' ? 'bgColor' : ''" @click="sendEmail">{{ buttonName }}</div>
               </el-form-item>
               <el-form-item label="Verification Code" prop="verificationCode">
                 <el-input v-model="ruleForm.verificationCode"
@@ -320,8 +336,8 @@ export default {
               </el-form-item>
               <el-form-item label="Password Comfirm" prop="passwordConfirm" class="mt-4px">
                 <div class="flex items-center">
-                  <el-input v-model.trim="ruleForm.passwordConfirm" autocomplete="off" placeholder="Please confirm password."
-                    :type="passwordConfirmType ? '' : 'password'">
+                  <el-input v-model.trim="ruleForm.passwordConfirm" autocomplete="off"
+                    placeholder="Please confirm password." :type="passwordConfirmType ? '' : 'password'">
                   </el-input>
                   <span v-show="ruleForm.passwordConfirm !== ''" class="show-password"
                     @click="passwordConfirmType = !passwordConfirmType">
@@ -345,7 +361,7 @@ export default {
                 class="rounded-4px leading-38px w-[48%] border border-[#3091FF] text-center font-500 text-16px text-[#065CBC] hover:opacity-80 cursor-pointer hover:(bg-[#F5FAFF] text-[#065CBC] border-[#3091FF])">Log
                 in</a>
             </div>
-            <div class="flex justify-between items-start ml-200px mt-8px">
+            <div class="flex items-center ml-200px mt-8px">
               <input type="checkbox" v-model="checked" name="type" />
               <span class="ml-8px text-12px leading-16px" :class="checkBox ? 'text-[#FF5054]' : ''">Read and Agree to
                 <a href="https://www.pdfreaderpro.com/privacy-policy" target="_blank" class="text-[#0773ED]">PRIVACY
@@ -366,13 +382,11 @@ export default {
       </div>
       <Email />
       <p class="mt-16px font-500 text-16px leading-24px text-[#101828]">
-        Email has been created
-        <br>
-        sign in now or change your email?
+        Account already exists, please change the account or login directly.
       </p>
       <span slot="footer" class="dialog-footer">
         <div class="flex justify-between">
-          <a href="/login"
+          <a :href="`/login?freeEmail=${ruleForm.email}`"
             class="rounded-4px bg-[#0773ED] leading-40px w-[48%] text-center font-500 text-16px text-[#fff] hover:bg-[#3091FF] cursor-pointer">
             Sign in
           </a>
@@ -395,8 +409,8 @@ export default {
 .show-password {
   display: inline-block;
   position: absolute;
-  right: 23px;
-  top: 13px;
+  right: 15px;
+  top: 10px;
   width: 14px;
   height: 14px;
   cursor: pointer;

+ 3 - 2
src/views/Login.vue

@@ -188,7 +188,7 @@ export default {
   <div class="bg w-full min-h-100vh flex justify-center items-center m-auto">
     <div class="flex w-1184px py-40px">
       <AsideInfo />
-      <div class="w-704px bg-[#fff] flex justify-center">
+      <div class="w-704px bg-[#fff] flex justify-center rounded-r-16px">
         <div class="w-592px h-auto m-auto rounded-8px p-24px bg-[#fff]">
           <h1 class="text-24px font-500 mb-8px">Log in</h1>
           <div class="text-16px leading-24px text-[#404653] pb-8px border-b-1px border-[#E2E3E5]">
@@ -202,7 +202,7 @@ export default {
               <div class="mt-24px text-[#404653] text-16px leading-24px mb-8px">Email</div>
               <div class="flex items-center">
                 <el-input v-model.trim="ruleForm.email" @input="isdisable()" placeholder="Please enter email address." />
-                <Error class="w-14px h-14px block" :class="emailError ? 'block' : 'hidden'" />
+                <Error class="w-14px h-14px block absolute right-13px bottom-15px" :class="emailError ? 'block' : 'hidden'" />
               </div>
             </el-form-item>
             <el-form-item prop="password">
@@ -266,6 +266,7 @@ export default {
     font-size: 12px;
     line-height: 16px;
     color: #3686FF;
+    font-weight: 400;
   }
 }
 

+ 7 - 1
src/views/ProductManagement.vue

@@ -19,6 +19,7 @@ const productId = ref('')
 const url = ref('')
 const role = userStore().user.role
 const ProURL = ref('')
+const memberRole = ref('')
 
 onMounted(() => {
   let pageText = document.getElementsByClassName('el-pagination__jump')[0]
@@ -33,6 +34,7 @@ onMounted(() => {
   ProURL.value = baseurl
   pagingQuery()
   getproductList()
+  memberRole.value = userStore().user.role
 })
 //筛选
 const searchInfo = () => {
@@ -61,6 +63,10 @@ const pagingQuery = () => {
       } else if (tableData.value[i].payment === 1 || tableData.value[i].payment === 2) {
         tableData.value[i].price = '¥' + tableData.value[i].price
       }
+      // 如果订单是未支付状态不显示价格,
+      if (tableData.value[i].detailType !== 2) {
+        tableData.value[i].price = ''
+      }
     }
     total.value = res.data.result.total
   })
@@ -134,7 +140,7 @@ const handleCurrentChange = (value) => {
         <el-table-column prop="expirationAt" label="Expiration Date" min-width="110"></el-table-column>
         <el-table-column prop="detailType" label="Actions">
           <template slot-scope="scope">
-            <div v-if="scope.row.detailType === 1">
+            <div v-if="scope.row.detailType !== 2 && memberRole?.indexOf('1') !== -1">
               <a :href="`${ProURL}/store/purchase-pdftech-editor/${scope.row.id}`" target="_blank" class="w-68px inline-block text-center h-20px mt-8px rounded-4px border-1px border-[#1460F3] text-[#1460F3] leading-18px hover:bg-[#1460F333]">
                 Purchase
               </a>

+ 1 - 1
vite.config.js

@@ -35,7 +35,7 @@ export default defineConfig({
     // 是否开启 https
     https: false,
     // 端口号
-    port: 3001,
+    port: 3000,
     // 监听所有地址
     host: "0.0.0.0",
     // 服务启动时是否自动打开浏览器