静态资源修改

This commit is contained in:
aihe 2024-07-13 16:34:34 +08:00
parent 52ab4935be
commit 22f31116dd
14 changed files with 226 additions and 440 deletions

View File

@ -5,12 +5,12 @@ export const host = curEnvConf.apiHost
export default {
uploadFile: '/common/ossUpload',
loginByApp: `/loginByApp`, // 登录
loginByMP: `/loginByWeixin`, // 小程序登录 -- DONE
getInfoByApp: `/getInfoByApp`,// 获取用户基本信息
updatePwdByApp: `/updatePwdByApp`,// 修改密码
getStaffQRCodePng: `/emis/emisStaff/getStaffQRCodePng`,// 获取用户二维码
getEmisCountry: `/emis/emisCountry/listSimple`, // 获取国家列表
getEmisRegion: `/emis/emisRegion/listSimple`,// 获取省市区列表
getDicDataJson: `/common/getDicDataJson`, // 获取枚举字段
getDicDataJson: `/common/getDicDataJson`, // 获取枚举字段 -- DONE
getAppHomeStatData: `/emis/commonTools/getAppHomeStatData`,// 首页统计数据
getLatestNotices: `/emis/commonTools/getLatestNotices`,// 首页统计数据
getCustomerUserAddressList: `/emis/emisCustomerAddress/listSimple`, // 获取客户地址列表

View File

@ -5,9 +5,11 @@ export const loginByApp = (data = {})=> {
return coreRequest(url.loginByApp, data)
}
export const loginByMP = (data = {})=> {
return coreRequest(url.loginByMP, data)
}
export const getInfoByApp = (data = {})=> {
return coreRequest(url.getInfoByApp, data, {}, 'GET')
}
export const updatePwdByApp = (data = {})=> {
return coreRequest(url.updatePwdByApp, data, {}, 'GET')
}

View File

@ -1,9 +1,9 @@
let envMap = {
development: {
apiHost: 'http://47.102.220.189:58089/api/bizsvr',
apiHost: 'http://47.102.220.189:59089/api/omssvr',
},
production: {
apiHost: 'http://api.emis.tanex56.com/api/bizsvr',
apiHost: 'https://api.sapp.tanex56.com/api/omssvr',
}
}
let curEnvConf

View File

@ -1,4 +1,9 @@
export default (path)=> {
// return `/sta_back/images/${path}`
return `http://oss-emis.tanex56.com/sapp/${path}`
return `/sta_back/images/${path}`
// return `https://oms.tanex56.com/static/sapp/images/${path}`
}
export const getCdnRoot = (path)=> {
// return `/static/${path}`
return `https://oms.tanex56.com/static/sapp/${path}`
}

View File

@ -8,7 +8,7 @@ const getCommonReqData = ()=> {
return {
header: {
"dataFrom": "sapp",
"X-Token": xToken,
"Oms-X-Token": xToken,
}
}
}
@ -82,6 +82,7 @@ async function handleResponse(options) {
resolve(data)
} else {
if ( code == 401) { // 统一判断需要认证, 并作页面跳转
debugger
setSessionXToken()
msg = '登录失效,请重新登录'
showToast(msg)

View File

@ -0,0 +1,122 @@
<template>
<view class="lgn-page">
<view class="pos-abt-all" style="z-index: 0;overflow: hidden;">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg.png')"></tpx-image>
<view class="yunduo">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg-yun.png')"></tpx-image>
</view>
</view>
<view class="pos-rlt" style="z-index: 1;">
<view>
<u-image custom-style="margin: 160rpx auto 0 auto;" width="140" height="140" :src="getCdnUrl('logo.png')"></u-image>
<u-text margin="70rpx 0 0 0" size="60" text="探路物流 速运全球" color="#fff" bold="true" align="center"></u-text>
</view>
<view style="margin-top: 90rpx;" class="pl-30 pr-30">
<u-text text="密码登录" size="30" color="#fff" bold="true"></u-text>
<view class="mt-40">
<u-input placeholder="请输入账号" color="#fff" font-size="30"
v-model="submitParams.username"
custom-style="padding: 30rpx 60rpx;background: rgba(255,255,255,0.2); border: 2px solid #FFFFFF;border-radius: 16rpx;"
placeholder-style="color: #FFF;"></u-input>
</view>
<view class="mt-40">
<u-input placeholder="请输入密码" color="#fff" font-size="30" type="password"
v-model="submitParams.password"
custom-style="padding: 30rpx 60rpx;background: rgba(255,255,255,0.2); border: 2px solid #FFFFFF;border-radius: 16rpx;"
placeholder-style="color: #FFF;"></u-input>
</view>
<view class="mt-30">
<u-checkbox-group placement="column" v-model="submitParams.remberPassport">
<u-checkbox size="28" labelSize="28" label="记住密码"
:name="true"
label-color="#fff" activeColor="#fff" iconColor="#B12D29" iconSize="20"></u-checkbox>
</u-checkbox-group>
</view>
<view style="margin-top: 70rpx;">
<u-button @click="handleLogin" custom-style="height:90rpx;font-size:32rpx;color: #B12D29;font-weight: bold;;box-shadow: 0rpx 12rpx 21rpx 0rpx rgba(177,45,41,0.32);border-radius: 16rpx;">登录</u-button>
</view>
</view>
</view>
</view>
</template>
<script>
import { USERKEY } from "@/store/actionKey"
import { getSessionLoginInfo, setSessionLoginInfo, setSessionXToken } from "@/session"
import { encrypt } from "@/common/libs/jsencrypt_utils"
export default {
props: {
},
data() {
return {
submitParams: {
isEncrypt: true,
username: '',
password: '',
remberPassport: []
},
}
},
onShareAppMessage() {
return {
title: '',
}
},
onLoad() {
let info = getSessionLoginInfo()
let { remberPassport } = info
if(remberPassport[0]) {
Object.assign(this.submitParams, info)
}
},
methods: {
async handleLogin() {
const { submitParams } = this
this.showLoading()
try{
setSessionXToken() // 登录前先清除xtoke
await this.$store.dispatch(USERKEY.LOGIN, {
...submitParams,
...(submitParams.isEncrypt ? {
password: encrypt(submitParams.password),
username: encrypt(submitParams.username),
} : {})
})
setSessionLoginInfo(submitParams)
this.$emit("succeedBack")
}catch(e){
console.error("USERKEY.LOGIN===catch error:", e)
}
this.hideLoading()
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page{
height: 100% !important;
}
</style>
<style scoped lang="scss">
.lgn-page {
background-color: #B12D29;
position: relative;
min-height: 100%;
background-size: 100% auto;
background-repeat: no-repeat;
}
.yunduo{
position: absolute;
bottom: 0rpx;
left: 0;
right: 0;
}
</style>

View File

@ -0,0 +1,63 @@
<template>
<view class="lgn-page">
<view class="pos-abt-all" style="z-index: 0;overflow: hidden;">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg.png')"></tpx-image>
<view class="yunduo">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg-yun.png')"></tpx-image>
</view>
</view>
<view class="pos-rlt" style="z-index: 1;">
<view>
<u-image custom-style="margin: 160rpx auto 0 auto;" width="140" height="140" :src="getCdnUrl('logo.png')"></u-image>
<u-text margin="70rpx 0 0 0" size="60" text="探路物流 速运全球" color="#fff" bold="true" align="center"></u-text>
</view>
<view style="margin-top: 90rpx;" class="pl-30 pr-30">
<view style="margin-top: 70rpx;">
<u-button @click="handleLogin" custom-style="height:90rpx;font-size:32rpx;color: #B12D29;font-weight: bold;;box-shadow: 0rpx 12rpx 21rpx 0rpx rgba(177,45,41,0.32);border-radius: 16rpx;">登录</u-button>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations,
mapActions
} from 'vuex'
const univerifyInfoKey = 'univerifyInfo';
export default {
data() {
return {
}
},
computed: {
},
onLoad() {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.lgn-page {
background-color: #B12D29;
position: relative;
min-height: 100%;
background-size: 100% auto;
background-repeat: no-repeat;
}
.yunduo{
position: absolute;
bottom: 0rpx;
left: 0;
right: 0;
}
</style>

View File

@ -179,28 +179,9 @@
}
],
"subPackages": [{
"root": "pages/API",
"pages": [{
"path": "login/login",
"style": {
"navigationBarTitleText": "授权登录"
}
},
{
"path": "get-user-info/get-user-info",
"style": {
"navigationBarTitleText": "获取用户信息"
}
},
{
"path": "request-payment/request-payment",
"style": {
"navigationBarTitleText": "发起支付"
}
}
]
}],
"subPackages": [
],
"globalStyle": {
"pageOrientation": "portrait",
"navigationBarTitleText": "探路物流",

View File

@ -1,322 +0,0 @@
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view style="background:#FFF; padding:40rpx;">
<block v-if="hasLogin === true">
<view class="uni-h3 uni-center uni-common-mt">已登录
<text v-if="isUniverifyLogin" style="font-size: 0.8em;">
<i v-if="!phoneNumber.length" class="uni-icon_toast uni-loading"></i>
<i v-else>({{phoneNumber}})</i>
</text>
</view>
<view class="uni-hello-text uni-center">
<text>每个账号仅需登录 1 次,\n后续每次进入页面即可自动拉取用户信息。</text>
</view>
</block>
<block v-if="hasLogin === false">
<view class="uni-h3 uni-center uni-common-mt">未登录</view>
<view class="uni-hello-text uni-center">
请点击按钮登录
</view>
</block>
</view>
<view class="uni-btn-v uni- uni-common-mt">
<!-- #ifdef MP-TOUTIAO -->
<button type="primary" class="page-body-button" v-for="(value,key) in providerList" @click="tologin(value)" :key="key">
登录
</button>
<!-- #endif -->
<!-- #ifndef MP-TOUTIAO -->
<button type="primary" class="page-body-button" v-for="(value,key) in providerList" @click="tologin(value)"
:loading="value.id === 'univerify' ? univerifyBtnLoading : false" :key="key">{{value.name}}</button>
<!-- #endif -->
</view>
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations,
mapActions
} from 'vuex'
const univerifyInfoKey = 'univerifyInfo';
export default {
data() {
return {
title: 'login',
providerList: [],
phoneNumber: '',
univerifyBtnLoading: false
}
},
computed: {
...mapState(['hasLogin', 'isUniverifyLogin', 'univerifyErrorMsg'])
},
onLoad() {
uni.getProvider({
service: 'oauth',
success: (result) => {
this.providerList = result.provider.map((value) => {
let providerName = '';
switch (value) {
case 'weixin':
providerName = '微信登录'
break;
case 'qq':
providerName = 'QQ登录'
break;
case 'sinaweibo':
providerName = '新浪微博登录'
break;
case 'xiaomi':
providerName = '小米登录'
break;
case 'alipay':
providerName = '支付宝登录'
break;
case 'baidu':
providerName = '百度登录'
break;
case 'jd':
providerName = '京东登录'
break;
case 'toutiao':
providerName = '头条登录'
break;
case 'apple':
providerName = '苹果登录'
break;
case 'univerify':
providerName = '一键登录'
break;
}
return {
name: providerName,
id: value
}
});
},
fail: (error) => {
console.log('获取登录通道失败', error);
}
});
if (this.hasLogin && this.isUniverifyLogin) {
this.getPhoneNumber(uni.getStorageSync(univerifyInfoKey)).then((phoneNumber) => {
this.phoneNumber = phoneNumber
})
}
},
methods: {
...mapMutations(['login', 'setUniverifyLogin']),
...mapActions(['getPhoneNumber']),
Toast(data, duration = 1000) {
uni.showToast(Object.assign({}, data, {
duration
}))
},
tologin(provider) {
if (provider.id === 'univerify') {
this.univerifyBtnLoading = true;
}
// 一键登录已在APP onLaunch的时候进行了预登陆,可以显著提高登录速度。登录成功后,预登陆状态会重置
uni.login({
provider: provider.id,
// #ifdef MP-ALIPAY
scopes: 'auth_user', //支付宝小程序需设置授权类型
// #endif
success: async (res) => {
console.log('login success:', res);
this.Toast({
title: '登录成功'
})
// 更新保存在 store 中的登录状态
this.login(provider.id);
// #ifdef APP-PLUS
this.setUniverifyLogin(provider.id === 'univerify')
switch (provider.id) {
case 'univerify':
this.loginByUniverify(provider.id, res)
break;
case 'apple':
this.loginByApple(provider.id, res)
break;
}
// #endif
// #ifdef MP-WEIXIN
console.warn('如需获取openid请参考uni-id: https://uniapp.dcloud.net.cn/uniCloud/uni-id')
uni.request({
url: 'https://97fca9f2-41f6-449f-a35e-3f135d4c3875.bspapp.com/http/user-center',
method: 'POST',
data: {
action: 'loginByWeixin',
params: {
code: res.code,
platform: 'mp-weixin'
}
},
success(res) {
console.log(res);
if (res.data.code !== 0) {
console.log('获取openid失败:', res.data.errMsg);
return
}
uni.setStorageSync('openid', res.data.openid)
},
fail(err) {
console.log('获取openid失败:', err);
}
})
// #endif
},
fail: (err) => {
console.log('login fail:', err);
// 一键登录点击其他登录方式
if (err.code == '30002') {
uni.closeAuthView();
this.Toast({
title: '其他登录方式'
})
return;
}
// 未开通
if (err.code == 1000) {
uni.showModal({
title: '登录失败',
content: `${err.errMsg}\n,错误码:${err.code}`,
confirmText: '开通指南',
cancelText: '确定',
success: (res) => {
if (res.confirm) {
setTimeout(() => {
plus.runtime.openWeb('https://ask.dcloud.net.cn/article/37965')
}, 500)
}
}
});
return;
}
// 一键登录预登陆失败
if (err.code == '30005') {
uni.showModal({
showCancel: false,
title: '预登录失败',
content: this.univerifyErrorMsg || err.errMsg
});
return;
}
// 一键登录用户关闭验证界面
if (err.code != '30003') {
uni.showModal({
showCancel: false,
title: '登录失败',
content: JSON.stringify(err)
});
}
},
complete: () => {
this.univerifyBtnLoading = false;
}
});
},
loginByUniverify(provider, res) {
this.setUniverifyLogin(true);
uni.closeAuthView();
const univerifyInfo = {
provider,
...res.authResult,
}
this.getPhoneNumber(univerifyInfo).then((phoneNumber) => {
this.phoneNumber = phoneNumber;
uni.setStorageSync(univerifyInfoKey, univerifyInfo)
}).catch(err => {
uni.showModal({
showCancel: false,
title: '手机号获取失败',
content: `${err.errMsg}\n,错误码:${err.code}`
})
console.error(res);
})
},
async loginByApple(provider, res) {
// 获取用户信息
let getUserInfoErr, result
// #ifndef VUE3
[getUserInfoErr, result] = await uni.getUserInfo({
provider
});
// #endif
// #ifdef VUE3
try {
result = await uni.getUserInfo({
provider
});
} catch(e) {
getUserInfoErr = e
}
// #endif
if (getUserInfoErr) {
let content = getUserInfoErr.errMsg;
if (~content.indexOf('uni.login')) {
content = '请在登录页面完成登录操作';
}
uni.showModal({
title: '获取用户信息失败',
content: '错误原因' + content,
showCancel: false
});
}
// uni-id 苹果登录
console.warn('此处使用uni-id处理苹果登录,详情参考: https://uniapp.dcloud.net.cn/uniCloud/uni-id')
uni.request({
url: 'https://97fca9f2-41f6-449f-a35e-3f135d4c3875.bspapp.com/http/user-center',
method: 'POST',
data: {
action: 'loginByApple',
params: result.userInfo
},
success: (res) => {
console.log('uniId login success', res);
if(res.data.code !== 0){
uni.showModal({
showCancel: false,
content: `苹果登录失败: ${JSON.stringify(res.data.msg)}`,
})
} else {
uni.setStorageSync('openid', res.data.openid)
uni.setStorageSync('apple_nickname', res.data.userInfo.nickname)
}
},
fail: (e) => {
uni.showModal({
content: `苹果登录失败: ${JSON.stringify(e)}`,
showCancel: false
})
}
})
}
}
}
</script>
<style>
button {
background-color: #007aff;
color: #ffffff;
}
</style>

View File

@ -1,66 +1,31 @@
<template>
<tpx-page>
<view class="lgn-page">
<view class="pos-abt-all" style="z-index: 0;overflow: hidden;">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg.png')"></tpx-image>
<view class="yunduo">
<tpx-image width="750" mode="widthFix" :src="getCdnUrl('login/bg-yun.png')"></tpx-image>
</view>
</view>
<view class="pos-rlt" style="z-index: 1;">
<view>
<u-image custom-style="margin: 160rpx auto 0 auto;" width="140" height="140" :src="getCdnUrl('logo.png')"></u-image>
<u-text margin="70rpx 0 0 0" size="60" text="探路物流 速运全球" color="#fff" bold="true" align="center"></u-text>
</view>
<view style="margin-top: 90rpx;" class="pl-30 pr-30">
<u-text text="密码登录" size="30" color="#fff" bold="true"></u-text>
<view class="mt-40">
<u-input placeholder="请输入账号" color="#fff" font-size="30"
v-model="submitParams.username"
custom-style="padding: 30rpx 60rpx;background: rgba(255,255,255,0.2); border: 2px solid #FFFFFF;border-radius: 16rpx;"
placeholder-style="color: #FFF;"></u-input>
</view>
<view class="mt-40">
<u-input placeholder="请输入密码" color="#fff" font-size="30" type="password"
v-model="submitParams.password"
custom-style="padding: 30rpx 60rpx;background: rgba(255,255,255,0.2); border: 2px solid #FFFFFF;border-radius: 16rpx;"
placeholder-style="color: #FFF;"></u-input>
</view>
<view class="mt-30">
<u-checkbox-group placement="column" v-model="submitParams.remberPassport">
<u-checkbox size="28" labelSize="28" label="记住密码"
:name="true"
label-color="#fff" activeColor="#fff" iconColor="#B12D29" iconSize="20"></u-checkbox>
</u-checkbox-group>
</view>
<view style="margin-top: 70rpx;">
<u-button @click="handleLogin" custom-style="height:90rpx;font-size:32rpx;color: #B12D29;font-weight: bold;;box-shadow: 0rpx 12rpx 21rpx 0rpx rgba(177,45,41,0.32);border-radius: 16rpx;">登录</u-button>
</view>
</view>
</view>
</view>
<LoginComponent @succeedBack="handleLoginedBack"></LoginComponent>
</tpx-page>
</template>
<script>
import { USERKEY } from "@/store/actionKey"
import { getSessionLoginInfo, setSessionLoginInfo, setSessionXToken } from "@/session"
import { encrypt } from "@/common/libs/jsencrypt_utils"
import { promiseTimeout } from "@/common/untool"
// #ifdef MP
import LoginComponent from "@/components/buns-api/login/mp-login"
// #endif
// #ifndef MP
import LoginComponent from "@/components/buns-api/login/com-login"
// #endif
export default {
components: { LoginComponent },
props: {
},
data() {
return {
submitParams: {
isEncrypt: true,
username: '',
password: '',
remberPassport: []
},
}
},
onShareAppMessage() {
@ -69,32 +34,13 @@
}
},
onLoad() {
let info = getSessionLoginInfo()
let { remberPassport } = info
if(remberPassport[0]) {
Object.assign(this.submitParams, info)
}
setSessionXToken() // 登录前先清除xtoke
},
methods: {
async handleLogin() {
const { submitParams } = this
this.showLoading()
try{
setSessionXToken() // 登录前先清除xtoke
await this.$store.dispatch(USERKEY.LOGIN, {
...submitParams,
...(submitParams.isEncrypt ? {
password: encrypt(submitParams.password),
username: encrypt(submitParams.username),
} : {})
})
await this.$store.dispatch(USERKEY.GETUSERINFO)
setSessionLoginInfo(submitParams)
this.goto("tabBar/sending/sending")
}catch(e){
console.error("USERKEY.LOGIN===catch error:", e)
}
this.hideLoading()
async handleLoginedBack() {
await promiseTimeout(300)
await this.$store.dispatch(USERKEY.GETUSERINFO)
this.goto("tabBar/sending/sending")
}
}
}
@ -106,18 +52,7 @@
height: 100% !important;
}
</style>
<style scoped lang="scss">
.lgn-page {
background-color: #B12D29;
position: relative;
min-height: 100%;
background-size: 100% auto;
background-repeat: no-repeat;
}
.yunduo{
position: absolute;
bottom: 0rpx;
left: 0;
right: 0;
}
</style>

BIN
sta_back/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1 +0,0 @@
http://2212.qrcode.n.yunjie.com.cn/bos/qrcode/705301687/6016388900687/12963318687/onecode/getcode?codeId=127974&bosId=4021899060687