修复小程序违规
This commit is contained in:
1 parent
3fdda89833
commit
54c90072fb
8 files changed
+28
-28
No files matched your search
@@ -56,7 +56,7 @@
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
/* 微信小程序 AppID:需与平台端「微信小程序配置」(/platform/wechatMini/config)中的 AppID 一致,
|
||||
否则「微信手机号一键登录」会因 jscode2session 报 40029 而失败 */
|
||||
否则「手机号快捷登录」会因 jscode2session 报 40029 而失败 */
|
||||
"appid" : "wxd500522c8b9440a6",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<block v-if="step === 'main'">
|
||||
<view class="panel-head">
|
||||
<text class="panel-title">欢迎登录</text>
|
||||
<text class="panel-sub">使用微信手机号,一键完成身份认证</text>
|
||||
<text class="panel-sub">使用手机号快捷登录,快速完成身份认证</text>
|
||||
</view>
|
||||
|
||||
<view v-if="errorMsg" class="error-box">
|
||||
@@ -34,16 +34,16 @@
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<block v-if="showMiniLogin">
|
||||
<button
|
||||
class="btn-wechat"
|
||||
class="btn-phone"
|
||||
open-type="getPhoneNumber"
|
||||
:class="{ disabled: submitting }"
|
||||
@getphonenumber="onGetPhoneNumber"
|
||||
>
|
||||
<FaIcon name="weixin" type="brands" color="#ffffff" :size="20" />
|
||||
<text class="btn-wechat-text">{{ submitting ? '登录中...' : '微信手机号一键登录' }}</text>
|
||||
<FaIcon name="phone" color="#ffffff" :size="20" />
|
||||
<text class="btn-phone-text">{{ submitting ? '登录中...' : '手机号快捷登录' }}</text>
|
||||
</button>
|
||||
<view class="tip-row">
|
||||
<text class="tip-text">首次使用请先用账号密码登录一次,自动完成微信绑定后即可一键登录</text>
|
||||
<text class="tip-text">首次使用请先用账号密码登录一次,完成账号绑定后即可快捷登录</text>
|
||||
</view>
|
||||
</block>
|
||||
<view v-else class="loading-box">
|
||||
@@ -510,9 +510,9 @@ function uniLoginCode() {
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
if (res && res.code) resolve(res.code)
|
||||
else reject(new Error('未获取到微信登录凭证'))
|
||||
else reject(new Error('未获取到登录凭证'))
|
||||
},
|
||||
fail: () => reject(new Error('获取微信登录凭证失败'))
|
||||
fail: () => reject(new Error('获取登录凭证失败'))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -532,7 +532,7 @@ async function onGetPhoneNumber(e) {
|
||||
const detail = (e && e.detail) || {}
|
||||
const errMsg = detail.errMsg || ''
|
||||
if (errMsg.indexOf('deny') !== -1) {
|
||||
uni.showToast({ title: '你已取消手机号授权', icon: 'none' })
|
||||
uni.showToast({ title: '已取消手机号快捷登录', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const phoneCode = detail.code && errMsg.indexOf('fail') === -1 ? detail.code : ''
|
||||
@@ -597,7 +597,7 @@ function showError(err) {
|
||||
const raw = (err && err.message) || ''
|
||||
if (/url not in domain list/i.test(raw)) {
|
||||
errorMsg.value =
|
||||
'当前小程序未配置服务器域名,请在微信公众平台「开发管理 - 开发设置 - 服务器域名」中添加 api.yunzer.cn 为 request 合法域名'
|
||||
'当前小程序未配置服务器域名,请在小程序管理后台「开发管理 - 开发设置 - 服务器域名」中添加 api.yunzer.cn 为 request 合法域名'
|
||||
return
|
||||
}
|
||||
errorMsg.value = raw || '登录失败,请稍后重试'
|
||||
@@ -954,7 +954,7 @@ function goForget() {
|
||||
}
|
||||
}
|
||||
|
||||
.btn-wechat {
|
||||
.btn-phone {
|
||||
margin-top: 0;
|
||||
height: 96rpx;
|
||||
border-radius: 20rpx;
|
||||
@@ -980,7 +980,7 @@ function goForget() {
|
||||
}
|
||||
}
|
||||
|
||||
.btn-wechat-text {
|
||||
.btn-phone-text {
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ function navUniLoginCode() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => (res && res.code ? resolve(res.code) : reject(new Error('未获取到微信登录凭证'))),
|
||||
fail: () => reject(new Error('获取微信登录凭证失败'))
|
||||
success: (res) => (res && res.code ? resolve(res.code) : reject(new Error('未获取到登录凭证'))),
|
||||
fail: () => reject(new Error('获取登录凭证失败'))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -172,7 +172,7 @@ function navUniLoginCode() {
|
||||
async function onGuestPhone(e) {
|
||||
const detail = (e && e.detail) || {}
|
||||
if (String(detail.errMsg || '').indexOf('ok') === -1 || !detail.code) {
|
||||
uni.showToast({ title: '未获取到手机号授权', icon: 'none' })
|
||||
uni.showToast({ title: '未获取到手机号,请重试', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (guestAuthLoading.value) return
|
||||
@@ -194,10 +194,10 @@ async function onGuestPhone(e) {
|
||||
if (!res || !res.token) throw new Error('未返回游客令牌')
|
||||
setGuestToken(res.token)
|
||||
guestAuthVisible.value = false
|
||||
uni.showToast({ title: '授权成功,数据可保存了', icon: 'none' })
|
||||
uni.showToast({ title: '验证成功,数据可保存了', icon: 'none' })
|
||||
} catch (err) {
|
||||
console.error('[nav] guest mini-login failed:', err)
|
||||
uni.showToast({ title: (err && err.message) || '授权失败,请重试', icon: 'none' })
|
||||
uni.showToast({ title: (err && err.message) || '验证失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
guestAuthLoading.value = false
|
||||
}
|
||||
@@ -441,7 +441,7 @@ function chooseTenant() {
|
||||
async function onCardPhone(e, card = null) {
|
||||
const detail = (e && e.detail) || {}
|
||||
if (String(detail.errMsg || '').indexOf('ok') === -1 || !detail.code) {
|
||||
uni.showToast({ title: '需要授权手机号才能使用', icon: 'none' })
|
||||
uni.showToast({ title: '请先完成手机号验证才能使用', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (phoneBusy.value) return
|
||||
@@ -474,7 +474,7 @@ async function onCardPhone(e, card = null) {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[nav] onboarding phone failed:', err)
|
||||
uni.showToast({ title: (err && err.message) || '授权失败,请重试', icon: 'none' })
|
||||
uni.showToast({ title: (err && err.message) || '验证失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
phoneBusy.value = false
|
||||
@@ -507,7 +507,7 @@ async function enter(card) {
|
||||
return
|
||||
}
|
||||
if (guest.value) {
|
||||
uni.showToast({ title: '请先授权手机号', icon: 'none' })
|
||||
uni.showToast({ title: '请先完成手机号验证', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (card.needTenant) {
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">手机号</text>
|
||||
<view class="readonly"><text>{{ mobileMask || '微信已验证' }}</text><text class="readonly-tag">不可修改</text></view>
|
||||
<view class="readonly"><text>{{ mobileMask || '手机号已验证' }}</text><text class="readonly-tag">不可修改</text></view>
|
||||
</view>
|
||||
<text class="hint">提交后由该企业管理员审核,通过后即可使用业务功能</text>
|
||||
</view>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<text class="label">确认密码</text>
|
||||
<input v-model="confirmPassword" class="input" type="password" placeholder="再输入一次" :maxlength="32" />
|
||||
</view>
|
||||
<text class="hint">密码至少 6 位;微信号会在注册时自动绑定,下次可直接进入</text>
|
||||
<text class="hint">密码至少 6 位;当前账号会在注册时自动绑定,下次可直接进入</text>
|
||||
<view v-if="errorMsg" class="error"><text>{{ errorMsg }}</text></view>
|
||||
<button class="submit" :disabled="loading" @tap="handleSubmit">
|
||||
{{ loading ? '注册中…' : '完成注册' }}
|
||||
@@ -44,7 +44,7 @@ onLoad((options = {}) => {
|
||||
token.value = options.token || ''
|
||||
mobileMask.value = decodeURIComponent(options.mobile_mask || '')
|
||||
if (!token.value) {
|
||||
errorMsg.value = '授权会话已失效,请返回工作台重新授权手机号'
|
||||
errorMsg.value = '验证会话已失效,请返回工作台重新验证手机号'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -52,7 +52,7 @@ async function handleSubmit() {
|
||||
if (loading.value) return
|
||||
errorMsg.value = ''
|
||||
if (!token.value) {
|
||||
errorMsg.value = '授权会话已失效,请返回工作台重新授权手机号'
|
||||
errorMsg.value = '验证会话已失效,请返回工作台重新验证手机号'
|
||||
return
|
||||
}
|
||||
if (password.value.length < 6) {
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<view class="field">
|
||||
<text class="label">手机号</text>
|
||||
<view class="readonly">
|
||||
<text>{{ mobileMask || '微信已验证' }}</text>
|
||||
<text>{{ mobileMask || '手机号已验证' }}</text>
|
||||
<text class="readonly-tag">不可修改</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<text class="edit-label">手机号</text>
|
||||
<view class="edit-readonly">
|
||||
<text>{{ phoneText }}</text>
|
||||
<text class="readonly-tag">微信验证,不可修改</text>
|
||||
<text class="readonly-tag">已验证,不可修改</text>
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="editError" class="edit-error">{{ editError }}</text>
|
||||
@@ -199,7 +199,7 @@ const editForm = reactive({ name: '', email: '' })
|
||||
const phoneText = computed(() => {
|
||||
const u = user.value || {}
|
||||
const p = u.phone || (u.account && /^1\d{10}$/.test(String(u.account)) ? String(u.account) : '')
|
||||
return p ? String(p).replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '微信已验证'
|
||||
return p ? String(p).replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '手机号已验证'
|
||||
})
|
||||
|
||||
function onEdit() {
|
||||
|
||||
@@ -89,7 +89,7 @@ function onPhone(e) {
|
||||
const detail = (e && e.detail) || {}
|
||||
const errMsg = detail.errMsg || ''
|
||||
if (errMsg.indexOf('deny') !== -1) {
|
||||
uni.showToast({ title: '已取消手机号授权', icon: 'none' })
|
||||
uni.showToast({ title: '已取消手机号验证', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const phoneCode = detail.code && errMsg.indexOf('fail') === -1 ? detail.code : ''
|
||||
|
||||
Reference in new issue
Block a user