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 { import { secretKey, domain, path, sign } from "./http.js";
secretKey,
domain,
path,
sign
} from './http.js'
// console.log(secretKey, 'secretKey') // console.log(secretKey, 'secretKey')
import util from '~/utils/util.js' import util from "~/utils/util.js";
import { import { envIndex } from "~/config";
envIndex import qs from "~/utils/lib/qs";
} from '~/config'
import qs from '~/utils/lib/qs'
/**接口 */ /**接口 */
class Request { class Request {
get(method, data, noSignAttr, requestPath, domainName, failTips) { get(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.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) { post(method, data, noSignAttr, requestPath, domainName, failTips) {
return this.request('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) { request(RequestMethods, method, data, noSignAttr = [], requestPath, domainName = "dj", failTips = true) {
let _this = this let _this = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.showNavigationBarLoading() wx.showNavigationBarLoading();
wx.getNetworkType({ wx.getNetworkType({
success(res) { success(res) {
if (res.networkType == "none") { if (res.networkType == "none") {
wx.hideLoading(); wx.hideLoading();
wx.showToast({ wx.showToast({
title: '网络异常', title: "网络异常",
icon: "none", icon: "none",
}) });
return; return;
} }
if (!data) data = {} if (!data) data = {};
let header = let header =
RequestMethods === 'POST' ? { RequestMethods === "POST"
'content-type': 'application/x-www-form-urlencoded' ? {
} : {}; "content-type": "application/x-www-form-urlencoded",
}
: {};
let url = `${domain[domainName]}${requestPath || path}`; let url = `${domain[domainName]}${requestPath || path}`;
// console.log(requestPath) // console.log(requestPath)
if (method) { if (method) {
data = _this.getData(data, method, noSignAttr, domainName == 'merchants') data = _this.getData(data, method, noSignAttr, domainName == "merchants");
url = `${domain[domainName]}${requestPath || path}?method=${method}`; url = `${domain[domainName]}${requestPath || path}?method=${method}`;
} else { } else {
header = { header = {
'content-type': 'application/json' "content-type": "application/json",
} };
} }
// console.log('reqData',data?.sessionId); // console.log('reqData',data?.sessionId);
// delete // delete
...@@ -57,108 +52,121 @@ class Request { ...@@ -57,108 +52,121 @@ class Request {
data, data,
method: RequestMethods, method: RequestMethods,
header, header,
dataType: 'json', dataType: "json",
responseType: 'text', responseType: "text",
timeout: noSignAttr?.includes('file') ? 120 * 1000 : 60 * 1000, timeout: noSignAttr?.includes("file") ? 120 * 1000 : 60 * 1000,
success(response) { success(response) {
/**业务代码 */ /**业务代码 */
let { let {
data: { data: { code, message, subErrors },
code, data,
message, } = response;
subErrors
},
data
} = response
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance();
// console.log(thisPage); // console.log(thisPage);
wx.hideLoading() wx.hideLoading();
if (thisPage.route != 'pages/wxLogin/wxLogin') { if (thisPage.route != "pages/wxLogin/wxLogin") {
getApp().login(true, '', url) getApp().login(true, "", url);
} }
} else if (code == -1) { } else if (code == -1) {
wx.showToast({ wx.showToast({
title: message || '网络请求失败', title: message || "网络请求失败",
icon: 'none' icon: "none",
}) });
resolve(data) resolve(data);
} else { } else {
// util.debounce( getApp().test(true),500) // util.debounce( getApp().test(true),500)
// getApp().test() // getApp().test()
// console.log(data,'data'); // console.log(data,'data');
resolve(data) resolve(data);
} }
}, },
fail(error) { fail(error) {
wx.hideLoading() wx.hideLoading();
console.error(`接口异常:${domain[domainName]}${requestPath || path}?method=${method}`, error) console.error(`接口异常:${domain[domainName]}${requestPath || path}?method=${method}`, error);
if (failTips) { if (failTips) {
wx.showToast({ wx.showToast({
title: '系统异常', title: "系统异常",
icon: 'error' icon: "error",
}) });
} }
reject(error) reject(error);
}, },
complete() { complete() {
wx.stopPullDownRefresh() wx.stopPullDownRefresh();
wx.hideNavigationBarLoading() wx.hideNavigationBarLoading();
} },
}) });
} },
}) });
}) });
} }
getData(data, method, noSignAttr, merchant) { getData(data, method, noSignAttr, merchant) {
let sessionId = util.getSessionId() let sessionId = util.getSessionId();
if (sessionId) data['sessionId'] = sessionId if (sessionId) data["sessionId"] = sessionId;
// console.log(data,'request'); // console.log(data,'request');
data['v'] = '1.0.0' data["v"] = "1.0.0";
data['method'] = method data["method"] = method;
data['format'] = 'json' data["format"] = "json";
data['locale'] = 'zh_CN' data["locale"] = "zh_CN";
data['source'] = 'dj-wechat' data["source"] = "dj-wechat";
// 兼容线上dj和scrm appkey和secret不一样的情况 // 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = data.method.split('.api')[0] let apiName = data.method.split(".api")[0];
// 为空报错 // 为空报错
if (!apiName) { if (!apiName) {
throw new Error('apiName is null') throw new Error("apiName is null");
} }
if (apiName.split('.').length > 1) apiName = apiName.split('.')[0] if (apiName.split(".").length > 1) apiName = apiName.split(".")[0];
if (merchant) apiName = 'merchants' if (merchant) apiName = "merchants";
const appKey = secretKey[apiName].appKey const appKey = secretKey[apiName].appKey;
const secret = secretKey[apiName].secret const secret = secretKey[apiName].secret;
data['appKey'] = appKey data["appKey"] = appKey;
let obj = sign(data, secret, noSignAttr) let obj = sign(data, secret, noSignAttr);
//data['sign'] = obj.sign; //data['sign'] = obj.sign;
return obj return obj;
} }
getMock(configModule = 'dj-car-boutique-work-wechat-miniapp') { getMock(configModule = "dj-car-boutique-work-wechat-miniapp") {
const env = { const env = {
'1': 'develop', 1: "develop",
'2': 'test', 2: "test",
'3': 'production', 3: "production",
'4': 'beta' 4: "beta",
} [envIndex], }[envIndex],
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}` configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`;
return new Promise(resolve => { return new Promise((resolve) => {
wx.request({ wx.request({
url: configUrl, url: configUrl,
data: {}, data: {},
method: 'GET', method: "GET",
header: {}, header: {},
dataType: 'json', dataType: "json",
responseType: 'text', responseType: "text",
success(response) { success(response) {
resolve(response.data) 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()
\ No newline at end of file \ No newline at end of file
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!