Merge branch 'ymf' of https://newgitea.sxczgkj.cn/czg_team/cashier-ipad into ymf
This commit is contained in:
commit
e8c93e8ddb
256
App.vue
256
App.vue
|
|
@ -25,135 +25,135 @@ App.vue本身不是页面,这里不能编写视图元素,也就是没有<tem
|
||||||
uni.hideTabBar()
|
uni.hideTabBar()
|
||||||
//#ifdef APP-PLUS
|
//#ifdef APP-PLUS
|
||||||
//获取当前系统版本信息
|
//获取当前系统版本信息
|
||||||
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
|
// plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
|
||||||
//请求后台接口 解析数据 对比版本
|
// //请求后台接口 解析数据 对比版本
|
||||||
console.log("widgetInfo==",widgetInfo)
|
// console.log("widgetInfo==",widgetInfo)
|
||||||
getFindBySource({source:'点餐宝'}).then(res => {
|
// getFindBySource({source:'点餐宝'}).then(res => {
|
||||||
if (res.url && widgetInfo.version < res.version) {
|
// if (res.url && widgetInfo.version < res.version) {
|
||||||
let downloadLink = res.url;
|
// let downloadLink = res.url;
|
||||||
console.log(downloadLink)
|
// console.log(downloadLink)
|
||||||
let ready = false;
|
// let ready = false;
|
||||||
// 校验是否强制升级
|
// // 校验是否强制升级
|
||||||
if (res.isUp == 1) {
|
// if (res.isUp == 1) {
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
showCancel: false,
|
// showCancel: false,
|
||||||
title: '发现新版本',
|
// title: '发现新版本',
|
||||||
confirmText: '立即更新',
|
// confirmText: '立即更新',
|
||||||
content: res.message,
|
// content: res.message,
|
||||||
success: res => {
|
// success: res => {
|
||||||
if (res.confirm) {
|
// if (res.confirm) {
|
||||||
uni.showLoading({title:'下载中...'});
|
// uni.showLoading({title:'下载中...'});
|
||||||
if (uni.getSystemInfoSync().platform ==
|
// if (uni.getSystemInfoSync().platform ==
|
||||||
'android') {
|
// 'android') {
|
||||||
uni.hideLoading()
|
// uni.hideLoading()
|
||||||
uni.downloadFile({
|
// uni.downloadFile({
|
||||||
url: downloadLink,
|
// url: downloadLink,
|
||||||
success: downloadResult => {
|
// success: downloadResult => {
|
||||||
uni.hideLoading()
|
// uni.hideLoading()
|
||||||
if (downloadResult.statusCode === 200) {
|
// if (downloadResult.statusCode === 200) {
|
||||||
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
|
// plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
|
||||||
entry.getParent(_oldFile=>{
|
// entry.getParent(_oldFile=>{
|
||||||
entry.moveTo(_oldFile,'.apk',newFilePath=>{
|
// entry.moveTo(_oldFile,'.apk',newFilePath=>{
|
||||||
console.log('newFilePath',newFilePath.fullPath)
|
// console.log('newFilePath',newFilePath.fullPath)
|
||||||
plus.runtime
|
// plus.runtime
|
||||||
.install(newFilePath.fullPath, { force: false },
|
// .install(newFilePath.fullPath, { force: false },
|
||||||
d => {
|
// d => {
|
||||||
console
|
// console
|
||||||
.log(
|
// .log(
|
||||||
'install success...'
|
// 'install success...'
|
||||||
);
|
// );
|
||||||
plus.runtime
|
// plus.runtime
|
||||||
.restart();
|
// .restart();
|
||||||
},
|
// },
|
||||||
e => {
|
// e => {
|
||||||
console.log(e)
|
// console.log(e)
|
||||||
console
|
// console
|
||||||
.error(
|
// .error(
|
||||||
'install fail...'
|
// 'install fail...'
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
if (uni.getSystemInfoSync().platform ==
|
// if (uni.getSystemInfoSync().platform ==
|
||||||
'ios') {
|
// 'ios') {
|
||||||
plus.runtime.openURL(downloadLink, function(
|
// plus.runtime.openURL(downloadLink, function(
|
||||||
res) {});
|
// res) {});
|
||||||
}
|
// }
|
||||||
} else if (res.cancel) {
|
// } else if (res.cancel) {
|
||||||
console.log('取消');
|
// console.log('取消');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: '发现新版本',
|
// title: '发现新版本',
|
||||||
confirmText: '立即更新',
|
// confirmText: '立即更新',
|
||||||
cancelText: '下次更新',
|
// cancelText: '下次更新',
|
||||||
content: res.message,
|
// content: res.message,
|
||||||
success: res => {
|
// success: res => {
|
||||||
if (res.confirm) {
|
// if (res.confirm) {
|
||||||
uni.showLoading({title:'下载中...'});
|
// uni.showLoading({title:'下载中...'});
|
||||||
if (uni.getSystemInfoSync().platform ==
|
// if (uni.getSystemInfoSync().platform ==
|
||||||
'android') {
|
// 'android') {
|
||||||
uni.downloadFile({
|
// uni.downloadFile({
|
||||||
url: downloadLink,
|
// url: downloadLink,
|
||||||
success: downloadResult => {
|
// success: downloadResult => {
|
||||||
if (downloadResult
|
// if (downloadResult
|
||||||
.statusCode ===
|
// .statusCode ===
|
||||||
200) {
|
// 200) {
|
||||||
plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
|
// plus.io.resolveLocalFileSystemURL(downloadResult.tempFilePath, entry => {
|
||||||
entry.getParent(_oldFile=>{
|
// entry.getParent(_oldFile=>{
|
||||||
entry.moveTo(_oldFile,'.apk',newFilePath=>{
|
// entry.moveTo(_oldFile,'.apk',newFilePath=>{
|
||||||
console.log('newFilePath',newFilePath.fullPath)
|
// console.log('newFilePath',newFilePath.fullPath)
|
||||||
plus.runtime
|
// plus.runtime
|
||||||
.install(newFilePath.fullPath, { force: false },
|
// .install(newFilePath.fullPath, { force: false },
|
||||||
d => {
|
// d => {
|
||||||
console
|
// console
|
||||||
.log(
|
// .log(
|
||||||
'install success...'
|
// 'install success...'
|
||||||
);
|
// );
|
||||||
plus.runtime
|
// plus.runtime
|
||||||
.restart();
|
// .restart();
|
||||||
},
|
// },
|
||||||
e => {
|
// e => {
|
||||||
console.log(e)
|
// console.log(e)
|
||||||
console
|
// console
|
||||||
.error(
|
// .error(
|
||||||
'install fail...'
|
// 'install fail...'
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
if (uni.getSystemInfoSync().platform ==
|
// if (uni.getSystemInfoSync().platform ==
|
||||||
'ios') {
|
// 'ios') {
|
||||||
plus.runtime.openURL(downloadLink, function(
|
// plus.runtime.openURL(downloadLink, function(
|
||||||
res) {});
|
// res) {});
|
||||||
}
|
// }
|
||||||
} else if (res.cancel) {
|
// } else if (res.cancel) {
|
||||||
uni.hideLoading()
|
// uni.hideLoading()
|
||||||
console.log('取消');
|
// console.log('取消');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}).catch((res)=>{
|
// }).catch((res)=>{
|
||||||
console.log(res)
|
// console.log(res)
|
||||||
})
|
// })
|
||||||
});
|
// });
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const appConfig = {
|
||||||
|
|
||||||
// 环境变量相关
|
// 环境变量相关
|
||||||
env: {},
|
env: {},
|
||||||
wss: "ws://192.168.1.42:2348", //
|
wss: "ws://192.168.1.42:2348", // ws://192.168.1.42:2348
|
||||||
// wss: "wss://sockets.sxczgkj.com/wss", //
|
// wss: "wss://sockets.sxczgkj.com/wss", //
|
||||||
// 环境变量常量
|
// 环境变量常量
|
||||||
ENV_ENUM: {
|
ENV_ENUM: {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
"js-base64": "^3.7.2",
|
"js-base64": "^3.7.2",
|
||||||
"jsencrypt": "^3.3.2",
|
"jsencrypt": "^3.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"uview-plus": "^3.3.32"
|
"uview-plus": "^3.3.32",
|
||||||
|
"ysk-utils": "^1.0.50"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"copy-webpack-plugin": "^12.0.2",
|
"copy-webpack-plugin": "^12.0.2",
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="login-wrapper">
|
<view class="login-wrapper">
|
||||||
|
|
||||||
|
|
||||||
<view class="login-top">
|
<view class="login-top">
|
||||||
<text>欢迎回来,请登录</text>
|
<text>欢迎回来,请登录</text>
|
||||||
<image @tap="envChangeTipsRef.tapFunc()" style="width: 320rpx; height: 76rpx"
|
<image @tap="envChangeTipsRef.tapFunc()" style="width: 320rpx; height: 76rpx" :src="vdata.siteInfos.appTopImgUrl" />
|
||||||
:src="vdata.siteInfos.appTopImgUrl" />
|
|
||||||
</view>
|
</view>
|
||||||
<view class="login-bottom jeepay-form">
|
<view class="login-bottom jeepay-form">
|
||||||
|
|
||||||
<!-- 不需要label, 需要修改: label-width="0" -->
|
<!-- 不需要label, 需要修改: label-width="0" -->
|
||||||
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
|
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
|
||||||
<view class="u-p-b-30">
|
<view class="u-p-b-30">
|
||||||
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list"
|
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list" textKey="label"></my-tabs>
|
||||||
textKey="label"></my-tabs>
|
|
||||||
</view>
|
</view>
|
||||||
<view v-if="vdata.loginType == 'pwd'">
|
<view v-if="vdata.loginType == 'pwd'">
|
||||||
<template v-if="accountType.sel == 1">
|
<template v-if="accountType.sel == 1">
|
||||||
<uni-forms-item name="merchantName">
|
<uni-forms-item name="merchantName">
|
||||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入商户号"
|
<uni-easyinput class="jeepay-easyinput" placeholder="请输入商户号" v-model="vdata.formData.merchantName" :clearable="false">
|
||||||
v-model="vdata.formData.merchantName" :clearable="false">
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -28,8 +22,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<uni-forms-item name="username">
|
<uni-forms-item name="username">
|
||||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
|
<uni-easyinput class="jeepay-easyinput" placeholder="请输入登录名/手机号" v-model="vdata.formData.username" :clearable="false">
|
||||||
v-model="vdata.formData.username" :clearable="false">
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -37,13 +30,18 @@
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
|
||||||
<uni-forms-item name="pwd">
|
<uni-forms-item name="pwd">
|
||||||
<uni-easyinput class='jeepay-easyinput' :type="vdata.isShowPwd ? 'text' : 'password'"
|
<uni-easyinput
|
||||||
v-model="vdata.formData.pwd" :clearable="false" placeholder="请输入登录密码">
|
class="jeepay-easyinput"
|
||||||
|
:type="vdata.isShowPwd ? 'text' : 'password'"
|
||||||
|
v-model="vdata.formData.pwd"
|
||||||
|
:clearable="false"
|
||||||
|
placeholder="请输入登录密码"
|
||||||
|
>
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-pw.svg" class="input-icon" />
|
<image src="@/static/login/icon-pw.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
<template #suffixIcon>
|
<template #suffixIcon>
|
||||||
<view class='show-tips' @tap="vdata.isShowPwd = !vdata.isShowPwd ">
|
<view class="show-tips" @tap="vdata.isShowPwd = !vdata.isShowPwd">
|
||||||
{{ vdata.isShowPwd ? '隐藏' : '显示' }}
|
{{ vdata.isShowPwd ? '隐藏' : '显示' }}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -52,60 +50,57 @@
|
||||||
|
|
||||||
<uni-forms-item name="code">
|
<uni-forms-item name="code">
|
||||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||||
<view style="display: flex;" class="u-flex u-flex-y-center">
|
<view style="display: flex" class="u-flex u-flex-y-center">
|
||||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码"
|
<uni-easyinput class="jeepay-easyinput" :maxlength="6" placeholder="请输入验证码" v-model="vdata.formData.code" :clearable="false">
|
||||||
v-model="vdata.formData.code" :clearable="false">
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
<image :src="vdata.formData.img" class=" u-m-b-50"
|
<image :src="vdata.formData.img" class="u-m-b-50" style="width: 200rpx; height: 80rpx; margin-left: 10rpx" @click="getCode" mode=""></image>
|
||||||
style="width: 200rpx; height: 80rpx;margin-left: 10rpx;" @click="getCode" mode="">
|
|
||||||
</image>
|
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="vdata.loginType == 'sms'">
|
<view v-if="vdata.loginType == 'sms'">
|
||||||
<uni-forms-item name="loginPhone">
|
<uni-forms-item name="loginPhone">
|
||||||
<uni-easyinput class='jeepay-easyinput' v-model="vdata.formData.loginPhone" type="number"
|
<uni-easyinput
|
||||||
:maxlength="11" :disabled="!vdata.allowSendMsgFlag" placeholder="请输入手机号" :clearable="false">
|
class="jeepay-easyinput"
|
||||||
|
v-model="vdata.formData.loginPhone"
|
||||||
|
type="number"
|
||||||
|
:maxlength="11"
|
||||||
|
:disabled="!vdata.allowSendMsgFlag"
|
||||||
|
placeholder="请输入手机号"
|
||||||
|
:clearable="false"
|
||||||
|
>
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-phone.svg" class="input-icon" />
|
<image src="@/static/login/icon-phone.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
<template #suffixIcon>
|
<template #suffixIcon>
|
||||||
<view class='show-tips' @tap="sendSmscodeFunc">{{ vdata.sendMsgText }}</view>
|
<view class="show-tips" @tap="sendSmscodeFunc">{{ vdata.sendMsgText }}</view>
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item>
|
<uni-forms-item>
|
||||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||||
<view style="display: flex;">
|
<view style="display: flex">
|
||||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码"
|
<uni-easyinput class="jeepay-easyinput" :maxlength="6" placeholder="请输入验证码" v-model="vdata.formData.vercode" :clearable="false">
|
||||||
v-model="vdata.formData.vercode" :clearable="false">
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
<image :src="vdata.formData.imgCodeUrl"
|
<image :src="vdata.formData.imgCodeUrl" style="width: 200rpx; height: 110rpx; margin-left: 10rpx" @click="getCode" mode=""></image>
|
||||||
style="width: 200rpx; height: 110rpx;margin-left: 10rpx;" @click="getCode" mode="">
|
|
||||||
</image>
|
|
||||||
</view>
|
</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
|
||||||
<uni-forms-item name="smsCode">
|
<uni-forms-item name="smsCode">
|
||||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入手机验证码"
|
<uni-easyinput class="jeepay-easyinput" :maxlength="6" placeholder="请输入手机验证码" v-model="vdata.formData.smsCode" :clearable="false">
|
||||||
v-model="vdata.formData.smsCode" :clearable="false">
|
|
||||||
<template #prefixIcon>
|
<template #prefixIcon>
|
||||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||||
</template>
|
</template>
|
||||||
</uni-easyinput>
|
</uni-easyinput>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
|
|
||||||
<!-- <view class="agreement-policy">
|
<!-- <view class="agreement-policy">
|
||||||
|
|
@ -116,7 +111,6 @@
|
||||||
<text class="policy" @click="toPrivacy">《隐私政策》</text>
|
<text class="policy" @click="toPrivacy">《隐私政策》</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
<!-- <view class="agreement-policy">
|
<!-- <view class="agreement-policy">
|
||||||
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
||||||
同意
|
同意
|
||||||
|
|
@ -126,7 +120,6 @@
|
||||||
<text class="policy" @click="go.to('PAGES_STATIC_POLICY')">《隐私政策》</text>
|
<text class="policy" @click="go.to('PAGES_STATIC_POLICY')">《隐私政策》</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
|
|
||||||
<Button @tap="loginFunc">登录</Button>
|
<Button @tap="loginFunc">登录</Button>
|
||||||
|
|
||||||
<!-- <view class="register-box">
|
<!-- <view class="register-box">
|
||||||
|
|
@ -139,92 +132,68 @@
|
||||||
{{ vdata.loginType == 'pwd' ? '短信验证码登录' : '账号密码登录' }}
|
{{ vdata.loginType == 'pwd' ? '短信验证码登录' : '账号密码登录' }}
|
||||||
<image src="@/static/login/icon-arrow-left.svg"></image>
|
<image src="@/static/login/icon-arrow-left.svg"></image>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<JAgree service="PAGES_STATIC_AGREEMENT" privacy="PAGES_FORGET_PASSWORD" ref="refAgr"
|
<JAgree service="PAGES_STATIC_AGREEMENT" privacy="PAGES_FORGET_PASSWORD" ref="refAgr" @agree="vdata.isSelectedAgreement = true" />
|
||||||
@agree="vdata.isSelectedAgreement = true" />
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { encrypt } from '@/commons/utils/rsaEncrypt.js';
|
||||||
encrypt
|
|
||||||
} from '@/commons/utils/rsaEncrypt.js'
|
|
||||||
|
|
||||||
import {
|
import { ref, reactive, onMounted, watch } from 'vue';
|
||||||
ref,
|
import { $loginByPwd, $phoneCodeLogin, $userInfo, $sendSms, $getSiteInfos, $getUploadImgSize, $isCode } from '@/http/apiManager.js';
|
||||||
reactive,
|
import storageManage from '@/commons/utils/storageManage.js';
|
||||||
onMounted,
|
|
||||||
watch
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
$loginByPwd,
|
|
||||||
$phoneCodeLogin,
|
|
||||||
$userInfo,
|
|
||||||
$sendSms,
|
|
||||||
$getSiteInfos,
|
|
||||||
$getUploadImgSize,
|
|
||||||
$isCode
|
|
||||||
} from '@/http/apiManager.js';
|
|
||||||
import storageManage from '@/commons/utils/storageManage.js'
|
|
||||||
import infoBox from '@/commons/utils/infoBox.js';
|
import infoBox from '@/commons/utils/infoBox.js';
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js';
|
||||||
import timer from '@/commons/utils/timer.js'
|
import timer from '@/commons/utils/timer.js';
|
||||||
import formUtil from '@/commons/utils/formUtil.js'
|
import formUtil from '@/commons/utils/formUtil.js';
|
||||||
import Button from '@/components/Button/Button.vue'
|
import Button from '@/components/Button/Button.vue';
|
||||||
import {
|
import { getExtStoreId } from '@/commons/utils/versionManage.js';
|
||||||
getExtStoreId
|
import { $login } from '@/http/newApi/login.js';
|
||||||
} from "@/commons/utils/versionManage.js"
|
import { login, getCodeImg } from '@/http/yskApi/login.js';
|
||||||
import {
|
|
||||||
$login
|
|
||||||
} from '@/http/newApi/login.js';
|
|
||||||
import {
|
|
||||||
login,
|
|
||||||
getCodeImg
|
|
||||||
} from '@/http/yskApi/login.js';
|
|
||||||
|
|
||||||
const accountType = reactive({
|
const accountType = reactive({
|
||||||
list: [{
|
list: [
|
||||||
|
{
|
||||||
label: '商户',
|
label: '商户',
|
||||||
value: '0'
|
value: '0'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '员工',
|
label: '员工',
|
||||||
value: '1'
|
value: '1'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
sel: 0
|
sel: 0
|
||||||
})
|
});
|
||||||
|
|
||||||
const loginFormRef = ref()
|
const loginFormRef = ref();
|
||||||
const envChangeTipsRef = ref()
|
const envChangeTipsRef = ref();
|
||||||
const refAgr = ref()
|
const refAgr = ref();
|
||||||
const rules = {
|
const rules = {
|
||||||
merchantName: {
|
merchantName: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('商户号')],
|
rules: [formUtil.rules.requiredInputShowToast('商户号')]
|
||||||
},
|
},
|
||||||
username: {
|
username: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('用户名')],
|
rules: [formUtil.rules.requiredInputShowToast('用户名')]
|
||||||
},
|
},
|
||||||
pwd: {
|
pwd: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('密码')],
|
rules: [formUtil.rules.requiredInputShowToast('密码')]
|
||||||
},
|
},
|
||||||
safetyCode: {
|
safetyCode: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('安全码')],
|
rules: [formUtil.rules.requiredInputShowToast('安全码')]
|
||||||
},
|
},
|
||||||
code: {
|
code: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('验证码')],
|
rules: [formUtil.rules.requiredInputShowToast('验证码')]
|
||||||
},
|
},
|
||||||
loginPhone: {
|
loginPhone: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('手机号')],
|
rules: [formUtil.rules.requiredInputShowToast('手机号')]
|
||||||
},
|
},
|
||||||
|
|
||||||
smsCode: {
|
smsCode: {
|
||||||
rules: [formUtil.rules.requiredInputShowToast('短信验证码')],
|
rules: [formUtil.rules.requiredInputShowToast('短信验证码')]
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const vdata = reactive({
|
const vdata = reactive({
|
||||||
|
|
||||||
isShowPwd: false, // 是否显示密码
|
isShowPwd: false, // 是否显示密码
|
||||||
loginType: 'pwd', // 类型切换: pwd or sms
|
loginType: 'pwd', // 类型切换: pwd or sms
|
||||||
isShowSafetyCode: false, // 是否显示安全码输入框
|
isShowSafetyCode: false, // 是否显示安全码输入框
|
||||||
|
|
@ -242,12 +211,11 @@
|
||||||
uuid: '',
|
uuid: '',
|
||||||
merchantName: '',
|
merchantName: '',
|
||||||
loginType: 'merchant'
|
loginType: 'merchant'
|
||||||
},
|
}
|
||||||
|
});
|
||||||
})
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
vdata.formData.username = 'xpc'
|
vdata.formData.username = 'xpc';
|
||||||
vdata.formData.pwd = '123'
|
vdata.formData.pwd = '123';
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// vdata.formData.username = '15699991111'
|
// vdata.formData.username = '15699991111'
|
||||||
|
|
@ -257,23 +225,29 @@
|
||||||
function accountTypeChange(e) {
|
function accountTypeChange(e) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (e == 1) {
|
if (e == 1) {
|
||||||
vdata.formData.merchantName = '18049104914'
|
vdata.formData.merchantName = '18049104914';
|
||||||
vdata.formData.username = '13666666666'
|
vdata.formData.username = '13666666666';
|
||||||
vdata.formData.pwd = '123456'
|
vdata.formData.pwd = '123456';
|
||||||
} else {
|
} else {
|
||||||
vdata.formData.pwd = 'qwer1234'
|
vdata.formData.pwd = 'qwer1234';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCode = () => {
|
const getCode = async () => {
|
||||||
getCodeImg().then(res => {
|
try {
|
||||||
vdata.formData.img = res.data.code
|
const res = await getCodeImg();
|
||||||
vdata.formData.uuid = res.data.uuid
|
vdata.formData.img = res.data.code;
|
||||||
})
|
vdata.formData.uuid = res.data.uuid;
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: error.message,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
getCode()
|
getCode();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// getExtStoreId()
|
// getExtStoreId()
|
||||||
|
|
@ -286,12 +260,12 @@
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
// 获取商户信息,有就回显
|
// 获取商户信息,有就回显
|
||||||
let info = uni.getStorageSync('MerchantId')
|
let info = uni.getStorageSync('MerchantId');
|
||||||
if (info.merchantName) {
|
if (info.merchantName) {
|
||||||
vdata.formData.merchantName = info.merchantName
|
vdata.formData.merchantName = info.merchantName;
|
||||||
vdata.formData.username = info.username
|
vdata.formData.username = info.username;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// 切换登录方式
|
// 切换登录方式
|
||||||
function changeLoginType() {
|
function changeLoginType() {
|
||||||
|
|
@ -306,7 +280,8 @@
|
||||||
// return false
|
// return false
|
||||||
// }
|
// }
|
||||||
let loginPromise = null;
|
let loginPromise = null;
|
||||||
if (vdata.loginType == 'pwd') { // 用户名密码登录
|
if (vdata.loginType == 'pwd') {
|
||||||
|
// 用户名密码登录
|
||||||
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
|
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
|
||||||
loginPromise = login({
|
loginPromise = login({
|
||||||
username: vdata.formData.username,
|
username: vdata.formData.username,
|
||||||
|
|
@ -317,35 +292,35 @@
|
||||||
uuid: vdata.formData.uuid,
|
uuid: vdata.formData.uuid,
|
||||||
merchantName: vdata.formData.merchantName,
|
merchantName: vdata.formData.merchantName,
|
||||||
loginType: accountType.list[accountType.sel].value
|
loginType: accountType.list[accountType.sel].value
|
||||||
})
|
});
|
||||||
|
} else if (vdata.loginType == 'sms') {
|
||||||
} else if (vdata.loginType == 'sms') { // 短信验证码登录
|
// 短信验证码登录
|
||||||
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode)
|
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loginPromise == null) {
|
if (loginPromise == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 请求后的操作
|
// 请求后的操作
|
||||||
loginPromise.then(res => {
|
loginPromise
|
||||||
|
.then((res) => {
|
||||||
// 登录成功
|
// 登录成功
|
||||||
loginFinishFunc(res.data)
|
loginFinishFunc(res.data);
|
||||||
// 保存商户号
|
// 保存商户号
|
||||||
uni.setStorageSync('MerchantId', {
|
uni.setStorageSync('MerchantId', {
|
||||||
merchantName: vdata.formData.merchantName,
|
merchantName: vdata.formData.merchantName,
|
||||||
username: vdata.formData.username,
|
username: vdata.formData.username
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}).catch(e => {
|
.catch((e) => {
|
||||||
getCode()
|
getCode();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
const toPrivacy = () => {
|
const toPrivacy = () => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
go.to('PAGES_STATIC_POLICY')
|
go.to('PAGES_STATIC_POLICY');
|
||||||
// #endif
|
// #endif
|
||||||
// 打开小程序隐私政策
|
// 打开小程序隐私政策
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
|
|
@ -354,27 +329,30 @@
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '打开失败请稍后重试', // 打开失败
|
title: '打开失败请稍后重试', // 打开失败
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
},
|
}
|
||||||
})
|
});
|
||||||
// #endif
|
// #endif
|
||||||
}
|
};
|
||||||
watch(() => accountType.sel, (newval) => {
|
watch(
|
||||||
|
() => accountType.sel,
|
||||||
|
(newval) => {
|
||||||
if (newval == 1) {
|
if (newval == 1) {
|
||||||
vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
|
vdata.formData.merchantName = uni.getStorageSync('merchantName') || '';
|
||||||
} else {
|
} else {
|
||||||
vdata.formData.username = ''
|
vdata.formData.username = '';
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
);
|
||||||
// 封装登录成功后的操作
|
// 封装登录成功后的操作
|
||||||
async function loginFinishFunc(loginBizData) {
|
async function loginFinishFunc(loginBizData) {
|
||||||
// 保存 token
|
// 保存 token
|
||||||
uni.setStorageSync('shopInfo',loginBizData.shopInfo)
|
uni.setStorageSync('shopInfo', loginBizData.shopInfo);
|
||||||
uni.setStorageSync('tokenInfo',loginBizData.tokenInfo)
|
uni.setStorageSync('tokenInfo', loginBizData.tokenInfo);
|
||||||
uni.setStorageSync('shopId',loginBizData.shopInfo.id)
|
uni.setStorageSync('shopId', loginBizData.shopInfo.id);
|
||||||
uni.setStorageSync('loginType',loginBizData.loginType)
|
uni.setStorageSync('loginType', loginBizData.loginType);
|
||||||
// 跳转到首页
|
// 跳转到首页
|
||||||
go.to("PAGES_CREATE_ORDER")
|
go.to('PAGES_CREATE_ORDER');
|
||||||
// uni.navigateTo({
|
// uni.navigateTo({
|
||||||
// url:'pagesCreateOrder/index/index'
|
// url:'pagesCreateOrder/index/index'
|
||||||
// })
|
// })
|
||||||
|
|
@ -389,41 +367,39 @@
|
||||||
|
|
||||||
// 验证失败
|
// 验证失败
|
||||||
if (!formUtil.regexp.mobile.test(vdata.formData.loginPhone)) {
|
if (!formUtil.regexp.mobile.test(vdata.formData.loginPhone)) {
|
||||||
return infoBox.showToast("请输入正确的手机号")
|
return infoBox.showToast('请输入正确的手机号');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vdata.formData.vercode) {
|
if (!vdata.formData.vercode) {
|
||||||
return infoBox.showToast("请输入图像验证码");
|
return infoBox.showToast('请输入图像验证码');
|
||||||
}
|
}
|
||||||
|
|
||||||
vdata.allowSendMsgFlag = false; // 按钮禁用
|
vdata.allowSendMsgFlag = false; // 按钮禁用
|
||||||
|
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
phone: vdata.formData.loginPhone,
|
phone: vdata.formData.loginPhone,
|
||||||
vercode: vdata.formData.vercode,
|
vercode: vdata.formData.vercode,
|
||||||
vercodeToken: vdata.formData.vercodeToken,
|
vercodeToken: vdata.formData.vercodeToken
|
||||||
}
|
};
|
||||||
|
|
||||||
// 发送短信验证码
|
// 发送短信验证码
|
||||||
$sendSms(data, 'auth').then(({
|
$sendSms(data, 'auth')
|
||||||
bizData
|
.then(({ bizData }) => {
|
||||||
}) => {
|
infoBox.showSuccessToast('验证码发送成功');
|
||||||
infoBox.showSuccessToast('验证码发送成功')
|
|
||||||
timer.startTimeoutTask(1, 60, (subTime) => {
|
timer.startTimeoutTask(1, 60, (subTime) => {
|
||||||
|
if (subTime <= 0) {
|
||||||
if (subTime <= 0) { // 任务结束
|
// 任务结束
|
||||||
vdata.sendMsgText = '发送验证码'
|
vdata.sendMsgText = '发送验证码';
|
||||||
vdata.allowSendMsgFlag = true;
|
vdata.allowSendMsgFlag = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vdata.sendMsgText = `${subTime}s后可重新发送`
|
vdata.sendMsgText = `${subTime}s后可重新发送`;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
.catch(() => {
|
||||||
vdata.allowSendMsgFlag = true;
|
vdata.allowSendMsgFlag = true;
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -439,7 +415,7 @@
|
||||||
height: 376rpx;
|
height: 376rpx;
|
||||||
padding: 176rpx 70rpx 0;
|
padding: 176rpx 70rpx 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: url("/static/indexImg/user-bg.svg") center center no-repeat;
|
background: url('/static/indexImg/user-bg.svg') center center no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
|
||||||
text:first-child {
|
text:first-child {
|
||||||
|
|
@ -452,7 +428,7 @@
|
||||||
text:last-child {
|
text:last-child {
|
||||||
font-size: 50rpx;
|
font-size: 50rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #48C0FF;
|
color: #48c0ff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -477,7 +453,7 @@
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
margin-bottom: 50rpx;
|
margin-bottom: 50rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #8C8C8C;
|
color: #8c8c8c;
|
||||||
|
|
||||||
.select-box {
|
.select-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -491,7 +467,7 @@
|
||||||
|
|
||||||
.agreement,
|
.agreement,
|
||||||
.policy {
|
.policy {
|
||||||
color: #1D79FD;
|
color: #1d79fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -505,12 +481,12 @@
|
||||||
|
|
||||||
.register {
|
.register {
|
||||||
text:last-child {
|
text:last-child {
|
||||||
color: #1D79FD;
|
color: #1d79fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.forget {
|
.forget {
|
||||||
color: #1D79FD;
|
color: #1d79fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,6 @@
|
||||||
import { defineConfig } from 'vite'
|
import {
|
||||||
|
defineConfig
|
||||||
|
} from 'vite'
|
||||||
import uni from '@dcloudio/vite-plugin-uni'
|
import uni from '@dcloudio/vite-plugin-uni'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
@ -14,8 +16,8 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
"/ysk": {
|
"/ysk": {
|
||||||
// 需要被代理的后台地址
|
// 需要被代理的后台地址
|
||||||
"target" : "http://192.168.1.42",
|
target: "http://192.168.1.42",
|
||||||
"changeOrigin": true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/ysk/, '')
|
rewrite: (path) => path.replace(/^\/ysk/, '')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ module.exports = {
|
||||||
rewrite: '/' // 重写路径
|
rewrite: '/' // 重写路径
|
||||||
},
|
},
|
||||||
"/ysk": {
|
"/ysk": {
|
||||||
"target": "http://192.168.1.42",
|
target: "http://192.168.1.42",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
"^/ysk": ""
|
"^/ysk": ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue