Commit 4ae6e627 by 梁建民

js

parent b41ec423
// pages/person/addcertification/index.js const http = require('../../../../utils/util.js');
import {
chooseImg
} from '../../../../utils/util.js';
import {
apis
} from '../../../../utils/api.js';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
status:false, status: true,
items: [ nameText: '公司名称',
{name: 'auth_type', value: '企业', checked: 'true'}, companyType: ['贸易商', '代理商', '原厂', '制造商'],
{name: 'auth_type', value: '个人'} companyTypeText: '请选择经营性质',
placeholderText: '请输入公司名称',
imgSrc: '',
items: [{
name: '企业',
value: 2,
checked: 'true'
},
{
name: '个人',
value: 1
}
] ]
}, },
...@@ -66,5 +84,75 @@ Page({ ...@@ -66,5 +84,75 @@ Page({
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {
},
/**
* 认证类型
*/
radioChange: function (e) {
if (e.detail.value) {
if (e.detail.value == 1) {
this.setData({
nameText: "个人名称",
placeholderText: '请输入个人名称'
});
} else if (e.detail.value == 2) {
this.setData({
nameText: "公司名称",
placeholderText: '请输入公司名称'
});
}
}
},
/**
* 上传资料
*/
uploadImg: function () {
chooseImg(apis.ossupload, 1, (res) => {
if (res) {
this.setData({
imgSrc: res,
status: false
});
}
});
},
/**
* 删除资料
*/
deleteImg: function () {
this.setData({
imgSrc: '',
status: true
})
},
/**
* 认证提交
*/
formSubmit: function (e) {
let company_type=e.detail.value.company_type * 1 +1;
let params = Object.assign({}, e.detail.value, {
company_type:company_type,
auth_img: this.data.imgSrc
});
http.getData(apis.addAuth, 'GET', params, (res) => {
},false,false,true);
},
/**
*
* 经营性质
*/
bindPickerChange: function (e) {
this.setData({
index: e.detail.value,
companyTypeText: this.data.companyType[e.detail.value]
})
} }
}) })
\ No newline at end of file
...@@ -8,52 +8,56 @@ ...@@ -8,52 +8,56 @@
<text class="icon iconfont iconiconxiantiaoshouji13"></text> <text class="icon iconfont iconiconxiantiaoshouji13"></text>
</view> </view>
</view> </view>
<view class="item boxsiz row verCenter bothSide"> <form bindsubmit="formSubmit">
<view> <view class="item boxsiz row verCenter bothSide">
<text class="t1">认证类型</text> <view>
</view> <text class="t1">认证类型</text>
<view> </view>
<radio-group class="radio-group" bindchange="radioChange"> <view>
<label class="radio-wrap" wx:for="{{items}}"> <radio-group class="radio-group" bindchange="radioChange" name="auth_type">
<radio value="{{item.name}}" checked="{{item.checked}}" class="radio-text" /> <label class="radio-wrap" wx:for="{{items}}">
<text class="va-m">{{item.value}}</text> <radio value="{{item.value}}" checked="{{item.checked}}" class="radio-text" />
</label> <text class="va-m">{{item.name}}</text>
</radio-group> </label>
</view> </radio-group>
</view> </view>
<view class="hr"></view>
<view class="item boxsiz row verCenter bothSide">
<view class="flex-a">
<text class="t1">公司名称</text>
</view>
<view class="flex-b">
<input placeholder="请输入公司名称" placeholder-class="placeholderClass" name="company_name" data-type="1" bindinput='bindinputFn' class="inp"></input>
</view>
</view>
<view class="hr"></view>
<view class="item boxsiz row verCenter bothSide bor">
<view>
<text class="t1">经营性质</text>
</view> </view>
<view> <view class="hr"></view>
<text class="t2">请选择经营性质</text> <view class="item boxsiz row verCenter bothSide">
<text class="icon iconfont iconChevron"></text> <view class="flex-a">
<text class="t1">{{nameText}}</text>
</view>
<view class="flex-b">
<input placeholder="{{placeholderText}}" placeholder-class="placeholderClass" name="company_name" data-type="1" bindinput='bindinputFn' class="inp"></input>
</view>
</view> </view>
</view> <view class="hr"></view>
<view class="upload-box column rowCenter verCenter"> <view class="item boxsiz row verCenter bothSide bor">
<block wx:if="{{status}}"> <view>
<view class="add column rowCenter verCenter"> <text class="t1">经营性质</text>
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text class="t1">上传资料</text>
</view> </view>
</block> <view>
<block wx:else> <picker bindchange="bindPickerChange" value="{{index}}" range="{{companyType}}" name="company_type">
<view class="view column rowCenter verCenter"> <text class="t2">{{companyTypeText}}</text>
<cover-image src="/res/images/imgs/test.jpg " class="img"></cover-image> <text class="icon iconfont iconChevron"></text>
<text class="icon iconfont iconiconxiantiaoshouji7"></text> </picker>
</view> </view>
</block> </view>
<text class="txt">请上传名片/工作,任意材料,证明您的身份信息</text> <view class="upload-box column rowCenter verCenter">
</view> <block wx:if="{{status}}">
<button class="btn">提交认证</button> <view class="add column rowCenter verCenter" bindtap="uploadImg">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text class="t1">上传资料</text>
</view>
</block>
<block wx:else>
<view class="view column rowCenter verCenter">
<cover-image src="{{imgSrc}}" class="img"></cover-image>
<text class="icon iconfont iconiconxiantiaoshouji7" bind:tap="deleteImg"></text>
</view>
</block>
<text class="txt">请上传名片/工作,任意材料,证明您的身份信息</text>
</view>
<button class="btn" form-type="submit">提交认证</button>
</form>
</view> </view>
\ No newline at end of file
...@@ -48,12 +48,13 @@ ...@@ -48,12 +48,13 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 11, "current": 5,
"list": [ "list": [
{ {
"id": -1, "id": -1,
"name": "pages/form/xj/index", "name": "pages/form/xj/index",
"pathName": "pages/form/xj/index", "pathName": "pages/form/xj/index",
"query": "",
"scene": null "scene": null
}, },
{ {
...@@ -83,6 +84,12 @@ ...@@ -83,6 +84,12 @@
"pathName": "pages/person/certification/certificationmanage/index", "pathName": "pages/person/certification/certificationmanage/index",
"query": "", "query": "",
"scene": null "scene": null
},
{
"id": -1,
"name": "pages/person/auth/index",
"pathName": "pages/person/auth/index",
"scene": null
} }
] ]
} }
......
//数据请求(get,post) //数据请求(get,post)
const getData = (url, type, param, callBack, loading, isheader) => { const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx.showNavigationBarLoading(); wx.showNavigationBarLoading();
var token, header; var token, header;
...@@ -7,10 +7,17 @@ const getData = (url, type, param, callBack, loading, isheader) => { ...@@ -7,10 +7,17 @@ const getData = (url, type, param, callBack, loading, isheader) => {
//获取token //获取token
token = wx.getStorageSync('access_token'); token = wx.getStorageSync('access_token');
//参数字段追加来源字段 //参数字段追加来源字段,token字段
var params = Object.assign({}, param, { if (istoken) {
source: 1 var params = Object.assign({}, param, {
}); source: 1,
token:token
});
} else {
var params = Object.assign({}, param, {
source: 1
});
}
//是否启用loading加载效果 //是否启用loading加载效果
if (loading) { if (loading) {
...@@ -94,11 +101,6 @@ const uploadFile = (url, paths, callBack) => { ...@@ -94,11 +101,6 @@ const uploadFile = (url, paths, callBack) => {
success: (res) => { success: (res) => {
var data = JSON.parse(res.data); var data = JSON.parse(res.data);
if (data.errcode == 103200) { if (data.errcode == 103200) {
wx.showToast({
title: '上传成功',
icon: 'none',
duration: 2000
});
callBack(data.data[0]) callBack(data.data[0])
} else { } else {
wx.showToast({ wx.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment