hbchen před 2 roky
rodič
revize
f0ed2d578d

+ 10 - 0
src/api/auth.js

@@ -52,6 +52,16 @@ export const bindMobile=params=>{
     return post('/auth/bindMobile',params)
 }
 
+/**
+ * 换绑手机号
+ * @param params.OldMobile 原手机号  
+ * @param params.Mobile 手机号  
+ * @param params.SmsCode 验证码  
+ */
+export const modifyMobile=params=>{
+    return post('/auth/modifyMobile',params)
+}
+
 /**
  * 修改密码
  * @param params.OldPwd 旧密码 MD5加密后  

+ 69 - 3
src/api/http.js

@@ -1,6 +1,6 @@
 "use strict";
 import axios from "axios";
-import { ElMessage } from 'element-plus'
+import {ElMessage,ElMessageBox} from 'element-plus'
 import CryptoJS from './crypto'
 import router from '@/router/index'
 
@@ -11,6 +11,28 @@ let config = {
 
 const _axios = axios.create(config);
 
+const isPhone=()=>{
+  return !(window.innerWidth>768)
+}
+const copyEmail=()=>{
+  if (navigator.clipboard && window.isSecureContext) {
+    // navigator clipboard 向剪贴板写文本
+    navigator.clipboard.writeText('stephanie@hzinsights.com').then(() => {
+      ElMessage.success('Email address copied')
+    });
+  }else{
+    const input = document.createElement('input');
+    input.setAttribute('readonly', 'readonly');
+    input.setAttribute('value', 'stephanie@hzinsights.com');
+    document.body.appendChild(input);
+    input.setSelectionRange(0, input.value.length);
+    input.select();
+    document.execCommand('copy');
+    document.body.removeChild(input);
+    ElMessage.success('Email address copied')
+  }
+}
+
 _axios.interceptors.request.use(
   function (config) {
     config.headers.shareEmailId=sessionStorage.getItem('shareId')||0
@@ -33,9 +55,9 @@ _axios.interceptors.response.use(
       data=response.data
     }
 
-    if(data.code === 400) {
+    if(data.code === 400 || data.code === 500) {
       ElMessage.error(data.msg)
-    }if(data.code==401){
+    }else if(data.code==401){
       // 非法访问
       ElMessage({
         type:'error',
@@ -47,6 +69,50 @@ _axios.interceptors.response.use(
         localStorage.removeItem('yben_token')
         router.replace('/login')
       },1000)
+    }else if(data.code==4013){
+      // 未注册
+      ElMessageBox.confirm("This email adress is not registered. Please try again.","Prompt",
+      {
+        customClass:isPhone()?'mobile-message-confirm':'PC-message-confirm',
+        confirmButtonClass:isPhone()?'mobile-confirm-button':'',
+        confirmButtonText: 'Create account',
+        showCancelButton:false,
+      }).then(res=>{
+        router.push('/register')
+      }).catch(()=>{})
+    }else if(data.code==4014){
+      // 未绑定
+      ElMessageBox.confirm("This phone number is not registered. Please try again.","Prompt",
+      {
+        customClass:isPhone()?'mobile-message-confirm':'PC-message-confirm',
+        confirmButtonClass:isPhone()?'mobile-confirm-button':'',
+        confirmButtonText: 'Got it',
+        showCancelButton:false,
+      }).then(res=>{
+        console.log('This phone number is not registered. Please try again.');
+      }).catch(()=>{})
+    }else if(data.code==4012){
+      // 权限到期
+      ElMessageBox.confirm("Your trial has ended Enjoyed your experience with us? Contact us at stephanie@hzinsights.com to extend your trial.","Prompt",
+      {
+        customClass:isPhone()?'mobile-message-confirm':'PC-message-confirm',
+        confirmButtonClass:isPhone()?'mobile-confirm-button':'',
+        confirmButtonText: 'Get the contact email',
+        showCancelButton:false,
+      }).then(res=>{
+        copyEmail()
+      }).catch(()=>{})
+    }else if(data.code==4015){
+      // 已注册
+      ElMessageBox.confirm("There is already a user account associated with this email address. Please log in instead.","Prompt",
+      {
+        customClass:isPhone()?'mobile-message-confirm':'PC-message-confirm',
+        confirmButtonClass:isPhone()?'mobile-confirm-button':'',
+        confirmButtonText: 'Log in',
+        showCancelButton:false,
+      }).then(res=>{
+        router.push('/login')
+      }).catch(()=>{})
     }
     return data;
   },

binární
src/assets/icons/yb-cn.png


+ 74 - 44
src/views/report/Detail.vue

@@ -6,6 +6,9 @@ import {apiReportDetail,apiReportClassifyList} from '@/api/report'
 const route=useRoute()
 const router=useRouter()
 
+const userInfo=localStorage.getItem('user_info')?JSON.parse(localStorage.getItem('user_info')):{}
+
+
 //分类
 let reportClassify=ref([])
 async function getReportClassify(){
@@ -115,6 +118,11 @@ onMounted(()=>{
     wwidth.value=window.innerWidth
 })
 
+const goYBPCCN=()=>{
+    let href = import.meta.env.VITE_CN_YB_PC
+    window.open(href,'_blank');
+}
+
 const userInfoGo=()=>{
     let {href} = router.resolve("/my");
     window.open(href,'_blank');
@@ -138,41 +146,44 @@ const passwordChange=()=>{
 <template>
     <div class="report-detail-page" v-if="info">
         <div class="header-wrap">
-            <div>
+            <div class="navigation-row">
                 <span style="color:#00459F;margin-right:30px;">MORE CONTENT>></span>
                 <span v-for="item in reportClassify" :key="item.id" style="margin-right:20px;cursor: pointer;" @click="goIndex(item)">{{item.classify_name}}</span>
             </div>
             <!-- <div style="color:#00459F;cursor: pointer;" @click="$router.replace('/')">ABOUT US</div> -->
-            <el-popover
-                popper-class="user-info-popper"
-                placement="top-start"
-                trigger="click">
-                <template #reference>
-                    <div class="user-info-hover">
-                        <img src="@/assets/icons/avatar.svg" />
-                        <span>xxxxx</span>
+            <div class="header-right">
+                <img @click="goYBPCCN" class="ybCN-jump" src="@/assets/icons/yb-cn.png" />
+                <el-popover
+                    popper-class="user-info-popper"
+                    placement="top-start"
+                    trigger="click">
+                    <template #reference>
+                        <div class="user-info-hover">
+                            <img src="@/assets/icons/avatar.svg" />
+                            <span>{{userInfo.Name}}</span>
+                        </div>
+                    </template>
+                    <div class="user-info-message">
+                        <div class="user-info-item">User Name:<span><span>{{userInfo.Name}}</span></span></div>
+                        <div class="user-info-item">Email Address:<span>{{userInfo.Email}}</span></div>
+                        <div class="user-info-item">Mobile Phone No:
+                            <!-- <span style="display: inline-flex;align-items: center;" v-if="userInfo.Mobile" @click="bindPhone">
+                                <span>{{ userInfo.CountryCode+' '+userInfo.Mobile }}</span>
+                                <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" />
+                            </span> -->
+                            <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
+                            @click="bindPhone">
+                                <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
+                                <span>Add a phone number to your account</span>
+                            </span>
+                        </div>
+                        <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
+                            <el-button type="primary" @click="loginOut" size="large" style="min-width: 100px;background-color:#1856A7 ;">Sign out</el-button>
+                            <el-button plain @click="passwordChange" size="large" style="min-width: 100px;padding: 12px;">Update password</el-button>
+                        </div>
                     </div>
-                </template>
-                <div class="user-info-message">
-                    <div class="user-info-item">用户姓名:<span>xxxxx</span></div>
-                    <div class="user-info-item">邮箱:<span>1605177521@qq.com</span></div>
-                    <div class="user-info-item">手机号:
-                        <span style="display: inline-flex;align-items: center;">
-                            <span>+86 13588818597</span>
-                            <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" @click="bindPhone" />
-                        </span>
-                        <!-- <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
-                        @click="bindPhone">
-                            <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
-                            <span>绑定手机号</span>
-                        </span> -->
-                    </div>
-                    <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
-                        <el-button type="primary" @click="loginOut" size="large" style="width: 100px;background-color:#1856A7 ;">退出账号</el-button>
-                        <el-button plain @click="passwordChange" size="large" style="width: 100px;">修改密码</el-button>
-                    </div>
-                </div>
-            </el-popover>
+                </el-popover>
+            </div>
         </div>
         <div class="mobile-header-wrap">
             <img class="menu-icon" @click="showFilter=true;filterSize='100%'" src="@/assets/menu.svg" alt="">
@@ -235,7 +246,7 @@ const passwordChange=()=>{
     }
 }
 .user-info-popper{
-    min-width: 300px!important;
+    width: unset!important;
     .user-info-message{
         padding: 28px;
         .user-info-item{
@@ -275,28 +286,47 @@ const passwordChange=()=>{
     font-size: 20px;
     z-index: 99;
     background-color: #fff;
-    .user-info-hover{
+    .header-right{
         display: flex;
         align-items: center;
         position: absolute;
         top: 50%;
         transform: translateY(-50%);
         right: 17px;
+        z-index: 30;
         cursor: pointer;
-        img{
+        .ybCN-jump{
             height: 30px;
-            width: 30px;
-            margin-right: 10px;
+            cursor: pointer;
+            margin-right: 20px;
+        }
+        .user-info-hover{
+            display: flex;
+            align-items: center;
+            img{
+                height: 30px;
+                width: 30px;
+                margin-right: 10px;
+            }
+            span{
+                font-weight: 500;
+                font-size: 16px;
+                line-height: 18px;
+                color: #666666;
+                white-space: nowrap;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                max-width: 130px;
+            }
         }
-        span{
-            font-weight: 500;
-            font-size: 16px;
-            line-height: 18px;
-            color: #666666;
-            white-space: nowrap;
-            overflow: hidden;
-            text-overflow: ellipsis;
-            max-width: 130px;
+    }
+}
+@media (max-width: 900px){
+    .header-wrap{
+        .navigation-row{
+            span{
+                font-size: 16px;
+            }
         }
     }
 }

+ 73 - 49
src/views/report/Index.vue

@@ -5,13 +5,14 @@ import {apiReportClassifyList,apiReportList} from '@/api/report'
 import { useWindowSize } from '@vueuse/core'
 import videoPlayBox from '@/components/VideoPlayBox.vue'
 import roadShowList from '@/views/roadShow/List.vue'
-import {SuccessFilled} from '@element-plus/icons-vue'
 
 const { width, height } = useWindowSize()
 
 const router=useRouter()
 const route=useRoute()
 
+const userInfo=localStorage.getItem('user_info')?JSON.parse(localStorage.getItem('user_info')):{}
+
 //分类
 let navList=ref([])
 async function getReportClassify(){
@@ -194,37 +195,40 @@ const passwordChange=()=>{
                 <span style="margin-left:10px">search for</span>
             </div>
             <img src="@/assets/icons/avatar.svg" class="user-info-avatar" @click="userInfoGo" />
-            <el-icon @click="goYBPCCN" class="ybCN-jump"><SuccessFilled /></el-icon>
-            <el-popover
-                popper-class="user-info-popper"
-                placement="top-start"
-                trigger="click">
-                <template #reference>
-                    <div class="user-info-hover">
-                        <img src="@/assets/icons/avatar.svg" />
-                        <span>xxxxx</span>
-                    </div>
-                </template>
-                <div class="user-info-message">
-                    <div class="user-info-item">用户姓名:<span>xxxxx</span></div>
-                    <div class="user-info-item">邮箱:<span>1605177521@qq.com</span></div>
-                    <div class="user-info-item">手机号:
-                        <span style="display: inline-flex;align-items: center;">
-                            <span>+86 13588818597</span>
-                            <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" @click="bindPhone" />
-                        </span>
-                        <!-- <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
-                        @click="bindPhone">
-                            <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
-                            <span>绑定手机号</span>
-                        </span> -->
-                    </div>
-                    <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
-                        <el-button type="primary" @click="loginOut" size="large" style="width: 100px;background-color:#1856A7 ;">退出账号</el-button>
-                        <el-button plain @click="passwordChange" size="large" style="width: 100px;">修改密码</el-button>
+            <div class="header-right">
+                <img @click="goYBPCCN" class="ybCN-jump" src="@/assets/icons/yb-cn.png" />
+                <el-popover
+                    popper-class="user-info-popper"
+                    placement="top-start"
+                    trigger="click">
+                    <template #reference>
+                        <div class="user-info-hover">
+                            <img src="@/assets/icons/avatar.svg" />
+                            <span>{{userInfo.Name}}</span>
+                        </div>
+                    </template>
+                    <div class="user-info-message">
+                        <div class="user-info-item">User Name:<span>{{userInfo.Name}}</span></div>
+                        <div class="user-info-item">Email Address:<span>{{userInfo.Email}}</span></div>
+                        <div class="user-info-item">Mobile Phone No:
+                            <span style="display: inline-flex;align-items: center;" v-if="userInfo.Mobile" @click="bindPhone">
+                                <span>{{ userInfo.CountryCode+' '+userInfo.Mobile }}</span>
+                                <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" />
+                            </span>
+                            <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
+                            @click="bindPhone" v-else>
+                                <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
+                                <span>Add a phone number to your account</span>
+                            </span>
+                        </div>
+                        <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
+                            <el-button type="primary" @click="loginOut" size="large" 
+                            style="min-width: 100px;background-color:#1856A7;">Sign out</el-button>
+                            <el-button plain @click="passwordChange" size="large" style="min-width: 100px;padding: 12px;">Update password</el-button>
+                        </div>
                     </div>
-                </div>
-            </el-popover>
+                </el-popover>
+            </div>
         </div>
         <div class="content-wrap">
         <div class="nav-wrap">
@@ -361,7 +365,8 @@ const passwordChange=()=>{
     }
 }
 .user-info-popper{
-    min-width: 300px!important;
+    // min-width: 300px!important;
+    width: unset!important;
     .user-info-message{
         padding: 28px;
         .user-info-item{
@@ -418,29 +423,40 @@ const passwordChange=()=>{
     .user-info-avatar{
         display: none;
     }
-    .user-info-hover{
+    .header-right{
         display: flex;
         align-items: center;
         position: absolute;
         top: 50%;
         transform: translateY(-50%);
         right: 17px;
+        z-index: 30;
         cursor: pointer;
-        img{
+        .ybCN-jump{
             height: 30px;
-            width: 30px;
-            margin-right: 10px;
+            cursor: pointer;
+            margin-right: 20px;
         }
-        span{
-            font-weight: 500;
-            font-size: 16px;
-            line-height: 18px;
-            color: #666666;
-            white-space: nowrap;
-            overflow: hidden;
-            text-overflow: ellipsis;
-            max-width: 130px;
+        .user-info-hover{
+            display: flex;
+            align-items: center;
+            img{
+                height: 30px;
+                width: 30px;
+                margin-right: 10px;
+            }
+            span{
+                font-weight: 500;
+                font-size: 16px;
+                line-height: 18px;
+                color: #666666;
+                white-space: nowrap;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                max-width: 130px;
+            }
         }
+
     }
     .menu-icon{
         position: absolute;
@@ -450,6 +466,14 @@ const passwordChange=()=>{
         display: none;
     }
 }
+
+@media (max-width: 940px){
+    .header-wrap{
+        font-size: 26px;
+    }
+}
+
+
 @media (max-width: 768px){
     .header-wrap{
         border: none;
@@ -472,10 +496,10 @@ const passwordChange=()=>{
             right: 17px;
             height: 18px;
         }
-        .ybCN-jump{
-            display: none;
-        }
-        .user-info-hover{
+        // .ybCN-jump{
+        //     display: none;
+        // }
+        .header-right{
             display: none;
         }
         .menu-icon{

+ 73 - 44
src/views/roadShow/Detail.vue

@@ -8,6 +8,8 @@ import { useRoute, useRouter } from 'vue-router'
 const route=useRoute()
 const router=useRouter()
 
+const userInfo=localStorage.getItem('user_info')?JSON.parse(localStorage.getItem('user_info')):{}
+
 //分类
 let reportClassify=ref([])
 async function getReportClassify(){
@@ -120,6 +122,11 @@ function handleChangeSecClassify(item,pitem){
 
 }
 
+const goYBPCCN=()=>{
+    let href = import.meta.env.VITE_CN_YB_PC
+    window.open(href,'_blank');
+}
+
 const userInfoGo=()=>{
     let {href} = router.resolve("/my");
     window.open(href,'_blank');
@@ -144,41 +151,44 @@ const passwordChange=()=>{
 <template>
     <div class="roadshow-video-detail-page">
         <div class="header-wrap">
-            <div>
+            <div class="navigation-row">
                 <span style="color:#00459F;margin-right:30px;">MORE CONTENT>></span>
                 <span v-for="item in reportClassify" :key="item.id" style="margin-right:20px;cursor: pointer;" @click="goIndex(item)">{{item.classify_name}}</span>
             </div>
             <!-- <div style="color:#00459F;cursor: pointer;" @click="$router.replace('/')">ABOUT US</div> -->
-            <el-popover
-                popper-class="user-info-popper"
-                placement="top-start"
-                trigger="click">
-                <template #reference>
-                    <div class="user-info-hover">
-                        <img src="@/assets/icons/avatar.svg" />
-                        <span>xxxxx</span>
-                    </div>
-                </template>
-                <div class="user-info-message">
-                    <div class="user-info-item">用户姓名:<span>xxxxx</span></div>
-                    <div class="user-info-item">邮箱:<span>1605177521@qq.com</span></div>
-                    <div class="user-info-item">手机号:
-                        <span style="display: inline-flex;align-items: center;">
-                            <span>+86 13588818597</span>
-                            <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" @click="bindPhone" />
-                        </span>
-                        <!-- <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
-                        @click="bindPhone">
-                            <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
-                            <span>绑定手机号</span>
-                        </span> -->
+            <div class="header-right">
+                <img @click="goYBPCCN" class="ybCN-jump" src="@/assets/icons/yb-cn.png" />
+                <el-popover
+                    popper-class="user-info-popper"
+                    placement="top-start"
+                    trigger="click">
+                    <template #reference>
+                        <div class="user-info-hover">
+                            <img src="@/assets/icons/avatar.svg" />
+                            <span>{{userInfo.Name}}</span>
+                        </div>
+                    </template>
+                    <div class="user-info-message">
+                        <div class="user-info-item">User Name:<span>{{userInfo.Name}}</span></div>
+                        <div class="user-info-item">Email Address:<span>{{userInfo.Email}}</span></div>
+                        <div class="user-info-item">Mobile Phone No:
+                            <span style="display: inline-flex;align-items: center;" v-if="userInfo.Mobile" @click="bindPhone">
+                                <span>{{ userInfo.CountryCode+' '+userInfo.Mobile }}</span>
+                                <img src="@/assets/icons/edit.svg" style="margin-left: 20px;height: 16px;cursor: pointer;" />
+                            </span>
+                            <span style="display: inline-flex;align-items: center;color: #1856A7;cursor: pointer;"
+                            @click="bindPhone" v-else>
+                                <img src="@/assets/icons/add-circle.svg" style="margin-right: 8px;height: 16px;" />
+                                <span>Add a phone number to your account</span>
+                            </span>
+                        </div>
+                        <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
+                            <el-button type="primary" @click="loginOut" size="large" style="width: 100px;background-color:#1856A7 ;">Sign out</el-button>
+                            <el-button plain @click="passwordChange" size="large" style="min-width: 100px;padding: 12px;">Update password</el-button>
+                        </div>
                     </div>
-                    <div style="margin-top: 30px;display: flex;align-items: center;justify-content: space-between;">
-                        <el-button type="primary" @click="loginOut" size="large" style="width: 100px;background-color:#1856A7 ;">退出账号</el-button>
-                        <el-button plain @click="passwordChange" size="large" style="width: 100px;">修改密码</el-button>
-                    </div>
-                </div>
-            </el-popover>
+                </el-popover>
+            </div>
         </div>
         <div class="mobile-header-wrap">
             <img class="menu-icon" @click="showFilter=true;filterSize='100%'" src="@/assets/menu.svg" alt="">
@@ -221,28 +231,47 @@ const passwordChange=()=>{
     font-size: 20px;
     z-index: 99;
     background-color: #fff;
-    .user-info-hover{
+    .header-right{
         display: flex;
         align-items: center;
         position: absolute;
         top: 50%;
         transform: translateY(-50%);
         right: 17px;
+        z-index: 30;
         cursor: pointer;
-        img{
+        .ybCN-jump{
             height: 30px;
-            width: 30px;
-            margin-right: 10px;
+            cursor: pointer;
+            margin-right: 20px;
         }
-        span{
-            font-weight: 500;
-            font-size: 16px;
-            line-height: 18px;
-            color: #666666;
-            white-space: nowrap;
-            overflow: hidden;
-            text-overflow: ellipsis;
-            max-width: 130px;
+        .user-info-hover{
+            display: flex;
+            align-items: center;
+            img{
+                height: 30px;
+                width: 30px;
+                margin-right: 10px;
+            }
+            span{
+                font-weight: 500;
+                font-size: 16px;
+                line-height: 18px;
+                color: #666666;
+                white-space: nowrap;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                max-width: 130px;
+            }
+        }
+    }
+}
+@media (max-width: 900px){
+    .header-wrap{
+        .navigation-row{
+            span{
+                font-size: 16px;
+            }
         }
     }
 }
@@ -322,7 +351,7 @@ const passwordChange=()=>{
 </style>
 <style lang="scss">
 .user-info-popper{
-    min-width: 300px!important;
+    width: unset!important;
     .user-info-message{
         padding: 28px;
         .user-info-item{

+ 87 - 50
src/views/verification/bindPhoneNo.vue

@@ -3,12 +3,18 @@ import { reactive, ref } from 'vue';
 import {ElMessage,ElMessageBox} from 'element-plus'
 import { useRouter } from 'vue-router';
 import {CaretBottom} from '@element-plus/icons-vue'
-import {smsCodeSend,bindMobile} from '@/api/auth.js'
+import {smsCodeSend,bindMobile,modifyMobile} from '@/api/auth.js'
 
   const router = useRouter()
 
   const bindPhoneRef = ref(null)
+  const bindPhoneMobileRef = ref(null)
+  
   const newPhoneNoRef = ref(null)
+  const newPhoneNoMobileRef = ref(null)
+  
+  const userInfo = localStorage.getItem('user_info')?JSON.parse(localStorage.getItem('user_info')):{}
+
   const telCodeArr=[
     { value: '86', label: '+86' },
     { value: '852', label: "+852" },
@@ -27,15 +33,15 @@ import {smsCodeSend,bindMobile} from '@/api/auth.js'
       verificationCode:''
     },
     rules:{
-      newPhoneNo:[{required: true, message:'手机号不能为空', trigger: 'blur'},
+      newPhoneNo:[{required: true, message:'Mobile phone No. cannot be null', trigger: 'blur'},
       {validator:(rule,value,callback)=>{
         if(value!='' && !Number(value) || value.indexOf('.')!=-1){
-          callback(new Error('必须都为数字'))
+          callback(new Error('Must be number'))
         }else{
           callback()
         }
       }, trigger: 'blur'}],
-      verificationCode:{required: true, message:'验证码不能为空', trigger: 'blur'}
+      verificationCode:{required: true, message:'Verification code cannot be null', trigger: 'blur'}
     }
   })
 
@@ -46,14 +52,20 @@ import {smsCodeSend,bindMobile} from '@/api/auth.js'
   })
 // ----------------------------------------------------方法
   const sendVerCode=()=>{
-    bindPhoneRef.value.validateField(['newPhoneNo']).then(res=>{
+    let refTemp = ''
+    if(isPhone()){
+      refTemp=bindPhoneMobileRef.value
+    }else{
+      refTemp=bindPhoneRef.value
+    }
+    refTemp.validateField(['newPhoneNo']).then(res=>{
       let codeParams={
         Mobile:bindPhone.form.newPhoneNo,
         Area_num:bindPhone.form.newPhoneNoPre || '86'
       }
       smsCodeSend(codeParams).then(res=>{
         if(res.code!=200) return 
-        ElMessage.success('已发送验证码')
+        ElMessage.success('Verification code sent')
         codeInfo.isRequesting=true
         codeInfo.timeout--
         codeTimer=setInterval(()=>{
@@ -75,94 +87,127 @@ import {smsCodeSend,bindMobile} from '@/api/auth.js'
   }
 
   const bindSubmit=()=>{
-    bindPhoneRef.value.validate(valid=>{
+    let isPhoneVar = isPhone()
+    let refTemp = ''
+    if(isPhoneVar){
+      refTemp=bindPhoneMobileRef.value
+    }else{
+      refTemp=bindPhoneRef.value
+    }
+    refTemp.validate(valid=>{
       if(valid){
-        let params={
-          Mobile:bindPhone.form.newPhoneNo,
-          SmsCode:bindPhone.form.verificationCode
+        let params=''
+        let mobileApi=''
+        if(userInfo.Mobile){
+          // 换绑
+          params={
+            OldMobile:userInfo.Mobile,
+            Mobile:bindPhone.form.newPhoneNo,
+            SmsCode:bindPhone.form.verificationCode,
+            CountryCode:bindPhone.form.newPhoneNoPre || '86'
+          }
+          mobileApi = modifyMobile
+        }else{
+          params={
+            Mobile:bindPhone.form.newPhoneNo,
+            SmsCode:bindPhone.form.verificationCode,
+            CountryCode:bindPhone.form.newPhoneNoPre || '86'
+          }
+          mobileApi= bindMobile
         }
-        bindMobile(params).then(res=>{
+
+        mobileApi(params).then(res=>{
           if(res.code==200){
-            //TODO 绑定成功,跳转
+            userInfo.Mobile=bindPhone.form.newPhoneNo
+            localStorage.setItem('user_info',JSON.stringify(userInfo))
             sessionStorage.setItem('transitionPageMessage','bindPhone')
             router.replace('/transitionPage')
-          } 
-          // if(Math.random()>0.5){
-          //   newPhoneNoRef.value.validateMessage='该手机号已绑定其他账号,请检查'
-          //   newPhoneNoRef.value.validateState='error'
-          // }else{
-
-          // }
+          }
+          else if(res.code==4016){
+            if(isPhoneVar){
+              newPhoneNoMobileRef.value.validateMessage='Has been bound to another account.'
+              newPhoneNoMobileRef.value.validateState='error'
+            }else{
+              newPhoneNoRef.value.validateMessage='This mobile phone No. has been bound to another account.'
+              newPhoneNoRef.value.validateState='error'
+            }
+          }
         })
       }
     })
   }
+
+  const isPhone=()=>{
+    return !(window.innerWidth>768)
+  }
+
 </script>
 
 <template>
     <div class="bind-phone-container">
       <div class="fixed-header">
         <span>
-          HORIZONINSIGHTS
+          HORIZON INSIGHTS
         </span>
       </div>
       <div class="page-title">
-        绑定手机号
+        Add a phone number to your account
       </div>
       <div class="bind-phone-form-box" id="bind-phone-form-box">
         <!-- PC端的表单 -->
-        <el-form :model="bindPhone.form" class="bind-phone-form" :rules="bindPhone.rules" ref="bindPhoneRef" >
-          <el-form-item label="原手机号" label-width="70px" style="border: none;">
-            +86 13588818597
+        <el-form :model="bindPhone.form" class="bind-phone-form" :rules="bindPhone.rules" ref="bindPhoneRef">
+          <el-form-item label="Original Mobile Phone No." label-width="176px" style="border: none;" v-if="userInfo.Mobile">
+            {{ userInfo.CountryCode+' '+userInfo.Mobile }}
           </el-form-item>
           <el-form-item prop="newPhoneNo" ref="newPhoneNoRef" size="large">
             <div class="phone-item">
-              <el-select v-model="bindPhone.form.newPhoneNoPre" size="large" style="max-width: 90px;margin-right: 10px;" placeholder="请选择">
+              <el-select v-model="bindPhone.form.newPhoneNoPre" size="large" style="max-width: 90px;margin-right: 10px;" placeholder="Please select">
                 <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
               </el-select>
-              <el-input v-model.trim="bindPhone.form.newPhoneNo" size="large" style="flex-grow: 1;" placeholder="请输入手机号">
+              <el-input v-model.trim="bindPhone.form.newPhoneNo" size="large" style="flex-grow: 1;" placeholder="Please enter your phone number">
                 <template #suffix>
                   <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                  @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                  @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
                 </template>
               </el-input>
             </div>
           </el-form-item>
           <el-form-item prop="verificationCode" style="margin-bottom: 0;" size="large">
-            <el-input v-model="bindPhone.form.verificationCode" size="large" style="width: 360px;" placeholder="请输入验证码" class="form-item">
+            <el-input v-model="bindPhone.form.verificationCode" size="large" style="width: 360px;" placeholder="Please enter the verification code" class="form-item">
             </el-input>
           </el-form-item>
         </el-form>
         <!-- 移动端的表单 -->
-        <el-form :model="bindPhone.form" class="mobile-bind-phone-form" id="mobile-form-field" hide-required-asterisk label-position="left"
-        :rules="bindPhone.rules" label-width="60px" ref="bindPhoneRef" >
-          <el-form-item label="原手机号"  style="border: none;">
-            <span style="margin-left: 15px;">+86 13588818597</span>
+        <el-form :model="bindPhone.form" class="mobile-bind-phone-form" id="mobile-form-field" hide-required-asterisk label-position="top"
+        :rules="bindPhone.rules" label-width="70px" ref="bindPhoneMobileRef">
+          <el-form-item label="Original Mobile Phone No." label-width="165px" v-if="userInfo.Mobile">
+            <span style="margin-left: 15px;">{{ userInfo.CountryCode+' '+userInfo.Mobile }}</span>
           </el-form-item>
-          <el-form-item prop="newPhoneNo" ref="newPhoneNoRef" size="large">
+          <el-form-item prop="newPhoneNo" ref="newPhoneNoMobileRef" size="large" label-position="left">
             <template #label>
+              <span style="margin-right: 10px;">Area Code</span>
               <el-select v-model="bindPhone.form.newPhoneNoPre" :suffix-icon="CaretBottom"
-              style="max-width: 60px;" placeholder="请选择" size="large">
+              style="max-width: 60px;" placeholder="Please select" size="large">
                 <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
               </el-select>
             </template>
-              <el-input v-model.trim="bindPhone.form.newPhoneNo" size="large" style="flex-grow: 1;" placeholder="请输入手机号">
+              <el-input v-model.trim="bindPhone.form.newPhoneNo" size="large" style="flex-grow: 1;" placeholder="Please enter your phone number">
                 <template #suffix>
                   <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                  @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                  @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
                 </template>
               </el-input>
             <!-- </div> -->
           </el-form-item>
-          <el-form-item prop="verificationCode" label="验证码" style="margin-bottom: 0;" size="large">
-            <el-input v-model="bindPhone.form.verificationCode" size="large" style="width: 360px;" placeholder="请输入验证码" class="form-item">
+          <el-form-item prop="verificationCode" label="Verification code" style="margin-bottom: 0;" size="large">
+            <el-input v-model="bindPhone.form.verificationCode" size="large" style="width: 360px;" placeholder="Please enter the verification code" class="form-item">
             </el-input>
           </el-form-item>
         </el-form>
-        <el-button type="primary" @click="bindSubmit" class="submit-button" size="large">提交信息</el-button>
-        <div class="question-hint">若有任何问题,请发邮件至xxxxxxxxxx</div>
+        <el-button type="primary" @click="bindSubmit" class="submit-button" size="large">Submit</el-button>
+        <div class="question-hint">For technical assistance, please contact stephanie@hzinsights.com</div>
       </div>
     </div>
 </template>
@@ -241,12 +286,4 @@ import {smsCodeSend,bindMobile} from '@/api/auth.js'
       }
     }
   }
-</style>
-<style lang="scss">
-@media screen and (max-width: 768px) {
-  .el-form-item__error{
-    left: -60px;
-  }
-}
-
 </style>

+ 102 - 165
src/views/verification/login.vue

@@ -9,9 +9,11 @@ import md5 from 'md5';
 
   const router = useRouter()
   const loginFormRef=ref(null)
-
-  const isMobile=ref(window.innerWidth>768?false:true)
-
+  const loginFormMobileRef=ref(null)
+  
+  const isPhone=()=>{
+    return !(window.innerWidth>768)
+  }
   const loginForm=reactive({
     email:'',
     phone:'',
@@ -33,46 +35,34 @@ import md5 from 'md5';
   const hasChecked=ref(false)
 
   const loginFormRules=reactive({
-    email:[{required: true, message:'邮箱不能为空', trigger: 'blur'},
-    {type:'email',message:'邮箱格式不正确', trigger: 'blur'}],
-    phone:[{required: true, message:'手机号不能为空', trigger: 'blur'},
+    email:[{required: true, message:'Email address cannot be null', trigger: 'blur'},
+    {type:'email',message:'Email address format is incorrect', trigger: 'blur'}],
+    phone:[{required: true, message:'Mobile phone No. cannot be null', trigger: 'blur'},
     {validator:(rule,value,callback)=>{
       if(!Number(value) || value.indexOf('.')!=-1){
-        callback(new Error('必须都为数字'))
+        callback(new Error('Must be number'))
       }else{
         callback()
       }
     }, trigger: 'blur'}],
-    password:{required: true, message:'密码不能为空', trigger: 'blur'}
+    password:{required: true, message:'Password cannot be null', trigger: 'blur'}
   })
 
-
-  const copyEmail=()=>{
-    if (navigator.clipboard && window.isSecureContext) {
-      // navigator clipboard 向剪贴板写文本
-      navigator.clipboard.writeText('xxxxxxxxxxxxx@qq.com').then(() => {
-        ElMessage.success('复制成功')
-      });
+  const login=()=>{
+    let refTemp = ''
+    if(isPhone()){
+      refTemp=loginFormMobileRef.value
     }else{
-      const input = document.createElement('input');
-      input.setAttribute('readonly', 'readonly');
-      input.setAttribute('value', 'xxxxxxxxxxxxx@qq.com');
-      document.body.appendChild(input);
-      input.setSelectionRange(0, input.value.length);
-      input.select();
-      document.execCommand('copy');
-      document.body.removeChild(input);
-      ElMessage.success('复制成功')
+      refTemp=loginFormRef.value
     }
-  }
-  const login=()=>{
-    loginFormRef.value.validate(valid =>{
+    refTemp.validate(valid =>{
       if(valid){
         if(!hasChecked.value){
-          ElMessage.warning('请勾选隐私政策')
+          ElMessage.warning('Please check the Privacy policy')
           return
         }
         let params={
+          CountryCode:loginForm.phonePre,
           Account:loginType.value==1?loginForm.email:loginForm.phone,
           Type:loginType.value,
           Password:md5(loginForm.password)
@@ -81,51 +71,20 @@ import md5 from 'md5';
           // console.log(res);
           if(res.code == 200){
             localStorage.setItem('yben_token',res.data.access_token)
+            let userInfo = {
+              user_id:res.data.user_id,
+              Name:res.data.Name,
+              Email:res.data.Email,
+              Mobile:res.data.Mobile,
+              CountryCode:res.data.CountryCode
+            }
+            localStorage.setItem('user_info',JSON.stringify(userInfo))
+
             let redirectPath=sessionStorage.getItem('login_redirect') || '/'
             sessionStorage.removeItem('login_redirect')
             router.replace(redirectPath)
           }
         })
-        // console.log(loginForm);
-        // if(Math.random()>0.75){
-          // ElMessageBox.confirm("您的账号未曾注册,请注册后登录", '提示',   
-          // {
-          //   customClass:isMobile.value?'mobile-message-confirm':'PC-message-confirm',
-          //   confirmButtonClass:isMobile.value?'mobile-confirm-button':'',
-          //   confirmButtonText: '立即注册',
-          //   showCancelButton:false,
-          // }).then(res=>{
-          //   router.push('/register')
-          // }).catch(()=>{})
-        // }else if(Math.random()>0.5){
-          // ElMessageBox.confirm("您的手机号未绑定账号,请检查","提示",
-          // {
-          //   customClass:isMobile.value?'mobile-message-confirm':'PC-message-confirm',
-          //   confirmButtonClass:isMobile.value?'mobile-confirm-button':'',
-          //   confirmButtonText: '知道了',
-          //   showCancelButton:false,
-          // }).then(res=>{
-          //   console.log('您的手机号未绑定账号,请检查');
-          // }).catch(()=>{})
-        // }else if(Math.random()>0.25){
-          // ElMessage.error('密码错误,请检查')
-        // }else if(Math.random()>0.2){
-          //TODO 登录成功,跳转
-          // localStorage.setItem('yben_token','FDSAFWRFEGGREGEe1')
-          // let redirectPath=sessionStorage.getItem('login_redirect') || '/'
-          // sessionStorage.removeItem('login_redirect')
-          // router.replace(redirectPath)
-        // }else{
-              // ElMessageBox.confirm("您的报告试用权限已超一个月,如需要延长试用期或其他帮助,请联系我们:XXXXXXXXXXXXXXXXXX","提示",
-              // {
-              //   customClass:isMobile.value?'mobile-message-confirm':'PC-message-confirm',
-              //   confirmButtonClass:isMobile.value?'mobile-confirm-button':'',
-              //   confirmButtonText: '复制邮箱',
-              //   showCancelButton:false,
-              // }).then(res=>{
-              //   copyEmail()
-              // }).catch(()=>{})
-        // }
       }
     })
   }
@@ -165,16 +124,16 @@ import md5 from 'md5';
   })
   const registerFormRef=ref(null)
   const registerFormRules=reactive({
-    userName:{required: true, message:'姓名不能为空', trigger: 'blur'},
-    companyName:{required: true, message:'公司名称不能为空', trigger: 'blur'},
-    email:[{required: true, message:'邮箱不能为空', trigger: 'blur'},
-    {type:'email',message:'邮箱格式不正确', trigger: 'blur'}],
-    verificationCode:{required: true, message:'邮箱验证码不能为空', trigger: 'blur'},
-    password:{required: true, message:'密码不能为空', trigger: 'blur'},
-    passwordConfirm:[{required: true, message:'密码不能为空', trigger: 'blur'},
+    userName:{required: true, message:'User name cannot be null', trigger: 'blur'},
+    companyName:{required: true, message:'Company name cannot be null', trigger: 'blur'},
+    email:[{required: true, message:'Email address cannot be null', trigger: 'blur'},
+    {type:'email',message:'Email address format is incorrect', trigger: 'blur'}],
+    verificationCode:{required: true, message:'Verification code cannot be null', trigger: 'blur'},
+    password:{required: true, message:'Password cannot be null', trigger: 'blur'},
+    passwordConfirm:[{required: true, message:'Password cannot be null', trigger: 'blur'},
     {validator:(rule,value,callback)=>{
       if(registerForm.passwordConfirm!==registerForm.password){
-        callback(new Error('两次密码不一致'))
+        callback(new Error('Passwords do not match'))
       }else{
         callback()
       }
@@ -195,7 +154,7 @@ import md5 from 'md5';
       }
       emailCodeSend(codeParams).then(res=>{
         if(res.code!=200) return  
-        ElMessage.success('已发送验证码')
+        ElMessage.success('Verification code sent')
         codeInfo.isRequesting=true
         codeInfo.timeout--
         codeTimer=setInterval(()=>{
@@ -226,7 +185,7 @@ import md5 from 'md5';
           return
         }
         if(!hasChecked.value){
-          ElMessage.warning('请勾选隐私政策')
+          ElMessage.warning('Please check the Privacy policy')
           return
         }
         let params={
@@ -239,35 +198,19 @@ import md5 from 'md5';
         registerApi(params).then(res=>{
           console.log(res.code);
           if(res.code==200){
+            localStorage.setItem('yben_token',res.data.access_token)
+            let userInfo = {
+              user_id:res.data.user_id,
+              Name:res.data.Name,
+              Email:res.data.Email,
+              Mobile:res.data.Mobile,
+              CountryCode:res.data.CountryCode
+            }
+            localStorage.setItem('user_info',JSON.stringify(userInfo))
             sessionStorage.setItem('transitionPageMessage','register')
             router.replace('/transitionPage')
           }
         })
-        // if(Math.random()>0.75){
-        //   ElMessageBox.confirm("您的邮箱已注册,请直接登录","提示",
-        //   {
-              // customClass:'mobile-message-confirm',
-              // confirmButtonClass:'mobile-confirm-button',
-        //     confirmButtonText: '立即登录',
-        //     showCancelButton:false,
-        //   }).then(res=>{
-        //     router.push('/login')
-        //   }).catch(()=>{})
-        // }else if(Math.random()>0.25){
-        //   //TODO 注册成功,跳转
-          // sessionStorage.setItem('transitionPageMessage','register')
-          // router.replace('/transitionPage')
-        // }else{
-          // ElMessageBox.confirm("您的报告试用权限已超一个月,如需要延长试用期或其他帮助,请联系我们:XXXXXXXXXXXXXXXXXX","提示",
-          // {
-          //   customClass:'mobile-message-confirm',
-          //   confirmButtonClass:'mobile-confirm-button',
-          //   confirmButtonText: '复制邮箱',
-          //   showCancelButton:false,
-          // }).then(res=>{
-          //   copyEmail()
-          // }).catch(()=>{})
-        // }
       }
     })
   }
@@ -282,45 +225,45 @@ import md5 from 'md5';
       <div class="login-container-main">
         <div class="login-container-right">
           <div class="login-container-header">
-            <span>HORIZONINSIGHTS</span>
+            <span>HORIZON INSIGHTS</span>
           </div>
           <div class="login-container-body">
             <div class="login-type-tab">
-              <span :class="loginType==1?'active-tab':''" @click="changeLoginType(1)">邮箱登录</span>
+              <span :class="loginType==1?'active-tab':''" @click="changeLoginType(1)">Login with email</span>
               <div class="tab-split"></div>
-              <span :class="loginType==2?'active-tab':''" @click="changeLoginType(2)">手机号登录</span>
+              <span :class="loginType==2?'active-tab':''" @click="changeLoginType(2)">phone number</span>
             </div>
-            <el-form :model="loginForm" class="login-form" :rules="loginFormRules" ref="loginFormRef">
+            <el-form :model="loginForm" class="login-form" :rules="loginFormRules" ref="loginFormRef" style="width: 360px;">
               <el-form-item prop="email" v-if="loginType==1">
-                <el-input v-model.trim="loginForm.email" size="large" placeholder="请输入邮箱" style="width: 360px;"></el-input>
+                <el-input v-model.trim="loginForm.email" size="large" placeholder="Please enter your email address" style="width: 360px;"></el-input>
               </el-form-item>
               <el-form-item prop="phone" v-else >
                 <div class="phone-item">
-                  <el-select v-model="loginForm.phonePre" style="max-width: 90px;margin-right: 10px;" placeholder="请选择" size="large">
+                  <el-select v-model="loginForm.phonePre" style="max-width: 90px;margin-right: 10px;" placeholder="Please select" size="large">
                     <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
                   </el-select>
-                  <el-input v-model.trim="loginForm.phone" style="flex-grow: 1;" placeholder="请输入手机号" size="large">
+                  <el-input v-model.trim="loginForm.phone" style="flex-grow: 1;" placeholder="Please enter your phone number" size="large">
                   </el-input>
                 </div>
               </el-form-item>
               <el-form-item prop="password" style="width: 360px;">
-                <el-input v-model="loginForm.password" size="large" type="password" placeholder="请输入密码"></el-input>
+                <el-input v-model="loginForm.password" size="large" type="password" placeholder="Please enter a password"></el-input>
               </el-form-item>
             </el-form>
             <div class="register-message-row">
               <div class="register-message">
-                还没有账号?<span @click="registerPageGo">去注册</span>
+                New to Horizon Insights? <span @click="registerPageGo">Create an account</span>
               </div>
               <div class="password-miss" @click="psdMissingPageGo">
-                忘记密码?
+                Forgot your password?
               </div>
             </div>
-            <el-button class="submit-button" type="primary" size="large" @click="login">立即登录</el-button>
+            <el-button class="submit-button" type="primary" size="large" @click="login">Log in now</el-button>
             <div class="privacy-policy">
-              <el-checkbox v-model="hasChecked" label="我已阅读并同意" style="color:#333333"></el-checkbox>
-              <span @click="privacyPolicy" class="policy">弘则研报隐私政策</span>
+              <el-checkbox v-model="hasChecked" label="I have read and agree" style="color:#333333"></el-checkbox>
+              <span @click="privacyPolicy" class="policy">the Horizon Insights Privacy Policy</span>
             </div>
-            <div class="login-hint">若有任何问题,请发邮件至xxxxxxxxxx</div>
+            <div class="login-hint">For technical assistance, please contact stephanie@hzinsights.com</div>
           </div>
         </div>
       </div>
@@ -329,85 +272,86 @@ import md5 from 'md5';
     <div id="mobile-part">
       <div class="fixed-header">
         <span>
-          HORIZONINSIGHTS
+          HORIZON INSIGHTS
         </span>
       </div>
       <div class="verification-body">
         <div class="login-type-tab" v-if="step==1 || operationType==1">
-          <span :class="operationType==1?'active-tab':''" @click="changeOperationType(1)">登录</span>
+          <span :class="operationType==1?'active-tab':''" @click="changeOperationType(1)">Login</span>
           <div class="tab-split"></div>
-          <span :class="operationType==2?'active-tab':''" @click="changeOperationType(2)">注册</span>
+          <span :class="operationType==2?'active-tab':''" @click="changeOperationType(2)">Create account</span>
         </div>
         <div class="register-psd-hint" v-else>
-          请设置密码
+          Please set password
         </div>
         <!-- 登录 -->
         <div class="mobile-login-box" v-if="operationType==1">
-          <el-form :model="loginForm" label-width="55px" label-position="left" id="mobile-form-field" :rules="loginFormRules" 
-          ref="loginFormRef" hide-required-asterisk>
-            <el-form-item prop="email" v-if="loginType==1" label="邮箱" size="large" >
-              <el-input v-model.trim="loginForm.email" size="large" placeholder="请输入邮箱"></el-input>
+          <el-form :model="loginForm" label-width="55px" label-position="top" id="mobile-form-field" :rules="loginFormRules" 
+          ref="loginFormMobileRef" hide-required-asterisk>
+            <el-form-item prop="email" v-if="loginType==1" label="Email Address" size="large" >
+              <el-input v-model.trim="loginForm.email" size="large" placeholder="Please enter your email address"></el-input>
             </el-form-item>
             <el-form-item prop="phone" v-else >
               <template #label>
+                <span style="margin-right: 10px;">Area Code</span>
                 <el-select v-model="loginForm.phonePre" :suffix-icon="CaretBottom"
-                style="max-width: 55px;" placeholder="请选择" size="large">
+                style="max-width: 55px;" placeholder="Please select" size="large">
                   <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
                 </el-select>
               </template>
-              <el-input v-model.trim="loginForm.phone" style="flex-grow: 1;" placeholder="请输入手机号" size="large"></el-input>
+              <el-input v-model.trim="loginForm.phone" style="flex-grow: 1;" placeholder="Please enter your phone number" size="large"></el-input>
             </el-form-item>
-            <el-form-item prop="password" label="密码" size="large">
-              <el-input v-model="loginForm.password" size="large"  type="password" placeholder="请输入密码"></el-input>
+            <el-form-item prop="password" label="Password" size="large">
+              <el-input v-model="loginForm.password" size="large"  type="password" placeholder="Please enter a password"></el-input>
             </el-form-item>
           </el-form>
           <div class="mobile-login-type-change">
-            <span @click="changeLoginType(loginType==1?2:1)">切换至{{ loginType==1?"手机号码":"邮箱" }}登录</span>
-            <span @click="psdMissingPageGo">忘记密码?</span>
+            <span @click="changeLoginType(loginType==1?2:1)">Login with {{ loginType==1?"phone number":"email" }} instead</span>
+            <span @click="psdMissingPageGo">Forgot your password?</span>
           </div>
-          <el-button type="primary" class="submit-button" @click="login" size="large">立即登录</el-button>
+          <el-button type="primary" class="submit-button" @click="login" size="large">Log in now</el-button>
           <div class="privacy-policy">
-            <el-checkbox v-model="hasChecked" label="我已阅读并同意"></el-checkbox>
-            <span @click="privacyPolicy" class="policy">弘则研报隐私政策</span>
+            <el-checkbox v-model="hasChecked" label="I have read and agree"></el-checkbox>
+            <span @click="privacyPolicy" class="policy">the Horizon Insights Privacy Policy</span>
           </div>
-          <div class="mobile-login-hint">若有任何问题,请发邮件至xxxxxxxxxx</div>
+          <div class="mobile-login-hint">For technical assistance, please contact stephanie@hzinsights.com</div>
         </div>
         <!-- 注册 -->
         <div class="mobile-register-box" v-else>
-          <el-form :model="registerForm" label-width="55px" label-position="left" id="mobile-form-field" 
+          <el-form :model="registerForm" label-position="top" id="mobile-form-field" 
           :rules="registerFormRules" ref="registerFormRef" hide-required-asterisk>
-            <el-form-item prop="userName" label="姓名" size="large" v-if="step==1">
-              <el-input v-model.trim="registerForm.userName" size="large" placeholder="请输入姓名"></el-input>
+            <el-form-item prop="userName" label="Name" size="large" v-if="step==1">
+              <el-input v-model.trim="registerForm.userName" size="large" placeholder="Please enter your name"></el-input>
             </el-form-item>
-            <el-form-item prop="companyName" label="公司" size="large" v-if="step==1">
-              <el-input v-model="registerForm.companyName" size="large" placeholder="请输入公司名称"></el-input>
+            <el-form-item prop="companyName" label="Company" size="large" v-if="step==1">
+              <el-input v-model="registerForm.companyName" size="large" placeholder="Please enter the company name"></el-input>
             </el-form-item>
-            <el-form-item prop="email" label="邮箱" size="large" v-if="step==1">
-              <el-input v-model="registerForm.email" size="large" placeholder="请输入邮箱">
+            <el-form-item prop="email" label="Email Address" size="large" v-if="step==1">
+              <el-input v-model="registerForm.email" size="large" placeholder="Please enter your email address">
                 <template #suffix>
                   <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                  @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                  @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
                 </template>
               </el-input>
             </el-form-item>
-            <el-form-item prop="verificationCode" label="验证码" size="large" v-if="step==1">
-              <el-input v-model="registerForm.verificationCode" size="large" placeholder="请输入验证码"></el-input>
+            <el-form-item prop="verificationCode" label="Verification code" size="large" v-if="step==1">
+              <el-input v-model="registerForm.verificationCode" size="large" placeholder="Please enter the verification code"></el-input>
             </el-form-item>
-            <el-form-item prop="password" label="密码" size="large" v-if="step==2">
-              <el-input v-model="registerForm.password" size="large" type="password" placeholder="请输入密码"></el-input>
+            <el-form-item prop="password" label="Password" size="large" v-if="step==2">
+              <el-input v-model="registerForm.password" size="large" type="password" placeholder="Please enter a password"></el-input>
             </el-form-item>
-            <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" label="密码" size="large" v-if="step==2">
-              <el-input v-model="registerForm.passwordConfirm" size="large" type="password" placeholder="请再次输入密码"></el-input>
+            <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" label="Password" size="large" v-if="step==2">
+              <el-input v-model="registerForm.passwordConfirm" size="large" type="password" placeholder="Please enter the password again"></el-input>
             </el-form-item>
           </el-form>
-          <el-button type="primary" class="submit-button" @click="register" size="large" v-if="step==1">下一步</el-button>
-          <el-button type="primary" class="submit-button" size="large" v-if="step==2" @click="register">提交信息</el-button>
+          <el-button type="primary" class="submit-button" @click="register" size="large" v-if="step==1">Next</el-button>
+          <el-button type="primary" class="submit-button" size="large" v-if="step==2" @click="register">Submit</el-button>
           <div class="privacy-policy" v-if="step==2">
-            <el-checkbox v-model="hasChecked" label="我已阅读并同意" style="color:#333333" ></el-checkbox>
-            <span @click="privacyPolicy" class="policy">弘则研报隐私政策</span>
+            <el-checkbox v-model="hasChecked" label="I have read and agree" style="color:#333333" ></el-checkbox>
+            <span @click="privacyPolicy" class="policy">the Horizon Insights Privacy Policy</span>
           </div>
-          <div class="mobile-login-hint">若有任何问题,请发邮件至xxxxxxxxxx</div>
+          <div class="mobile-login-hint">For technical assistance, please contact stephanie@hzinsights.com</div>
         </div>
       </div>
     </div>
@@ -445,6 +389,7 @@ import md5 from 'md5';
       margin-top: 25px;
       display: flex;
       align-items: center;
+      flex-wrap: wrap;
       .policy{
         color: #1856A7;
         cursor: pointer;
@@ -480,7 +425,7 @@ import md5 from 'md5';
 
         .login-container-right{
           background-color: white;
-          width: 600px;
+          width: 650px;
           height: 550px;
           opacity: 0.95;
           border: 1px solid #DCDFE6;
@@ -502,7 +447,7 @@ import md5 from 'md5';
             }
           }
           .login-container-body{
-            width: 360px;
+            width: 430px;
             padding-top: 45px;
             .login-form{
               .phone-item{
@@ -623,12 +568,4 @@ import md5 from 'md5';
       }
     }
   }
-</style>
-<style lang="scss">
-@media screen and (max-width: 768px) {
-  .el-form-item__error{
-    left: -55px;
-  }
-}
-
 </style>

+ 18 - 20
src/views/verification/mobileMyPage.vue

@@ -1,15 +1,9 @@
 <script setup>
-import { reactive } from 'vue';
 import { useRouter } from 'vue-router';
 
 const router = useRouter()
 
-  const userForm=reactive({
-    userName:'陈煌滨',
-    email:'hbchen@hz.com',
-    phone:'17859768727',
-    areaNum:'+86'
-  })
+  const userForm=localStorage.getItem('user_info')?JSON.parse(localStorage.getItem('user_info')):{}
 
 
   const bindPhone=()=>{
@@ -30,30 +24,34 @@ const router = useRouter()
   <div class="user-container" id="user-container">
     <div class="fixed-header">
       <span>
-        HORIZONINSIGHTS
+        HORIZON INSIGHTS
       </span>
     </div>
     <div class="user-info-box">
       <img src="@/assets/icons/avatar.svg" class="user-avatar">
       <div class="user-info">
-        <el-form :model="userForm" id="mobile-form-field" label-position="left" label-width="56px">
-          <el-form-item label="用户姓名" size="large">
-            {{ userForm.userName }}
+        <el-form :model="userForm" id="mobile-form-field" label-position="top">
+          <el-form-item label="User Name" size="large">
+            {{ userForm.Name }}
           </el-form-item>
-          <el-form-item label="邮箱" size="large">
-            {{ userForm.email }}
+          <el-form-item label="Email Address" size="large">
+            {{ userForm.Email }}
           </el-form-item>
-          <el-form-item label="手机号" size="large">
+          <el-form-item label="Mobile Phone No" size="large">
             <div class="phone-form-item" @click="bindPhone">
-              <!-- {{ userForm.areaNum+' '+userForm.phone }}
-              <img src="@/assets/icons/edit.svg" style="height: 16px;margin-left: 20px;"> -->
-              <img src="@/assets/icons/add-square.svg" style="height: 16px;margin-right: 8px;">
-              <span>绑定手机号</span>
+              <template v-if="!userForm.Mobile">
+                <img src="@/assets/icons/add-square.svg" style="height: 16px;margin-right: 8px;">
+                <span>Add a phone number to your account</span>
+              </template>
+              <template v-else>
+                {{ userForm.CountryCode+' '+userForm.Mobile }}
+                <img src="@/assets/icons/edit.svg" style="height: 16px;margin-left: 20px;">
+              </template>
             </div>
           </el-form-item>
         </el-form>
-        <el-button type="primary" class="form-button" size="large" @click="loginOut">退出账号</el-button>
-        <el-button class="form-button" size="large" style="margin-left: 0;" @click="passwordChange">修改密码</el-button>
+        <el-button type="primary" class="form-button" size="large" @click="loginOut">Sign out</el-button>
+        <el-button class="form-button" size="large" style="margin-left: 0;" @click="passwordChange">Update password</el-button>
       </div>
     </div>
   </div>

+ 33 - 30
src/views/verification/passwordChange.vue

@@ -8,6 +8,11 @@ import md5 from 'md5';
   const router = useRouter()
 
   const psdChangeRef = ref(null)
+  const psdChangeMobileRef = ref(null)
+
+  const isPhone=()=>{
+    return !(window.innerWidth>768)
+  }
 
   const psdChange=reactive({
     form:{
@@ -16,12 +21,12 @@ import md5 from 'md5';
       passwordConfirm:'',
     },
     rules:{
-      passwordOrigin:{required: true, message:'原密码不能为空', trigger: 'blur'},
-      password:{required: true, message:'密码不能为空', trigger: 'blur'},
-      passwordConfirm:[{required: true, message:'密码不能为空', trigger: 'blur'},
+      passwordOrigin:{required: true, message:'Original password cannot be null', trigger: 'blur'},
+      password:{required: true, message:'New password cannot be null', trigger: 'blur'},
+      passwordConfirm:[{required: true, message:'New Password cannot be null', trigger: 'blur'},
       {validator:(rule,value,callback)=>{
         if(psdChange.form.passwordConfirm!==psdChange.form.password){
-          callback(new Error('两次密码不一致'))
+          callback(new Error('Passwords do not match'))
         }else{
           callback()
         }
@@ -37,7 +42,13 @@ import md5 from 'md5';
     window.open(href,'_blank');
   }
   const submit=()=>{
-    psdChangeRef.value.validate(valid=>{
+    let refTemp = ''
+    if(isPhone()){
+      refTemp=psdChangeMobileRef.value
+    }else{
+      refTemp=psdChangeRef.value
+    }
+    refTemp.validate(valid=>{
       if(valid){
         let params={
           OldPwd:md5(psdChange.form.passwordOrigin),
@@ -46,7 +57,7 @@ import md5 from 'md5';
         psdModify(params).then(res=>{
           if(res.code == 200){
             ElMessage({
-              message: '修改成功,请重新登录',
+              message: 'Modify successfully, please log in again',
               type: 'success',
               duration:1000
             })
@@ -66,49 +77,49 @@ import md5 from 'md5';
     <div class="psdChange-container">
       <div class="fixed-header">
         <span>
-          HORIZONINSIGHTS
+          HORIZON INSIGHTS
         </span>
       </div>
       <div class="page-title">
-        修改密码
+        Update password
       </div>
       <div class="regitser-form-box" id="regitser-form-box">
         <!-- PC端表单 -->
         <el-form :model="psdChange.form" class="regitser-form" :rules="psdChange.rules" ref="psdChangeRef">
           <el-form-item prop="passwordOrigin">
-            <el-input v-model="psdChange.form.passwordOrigin" size="large" type="password" placeholder="请输入原密码">
+            <el-input v-model="psdChange.form.passwordOrigin" size="large" type="password" placeholder="Please enter the original password">
               <template #suffix>
                 <span style=" color:#1856A7;cursor: pointer;white-space: nowrap;" 
-                @click="psdMissingPageGo">忘记密码?</span>
+                @click="psdMissingPageGo">Forgot your password?</span>
               </template>
             </el-input>
           </el-form-item>
           <el-form-item prop="password">
-            <el-input v-model="psdChange.form.password" size="large" type="password" placeholder="请输入新密码"></el-input>
+            <el-input v-model="psdChange.form.password" size="large" type="password" placeholder="Please enter a new password"></el-input>
           </el-form-item>
           <el-form-item prop="passwordConfirm" style="margin-bottom: 0;">
-            <el-input v-model="psdChange.form.passwordConfirm" size="large" type="password" placeholder="请再次输入新密码"></el-input>
+            <el-input v-model="psdChange.form.passwordConfirm" size="large" type="password" placeholder="Please enter the new password again"></el-input>
           </el-form-item>
         </el-form>
         <!-- 移动端表单 -->
-        <el-form :model="psdChange.form" class="mobile-regitser-form" id="mobile-form-field" label-width="45px"
-        :rules="psdChange.rules" ref="psdChangeRef" hide-required-asterisk label-position="left">
-          <el-form-item prop="passwordOrigin" label="原密码" size="large">
-            <el-input v-model="psdChange.form.passwordOrigin" size="large" type="password" placeholder="请输入原密码">
+        <el-form :model="psdChange.form" class="mobile-regitser-form" id="mobile-form-field"
+        :rules="psdChange.rules" ref="psdChangeMobileRef" hide-required-asterisk label-position="top">
+          <el-form-item prop="passwordOrigin" label="Original Password" size="large">
+            <el-input v-model="psdChange.form.passwordOrigin" size="large" type="password" placeholder="Please enter the original password">
               <template #suffix>
                 <span style=" color:#1856A7;cursor: pointer;white-space: nowrap;" 
-                @click="psdMissingPageGo">忘记密码?</span>
+                @click="psdMissingPageGo">Forgot your password?</span>
               </template>
             </el-input>
           </el-form-item>
-          <el-form-item prop="password" size="large" label="密码">
-            <el-input v-model="psdChange.form.password" size="large" type="password" placeholder="请输入新密码"></el-input>
+          <el-form-item prop="password" size="large" label="Password">
+            <el-input v-model="psdChange.form.password" size="large" type="password" placeholder="Please enter a new password"></el-input>
           </el-form-item>
-          <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" size="large" label="密码">
-            <el-input v-model="psdChange.form.passwordConfirm" size="large" type="password" placeholder="请再次输入新密码"></el-input>
+          <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" size="large" label="Password">
+            <el-input v-model="psdChange.form.passwordConfirm" size="large" type="password" placeholder="Please enter the new password again"></el-input>
           </el-form-item>
         </el-form>
-        <el-button type="primary" @click="submit" class="psdChange-button" size="large">确定</el-button>
+        <el-button type="primary" @click="submit" class="psdChange-button" size="large">Submit</el-button>
       </div>
     </div>
 </template>
@@ -169,12 +180,4 @@ import md5 from 'md5';
       }
     }
   }
-</style>
-<style lang="scss">
-@media screen and (max-width: 768px) {
-  .el-form-item__error{
-    left: -45px;
-  }
-}
-
 </style>

+ 64 - 66
src/views/verification/passwordMissing.vue

@@ -9,7 +9,10 @@ import md5 from 'md5';
   const router = useRouter()
 
   const psdMissingRef = ref(null)
-  const phoneRef = ref(null)
+  const psdMissingMobileRef = ref(null)
+  const isPhone=()=>{
+    return !(window.innerWidth>768)
+  }
   const telCodeArr=[
     { value: '86', label: '+86' },
     { value: '852', label: "+852" },
@@ -30,26 +33,26 @@ import md5 from 'md5';
       verificationCode:''
     },
     rules:{
-      email:[{required: true, message:'邮箱不能为空', trigger: 'blur'},
-      {type:'email',message:'邮箱格式不正确', trigger: 'blur'}],
-      phone:[{required: true,message:'手机号码不能为空', trigger: 'blur'},
+      email:[{required: true, message:'Email address cannot be null', trigger: 'blur'},
+      {type:'email',message:'Email address format is incorrect', trigger: 'blur'}],
+      phone:[{required: true,message:'Mobile phone No. cannot be null', trigger: 'blur'},
       {validator:(rule,value,callback)=>{
         if(value!='' && !Number(value) || value.indexOf('.')!=-1){
-          callback(new Error('必须都为数字'))
+          callback(new Error('Must be number'))
         }else{
           callback()
         }
       }, trigger: 'blur'}],
-      password:{required: true, message:'密码不能为空', trigger: 'blur'},
-      passwordConfirm:[{required: true, message:'密码不能为空', trigger: 'blur'},
+      password:{required: true, message:'Password cannot be null', trigger: 'blur'},
+      passwordConfirm:[{required: true, message:'Password cannot be null', trigger: 'blur'},
       {validator:(rule,value,callback)=>{
         if(psdMissing.form.passwordConfirm!==psdMissing.form.password){
-          callback(new Error('两次密码不一致'))
+          callback(new Error('Passwords do not match'))
         }else{
           callback()
         }
       }, trigger: 'blur'}],
-      verificationCode:{required: true, message:'验证码不能为空', trigger: 'blur'}
+      verificationCode:{required: true, message:'Verification code cannot be null', trigger: 'blur'}
 
     }
   })
@@ -69,7 +72,13 @@ const changeLoginType=(type)=>{
 }
 
   const sendVerCode=()=>{
-    psdMissingRef.value.validateField(['phone','email']).then(async res=>{
+    let refTemp = ''
+    if(isPhone()){
+      refTemp=psdMissingMobileRef.value
+    }else{
+      refTemp=psdMissingRef.value
+    }
+    refTemp.validateField(['phone','email']).then(async res=>{
       let resp=''
       // 邮箱验证
       if(loginType.value==1){
@@ -97,7 +106,7 @@ const changeLoginType=(type)=>{
         codeInfo.timeout--
       },1000)
       // TODO 发送验证码
-      ElMessage.success('已发送验证码')
+      ElMessage.success('Verification code sent')
       }
     }).catch(err=>{
       let errMessage=''
@@ -110,9 +119,17 @@ const changeLoginType=(type)=>{
   }
 
   const psdMissingSubmit=()=>{
-    psdMissingRef.value.validate(valid=>{
+    let refTemp = ''
+    if(isPhone()){
+      refTemp=psdMissingMobileRef.value
+    }else{
+      refTemp=psdMissingRef.value
+    }
+    refTemp.validate(valid=>{
       if(valid){
         let params={
+          CountryCode:loginType.value==1?undefined:psdMissing.form.phonePre,
+          type:loginType.value,
           Account:loginType.value==1?psdMissing.form.email:psdMissing.form.phone,
           Password:md5(psdMissing.form.password),
           SmsCode:psdMissing.form.verificationCode
@@ -120,7 +137,7 @@ const changeLoginType=(type)=>{
         psdMissingApi(params).then(res=>{
           if(res.code==200){
             ElMessage({
-              message: '修改成功',
+              message: 'Modified successfully',
               type: 'success',
               duration:1000
             })
@@ -130,18 +147,6 @@ const changeLoginType=(type)=>{
             },1000)
           }
         })
-        // if(Math.random()>0.5){
-        //   // ElMessageBox.confirm("您的账号未曾注册,请注册后登录","提示",
-        //   // {
-        //   //   confirmButtonText: '立即注册',
-        //   //   showCancelButton:false,
-        //   // }).then(res=>{
-        //   //   router.push('/register')
-        //   // }).catch(()=>{})
-        // }else{
-        //   //TODO 注册成功,跳转
-
-        // }
       }
     })
   }
@@ -156,89 +161,90 @@ const changeLoginType=(type)=>{
     <div class="psdMissing-container">
       <div class="fixed-header">
         <span>
-          HORIZONINSIGHTS
+          HORIZON INSIGHTS
         </span>
       </div>
       <div class="login-type-tab">
-        <span :class="loginType==1?'active-tab':''" @click="changeLoginType(1)">邮箱验证</span>
+        <span :class="loginType==1?'active-tab':''" @click="changeLoginType(1)">Email verification</span>
         <div class="tab-split"></div>
-        <span :class="loginType==2?'active-tab':''" @click="changeLoginType(2)">手机号码验证</span>
+        <span :class="loginType==2?'active-tab':''" @click="changeLoginType(2)">Phone number verification</span>
       </div>
       <div class="regitser-form-box" id="regitser-form-box">
         <!-- PC端表单 -->
         <el-form :model="psdMissing.form" class="missing-psd-form" :rules="psdMissing.rules" ref="psdMissingRef">
-          <el-form-item prop="phone" ref="phoneRef" v-if="loginType==2">
+          <el-form-item prop="phone" v-if="loginType==2">
             <div class="phone-item">
-              <el-select v-model="psdMissing.form.phonePre" size="large" style="max-width: 90px;margin-right: 10px;" placeholder="请选择">
+              <el-select v-model="psdMissing.form.phonePre" size="large" style="max-width: 90px;margin-right: 10px;" placeholder="Please select">
                 <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
               </el-select>
-              <el-input v-model.trim="psdMissing.form.phone" size="large" style="flex-grow: 1;height: 40px;" placeholder="请输入手机号">
+              <el-input v-model.trim="psdMissing.form.phone" size="large" style="flex-grow: 1;height: 40px;" placeholder="Please enter your phone number">
                 <template #suffix>
                   <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                  @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                  @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                  <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
                 </template>
               </el-input>
             </div>
           </el-form-item>
           <el-form-item prop="email" v-else>
-            <el-input v-model="psdMissing.form.email" size="large" style="height: 40px;" placeholder="请输入邮箱" class="form-item">
+            <el-input v-model="psdMissing.form.email" size="large" style="height: 40px;" placeholder="Please enter your email address" class="form-item">
               <template #suffix>
                 <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
               </template>
             </el-input>
           </el-form-item>
           <el-form-item prop="verificationCode" >
-            <el-input v-model="psdMissing.form.verificationCode" size="large" placeholder="请输入验证码" class="form-item"></el-input>
+            <el-input v-model="psdMissing.form.verificationCode" size="large" placeholder="Please enter the verification code" class="form-item"></el-input>
           </el-form-item>
           <el-form-item prop="password">
-            <el-input v-model="psdMissing.form.password" size="large" type="password" placeholder="请输入密码" class="form-item"></el-input>
+            <el-input v-model="psdMissing.form.password" size="large" type="password" placeholder="Please enter a password" class="form-item"></el-input>
           </el-form-item>
           <el-form-item prop="passwordConfirm" style="margin-bottom: 0;">
-            <el-input v-model="psdMissing.form.passwordConfirm" size="large" type="password" placeholder="请再次输入密码" class="form-item"></el-input>
+            <el-input v-model="psdMissing.form.passwordConfirm" size="large" type="password" placeholder="Please enter the password again" class="form-item"></el-input>
           </el-form-item>
         </el-form>
         <!-- 移动端表单 -->
-        <el-form :model="psdMissing.form" class="mobile-missing-psd-form" id="mobile-form-field" label-width="55px"
-        label-position="left" :rules="psdMissing.rules" ref="psdMissingRef" hide-required-asterisk>
-          <el-form-item prop="phone" ref="phoneRef" v-if="loginType==2" size="large">
+        <el-form :model="psdMissing.form" class="mobile-missing-psd-form" id="mobile-form-field"
+        label-position="top" :rules="psdMissing.rules" ref="psdMissingMobileRef" hide-required-asterisk>
+          <el-form-item prop="phone" v-if="loginType==2" size="large">
             <template #label>
+              <span style="margin-right: 10px;">Area Code</span>
               <el-select v-model="psdMissing.form.phonePre" :suffix-icon="CaretBottom"
-              style="max-width: 55px;" placeholder="请选择" size="large">
+              style="max-width: 55px;" placeholder="Please select" size="large">
                 <el-option :label="item.label" :value="item.value" v-for="item in telCodeArr" />
               </el-select>
             </template>
-            <el-input v-model.trim="psdMissing.form.phone" size="large" style="flex-grow: 1;height: 40px;" placeholder="请输入手机号">
+            <el-input v-model.trim="psdMissing.form.phone" size="large" style="flex-grow: 1;height: 40px;" placeholder="Please enter your phone number">
               <template #suffix>
                 <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
               </template>
             </el-input>
           </el-form-item>
-          <el-form-item prop="email" v-else label="邮箱" size="large">
-            <el-input v-model="psdMissing.form.email" size="large" style="height: 40px;" placeholder="请输入邮箱" class="form-item">
+          <el-form-item prop="email" v-else label="Email Address" size="large">
+            <el-input v-model="psdMissing.form.email" size="large" style="height: 40px;" placeholder="Please enter your email address" class="form-item">
               <template #suffix>
                 <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
               </template>
             </el-input>
           </el-form-item>
-          <el-form-item prop="verificationCode" size="large" label="验证码">
-            <el-input v-model="psdMissing.form.verificationCode" size="large" placeholder="请输入验证码" class="form-item"></el-input>
+          <el-form-item prop="verificationCode" size="large" label="Verification Code">
+            <el-input v-model="psdMissing.form.verificationCode" size="large" placeholder="Please enter the verification code" class="form-item"></el-input>
           </el-form-item>
-          <el-form-item prop="password" size="large" label="密码">
-            <el-input v-model="psdMissing.form.password" size="large" type="password" placeholder="请输入密码" class="form-item"></el-input>
+          <el-form-item prop="password" size="large" label="Password">
+            <el-input v-model="psdMissing.form.password" size="large" type="password" placeholder="Please enter a password" class="form-item"></el-input>
           </el-form-item>
-          <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" size="large" label="密码">
-            <el-input v-model="psdMissing.form.passwordConfirm" size="large" type="password" placeholder="请再次输入密码" class="form-item"></el-input>
+          <el-form-item prop="passwordConfirm" style="margin-bottom: 0;" size="large" label="Password">
+            <el-input v-model="psdMissing.form.passwordConfirm" size="large" type="password" placeholder="Please enter the password again" class="form-item"></el-input>
           </el-form-item>
         </el-form>
-        <el-button type="primary" @click="psdMissingSubmit" class="psdMissing-button" size="large">确定</el-button>
-        <div class="login-row">想起密码<span @click="loginPageGo">去登录</span></div>
+        <el-button type="primary" @click="psdMissingSubmit" class="psdMissing-button" size="large">Submit</el-button>
+        <div class="login-row">Remember your password? <span @click="loginPageGo">Log in instead</span></div>
       </div>
     </div>
 </template>
@@ -367,12 +373,4 @@ const changeLoginType=(type)=>{
       }
     }
   }
-</style>
-<style lang="scss">
-@media screen and (max-width: 768px) {
-  .el-form-item__error{
-    left: -55px;
-  }
-}
-
 </style>

+ 38 - 68
src/views/verification/register.vue

@@ -21,20 +21,20 @@ import md5 from 'md5'
       verificationCode:''
     },
     rules:{
-      userName:{required: true, message:'姓名不能为空', trigger: 'blur'},
-      companyName:{required: true, message:'公司名称不能为空', trigger: 'blur'},
-      email:[{required: true, message:'邮箱不能为空', trigger: 'blur'},
-      {type:'email',message:'邮箱格式不正确', trigger: 'blur'}],
-      password:{required: true, message:'密码不能为空', trigger: 'blur'},
-      passwordConfirm:[{required: true, message:'密码不能为空', trigger: 'blur'},
+      userName:{required: true, message:'User name cannot be null', trigger: 'blur'},
+      companyName:{required: true, message:'Company name cannot be null', trigger: 'blur'},
+      email:[{required: true, message:'Email address cannot be null', trigger: 'blur'},
+      {type:'email',message:'Email address format is incorrect', trigger: 'blur'}],
+      password:{required: true, message:'Password cannot be null', trigger: 'blur'},
+      passwordConfirm:[{required: true, message:'Password cannot be null', trigger: 'blur'},
       {validator:(rule,value,callback)=>{
         if(register.form.passwordConfirm!==register.form.password){
-          callback(new Error('两次密码不一致'))
+          callback(new Error('Passwords do not match'))
         }else{
           callback()
         }
       }, trigger: 'blur'}],
-      verificationCode:{required: true, message:'邮箱验证码不能为空', trigger: 'blur'}
+      verificationCode:{required: true, message:'Verification code cannot be null', trigger: 'blur'}
     }
   })
 
@@ -53,7 +53,7 @@ import md5 from 'md5'
       }
       emailCodeSend(codeParams).then(res=>{
         if(res.code!=200) return  
-        ElMessage.success('已发送验证码')
+        ElMessage.success('Verification code sent')
         codeInfo.isRequesting=true
         codeInfo.timeout--
         codeTimer=setInterval(()=>{
@@ -79,7 +79,7 @@ import md5 from 'md5'
     registerRef.value.validate(valid=>{
       if(valid){
         if(!hasChecked.value){
-          ElMessage.warning('请勾选隐私政策')
+          ElMessage.warning('Please check the Privacy policy')
           return
         }
         let params={
@@ -89,33 +89,21 @@ import md5 from 'md5'
           SmsCode:register.form.verificationCode,
           Password:md5(register.form.password)
         }
-        // registerApi(params).then(res=>{
-        //   console.log(res);
-        //   if(Math.random()>0.75){
-        //     ElMessageBox.confirm("您的邮箱已注册,请直接登录","提示",
-        //     {
-        //       confirmButtonText: '立即登录',
-        //       showCancelButton:false,
-        //     }).then(res=>{
-        //       router.push('/login')
-        //     }).catch(()=>{})
-        //   }else if(Math.random()>0.5){
-        //     phoneRef.value.validateMessage='该手机号已绑定其他账号,请检查'
-        //     phoneRef.value.validateState='error'
-        //   }else if(Math.random()>0.25){
-        //     //TODO 注册成功,跳转
+        registerApi(params).then(res=>{
+          if(res.code == 200){
+            localStorage.setItem('yben_token',res.data.access_token)
+            let userInfo = {
+              user_id:res.data.user_id,
+              Name:res.data.Name,
+              Email:res.data.Email,
+              Mobile:res.data.Mobile,
+              CountryCode:res.data.CountryCode
+            }
+            localStorage.setItem('user_info',JSON.stringify(userInfo))
             sessionStorage.setItem('transitionPageMessage','register')
             router.replace('/transitionPage')
-        //   }else{
-        //     ElMessageBox.confirm("您的报告试用权限已超一个月,如需要延长试用期或其他帮助,请联系我们:XXXXXXXXXXXXXXXXXX","提示",
-        //     {
-        //       confirmButtonText: '复制邮箱',
-        //       showCancelButton:false,
-        //     }).then(res=>{
-        //       copyEmail()
-        //     }).catch(()=>{})
-        //   }
-        // })
+          }
+        })
       }
     })
   }
@@ -123,24 +111,6 @@ import md5 from 'md5'
     let {href} = router.resolve("/login");
     window.open(href,'_blank');
   }
-  const copyEmail=()=>{
-    if (navigator.clipboard && window.isSecureContext) {
-      // navigator clipboard 向剪贴板写文本
-      navigator.clipboard.writeText('xxxxxxxxxxxxx@qq.com').then(() => {
-        ElMessage.success('复制成功')
-      });
-    }else{
-      const input = document.createElement('input');
-      input.setAttribute('readonly', 'readonly');
-      input.setAttribute('value', 'xxxxxxxxxxxxx@qq.com');
-      document.body.appendChild(input);
-      input.setSelectionRange(0, input.value.length);
-      input.select();
-      document.execCommand('copy');
-      document.body.removeChild(input);
-      ElMessage.success('复制成功')
-    }
-  }
 
   const privacyPolicy=()=>{
     //TODO 去查看隐私政策
@@ -152,46 +122,46 @@ import md5 from 'md5'
     <div class="register-container">
       <div class="fixed-header">
         <span>
-          HORIZONINSIGHTS
+          HORIZON INSIGHTS
         </span>
       </div>
       <div class="page-title">
-        注册账号
+        Create account
       </div>
       <div class="regitser-form-box" id="regitser-form-box">
         <el-form :model="register.form" :rules="register.rules" ref="registerRef">
           <el-form-item prop="userName">
-            <el-input v-model="register.form.userName" size="large" placeholder="请输入姓名"></el-input>
+            <el-input v-model="register.form.userName" size="large" placeholder="Please enter your name"></el-input>
           </el-form-item>
           <el-form-item prop="companyName">
-            <el-input v-model="register.form.companyName" size="large" placeholder="请输入公司名称"></el-input>
+            <el-input v-model="register.form.companyName" size="large" placeholder="Please enter the company name"></el-input>
           </el-form-item>
           <el-form-item prop="email">
-            <el-input v-model="register.form.email" size="large" placeholder="请输入邮箱">
+            <el-input v-model="register.form.email" size="large" placeholder="Please enter your email address">
               <template #suffix>
                 <span style=" color: var(--el-color-primary);cursor: pointer;white-space: nowrap;" 
-                @click="sendVerCode" v-if="!codeInfo.isRequesting">获取验证码</span>
-                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s后再获取</span>
+                @click="sendVerCode" v-if="!codeInfo.isRequesting">Get verification code</span>
+                <span style=" color: #999999;white-space: nowrap;" v-else>{{ codeInfo.timeout }}s</span>
               </template>
             </el-input>
           </el-form-item>
           <el-form-item prop="verificationCode" >
-            <el-input v-model.trim="register.form.verificationCode" size="large" placeholder="请输入邮箱验证码"></el-input>
+            <el-input v-model.trim="register.form.verificationCode" size="large" placeholder="Please enter the email verification code"></el-input>
           </el-form-item>
           <el-form-item prop="password">
-            <el-input v-model="register.form.password" size="large" type="password" placeholder="请输入密码"></el-input>
+            <el-input v-model="register.form.password" size="large" type="password" placeholder="Please enter a password"></el-input>
           </el-form-item>
           <el-form-item prop="passwordConfirm" style="margin-bottom: 0;">
-            <el-input v-model="register.form.passwordConfirm" size="large" type="password" placeholder="请再次输入密码"></el-input>
+            <el-input v-model="register.form.passwordConfirm" size="large" type="password" placeholder="Please enter the password again"></el-input>
           </el-form-item>
         </el-form>
-        <el-button type="primary" @click="registerSubmit" class="register-button" size="large">提交信息</el-button>
-        <div class="login-row">已有账号<span @click="loginPageGo">去登录</span></div>
+        <el-button type="primary" @click="registerSubmit" class="register-button" size="large">Submit</el-button>
+        <div class="login-row">Existing account <span @click="loginPageGo">Log in instead</span></div>
         <div class="privacy-policy">
-          <el-checkbox v-model="hasChecked" label="我已阅读并同意" style="color:#333333"></el-checkbox>
-          <span @click="privacyPolicy" class="policy">弘则研报隐私政策</span>
+          <el-checkbox v-model="hasChecked" label="I have read and agree" style="color:#333333"></el-checkbox>
+          <span @click="privacyPolicy" class="policy">the Horizon Insights Privacy Policy</span>
         </div>
-        <div class="question-hint">若有任何问题,请发邮件至xxxxxxxxxx</div>
+        <div class="question-hint">For technical assistance, please contact stephanie@hzinsights.com</div>
       </div>
     </div>
 </template>

+ 7 - 7
src/views/verification/transitionPage.vue

@@ -9,7 +9,7 @@
     const transitionType=ref()
     
     let timer=null
-    const time = ref(3)
+    const time = ref(5)
     const bindPhonePageGo=()=>{
         router.replace('/bindPhoneNo')
     }
@@ -52,19 +52,19 @@
     <div class="hint-box" v-show="transitionType">
         <div class="fixed-header">
             <span>
-            HORIZONINSIGHTS
+            HORIZON INSIGHTS
             </span>
         </div>
         <img src="@/assets/icons/transition-success.svg" class="success-svg" />
-        <p v-if="transitionType=='register'" class="transitioin-text">您已注册成功!</p>
-        <p v-else-if="transitionType=='bindPhone'" class="transitioin-text">您已成功绑定手机号码!{{ time }}s后自动跳转</p>
+        <p v-if="transitionType=='register'" class="transitioin-text">You have successfully registered</p>
+        <p v-else-if="transitionType=='bindPhone'" class="transitioin-text">Registration succeeded. You will be automatically redirected in {{ time }} seconds.</p>
         <div class="register-buttons" v-if="transitionType=='register'" >
             <el-button type="primary" class="transitioin-button" @click="bindPhonePageGo" 
-            style="background-color: #1856A7;">我要绑定手机号,方便下次登录!</el-button>
-            <el-button class="transitioin-button" @click="ybPageGo" style="margin-left: 0;margin-top: 20px;">不绑定</el-button>
+            style="background-color: #1856A7;">Add a phone number to your account</el-button>
+            <el-button class="transitioin-button" @click="ybPageGo" style="margin-left: 0;margin-top: 20px;">Skip</el-button>
         </div>
         <el-button type="primary" class="transitioin-button" @click="ybPageGo" 
-        v-else-if="transitionType=='bindPhone'" style="background-color: #1856A7;">知道了</el-button>
+        v-else-if="transitionType=='bindPhone'" style="background-color: #1856A7;">Got it</el-button>
     </div>
 </template>