This commit is contained in:
YeMingfei666 2025-01-07 11:03:02 +08:00
commit ae5b72a9e9
13 changed files with 1188 additions and 1047 deletions

View File

@ -10,4 +10,13 @@ export async function init() {
uni.setStorageSync('moreSearch', res.data.value)
}
})
}
/**
*
*/
export const commonType = (num) => {
return http.request({
url: `/common/type/${num}`,
})
}

43
api/login/login.js Normal file
View File

@ -0,0 +1,43 @@
import http from '@/http/http.js'
/**
* 登录
*/
export const login = (data) => {
return http.request({
url: '/Login/registerCode',
method: 'POST',
params: data
})
}
/**
* 发送验证码
*/
export const setSendMsg = (mobile,type) => {
return http.request({
url: '/Login/sendMsg/' + mobile + '/'+type
})
}
/**
* 注册
*/
export const registerCode = (params) => {
return http.request({
url: '/Login/registerCode',
params: params
})
}
/**
* 修改密码
*/
export const forgetPwd = (data) => {
return http.request({
url: '/Login/forgetPwd',
method: 'POST',
params: data
})
}

11
api/user/user.js Normal file
View File

@ -0,0 +1,11 @@
import http from '@/http/http.js'
/**
* 获取用户信息
*/
export const selectUserById = (data) => {
return http.request({
url: '/user/selectUserById',
data: data
})
}

View File

@ -141,28 +141,36 @@ function req(uri, data, method = "GET", showLoading = true, extParams = {}) {
// 默认 显示loading(控制 xxs 内 不提示loading )
function request(args) {
const {
url,
data,
params,
method = "GET",
showLoading = true,
extParams = {},
} = args;
let headerObject = {};
return commonsProcess(showLoading, () => {
return uni.request(
Object.assign(
{
url: slash(baseUrl, url),
data: params || data,
method: method,
header: getHeader(),
},
extParams
)
);
});
let {
url,
data,
params,
method = "GET",
showLoading = true,
extParams = {}
} = args
if (params) {
let result = ''
Object.keys(params).forEach((key) => {
if (!Object.is(params[key], undefined) && !Object.is(params[key], null) && !Object.is(JSON.stringify(params[key]), '{}')) {
result += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]) + "&"
}
})
url = url+'?'+result
params = null
}
let headerObject = {}
return commonsProcess(showLoading, () => {
return uni.request(
Object.assign({
url: slash(baseUrl, url),
data: params || data,
method: method,
header: getHeader()
}, extParams)
)
})
}
// 处理/
function slash(baseUrl, url) {

View File

@ -79,6 +79,16 @@
"style": {
"navigationBarTitleText": "个人资料"
}
}, {
"path": "pages/me/privacy",
"style": {
"navigationBarTitleText": "隐私协议"
}
}, {
"path": "pages/me/agreement",
"style": {
"navigationBarTitleText": "服务协议"
}
},
{
"path": "pages/index/search/index",

View File

@ -19,137 +19,134 @@
</template>
<script>
import listCell from '@/components/com-input';
export default {
components: {
listCell
},
data() {
return {
mobile: '',
code: '',
loginIng: false,
sendIng: false,
sendTime: '获取验证码',
count: 60,
type: '',
}
},
onLoad(option) {
if (option.type) {
this.type = option.type
}
},
methods: {
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sendIng = false;
this.sendTime = '获取验证码'
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import {setSendMsg,forgetPwd} from '@/api/login/login.js';
let data = reactive({
mobile: '',
code: '',
loginIng: false,
sendIng: false,
sendTime: '获取验证码',
count: 60,
type: '',
})
onLoad((option) => {
if (option.type) {
data.type = option.type
}
})
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
function countDown() {
const {
count
} = data;
if (count === 1) {
data.count = 60;
data.sendIng = false;
data.sendTime = '获取验证码'
} else {
data.count = count - 1;
data.sendIng = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
}
}
function sendMsg() {
const {
mobile
} = data;
if (!mobile) {
data.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) {
data.$queue.showToast("请输入正确的手机号");
} else {
data.$queue.showLoading("正在发送验证码...");
http.request({
url: 'app/Login/sendMsg/' + mobile + '/gzg',
}).then(res => {
if (res.code === 0) {
data.sendIng = true;
uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
data.countDown();
} else {
this.count = count - 1;
this.sendIng = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
sendMsg() {
const {
mobile
} = this;
if (!mobile) {
this.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else {
this.$queue.showLoading("正在发送验证码...");
http.request({
url: 'app/Login/sendMsg/' + mobile + '/gzg',
}).then(res => {
if (res.code === 0) {
this.sendIng = true;
this.$queue.showToast('验证码发送成功请注意查收');
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
})
}
},
toLogin() {
const {
mobile,
code
} = this;
let userId = this.$queue.getData("userId");
if (!mobile) {
this.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号");
} else if (!code) {
this.$queue.showToast("请输入验证码");
} else {
this.$queue.showLoading("正在绑定中...");
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
'';
let openidheadimgurl = this.$queue.getData('openidheadimgurl') ? this.$queue.getData(
'openidheadimgurl') : '';
let invitation = this.$queue.getData('inviterCode') ? this.$queue.getData('inviterCode') : '';
let userId = this.$queue.getData('userId') ? this.$queue.getData('userId') : '';
http.request({
url: `app/Login/registerCode`,
method: 'post',
data: {
phone: mobile,
wxId: openId,
userId: userId,
inviterCode: invitation,
avatar: openidheadimgurl,
userName: openidnickname,
msg: code
}
}).then(res => {
if (res.code === 0) {
this.$queue.setData("token", res.token);
this.$queue.setData('userId', res.user.userId);
this.$queue.setData('userName', res.user.userName);
this.$queue.setData('phone', res.user.phone);
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
'../../static/logo.png');
this.$queue.showToast('绑定成功');
setTimeout(function() {
uni.navigateBack()
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '绑定失败',
content: res.msg,
});
}
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
},
},
uni.hideLoading();
})
}
}
function toLogin() {
const {
mobile,
code
} = data;
let userId = this.$queue.getData("userId");
if (!mobile) {
uni.showToast({ title: '请输入手机号', icon: 'none', })
} else if (mobile.length !== 11) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
} else if (!code) {
uni.showToast({ title: '请输入验证码', icon: 'none', })
} else {
uni.showLoading({ title: '正在绑定中...' })
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
'';
let openidheadimgurl = this.$queue.getData('openidheadimgurl') ? this.$queue.getData(
'openidheadimgurl') : '';
let invitation = this.$queue.getData('inviterCode') ? this.$queue.getData('inviterCode') : '';
let userId = this.$queue.getData('userId') ? this.$queue.getData('userId') : '';
http.request({
url: `app/Login/registerCode`,
method: 'post',
data: {
phone: mobile,
wxId: openId,
userId: userId,
inviterCode: invitation,
avatar: openidheadimgurl,
userName: openidnickname,
msg: code
}
}).then(res => {
if (res.code === 0) {
this.$queue.setData("token", res.token);
this.$queue.setData('userId', res.user.userId);
this.$queue.setData('userName', res.user.userName);
this.$queue.setData('phone', res.user.phone);
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
'../../static/logo.png');
this.$queue.showToast('绑定成功');
uni.showToast({ title: '绑定成功', icon: 'none', })
setTimeout(function() {
uni.navigateBack()
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '绑定失败',
content: res.msg,
});
}
uni.hideLoading();
});
}
}
</script>

View File

@ -8,21 +8,21 @@
<view style="font-size: 58rpx;font-weight: bold;color: #333;margin-bottom: 48rpx;">重置密码</view>
<view class="cu-form-group">
<view class="title">手机号</view>
<input class="input" type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
<input class="input" type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
</view>
<view class="cu-form-group">
<text class="title">验证码</text>
<view class="input flex">
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code"
<input type="number" :value="data.code" placeholder="请输入验证码" maxlength="6" data-key="code"
@input="inputChange" @confirm="reset" />
<button class="send-msg" @click="sendMsg" :disabled="sending">{{ sendTime }}</button>
<button class="send-msg" @click="sendMsg" :disabled="data.sending">{{ data.sendTime }}</button>
</view>
</view>
<view class="cu-form-group">
<text class="title">设置密码</text>
<input class="input" type="password" :value="password" placeholder="请设置新密码" placeholder-class="input-empty"
<input class="input" type="password" :value="data.password" placeholder="请设置新密码" placeholder-class="input-empty"
maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="reset" />
</view>
<button class="confirm-btn" @click="reset">立即重置</button>
@ -32,169 +32,132 @@
</view>
</template>
<script>
import http from '@/http/http.js';
export default {
data() {
return {
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
};
},
onLoad() {
},
methods: {
/**
* 发送验证码
*/
sendMsg() {
if (!this.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (this.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
http.request({
url:'app/Login/sendMsg/' + this.mobile + '/forget',
}).then(res => {
if ( res.code == 0 ) {
this.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
})
}
},
/**
* 验证码倒计时
*/
countDown() {
const { count } = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
/**
* 获取手机号/验证码/密码
* @param {Object} e
*/
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
/**
* 注册
*/
reset() {
const {
mobile,
password,
code
} = this;
if (!mobile) {
// this.$queue.showToast("");
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (!code) {
// this.$queue.showToast("");
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
} else if (!password) {
// this.$queue.showToast("");
uni.showToast({
title: '请输入密码',
icon: 'none',
duration: 1000
})
} else {
this.loginIng = true;
// this.$queue.showLoading("...");
uni.showLoading({
title: '正在修改密码中...'
})
http.request({
url: 'app/Login/forgetPwd?pwd=' + password + '&phone=' + mobile + '&msg=' + code,
method: 'post'
}).then(
res => {
// this.$Request.postJson("/appLogin/forgetPwd",{
// pwd: password,
// phone: mobile,
// msg: code
// }).then(res => {
uni.hideLoading();
if (res.code === 0) {
uni.showToast({
title: '密码找回成功',
icon: 'none'
});
setTimeout(function() {
uni.navigateTo({
url: '/pages/login/login'
});
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '密码找回失败',
content: res.msg,
});
}
});
}
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import {setSendMsg,forgetPwd} from '@/api/login/login.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
})
/**
* 发送验证码
*/
async function sendMsg() {
if (!data.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (data.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
let res = await setSendMsg(data.mobile,'forget')
uni.hideLoading();
uni.hideToast();
if( res ){
data.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
})
data.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: '请一分钟后再获取验证码'
});
}
}
};
}
/**
* 验证码倒计时
*/
function countDown() {
if (data.count === 1) {
data.count = 60;
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
}
}
/**
* 获取手机号/验证码/密码
* @param {Object} e
*/
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
/**
* 注册
*/
async function reset() {
if (!data.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (!data.code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
} else if (!data.password) {
uni.showToast({
title: '请输入密码',
icon: 'none',
duration: 1000
})
} else {
data.loginIng = true;
uni.showLoading({
title: '正在修改密码中...'
})
let res = await forgetPwd({
pwd: data.password,
phone: data.mobile,
msg: data.code,
})
uni.hideLoading();
uni.showToast({
title: '密码找回成功',
icon: 'none'
});
setTimeout(function() {
uni.navigateTo({
url: '/pages/login/login'
});
}, 1000)
}
}
</script>
<style lang="scss" >

View File

@ -9,14 +9,14 @@
<view class="cu-form-group">
<view class="title">手机号</view>
<input class="input" type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
<input class="input" type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
</view>
<view class="cu-form-group">
<text class="title">密码</text>
<view class="input flex">
<input class="input" type="password" :value="password" placeholder="请输入密码" placeholder-class="input-empty"
<view class="input flex" style="padding-left: 0;">
<input class="input" type="password" :value="data.password" placeholder="请输入密码" placeholder-class="input-empty"
maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="toLogin" />
<text class="send-msg" @click="forget" style="flex-shrink: 0;">忘记密码</text>
</view>
@ -31,13 +31,13 @@
</view>
<view class="footerView">
<u-checkbox-group>
<u-checkbox v-model="checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
<u-checkbox v-model="data.checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>同意</view>
<!-- 协议地址 -->
<navigator url="/me/setting/mimi" open-type="navigate">隐私政策</navigator>
<navigator url="/pages/me/privacy" open-type="navigate">隐私政策</navigator>
<navigator url="/me/setting/xieyi" open-type="navigate">用户服务协议</navigator>
<navigator url="/pages/me/agreement" open-type="navigate">用户服务协议</navigator>
</view>
<u-toast ref="uToast" />
@ -45,135 +45,115 @@
</view>
</template>
<script>
import http from '@/http/http.js';
export default {
data() {
return {
mobile: '',
password: '',
checked: false
};
},
onLoad() {
if (uni.getStorageSync('isSafeView')) {
uni.showModal({
title: '提示',
content: '您正在使用无痕浏览,可能导致登录状态失效,建议切换浏览模式',
})
uni.setStorageSync("isSafeView", null)
}
},
methods: {
/**
* 注册
*/
register() {
uni.navigateTo({
url: '/pages/login/register'
});
},
/**
* 忘记密码
*/
forget() {
uni.navigateTo({
url: '/pages/login/forgetPwd'
});
},
/**
* 获取手机号/密码
* @param {Object} e
*/
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
/**
* 同意协议
* @param {Object} e
*/
radioChange(e) {
this.checked = e
},
/**
* 登录
*/
toLogin() {
if (!this.checked) {
uni.showToast({
title: '请阅读并同意《隐私政策》和《用户服务协议》',
icon: 'none',
})
return;
}
const { mobile, password } = this;
console.log(this.mobile)
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
})
} else if (mobile.length != 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
})
} else if (!password) {
uni.showToast({
title: '请输入密码',
icon: 'none',
})
} else {
uni.showLoading({
title: '正在登录中...',
})
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile,
method: 'post'
}).then(res => {
console.log(res)
if (res.code === 0) {
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('userName', res.user.userName)
uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
uni.showToast({
title: '登录成功',
icon: 'none'
})
uni.reLaunch({
url:'/pages/index/index'
})
} else{
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
}
},
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import { login } from '@/api/login/login.js';
let data = reactive({
mobile: '',
password: '',
checked: false
})
onLoad(() => {
})
/**
* 注册
*/
function register () {
uni.navigateTo({
url: '/pages/login/register'
});
}
/**
* 忘记密码
*/
function forget () {
uni.navigateTo({
url: '/pages/login/forgetPwd'
});
}
/**
* 获取手机号/密码
*/
function inputChange (e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
/**
* 同意协议
*/
function radioChange (e) {
data.checked = e
}
/**
* 登录
*/
async function toLogin () {
if (!data.checked) {
uni.showToast({
title: '请阅读并同意《隐私政策》和《用户服务协议》',
icon: 'none',
})
return;
}
};
const { mobile, password } = data;
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
})
} else if (mobile.length != 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
})
} else if (!password) {
uni.showToast({
title: '请输入密码',
icon: 'none',
})
} else {
uni.showLoading({
title: '正在登录中...',
})
let res = await login({
password: password,
phone: mobile
})
console.log(res)
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('userName', res.user.userName)
uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
uni.hideLoading();
uni.showToast({
title: '登录成功',
icon: 'none'
})
uni.reLaunch({
url:'/pages/index/index'
})
}
}
</script>
<style lang="scss" scoped>
@ -207,10 +187,7 @@
font-weight: 400;
font-size: 24rpx;
color: #333333;
position: absolute;
left: 0;
right: 0;
bottom: 78rpx;
margin-top: 50rpx;
}

View File

@ -9,21 +9,21 @@
<view class="cu-form-group">
<view class="title">手机号</view>
<input class="input" type="number" :value="mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
<input class="input" type="number" :value="data.mobile" placeholder="请输入手机号" maxlength="11" data-key="mobile"
@input="inputChange" />
</view>
<view class="cu-form-group">
<text class="title">验证码</text>
<view class="input flex">
<input type="number" :value="code" placeholder="请输入验证码" maxlength="6" data-key="code"
<input type="number" :value="data.code" placeholder="请输入验证码" maxlength="6" data-key="code"
@input="inputChange" @confirm="toRegister" />
<button class="send-msg" @click="sendMsg" :disabled="sending">{{ sendTime }}</button>
<button class="send-msg" @click="sendMsg" :disabled="data.sending">{{ data.sendTime }}</button>
</view>
</view>
<view class="cu-form-group">
<text class="title">设置密码</text>
<input class="input" type="password" :value="password" placeholder="请设置新密码" placeholder-class="input-empty"
<input class="input" type="password" :value="data.password" placeholder="请设置新密码" placeholder-class="input-empty"
maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="toRegister" />
</view>
<button class="confirm-btn" @click="toRegister">注册</button>
@ -31,250 +31,249 @@
</view>
<view class="footerView">
<u-checkbox-group>
<u-checkbox v-model="checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
<u-checkbox v-model="data.checked" label-size='24upx' shape="circle" @change="radioChange"></u-checkbox>
</u-checkbox-group>
<view>注册即同意</view>
<!-- 协议地址 -->
<navigator url="/me/setting/mimi" open-type="navigate" style="color: #37A6FF;">隐私政策</navigator>
<navigator url="/pages/me/privacy" open-type="navigate" style="color: #37A6FF;">隐私政策</navigator>
<navigator url="/me/setting/xieyi" open-type="navigate" style="color: #37A6FF;">用户协议</navigator>
<navigator url="/pages/me/agreement" open-type="navigate" style="color: #37A6FF;">用户协议</navigator>
</view>
</view>
</view>
</template>
<script>
import http from '@/http/http.js';
export default {
data() {
return {
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
registerCode: '',
qdCodeion: '', //
checked: false,
};
},
onLoad( options ) {
if (uni.getStorageSync('qdCodeion')) { this.qdCodeion = uni.getStorageSync('qdCodeion') }
if (options.qdCode) { this.qdCodeion = options.qdCode }
if (options.invitation ) { this.invitation = options.invitation }
http.request({
url:'app/common/type/3',
}).then(res => {
if (res.code == 0) {
this.registerCode = res.data.value
}
});
},
methods: {
/**
* 发送验证码
*/
sendMsg() {
if (!this.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (this.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
http.request({
url:'app/Login/sendMsg/' + this.mobile + '/login',
}).then(res => {
if ( res.code == 0 ) {
this.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
})
}
},
/**
* 验证码倒计时
*/
countDown() {
const { count } = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
/**
* 获取注册值
* @param {Object} e
*/
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
/**
* 是否同意协议
* @param {Object} e
*/
radioChange(e) {
this.checked = e
},
/**
* 登录
*/
toLogin() {
uni.reLaunch({
url: '/pages/login/login'
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import {setSendMsg,registerCode} from '@/api/login/login.js';
import {commonType} from '@/api/init.js';
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
registerCode: '',
qdCodeion: '', //
checked: false,
})
onLoad(async ( options ) => {
if (uni.getStorageSync('qdCodeion')) { data.qdCodeion = uni.getStorageSync('qdCodeion') }
if (options.qdCode) { data.qdCodeion = options.qdCode }
if (options.invitation ) { data.invitation = options.invitation }
let res = await commonType(3)
data.registerCode = res.value
})
/**
* 发送验证码
*/
async function sendMsg () {
if (!data.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (data.mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
let res = await setSendMsg(data.mobile,'login')
uni.hideLoading();
uni.hideToast();
if( res ){
data.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
data.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: '请一分钟后再获取验证码'
});
},
/**
* 注册
*/
toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
registerCode,
qdCodeion
} = this;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
})
return
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
this.logining = true;
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code +
'&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion,
method: 'post'
}).then(res => {
console.log(res)
if (res.code === 0) {
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
//
if (res.user.qdCod) {
uni.setStorageSync('qdCod', res.user.qdCod)
}
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/index'
});
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
uni.hideLoading();
})
}
}
};
}
/**
* 验证码倒计时
*/
function countDown() {
if (data.count === 1) {
data.count = 60;
data.sending = false;
data.sendTime = '获取验证码';
} else {
data.count = count - 1;
data.sending = true;
data.sendTime = count - 1 + '秒后重新获取';
setTimeout(data.countDown.bind(data), 1000);
}
}
/**
* 获取注册值
* @param {Object} e
*/
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
data.checked = e
}
/**
* 登录
*/
function toLogin() {
uni.reLaunch({
url: '/pages/login/login'
});
}
/**
* 注册
*/
async function toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
registerCode,
qdCodeion
} = data;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
})
return
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
data.logining = true;
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
let res = await registerCode({
password: password,
phone: mobile,
msg: code,
inviterCode: invitation,
platform: platform,
qdCode: qdCodeion,
})
if (res.code === 0) {
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
//
if (res.user.qdCod) {
uni.setStorageSync('qdCod', res.user.qdCod)
}
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/index'
});
}, 1000)
} else {
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
uni.hideLoading();
}
</script>
<style lang="scss" >

View File

@ -52,244 +52,234 @@
</view>
</template>
<script>
<script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import http from '@/http/http.js';
export default {
data() {
return {
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
registerCode: '',
qdCodeion: '',
checked: false,
};
},
onLoad(e) {
let relation = e.invitation
if (relation) {
this.relation = relation;
this.invitation = relation;
let data = reactive({
code: '',
mobile: '',
password: '',
sending: false,
sendTime: '获取验证码',
count: 60,
relation: "",
invitation: '',
registerCode: '',
qdCodeion: '', //
checked: false,
})
onLoad(( options ) => {
let relation = e.invitation
if (relation) {
this.relation = relation;
this.invitation = relation;
}
if (e.qdCode) {
this.qdCodeion = e.qdCode
}
http.request({
url:'app/common/type/3',
}).then(res => {
if (res.code == 0) {
this.registerCode = res.data.value
}
if (e.qdCode) {
this.qdCodeion = e.qdCode
});
})
/**
* 是否同意协议
* @param {Object} e
*/
function radioChange(e) {
this.checked = e
}
function showMa() {
//
this.$Request.getT('/common/type/88').then(res => {
if (res.code == 0) {
this.invitation = res.data.value;
}
});
}
function sendMsg() {
const {
mobile
} = this;
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
http.request({
url:'app/common/type/3',
url:'app/Login/sendMsg/' + mobile + '/login',
}).then(res => {
if (res.code == 0) {
this.registerCode = res.data.value
}
});
},
methods: {
/**
* 是否同意协议
* @param {Object} e
*/
radioChange(e) {
this.checked = e
},
showMa() {
//
this.$Request.getT('/common/type/88').then(res => {
if (res.code == 0) {
this.invitation = res.data.value;
}
});
},
sendMsg() {
const {
mobile
} = this;
if (!mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else if (mobile.length !== 11) {
uni.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1000
})
} else {
uni.showLoading({
title: '正在发送验证码...'
})
http.request({
url:'app/Login/sendMsg/' + mobile + '/login',
}).then(res => {
if (res.code === 0) {
this.sending = true;
uni.showToast({
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
uni.hideLoading();
})
}
},
countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
if (res.code === 0) {
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
},
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
navTo(url) {
uni.navigateTo({
url
});
},
toLogin() {
console.log("123");
uni.reLaunch({
url: '/pages/login/login'
});
},
toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
registerCode,
qdCodeion
} = this;
if (!mobile) {
uni.showToast({
title: '请输入账号',
title: '验证码发送成功请注意查收',
icon: 'none',
duration: 1000
})
return
this.countDown();
} else {
uni.showModal({
showCancel: false,
title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码'
});
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
this.logining = true;
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code +
'&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion,
method: 'post'
}).then(res => {
if (res.code === 0) {
// this.$queue.remove('invitation');
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/pages/login/appEq'
})
}, 1000)
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
});
},
uni.hideLoading();
})
}
};
}
function countDown() {
const {
count
} = this;
if (count === 1) {
this.count = 60;
this.sending = false;
this.sendTime = '获取验证码';
} else {
this.count = count - 1;
this.sending = true;
this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000);
}
}
function inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
}
function toLogin() {
console.log("123");
uni.reLaunch({
url: '/pages/login/login'
});
}
function toRegister() {
const {
mobile,
password,
code,
checked,
invitation,
registerCode,
qdCodeion
} = this;
if (!mobile) {
uni.showToast({
title: '请输入账号',
icon: 'none',
duration: 1000
})
return
}
if (!code) {
uni.showToast({
title: '请输入验证码',
icon: 'none',
duration: 1000
})
return
}
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 1000
})
return
}
if (password.length < 6) {
uni.showToast({
title: '密码位数必须大于六位',
icon: 'none',
duration: 1000
})
return
}
if (invitation.length == 0 && registerCode == '是') {
uni.showToast({
title: '请输入邀请码',
icon: 'none',
duration: 1000
})
return
}
if (!checked) {
uni.showToast({
title: '请先同意《隐私政策》和《用户协议》',
icon: 'none',
duration: 1000
})
return
}
this.logining = true;
uni.showLoading({
title: '注册中...'
})
let platform = ''
// #ifdef APP
platform = 'app'
// #endif
// #ifdef H5
platform = 'h5'
// #endif
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code +
'&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion,
method: 'post'
}).then(res => {
if (res.code === 0) {
// this.$queue.remove('invitation');
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
//
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
uni.showToast({
title: '注册成功',
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/pages/login/appEq'
})
}, 1000)
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '注册失败',
content: res.msg
});
}
});
}
</script>
<style lang="scss" scoped>

67
pages/me/agreement.vue Normal file
View File

@ -0,0 +1,67 @@
<template>
<view style="line-height: 26px;padding: 32upx;" class="home1 ">
<view style="font-size: 28upx;" v-html="data.content"></view>
<view class="btn-box u-flex u-row-center" v-if="!isLogin">
<view class="btn cancel" @click="cancel">拒绝</view>
<view class="btn" @click="back">同意</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import config from '@/commons/config.js';
import {selectUserById} from '@/api/user/user.js';
import {commonType} from '@/api/init.js';
let data = reactive({
content: '',
isLogin:false
})
onLoad(() => {
getGuize()
data.isLogin=uni.getStorageSync('token')?true:false
})
async function getGuize() {
let res = await commonType(154)
data.content = res.value
}
function cancel(){
// #ifdef H5
uni.navigateBack()
// #endif
// #ifdef APP
plus.runtime.quit();
// #endif
}
function back(){
uni.navigateBack()
}
</script>
<style scoped>
.btn {
width: 100%;
height: 42px;
line-height: 42px;
border-radius: 30px;
background: #ff7581;
color: #ffffff;
text-align: center;
}
.btn-box{
gap: 20px;
padding: 30rpx 130rpx;
}
.cancel{
background-color: #eee;
color: #999;
}
page{
/* background: #1c1b20; */
}
</style>

70
pages/me/privacy.vue Normal file
View File

@ -0,0 +1,70 @@
<template>
<view style="font-size: 14px;line-height: 26px;padding: 32upx;" class="home1 ">
<view style="font-size: 28upx;" v-html="data.content"></view>
<view class="btn-box u-flex u-row-center" v-if="!isLogin">
<view class="btn cancel" @click="cancel">拒绝</view>
<view class="btn" @click="back">同意</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import config from '@/commons/config.js';
import {selectUserById} from '@/api/user/user.js';
import {commonType} from '@/api/init.js';
let data = reactive({
content: '',
isLogin:false
})
onLoad(() => {
getGuize()
data.isLogin=uni.getStorageSync('token')?true:false
})
async function getGuize() {
let res = await commonType(155)
data.content = res.value
}
function cancel(){
// #ifdef H5
uni.navigateBack()
// #endif
// #ifdef APP
plus.runtime.quit();
// #endif
}
function back(){
uni.navigateBack()
}
</script>
<style scoped>
.btn {
width: 100%;
height: 42px;
line-height: 42px;
border-radius: 30px;
background: #ff7581;
color: #ffffff;
text-align: center;
}
.btn-box{
gap: 20px;
padding: 30rpx 130rpx;
}
.cancel{
background-color: #eee;
color: #999;
}
page{
/* background: #1c1b20; */
}
</style>

View File

@ -3,18 +3,18 @@
<up-cell-group>
<up-cell title="头像">
<template #value>
<image :src="userInfo.avatar?userInfo.avatar:'../../static/default/avatar.png'" mode="" @click="uploadImg"
<image :src="data.userInfo.avatar?data.userInfo.avatar:'../../static/default/avatar.png'" mode="" @click="uploadImg"
style="width: 111rpx;height: 111rpx;border-radius: 50%;"></image>
</template>
</up-cell>
<up-cell title="用户名">
<template #value>
<input v-model="userInfo.userName" align="right" placeholder="请输入用户名" />
<input v-model="data.userInfo.userName" align="right" placeholder="请输入用户名" />
</template>
</up-cell>
<up-cell title="手机">
<template #value>
<input :disabled="userInfo.phone?true:false" v-model="userInfo.phone" align="right" placeholder="请输入联系电话" />
<input :disabled="data.userInfo.phone?true:false" v-model="data.userInfo.phone" align="right" placeholder="请输入联系电话" />
</template>
</up-cell>
</up-cell-group>
@ -22,144 +22,141 @@
</view>
</template>
<script>
<script setup>
import { reactive } from 'vue';
import { onShow} from '@dcloudio/uni-app'
import config from '@/commons/config.js';
import http from '@/http/http.js';
export default {
data() {
return{
userInfo: {
avatar: '',
userName: '',
phone: '',
}
}
},
onLoad( options ) {
this.getUserInfo()
},
methods: {
/**
* 获取个人信息
*/
getUserInfo() {
http.request({
url:'app/user/selectUserById',
}).then(res => {
this.userInfo = res.data
})
},
/**
* 上次头像
*/
uploadImg() {
let that = this;
var url = null;
uni.showActionSheet({
// itemList
itemList: ["查看头像", "从相册选择图片"],
success(e) {
var index = e.tapIndex
console.log(index)
if (index === 0) {
//
//
let url = that.headImg;
let arr = []
arr.push(url)
uni.previewImage({
//
urls: arr
})
} else if (index === 1) {
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function(res) {
uni.showLoading({
title: '上传中...'
});
uni.uploadFile({
url: config.baseApiUrl + 'alioss/upload',
filePath: res.tempFilePaths[0],
name: 'file',
success: uploadFileRes => {
url = JSON.parse(uploadFileRes.data);
console.log(url)
this.userInfo.avatar = url.data
uni.hideLoading();
}
});
import {selectUserById} from '@/api/user/user.js';
let data = reactive({
userInfo: {
avatar: '',
userName: '',
phone: '',
}
})
onShow(() => {
// console.log(1)
getUserInfo()
})
/**
* 获取个人信息
*/
async function getUserInfo () {
let res = await selectUserById()
if ( res.code == 0 ) {
data.userInfo = res.data
}
}
/**
* 上传头像
*/
function uploadImg () {
var url = null;
uni.showActionSheet({
// itemList
itemList: ["查看头像", "从相册选择图片"],
success(e) {
var index = e.tapIndex
console.log(index)
if (index === 0) {
//
//
let url = data.userInfo.avatar;
let arr = []
arr.push(url)
uni.previewImage({
//
urls: arr
})
} else if (index === 1) {
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function(res) {
uni.showLoading({
title: '上传中...'
});
uni.uploadFile({
url: config.baseApiUrl + 'alioss/upload',
filePath: res.tempFilePaths[0],
name: 'file',
success: uploadFileRes => {
url = JSON.parse(uploadFileRes.data);
console.log(url)
data.userInfo.avatar = url.data
uni.hideLoading();
}
});
}
}
})
},
/**
* 保存
*/
save() {
if (!this.userInfo.userName) {
uni.showToast({
title: "用户名不能为空",
icon: "none"
})
return
});
}
if (!this.userInfo.phone) {
uni.showToast({
title: "手机号不能空",
icon: "none"
})
return
}
if (this.checkPhone(this.userInfo.phone) == false) {
uni.showToast({
title: "手机号格式不正确",
icon: "none"
})
return
}
uni.showModal({
title: '温馨提示',
content: '确定保存信息',
confirmColor: '#ff7581',
success: e => {
if (e.confirm) {
http.request({
url:'app/user/updateUsers',
method: 'post',
data: {
userName: this.userInfo.userName,
avatar: this.userInfo.avatar,
phone: this.userInfo.phone,
}
}).then(res => {
uni.showToast({
title: '保存成功',
icon: "none"
})
setTimeout(function() {
uni.navigateBack()
}, 1000)
})
}
}
});
},
//
checkPhone(phone) {
return /^1[3456789]\d{9}$/.test(phone);
},
}
})
}
/**
* 保存
*/
function save () {
if (!data.userInfo.userName) {
uni.showToast({
title: "用户名不能为空",
icon: "none"
})
return
}
if (!data.userInfo.phone) {
uni.showToast({
title: "手机号不能空",
icon: "none"
})
return
}
if (checkPhone(data.userInfo.phone) == false) {
uni.showToast({
title: "手机号格式不正确",
icon: "none"
})
return
}
uni.showModal({
title: '温馨提示',
content: '确定保存信息',
confirmColor: '#ff7581',
success: e => {
if (e.confirm) {
http.request({
url:'app/user/updateUsers',
method: 'post',
data: {
userName: data.userInfo.userName,
avatar: data.userInfo.avatar,
phone: data.userInfo.phone,
}
}).then(res => {
uni.showToast({
title: '保存成功',
icon: "none"
})
setTimeout(function() {
uni.navigateBack()
}, 1000)
})
}
}
});
}
function checkPhone(phone) {
return /^1[3456789]\d{9}$/.test(phone);
}
</script>