第一次上传

This commit is contained in:
Ls
2026-03-09 16:39:03 +08:00
commit 3d9efaf15c
924 changed files with 326227 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
export class HttpRequest {
/***普通请求方法***/
static Request(url: string, method: "GET" | "POST" | "PUT" | undefined, data: object | any) {
return new Promise(function(resolve, reject) {
let header = {
'content-type': method == 'POST' || method == 'PUT' ? 'application/x-www-form-urlencoded' : 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': '*'
};
uni.request({
url: url,
method: method,
data: data,
header: header,
success(res: any) {
if (res.statusCode == "200") {
resolve(res.data);
}
else
{
resolve(res);
}
},
fail(err) {
//请求失败
uni.showToast({
title: '无法连接到服务器',
icon: 'none'
})
reject(err)
}
})
})
};
/***带Token的请求方法***/
static RequestWithToken(url: string, method: "GET" | "POST" | "PUT" | undefined, token: string, data: object | any) {
return new Promise(function(resolve, reject) {
let header = {
'content-type': method == 'POST' || method == 'PUT' ? 'application/x-www-form-urlencoded' : 'application/json; charset=utf-8',
'Authorization': 'Bearer ' + token,//token获取
'Access-Control-Allow-Origin': '*'
};
uni.request({
url: url,
method: method,
data: data,
header: header,
success(res: any) {
resolve(res);
},
fail(err) {
//请求失败
uni.showToast({
title: '无法连接到服务器',
icon: 'none'
})
reject(err)
}
})
})
}
}

View File

@@ -0,0 +1,122 @@
<template>
<view style="margin: 20rpx 40rpx;">
<up-form labelPosition="left" labelWidth='90' :model="data" ref="form1">
<up-form-item label="手机号:" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' v-model="data.phone" placeholder="请先绑定手机号" readonly='true'
border="none"></up-input>
</up-form-item>
<up-form-item label="验证码:" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' type='number' v-model="data.code" clearable='true' placeholder="请输入验证码"
border="none">
<template #suffix>
<up-code ref="uCodeRef" @change="codeChange" seconds="60" changeText="X秒重新获取"></up-code>
<up-button @tap="getCode" :text="tips" type="success" size="mini"></up-button>
</template>
</up-input>
</up-form-item>
<up-form-item label="原密码:" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' v-model="data.oldPass" placeholder="请输入原密码" border="none"></up-input>
</up-form-item>
<up-form-item label="新密码:" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' v-model="data.newPass" placeholder="请输入新密码" border="none"></up-input>
</up-form-item>
</up-form>
<view class="" style="margin-top: 20rpx;">
<button @click="save()" class="logout-btn"> {{ data.phone?'修改支付密码':'添加支付密码' }} </button>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { ref } from "vue";
import { Service } from "../../Service/Service";
let data = ref({
oldPass: '',
newPass: '',
phone: '',
code: '',
})
let tips = ref('')
const uCodeRef = ref(null);
onLoad((data : any) => {
getData()
});
onShow(() => {
});
const getData = () => {
}
// 验证码
const codeChange = (text) => {
tips.value = text;
};
const getCode = () => {
if (uCodeRef.value.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码',
});
} else {
uni.$u.toast('倒计时结束后再发送');
}
};
const change = (e) => {
console.log('change', e);
};
const save = () => {
if (data.value.code == '') {
Service.Msg('请输入验证码')
return
}
if (data.value.oldPass == '') {
Service.Msg('请输入原密码')
return
}
if (data.value.newPass == '') {
Service.Msg('请输入新密码')
return
}
if(data.value.oldPass===data.value.newPass){
Service.Msg('请输入原密码不能与新密码一致')
return
}
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
.logout-btn {
background-color: var(--nav-mian);
color: #fff;
font-weight: 500;
border-radius: 10rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
margin: 0;
border: none;
}
</style>