Commit 1794e584 by chenwq

移除部分未使用的代码和注释,优化组件结构

1 parent 506dea30
...@@ -13,7 +13,12 @@ import axios from "@/plugin/axios/index_code"; ...@@ -13,7 +13,12 @@ import axios from "@/plugin/axios/index_code";
import RequestMethods from "./request.methods"; import RequestMethods from "./request.methods";
import sign from "./sign"; import sign from "./sign";
function request(params = {}, method = RequestMethods.GET, noSignAttr = [], options = {}) { function request(
params = {},
method = RequestMethods.GET,
noSignAttr = [],
options = {},
) {
// 兼容线上dj和scrm appkey和secret不一样的情况 // 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = ""; let apiName = "";
if (params.method.includes("dj.api.smartcarlife")) { if (params.method.includes("dj.api.smartcarlife")) {
...@@ -46,18 +51,18 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -46,18 +51,18 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
} }
const mappingName = { const mappingName = {
"dj.smartcarlife": "axios", "dj.smartcarlife": "axios",
"dj": "axios", dj: "axios",
"scrm": "axios2", scrm: "axios2",
"merchants": "axios3", merchants: "axios3",
"reportExport": "axios4", reportExport: "axios4",
"glsx.accounts.biz.common.pictureUpload": "common", "glsx.accounts.biz.common.pictureUpload": "common",
"clue": "axios5", clue: "axios5",
"dj.businessSchool": "axios6", "dj.businessSchool": "axios6",
"script": "axios7", script: "axios7",
"staff": "axios9", staff: "axios9",
"riskmanage": "axios10", riskmanage: "axios10",
"strategy": "axios_strategy", strategy: "axios_strategy",
"supervisor": "axios_supervisor", supervisor: "axios_supervisor",
}; };
const baseApiName = mappingName[apiName]; const baseApiName = mappingName[apiName];
// console.log(baseApiName, "baseApiName") // console.log(baseApiName, "baseApiName")
...@@ -67,7 +72,10 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -67,7 +72,10 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
} else { } else {
params.appKey = baseConfig[baseApiName].appkey; params.appKey = baseConfig[baseApiName].appkey;
} }
// console.log("params.appKey", params.appKey)
if (util.cookies.get("uuid")) {
params.accountId = util.cookies.get("uuid");
}
params.timestamp = new Date().getTime(); params.timestamp = new Date().getTime();
params.v = "1.0.0"; params.v = "1.0.0";
params.format = "json"; params.format = "json";
...@@ -86,20 +94,20 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -86,20 +94,20 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
*/ */
const signWay = { const signWay = {
"dj.smartcarlife": "sha1", "dj.smartcarlife": "sha1",
"dj": "sha1", dj: "sha1",
"scrm": "sha1", scrm: "sha1",
"glsx": "md5", glsx: "md5",
"glsx.accounts.biz.common.pictureUpload": "md5", "glsx.accounts.biz.common.pictureUpload": "md5",
"clue": "sha1", clue: "sha1",
"script": "sha1", script: "sha1",
"staff": "sha1", staff: "sha1",
"riskmanage": "sha1", riskmanage: "sha1",
}; };
// console.log(signWay[apiName], "baseApiName") // console.log(signWay[apiName], "baseApiName")
const secret = baseConfig[baseApiName].secret; const secret = baseConfig[baseApiName].secret;
const CancelToken = axiosPackage.CancelToken; const CancelToken = axiosPackage.CancelToken;
let reqData let reqData =
= method === RequestMethods.POST method === RequestMethods.POST
? { ? {
baseURL: "/", baseURL: "/",
data: sign(params, noSignAttr, secret, signWay[apiName]), data: sign(params, noSignAttr, secret, signWay[apiName]),
...@@ -126,8 +134,7 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti ...@@ -126,8 +134,7 @@ function request(params = {}, method = RequestMethods.GET, noSignAttr = [], opti
method, method,
...reqData, ...reqData,
}; };
if (options.returnAll) if (options.returnAll) axiosParams.headers = { "return-all": true };
axiosParams.headers = { "return-all": true };
return axios(axiosParams); return axios(axiosParams);
/** /**
......
...@@ -553,19 +553,19 @@ export function getStaffAttendanceDetailAPI(data) { ...@@ -553,19 +553,19 @@ export function getStaffAttendanceDetailAPI(data) {
// 查询录音标签 // 查询录音标签
export function getRecordTagList(data) { export function getRecordTagList(data) {
data.method = `${path2}reception.findRecordingTagByBatchId`; data.method = `dj.api.smartcarlife.reception.findRecordingTagByBatchId.out`;
return request(data, "post"); return request(data, "post");
} }
// 查询质检列表|侧边栏 // 查询质检列表|侧边栏
export function getQualityList(data) { export function getQualityList(data) {
data.method = `${path2}reception.findCheckResultByBatchId`; data.method = `dj.api.smartcarlife.reception.findCheckResultByBatchId.out`;
return request(data, "post"); return request(data, "post");
} }
// 查询对话内容 // 查询对话内容
export function getConversationDetail(data) { export function getConversationDetail(data) {
data.method = `${path2}reception.findConversationDetailByBatchIdNew`; data.method = `dj.api.smartcarlife.reception.findConversationDetailByBatchIdNew.out`;
return request(data, "post"); return request(data, "post");
} }
// dj.api.smartcarlife.performanceSalaryConfig.page 分页查询绩效工资扣减规则 // dj.api.smartcarlife.performanceSalaryConfig.page 分页查询绩效工资扣减规则
...@@ -643,7 +643,7 @@ export function getPermissionsByPhone(data) { ...@@ -643,7 +643,7 @@ export function getPermissionsByPhone(data) {
* 质检管理-平铺视图 * 质检管理-平铺视图
*/ */
export function getReclistWithPageV2(data) { export function getReclistWithPageV2(data) {
data.method = "dj.api.mindworkplate.badge.employeeBadgeReclistWithPageV2"; data.method = "dj.api.mindworkplate.badge.employeeBadgeReclistWithPage.out";
return request(data, "post"); return request(data, "post");
} }
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
</span> </span>
</el-popover> </el-popover>
<span v-if="show" class="btn-text">{{ info && info.detail ? (info.detail.userType == 2 ? `${info.detail.userName}` : <span v-if="show" class="btn-text">{{ info && info.accountId ? (info.accountId || '管理员') : '未登录' }}</span>
'管理员') : '未登录' }}</span>
<span class="btn-text out-txt" @click="clear">退出</span> <span class="btn-text out-txt" @click="clear">退出</span>
</div> </div>
...@@ -429,9 +428,9 @@ export default { ...@@ -429,9 +428,9 @@ export default {
window.location.reload() window.location.reload()
} }
// 开始请求退出接口 // 开始请求退出接口
AccountLoginOut({}).then(async (res) => { // AccountLoginOut({}).then(async (res) => {
reload() reload()
}) // })
// if (this.$router.currentRoute.name === 'index') { // if (this.$router.currentRoute.name === 'index') {
// reload() // reload()
// } else { // } else {
......
...@@ -142,8 +142,7 @@ service.interceptors.response.use( ...@@ -142,8 +142,7 @@ service.interceptors.response.use(
return errorCreate("登录超时,请重新登录"); return errorCreate("登录超时,请重新登录");
// return Promise.reject(new Error(response.message || 'Error')) // return Promise.reject(new Error(response.message || 'Error'))
} }
if (returnAll) if (returnAll) return dataAxios;
return dataAxios;
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode; const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode;
switch (+codeValue) { switch (+codeValue) {
case ruleResult.code_success_value: case ruleResult.code_success_value:
...@@ -156,7 +155,8 @@ service.interceptors.response.use( ...@@ -156,7 +155,8 @@ service.interceptors.response.use(
// 不是正确的 code // 不是正确的 code
// 请求配置 useResponseMessage 时:code 为 -1 直接使用响应的 message // 请求配置 useResponseMessage 时:code 为 -1 直接使用响应的 message
const codeStr = String(dataAxios[ruleResult.code_key] ?? ""); const codeStr = String(dataAxios[ruleResult.code_key] ?? "");
const isCodeMinusOne = codeStr === "-1" || +dataAxios[ruleResult.code_key] === -1; const isCodeMinusOne =
codeStr === "-1" || +dataAxios[ruleResult.code_key] === -1;
if (useResponseMessage && isCodeMinusOne) { if (useResponseMessage && isCodeMinusOne) {
return errorCreate(`${dataAxios[ruleResult.message_key]}`); return errorCreate(`${dataAxios[ruleResult.message_key]}`);
} }
...@@ -217,8 +217,7 @@ service.interceptors.response.use( ...@@ -217,8 +217,7 @@ service.interceptors.response.use(
// console.log(error) // console.log(error)
} }
store.commit("d2admin/loading/set", false); store.commit("d2admin/loading/set", false);
if (!error.__CANCEL__) if (!error.__CANCEL__) errorLog(error); // 取消请求 不做错误提示
errorLog(error); // 取消请求 不做错误提示
return Promise.reject(error); return Promise.reject(error);
}, },
); );
......
...@@ -26,7 +26,6 @@ export default { ...@@ -26,7 +26,6 @@ export default {
// 开始请求登录接口 // 开始请求登录接口
AccountLogin(params) AccountLogin(params)
.then(async (accountInfo = {}) => { .then(async (accountInfo = {}) => {
console.log("accountInfo: ", accountInfo);
util.cookies.set("uuid", accountInfo.accountId); util.cookies.set("uuid", accountInfo.accountId);
util.cookies.set("userInfo", accountInfo); util.cookies.set("userInfo", accountInfo);
await dispatch("getAuth", { await dispatch("getAuth", {
......
...@@ -6,16 +6,8 @@ const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_AP ...@@ -6,16 +6,8 @@ const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_AP
const userInfo = JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))) || { const userInfo = JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME))) || {
detail: {} detail: {}
} }
const INDEX_PATH = userInfo const INDEX_PATH = "/index";
? userInfo.detail.accountType !== 7 const defaultPage = home;
? "/index"
: "/onlineAccountList"
: "/index"
const defaultPage = userInfo
? userInfo.detail.accountType !== 7
? home
: localRoutes["90503"]
: home
defaultPage.fullPath = INDEX_PATH defaultPage.fullPath = INDEX_PATH
// 判定是否需要缓存 // 判定是否需要缓存
const isKeepAlive = (data) => _.get(data, "meta.cache", false) const isKeepAlive = (data) => _.get(data, "meta.cache", false)
......
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
if (this.$refs.qualityDetail) this.$refs.qualityDetail.onPageHide() if (this.$refs.qualityDetail) this.$refs.qualityDetail.onPageHide()
if (this.$refs.newQualityDetail) { if (this.$refs.newQualityDetail) {
this.$refs.newQualityDetail.onPause() this.$refs.newQualityDetail.onPause()
this.$refs.newQualityDetail.onPageHide() // this.$refs.newQualityDetail.onPageHide()
} }
this.isQualityVisible = false this.isQualityVisible = false
this.isNewQualityVisible = false this.isNewQualityVisible = false
......
...@@ -125,20 +125,21 @@ ...@@ -125,20 +125,21 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { listShop4sByRef } from "@api/merchant" // import { listShop4sByRef } from "@api/merchant"
import { getMerchantEmployeeList, updateRecordings, getAliOSSToken } from "@api/serviceManage" import { getMerchantEmployeeList, updateRecordings, getAliOSSToken } from "@api/serviceManage"
import OSS from 'ali-oss' import OSS from 'ali-oss'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import { rangePickerOptions } from "@/common/format" import { rangePickerOptions } from "@/common/format"
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin' // import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default { export default {
mixins: [reportTrackFunMixin], // mixins: [reportTrackFunMixin],
name: 'VoiceDialog', name: 'VoiceDialog',
props: { props: {
visible: Boolean visible: Boolean
}, },
data () { data () {
return { return {
userInfo: this.$store.state.d2admin.user.info,
rangePickerOptions, rangePickerOptions,
client: null, client: null,
loading: false, loading: false,
...@@ -280,12 +281,11 @@ export default { ...@@ -280,12 +281,11 @@ export default {
}) })
}, },
getServiceStore () { getServiceStore () {
listShop4sByRef({ // listShop4sByRef({
yqMerchantId: '' // yqMerchantId: ''
}).then((res) => { // }).then((res) => {
this.merchantList = res || [] this.merchantList = this.userInfo.merchantList || []
console.log(res) // })
})
}, },
async getMerchantEmployeeList (storeMerchantNo) { async getMerchantEmployeeList (storeMerchantNo) {
try { try {
......
...@@ -207,9 +207,9 @@ const toMinutesAndSeconds = (seconds) => { ...@@ -207,9 +207,9 @@ const toMinutesAndSeconds = (seconds) => {
return formattedTime return formattedTime
} }
} }
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin' // import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default { export default {
mixins: [reportTrackFunMixin], // mixins: [reportTrackFunMixin],
name: "NewQualityDetail", name: "NewQualityDetail",
components: { components: {
Dialogue, Dialogue,
...@@ -257,7 +257,7 @@ export default { ...@@ -257,7 +257,7 @@ export default {
currentNum: { currentNum: {
handler (val) { handler (val) {
this.searchForm.batchId = this.qualityDetailList[val].id this.searchForm.batchId = this.qualityDetailList[val].id
this.onPageShow() // this.onPageShow()
}, },
immediate: true immediate: true
}, },
...@@ -332,7 +332,7 @@ export default { ...@@ -332,7 +332,7 @@ export default {
max = qualityDetailList.length - 1 max = qualityDetailList.length - 1
if ((currentNum == 0 && num == -1) || (currentNum == max && num == 1)) if ((currentNum == 0 && num == -1) || (currentNum == max && num == 1))
throw "无更多接待记录" throw "无更多接待记录"
this.onPageHide() // this.onPageHide()
this.currentNum += num this.currentNum += num
} catch (error) { } catch (error) {
if (error) this.$message.error(error) if (error) this.$message.error(error)
......
...@@ -101,9 +101,9 @@ const toMinutesAndSeconds = (seconds) => { ...@@ -101,9 +101,9 @@ const toMinutesAndSeconds = (seconds) => {
return formattedTime return formattedTime
} }
} }
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin' // import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default { export default {
mixins: [reportTrackFunMixin], // mixins: [reportTrackFunMixin],
name: "RelatActivityOrderDialog", name: "RelatActivityOrderDialog",
components: { components: {
QualityAnalyse, QualityAnalyse,
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
currentNum: { currentNum: {
handler (val) { handler (val) {
this.searchForm.batchId = this.qualityDetailList[val].id this.searchForm.batchId = this.qualityDetailList[val].id
this.onPageShow() // this.onPageShow()
}, },
immediate: true immediate: true
} }
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
max = qualityDetailList.length - 1 max = qualityDetailList.length - 1
if ((currentNum == 0 && num == -1) || (currentNum == max && num == 1)) if ((currentNum == 0 && num == -1) || (currentNum == max && num == 1))
throw "无更多接待记录" throw "无更多接待记录"
this.onPageHide() // this.onPageHide()
this.currentNum += num this.currentNum += num
} catch (error) { } catch (error) {
if (error) this.$message.error(error) if (error) this.$message.error(error)
......
...@@ -61,20 +61,20 @@ const FORM_DATA = [ ...@@ -61,20 +61,20 @@ const FORM_DATA = [
isClear: false, isClear: false,
pickerOptions: "rangePickerOptions", pickerOptions: "rangePickerOptions",
}, },
{ // {
label: "质检评分", // label: "质检评分",
name: "qualityTestScore", // name: "qualityTestScore",
addHtml: "score", // addHtml: "score",
}, // },
{ // {
label: "归属服务商", // label: "归属服务商",
name: "serviceMerchantNo", // name: "serviceMerchantNo",
type: "select", // type: "select",
optionList: [], // optionList: [],
optionId: "partnerMerchantId", // optionId: "partnerMerchantId",
optionLabel: "partnerMerchantName", // optionLabel: "partnerMerchantName",
optionsName: "parkServiceList", // optionsName: "parkServiceList",
}, // },
{ {
label: "归属门店", label: "归属门店",
name: "RecMerchantNo", name: "RecMerchantNo",
...@@ -84,60 +84,60 @@ const FORM_DATA = [ ...@@ -84,60 +84,60 @@ const FORM_DATA = [
optionLabel: "merchantName", optionLabel: "merchantName",
optionsName: "storeIdList", optionsName: "storeIdList",
}, },
{ // {
label: "员工姓名", // label: "员工姓名",
name: "employeeName", // name: "employeeName",
type: "input", // type: "input",
maxlength: "40", // maxlength: "40",
isClear: true, // isClear: true,
}, // },
{ // {
label: "手机号", // label: "手机号",
name: "phoneNumber", // name: "phoneNumber",
type: "input", // type: "input",
placeholder: "请输入手机号(至少4位)", // placeholder: "请输入手机号(至少4位)",
maxlength: "11", // maxlength: "11",
isClear: true, // isClear: true,
}, // },
{ // {
label: "业务场景", // label: "业务场景",
name: "BussinessType", // name: "BussinessType",
type: "select", // type: "select",
optionList: [], // optionList: [],
optionId: "id", // optionId: "id",
optionLabel: "name", // optionLabel: "name",
optionsName: "sceneTypeList", // optionsName: "sceneTypeList",
}, // },
{ // {
label: "品牌", // label: "品牌",
name: "carBrandIds", // name: "carBrandIds",
type: "select", // type: "select",
multiple: true, // multiple: true,
isClear: true, // isClear: true,
collapseTags: true, // collapseTags: true,
optionList: [], // optionList: [],
optionId: "id", // optionId: "id",
optionLabel: "label", // optionLabel: "label",
optionsName: "brandList", // optionsName: "brandList",
}, // },
{ // {
label: "是否成交", // label: "是否成交",
name: "orderTransactionFlag", // name: "orderTransactionFlag",
type: "select", // type: "select",
optionList: [], // optionList: [],
optionId: "id", // optionId: "id",
optionLabel: "name", // optionLabel: "name",
optionsName: "orderTransactionList", // optionsName: "orderTransactionList",
}, // },
{ // {
label: "客户类型", // label: "客户类型",
name: "enterpriseCustomerFlag", // name: "enterpriseCustomerFlag",
type: "select", // type: "select",
optionList: [], // optionList: [],
optionId: "id", // optionId: "id",
optionLabel: "name", // optionLabel: "name",
optionsName: "enterpriseCustomerList", // optionsName: "enterpriseCustomerList",
}, // },
{ {
label: "客户姓名", label: "客户姓名",
name: "customerName", name: "customerName",
...@@ -150,20 +150,20 @@ const FORM_DATA = [ ...@@ -150,20 +150,20 @@ const FORM_DATA = [
name: "customerPhone", name: "customerPhone",
addHtml: "customerPhone", addHtml: "customerPhone",
}, },
{ // {
label: "安心包是否成交", // label: "安心包是否成交",
name: "orderAxbTransactionFlag", // name: "orderAxbTransactionFlag",
type: "select", // type: "select",
optionList: [], // optionList: [],
optionId: "id", // optionId: "id",
optionLabel: "name", // optionLabel: "name",
optionsName: "orderAxTransactionList", // optionsName: "orderAxTransactionList",
}, // },
{ // {
label: "成交金额大于", // label: "成交金额大于",
name: "orderTransactionAmount", // name: "orderTransactionAmount",
addHtml: "orderTransactionAmount", // addHtml: "orderTransactionAmount",
}, // },
// { // {
// label: "当日到店量", // label: "当日到店量",
......
...@@ -194,9 +194,9 @@ import ElInputRange from "../el-input-range" ...@@ -194,9 +194,9 @@ import ElInputRange from "../el-input-range"
import QualityDetail from "./qualityDetail.vue" import QualityDetail from "./qualityDetail.vue"
import NewQualityDetail from "./newQualityDetail.vue" import NewQualityDetail from "./newQualityDetail.vue"
import { conversationPage } from "@api/resident" import { conversationPage } from "@api/resident"
import reportTrackFunMixin from "@/mixins/reportTrackFunMixin" // import reportTrackFunMixin from "@/mixins/reportTrackFunMixin"
export default { export default {
mixins: [reportTrackFunMixin], // mixins: [reportTrackFunMixin],
props: { props: {
queryData: Object, queryData: Object,
show: Boolean show: Boolean
...@@ -356,8 +356,8 @@ export default { ...@@ -356,8 +356,8 @@ export default {
watch: { watch: {
show: { show: {
handler(val) { handler(val) {
if (val) this.onPageShow() // if (val) this.onPageShow()
else this.onPageHide() // else this.onPageHide()
}, },
immediate: true immediate: true
} }
...@@ -407,14 +407,14 @@ export default { ...@@ -407,14 +407,14 @@ export default {
this.$refs.recepDetail.refreshTable() this.$refs.recepDetail.refreshTable()
}, },
closeDialog() { closeDialog() {
if (this.$refs.qualityDetail) this.$refs.qualityDetail.onPageHide() // if (this.$refs.qualityDetail) this.$refs.qualityDetail.onPageHide()
if (this.$refs.newQualityDetail) { if (this.$refs.newQualityDetail) {
this.$refs.newQualityDetail.onPause() this.$refs.newQualityDetail.onPause()
this.$refs.newQualityDetail.onPageHide() // this.$refs.newQualityDetail.onPageHide()
} }
this.isQualityVisible = false this.isQualityVisible = false
this.isNewQualityVisible = false this.isNewQualityVisible = false
this.onPageShow() // this.onPageShow()
}, },
qualitDetail(row) { qualitDetail(row) {
const list = this.$refs.recepDetail.data, const list = this.$refs.recepDetail.data,
...@@ -426,7 +426,7 @@ export default { ...@@ -426,7 +426,7 @@ export default {
} else { } else {
this.isQualityVisible = true this.isQualityVisible = true
} }
this.onPageHide() // this.onPageHide()
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
......
...@@ -83,9 +83,9 @@ ...@@ -83,9 +83,9 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import qualityIndex from "./components/qualityIndex/index" import qualityIndex from "./components/qualityIndex/index"
import recepDetail from "./components/recepDetail.vue" import recepDetail from "./components/recepDetail.vue"
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin" // import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"
export default { export default {
mixins: [reportTrackPageMixin], // mixins: [reportTrackPageMixin],
name: "", name: "",
components: { components: {
qualityIndex, qualityIndex,
......
...@@ -192,77 +192,77 @@ export default { ...@@ -192,77 +192,77 @@ export default {
handleReturnLogin() { handleReturnLogin() {
this.isMutiAccount && (this.isMutiAccount = false) this.isMutiAccount && (this.isMutiAccount = false)
}, },
handleSelectAccount(idx) { // handleSelectAccount(idx) {
if (this.logining) return false // if (this.logining) return false
this.logining = true // this.logining = true
var currentItem = this.accountInfo.accountList[idx] // var currentItem = this.accountInfo.accountList[idx]
var params = { // var params = {
loginAccount: currentItem.loginAccout, // loginAccount: currentItem.loginAccout,
merchantId: +currentItem.merchantNo, // merchantId: +currentItem.merchantNo,
loginToken: this.loginToken // loginToken: this.loginToken
} // }
selectAccount(params).then((res) => { // selectAccount(params).then((res) => {
util.cookies.set("token", res.sessionId) // util.cookies.set("token", res.sessionId)
// console.log(currentItem) // // console.log(currentItem)
getUserInfo({}) // getUserInfo({})
.then((userInfo) => { // .then((userInfo) => {
userInfo.beSuper = userInfo.loginAccount.isAdmin == 1 // userInfo.beSuper = userInfo.loginAccount.isAdmin == 1
if (userInfo.beSuper) { // if (userInfo.beSuper) {
// 是否园区店 // // 是否园区店
userInfo.beYQMerchant = true // userInfo.beYQMerchant = true
// 是否服务商 // // 是否服务商
userInfo.beServerMerchant = true // userInfo.beServerMerchant = true
} else { // } else {
// 是否园区店 // // 是否园区店
userInfo.beYQMerchant = // userInfo.beYQMerchant =
userInfo.loginAccount.merchantAccountList.includes("6") || // userInfo.loginAccount.merchantAccountList.includes("6") ||
userInfo.loginAccount.merchantAccountList.includes("8") // userInfo.loginAccount.merchantAccountList.includes("8")
// 是否服务商 // // 是否服务商
userInfo.beServerMerchant = // userInfo.beServerMerchant =
userInfo.loginAccount.merchantAccountList.includes("7") // userInfo.loginAccount.merchantAccountList.includes("7")
} // }
userInfo.detail = userInfo.merchant // userInfo.detail = userInfo.merchant
Object.keys(userInfo.loginAccount).forEach((item) => { // Object.keys(userInfo.loginAccount).forEach((item) => {
if (userInfo.loginAccount[item] && !userInfo.detail[item]) { // if (userInfo.loginAccount[item] && !userInfo.detail[item]) {
userInfo.detail[item] = userInfo.loginAccount[item] // userInfo.detail[item] = userInfo.loginAccount[item]
} // }
}) // })
userInfo.merchantAccountLevel = userInfo.detail.merchantAccountLevel // userInfo.merchantAccountLevel = userInfo.detail.merchantAccountLevel
this.getAuth({ // this.getAuth({
userInfo: userInfo, // userInfo: userInfo,
accountInfo: this.accountInfo // accountInfo: this.accountInfo
}) // })
.then(async (res) => { // .then(async (res) => {
console.log(res, "merchantAccountLevel") // console.log(res, "merchantAccountLevel")
const _current = // const _current =
userInfo.detail.accountType !== 7 // userInfo.detail.accountType !== 7
? await this.current() // ? await this.current()
: "/onlineAccountList" // : "/onlineAccountList"
await this.initBaseData() // await this.initBaseData()
// console.log(this.$route.query.redirect) // // console.log(this.$route.query.redirect)
// console.log(_current) // // console.log(_current)
// return // // return
this.$router.replace(this.$route.query.redirect || _current) // this.$router.replace(this.$route.query.redirect || _current)
}) // })
.catch((err) => { // .catch((err) => {
// 接收 getAuth 的 reject 并做对应处理 // // 接收 getAuth 的 reject 并做对应处理
console.error("getAuth failed:", err) // console.error("getAuth failed:", err)
const msg = // const msg =
typeof err === "string" // typeof err === "string"
? err // ? err
: (err && err.message) || "获取权限失败,请联系管理员" // : (err && err.message) || "获取权限失败,请联系管理员"
this.$message && this.$message.error(msg) // this.$message && this.$message.error(msg)
this.isMutiAccount = false // this.isMutiAccount = false
// 可选:重置登录按钮 loading / 回到登录页 / 清理态 // // 可选:重置登录按钮 loading / 回到登录页 / 清理态
// if (this.loading) this.loading = false // // if (this.loading) this.loading = false
// this.$router.replace('/login') // // this.$router.replace('/login')
}) // })
}) // })
.finally(() => { // .finally(() => {
this.logining = false // this.logining = false
}) // })
}) // })
}, // },
// 提交登录信息 // 提交登录信息
submit() { submit() {
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!