|
@@ -4,7 +4,7 @@
|
|
|
智能营销系统,欢迎您!
|
|
智能营销系统,欢迎您!
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <view class="main-card">
|
|
|
|
|
|
|
+ <view class="main-card" style="margin-top:20%">
|
|
|
<!-- <image class="logo" :src="imgurl+'/cjx/hexiao/lobin_lobin.png'" mode="aspectFit"></image>-->
|
|
<!-- <image class="logo" :src="imgurl+'/cjx/hexiao/lobin_lobin.png'" mode="aspectFit"></image>-->
|
|
|
|
|
|
|
|
<view class="user-type-selector">
|
|
<view class="user-type-selector">
|
|
@@ -26,42 +26,53 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <view class="form-group">
|
|
|
|
|
- <view class="input-wrapper">
|
|
|
|
|
- <uni-icons type="person" size="24" color="#cccccc"></uni-icons>
|
|
|
|
|
- <input class="input-field" type="number" v-model="phone" placeholder="请输入手机号" placeholder-class="placeholder" />
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view class="input-wrapper">
|
|
|
|
|
- <uni-icons type="locked" size="24" color="#cccccc"></uni-icons>
|
|
|
|
|
- <input class="input-field" type="number" v-model="code" placeholder="请输入验证码" placeholder-class="placeholder" />
|
|
|
|
|
- <text
|
|
|
|
|
- class="code-btn"
|
|
|
|
|
- :class="{ 'disabled': isCountingDown }"
|
|
|
|
|
- @click="getVerificationCode"
|
|
|
|
|
- >
|
|
|
|
|
- {{ codeBtnText }}
|
|
|
|
|
- </text>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <view v-if="showTel">
|
|
|
|
|
+ <view class="form-group">
|
|
|
|
|
+ <view class="input-wrapper">
|
|
|
|
|
+ <uni-icons type="person" size="24" color="#cccccc"></uni-icons>
|
|
|
|
|
+ <input class="input-field" type="number" v-model="phone" placeholder="请输入手机号" placeholder-class="placeholder" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <view class="input-wrapper">
|
|
|
|
|
+ <uni-icons type="locked" size="24" color="#cccccc"></uni-icons>
|
|
|
|
|
+ <input class="input-field" type="number" v-model="code" placeholder="请输入验证码" placeholder-class="placeholder" />
|
|
|
|
|
+ <text
|
|
|
|
|
+ class="code-btn"
|
|
|
|
|
+ :class="{ 'disabled': isCountingDown }"
|
|
|
|
|
+ @click="getVerificationCode"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ codeBtnText }}
|
|
|
|
|
+ </text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
|
|
+ <button class="login-btn" @click="handleLogin">登 录</button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-if="!showTel">
|
|
|
|
|
+ <view>
|
|
|
|
|
+ 请点击下方按钮进行授权登录
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
- <button class="login-btn" @click="handleLogin">登 录</button>
|
|
|
|
|
-
|
|
|
|
|
-<!-- <view class="version-info">-->
|
|
|
|
|
-<!-- 版本号:V1.0.0-->
|
|
|
|
|
-<!-- </view>-->
|
|
|
|
|
|
|
+ <button class="login-btn" open-type="getPhoneNumber" @getphonenumber="handlePhone">
|
|
|
|
|
+ 授权登录
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view style="font-size: 12px;margin-top:12%;" @click="showTel = !showTel">
|
|
|
|
|
+ <view v-if="!showTel">使用手机号验证码登录</view>
|
|
|
|
|
+ <view v-if="showTel">一键登录</view>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
// 1. 导入你的API方法
|
|
// 1. 导入你的API方法
|
|
|
-import { getVerificationCode, login } from '@/api/hexiao.js';
|
|
|
|
|
|
|
+import { getVerificationCode, login ,oneKeyLogin} from '@/api/hexiao.js';
|
|
|
import {getAdminInfo, getAdminToken, setAdminInfo, setAdminToken} from "@/utils/auth";
|
|
import {getAdminInfo, getAdminToken, setAdminInfo, setAdminToken} from "@/utils/auth";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ showTel: false,
|
|
|
userType: 'distributor',
|
|
userType: 'distributor',
|
|
|
phone: '',
|
|
phone: '',
|
|
|
code: '',
|
|
code: '',
|
|
@@ -91,6 +102,46 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ handlePhone(e) {
|
|
|
|
|
+ if (e.detail.code) {
|
|
|
|
|
+ // this.loginDate.iv = e.detail.iv;
|
|
|
|
|
+ // this.loginDate.encryptedData = e.detail.encryptedData;
|
|
|
|
|
+ uni.showLoading({ title: '登录中...' });
|
|
|
|
|
+ let userType = 0;
|
|
|
|
|
+ if(this.userType === 'distributor'){
|
|
|
|
|
+ userType = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.userType === 'salesman'){
|
|
|
|
|
+ userType = 2;
|
|
|
|
|
+ }
|
|
|
|
|
+ let self = this;
|
|
|
|
|
+ uni.login({
|
|
|
|
|
+ provider: 'weixin', //使用微信登录
|
|
|
|
|
+ success: function (loginRes) {
|
|
|
|
|
+ let jsCode = loginRes.code;
|
|
|
|
|
+ oneKeyLogin( e.detail.code,userType,jsCode,self.tenantId).then(res => {
|
|
|
|
|
+ // 登录成功 (res.code === 0)
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ setAdminToken(res.data.sessionId)
|
|
|
|
|
+ self.setUserInfo(res.data);
|
|
|
|
|
+ self.doLoginSuccess();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('登录失败!' + res.msg);
|
|
|
|
|
+ uni.showToast({ title: err.msg || '登录失败', icon: 'none' });
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ // 登录失败 (res.code !== 0 或网络错误)
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ console.error('登录失败:', err);
|
|
|
|
|
+ uni.showToast({ title: err.msg || '登录失败', icon: 'none' });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
doLoginSuccess(){
|
|
doLoginSuccess(){
|
|
|
|
|
|
|
|
let info = getAdminInfo()
|
|
let info = getAdminInfo()
|