123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- import * as config from '../config'
- const rolesList = []
- const ossUploadUrl = 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/';
- const chooseImage = {
- count: '1',
- sizeType: ['original', 'compressed'],
- sourceType: ['album'],
- }
- const imgType = '请选择图片来源'
- const imgTypeList = [{
- name: '相册',
- },
- {
- name: '拍照',
- }
- ]
- const makeValidityPeriod = function(type) {
- //获取当前年
- let nowDate = new Date();
- let year = nowDate.getFullYear()
- let _list = []
- let _list1 = []
- // let _list2 = ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]
- let _list2 = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
- let _list3 = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14",
- "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
- "31"
- ]
- let _ValidityPeriod = []
- for (let i = 0; i < 30; i++) {
- _list1.push(year + i)
- }
- if (type == 0) {
- _list1.unshift('长期')
- _list2.unshift('')
- _list3.unshift('')
- }
- _list.push(_list1, _list2, _list3)
- return _list
- }
- const fUN_AmapLocation = uni.requireNativePlugin('FUN-AmapLocation');
- const getListByUserId = function() {
- let baseUrlNew = config.def().baseUrlNew
- var userInfo = uni.getStorageSync("userInfo")
- console.log("------", userInfo)
- if (userInfo) {
- uni.request({
- url: baseUrlNew + '/roleMenu/query/getListByUserId',
- data: {
- userId: userInfo.id ? userInfo.id : userInfo.data.id
- },
- method: 'GET',
- success: (res) => {
- if (res.statusCode === 200) {
- uni.setStorageSync("jurisdiction", res.data.data)
- let list = getUserAllRoles(res.data.data);
- uni.setStorageSync("rolesList", list)
- }
- }
- })
- }
- }
- const getUserAllRoles = (item) => {
- console.log(item)
- for (let i = 0; i < item.length; i++) {
- rolesList.push(item[i].name)
- // console.log('用户权限',rolesList)
- if (item[i].children && item[i].children.length > 0) {
- getUserAllRoles(item[i].children)
- }
- }
- return rolesList;
- }
- const setAudit = (item) => {
- let _list = uni.getStorageSync("copyTaskInfo")
- let _isShowbtn = true
- if (_list.length == 0) {
- _isShowbtn = false
- }
- for (let i = 0; i < _list.length; i++) {
- if (_list[i].businessId == item.id) {
- _list.splice(i, 1)
- uni.setStorageSync("copyTaskInfo", _list)
- }
- }
- if (_list.length > 0) {
- uni.navigateTo({
- url: _list[0].itemUrl + '&isShowbtn=' + _isShowbtn,
- })
- }
- console.log(item)
- }
- const contactCustomerService = (item) => {
- console.log(item)
- if(!item){
- item='110'
- }
- console.log("联系客服")
- uni.makePhoneCall({
- phoneNumber: item
- });
- }
- // 获取市、区简称
- const filterUrban = (s) => {
- return s.substring(0,s.length-1)
- }
- const filterArea = (q) => {
- return q.substring(0,q.length-1)
- }
- //获取省份简称
- const getProvinceAbbreviation = (province) => {
- if(province == "北京市"||province == "北京")
- return "京";
- else if(province == "天津市"||province == "天津")
- return "津";
- else if(province == "重庆市"||province == "重庆")
- return "渝";
- else if(province == "上海市"||province == "上海")
- return "沪";
- else if(province == "河北省"||province == "河北")
- return "冀";
- else if(province == "山西省"||province == "山西")
- return "晋";
- else if(province == "辽宁省"||province == "辽宁")
- return "辽";
- else if(province == "吉林省"||province == "吉林")
- return "吉";
- else if(province == "黑龙江省"||province == "黑龙江")
- return "黑";
- else if(province == "江苏省"||province == "江苏")
- return "苏";
- else if(province == "浙江省"||province == "浙江")
- return "浙";
- else if(province == "安徽省"||province == "安徽")
- return "皖";
- else if(province == "福建省"||province == "福建")
- return "闽";
- else if(province == "江西省"||province == "江西")
- return "赣";
- else if(province == "山东省"||province == "山东")
- return "鲁";
- else if(province == "河南省"||province == "河南")
- return "豫";
- else if(province == "湖北省"||province == "湖北")
- return "鄂";
- else if(province == "湖南省"||province == "湖南")
- return "湘";
- else if(province == "广东省"||province == "广东")
- return "粤";
- else if(province == "海南省"||province == "海南")
- return "琼";
- else if(province == "四川省"||province == "四川")
- return "川";
- else if(province == "贵州省"||province == "贵州")
- return "贵";
- else if(province == "云南省"||province == "云南")
- return "云";
- else if(province == "陕西省"||province == "陕西")
- return "陕";
- else if(province == "甘肃省"||province == "甘肃")
- return "甘";
- else if(province == "青海省"||province == "青海")
- return "青";
- else if(province == "台湾省"||province == "台湾")
- return "台";
- else if(province == "内蒙古自治区"||province == "内蒙古")
- return "蒙";
- else if(province == "广西壮族自治区"||province == "广西")
- return "桂";
- else if(province == "宁夏回族自治区"||province == "宁夏")
- return "宁";
- else if(province == "新疆维吾尔自治区"||province == "新疆")
- return "新";
- else if(province == "西藏自治区"||province == "西藏")
- return "藏";
- else if(province == "香港特别行政区"||province == "香港")
- return "港";
- else if(province == "澳门特别行政区"||province == "澳门")
- return "澳";
-
- }
- export default {
- getListByUserId,
- setAudit,
- ossUploadUrl,
- contactCustomerService,
- chooseImage,
- imgType,
- imgTypeList,
- makeValidityPeriod,
- getProvinceAbbreviation,
- filterUrban,
- filterArea,
- fUN_AmapLocation
- }
|