feat: 引入uView Plus组件库,新增部分静态页面
This commit is contained in:
@@ -14,6 +14,19 @@ const AuthUtil = {
|
||||
},
|
||||
});
|
||||
},
|
||||
// 账号登录
|
||||
loginAccount: (data) => {
|
||||
return request({
|
||||
url: '/auth/login',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '登录中',
|
||||
successMsg: '登录成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 使用手机 + 验证码登录
|
||||
smsLogin: (data) => {
|
||||
return request({
|
||||
|
||||
@@ -4,12 +4,8 @@
|
||||
<!-- 标题栏 -->
|
||||
<view class="head-box ss-m-b-60">
|
||||
<view class="ss-m-b-20">
|
||||
<!-- <view class="head-title-active head-title-line" @tap="showAuthModal('smsLogin')">
|
||||
短信登录
|
||||
</view> -->
|
||||
<view class="head-title head-title-animation">登录账号</view>
|
||||
</view>
|
||||
<view class="head-subtitle">如无账号请联系平台开通</view>
|
||||
<!-- <view class="head-subtitle">如果未设置过密码,请点击忘记密码</view> -->
|
||||
</view>
|
||||
|
||||
@@ -24,11 +20,11 @@
|
||||
>
|
||||
<uni-forms-item name="mobile" label="账号">
|
||||
<uni-easyinput placeholder="请输入手机号" v-model="state.model.mobile" :inputBorder="false">
|
||||
<!-- <template v-slot:right>
|
||||
<template v-slot:right>
|
||||
<button class="ss-reset-button forgot-btn" @tap="showAuthModal('resetPassword')">
|
||||
忘记密码
|
||||
</button>
|
||||
</template> -->
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
@@ -45,6 +41,14 @@
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<view class="text-center">
|
||||
<text class="head-title-active head-title-line" @tap="showAuthModal('smsLogin')">
|
||||
验证码登录
|
||||
</text>
|
||||
<text class="head-title-active head-title-line" style="margin-left:25rpx;" @click="toRegister">
|
||||
骑手注册
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -69,7 +73,8 @@
|
||||
// 数据
|
||||
const state = reactive({
|
||||
model: {
|
||||
mobile: '', // 账号
|
||||
username: '', // 账号
|
||||
mobile: '',
|
||||
password: '', // 密码
|
||||
},
|
||||
rules: {
|
||||
@@ -97,10 +102,18 @@
|
||||
|
||||
// 提交数据
|
||||
const { code, data } = await AuthUtil.login(state.model);
|
||||
// const { code, data } = await AuthUtil.loginAccount(state.model);
|
||||
if (code === 0) {
|
||||
closeAuthModal();
|
||||
}
|
||||
}
|
||||
|
||||
const toRegister = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/registered/registerRiders'
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<view>
|
||||
<!-- 标题栏 -->
|
||||
<view class="head-box ss-m-b-60">
|
||||
<view class="head-title ss-m-b-20">重置密码</view>
|
||||
<view class="head-title ss-m-b-20 text-center">重置密码</view>
|
||||
<view class="head-subtitle">为了您的账号安全,设置密码前请先进行安全验证</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
<view>
|
||||
<!-- 标题栏 -->
|
||||
<view class="head-box ss-m-b-60">
|
||||
<view class="ss-flex ss-m-b-20">
|
||||
<view class="ss-m-b-20 ">
|
||||
<view class="head-title head-title-line head-title-animation">短信登录</view>
|
||||
<view class="head-title-active ss-m-r-40" @tap="showAuthModal('accountLogin')">
|
||||
账号登录
|
||||
</view>
|
||||
</view>
|
||||
<view class="head-subtitle">未注册的手机号,验证后自动注册账号</view>
|
||||
</view>
|
||||
@@ -55,6 +52,10 @@
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
|
||||
<view class="head-title-active ss-m-r-40 text-center" @tap="showAuthModal('accountLogin')">
|
||||
账号登录
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -154,3 +154,7 @@
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -10,23 +10,24 @@
|
||||
/>
|
||||
|
||||
<!-- 2. 短信登录 smsLogin -->
|
||||
<!-- <sms-login
|
||||
<smsLogin
|
||||
v-if="authType === 'smsLogin'"
|
||||
:agreeStatus="state.protocol"
|
||||
@onConfirm="onConfirm"
|
||||
/> -->
|
||||
|
||||
/>
|
||||
|
||||
|
||||
<!-- 3. 忘记密码 resetPassword-->
|
||||
<reset-password v-if="authType === 'resetPassword'" />
|
||||
|
||||
<!-- 4. 绑定手机号 changeMobile -->
|
||||
<change-mobile v-if="authType === 'changeMobile'" />
|
||||
<!-- <change-mobile v-if="authType === 'changeMobile'" /> -->
|
||||
|
||||
<!-- 5. 修改密码 changePassword-->
|
||||
<changePassword v-if="authType === 'changePassword'" />
|
||||
|
||||
<!-- 6. 微信小程序授权 -->
|
||||
<mp-authorization v-if="authType === 'mpAuthorization'" />
|
||||
<!-- <mp-authorization v-if="authType === 'mpAuthorization'" /> -->
|
||||
|
||||
<!-- 7. 第三方登录 -->
|
||||
<view
|
||||
@@ -34,8 +35,8 @@
|
||||
class="auto-login-box ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||
>
|
||||
<!-- 7.1 微信小程序的快捷登录 -->
|
||||
<view v-if="sheep.$platform.name === 'WechatMiniProgram'" class="ss-flex register-box">
|
||||
<!-- <view class="register-title">还没有账号?</view> -->
|
||||
<!-- <view v-if="sheep.$platform.name === 'WechatMiniProgram'" class="ss-flex register-box">
|
||||
<view class="register-title">还没有账号?</view>
|
||||
<view class="register-title">已经拥有账号可以,</view>
|
||||
<button
|
||||
class="ss-reset-button login-btn"
|
||||
@@ -45,7 +46,7 @@
|
||||
快捷登录
|
||||
</button>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 7.2 微信的公众号、App、小程序的登录,基于 openid + code -->
|
||||
<!-- <button
|
||||
|
||||
@@ -19,17 +19,20 @@
|
||||
@pickstart="pickstart"
|
||||
@pickend="pickend"
|
||||
>
|
||||
<!-- 省级选择列 -->
|
||||
<picker-view-column>
|
||||
<view class="ui-column-item" v-for="province in provinceList" :key="province.id">
|
||||
<view :style="getSizeByNameLength(province.name)">{{ province.name }}</view>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<!-- 市级选择列 -->
|
||||
<picker-view-column v-if="props.level >= 2">
|
||||
<view class="ui-column-item" v-for="city in cityList" :key="city.id">
|
||||
<view :style="getSizeByNameLength(city.name)">{{ city.name }}</view>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
<!-- 区级选择列 -->
|
||||
<picker-view-column v-if="props.level >= 3">
|
||||
<view class="ui-column-item" v-for="district in districtList" :key="district.id">
|
||||
<view :style="getSizeByNameLength(district.name)">{{ district.name }}</view>
|
||||
</view>
|
||||
@@ -56,6 +59,7 @@
|
||||
* @property {String Number} z-index 弹出时的z-index值(默认1075)
|
||||
* @property {Array} default-selector 数组形式,其中每一项表示选择了range对应项中的第几个
|
||||
* @property {String} range-key 当range参数的元素为对象时,指定Object中的哪个key的值作为选择器显示内容
|
||||
* @property {Number} level 选择器层级:1-只显示省,2-显示省市,3-显示省市区(默认3)
|
||||
* @event {Function} confirm 点击确定按钮,返回当前选择的值
|
||||
* @event {Function} cancel 点击取消按钮,返回当前选择的值
|
||||
*/
|
||||
@@ -85,6 +89,12 @@
|
||||
type: String,
|
||||
default: '确认',
|
||||
},
|
||||
// 选择器层级:1-只显示省,2-显示省市,3-显示省市区
|
||||
level: {
|
||||
type: Number,
|
||||
default: 3,
|
||||
validator: (value) => [1, 2, 3].includes(value),
|
||||
},
|
||||
});
|
||||
const areaData = uni.getStorageSync('areaData');
|
||||
|
||||
@@ -98,7 +108,7 @@
|
||||
}
|
||||
};
|
||||
const state = reactive({
|
||||
currentIndex: [0, 0, 0],
|
||||
currentIndex: Array(props.level).fill(0),
|
||||
moving: false, // 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
|
||||
});
|
||||
const emits = defineEmits(['confirm', 'cancel', 'change']);
|
||||
@@ -106,10 +116,12 @@
|
||||
const provinceList = areaData;
|
||||
|
||||
const cityList = computed(() => {
|
||||
return areaData[state.currentIndex[0]].children;
|
||||
const province = areaData?.[state.currentIndex[0]];
|
||||
return province?.children || [];
|
||||
});
|
||||
const districtList = computed(() => {
|
||||
return cityList.value[state.currentIndex[1]]?.children;
|
||||
const city = cityList.value?.[state.currentIndex[1]];
|
||||
return city?.children || [];
|
||||
});
|
||||
// 标识滑动开始,只有微信小程序才有这样的事件
|
||||
const pickstart = () => {
|
||||
@@ -132,21 +144,28 @@
|
||||
|
||||
// 用户更改picker的列选项
|
||||
const change = (e) => {
|
||||
if (
|
||||
state.currentIndex[0] === e.detail.value[0] &&
|
||||
state.currentIndex[1] === e.detail.value[1]
|
||||
) {
|
||||
// 不更改省市区列表
|
||||
state.currentIndex[2] = e.detail.value[2];
|
||||
return;
|
||||
} else {
|
||||
// 更改省市区列表
|
||||
if (state.currentIndex[0] !== e.detail.value[0]) {
|
||||
e.detail.value[1] = 0;
|
||||
const newIndex = [...e.detail.value];
|
||||
let shouldResetSubsequent = false;
|
||||
|
||||
// 检查每一列是否发生变化,如果上级发生变化,需要重置下级
|
||||
for (let i = 0; i < props.level; i++) {
|
||||
if (state.currentIndex[i] !== newIndex[i]) {
|
||||
shouldResetSubsequent = true;
|
||||
// 重置当前列之后的所有列
|
||||
for (let j = i + 1; j < props.level; j++) {
|
||||
newIndex[j] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
e.detail.value[2] = 0;
|
||||
state.currentIndex = e.detail.value;
|
||||
}
|
||||
|
||||
if (shouldResetSubsequent) {
|
||||
state.currentIndex = newIndex;
|
||||
} else {
|
||||
// 只有最后一列变化,不需要重置
|
||||
state.currentIndex = newIndex;
|
||||
}
|
||||
|
||||
emits('change', state.currentIndex);
|
||||
};
|
||||
|
||||
@@ -156,18 +175,29 @@
|
||||
if (state.moving) return;
|
||||
// #endif
|
||||
let index = state.currentIndex;
|
||||
let province = provinceList[index[0]];
|
||||
let city = cityList.value[index[1]];
|
||||
let district = districtList.value[index[2]];
|
||||
let province = provinceList?.[index[0]];
|
||||
if (!province) return;
|
||||
let result = {
|
||||
province_name: province.name,
|
||||
province_id: province.id,
|
||||
city_name: city.name,
|
||||
city_id: city.id,
|
||||
district_name: district.name,
|
||||
district_id: district.id,
|
||||
};
|
||||
|
||||
if (props.level >= 2) {
|
||||
let city = cityList.value?.[index[1]];
|
||||
if (city?.name) {
|
||||
result.city_name = city.name;
|
||||
result.city_id = city.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (props.level >= 3) {
|
||||
let district = districtList.value?.[index[2]];
|
||||
if (district?.name) {
|
||||
result.district_name = district.name;
|
||||
result.district_id = district.id;
|
||||
}
|
||||
}
|
||||
|
||||
if (event) emits(event, result);
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user