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

View File

@@ -11,3 +11,12 @@ export async function init() {
} }
}) })
} }
/**
*
*/
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 ) // 默认 显示loading(控制 xxs 内 不提示loading )
function request(args) { function request(args) {
const { let {
url, url,
data, data,
params, params,
method = "GET", method = "GET",
showLoading = true, showLoading = true,
extParams = {}, extParams = {}
} = args; } = args
let headerObject = {}; 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 commonsProcess(showLoading, () => {
return uni.request( return uni.request(
Object.assign( Object.assign({
{
url: slash(baseUrl, url), url: slash(baseUrl, url),
data: params || data, data: params || data,
method: method, method: method,
header: getHeader(), header: getHeader()
}, }, extParams)
extParams
) )
); })
});
} }
// 处理/ // 处理/
function slash(baseUrl, url) { function slash(baseUrl, url) {

View File

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

View File

@@ -19,13 +19,10 @@
</template> </template>
<script> <script>
import listCell from '@/components/com-input'; import { reactive } from 'vue';
export default { import { onLoad} from '@dcloudio/uni-app'
components: { import {setSendMsg,forgetPwd} from '@/api/login/login.js';
listCell let data = reactive({
},
data() {
return {
mobile: '', mobile: '',
code: '', code: '',
loginIng: false, loginIng: false,
@@ -33,51 +30,52 @@
sendTime: '获取验证码', sendTime: '获取验证码',
count: 60, count: 60,
type: '', 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() { 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 { const {
count count
} = this; } = data;
if (count === 1) { if (count === 1) {
this.count = 60; data.count = 60;
this.sendIng = false; data.sendIng = false;
this.sendTime = '获取验证码' data.sendTime = '获取验证码'
} else { } else {
this.count = count - 1; data.count = count - 1;
this.sendIng = true; data.sendIng = true;
this.sendTime = count - 1 + '秒后重新获取'; data.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000); setTimeout(data.countDown.bind(data), 1000);
} }
}, }
sendMsg() {
function sendMsg() {
const { const {
mobile mobile
} = this; } = data;
if (!mobile) { if (!mobile) {
this.$queue.showToast("请输入手机号"); data.$queue.showToast("请输入手机号");
} else if (mobile.length !== 11) { } else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号"); data.$queue.showToast("请输入正确的手机号");
} else { } else {
this.$queue.showLoading("正在发送验证码..."); data.$queue.showLoading("正在发送验证码...");
http.request({ http.request({
url: 'app/Login/sendMsg/' + mobile + '/gzg', url: 'app/Login/sendMsg/' + mobile + '/gzg',
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.sendIng = true; data.sendIng = true;
this.$queue.showToast('验证码发送成功请注意查收'); uni.showToast({ title: '验证码发送成功请注意查收', icon: 'none', })
this.countDown(); data.countDown();
} else { } else {
uni.showModal({ uni.showModal({
showCancel: false, showCancel: false,
@@ -90,21 +88,22 @@
}) })
} }
}, }
toLogin() {
function toLogin() {
const { const {
mobile, mobile,
code code
} = this; } = data;
let userId = this.$queue.getData("userId"); let userId = this.$queue.getData("userId");
if (!mobile) { if (!mobile) {
this.$queue.showToast("请输入手机号"); uni.showToast({ title: '请输入手机号', icon: 'none', })
} else if (mobile.length !== 11) { } else if (mobile.length !== 11) {
this.$queue.showToast("请输入正确的手机号"); uni.showToast({ title: '请输入正确的手机号', icon: 'none', })
} else if (!code) { } else if (!code) {
this.$queue.showToast("请输入验证码"); uni.showToast({ title: '请输入验证码', icon: 'none', })
} else { } else {
this.$queue.showLoading("正在绑定中..."); uni.showLoading({ title: '正在绑定中...' })
let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : ''; let openId = this.$queue.getData('openId') ? this.$queue.getData('openId') : '';
let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') : let openidnickname = this.$queue.getData('openidnickname') ? this.$queue.getData('openidnickname') :
''; '';
@@ -134,6 +133,7 @@
this.$queue.setData('avatar', res.user.avatar ? res.user.avatar : this.$queue.setData('avatar', res.user.avatar ? res.user.avatar :
'../../static/logo.png'); '../../static/logo.png');
this.$queue.showToast('绑定成功'); this.$queue.showToast('绑定成功');
uni.showToast({ title: '绑定成功', icon: 'none', })
setTimeout(function() { setTimeout(function() {
uni.navigateBack() uni.navigateBack()
}, 1000) }, 1000)
@@ -147,9 +147,6 @@
uni.hideLoading(); uni.hideLoading();
}); });
} }
},
},
} }
</script> </script>

View File

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

View File

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

View File

@@ -9,21 +9,21 @@
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">手机号</view> <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" /> @input="inputChange" />
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<text class="title">验证码</text> <text class="title">验证码</text>
<view class="input flex"> <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" /> @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> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<text class="title">设置密码</text> <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" /> maxlength="20" minlength="6" data-key="password" @input="inputChange" @confirm="toRegister" />
</view> </view>
<button class="confirm-btn" @click="toRegister">注册</button> <button class="confirm-btn" @click="toRegister">注册</button>
@@ -31,23 +31,26 @@
</view> </view>
<view class="footerView"> <view class="footerView">
<u-checkbox-group> <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> </u-checkbox-group>
<view>注册即同意</view> <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> </view>
</view> </view>
</template> </template>
<script> <script setup>
import http from '@/http/http.js'; import { reactive } from 'vue';
export default { import { onLoad} from '@dcloudio/uni-app'
data() { import {setSendMsg,registerCode} from '@/api/login/login.js';
return { import {commonType} from '@/api/init.js';
let data = reactive({
code: '', code: '',
mobile: '', mobile: '',
password: '', password: '',
@@ -59,34 +62,28 @@
registerCode: '', registerCode: '',
qdCodeion: '', //渠道码 qdCodeion: '', //渠道码
checked: false, 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({ onLoad(async ( options ) => {
url:'app/common/type/3', if (uni.getStorageSync('qdCodeion')) { data.qdCodeion = uni.getStorageSync('qdCodeion') }
}).then(res => { if (options.qdCode) { data.qdCodeion = options.qdCode }
if (res.code == 0) { if (options.invitation ) { data.invitation = options.invitation }
this.registerCode = res.data.value
} let res = await commonType(3)
}); data.registerCode = res.value
}, })
methods: {
/** /**
* 发送验证码 * 发送验证码
*/ */
sendMsg() { async function sendMsg () {
if (!this.mobile) { if (!data.mobile) {
uni.showToast({ uni.showToast({
title: '请输入手机号', title: '请输入手机号',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000
}) })
} else if (this.mobile.length !== 11) { } else if (data.mobile.length !== 11) {
uni.showToast({ uni.showToast({
title: '请输入正确的手机号', title: '请输入正确的手机号',
icon: 'none', icon: 'none',
@@ -96,78 +93,78 @@
uni.showLoading({ uni.showLoading({
title: '正在发送验证码...' title: '正在发送验证码...'
}) })
http.request({ let res = await setSendMsg(data.mobile,'login')
url:'app/Login/sendMsg/' + this.mobile + '/login', uni.hideLoading();
}).then(res => { uni.hideToast();
if ( res.code == 0 ) { if( res ){
this.sending = true; data.sending = true;
uni.showToast({ uni.showToast({
title: '验证码发送成功请注意查收', title: '验证码发送成功请注意查收',
icon: 'none', icon: 'none',
duration: 1000 duration: 1000
}) })
this.countDown(); data.countDown();
} else { } else {
uni.showModal({ uni.showModal({
showCancel: false, showCancel: false,
title: '短信发送失败', title: '短信发送失败',
content: res.msg ? res.msg : '请一分钟后再获取验证码' content: '请一分钟后再获取验证码'
}); });
} }
uni.hideLoading();
})
} }
}, }
/** /**
* 验证码倒计时 * 验证码倒计时
*/ */
countDown() { function countDown() {
const { count } = this; if (data.count === 1) {
if (count === 1) { data.count = 60;
this.count = 60; data.sending = false;
this.sending = false; data.sendTime = '获取验证码';
this.sendTime = '获取验证码';
} else { } else {
this.count = count - 1; data.count = count - 1;
this.sending = true; data.sending = true;
this.sendTime = count - 1 + '秒后重新获取'; data.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000); setTimeout(data.countDown.bind(data), 1000);
}
} }
},
/** /**
* 获取注册值 * 获取注册值
* @param {Object} e * @param {Object} e
*/ */
inputChange(e) { function inputChange(e) {
const key = e.currentTarget.dataset.key; const key = e.currentTarget.dataset.key;
this[key] = e.detail.value; data[key] = e.detail.value;
}, }
/** /**
* 是否同意协议 * 是否同意协议
* @param {Object} e * @param {Object} e
*/ */
radioChange(e) { function radioChange(e) {
this.checked = e data.checked = e
}, }
/** /**
* 登录 * 登录
*/ */
toLogin() { function toLogin() {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
}, }
/** /**
* 注册 * 注册
*/ */
toRegister() { async function toRegister() {
const { const {
mobile, mobile,
password, password,
@@ -176,7 +173,7 @@
invitation, invitation,
registerCode, registerCode,
qdCodeion qdCodeion
} = this; } = data;
if (!mobile) { if (!mobile) {
uni.showToast({ uni.showToast({
title: '请输入账号', title: '请输入账号',
@@ -225,7 +222,7 @@
}) })
return return
} }
this.logining = true; data.logining = true;
uni.showLoading({ uni.showLoading({
title: '注册中...' title: '注册中...'
}) })
@@ -236,12 +233,17 @@
// #ifdef H5 // #ifdef H5
platform = 'h5' platform = 'h5'
// #endif // #endif
http.request({
url: 'app/Login/registerCode?password=' + password + '&phone=' + mobile + '&msg=' + code +
'&inviterCode=' + invitation + '&platform=' + platform + '&qdCode=' + qdCodeion, let res = await registerCode({
method: 'post' password: password,
}).then(res => { phone: mobile,
console.log(res) msg: code,
inviterCode: invitation,
platform: platform,
qdCode: qdCodeion,
})
if (res.code === 0) { if (res.code === 0) {
uni.setStorageSync('token', res.token) uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId) uni.setStorageSync('userId', res.user.userId)
@@ -269,12 +271,9 @@
}); });
} }
uni.hideLoading(); uni.hideLoading();
})
} }
}
};
</script> </script>
<style lang="scss" > <style lang="scss" >

View File

@@ -52,11 +52,11 @@
</view> </view>
</template> </template>
<script> <script setup>
import { reactive } from 'vue';
import { onLoad} from '@dcloudio/uni-app'
import http from '@/http/http.js'; import http from '@/http/http.js';
export default { let data = reactive({
data() {
return {
code: '', code: '',
mobile: '', mobile: '',
password: '', password: '',
@@ -66,11 +66,11 @@
relation: "", relation: "",
invitation: '', invitation: '',
registerCode: '', registerCode: '',
qdCodeion: '', qdCodeion: '', //渠道码
checked: false, checked: false,
}; })
},
onLoad(e) { onLoad(( options ) => {
let relation = e.invitation let relation = e.invitation
if (relation) { if (relation) {
this.relation = relation; this.relation = relation;
@@ -86,27 +86,26 @@
this.registerCode = res.data.value this.registerCode = res.data.value
} }
}); });
})
},
methods: {
/** /**
* 是否同意协议 * 是否同意协议
* @param {Object} e * @param {Object} e
*/ */
radioChange(e) { function radioChange(e) {
this.checked = e this.checked = e
}, }
showMa() { function showMa() {
//查询官方邀请码 //查询官方邀请码
this.$Request.getT('/common/type/88').then(res => { this.$Request.getT('/common/type/88').then(res => {
if (res.code == 0) { if (res.code == 0) {
this.invitation = res.data.value; this.invitation = res.data.value;
} }
}); });
}, }
sendMsg() {
function sendMsg() {
const { const {
mobile mobile
} = this; } = this;
@@ -149,8 +148,8 @@
}) })
} }
}, }
countDown() { function countDown() {
const { const {
count count
} = this; } = this;
@@ -164,27 +163,21 @@
this.sendTime = count - 1 + '秒后重新获取'; this.sendTime = count - 1 + '秒后重新获取';
setTimeout(this.countDown.bind(this), 1000); setTimeout(this.countDown.bind(this), 1000);
} }
}, }
inputChange(e) {
function inputChange(e) {
const key = e.currentTarget.dataset.key; const key = e.currentTarget.dataset.key;
this[key] = e.detail.value; this[key] = e.detail.value;
}, }
navBack() {
uni.navigateBack();
},
navTo(url) { function toLogin() {
uni.navigateTo({
url
});
},
toLogin() {
console.log("123"); console.log("123");
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
}, }
toRegister() {
function toRegister() {
const { const {
mobile, mobile,
password, password,
@@ -286,10 +279,7 @@
}); });
} }
}); });
},
} }
};
</script> </script>
<style lang="scss" scoped> <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-group>
<up-cell title="头像"> <up-cell title="头像">
<template #value> <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> style="width: 111rpx;height: 111rpx;border-radius: 50%;"></image>
</template> </template>
</up-cell> </up-cell>
<up-cell title="用户名"> <up-cell title="用户名">
<template #value> <template #value>
<input v-model="userInfo.userName" align="right" placeholder="请输入用户名" /> <input v-model="data.userInfo.userName" align="right" placeholder="请输入用户名" />
</template> </template>
</up-cell> </up-cell>
<up-cell title="手机"> <up-cell title="手机">
<template #value> <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> </template>
</up-cell> </up-cell>
</up-cell-group> </up-cell-group>
@@ -22,40 +22,39 @@
</view> </view>
</template> </template>
<script> <script setup>
import { reactive } from 'vue';
import { onShow} from '@dcloudio/uni-app'
import config from '@/commons/config.js'; import config from '@/commons/config.js';
import http from '@/http/http.js'; import {selectUserById} from '@/api/user/user.js';
export default {
data() { let data = reactive({
return{
userInfo: { userInfo: {
avatar: '', avatar: '',
userName: '', userName: '',
phone: '', phone: '',
} }
} })
},
onLoad( options ) { onShow(() => {
this.getUserInfo() // console.log(1)
}, getUserInfo()
})
methods: {
/** /**
* 获取个人信息 * 获取个人信息
*/ */
getUserInfo() { async function getUserInfo () {
http.request({ let res = await selectUserById()
url:'app/user/selectUserById', if ( res.code == 0 ) {
}).then(res => { data.userInfo = res.data
this.userInfo = res.data }
}) }
},
/** /**
* 上头像 * 上头像
*/ */
uploadImg() { function uploadImg () {
let that = this;
var url = null; var url = null;
uni.showActionSheet({ uni.showActionSheet({
// itemList按钮的文字接受的是数组 // itemList按钮的文字接受的是数组
@@ -66,7 +65,7 @@
if (index === 0) { if (index === 0) {
// 用户点击了预览当前图片 // 用户点击了预览当前图片
// 可以自己实现当前头像链接的读取 // 可以自己实现当前头像链接的读取
let url = that.headImg; let url = data.userInfo.avatar;
let arr = [] let arr = []
arr.push(url) arr.push(url)
uni.previewImage({ uni.previewImage({
@@ -89,7 +88,7 @@
success: uploadFileRes => { success: uploadFileRes => {
url = JSON.parse(uploadFileRes.data); url = JSON.parse(uploadFileRes.data);
console.log(url) console.log(url)
this.userInfo.avatar = url.data data.userInfo.avatar = url.data
uni.hideLoading(); uni.hideLoading();
} }
@@ -99,27 +98,27 @@
} }
} }
}) })
}, }
/** /**
* 保存 * 保存
*/ */
save() { function save () {
if (!this.userInfo.userName) { if (!data.userInfo.userName) {
uni.showToast({ uni.showToast({
title: "用户名不能为空", title: "用户名不能为空",
icon: "none" icon: "none"
}) })
return return
} }
if (!this.userInfo.phone) { if (!data.userInfo.phone) {
uni.showToast({ uni.showToast({
title: "手机号不能空", title: "手机号不能空",
icon: "none" icon: "none"
}) })
return return
} }
if (this.checkPhone(this.userInfo.phone) == false) { if (checkPhone(data.userInfo.phone) == false) {
uni.showToast({ uni.showToast({
title: "手机号格式不正确", title: "手机号格式不正确",
icon: "none" icon: "none"
@@ -137,9 +136,9 @@
url:'app/user/updateUsers', url:'app/user/updateUsers',
method: 'post', method: 'post',
data: { data: {
userName: this.userInfo.userName, userName: data.userInfo.userName,
avatar: this.userInfo.avatar, avatar: data.userInfo.avatar,
phone: this.userInfo.phone, phone: data.userInfo.phone,
} }
}).then(res => { }).then(res => {
uni.showToast({ uni.showToast({
@@ -154,12 +153,10 @@
} }
} }
}); });
},
//根据正则验证手机号是否正确包括校验长度
checkPhone(phone) {
return /^1[3456789]\d{9}$/.test(phone);
},
} }
function checkPhone(phone) {
return /^1[3456789]\d{9}$/.test(phone);
} }
</script> </script>