This commit is contained in:
zhang zhuo 2025-03-04 09:48:19 +08:00
parent a6c701250b
commit 64509092eb
5 changed files with 81 additions and 20 deletions

26
.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/package-lock.json
.hbuilder
unpackage

View File

@ -3,7 +3,7 @@
//
const $globalData = {
BASE_URL: 'https://dev.api.leapy.cn',
BASE_URL: 'https://dev.api.leapy.cn/merchant/',
RESOURCE_URL: 'https://resource.leapy.cn/staff/'
}

View File

@ -7,4 +7,8 @@ export const register = (data : any) => post('/power/drv', data);
export const updateUser = (data : any) => put('/power/drv', data);
export const deleteUser = (data : any) => del('/power/drv', data);
export const deleteUser = (data : any) => del('/power/drv', data);
export const captcha = (data : any) => get('v1/captcha', data);
export const login = (data : any) => post('v1/login', data);

View File

@ -6,7 +6,7 @@
</view>
<view class="li-w-80% li-mx-auto li-mt-100">
<!-- 账号 -->
<wd-input :maxlength="11" placeholder="请输入账号" type='number' v-model="form.phone" prefix-icon="user"
<wd-input :maxlength="11" placeholder="请输入账号" type='number' v-model="form.username" prefix-icon="user"
placeholderStyle="font-size:30rpx" :focus-when-clear="false" clear-trigger="focus" clearable
no-border />
<!-- 密码 -->
@ -22,8 +22,8 @@
prefix-icon="secured" placeholderStyle="font-size:30rpx" :focus-when-clear="false"
clear-trigger="focus" clearable no-border />
</view>
<view class="li-bg-white li-w-150 li-h-68">
<image class="li-w-150 li-h-68" src="/static/code.jpg" mode=""></image>
<view class="li-bg-white li-w-150 li-h-68" @click="getCode()">
<image class="li-w-150 li-h-68" :src="captchaData.image" mode=""></image>
</view>
</view>
</view>
@ -32,9 +32,8 @@
<wd-button @click="login" block custom-class="custom-shadow">登录</wd-button>
</view>
<!-- -->
<view
class="li-flex li-items-center li-justify-center li-w-90% li-mx-auto li-text-#a5a5a5 li-text-24 li-mt-300">
<wd-checkbox checked-color="#2EA1EA" v-model="check" @change="handleChange" />
<view class="li-flex li-items-center li-justify-center li-w-90% li-mx-auto li-text-#a5a5a5 li-text-24 li-mt-32">
<wd-checkbox checked-color="#2EA1EA" v-model="check" />
阅读并同意
<text class="li-text-#2EA1EA li-mx-10">
用户协议
@ -49,27 +48,59 @@
<script lang="ts" setup>
import { ref, reactive } from 'vue'
import { captcha } from '@/api/login';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { md5Sync } from "@/uni_modules/tq-encrypt"
interface formItem {
phone : string
username : string
password : string
code : string
code : string,
uuid : string
}
interface CaptchaData {
uuid : string
image : string
}
const form = ref<formItem>({
phone: '',
username: '',
password: '',
code: ""
code: "",
uuid : ""
})
let captchaData = ref<CaptchaData>({
uuid: '',
image: ''
})
const check = ref<boolean>(true)
const handleChange = ({ value }) => {
console.log(value)
const login = () => {
console.log(md5Sync("123456"))
if (!check.value) {
uni.showToast({
icon: 'none',
title: '请阅读并同意《用户协议》和《隐私政策》',
duration: 2000
})
return;
}
console.log(check)
// uni.switchTab({
// url:'/pages/index/index'
// })
}
const login = ()=>{
uni.switchTab({
url:'/pages/index/index'
})
onShow(() => {
getCode()
});
const getCode = async () => {
const res = await captcha({})
captchaData.value = res.data as CaptchaData
}
</script>

View File

@ -25,7 +25,7 @@ function objectToQueryString(obj: Record<string, any>): string {
// 获取基础URL的函数
function getBaseUrl() {
// @ts-ignore
return uni.$globalData?.BASE_URL || 'https://dev.api.leapy.cn';
return uni.$globalData?.BASE_URL || 'https://dev.api.leapy.cn/merchant';
}
// 封装请求函数