first commit
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
|
||||
|
||||
const uploadFileType = ['jpg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'pdf']
|
||||
const docType = ['doc', 'docx', 'xls', 'xlsx', 'pdf']
|
||||
|
||||
const FILE_UPLOAD_ADDRESS = '/file_server/uploadFile'
|
||||
const FILE_DELETE_ADDRESS = '/file_server/deleteFile'
|
||||
const FILE_STREAM_PREVIEW_ADDRESS = '/file_server/fileStreamPreview'
|
||||
|
||||
Vue.component('m-page-loading', httpVueLoader('/components/mobile/common/MLoading.vue'))
|
||||
Vue.component('m-table-loading', httpVueLoader('/components/mobile/common/MTableLoading.vue'))
|
||||
Vue.component('m-card', httpVueLoader('/components/mobile/common/MCard.vue'))
|
||||
Vue.component('vant-file-upload', httpVueLoader('/components/plugins/VantFileUpload.vue'))
|
||||
|
||||
const GetQueryString = (name) => {
|
||||
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
const r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]);
|
||||
return "";
|
||||
}
|
||||
const removeHTMLTag = (str) => {
|
||||
str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
|
||||
str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
|
||||
str = str.replace(/\n[\s| | ]*\r/g, '\n'); //去除多余空行
|
||||
str = str.replace(/ /ig, '');//去掉
|
||||
return str;
|
||||
}
|
||||
|
||||
const CREATE_PREVIEW_URL = (val) => {
|
||||
return FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val
|
||||
}
|
||||
|
||||
const clone = (val) => {
|
||||
return JSON.parse(JSON.stringify(val))
|
||||
}
|
||||
|
||||
const toChinesNum = (num) => {
|
||||
let changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
|
||||
let unit = ["", "十", "百", "千", "万"];
|
||||
num = parseInt(num);
|
||||
let getWan = (temp) => {
|
||||
let strArr = temp.toString().split("").reverse();
|
||||
let newNum = "";
|
||||
for (let i = 0; i < strArr.length; i++) {
|
||||
newNum = (i == 0 && strArr[i] == 0 ? "" : (i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? "" : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i]))) + newNum;
|
||||
}
|
||||
return newNum;
|
||||
}
|
||||
let overWan = Math.floor(num / 10000);
|
||||
let noWan = num % 10000;
|
||||
if (noWan.toString().length < 4) {
|
||||
noWan = "0" + noWan;
|
||||
}
|
||||
return overWan ? getWan(overWan) + "万" + getWan(noWan) : getWan(num);
|
||||
}
|
||||
|
||||
const loc = () => {
|
||||
return location.href.replace(location.search, "").replace(location.hash, "")
|
||||
}
|
||||
|
||||
const modal = {
|
||||
// 消息提示
|
||||
msg(content) {
|
||||
vant.Toast(content)
|
||||
},
|
||||
// 错误消息
|
||||
msgError(content) {
|
||||
vant.Toast.fail(content)
|
||||
},
|
||||
// 成功消息
|
||||
msgSuccess(content) {
|
||||
vant.Toast.success(content)
|
||||
},
|
||||
// 弹出提示
|
||||
alert(content) {
|
||||
vant.Dialog.alert({
|
||||
title: '提示',
|
||||
message: content
|
||||
}).then(() => {
|
||||
// on close
|
||||
});
|
||||
},
|
||||
// 确认窗体
|
||||
confirm(content) {
|
||||
return new Promise((resolve, reject) => {
|
||||
vant.Dialog.confirm({
|
||||
title: '提示',
|
||||
message: content,
|
||||
}).then(() => {
|
||||
resolve()
|
||||
}).catch(() => {
|
||||
// reject()
|
||||
})
|
||||
})
|
||||
},
|
||||
// 提示信息
|
||||
showToast(option) {
|
||||
if (typeof option === "object") {
|
||||
vant.Toast(option)
|
||||
} else {
|
||||
vant.Toast.loading({
|
||||
message: option,
|
||||
forbidClick: true,
|
||||
loadingType: 'spinner',
|
||||
duration: 2500
|
||||
});
|
||||
}
|
||||
},
|
||||
// 打开遮罩层
|
||||
loading(content) {
|
||||
vant.Toast.loading({
|
||||
message: content,
|
||||
forbidClick: true,
|
||||
overlay: true,
|
||||
duration: 0
|
||||
});
|
||||
},
|
||||
// 关闭遮罩层
|
||||
closeLoading() {
|
||||
vant.Toast.clear();
|
||||
}
|
||||
}
|
||||
Vue.prototype.$modal = modal
|
||||
@@ -0,0 +1,53 @@
|
||||
const mCommon = {
|
||||
unitList: [],
|
||||
unionList: [],
|
||||
async getUnionList() {
|
||||
const {data} = await $.get("/platform/vi/common/unions")
|
||||
data.forEach(v => {
|
||||
v.text = v.unionname
|
||||
v.value = v.id
|
||||
})
|
||||
data.unshift({text: "全部工会", value: null})
|
||||
this.unionList = data
|
||||
},
|
||||
async getUnitList(unionId) {
|
||||
const {data} = await $.get("/platform/vi/common/units", {unionId})
|
||||
data.forEach(v => {
|
||||
v.text = v.name
|
||||
v.value = v.id
|
||||
})
|
||||
data.unshift({text: "全部单位", value: null})
|
||||
this.unitList = data
|
||||
},
|
||||
previewFile(filepath, filename, fileList, index, fileId) {
|
||||
|
||||
const doctype = ['doc', 'docx', 'xls', 'xlsx'];
|
||||
const pictype = ['jpg', 'png', 'gif', 'jpeg'];
|
||||
let filetype = filepath.substring(filepath.lastIndexOf('.') + 1, filepath.length);
|
||||
if (doctype.indexOf(filetype) > -1) {
|
||||
const path = APP_DOMAIN + "/file/mange/preview?filepath=" + filepath + "&fileid=" + fileId
|
||||
window.open(path);
|
||||
} else if (pictype.indexOf(filetype) > -1) {
|
||||
let ele = document.createElement("div");
|
||||
fileList.forEach(v => {
|
||||
let fp = v.filepath.substring(v.filepath.lastIndexOf('.') + 1, v.filepath.length);
|
||||
if (pictype.indexOf(fp) > -1) {
|
||||
const image = new Image();
|
||||
const src = FILE_DOMAIN + v.filepath
|
||||
image.src = src
|
||||
image.alt = v.filename
|
||||
ele.appendChild(image);
|
||||
}
|
||||
|
||||
})
|
||||
const viewer = new Viewer(ele, {
|
||||
title: function (img, obj) {
|
||||
return img.getAttribute("alt");
|
||||
}
|
||||
});
|
||||
viewer.show();
|
||||
} else {
|
||||
alert('该文件不支持在手机端预览')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
const mCondolence = {
|
||||
typeList: [],
|
||||
async getType() {
|
||||
const {data} = await $.get("/platform/condolence/type/getAll")
|
||||
data.forEach(v => {
|
||||
v.text = v.name + '(' + v.code + ')'
|
||||
v.value = v.id
|
||||
})
|
||||
data.unshift({text: "全部类型", value: null})
|
||||
this.typeList = data
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
const mProposal = {
|
||||
needSignState: [],
|
||||
async getAllSession() {
|
||||
const {data} = await $.get('/mobile/proposal/common/getAllSession')
|
||||
return data
|
||||
},
|
||||
|
||||
async getDelegation(sessionId) {
|
||||
const {data} = await $.get('/mobile/proposal/common/getDelegation', {sessionId})
|
||||
return data
|
||||
},
|
||||
async getDelegateType() {
|
||||
const {data} = await $.get('/mobile/proposal/common/getDelegateType')
|
||||
return data
|
||||
},
|
||||
async getProposalType() {
|
||||
const {data} = await $.get('/mobile/proposal/common/getProposalType')
|
||||
return data
|
||||
},
|
||||
async getProposalConfig() {
|
||||
const {data} = await $.get("/platform/proposal/common/getProposalConfig")
|
||||
return data
|
||||
},
|
||||
async getProposalNeedSignStateCode() {
|
||||
const {data} = await $.get("/platform/proposal/common/getProposalNeedSignStateCode")
|
||||
this.needSignState = data
|
||||
},
|
||||
/**
|
||||
* 根据教代会获取代表团
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
async getDelegation(meetingId) {
|
||||
const {data} = await $.get("/platform/proposal/common/getDelegation", {meetingId})
|
||||
return data
|
||||
},
|
||||
async getOpenMeeting() {
|
||||
const {data} = await $.get("/platform/proposal/common/getOpenMeeting")
|
||||
return data
|
||||
},
|
||||
async getProposalDict() {
|
||||
const {data} = await $.get('/mobile/proposal/common/getProposalDict')
|
||||
return data
|
||||
},
|
||||
async GetProposalStateCode(proposal_id) {
|
||||
const {data} = await $.post("/platform/proposal/common/getProposalStateCode", {proposal_id})
|
||||
return data;
|
||||
},
|
||||
|
||||
async GetProposalResultCode(proposal_id) {
|
||||
const {data} = await $.post("/platform/proposal/common/getProposalResultCode", {proposal_id})
|
||||
return data;
|
||||
},
|
||||
async getProposalUndertake() {
|
||||
const {data} = await $.get("/platform/proposal/common/getProposalUndertake")
|
||||
return data
|
||||
},
|
||||
async getProposalConfig() {
|
||||
const {data} = await $.get("/platform/proposal/common/getProposalConfig")
|
||||
return data
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
const mobileMixins = {
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
mLoading: false,
|
||||
finished: false,
|
||||
loading: false,
|
||||
refreshing: false,
|
||||
formData: {},
|
||||
pageForm: {
|
||||
pageNumber: 1,
|
||||
pageSize: 5,
|
||||
totalCount: 0
|
||||
},
|
||||
themeColor: '#004e64',
|
||||
pageDataUrl: null,
|
||||
yearList: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
date(value) {
|
||||
return value ? moment(value).format('YYYY-MM-DD') : ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async pageData() {
|
||||
this.mLoading = true
|
||||
if (this.pageDataUrl == null) {
|
||||
this.pageDataUrl = loc() + '/pageData'
|
||||
}
|
||||
$.post(this.pageDataUrl, this.pageForm, (res) => {
|
||||
const {code, data} = res
|
||||
if (this.refreshing) {
|
||||
this.tableData = [];
|
||||
this.refreshing = false;
|
||||
}
|
||||
this.loading = false;
|
||||
|
||||
if (code === 0) {
|
||||
this.tableData = this.tableData.concat(data.list)
|
||||
this.pageForm.totalCount = data.totalCount
|
||||
|
||||
if (this.tableData.length === 0) {
|
||||
this.finished = true;
|
||||
} else {
|
||||
this.none_data = false
|
||||
if (this.tableData.length >= this.pageForm.totalCount) {
|
||||
this.finished = true;
|
||||
this.pageForm.pageNumber++
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
this.mLoading = false
|
||||
},
|
||||
async onRefresh() {
|
||||
this.tableData = []
|
||||
this.refreshing = true;
|
||||
this.finished = false;
|
||||
this.pageForm.pageNumber = 0
|
||||
this.loading = true;
|
||||
await this.pageData();
|
||||
},
|
||||
GetQueryString(name) {
|
||||
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
const r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]);
|
||||
return "";
|
||||
},
|
||||
createYearList() {
|
||||
for (let i = new Date().getFullYear() - 50; i <= new Date().getFullYear(); i++) {
|
||||
this.yearList.unshift({value: i, text: i + '年'},)
|
||||
}
|
||||
},
|
||||
startLoading() {
|
||||
this.vLoading = vant.Toast.loading({
|
||||
message: '加载中...',
|
||||
forbidClick: true,
|
||||
duration: 0
|
||||
})
|
||||
},
|
||||
closeLoading() {
|
||||
setTimeout(() => {
|
||||
this.vLoading.close()
|
||||
}, 500)
|
||||
},
|
||||
doSearch() {
|
||||
this.tableKey = new Date().getTime()
|
||||
this.pageForm.pageNumber = 1
|
||||
this.pageForm.totalCount = 0
|
||||
this.tableData = []
|
||||
this.pageData()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.createYearList()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user