123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- 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 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)
- console.log("联系客服")
- uni.makePhoneCall({
- phoneNumber: '114' //仅为示例
- });
- }
- export default {
- getListByUserId,
- setAudit,
- ossUploadUrl,
- contactCustomerService,
- chooseImage,
- imgType,
- imgTypeList,
- makeValidityPeriod
- }
|