This commit is contained in:
zmj 2024-05-09 10:40:50 +08:00
commit 91c409f11d
4 changed files with 153 additions and 102 deletions

View File

@ -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

View File

@ -45,6 +45,14 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path" : "pages/code/code",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
} }
], ],

31
pages/code/code.vue Normal file
View File

@ -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>

View File

@ -7,15 +7,18 @@
</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" <up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
color="#fff" size="28"></up-icon></up-button> size="28"></up-icon></up-button>
</view> </view>
<!-- <view class="btn">
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
size="28"></up-icon></up-button>
</view> -->
<view class="btn"> <view class="btn">
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text <up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
style="color: #20B128;">使用短信验证登录</text></up-button> style="color: #20B128;">使用短信验证登录</text></up-button>
@ -26,22 +29,20 @@
<up-transition :show="!showWeixin"> <up-transition :show="!showWeixin">
<view class="form"> <view class="form">
<view class="input"> <view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place" <up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place" border="none"
border="none" placeholder="请输入手机号" type="number"> placeholder="请输入手机号" type="number">
<template #prefix> <template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;" <image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png"> src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png"></image>
</image>
</template> </template>
</up-input> </up-input>
</view> </view>
<view class="input"> <view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4" <up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4" placeholderClass="place"
placeholderClass="place" border="none" placeholder="请输入验证码" type="number"> border="none" placeholder="请输入验证码" type="number">
<template #prefix> <template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;" <image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png"> src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png"></image>
</image>
</template> </template>
<template #suffix> <template #suffix>
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code> <up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
@ -64,23 +65,17 @@
</view> </view>
</view> </view>
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" /> <bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
<modal :show="showOfficial" @close="showOfficial = false" @change="officialCode()" title="您还未绑定公众号" content="需要绑定公众号后才可以接收消息" confirmText="立即绑定" />
</view> </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 {
ref
} from "vue"
import {
userLoginApi,
userLoginWeixinApi,
getMobileByMnpApi
} from "@/api/user.js";
import useUserStore from "@/store/user.js" import useUserStore from "@/store/user.js"
import bindPhone from "@/components/bindPhone.vue" import bindPhone from "@/components/bindPhone.vue"
import modal from "@/components/modal.vue"
@ -88,9 +83,26 @@
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) {
return showOfficial.value = true;
}
else{
uni.reLaunch({
url: '/pageQuota/quotation/index' 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
@ -131,9 +143,9 @@
}) })
} }
const showOfficial = ref(false);
const showBind = ref(false); // const showBind = ref(false); //
const getPhoneNumber = (e) => { const getPhoneNumber = (e) => {
console.log("===", e);
if (e.detail?.errMsg == 'getPhoneNumber:ok') { if (e.detail?.errMsg == 'getPhoneNumber:ok') {
getMobileByMnpApi({ getMobileByMnpApi({
code: e.detail.code code: e.detail.code