<template>
    <view class="body">
        <view class="date">
            <picker @change="datePickerBindchange" class="pickerdate" end="2999-12-12" mode="date" :start="starttimes">
                {{ xin }}
            </picker>
            <text class="fc99 candt">{{ date }}</text>
        </view>
        <view class="good">
            <view class="title">
                <text>宜</text>
            </view>
            <view class="content">
                <view class="content-max" v-for="(item, index) in goodlists" :key="index">
                    <view class="content-name">{{ item.name }}</view>

                    <view class="content-txt">{{ item.good }}</view>
                </view>
            </view>
        </view>
        <view class="split">
            <view class="title">
                <text>忌</text>
            </view>
            <view class="content">
                <view class="content-max" v-for="(item, index) in splitlists" :key="index">
                    <view class="content-name">{{ item.name }}</view>

                    <view class="content-txt">{{ item.bad }}</view>
                </view>
            </view>
        </view>
        <view class="shupai">
            <text class="strongtxt">座位朝向：</text>
            <text>面向</text>
            <text class="direction">{{ direction }}</text>
            <text>写程序，BUG 最少。</text>
        </view>
        <view class="shupai">
            <text class="strongtxt">今日宜饮：</text>
            <text>{{ drinks }}</text>
        </view>
        <view class="shupai">
            <text class="strongtxt">女神亲近指数：</text>
            <text class="start">{{ stars }}</text>
        </view>
    </view>
</template>

<script>
var e = require('../../utils/u1.js');
var t = e.drinks;
var a = e.directions;
getApp();
function n(e) {
    var t;
    switch (e) {
        case 1:
            t = '星期一';
            break;
        case 2:
            t = '星期二';
            break;
        case 3:
            t = '星期三';
            break;
        case 4:
            t = '星期四';
            break;
        case 5:
            t = '星期五';
            break;
        case 6:
            t = '星期六';
            break;
        case 0:
            t = '星期日';
    }
    return t;
}
function r(e) {
    for (var t = '', a = 0; a < e; ) {
        t += '★';
        a++;
    }
    for (; a < 5; ) {
        t += '☆';
        a++;
    }
    return t;
}
function i(e, t) {
    for (var a = e % 11117, n = 0; n < 100 + t; n++) {
        a *= a;
        a %= 11117;
    }
    return a;
}
export default {
    data() {
        return {
            xin: '☰',
            date: '',
            starttimes: '',
            drinks: '',
            direction: '',
            stars: '',
            goodlists: '',
            splitlists: ''
        };
    },
    onLoad: function () {
        var e = new Date();
        var s = 10000 * e.getFullYear() + 100 * (e.getMonth() + 1) + e.getDate();
        var o = n(e.getUTCDay());
        var u = e.getFullYear();
        var c = e.getMonth() + 1;
        var d = e.getDate();
		this.date='今天是' + u + '年' + c + '月' + d + '日  ' + o;
		this.starttimes=u + '-' + c + '-' + d;
		this.drinks=l(s, t, 2);
		this.direction=a[i(s, 2) % a.length];
		this.stars=r((i(s, 6) % 5) + 1);
		this.goodlists=g(e, s, 1);
		this.splitlists= g(e, s, 0);
    },
    onShareAppMessage: function () {
        return {
            title: '程序员老黄历',
            desc: '程序员老黄历!',
            path: 'pages/index/index'
        };
    },
    methods: {
        datePickerBindchange: function (e) {
            var s = new Date(e.detail.value);
            var o = n(s.getUTCDay());
            var u = s.getFullYear();
            var c = s.getMonth() + 1;
            var d = s.getDate();
            var f = 10000 * s.getFullYear() + 100 * (s.getMonth() + 1) + s.getDate();
          
			this.date=u + '年' + c + '月' + d + '日  ' + o;
			this.starttimes=u + '-' + c + '-' + d;
			this.drinks=l(f, t, 2);
			this.direction=a[i(f, 2) % a.length];
			this.stars=r((i(f, 6) % 5) + 1);
			this.goodlists=g(s, f, 1);
			this.splitlists=g(s, f, 0);
          
			
			
        }
    }
};
var s = e.activities;
var o = e.tools;
var u = e.varNames;
function g(e, t, a) {
    for (
        var n = [],
            r = [],
            o = (function (e, t) {
                var a = [];
                if (
                    (function (e) {
                        return 0 == e.getUTCDay() || 6 == e.getUTCDay();
                    })(e)
                ) {
                    for (var n = 0; n < t.length; n++) {
                        if (t[n].weekend) {
                            a.push(t[n]);
                        }
                    }
                    return a;
                }
                return t;
            })(e, s),
            u = (i(t, 98) % 3) + 2,
            g = (i(t, 87) % 3) + 2,
            d = (function (e, t, a) {
                for (var n = l(e, t, a), r = 0; r < n.length; r++) {
                    n[r] = c(e, n[r]);
                }
                return n;
            })(t, o, u + g),
            f = 0;
        f < u;
        f++
    ) {
        n.push(d[f]);
    }
    for (f = 0; f < g; f++) {
        r.push(d[u + f]);
    }
    return 1 == a ? n : 0 == a ? r : void 0;
}
function l(e, t, a) {
    for (var n = [], r = 0; r < t.length; r++) {
        n.push(t[r]);
    }
    for (var s = 0; s < t.length - a; s++) {
        var o = i(e, s) % n.length;
        n.splice(o, 1);
    }
    return n;
}
function c(e, t) {
    var a = {
        name: t.name,
        good: t.good,
        bad: t.bad
    };
    if (-1 != a.name.indexOf('%v')) {
        a.name = a.name.replace('%v', u[i(e, 12) % u.length]);
    }
    if (-1 != a.name.indexOf('%t')) {
        a.name = a.name.replace('%t', o[i(e, 11) % o.length]);
    }
    if (-1 != a.name.indexOf('%l')) {
        a.name = a.name.replace('%l', ((i(e, 12) % 247) + 30).toString());
    }
    return a;
}
</script>
<style>
@import './index.css';
</style>
