import Vue from "vue"
let prototype = Vue.prototype;

export default {
    /**
     * 上传文件
     */
    upload(path) {
        return new Promise((resolve, reject) => {
            prototype.$upload({
                api: "system.uploadFile",
                path: path
            }).then(response => {
                if (response.code == 1) {
                    return resolve(response.data);
                }
                return reject(response.msg);
            });
        });
    },
    /**
     * 提交投诉
     */
    submitComplaint(data) {
        return new Promise((resolve, reject) => {
            prototype.$request({
                api: "system.complaint",
                data: data,
            }).then(response => {
                if (response.code == 1) {
                    return resolve();
                }
                return reject(response.msg);
            }).catch(e => { });
        });
    }
}
