123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <template>
- <view class="container">
- <view class="container_text">
- <image class="banner-img" src="/static/img/logo.png" mode="widthFix"></image>
- </view>
- <view class="login_text">
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze4.png"></image>
- </view>
- <view class="login_name"><input class="uni-input" v-model="store_name" focus
- placeholder="请输入商户名称" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze.png"></image>
- </view>
- <view class="login_name"><input class="uni-input" @input="checkAccount" v-model="account" focus
- placeholder="请输入手机号" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze2.png"></image>
- </view>
- <view class="login_name"><input class="uni-input" type="password" v-model="password" focus
- :placeholder="$t('login.a3')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze2.png"></image>
- </view>
- <view class="login_name"><input class="uni-input" type="password" v-model="trade_password" focus
- :placeholder="$t('login.b3')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze2.png"></image>
- </view>
- <view class="login_name"><input class="uni-input" type="text" v-model="spread" focus
- :placeholder="$t('login.b4')" /></view>
- </view>
- <view class="login_input flex">
- <view class="login_img">
- <image src="/static/icon/ze3.png"></image>
- </view>
- <view class="login_name flex">
- <input class="uni-input width" v-model="captcha" focus :placeholder="$t('login.b6')" />
- <view class="code" @click="verification">{{ countDown == 0 ? $t('login.b5') : countDown }}</view>
- </view>
- </view>
- <view><button type="green" @click="register" class="uni-button uni-button-green">{{$t('login.a7')}}</button>
- </view>
- <view><button class="uni-button uni-button-green uni-button-green-plain" type="green" plain="true"
- hover-class="none" @click="login">{{$t('login.a4')}}</button></view>
- </view>
- </view>
- </template>
- <script>
- import {
- register,
- verify
- } from '@/api/login.js';
- // #ifdef H5
- import {
- getAppVersion
- } from '@/api/index.js'
- // #endif
- export default {
- data() {
- return {
- // phone: '', //用户
- account: '', //用户
- password: '', //密码
- repassword: '',
- // invitation: '', //邀请码
- spread: '', //邀请码
- captcha: '', //验证码
- time: '', //保存倒计时对象
- countDown: 0, //倒计时
- trade_password: '', // 交易密码
- isPhone: true, //是否为手机号,默认为true
- store_name:''
- };
- },
- onLoad(option) {
- uni.setNavigationBarTitle({
- title: this.$t("login.a7"),
- });
- // #ifndef MP
- if (option.spread) {
- // 存储其他邀请人
- uni.setStorageSync('spread', option.spread);
- }
- // #endif
- // #ifdef MP
- if (option.scene) {
- // 存储小程序邀请人
- uni.setStorage({
- key: 'spread_code',
- data: option.scene
- });
- }
- // #endif
- // 获取扫码邀请人id
- this.spread = option.spread || uni.getStorageSync('spread') || '';
- },
- watch: {
- // 监听倒计时
- countDown(i) {
- if (i == 0) {
- clearInterval(this.time);
- }
- }
- },
- methods: {
- // #ifdef H5
- domApp(type) {
- const bool = navigator.userAgent.toLowerCase().match(/MicroMessenger/i) == 'micromessenger';
- if (bool) {
- uni.showModal({
- // title: '提示',
- title: this.$t("enter.a7"),
- // content: '无法在微信中下载,请用浏览器打开下载',
- content: this.$t("login.c2"),
- showCancel: false,
- });
- } else {
- if (type == 'apk') {
- getAppVersion().then((res) => {
- console.log(res, 'res');
- window.open(res.data.apk);
- }).catch((err) => {
- console.log(err, 'err');
- })
- return
- }
- if(type=="ios"){
- window.open("/index/dom/iosdom.mobileconfig");
- }
- }
- },
- // #endif
- checkAccount() {
- const regPhone = /^1[3|4|5|7|8][0-9]{9}$/;
- const regEmail = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
- this.isPhone = regPhone.test(this.account);
- },
- // 注册
- register() {
- let obj = this;
- if (obj.account == '') {
- obj.$api.msg(obj.$t("login.a1"));
- return;
- }
- if (this.isPhone) {
- if (!/^1[3|4|5|7|8][0-9]{9}$/.test(this.account)) {
- this.$api.msg(obj.$t("safe.b8"));
- return;
- }
- } else {
- if (!/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/.test(this.account)) {
- this.$api.msg(obj.$t("login.b9"));
- return;
- }
- }
- if(!this.store_name){
- this.$api.msg("请输入商户名称");
- }
- if (obj.password == '') {
- obj.$api.msg(obj.$t("reg.a9"));
- return;
- }
- if (obj.trade_password == '') {
- obj.$api.msg(obj.$t("login.b3"));
- return;
- }
- register({
- account: obj.account, //账号
- captcha: obj.captcha, //验证码
- password: obj.password, //密码
- trade_password: obj.trade_password, // 交易密码
- spread: obj.spread ,//上级推广人
- store_name:obj.store_name
- }).then(function(e) {
- // uni.showToast({
- // title: obj.$t("reg.c5"),
- // duration: 2000,
- // position: 'top'
- // });
- uni.showModal({
- title: obj.$t("enter.a7"),
- content: obj.$t("login.c3"),
- cancelText: obj.$t("zy.b4"),
- confirmText: obj.$t("zy.b3"),
- success: res => {
- if(res.confirm){
- uni.navigateTo({
- url: '/pages/public/login'
- });
- }
- },
- fail: () => {},
- complete: () => {}
- });
- });
- //调用注册接口,成功跳转登录页
- },
- //发送验证码
- verification() {
- let obj = this;
- if (this.account == '') {
- this.$api.msg(obj.$t("login.a1"));
- return;
- }
- if (this.account.length < 11) {
- this.$api.msg(obj.$t("safe.b8"));
- return;
- }
- // 判断是否在倒计时
- if (obj.countDown > 0) {
- return false;
- } else {
- obj.countDown = 60;
- obj.time = setInterval(() => {
- obj.countDown--;
- }, 1000);
- //调用验证码接口
- verify({
- phone: obj.account,
- type: 'register'
- })
- .then(({
- data
- }) => {})
- .catch(err => {
- console.log(err);
- });
- }
- },
- login() {
- //返回登录
- uni.navigateTo({
- url: '/pages/public/login'
- });
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- background-size: 100% 100%;
- background-image: url("../../static/img/loginBg.png");
- background-repeat: no-repeat;
- }
- .container_text {
- width: 100%;
- text-align: center;
- .banner-img {
- width: 144rpx;
- margin-top: 100rpx;
- }
- }
- .login_text {
- margin: auto 10rpx;
- position: relative;
- padding: 100rpx 72rpx;
- border-radius: 20rpx;
- .login_input {
- border-bottom: 1px solid #f0f0f0;
- margin-bottom: 65rpx;
- .login_img image {
- height: 35rpx;
- width: 29rpx;
- // padding-right: 20rpx;
- }
- .uni-input {
- text-align: left;
- width: 100%;
- font-size: 28rpx !important;
- }
- .input-placeholder{
- color: #FFF;
- }
-
- .login_name {
- color: #FFFFFF;
- flex-grow: 1;
- margin-left: 20rpx;
- }
- }
- .other {
- margin-top: 60rpx;
- .fenge {
- width: 30%;
- height: 2rpx;
- background-color: #eeeeee;
- }
- .qita {
- font-size: 28rpx;
- color: #999999;
- }
- }
- // .weixin {
- // width: 75rpx;
- // height: 75rpx;
- // margin: 25rpx auto;
- // }
- // .weixin image {
- // width: 100%;
- // height: 100%;
- // }
- // .weixin_text {
- // text-align: center;
- // font-size: 28rpx;
- // color: #999999;
- // }
- .forget {
- font-size: 28rpx;
- width: 100%;
- text-align: right;
- color: #999999;
- }
- /* #ifdef H5 */
- .loadapp {
- border: 1px solid #feb041;
- background-color: transparent;
- color: #feb041;
- width: 45%;
- }
- /* #endif */
- .uni-button-green {
- color: #1257FE;
- background-color: #FFF;
- margin: 40rpx 0rpx;
- border-radius: 10rpx;
- }
-
- .uni-button-green-plain {
- border: 1px solid #FFF;
- margin: 40rpx 0rpx;
- border-radius: 10rpx;
- color: #FFF;
- background-color: transparent;
- }
- .uni-button {
- height: 85rpx;
- line-height: 85rpx;
- }
- }
- .loginTitle {
- position: absolute;
- top: 250rpx;
- width: 100%;
- text-align: center;
- color: #c6a674;
- font-size: 40rpx;
- }
- .forget {
- width: 100rpx;
- font-size: 24rpx;
- color: #ffffff;
- margin: 0px auto;
- border-bottom: 1px solid #ffffff;
- }
- .width {
- width: 325rpx !important;
- }
- .code {
- color: #FFF;
- font-size: 23rpx;
- border-left: 1px solid #eeeeee;
- width: 150rpx;
- flex-shrink: 0;
- text-align: center;
- }
- uni-button {
- height: 80rpx !important;
- line-height: 80rpx !important;
- }
- </style>
|