Commit 5d047592 by 前端

图标

1 parent 377f1fcb
......@@ -11,16 +11,16 @@ const HOST = {
scrm: domain,
dj: djDomain,
merchant: merchantDomain,
ip: 'http://192.168.1.169:8292'
ip: "http://192.168.1.169:8292",
};
class Request {
get (params, returnAll = false, hostType) {
get(params, returnAll = false, hostType) {
return this.request("GET", params, returnAll, hostType);
}
post (params, returnAll = false, hostType) {
post(params, returnAll = false, hostType) {
return this.request("POST", params, returnAll, hostType);
}
fetch (method, data, returnAll = true, hostType) {
fetch(method, data, returnAll = true, hostType) {
return this.post(
{
method,
......@@ -30,28 +30,28 @@ class Request {
hostType
);
}
request (RequestMethods, params, returnAll, hostType = "dj") {
request(RequestMethods, params, returnAll, hostType = "dj") {
return new Promise((resolve, reject) => {
let _this = this
let _this = this;
uni.getNetworkType({
success (res) {
if (res.networkType == 'none') {
success(res) {
if (res.networkType == "none") {
uni.hideLoading();
uni.showToast({
title: '网络异常',
icon: "error",
});
reject('网络异常');
return
// uni.showToast({
// title: '网络异常',
// icon: "error",
// });
reject("网络异常");
return;
}
let header = RequestMethods === "POST"
? {
"content-type": "application/x-www-form-urlencoded",
}
: {
"Cache-Control": "no-cache",
};
let header =
RequestMethods === "POST"
? {
"content-type": "application/x-www-form-urlencoded",
}
: {
"Cache-Control": "no-cache",
};
let projectName = params.projectName;
if (!projectName) projectName = _this.getRopProject(params.method);
const path = pathEnum[projectName];
......@@ -63,13 +63,11 @@ class Request {
header,
dataType: "json",
responseType: "text",
success (response) {
success(response) {
/**业务代码 */
let {
data,
} = response
if (!data) return reject()
let { code, message } = data
let { data } = response;
if (!data) return reject();
let { code, message } = data;
if (returnAll) {
resolve(data);
return;
......@@ -83,7 +81,7 @@ class Request {
if (code == "0") {
resolve(data.data);
} else {
uni.hideLoading()
uni.hideLoading();
uni.showToast({
title: message || "系统异常",
icon: "none",
......@@ -91,27 +89,29 @@ class Request {
}
}
},
fail (error) {
fail(error) {
uni.hideLoading();
console.error(`${params.method}接口异常:`, error);
uni.showToast({
title:
typeof error == "string"
? error
: error.errMsg ? error.errMsg : JSON.stringify(error) || "系统异常",
: error.errMsg
? error.errMsg
: JSON.stringify(error) || "系统异常",
icon: "error",
});
reject(error);
},
complete () {
complete() {
uni.stopPullDownRefresh();
},
});
}
})
},
});
});
}
getData (params, hostType = "scrm") {
getData(params, hostType = "scrm") {
let projectName = params.projectName;
if (!projectName) projectName = this.getRopProject(params.method);
else delete params.projectName;
......@@ -143,11 +143,11 @@ class Request {
params.appKey = appKey;
return sign(params, secret, noSignAttr);
}
getRopProject (method) {
getRopProject(method) {
const projectName = method.split(".")[2];
return projectName;
}
uni_request ({
uni_request({
url,
method = "GET",
data = {},
......@@ -163,7 +163,7 @@ class Request {
header,
dataType,
responseType,
success (response) {
success(response) {
resolve(response.data);
},
});
......
......@@ -208,6 +208,7 @@ export default {
this.nothing = false
if(index == 0) {
this.changeIndex(this.dateIndex,true)
this.getRecordNum()
}else {
this.getRecordFail()
}
......
......@@ -115,7 +115,7 @@ export default {
return params;
},
//开始录音
async startAudio() {
startAudio: utils.throttle(async function () {
if (this.audioInfo.audioStatus == "start") return;
this.setAudioInfo({ audioList: [], audioStatus: "start" });
this.initTime();
......@@ -140,6 +140,9 @@ export default {
console.log(res);
},
});
setTimeout(() => {
uni.hideLoading();
}, 3000);
return;
}
const saveResult = await uni.saveFile({
......@@ -154,7 +157,7 @@ export default {
});
this.handleSave(saveResult[1].savedFilePath);
});
},
}, 300),
handleSave(file) {
const audioList = [...this.audioInfo.audioList, file];
if (file) {
......@@ -167,7 +170,9 @@ export default {
this.setBooks([]);
this.$store.dispatch("clearCustomerInfo");
this.setReceptionStatus(1);
this.setAudioInfo({ endReasonType: 0, audioStatus: "finish" });
setTimeout(() => {
this.setAudioInfo({ endReasonType: 0, audioStatus: "finish" });
}, 2000);
},
/**保存记录*/
async saveRecord() {
......@@ -216,11 +221,9 @@ export default {
let finish_timer = null;
this.setAudioInfo({ audioStatus: "end" });
//直接退出
if (!status) {
uni.showLoading({
mask: true,
});
}
uni.showLoading({
mask: true,
});
this.times = 0;
clearInterval(this.timer);
this.timer = null;
......

9.68 KB | W: | H:

7.69 KB | W: | H:

static/144.png
static/144.png
static/144.png
static/144.png
  • 2-up
  • Swipe
  • Onion skin

3.75 KB | W: | H:

3.08 KB | W: | H:

static/72.png
static/72.png
static/72.png
static/72.png
  • 2-up
  • Swipe
  • Onion skin

5.62 KB | W: | H:

4.48 KB | W: | H:

static/96.png
static/96.png
static/96.png
static/96.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -65,15 +65,29 @@ function debounce(fn, timer) {
}, timer);
};
}
var throttle = function (fn, delay) {
var timer = null;
// var throttle = function (fn, delay) {
// var timer = null;
// return function () {
// var context = this,
// args = arguments;
// clearTimeout(timer);
// timer = setTimeout(function () {
// fn.apply(context, args);
// }, delay);
// };
// };
var throttle = function (func, limit) {
let inThrottle;
return function () {
var context = this,
args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
const context = this;
const args = arguments;
if (!inThrottle) {
func.apply(context, args);
inThrottle = true;
setTimeout(function () {
inThrottle = false;
}, limit);
}
};
};
//检查是否有网络
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!