mirror of
https://gitee.com/ShopeX/ECShopX_admin-frontend
synced 2026-08-08 21:55:31 +08:00
[TBID:ECX-9542] chore: merge master changes for release
This commit is contained in:
@@ -14,10 +14,10 @@ export function getTrustLoginList(query) {
|
||||
}
|
||||
|
||||
// 保存信任登录状态
|
||||
export function saveStatusSetting(query) {
|
||||
export function saveStatusSetting(data) {
|
||||
return fetch({
|
||||
url: 'members/trustlogin/setting',
|
||||
method: 'put',
|
||||
params: query
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
v-model="formData.distributor_id"
|
||||
clearable
|
||||
:placeholder="$t('3157a2d5.06accf')"
|
||||
:query-params="{ show_distributor_self: 1 }"
|
||||
@change="onSearch"
|
||||
/>
|
||||
</SpFilterFormItem>
|
||||
|
||||
@@ -11563,6 +11563,19 @@
|
||||
"b64b502c.939d53": "تقديم",
|
||||
"b64b502c.3b1083": "تم الحفظ بنجاح",
|
||||
"b64b502c.6de920": "فشل الحفظ",
|
||||
"b64b502c.f8a201": "Services ID",
|
||||
"b64b502c.f8a202": "Team ID",
|
||||
"b64b502c.f8a203": "Key ID",
|
||||
"b64b502c.f8a204": "المفتاح الخاص (.p8)",
|
||||
"b64b502c.f8a205": "الصق محتوى ملف .p8 كاملاً (متعدد الأسطر)",
|
||||
"b64b502c.f8a206": "extra_config",
|
||||
"b64b502c.f8a207": "تكوين JSON إضافي اختياري",
|
||||
"b64b502c.f8a208": "app_id",
|
||||
"b64b502c.f8a209": "secret",
|
||||
"b64b502c.f8a20a": "يرجى إدخال Services ID",
|
||||
"b64b502c.f8a20b": "يرجى إدخال Team ID و Key ID",
|
||||
"b64b502c.f8a20c": "يرجى لصق المفتاح الخاص .p8 كاملاً (متعدد الأسطر)",
|
||||
"b64b502c.f8a20d": "تنسيق المفتاح الخاص غير صحيح. الصق محتوى PEM كاملاً",
|
||||
"9e8ad576.f48f94": "سبب الرفض",
|
||||
"9e8ad576.714fa9": "اختياري. حتى 50 حرفاً.",
|
||||
"9e8ad576.e83a25": "تأكيد",
|
||||
@@ -12682,6 +12695,9 @@
|
||||
"ab2cdfe4.8098e2": "الجوال",
|
||||
"ab2cdfe4.60d045": "الاسم",
|
||||
"ab2cdfe4.0d4934": "اسم المتجر",
|
||||
"ab2cdfe4.f6d738": "رقم المتجر",
|
||||
"ab2cdfe4.867738": "يرجى إدخال اسم المتجر",
|
||||
"ab2cdfe4.68f04a": "يرجى إدخال رقم المتجر",
|
||||
"ab2cdfe4.464f3d": "الدور",
|
||||
"ab2cdfe4.b1dae9": "مدير",
|
||||
"ab2cdfe4.710ad0": "معطل",
|
||||
|
||||
@@ -11563,6 +11563,19 @@
|
||||
"b64b502c.939d53": "Submit",
|
||||
"b64b502c.3b1083": "Saved successfully",
|
||||
"b64b502c.6de920": "Save failed",
|
||||
"b64b502c.f8a201": "Services ID",
|
||||
"b64b502c.f8a202": "Team ID",
|
||||
"b64b502c.f8a203": "Key ID",
|
||||
"b64b502c.f8a204": "Private key (.p8)",
|
||||
"b64b502c.f8a205": "Paste the full .p8 file content (multiple lines allowed)",
|
||||
"b64b502c.f8a206": "extra_config",
|
||||
"b64b502c.f8a207": "Optional JSON extra configuration",
|
||||
"b64b502c.f8a208": "app_id",
|
||||
"b64b502c.f8a209": "secret",
|
||||
"b64b502c.f8a20a": "Please enter Services ID",
|
||||
"b64b502c.f8a20b": "Please enter Team ID and Key ID",
|
||||
"b64b502c.f8a20c": "Please paste the full .p8 private key (multiple lines allowed)",
|
||||
"b64b502c.f8a20d": "Invalid private key format. Paste the full PEM content",
|
||||
"9e8ad576.f48f94": "Reason for rejection",
|
||||
"9e8ad576.714fa9": "Optional. Up to 50 characters.",
|
||||
"9e8ad576.e83a25": "Confirm",
|
||||
@@ -12682,6 +12695,9 @@
|
||||
"ab2cdfe4.8098e2": "Mobile",
|
||||
"ab2cdfe4.60d045": "Name",
|
||||
"ab2cdfe4.0d4934": "Store name",
|
||||
"ab2cdfe4.f6d738": "Store No.",
|
||||
"ab2cdfe4.867738": "Please enter store name",
|
||||
"ab2cdfe4.68f04a": "Please enter store No.",
|
||||
"ab2cdfe4.464f3d": "Role",
|
||||
"ab2cdfe4.b1dae9": "Admin",
|
||||
"ab2cdfe4.710ad0": "Disabled",
|
||||
|
||||
@@ -11563,6 +11563,19 @@
|
||||
"b64b502c.939d53": "提交",
|
||||
"b64b502c.3b1083": "保存成功",
|
||||
"b64b502c.6de920": "保存失败",
|
||||
"b64b502c.f8a201": "Services ID",
|
||||
"b64b502c.f8a202": "Team ID",
|
||||
"b64b502c.f8a203": "Key ID",
|
||||
"b64b502c.f8a204": "私钥 (.p8)",
|
||||
"b64b502c.f8a205": "直接粘贴 .p8 文件全文(可多行)",
|
||||
"b64b502c.f8a206": "extra_config",
|
||||
"b64b502c.f8a207": "可选 JSON 扩展配置",
|
||||
"b64b502c.f8a208": "app_id",
|
||||
"b64b502c.f8a209": "secret",
|
||||
"b64b502c.f8a20a": "请填写 Services ID",
|
||||
"b64b502c.f8a20b": "请填写 Team ID 和 Key ID",
|
||||
"b64b502c.f8a20c": "请粘贴完整 .p8 私钥(可多行)",
|
||||
"b64b502c.f8a20d": "私钥格式不正确,请粘贴完整 PEM 内容",
|
||||
"9e8ad576.f48f94": "拒绝原因",
|
||||
"9e8ad576.714fa9": "非必填项,请填写不超过50字。",
|
||||
"9e8ad576.e83a25": "确认",
|
||||
@@ -12682,6 +12695,9 @@
|
||||
"ab2cdfe4.8098e2": "手机号",
|
||||
"ab2cdfe4.60d045": "姓名",
|
||||
"ab2cdfe4.0d4934": "店铺名称",
|
||||
"ab2cdfe4.f6d738": "店铺号",
|
||||
"ab2cdfe4.867738": "请输入店铺名称",
|
||||
"ab2cdfe4.68f04a": "请输入店铺号",
|
||||
"ab2cdfe4.464f3d": "角色",
|
||||
"ab2cdfe4.b1dae9": "管理员",
|
||||
"ab2cdfe4.710ad0": "禁用",
|
||||
|
||||
@@ -12682,6 +12682,9 @@
|
||||
"ab2cdfe4.8098e2": "手機號",
|
||||
"ab2cdfe4.60d045": "姓名",
|
||||
"ab2cdfe4.0d4934": "店鋪名稱",
|
||||
"ab2cdfe4.f6d738": "店鋪號",
|
||||
"ab2cdfe4.867738": "請輸入店鋪名稱",
|
||||
"ab2cdfe4.68f04a": "請輸入店鋪號",
|
||||
"ab2cdfe4.464f3d": "角色",
|
||||
"ab2cdfe4.b1dae9": "管理員",
|
||||
"ab2cdfe4.710ad0": "禁用",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
import api from '@/api'
|
||||
import { decodeJwtPayload } from '@/utils/jwt'
|
||||
|
||||
const userStore = {
|
||||
namespaced: true,
|
||||
@@ -195,9 +196,7 @@ const userStore = {
|
||||
setToken({ commit }, token) {
|
||||
commit('setToken', token)
|
||||
// 解析token中的user信息,并且保存
|
||||
let tokenArray = token.split('.')
|
||||
let user = atob(tokenArray[1])
|
||||
user = JSON.parse(user)
|
||||
const user = decodeJwtPayload(token)
|
||||
commit('setTokenExp', user.exp)
|
||||
commit('setUserName', user.mobile)
|
||||
commit('setAuthorizer', user.is_authorizer)
|
||||
|
||||
@@ -15,6 +15,8 @@ export * from './src/type-helper'
|
||||
|
||||
export * from './src/utils'
|
||||
|
||||
export * from './jwt'
|
||||
|
||||
export { install as VuePrototype } from './src/prototype'
|
||||
|
||||
// 云店
|
||||
|
||||
16
src/utils/jwt.js
Normal file
16
src/utils/jwt.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright © ShopeX (http://www.shopex.cn). All rights reserved.
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 解析 JWT payload(兼容 base64url:- _ 与缺省 padding)
|
||||
* @param {string} token
|
||||
* @returns {object}
|
||||
*/
|
||||
export function decodeJwtPayload(token) {
|
||||
const base64Url = String(token || '').split('.')[1] || ''
|
||||
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
|
||||
const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), '=')
|
||||
return JSON.parse(atob(padded))
|
||||
}
|
||||
@@ -116,7 +116,7 @@ const login_bg_ecshopx = require(`@/assets/imgs/login-b2b2c.jpg`)
|
||||
const login_bg_free_ecshopx = require(`@/assets/imgs/login-free-ecshopx.jpg`)
|
||||
import { mapMutations } from 'vuex'
|
||||
import { requiredRules, MinRules } from '@/utils/validate'
|
||||
import { unescape } from '@/utils'
|
||||
import { decodeJwtPayload, unescape } from '@/utils'
|
||||
import loadingBtn from '@/components/loading-btn'
|
||||
export default {
|
||||
components: {
|
||||
@@ -277,8 +277,7 @@ export default {
|
||||
type: 'success'
|
||||
})
|
||||
const userInfo = await this.$api.login.getAdminInfo()
|
||||
let base64Url = token.split('.')[1]
|
||||
const { menu_type } = JSON.parse(atob(base64Url))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
console.log('menu_type', menu_type)
|
||||
this.SET_USERINFO(userInfo)
|
||||
if (this.loginType == 'distributor') {
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
<SpFilterFormItem prop="username" :label="$t('ab2cdfe4.75d152')">
|
||||
<el-input v-model="params.username" :placeholder="$t('ab2cdfe4.8093e3')" />
|
||||
</SpFilterFormItem>
|
||||
<SpFilterFormItem prop="shop_name" :label="$t('ab2cdfe4.0d4934')">
|
||||
<el-input v-model="params.shop_name" clearable :placeholder="$t('ab2cdfe4.867738')" />
|
||||
</SpFilterFormItem>
|
||||
<SpFilterFormItem prop="shop_code" :label="$t('ab2cdfe4.f6d738')">
|
||||
<el-input v-model="params.shop_code" clearable :placeholder="$t('ab2cdfe4.68f04a')" />
|
||||
</SpFilterFormItem>
|
||||
</SpFilterForm>
|
||||
|
||||
<el-table v-loading="loading" border :data="accountsList">
|
||||
@@ -69,6 +75,17 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('ab2cdfe4.f6d738')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
v-for="item in scope.row.distributor_ids"
|
||||
:key="'code-' + item.distributor_id"
|
||||
size="mini"
|
||||
>
|
||||
{{ item.shop_code }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="login_type == 'distributor'"
|
||||
prop="roles"
|
||||
@@ -282,6 +299,10 @@ export default {
|
||||
total_count: 0,
|
||||
params: {
|
||||
mobile: '',
|
||||
login_name: '',
|
||||
username: '',
|
||||
shop_name: '',
|
||||
shop_code: '',
|
||||
operator_type: 'distributor'
|
||||
},
|
||||
operator_id: 0,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { unescape } from '@/utils'
|
||||
import { decodeJwtPayload, unescape } from '@/utils'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -79,9 +79,8 @@ export default {
|
||||
type: 'success'
|
||||
})
|
||||
const userInfo = await this.$api.login.getAdminInfo()
|
||||
let base64Url = token.split('.')[1]
|
||||
// const { menu_type } = await this.$api.wechat.getAuthorizerInfo()
|
||||
const { menu_type } = JSON.parse(atob(base64Url))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
console.log('menu_type', menu_type)
|
||||
this.SET_USERINFO(userInfo)
|
||||
this.SET_LOGIN_TYPE({ loginType: this.loginType || userInfo.logintype })
|
||||
|
||||
@@ -124,6 +124,17 @@ export default {
|
||||
const refName = refMap[this.activeName]
|
||||
return refName ? this.$refs[refName] : null
|
||||
},
|
||||
getActiveTabRef() {
|
||||
const refMap = {
|
||||
first: 'buyerTemplates',
|
||||
second: 'weightTemplates',
|
||||
third: 'numberTemplates',
|
||||
fourth: 'priceTemplates',
|
||||
fifth: 'volumeTemplates'
|
||||
}
|
||||
const refName = refMap[this.activeName]
|
||||
return refName ? this.$refs[refName] : null
|
||||
},
|
||||
getList() {
|
||||
const ref = this.getActiveTabRef()
|
||||
if (ref && typeof ref.getShippingTemplatesList === 'function') {
|
||||
|
||||
@@ -5,102 +5,95 @@
|
||||
|
||||
<template>
|
||||
<SpPage>
|
||||
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
|
||||
<el-tab-pane :label="$t('b64b502c.de28d2')" name="standard">
|
||||
<el-card>
|
||||
<el-table :data="list.standard">
|
||||
<el-table-column :label="$t('8da83775.2b6bc0')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row, 'standard')">
|
||||
{{ $t('b64b502c.224e2c') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('b64b502c.d7ec2d')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="$t('b64b502c.3fea7c')" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<el-tag
|
||||
v-if="scope.row.status == true || scope.row.status == 'true'"
|
||||
type="success"
|
||||
>
|
||||
{{ $t('b64b502c.cc42dd') }}
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-else-if="scope.row.status == false || scope.row.status == 'false'"
|
||||
type="danger"
|
||||
>
|
||||
{{ $t('b64b502c.b15d91') }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('b64b502c.c5f087')" name="touch" @tab-click="handleClick">
|
||||
<el-card>
|
||||
<el-table :data="list.touch">
|
||||
<el-table-column :label="$t('8da83775.2b6bc0')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row, 'touch')">
|
||||
{{ $t('b64b502c.224e2c') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('b64b502c.d7ec2d')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="$t('b64b502c.3fea7c')" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<el-tag
|
||||
v-if="scope.row.status == true || scope.row.status == 'true'"
|
||||
type="success"
|
||||
>
|
||||
{{ $t('b64b502c.cc42dd') }}
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-else-if="scope.row.status == false || scope.row.status == 'false'"
|
||||
type="danger"
|
||||
>
|
||||
{{ $t('b64b502c.b15d91') }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
<!--修改-->
|
||||
<sideBar :visible.sync="show_sideBar" :title="$t('b64b502c.224e2c')">
|
||||
<el-form>
|
||||
<el-form-item :label="$t('b64b502c.d7ec2d')">
|
||||
<el-input v-model="form.name" />
|
||||
<el-card>
|
||||
<el-table :data="list" data-testid="member-trustlogin-table">
|
||||
<el-table-column :label="$t('8da83775.2b6bc0')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">
|
||||
{{ $t('b64b502c.224e2c') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('b64b502c.d7ec2d')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.name }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" :label="$t('b64b502c.3fea7c')" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<el-tag
|
||||
v-if="scope.row.status == true || scope.row.status == 'true'"
|
||||
type="success"
|
||||
>
|
||||
{{ $t('b64b502c.cc42dd') }}
|
||||
</el-tag>
|
||||
<el-tag
|
||||
v-else-if="scope.row.status == false || scope.row.status == 'false'"
|
||||
type="danger"
|
||||
>
|
||||
{{ $t('b64b502c.b15d91') }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<sideBar :visible.sync="show_sideBar" :title="$t('b64b502c.224e2c')">
|
||||
<el-form>
|
||||
<el-form-item :label="$t('b64b502c.d7ec2d')">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<template v-if="form.type === 'apple'">
|
||||
<el-form-item :label="$t('b64b502c.f8a201')">
|
||||
<el-input
|
||||
v-model="form.app_id"
|
||||
placeholder="ecshopx-shop.ex-sandbox.com"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="app_id">
|
||||
<el-form-item :label="$t('b64b502c.f8a202')">
|
||||
<el-input v-model="form.apple_team_id" placeholder="J78N572P2G" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('b64b502c.f8a203')">
|
||||
<el-input v-model="form.apple_key_id" placeholder="V6MAPA8UM5" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('b64b502c.f8a204')">
|
||||
<el-input
|
||||
v-model="form.apple_private_key"
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
:placeholder="$t('b64b502c.f8a205')"
|
||||
data-testid="member-trustlogin-apple-private-key"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-form-item :label="$t('b64b502c.f8a208')">
|
||||
<el-input v-model="form.app_id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="secret">
|
||||
<el-form-item :label="$t('b64b502c.f8a209')">
|
||||
<el-input v-model="form.secret" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('b64b502c.3fea7c')">
|
||||
<el-switch v-model="form.status" />
|
||||
<el-form-item :label="$t('b64b502c.f8a206')">
|
||||
<el-input
|
||||
v-model="form.extra_config"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
:placeholder="$t('b64b502c.f8a207')"
|
||||
data-testid="member-trustlogin-extra-config"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="statusChange(form)">
|
||||
{{ $t('b64b502c.939d53') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</sideBar>
|
||||
</el-tabs>
|
||||
</template>
|
||||
<el-form-item :label="$t('b64b502c.3fea7c')">
|
||||
<el-switch v-model="form.status" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="statusChange(form)">
|
||||
{{ $t('b64b502c.939d53') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</sideBar>
|
||||
</SpPage>
|
||||
</template>
|
||||
<script>
|
||||
@@ -114,15 +107,18 @@ export default {
|
||||
return {
|
||||
loading: false,
|
||||
show_sideBar: false,
|
||||
activeName: 'standard',
|
||||
loading: false,
|
||||
list: [],
|
||||
form: {
|
||||
name: '',
|
||||
app_id: '',
|
||||
secret: '',
|
||||
extra_config: '',
|
||||
apple_team_id: '',
|
||||
apple_key_id: '',
|
||||
apple_private_key: '',
|
||||
status: false,
|
||||
loginversion: 'standard'
|
||||
loginversion: 'touch',
|
||||
type: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -130,73 +126,103 @@ export default {
|
||||
this.getConfig()
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.getConfig()
|
||||
},
|
||||
getConfig() {
|
||||
this.loading = true
|
||||
getTrustLoginList().then((res) => {
|
||||
this.list = res.data.data
|
||||
for (var i = res.data.data.length - 1; i >= 0; i--) {
|
||||
if (this.list[i].status == 'true') {
|
||||
this.list[i].status = true
|
||||
const payload = res.data.data || { touch: [] }
|
||||
this.list = Array.isArray(payload.touch) ? payload.touch : []
|
||||
this.list.forEach((row) => {
|
||||
if (row.status === 'true') row.status = true
|
||||
if (row.status === 'false') row.status = false
|
||||
if (row.extra_config === undefined || row.extra_config === null) {
|
||||
row.extra_config = ''
|
||||
}
|
||||
if (this.list[i].status == 'false') {
|
||||
this.list[i].status = false
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 编辑
|
||||
handleEdit(data, loginversion) {
|
||||
parseExtraConfig(extraConfig) {
|
||||
if (!extraConfig) {
|
||||
return {}
|
||||
}
|
||||
if (typeof extraConfig === 'object') {
|
||||
return extraConfig
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(extraConfig)
|
||||
return parsed && typeof parsed === 'object' ? parsed : {}
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
handleEdit(data) {
|
||||
this.show_sideBar = true
|
||||
this.form.name = data.name
|
||||
|
||||
this.form.status = data.status
|
||||
|
||||
this.form.app_id = data.app_id
|
||||
this.form.secret = data.secret
|
||||
this.form.type = data.type
|
||||
this.form.loginversion = loginversion
|
||||
this.form.loginversion = 'touch'
|
||||
const extra = this.parseExtraConfig(data.extra_config || '')
|
||||
this.form.apple_team_id = extra.team_id || ''
|
||||
this.form.apple_key_id = extra.key_id || ''
|
||||
this.form.apple_private_key =
|
||||
extra.private_key && extra.private_key !== '***' ? extra.private_key : ''
|
||||
this.form.extra_config =
|
||||
data.type === 'apple' ? '' : data.extra_config || ''
|
||||
},
|
||||
buildAppleExtraConfigPayload() {
|
||||
return {
|
||||
team_id: String(this.form.apple_team_id || '').trim(),
|
||||
key_id: String(this.form.apple_key_id || '').trim(),
|
||||
private_key: String(this.form.apple_private_key || '').trim()
|
||||
}
|
||||
},
|
||||
validateAppleForm() {
|
||||
if (!String(this.form.app_id || '').trim()) {
|
||||
return this.$t('b64b502c.f8a20a')
|
||||
}
|
||||
const extra = this.buildAppleExtraConfigPayload()
|
||||
if (!extra.team_id || !extra.key_id) {
|
||||
return this.$t('b64b502c.f8a20b')
|
||||
}
|
||||
if (!extra.private_key) {
|
||||
return this.$t('b64b502c.f8a20c')
|
||||
}
|
||||
if (!extra.private_key.includes('BEGIN PRIVATE KEY')) {
|
||||
return this.$t('b64b502c.f8a20d')
|
||||
}
|
||||
return ''
|
||||
},
|
||||
statusChange(data) {
|
||||
console.log(data)
|
||||
|
||||
saveStatusSetting(data)
|
||||
.then((res) => {
|
||||
const payload = { ...data }
|
||||
if (data.type === 'apple') {
|
||||
const error = this.validateAppleForm()
|
||||
if (error) {
|
||||
this.$message.error(error)
|
||||
return
|
||||
}
|
||||
payload.extra_config = this.buildAppleExtraConfigPayload()
|
||||
payload.secret = ''
|
||||
delete payload.apple_team_id
|
||||
delete payload.apple_key_id
|
||||
delete payload.apple_private_key
|
||||
}
|
||||
saveStatusSetting(payload)
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('b64b502c.3b1083')
|
||||
})
|
||||
this.show_sideBar = false
|
||||
this.getConfig()
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: this.$t('b64b502c.6de920')
|
||||
})
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
this.loading = true
|
||||
let query = {}
|
||||
if (this.activeName === 'standard') {
|
||||
query = this.standard_form
|
||||
} else {
|
||||
query = this.form
|
||||
}
|
||||
setstandardSetting(query)
|
||||
.then((response) => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('b64b502c.3b1083')
|
||||
})
|
||||
this.loading = false
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading = false
|
||||
.catch((err) => {
|
||||
const msg =
|
||||
err?.data?.message ||
|
||||
err?.message ||
|
||||
this.$t('b64b502c.6de920')
|
||||
this.$message.error(msg)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,9 +516,14 @@ export default {
|
||||
display: 'inline',
|
||||
options: [
|
||||
{ name: this.$t('027707af.9cfec5'), label: 1 },
|
||||
{ name: this.$t('027707af.29189f'), label: 2 }
|
||||
// BBC 去除「导购码」选项,仅保留上传企微码
|
||||
...(!this.VERSION_PLATFORM()
|
||||
? [{ name: this.$t('027707af.29189f'), label: 2 }]
|
||||
: [])
|
||||
],
|
||||
isShow: ({ key }, value) => value.show_salesperson !== 0
|
||||
// BBC 仅一种码类型,无需再展示「码类型」单选
|
||||
isShow: ({ key }, value) =>
|
||||
value.show_salesperson !== 0 && !this.VERSION_PLATFORM()
|
||||
},
|
||||
{
|
||||
label: this.$t('027707af.80384a'),
|
||||
@@ -528,7 +533,10 @@ export default {
|
||||
return <SpImagePicker v-model={value[key]} />
|
||||
},
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.form.show_salesperson === 1 && this.form.salesperson_type === 1) {
|
||||
const needQrcode =
|
||||
this.form.show_salesperson === 1 &&
|
||||
(this.VERSION_PLATFORM() || this.form.salesperson_type === 1)
|
||||
if (needQrcode) {
|
||||
if (!value) {
|
||||
callback(new Error(this.$t('027707af.e90339')))
|
||||
} else {
|
||||
@@ -538,7 +546,9 @@ export default {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
isShow: ({ key }, value) => value.show_salesperson === 1 && value.salesperson_type === 1
|
||||
isShow: ({ key }, value) =>
|
||||
value.show_salesperson === 1 &&
|
||||
(this.VERSION_PLATFORM() || value.salesperson_type === 1)
|
||||
},
|
||||
{
|
||||
label: this.$t('027707af.6a9e57'),
|
||||
@@ -893,7 +903,12 @@ export default {
|
||||
this.datapass_block = res.datapass_block
|
||||
const showSalespersonApi = Number(res.show_salesperson)
|
||||
const showSalespersonOn = showSalespersonApi === 1 || showSalespersonApi === 2 ? 1 : 0
|
||||
const salespersonTypeFromApi = showSalespersonApi === 2 ? 2 : 1
|
||||
// BBC 已去除导购码,历史 show_salesperson=2 回显为开启 + 企微码
|
||||
const salespersonTypeFromApi = this.VERSION_PLATFORM()
|
||||
? 1
|
||||
: showSalespersonApi === 2
|
||||
? 2
|
||||
: 1
|
||||
this.form = {
|
||||
distribution_type: res.distribution_type,
|
||||
distributor_category_id: this.normalizeCategoryId(res.distributor_category_id),
|
||||
@@ -1022,11 +1037,12 @@ export default {
|
||||
delete params.salesperson_type
|
||||
} else if (this.form.show_salesperson === 1) {
|
||||
// 开启时,根据 salesperson_type 设置 show_salesperson
|
||||
if (this.form.salesperson_type === 1) {
|
||||
// BBC 仅支持上传企微码(show_salesperson=1)
|
||||
if (this.VERSION_PLATFORM() || this.form.salesperson_type === 1) {
|
||||
// 上传企微码
|
||||
params.show_salesperson = 1
|
||||
} else if (this.form.salesperson_type === 2) {
|
||||
// 导购码
|
||||
// 导购码(非 BBC)
|
||||
params.show_salesperson = 2
|
||||
delete params.fixed_salesperson_qrcode_url
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
</div>
|
||||
-->
|
||||
<addCartas v-if="classify" />
|
||||
<List v-else ref="list" />
|
||||
<!-- <addCartas v-if="classify" /> -->
|
||||
<List ref="list" />
|
||||
<!-- <section v-if="classify" class="content-padded-s section-white content-center">
|
||||
<el-button class="btn-save" type="primary" @click="saveConfig"> 保存 </el-button>
|
||||
</section> -->
|
||||
@@ -49,14 +49,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addCartas from './addCartas.vue'
|
||||
// import addCartas from './addCartas.vue'
|
||||
import index from './index.vue'
|
||||
import List from './list.vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
addCartas,
|
||||
// addCartas,
|
||||
List
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="text-[28px] font-helvca mt-8 ml-2 text-[#333]">{{ $t('24b2720c.7d1eb0') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8 ml-2">
|
||||
<div class="mt-8 ml-2" data-testid="admin-login-form">
|
||||
<LoginForm ref="formRef" />
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<el-button
|
||||
round
|
||||
class="h-[50px] !bg-black !text-white"
|
||||
data-testid="admin-login-submit"
|
||||
:loading="loading"
|
||||
@click="handleLogin"
|
||||
>
|
||||
@@ -32,7 +33,7 @@
|
||||
<script>
|
||||
import { useForm } from '@/composables'
|
||||
import Config from '@/config'
|
||||
import { getSystemTitle } from '@/utils'
|
||||
import { decodeJwtPayload, getSystemTitle } from '@/utils'
|
||||
import { i18n } from '@/i18n'
|
||||
|
||||
const [Form, FormApi] = useForm({
|
||||
@@ -41,7 +42,8 @@ const [Form, FormApi] = useForm({
|
||||
label: i18n.t('24b2720c.819767'),
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: i18n.t('24b2720c.08b1fa')
|
||||
placeholder: i18n.t('24b2720c.08b1fa'),
|
||||
'data-testid': 'admin-login-account'
|
||||
},
|
||||
fieldName: 'account',
|
||||
rules: [{ required: true, message: i18n.t('24b2720c.08b1fa') }]
|
||||
@@ -51,7 +53,8 @@ const [Form, FormApi] = useForm({
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
type: 'password',
|
||||
placeholder: i18n.t('24b2720c.a81052')
|
||||
placeholder: i18n.t('24b2720c.a81052'),
|
||||
'data-testid': 'admin-login-password'
|
||||
},
|
||||
fieldName: 'pwd',
|
||||
rules: [{ required: true, message: i18n.t('24b2720c.e39ffe') }]
|
||||
@@ -117,8 +120,7 @@ export default {
|
||||
// agreement_id
|
||||
})
|
||||
if (token) {
|
||||
const tokenArray = token.split('.')
|
||||
const { menu_type } = JSON.parse(atob(tokenArray[1]))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
this.$store.commit('system/setVersionMode', { versionMode: menu_type })
|
||||
this.$store.commit('user/setToken', { token })
|
||||
this.$store.commit('user/setLoginType', { login_type: formData.loginType })
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<script>
|
||||
import { useForm } from '@/composables'
|
||||
import Config from '@/config'
|
||||
import { getSystemTitle } from '@/utils'
|
||||
import { decodeJwtPayload, getSystemTitle } from '@/utils'
|
||||
|
||||
const [Form, FormApi] = useForm({
|
||||
formItems: [
|
||||
@@ -96,8 +96,7 @@ export default {
|
||||
// agreement_id
|
||||
})
|
||||
if (token) {
|
||||
const tokenArray = token.split('.')
|
||||
const { menu_type } = JSON.parse(atob(tokenArray[1]))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
this.$store.commit('system/setVersionMode', { versionMode: menu_type })
|
||||
this.$store.commit('user/setToken', { token })
|
||||
this.$store.commit('user/setLoginType', { login_type: 'merchant' })
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<script>
|
||||
import { useForm } from '@/composables'
|
||||
import Config from '@/config'
|
||||
import { getSystemTitle } from '@/utils'
|
||||
import { decodeJwtPayload, getSystemTitle } from '@/utils'
|
||||
|
||||
const [Form, FormApi] = useForm({
|
||||
formItems: [
|
||||
@@ -96,8 +96,7 @@ export default {
|
||||
// agreement_id
|
||||
})
|
||||
if (token) {
|
||||
const tokenArray = token.split('.')
|
||||
const { menu_type } = JSON.parse(atob(tokenArray[1]))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
this.$store.commit('system/setVersionMode', { versionMode: menu_type })
|
||||
this.$store.commit('user/setToken', { token })
|
||||
this.$store.commit('user/setLoginType', { login_type: 'distributor' })
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { decodeJwtPayload } from '@/utils'
|
||||
export default {
|
||||
name: 'Login',
|
||||
data() {
|
||||
@@ -34,8 +35,7 @@ export default {
|
||||
try {
|
||||
const { token } = await this.$api.auth.shunyunLogin({ code: this.code })
|
||||
if (token) {
|
||||
const tokenArray = token.split('.')
|
||||
const { menu_type } = JSON.parse(atob(tokenArray[1]))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
this.$store.commit('system/setVersionMode', { versionMode: menu_type })
|
||||
this.$store.commit('user/setToken', { token })
|
||||
this.$store.commit('user/setLoginType', { login_type: 'admin' })
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<script>
|
||||
import { useForm } from '@/composables'
|
||||
import Config from '@/config'
|
||||
import { getSystemTitle } from '@/utils'
|
||||
import { decodeJwtPayload, getSystemTitle } from '@/utils'
|
||||
|
||||
const [Form, FormApi] = useForm({
|
||||
formItems: [
|
||||
@@ -96,8 +96,7 @@ export default {
|
||||
// agreement_id
|
||||
})
|
||||
if (token) {
|
||||
const tokenArray = token.split('.')
|
||||
const { menu_type } = JSON.parse(atob(tokenArray[1]))
|
||||
const { menu_type } = decodeJwtPayload(token)
|
||||
this.$store.commit('system/setVersionMode', { versionMode: menu_type })
|
||||
this.$store.commit('user/setToken', { token })
|
||||
this.$store.commit('user/setLoginType', { login_type: 'supplier' })
|
||||
@@ -109,7 +108,7 @@ export default {
|
||||
}, 700)
|
||||
}
|
||||
} catch (error) {
|
||||
// console.error('登录失败:', error)
|
||||
console.error('登录失败:', error)
|
||||
// this.$message.error(error.message || '登录失败')
|
||||
} finally {
|
||||
this.loading = false
|
||||
|
||||
Reference in New Issue
Block a user