Merge branch 'master' of https://gitea.lihaink.cn/weipengfei/purchase-let into dev
This commit is contained in:
commit
91c409f11d
|
@ -8,7 +8,7 @@ let env = "prod"
|
||||||
switch(env){
|
switch(env){
|
||||||
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
|
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
|
||||||
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
|
||||||
default: BASE_URL = 'http://192.168.1.15:8546';
|
default: BASE_URL = 'http://192.168.1.10:8546';
|
||||||
}
|
}
|
||||||
|
|
||||||
let HTTP_REQUEST_URL
|
let HTTP_REQUEST_URL
|
||||||
|
|
|
@ -45,6 +45,14 @@
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/code/code",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "",
|
||||||
|
"enablePullDownRefresh" : false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<template>
|
||||||
|
<view class="">
|
||||||
|
<web-view v-if="src" :src="src"></web-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from "vue"
|
||||||
|
import { onLoad } from "@dcloudio/uni-app"
|
||||||
|
|
||||||
|
let url = 'https://crmeb-test.shop.lihaink.cn/api/view?uid='; //地址
|
||||||
|
let uid = 9; // 用户id
|
||||||
|
let navTo = '_|_navTo=_pages_index_index' // 回跳页面地址 _pages_index_index 中/替换成_ 需要带上 _|_navTo 前缀
|
||||||
|
// let navTo = '_|_navTo=_pageQuota_quotation_detail' // 回跳页面地址 _pages_index_index 中/替换成_ 需要带上 _|_navTo 前缀
|
||||||
|
const src = ref('')
|
||||||
|
|
||||||
|
onLoad(options=>{
|
||||||
|
if(options.id) {
|
||||||
|
uid = options.id;
|
||||||
|
}
|
||||||
|
// url = url + uid + navTo;
|
||||||
|
url = url + uid;
|
||||||
|
// 公众号绑定
|
||||||
|
src.value = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxe2428e8fe6767e45&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=92efd21273559f62a614a3b49e2e3fcb&connect_redirect=1#wechat_redirect`
|
||||||
|
console.log(src.value);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
|
@ -1,97 +1,109 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
|
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
|
||||||
<template #left>
|
<template #left>
|
||||||
<up-icon v-if="!showWeixin" name="arrow-left" @click="navBack" size="20"></up-icon>
|
<up-icon v-if="!showWeixin" name="arrow-left" @click="navBack" size="20"></up-icon>
|
||||||
<view v-else></view>
|
<view v-else></view>
|
||||||
</template>
|
</template>
|
||||||
</up-navbar>
|
</up-navbar>
|
||||||
<view class="login-box">
|
<view class="login-box">
|
||||||
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
|
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image>
|
||||||
</image>
|
<view class="tips">欢迎登录惠农批发</view>
|
||||||
<view class="tips">欢迎登录惠农批发</view>
|
<block v-if="showWeixin">
|
||||||
<block v-if="showWeixin">
|
<up-transition :show="showWeixin">
|
||||||
<up-transition :show="showWeixin">
|
<view class="btn">
|
||||||
<view class="btn">
|
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
||||||
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill"
|
size="28"></up-icon>微信快捷登录</up-button>
|
||||||
color="#fff" size="28"></up-icon>微信快捷登录</up-button>
|
</view>
|
||||||
</view>
|
<!-- <view class="btn">
|
||||||
<view class="btn">
|
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
||||||
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
|
size="28"></up-icon>公众号授权</up-button>
|
||||||
style="color: #20B128;">使用短信验证登录</text></up-button>
|
</view> -->
|
||||||
</view>
|
<view class="btn">
|
||||||
</up-transition>
|
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
|
||||||
</block>
|
style="color: #20B128;">使用短信验证登录</text></up-button>
|
||||||
<block v-else>
|
</view>
|
||||||
<up-transition :show="!showWeixin">
|
</up-transition>
|
||||||
<view class="form">
|
</block>
|
||||||
<view class="input">
|
<block v-else>
|
||||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place"
|
<up-transition :show="!showWeixin">
|
||||||
border="none" placeholder="请输入手机号" type="number">
|
<view class="form">
|
||||||
<template #prefix>
|
<view class="input">
|
||||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place" border="none"
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png">
|
placeholder="请输入手机号" type="number">
|
||||||
</image>
|
<template #prefix>
|
||||||
</template>
|
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||||
</up-input>
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png"></image>
|
||||||
</view>
|
</template>
|
||||||
<view class="input">
|
</up-input>
|
||||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4"
|
</view>
|
||||||
placeholderClass="place" border="none" placeholder="请输入验证码" type="number">
|
<view class="input">
|
||||||
<template #prefix>
|
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4" placeholderClass="place"
|
||||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
border="none" placeholder="请输入验证码" type="number">
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png">
|
<template #prefix>
|
||||||
</image>
|
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||||
</template>
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png"></image>
|
||||||
<template #suffix>
|
</template>
|
||||||
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
|
<template #suffix>
|
||||||
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
|
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
|
||||||
</template>
|
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
|
||||||
</up-input>
|
</template>
|
||||||
</view>
|
</up-input>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn">
|
</view>
|
||||||
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
|
<view class="btn">
|
||||||
</view>
|
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
|
||||||
</up-transition>
|
</view>
|
||||||
</block>
|
</up-transition>
|
||||||
<view class="agreement">
|
</block>
|
||||||
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
|
<view class="agreement">
|
||||||
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
|
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
|
||||||
<view>
|
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
|
||||||
我已同意<text>《用户协议》</text>与<text>《隐私政策》</text>
|
<view>
|
||||||
</view>
|
我已同意<text>《用户协议》</text>与<text>《隐私政策》</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
|
</view>
|
||||||
</view>
|
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
|
||||||
|
<modal :show="showOfficial" @close="showOfficial = false" @change="officialCode()" title="您还未绑定公众号" content="需要绑定公众号后才可以接收消息" confirmText="立即绑定" />
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { onBackPress } from "@dcloudio/uni-app"
|
||||||
onBackPress
|
import { ref } from "vue"
|
||||||
} from "@dcloudio/uni-app"
|
import { userLoginApi, userLoginWeixinApi, getMobileByMnpApi } from "@/api/user.js";
|
||||||
import {
|
import useUserStore from "@/store/user.js"
|
||||||
ref
|
import bindPhone from "@/components/bindPhone.vue"
|
||||||
} from "vue"
|
import modal from "@/components/modal.vue"
|
||||||
import {
|
|
||||||
userLoginApi,
|
|
||||||
userLoginWeixinApi,
|
|
||||||
getMobileByMnpApi
|
|
||||||
} from "@/api/user.js";
|
|
||||||
import useUserStore from "@/store/user.js"
|
|
||||||
import bindPhone from "@/components/bindPhone.vue"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const navToIndex = () => {
|
const navToIndex = () => {
|
||||||
if (!userStore.userInfo.supplier) uni.reLaunch({
|
if (!userStore.userInfo.supplier) uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
else uni.navigateTo({
|
else if(!userStore.userInfo.supplier.openid) {
|
||||||
url: '/pageQuota/quotation/index'
|
return showOfficial.value = true;
|
||||||
})
|
}
|
||||||
}
|
else{
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pageQuota/quotation/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 微信公众号绑定
|
||||||
|
const officialCode = ()=>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/code/code?id=${userStore.userInfo.id}`,
|
||||||
|
success: () => {
|
||||||
|
let user = userStore.userInfo;
|
||||||
|
user.supplier ? user.supplier.openid = 1 : user.supplier = {};
|
||||||
|
userStore.setUserInfo(user);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const userStore = useUserStore(); //使用pinia进行状态管理
|
const userStore = useUserStore(); //使用pinia进行状态管理
|
||||||
if (userStore.userInfo && userStore.userInfo.mobile) {
|
if (userStore.userInfo && userStore.userInfo.mobile) {
|
||||||
|
@ -131,20 +143,20 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const showBind = ref(false); //是否显示绑定手机号弹窗
|
const showOfficial = ref(false);
|
||||||
const getPhoneNumber = (e) => {
|
const showBind = ref(false); //是否显示绑定手机号弹窗
|
||||||
console.log("===", e);
|
const getPhoneNumber = (e) => {
|
||||||
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
||||||
getMobileByMnpApi({
|
getMobileByMnpApi({
|
||||||
code: e.detail.code
|
code: e.detail.code
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
navToIndex();
|
navToIndex();
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log("用户拒绝授权");
|
console.log("用户拒绝授权");
|
||||||
return uni.$u.toast('您拒绝了授权');
|
return uni.$u.toast('您拒绝了授权');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginForm = ref({
|
const loginForm = ref({
|
||||||
phone: '15366662222',
|
phone: '15366662222',
|
||||||
|
|
Loading…
Reference in New Issue