Blame view

common/minxins.js 1.22 KB
c7add6cf   “wangming”   初始版本开发完毕
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  import BASE_URL from '@/common/config.js'

  import utils from '@/service/utils.js'

  export default {

  	data() {

  		return {

  			BASE_URL,

  			userInfo: {},

  			list: [],

  			queryModel: {

  				currentPage: 1,

  				pageSize: 20,

  			},

  		}

  	},

  	filters: {

  		dateTimeFilter(val) {

  			return utils.formatTime(val);

  		},

  		imageUrlFilter(val) {

  			return BASE_URL + val;

  		},

  		probleTypeFilter(val) {

  			let types = [{

  				value: 1,

  				text: '心理求助'

  			}, {

  				value: 2,

  				text: '内容二'

  			}];

  			try{

  				return types.find(t=>t.value == val).text;

  			}catch(e){

  				return '';

  				//TODO handle the exception

  			}	

  		},

  		replyTypeFilter(val) {

  			let types = [{

  				value: 1,

  				text: '线上'

  			}, {

  				value: 2,

  				text: '线下'

  			}];

  			try{

  				return types.find(t=>t.value == val).text;

  			}catch(e){

  				return '';

  				//TODO handle the exception

  			}	

  		},

  	},

  	created() {

  		//this.getUserInfo();

  		let user = uni.getStorageSync('userinfo');

  		this.userInfo = user;

  	},

  	methods: {

  		//获取用户信息

  		getUserInfo() {

  			this.API.getCurrentUserInfo().then(res => {

  				this.userInfo = res.data;

  				uni.setStorageSync('userinfo', res.data);

  			})

  		},

  	},

  }