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({
/**
* 页面的初始数据
*/
data: {
status:false,
items: [
{name: 'auth_type', value: '企业', checked: 'true'},
{name: 'auth_type', value: '个人'}
status: true,
nameText: '公司名称',
companyType: ['贸易商', '代理商', '原厂', '制造商'],
companyTypeText: '请选择经营性质',
placeholderText: '请输入公司名称',
imgSrc: '',
items: [{
name: '企业',
value: 2,
checked: 'true'
},
{
name: '个人',
value: 1
}
]
},
......@@ -66,5 +84,75 @@ Page({
*/
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 @@
<text class="icon iconfont iconiconxiantiaoshouji13"></text>
</view>
</view>
<view class="item boxsiz row verCenter bothSide">
<view>
<text class="t1">认证类型</text>
</view>
<view>
<radio-group class="radio-group" bindchange="radioChange">
<label class="radio-wrap" wx:for="{{items}}">
<radio value="{{item.name}}" checked="{{item.checked}}" class="radio-text" />
<text class="va-m">{{item.value}}</text>
</label>
</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>
<form bindsubmit="formSubmit">
<view class="item boxsiz row verCenter bothSide">
<view>
<text class="t1">认证类型</text>
</view>
<view>
<radio-group class="radio-group" bindchange="radioChange" name="auth_type">
<label class="radio-wrap" wx:for="{{items}}">
<radio value="{{item.value}}" checked="{{item.checked}}" class="radio-text" />
<text class="va-m">{{item.name}}</text>
</label>
</radio-group>
</view>
</view>
<view>
<text class="t2">请选择经营性质</text>
<text class="icon iconfont iconChevron"></text>
<view class="hr"></view>
<view class="item boxsiz row verCenter bothSide">
<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 class="upload-box column rowCenter verCenter">
<block wx:if="{{status}}">
<view class="add column rowCenter verCenter">
<text class="icon iconfont iconiconxiantiaoshouji15"></text>
<text class="t1">上传资料</text>
<view class="hr"></view>
<view class="item boxsiz row verCenter bothSide bor">
<view>
<text class="t1">经营性质</text>
</view>
</block>
<block wx:else>
<view class="view column rowCenter verCenter">
<cover-image src="/res/images/imgs/test.jpg " class="img"></cover-image>
<text class="icon iconfont iconiconxiantiaoshouji7"></text>
<view>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{companyType}}" name="company_type">
<text class="t2">{{companyTypeText}}</text>
<text class="icon iconfont iconChevron"></text>
</picker>
</view>
</block>
<text class="txt">请上传名片/工作,任意材料,证明您的身份信息</text>
</view>
<button class="btn">提交认证</button>
</view>
<view class="upload-box column rowCenter verCenter">
<block wx:if="{{status}}">
<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>
\ No newline at end of file
......@@ -48,12 +48,13 @@
"list": []
},
"miniprogram": {
"current": 11,
"current": 5,
"list": [
{
"id": -1,
"name": "pages/form/xj/index",
"pathName": "pages/form/xj/index",
"query": "",
"scene": null
},
{
......@@ -83,6 +84,12 @@
"pathName": "pages/person/certification/certificationmanage/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/auth/index",
"pathName": "pages/person/auth/index",
"scene": null
}
]
}
......
//数据请求(get,post)
const getData = (url, type, param, callBack, loading, isheader) => {
const getData = (url, type, param, callBack, loading, isheader, istoken) => {
wx.showNavigationBarLoading();
var token, header;
......@@ -7,10 +7,17 @@ const getData = (url, type, param, callBack, loading, isheader) => {
//获取token
token = wx.getStorageSync('access_token');
//参数字段追加来源字段
var params = Object.assign({}, param, {
source: 1
});
//参数字段追加来源字段,token字段
if (istoken) {
var params = Object.assign({}, param, {
source: 1,
token:token
});
} else {
var params = Object.assign({}, param, {
source: 1
});
}
//是否启用loading加载效果
if (loading) {
......@@ -94,11 +101,6 @@ const uploadFile = (url, paths, callBack) => {
success: (res) => {
var data = JSON.parse(res.data);
if (data.errcode == 103200) {
wx.showToast({
title: '上传成功',
icon: 'none',
duration: 2000
});
callBack(data.data[0])
} else {
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