zhao_js
2024-01-03 4b251816b75d1ba5423f41370b9e43bed4493f90
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<template>
    <view class="container" style="height: auto;">
        <view style="margin: 0.5rem;">
            <button @click="toTab(1)" class="mini-btn" style="margin-right: 10px;" type="default" size="mini">素材下载</button>
            <button @click="toTab(2)" class="mini-btn" style="margin-right: 10px;" type="default" size="mini">短信审核</button>
            <button class="mini-btn" style="background-color: cornflowerblue;" type="primary" size="mini">微信朋友圈</button>
        </view>
        <view style="display: flex;justify-content: center; flex-direction: column; /">
            <view>
             <textarea maxlength="492" v-model="content" class="smstxt" placeholder="请输入朋友圈文案"
                    placeholder-class="text-color-assist font-size-base"></textarea> 
                        
            </view>
            <view>
                <textarea maxlength="492" v-model="commnet" class="smstxt" placeholder="请输入评论(非必填)"
                    placeholder-class="text-color-assist font-size-base"></textarea>
            </view>
            <view>
                <cl-upload action="/api/automanage/uploadpublicfile" @onSuccess="onSuccess" v-model="list" :listStyle="{
                        columns: 2,
                        columnGap: '20rpx',
                        rowGap:'20rpx',
                        padding:'10rpx',
                        height:'300rpx',
                        radius:'20rpx'
                    }">
                    <template v-slot:addImg>
                        <view class="newAddImg">
                            <view>+</view>
                            <text>添加</text>
                        </view>
                    </template>
                </cl-upload>
            </view>
        </view>
        <view style="text-align: center;margin-top: 3rem;">
            <button @click="addSet()"
                style="width: 10rem;height: 3rem; line-height: 3rem; font-size: 20px; color: #fff; background: green;"
                class="mini-btn" type="default" size="mini">提交</button>
        </view>
    </view>
</template>
 
<script>
    import comUtils from '@/utils/ComUtils.js'
    export default {
        data() {
            return {
                content: '',
                list: [],
                commnet: ''
            }
        },
        onLoad(option) {
            this.checkId();
        },
 
        methods: {
            //检查白名单
            checkId() {
                var openId = uni.getStorageSync('smsopenid');
                var whiteid = comUtils.getAllowdId(status);
                if (openId == "" || whiteid.indexOf(openId) < 0) {
                    uni.reLaunch({
                        url: '/pages/emptypage/nopermissions'
                    })
                }
            },
            onSuccess(reslut) {
                // 把服务端返回的图片地址添加到list中与组件数据同步
                this.list.push(reslut.result)
            },
            addSet() {
                var param = {
                    Content: this.content,
                    PicList: this.list,
                    Commnet: this.commnet
                }
                var that=this;
                that.$http.post('/api/AutoManage/AddPyq', param).then(e => {
                    uni.hideLoading();
                    if (e.result) {
                        uni.showToast({
                            title: '操作成功!',
                            icon: 'none'
                        });
                        that.content='';
                        that.list=[];
                        that.commnet='';
                    } else {
                        uni.showToast({
                            title: '操作失败!',
                            icon: 'none'
                        });
                    }
                }).catch(function(err) {
                    uni.hideLoading()
                    console.log(err);
                })
            },
            toTab(tabtype) {
                var url = '';
                switch (tabtype) {
                    case 1:
                        url = '/pages/ad_page/product_sc';
                        break;
                    case 2:
                        url = '/pages/ad_page/sms_examine';
                        break;
                    case 3:
                        url = '/pages/ad_page/wx_pyqset';
                        break;
                }
                uni.navigateTo({
                    url: url
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    page {
        background: #fff;
        height: 100%;
    }
 
    .smstxt {
        width: 90%;
        margin-top: 2rem;
        border: 1px solid;
    }
 
    .newAddImg {
        width: 8rem;
        border: 1px solid;
        height: 8rem;
        display: flex;
        justify-content: center;
        flex-direction: column;
        text-align: center;
    }
</style>