Commit 8efffc8c by Jaxon

Merge branch 'dev/service-center' into 'SAAS+V5.6.0'

上线合并

See merge request !475
2 parents 204d6b8a d98e3f9a
...@@ -62,7 +62,7 @@ import api from "~/utils/request/request.js"; ...@@ -62,7 +62,7 @@ import api from "~/utils/request/request.js";
* @returns {Promise<{code: string, errId: string, message?: string, data?: RpcPagination}>} 返回公司公告分页数据 * @returns {Promise<{code: string, errId: string, message?: string, data?: RpcPagination}>} 返回公司公告分页数据
*/ */
export function getCompanyNoticeList(data = { pageNum: 1, pageSize: 10 }) { export function getCompanyNoticeList(data = { pageNum: 1, pageSize: 10 }) {
return api.post("dj.pad.api.new.pad.message.box.page", data); return api.getApiFoxMock("dj.pad.api.new.pad.message.box.page", data);
} }
/** /**
......
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
...@@ -7,7 +7,16 @@ import { getWaitAuditCountAPI, waitstaffstateAPI, getStaffTemplate } from "~/api ...@@ -7,7 +7,16 @@ import { getWaitAuditCountAPI, waitstaffstateAPI, getStaffTemplate } from "~/api
import dayjs from "dayjs"; import dayjs from "dayjs";
import { getCompanyNoticeList } from "~/api/serviceCenter/index.js"; import { getCompanyNoticeList } from "~/api/serviceCenter/index.js";
import { dialogOptions, noticeSort } from "./constant.js"; import { dialogOptions, noticeSort } from "./constant.js";
import Dialog from "@vant/weapp/dialog/dialog";
// import api from '~/packageCrowdFunding/api'
import NP from "number-precision";
import { getBusinessSchoolScene } from "~/store/index";
import { getQuotationStatistics, outputValueStatistics, quotationPage, updateOrderStatus, merchantMode, orderStaffValid } from "../../api";
import commonApi from "~/api/api";
import carLifeApi from "../../carEquityApi";
import reportPageTrackMixin from "~/mixins/reportPageTrackMixin";
const app = getApp();
let lastPath = null; // 用于存储上一次的路径 let lastPath = null; // 用于存储上一次的路径
function throttle(func, delay) { function throttle(func, delay) {
let timeoutId; let timeoutId;
...@@ -39,14 +48,7 @@ function throttle(func, delay) { ...@@ -39,14 +48,7 @@ function throttle(func, delay) {
} }
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/"; const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/";
// import api from '~/packageCrowdFunding/api'
import NP from "number-precision";
import { getBusinessSchoolScene } from "~/store/index";
import { getQuotationStatistics, outputValueStatistics, quotationPage, updateOrderStatus, merchantMode, orderStaffValid } from "../../api";
import commonApi from "~/api/api";
const app = getApp();
import carLifeApi from "../../carEquityApi";
import reportPageTrackMixin from "~/mixins/reportPageTrackMixin";
Component({ Component({
behaviors: [reportPageTrackMixin], behaviors: [reportPageTrackMixin],
/** /**
...@@ -262,6 +264,9 @@ Component({ ...@@ -262,6 +264,9 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
handleNavigateServiceCenter(e) {
wx.$router.go("tabWorkOrder.serviceNoticeList");
},
onReportPopupCancel() { onReportPopupCancel() {
this.setData({ this.setData({
showReportPopup: false, showReportPopup: false,
......
...@@ -14,14 +14,17 @@ Page({ ...@@ -14,14 +14,17 @@ Page({
tabPath: { tabPath: {
[ServerCenterEnum.companyNotice]: { [ServerCenterEnum.companyNotice]: {
path: "tabWorkOrder.companyNoticeDetail", path: "tabWorkOrder.companyNoticeDetail",
// api参数
params: {}, params: {},
}, },
[ServerCenterEnum.longCourse]: { [ServerCenterEnum.longCourse]: {
path: "tabWorkOrder.longCourseNoticeDetail", path: "tabWorkOrder.longCourseNoticeDetail",
// api参数
params: {}, params: {},
}, },
[ServerCenterEnum.case]: { [ServerCenterEnum.case]: {
path: "tabWorkOrder.caseDetail", path: "tabWorkOrder.caseDetail",
// api参数
params: {}, params: {},
}, },
}, },
...@@ -44,7 +47,7 @@ Page({ ...@@ -44,7 +47,7 @@ Page({
}); });
}, },
handleTapItem(e) { handleTapItem(e) {
wx.$router.go(this.data.tabPath[e?.detail?.type || 0], { wx.$router.go(this.data.tabPath[e?.detail?.type || 0].path, {
id: e?.detail?.item, id: e?.detail?.item,
}); });
}, },
...@@ -53,7 +56,7 @@ Page({ ...@@ -53,7 +56,7 @@ Page({
}, },
async onLoad(options) { async onLoad(options) {
await getCompanyNoticeList({ pageNum: 1, pageSize: 15 }); await getCompanyNoticeList({ pageNum: 1, pageSize: 15, moduleType: 8 });
}, },
onRoute(options) {}, onRoute(options) {},
......
import {
secretKey,
domain,
path,
sign
} from './http.js'
// console.log(secretKey, 'secretKey')
import util from '~/utils/util.js'
import {
envIndex
} from '~/config'
import qs from '~/utils/lib/qs'
/**接口 */
class Request {
get(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.request('GET', method, data, noSignAttr, requestPath, domainName, failTips)
}
post(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.request('POST', method, data, noSignAttr, requestPath, domainName, failTips)
}
request(RequestMethods, method, data, noSignAttr = [], requestPath, domainName = 'dj', failTips = true) {
let _this = this
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading()
wx.getNetworkType({
success(res) {
if (res.networkType == "none") {
wx.hideLoading();
wx.showToast({
title: '网络异常',
icon: "none",
})
return;
}
if (!data) data = {}
let header =
RequestMethods === 'POST' ? {
'content-type': 'application/x-www-form-urlencoded'
} : {};
let url = `${domain[domainName]}${requestPath || path}`;
// console.log(requestPath)
if (method) {
data = _this.getData(data, method, noSignAttr, domainName == 'merchants')
url = `${domain[domainName]}${requestPath || path}?method=${method}`;
} else {
header = {
'content-type': 'application/json'
}
}
// console.log('reqData',data?.sessionId);
// delete
// if (data?.sessionId) {
// delete data?.sessionId
// }
wx.request({
url,
data,
method: RequestMethods,
header,
dataType: 'json',
responseType: 'text',
timeout: noSignAttr?.includes('file') ? 120 * 1000 : 60 * 1000,
success(response) {
/**业务代码 */
let {
data: {
code,
message,
subErrors
},
data
} = response
if (code == 20 || code == 21) {
let thisPage = wx.$router.getPageInstance()
// console.log(thisPage);
wx.hideLoading()
if (thisPage.route != 'pages/wxLogin/wxLogin') {
getApp().login(true, '', url)
}
} else if (code == -1) {
wx.showToast({
title: message || '网络请求失败',
icon: 'none'
})
resolve(data)
} else {
// util.debounce( getApp().test(true),500)
// getApp().test()
// console.log(data,'data');
resolve(data)
}
},
fail(error) {
wx.hideLoading()
console.error(`接口异常:${domain[domainName]}${requestPath || path}?method=${method}`, error)
if (failTips) {
wx.showToast({
title: '系统异常',
icon: 'error'
})
}
reject(error)
},
complete() {
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
}
})
}
})
})
}
getData(data, method, noSignAttr, merchant) {
let sessionId = util.getSessionId()
if (sessionId) data['sessionId'] = sessionId
// console.log(data,'request');
data['v'] = '1.0.0'
data['method'] = method
data['format'] = 'json'
data['locale'] = 'zh_CN'
data['source'] = 'dj-wechat'
// 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = data.method.split('.api')[0]
// 为空报错
if (!apiName) {
throw new Error('apiName is null')
}
if (apiName.split('.').length > 1) apiName = apiName.split('.')[0]
if (merchant) apiName = 'merchants'
const appKey = secretKey[apiName].appKey
const secret = secretKey[apiName].secret
data['appKey'] = appKey
let obj = sign(data, secret, noSignAttr)
//data['sign'] = obj.sign;
return obj
}
getMock(configModule = 'dj-car-boutique-work-wechat-miniapp') {
const env = {
'1': 'develop',
'2': 'test',
'3': 'production',
'4': 'beta'
} [envIndex],
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`
return new Promise(resolve => {
wx.request({
url: configUrl,
data: {},
method: 'GET',
header: {},
dataType: 'json',
responseType: 'text',
success(response) {
resolve(response.data)
}
})
})
}
}
export default new Request()
\ No newline at end of file \ No newline at end of file
import { secretKey, domain, path, sign } from "./http.js";
// console.log(secretKey, 'secretKey')
import util from "~/utils/util.js";
import { envIndex } from "~/config";
import qs from "~/utils/lib/qs";
/**接口 */
class Request {
get(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.request("GET", method, data, noSignAttr, requestPath, domainName, failTips);
}
post(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.request("POST", method, data, noSignAttr, requestPath, domainName, failTips);
}
request(RequestMethods, method, data, noSignAttr = [], requestPath, domainName = "dj", failTips = true) {
let _this = this;
return new Promise((resolve, reject) => {
wx.showNavigationBarLoading();
wx.getNetworkType({
success(res) {
if (res.networkType == "none") {
wx.hideLoading();
wx.showToast({
title: "网络异常",
icon: "none",
});
return;
}
if (!data) data = {};
let header =
RequestMethods === "POST"
? {
"content-type": "application/x-www-form-urlencoded",
}
: {};
let url = `${domain[domainName]}${requestPath || path}`;
// console.log(requestPath)
if (method) {
data = _this.getData(data, method, noSignAttr, domainName == "merchants");
url = `${domain[domainName]}${requestPath || path}?method=${method}`;
} else {
header = {
"content-type": "application/json",
};
}
// console.log('reqData',data?.sessionId);
// delete
// if (data?.sessionId) {
// delete data?.sessionId
// }
wx.request({
url,
data,
method: RequestMethods,
header,
dataType: "json",
responseType: "text",
timeout: noSignAttr?.includes("file") ? 120 * 1000 : 60 * 1000,
success(response) {
/**业务代码 */
let {
data: { code, message, subErrors },
data,
} = response;
if (code == 20 || code == 21) {
let thisPage = wx.$router.getPageInstance();
// console.log(thisPage);
wx.hideLoading();
if (thisPage.route != "pages/wxLogin/wxLogin") {
getApp().login(true, "", url);
}
} else if (code == -1) {
wx.showToast({
title: message || "网络请求失败",
icon: "none",
});
resolve(data);
} else {
// util.debounce( getApp().test(true),500)
// getApp().test()
// console.log(data,'data');
resolve(data);
}
},
fail(error) {
wx.hideLoading();
console.error(`接口异常:${domain[domainName]}${requestPath || path}?method=${method}`, error);
if (failTips) {
wx.showToast({
title: "系统异常",
icon: "error",
});
}
reject(error);
},
complete() {
wx.stopPullDownRefresh();
wx.hideNavigationBarLoading();
},
});
},
});
});
}
getData(data, method, noSignAttr, merchant) {
let sessionId = util.getSessionId();
if (sessionId) data["sessionId"] = sessionId;
// console.log(data,'request');
data["v"] = "1.0.0";
data["method"] = method;
data["format"] = "json";
data["locale"] = "zh_CN";
data["source"] = "dj-wechat";
// 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = data.method.split(".api")[0];
// 为空报错
if (!apiName) {
throw new Error("apiName is null");
}
if (apiName.split(".").length > 1) apiName = apiName.split(".")[0];
if (merchant) apiName = "merchants";
const appKey = secretKey[apiName].appKey;
const secret = secretKey[apiName].secret;
data["appKey"] = appKey;
let obj = sign(data, secret, noSignAttr);
//data['sign'] = obj.sign;
return obj;
}
getMock(configModule = "dj-car-boutique-work-wechat-miniapp") {
const env = {
1: "develop",
2: "test",
3: "production",
4: "beta",
}[envIndex],
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;
return new Promise((resolve) => {
wx.request({
url: configUrl,
data: {},
method: "GET",
header: {},
dataType: "json",
responseType: "text",
success(response) {
resolve(response.data);
},
});
});
}
getApiFoxMock(method, params) {
return new Promise((resolve) => {
wx.request({
url: `http://127.0.0.1:4523/m1/7739320-7483460-default/rop-scrm-clue/router?method=${method}`,
data: params,
method: "post",
header: {
"content-type": "application/x-www-form-urlencoded",
},
dataType: "json",
responseType: "text",
success(response) {
resolve(response.data);
},
});
});
}
}
export default new Request();
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!