|
|
@@ -9,7 +9,7 @@
|
|
|
|
|
|
<view class="info-box">
|
|
|
<view class="info-value-box">
|
|
|
- <input type="text" placeholder="请输入活动标题" name="selfName">
|
|
|
+ <input type="text" placeholder="请输入活动标题" v-model="activeName">
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="info-box">
|
|
|
@@ -18,7 +18,7 @@
|
|
|
<text>选择活动类型</text>
|
|
|
</view>
|
|
|
<view class="info-value-box">
|
|
|
- <picker @change="bindPickerChange($event,'education')" :range="activeType" class="select-box" name="education" disabled="true">
|
|
|
+ <picker @change="bindPickerChange($event,'activeType')" :range="activeType" class="select-box">
|
|
|
<view class="uni-input">{{activeValue}}</view>
|
|
|
<image src="/static/arrow_down.svg" mode="aspectFill"></image>
|
|
|
</picker>
|
|
|
@@ -33,26 +33,46 @@
|
|
|
<uni-datetime-picker
|
|
|
class="time-select-box"
|
|
|
type="date"
|
|
|
- :value="single"
|
|
|
+ :value="activeDate"
|
|
|
@change="change"
|
|
|
:clear-icon="false"
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="info-box">
|
|
|
+ <view class="info-box" v-if="leaderAuth == '1'">
|
|
|
+ <view class="info-title-box">
|
|
|
+ <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
|
|
|
+ <text>可见范围</text>
|
|
|
+ </view>
|
|
|
+ <view class="info-value-box">
|
|
|
+ <picker @change="bindPickerChange($event,'range')" :range="rangeList" class="select-box">
|
|
|
+ <view class="uni-input">{{rangeValue}}</view>
|
|
|
+ <image src="/static/arrow_down.svg" mode="aspectFill"></image>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="info-box" v-if="orgList.length">
|
|
|
<view class="info-title-box">
|
|
|
<!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
|
|
|
- <text>设置可见范围</text>
|
|
|
+ <text>下级支部/组织可见</text>
|
|
|
</view>
|
|
|
- <view style="margin-top: 2%;">
|
|
|
- <checkbox-group @change="checkboxChange" class="display-wrap">
|
|
|
- <label class="display-flex-start check-class" v-for="(item,index) in memberList" :key="item.value">
|
|
|
- <view>
|
|
|
- <checkbox :value="item.value" :checked="item.checked"/>
|
|
|
- </view>
|
|
|
- <view>{{item.name}}</view>
|
|
|
- </label>
|
|
|
- </checkbox-group>
|
|
|
+ <view class="info-value-box">
|
|
|
+ <picker @change="bindPickerChange($event,'org')" :range="orgList" :range-key="'name'" class="select-box">
|
|
|
+ <view class="uni-input">{{orgValue}}</view>
|
|
|
+ <image src="/static/arrow_down.svg" mode="aspectFill"></image>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="info-box" v-if="orgList.length">
|
|
|
+ <view class="info-title-box">
|
|
|
+ <!-- <image src="/static/require-icon.png" mode="aspectFill"></image> -->
|
|
|
+ <text>下级支部/组织可见范围</text>
|
|
|
+ </view>
|
|
|
+ <view class="info-value-box">
|
|
|
+ <picker @change="bindPickerChange($event,'orgRange')" :range="orgRangeList" class="select-box">
|
|
|
+ <view class="uni-input">{{orgRangeValue}}</view>
|
|
|
+ <image src="/static/arrow_down.svg" mode="aspectFill"></image>
|
|
|
+ </picker>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="info-box">
|
|
|
@@ -80,8 +100,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="footer-box">
|
|
|
- <button type="primary" class="submit-bth" style="background-color: #aaaaaa;" @click="goStep()">上一步</button>
|
|
|
- <button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="goStep()">提交</button>
|
|
|
+ <button type="primary" class="submit-bth" style="background-color: #aaaaaa;" @click="goStepBack()">上一步</button>
|
|
|
+ <button type="primary" class="submit-bth" style="background-color: #169bd5;" @click="submitActive()">提交</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -96,8 +116,23 @@
|
|
|
data() {
|
|
|
return {
|
|
|
isAuthPhone:getApp().globalData.user_phone,
|
|
|
+ leaderAuth:'0',
|
|
|
+ activeName:'',
|
|
|
+ activeDate:'',
|
|
|
activeValue:'请选择',
|
|
|
activeType:['组织建设','参政议政','学习培训','社会活动','其他'],
|
|
|
+ rangeList:['全体成员可见','仅管理团队可见'],
|
|
|
+ rangeValue:'全体成员可见',
|
|
|
+ orgList:[],
|
|
|
+ orgValue:'',
|
|
|
+ orgId:'',
|
|
|
+ orgRangeList:['全体成员可见','仅管理团队可见'],
|
|
|
+ orgRangeValue:'全体成员可见',
|
|
|
+ branchId:'',
|
|
|
+ branchValue:'',
|
|
|
+ imgIdList: [],
|
|
|
+ uploadList:[],
|
|
|
+ lastPageLength:'',
|
|
|
memberList: [
|
|
|
{
|
|
|
value: 'CHN',
|
|
|
@@ -119,8 +154,12 @@
|
|
|
],
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- //this.getTradeRequest();
|
|
|
+ onLoad(option) {
|
|
|
+ let branchList = JSON.parse(option.list);
|
|
|
+ this.lastPageLength = option.length;
|
|
|
+ this.branchValue = branchList[0].name;
|
|
|
+ this.branchId = Number(branchList[0].id);
|
|
|
+ this.getPowerRequest(this.branchId);
|
|
|
},
|
|
|
onShow() {
|
|
|
},
|
|
|
@@ -133,57 +172,86 @@
|
|
|
methods: {
|
|
|
bindDateChange(e){
|
|
|
this.dateYear = e.target.value
|
|
|
-
|
|
|
},
|
|
|
bindDateMonthChange(e){
|
|
|
this.dateMonth = this.arrayMonth[e.target.value]
|
|
|
},
|
|
|
change(e) {
|
|
|
- this.single = e;
|
|
|
+ this.activeDate = e;
|
|
|
console.log("-change事件:", e);
|
|
|
},
|
|
|
- goStep(){
|
|
|
- uni.navigateTo({
|
|
|
- url:'./create2'
|
|
|
- })
|
|
|
+ goStepBack(){
|
|
|
+ uni.navigateBack({
|
|
|
+ })
|
|
|
},
|
|
|
bindPickerChange(e,type) {
|
|
|
- let that = this;
|
|
|
- switch (type){
|
|
|
- case 'education':
|
|
|
- that.educationValue = that.educationArray[e.target.value]
|
|
|
- console.log(that.educationValue)
|
|
|
- break;
|
|
|
- case 'profession':
|
|
|
- that.professionValue = that.professionArray[e.target.value]
|
|
|
- break;
|
|
|
- case 'ends':
|
|
|
- that.endsValue = that.endsArray[e.target.value]
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- submitRequest(params){
|
|
|
- console.log(params)
|
|
|
- let that = this;
|
|
|
- },
|
|
|
+ let that = this;
|
|
|
+ switch (type){
|
|
|
+ case 'activeType':
|
|
|
+ that.activeValue = that.activeType[e.target.value]
|
|
|
+ break;
|
|
|
+ case 'range':
|
|
|
+ that.rangeValue = that.rangeList[e.target.value]
|
|
|
+ break;
|
|
|
+ case 'org':
|
|
|
+ that.orgValue = that.orgList[e.target.value].name;
|
|
|
+ that.orgId = that.orgList[e.target.value].value;
|
|
|
+ break;
|
|
|
+ case 'orgRange':
|
|
|
+ that.orgRangeValue = that.orgRangeList[e.target.value]
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPowerRequest(bId){
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +"activity" + "×tamp=" + getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" + getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url = getApp().globalData.shareUrl +"api/api.php" +
|
|
|
+ "?method=activity&action=branch_auth×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ openid:getApp().globalData.open_id,
|
|
|
+ branch_id:bId
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ console.log(res.data)
|
|
|
+ this.leaderAuth = res.data.data.leader_auth;
|
|
|
+ this.orgList = res.data.data.post_branch_level;
|
|
|
+ console.log(this.orgList)
|
|
|
+ if(this.orgList.length){
|
|
|
+ this.orgValue = this.orgList[0].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
getImage(type) {
|
|
|
let that = this;
|
|
|
- // if (that.uploadList.length >= 9) {
|
|
|
- // uni.showToast({
|
|
|
- // title: "最多上传9张图片",
|
|
|
- // icon: "none",
|
|
|
- // duration: 2500,
|
|
|
- // });
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ if (that.uploadList.length >= 9) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "最多上传9张图片",
|
|
|
+ icon: "none",
|
|
|
+ duration: 2500,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
uni.chooseImage({
|
|
|
sourceType: [type],
|
|
|
- count: 1,
|
|
|
+ count: 9 - that.uploadList.length,
|
|
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
|
|
success: (res) => {
|
|
|
for (let i = 0; i < res.tempFilePaths.length; i++) {
|
|
|
- console.log(res.tempFilePaths[i])
|
|
|
that.uploadList.push(res.tempFilePaths[i]);
|
|
|
that.uploadFileRequest(res.tempFilePaths[i]);
|
|
|
}
|
|
|
@@ -197,30 +265,22 @@
|
|
|
});
|
|
|
let that = this;
|
|
|
let md5Sign = md5(
|
|
|
- "method=" +
|
|
|
- "upload" +
|
|
|
- "×tamp=" +
|
|
|
- getApp().globalData.globalTimestamp +
|
|
|
- "&secret=" +
|
|
|
- getApp().globalData.secret
|
|
|
+ "method="+"activity_upload" +"×tamp=" + getApp().globalData.globalTimestamp + "&secret=" +getApp().globalData.secret
|
|
|
);
|
|
|
- let url =
|
|
|
- getApp().globalData.shareUrl +
|
|
|
- "api/api.php" +
|
|
|
- "?method=upload&source=activity&id=1×tamp=" +
|
|
|
- getApp().globalData.globalTimestamp +
|
|
|
- "&sign=" +
|
|
|
- md5Sign;
|
|
|
+ let url = getApp().globalData.shareUrl + "api/api.php" +"?method=activity_upload×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp +"&sign=" + md5Sign;
|
|
|
uni.uploadFile({
|
|
|
url: url, //需要设置为全局
|
|
|
filePath: fileVal,
|
|
|
name: "file",
|
|
|
formData: {
|
|
|
+ openid: getApp().globalData.open_id,
|
|
|
file: fileVal,
|
|
|
+ branch_id:this.branchId
|
|
|
},
|
|
|
success: (res) => {
|
|
|
let tmpres = JSON.parse(res.data);
|
|
|
- console.log(tmpres);
|
|
|
+ console.log(tmpres)
|
|
|
uni.hideLoading();
|
|
|
that.imgIdList.push(tmpres.data.id);
|
|
|
},
|
|
|
@@ -246,6 +306,63 @@
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ submitActive(){
|
|
|
+ let typeObj = {
|
|
|
+ '组织建设':'1',
|
|
|
+ '参政议政':'2',
|
|
|
+ '社会活动':'3',
|
|
|
+ '学习培训':'4',
|
|
|
+ // '其他':'99',
|
|
|
+ }
|
|
|
+ let rangeObj = {
|
|
|
+ '全体成员可见':'0',
|
|
|
+ '仅管理团队可见':'1',
|
|
|
+ }
|
|
|
+ let md5Sign = md5(
|
|
|
+ "method=" +"activity" + "×tamp=" + getApp().globalData.globalTimestamp +
|
|
|
+ "&secret=" + getApp().globalData.secret
|
|
|
+ );
|
|
|
+ let url = getApp().globalData.shareUrl +"api/api.php" +
|
|
|
+ "?method=activity&action=add×tamp=" +
|
|
|
+ getApp().globalData.globalTimestamp + "&sign=" + md5Sign;
|
|
|
+ uni.request({
|
|
|
+ url: url,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ openid:getApp().globalData.open_id,
|
|
|
+ name:this.activeName,
|
|
|
+ type:typeObj[this.activeValue], //1.组织建设;2.参政议政;3.社会活动;4.学习培训;99.其他
|
|
|
+ start_time:this.activeDate, //开始日期
|
|
|
+ branch_id:this.branchId, //支部ID
|
|
|
+ leader_only:rangeObj[this.rangeValue], //可见范围: 0,都可见;1, 仅管理层可见
|
|
|
+ post_branch_level:this.orgId || '0', //下级支部可见层级
|
|
|
+ post_leader_only:rangeObj[this.orgRangeValue], //下级支部可见范围: 0,都可见;1,仅管理层可见
|
|
|
+ attach_ids:this.imgIdList.join(), //活动通知附件ids,以逗号分隔 可没有
|
|
|
+ remark:'' //备注
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "添加成功",
|
|
|
+ icon: "none",
|
|
|
+ duration: 2500,
|
|
|
+ });
|
|
|
+ setTimeout(()=>{
|
|
|
+ if(this.lastPageLength == 1){
|
|
|
+ uni.navigateBack({delta:1})
|
|
|
+ }else{
|
|
|
+ uni.navigateBack({delta:2})
|
|
|
+ }
|
|
|
+ },800)
|
|
|
+ }},
|
|
|
+ fail: () => {
|
|
|
+ console.log("连接失败");
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|