Compare commits

..

5 Commits
master ... ymf

10 changed files with 3627 additions and 2406 deletions

256
App.vue
View File

@ -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

View File

@ -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: {

View File

@ -30,7 +30,7 @@ import {
// let baseUrl = 'https://cashier.sxczgkj.com' // let baseUrl = 'https://cashier.sxczgkj.com'
// 本地测 // 本地测
let baseUrl = "http://192.168.1.31" let baseUrl = "http://192.168.1.42"
// #ifdef H5 // #ifdef H5
baseUrl = '/ysk' baseUrl = '/ysk'
// #endif // #endif

46
package-lock.json generated
View File

@ -20,18 +20,6 @@
"sass-loader": "^10.5.2" "sass-loader": "^10.5.2"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.27.0",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.27.0.tgz",
"integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==",
"license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.8", "version": "0.3.8",
"resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz",
@ -666,18 +654,6 @@
"license": "MIT", "license": "MIT",
"peer": true "peer": true
}, },
"node_modules/copy-text-to-clipboard": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz",
"integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/copy-webpack-plugin": { "node_modules/copy-webpack-plugin": {
"version": "12.0.2", "version": "12.0.2",
"resolved": "https://registry.npmmirror.com/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", "resolved": "https://registry.npmmirror.com/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz",
@ -702,17 +678,6 @@
"webpack": "^5.1.0" "webpack": "^5.1.0"
} }
}, },
"node_modules/core-js": {
"version": "3.41.0",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.41.0.tgz",
"integrity": "sha512-SJ4/EHwS36QMJd6h/Rg+GyR4A5xE0FSI3eZ+iBVpfqf1x0eTSg1smWLHrA+2jQThZSh97fmSgFSU8B61nxosxA==",
"hasInstallScript": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/dayjs": { "node_modules/dayjs": {
"version": "1.11.13", "version": "1.11.13",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz", "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
@ -1214,11 +1179,6 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/mutation-observer": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
"integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
},
"node_modules/neo-async": { "node_modules/neo-async": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz", "resolved": "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz",
@ -1324,12 +1284,6 @@
"node": ">=8.10.0" "node": ">=8.10.0"
} }
}, },
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
"license": "MIT"
},
"node_modules/require-from-string": { "node_modules/require-from-string": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz", "resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz",

View File

@ -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",

View File

@ -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,14 +30,19 @@
</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>
</uni-easyinput> </uni-easyinput>
@ -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,395 +132,378 @@
{{ 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, import infoBox from '@/commons/utils/infoBox.js';
watch import go from '@/commons/utils/go.js';
} from 'vue'; import timer from '@/commons/utils/timer.js';
import { import formUtil from '@/commons/utils/formUtil.js';
$loginByPwd, import Button from '@/components/Button/Button.vue';
$phoneCodeLogin, import { getExtStoreId } from '@/commons/utils/versionManage.js';
$userInfo, import { $login } from '@/http/newApi/login.js';
$sendSms, import { login, getCodeImg } from '@/http/yskApi/login.js';
$getSiteInfos,
$getUploadImgSize,
$isCode
} from '@/http/apiManager.js';
import storageManage from '@/commons/utils/storageManage.js'
import infoBox from '@/commons/utils/infoBox.js';
import go from '@/commons/utils/go.js'
import timer from '@/commons/utils/timer.js'
import formUtil from '@/commons/utils/formUtil.js'
import Button from '@/components/Button/Button.vue'
import {
getExtStoreId
} from "@/commons/utils/versionManage.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: '商户', {
value: '0' label: '商户',
}, value: '0'
{ },
label: '员工', {
value: '1' label: '员工',
}, 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, //
loginType: 'pwd', // pwd or sms
isShowSafetyCode: false, //
allowSendMsgFlag: true, //
sendMsgText: '发送验证码',
isSelectedAgreement: false, //
isShowPwd: false, // siteInfos: storageManage.siteInfos() || {},
loginType: 'pwd', // pwd or sms
isShowSafetyCode: false, //
allowSendMsgFlag: true, //
sendMsgText: '发送验证码',
isSelectedAgreement: false, //
siteInfos: storageManage.siteInfos() || {}, formData: {
username: '', //
pwd: '', //
rememberMe: false,
code: '',
uuid: '',
merchantName: '',
loginType: 'merchant'
}
});
// #ifdef H5
vdata.formData.username = 'xpc';
vdata.formData.pwd = '123';
// #endif
// #ifdef MP-WEIXIN
// vdata.formData.username = '15699991111'
// vdata.formData.pwd = 'qwer1234'
// #endif
formData: { function accountTypeChange(e) {
username: '', //
pwd: '', //
rememberMe: false,
code: '',
uuid: '',
merchantName: '',
loginType: 'merchant'
},
})
// #ifdef H5 // #ifdef H5
vdata.formData.username = 'xpc' if (e == 1) {
vdata.formData.pwd = '123' vdata.formData.merchantName = '18049104914';
// #endif vdata.formData.username = '13666666666';
// #ifdef MP-WEIXIN vdata.formData.pwd = '123456';
// vdata.formData.username = '15699991111' } else {
// vdata.formData.pwd = 'qwer1234' vdata.formData.pwd = 'qwer1234';
// #endif
function accountTypeChange(e) {
// #ifdef H5
if(e==1){
vdata.formData.merchantName = '18049104914'
vdata.formData.username = '13666666666'
vdata.formData.pwd = '123456'
}else{
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()
// //
// if(!vdata.siteInfos || Object.keys(vdata.siteInfos) <= 0){ // if(!vdata.siteInfos || Object.keys(vdata.siteInfos) <= 0){
// $getSiteInfos().then( ( { bizData } ) => { // $getSiteInfos().then( ( { bizData } ) => {
// vdata.siteInfos = storageManage.siteInfos(bizData) // vdata.siteInfos = storageManage.siteInfos(bizData)
// }) // })
// }
// ,
let info = uni.getStorageSync('MerchantId');
if (info.merchantName) {
vdata.formData.merchantName = info.merchantName;
vdata.formData.username = info.username;
}
});
//
function changeLoginType() {
vdata.loginType = vdata.loginType == 'pwd' ? 'sms' : 'pwd';
}
function loginFunc() {
//
formUtil.validate(loginFormRef.value).then(() => {
// if (!vdata.isSelectedAgreement) {
// infoBox.showToast('')
// return false
// } // }
// , let loginPromise = null;
let info = uni.getStorageSync('MerchantId') if (vdata.loginType == 'pwd') {
if (info.merchantName) { //
vdata.formData.merchantName = info.merchantName // loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
vdata.formData.username = info.username loginPromise = login({
username: vdata.formData.username,
password: vdata.formData.pwd,
// password: encrypt(vdata.formData.pwd),
rememberMe: false,
code: vdata.formData.code,
uuid: vdata.formData.uuid,
merchantName: vdata.formData.merchantName,
loginType: accountType.list[accountType.sel].value
});
} else if (vdata.loginType == 'sms') {
//
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode);
} }
})
// if (loginPromise == null) {
function changeLoginType() {
vdata.loginType = vdata.loginType == 'pwd' ? 'sms' : 'pwd';
}
function loginFunc() {
//
formUtil.validate(loginFormRef.value).then(() => {
// if (!vdata.isSelectedAgreement) {
// infoBox.showToast('')
// return false
// }
let loginPromise = null;
if (vdata.loginType == 'pwd') { //
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
loginPromise = login({
username: vdata.formData.username,
password: vdata.formData.pwd,
// password: encrypt(vdata.formData.pwd),
rememberMe: false,
code: vdata.formData.code,
uuid: vdata.formData.uuid,
merchantName: vdata.formData.merchantName,
loginType: accountType.list[accountType.sel].value
})
} else if (vdata.loginType == 'sms') { //
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode)
}
if (loginPromise == null) {
return false;
}
//
loginPromise.then(res => {
//
loginFinishFunc(res.data)
//
uni.setStorageSync('MerchantId', {
merchantName: vdata.formData.merchantName,
username: vdata.formData.username,
})
}).catch(e => {
getCode()
})
})
}
const toPrivacy = () => {
// #ifdef APP-PLUS
go.to('PAGES_STATIC_POLICY')
// #endif
//
// #ifdef MP-WEIXIN
wx.openPrivacyContract({
fail: () => {
uni.showToast({
title: '打开失败请稍后重试', //
icon: 'none'
})
},
})
// #endif
}
watch(() => accountType.sel, (newval) => {
if (newval == 1) {
vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
} else {
vdata.formData.username = ''
}
})
//
async function loginFinishFunc(loginBizData) {
// token
uni.setStorageSync('shopInfo',loginBizData.shopInfo)
uni.setStorageSync('tokenInfo',loginBizData.tokenInfo)
uni.setStorageSync('shopId',loginBizData.shopInfo.id)
uni.setStorageSync('loginType',loginBizData.loginType)
//
go.to("PAGES_CREATE_ORDER")
// uni.navigateTo({
// url:'pagesCreateOrder/index/index'
// })
}
//
function sendSmscodeFunc() {
//
if (!vdata.allowSendMsgFlag) {
return false; return false;
} }
// //
if (!formUtil.regexp.mobile.test(vdata.formData.loginPhone)) { loginPromise
return infoBox.showToast("请输入正确的手机号") .then((res) => {
//
loginFinishFunc(res.data);
//
uni.setStorageSync('MerchantId', {
merchantName: vdata.formData.merchantName,
username: vdata.formData.username
});
})
.catch((e) => {
getCode();
});
});
}
const toPrivacy = () => {
// #ifdef APP-PLUS
go.to('PAGES_STATIC_POLICY');
// #endif
//
// #ifdef MP-WEIXIN
wx.openPrivacyContract({
fail: () => {
uni.showToast({
title: '打开失败请稍后重试', //
icon: 'none'
});
} }
});
if (!vdata.formData.vercode) { // #endif
return infoBox.showToast("请输入图像验证码"); };
watch(
() => accountType.sel,
(newval) => {
if (newval == 1) {
vdata.formData.merchantName = uni.getStorageSync('merchantName') || '';
} else {
vdata.formData.username = '';
} }
}
);
//
async function loginFinishFunc(loginBizData) {
// token
uni.setStorageSync('shopInfo', loginBizData.shopInfo);
uni.setStorageSync('tokenInfo', loginBizData.tokenInfo);
uni.setStorageSync('shopId', loginBizData.shopInfo.id);
uni.setStorageSync('loginType', loginBizData.loginType);
//
go.to('PAGES_CREATE_ORDER');
// uni.navigateTo({
// url:'pagesCreateOrder/index/index'
// })
}
vdata.allowSendMsgFlag = false; // //
function sendSmscodeFunc() {
//
if (!vdata.allowSendMsgFlag) {
return false;
}
//
if (!formUtil.regexp.mobile.test(vdata.formData.loginPhone)) {
return infoBox.showToast('请输入正确的手机号');
}
let data = { if (!vdata.formData.vercode) {
phone: vdata.formData.loginPhone, return infoBox.showToast('请输入图像验证码');
vercode: vdata.formData.vercode, }
vercodeToken: vdata.formData.vercodeToken,
}
// vdata.allowSendMsgFlag = false; //
$sendSms(data, 'auth').then(({
bizData let data = {
}) => { phone: vdata.formData.loginPhone,
infoBox.showSuccessToast('验证码发送成功') vercode: vdata.formData.vercode,
vercodeToken: vdata.formData.vercodeToken
};
//
$sendSms(data, 'auth')
.then(({ bizData }) => {
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(() => {
vdata.allowSendMsgFlag = true;
}) })
.catch(() => {
} vdata.allowSendMsgFlag = true;
});
}
</script> </script>
<style lang="scss"> <style lang="scss">
@import '@/commons/style/global.scss'; @import '@/commons/style/global.scss';
.login-wrapper { .login-wrapper {
min-height: 100vh; min-height: 100vh;
background-color: $v-color-bgrey; background-color: $v-color-bgrey;
.login-top { .login-top {
display: flex;
flex-direction: column;
height: 376rpx;
padding: 176rpx 70rpx 0;
box-sizing: border-box;
background: url('/static/indexImg/user-bg.svg') center center no-repeat;
background-size: cover;
text:first-child {
margin-bottom: 30rpx;
font-size: 38rpx;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
}
text:last-child {
font-size: 50rpx;
font-weight: 600;
color: #48c0ff;
}
}
.login-bottom {
height: calc(100vh - 376rpx);
padding: 50rpx;
box-sizing: border-box;
border-radius: 60rpx 60rpx 0 0;
background-color: #fff;
.show-tips {
color: rgba(88, 132, 204, 1);
font-weight: 400;
font-size: 32rpx;
}
.agreement-policy {
display: flex; display: flex;
flex-direction: column; justify-content: center;
height: 376rpx; align-items: center;
padding: 176rpx 70rpx 0; padding: 0 30rpx;
box-sizing: border-box; margin-top: 10rpx;
background: url("/static/indexImg/user-bg.svg") center center no-repeat; margin-bottom: 50rpx;
background-size: cover; font-size: 26rpx;
color: #8c8c8c;
text:first-child { .select-box {
margin-bottom: 30rpx; display: flex;
font-size: 38rpx; align-items: center;
font-weight: 500;
color: rgba(0, 0, 0, 0.8); .select-img {
width: 46rpx;
height: 46rpx;
}
} }
text:last-child { .agreement,
font-size: 50rpx; .policy {
font-weight: 600; color: #1d79fd;
color: #48C0FF;
} }
} }
.login-bottom { .register-box {
height: calc(100vh - 376rpx); display: flex;
padding: 50rpx; justify-content: space-between;
box-sizing: border-box; padding: 0 30rpx;
border-radius: 60rpx 60rpx 0 0; margin-top: 50rpx;
background-color: #fff; font-size: 26rpx;
font-weight: 400;
.show-tips { .register {
color: rgba(88, 132, 204, 1); text:last-child {
font-weight: 400; color: #1d79fd;
font-size: 32rpx;
}
.agreement-policy {
display: flex;
justify-content: center;
align-items: center;
padding: 0 30rpx;
margin-top: 10rpx;
margin-bottom: 50rpx;
font-size: 26rpx;
color: #8C8C8C;
.select-box {
display: flex;
align-items: center;
.select-img {
width: 46rpx;
height: 46rpx;
}
}
.agreement,
.policy {
color: #1D79FD;
} }
} }
.register-box { .forget {
display: flex; color: #1d79fd;
justify-content: space-between;
padding: 0 30rpx;
margin-top: 50rpx;
font-size: 26rpx;
font-weight: 400;
.register {
text:last-child {
color: #1D79FD;
}
}
.forget {
color: #1D79FD;
}
} }
}
.swidth-login { .swidth-login {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 212rpx; margin-top: 212rpx;
font-size: 30rpx; font-size: 30rpx;
font-weight: 400; font-weight: 400;
color: rgba(77, 77, 77, 1); color: rgba(77, 77, 77, 1);
image { image {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
}
} }
} }
} }
}
</style> </style>

File diff suppressed because it is too large Load Diff

1304
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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({
@ -12,11 +14,11 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/server3/, ''), rewrite: path => path.replace(/^\/server3/, ''),
}, },
"/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/, '')
}, },
} }
} }

View File

@ -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": ""