Commit 5d047592 by 前端

图标

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