weliam-smartcity智慧城市
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

872 lines
24 KiB

<template>
<view>
<loadlogo v-if="!loadlogo" />
<block v-if="loadlogo">
<far-bottom></far-bottom>
<view class="header p-r">
<view class="iconfont icon-info col-f4 header-Icon"></view>
<view class="header-title col-9 f-24">{{schoolText == 1?'完善个人名片的用户,更容易获得学校人脉,并得到平台名片榜单推荐': '完善个人名片的用户,更容易获得商业人脉,并得到平台名片榜单推荐'}}</view>
</view>
<view class="formData-box">
<form @submit="sbformData">
<view class="userData-box bor-radius-10upx b-f">
<view class="user-avatar" :style="{ 'background-image': 'url(' + avatar + ')' }" @click="upImages"></view>
<view class="user-name-inputBox">
<view class="f-28 col-3 t-c m-btm20">真实姓名</view>
<input type="text" value="" name="name" placeholder="请填写姓名" class="user-name-input f-28 col-9" />
</view>
<view class="user-contact-inputBox dis-flex flex-y-center">
<view class="user-contact-item flex-box">
<view class="user-contact-phone f-24 col-3 t-c m-btm20">手机号</view>
<input type="number" value="" name="mobile" placeholder="请填写电话" class="user-contact-input f-28 col-9" />
</view>
<view class="user-contact-item flex-box">
<view class="user-contact-wx f-24 col-3 t-c m-btm20">微信号</view>
<input type="text" value="" name="wechat" placeholder="请填写微信号" class="user-contact-input f-28 col-9" />
</view>
</view>
</view>
<view class="enter-title padding-box-all f-24 col-9">{{schoolText == 1?'个人信息':"企业信息"}}</view>
<view class="enterData-box bor-radius-10upx b-f">
<view class="enterData-content">
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom">
<view class="f-28 m-right70 titile">{{schoolText == 1?'年级':"公司"}}</view>
<input type="text" value="" name="company" :placeholder="schoolText == 1?'请填写年级(选填)':'请填写公司'" class="user-contact-input f-28 col-9" />
</view>
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom">
<view class="f-28 m-right70 titile">{{schoolText == 1?'专业':"部门"}}</view>
<input type="text" value="" name="branch" :placeholder="schoolText == 1?'请填写专业(选填)':'请填写部门'" class="user-contact-input f-28 col-9" />
</view>
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom">
<view class="f-28 titile" :class="schoolText == 1?'m-right40':'m-right70'">{{schoolText == 1?'校内职务':"职位"}}</view>
<input type="text" value="" name="position" :placeholder="schoolText == 1?'请填写校内职务(选填)':'请填写职位'" class="user-contact-input f-28 col-9" />
</view>
<view class="enterData-input-box enterData-textarea border-line border-bottom">
<textarea value="" placeholder="" name="desc" :placeholder="schoolText == 1?'请简要介绍你自己(例如:获奖经历)':'请填写一句话介绍负责业务'" class="f-28 col-9"></textarea>
</view>
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom p-r">
<view class="f-28 m-right70 titile">省市</view>
<view >
<view class="uni-input" style="font-size: 24upx;line-height: 80upx;display: inline-block;height: 80upx;vertical-align: middle;" @tap="visble">{{citytext}}</view>
<w-pickerb
:visible.sync="visiblec"
mode="region"
:value="[userAddress.provinceid,userAddress.cityid,userAddress.countyid]"
default-type="value"
:hide-area="false"
@confirm="onConfirm($event,'region')"
ref="region"
></w-pickerb>
</view>
</view>
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom p-r">
<view class="f-28 titile" style="margin-right: 60upx;">地址<text class="f-20 c-ff4444">*</text></view>
<input @click="getLocation" type="text" disabled :value="address" name="address" placeholder="请输入详细地址" class="user-contact-input f-28 col-9" />
<view class="location dis-flex flex-y-center" @click="getLocation">
<view class="locationIconClass iconfont icon-location col-f4 m-right10"></view>
<view class="f-24 col-f4">定位</view>
</view>
</view>
<view class="enterData-input-box dis-flex flex-y-center border-line border-bottom p-r">
<view class="f-28 m-right70 titile">行业</view>
<view >
<view class="uni-input"
v-if="onelevelName || twolevelName"
style="font-size: 24upx;line-height: 80upx;display: inline-block;height: 80upx;vertical-align: middle;"
@tap="visblelinkage">{{ onelevelName }} {{ twolevelName }}
</view>
<view class="uni-input"
v-else
style="font-size: 24upx;line-height: 80upx;display: inline-block;height: 80upx;vertical-align: middle;"
@tap="visblelinkage">请选择所属行业
</view>
<w-pickerb
:visible.sync="visibleclinkage"
mode="linkage"
:value="[onelevelName,twolevelName]"
default-type="name"
:level="2"
:default-props="defaultprops"
:hide-area="false"
@confirm="onConfirmlinkage($event,'linkage')"
:options="catesList"
ref="linkage"
></w-pickerb>
</view>
</view>
<!-- <picker mode="multiSelector" class="dataPicker" :range="catesList" @change="checkType" @columnchange="changeKey" range-key="name" :value="typeIndex">
<view class="enterData-input-box dis-flex flex-y-center p-r">
<view class="dis-flex flex-y-center ">
<view class="f-28 m-right70">行业</view>
<view class="f-28 col-3">{{ onelevelName }} {{ twolevelName }}</view>
</view>
<view class="iconfont icon-right rightIconClass col-9"></view>
</view>
</picker> -->
</view>
</view>
<view class="enter-title padding-box-all f-24 col-9">隐私设置</view>
<view class="enterData-box bor-radius-10upx b-f">
<view class="enterData-content">
<view class="enterData-input-box dis-flex flex-y-center flex-x-between border-line border-bottom">
<view class="f-28 m-right70">公开手机号</view>
<view class="dis-flex flex-y-center">
<view class="col-9 f-24 m-right30">在名片中显示手机号</view>
<switch name="show_mobile" class="switchStyle" color="#FF4444" />
</view>
</view>
<view class="enterData-input-box dis-flex flex-y-center flex-x-between border-line border-bottom">
<view class="f-28 m-right70">公开微信号</view>
<view class="dis-flex flex-y-center">
<view class="col-9 f-24 m-right30">在名片中显示微信号</view>
<switch name="show_wechat" class="switchStyle" color="#FF4444" />
</view>
</view>
<view class="enterData-input-box dis-flex flex-y-center flex-x-between border-line border-bottom">
<view class="f-28 m-right70">公开位置信息</view>
<view class="dis-flex flex-y-center">
<view class="col-9 f-24 m-right30">在您的名片中公开显示</view>
<switch name="show_addr" class="switchStyle" color="#FF4444" />
</view>
</view>
</view>
</view>
<view class="enter-title padding-box-all f-24 col-9">付费入驻</view>
<view class="enterData-box bor-radius-10upx b-f padding-box-all">
<radio-group @change="radioChange" name="meal_id">
<label v-for="(mealsItem, index) in meals" :key="index" class="labeStyle">
<view class="dis-flex flex-y-center m-btm40 labeStyle-btm">
<view class="m-right20"><radio :value="mealsItem.id" color="#FF4444" style="transform: scale(0.8);" /></view>
<view class="f-28 col-3">{{ mealsItem.name }}有效期{{ mealsItem.day }}天(
<text v-if="mealsItem.is_free != 1">收费¥{{ mealsItem.price }}</text>
<text v-else>免费</text>)</view>
</view>
</label>
</radio-group>
</view>
<view class="agreement dis-flex flex-y-center" @click="openAgreement">
<view class="iconfont icon-roundcheck col-f4 agreementIcon m-right10"></view>
<view class="agreementIconText f-24 col-9">
阅读并同意
<text>《名片发布协议条款》</text>
</view>
</view>
<button form-type="submit" class="submit-btn f-28 t-c col-f">保存</button>
</form>
</view>
</block>
<PopManager :show="showRule" type="center" @clickmask="showRule = false">
<view class="wxParse-box b-f">
<scroll-view scroll-y="true" class="scrollView-parse">
<jyf-parser domain="https://6874-html-foe72-1259071903.tcb.qcloud.la" gesture-zoom lazy-load ref="article"
selectable show-with-animation use-anchor :html="agreement"></jyf-parser>
<!-- <wx-parse :content=""></wx-parse> -->
</scroll-view>
<view class="closeRule col-f f-28 t-c" @click="openAgreement">知道了</view>
</view>
</PopManager>
<!-- #ifdef H5 -->
<PopManager :show="isOpenLaction" :type="'bottom'" :overlay="'false'" :showOverlay="'false'">
<view class="iframe-wid-hgt" :style="{ height: phoneHeight }" v-if="latlngs">
<iframe
id="mapPage"
width="100%"
height="100%"
frameborder="0"
:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=KIQBZ-6OT3G-AOMQD-IHW6J-PEUDV-VCFAF&referer=myapp&coord=${latlngs.latitude},${latlngs.longitude}`"
></iframe>
</view>
<view class="iframe-wid-hgt" :style="{ height: phoneHeight }" v-if="!latlngs">
<iframe
id="mapPage"
width="100%"
height="100%"
frameborder="0"
:src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=KIQBZ-6OT3G-AOMQD-IHW6J-PEUDV-VCFAF&referer=myapp`"
></iframe>
</view>
</PopManager>
<!-- #endif -->
</view>
</template>
<script>
import App from '@/common/js/app.js';
import Loadlogo from '@/components/template/loadlogo';
import jyfParser from '@/components/jyf-parser/jyf-parser.vue';
import wxApi from '@/common/js/wxApi.js';
import PopManager from '@/components/template/PopManager';
import checkCity from '@/components/template/checkCity.vue';
import wPickerb from '@/components/w-picker/w-picker.vue'
const graceChecker = require('../../../../components/threeComponents/graceChecker.js');
export default {
data() {
return {
loadlogo: false,
phoneHeight: null,
isOpenLaction: false,
meals: [],
catesList: [],
visiblec:false,
visibleclinkage:false,
typeIndex: [0, 0],
onelevel: '',
twolevel: '',
onelevelName: '',
twolevelName: '',
lat: '',
lng: '',
address: '',
avatarLogo: '',
isOpenLaction: false,
showRule: false,
owenscitylist:[],
agreement: '',
defaultprops:{
"label":"name",
"value":"id",
"children":"childrens"
},
userAddress: {
id: '',
name: '',
tel: '',
detailed_address: '',
provinceidName: '',
areaidName: '',
distidName: '',
status: 0,
lat: '',
lng: ''
},
counts: true,
citytext:'请选择省市区',
latlngs:{},
userInfo:{},
lblis:{},
upImg:false,
schoolText:0
};
},
onShow(){
//#ifdef APP-PLUS
if(this.lblis.lat){
this.setData({
address: this.userInfo.address,
lat: this.userInfo.lat,
lng: this.userInfo.lng
});
_this.getloctions(this.lblis);
}
//#endif
if(this.upImg){
this.upImg = false;
return
}
this.getCardPage();
},
methods: {
onConfirm(e){
console.log(e);
this.userAddress.provinceid = e.obj.province.value;
this.userAddress.cityid = e.obj.city.value;
this.userAddress.countyid = e.obj.area.value;
this.citytext = e.result;
},
onConfirmlinkage(e){
let _this = this;
console.log(e);
_this.onelevel = e.obj.col1.id;
_this.onelevelName = e.obj.col1.name;
_this.twolevel = e.obj.col2.id;
_this.twolevelName = e.obj.col2.name;
},
visble(){
this.visiblec = true;
},
visblelinkage(){
this.visibleclinkage = true;
},
galadata(e) {
let _this = this;
_this.userAddress.areaidName = e.areaidName;
_this.userAddress.distidName = e.distidName;
_this.userAddress.provinceidName = e.provinceidName;
// _this.userAddress.distidName = !_this.userAddress.distidName?'':_this.userAddress.distidName;
},
returnData(e) {
let _this = this;
_this.userAddress = { ..._this.userAddress, ...e };
console.log(_this.userAddress);
// _this.userAddress.distidName = !_this.userAddress.distidName?'':_this.userAddress.distidName;
},
getCardPage() {
let _this = this;
let data = {
}
App._post_form(
'&p=citycard&do=createCityCardPage',
{},
res => {
if (res.errno === 0) {
_this.catesList = res.data.cates;
// if (!!cates) {
// let leftCheck = [],
// rightCheck = [];
// for (let i = 0; i < cates.length; i++) {
// leftCheck.push(cates[i]);
// }
// for (let j = 0; j < cates[0]['childrens']['length']; j++) {
// rightCheck.push(cates[0]['childrens'][j]);
// }
// _this.catesList.push(leftCheck);
// _this.catesList.push(rightCheck);
// console.log(res.data.cates,_this.catesList);
// }
_this.setData(res.data);
_this.schoolText = res.data.schoolText;
}
},
false,
() => {
_this.loadlogo = true;
}
);
},
//定位
getLocation() {
let _this = this;
let latlng;
// #ifdef MP-WEIXIN
uni.chooseLocation({
keyword: '',
success: function(res) {
_this.setData({
address: res.name,
lat: res.latitude,
lng: res.longitude
});
latlng = {
lat: res.latitude,
lng: res.longitude
};
_this.getloctions(latlng);
}
});
// #endif
// #ifdef H5
_this.isOpenLaction = true;
// #endif
//#ifdef APP-PLUS
console.log('app得嘛')
App.navigationTo({
url: 'pages/subPages2/map/index'
});
//#endif
},
getloctions(lblis) {
let _this = this;
App._post_form(`&p=member&do=lng2areaid&lng=${lblis.lng}&lat=${lblis.lat}`, {}, res => {
_this.userAddress.lat = lblis.lat;
_this.userAddress.lng = lblis.lng;
_this.userAddress.provinceid = res.data.provinceid;
_this.userAddress.countyid = res.data.countyid;
_this.userAddress.cityid = res.data.cityid;
(_this.userAddress.provinceidName = ''), (_this.userAddress.areaidName = ''), (_this.userAddress.distidName = ''), console.log(_this.userAddress);
_this.owenscitylist.map((item,index)=>{
if(item.id == _this.userAddress.provinceid){
_this.citytext = item.name;
_this.userAddress.provinceidName = item.name;
item.area.map(items=>{
if(items.id == _this.userAddress.cityid){
_this.citytext = `${_this.citytext}${items.name}`;
_this.userAddress.areaidName = items.name;
console.log(_this.citytext,items.name);
items.dist.map(itemss=>{
if(itemss.id == _this.userAddress.countyid){
_this.citytext = `${_this.citytext}${itemss.name}`;
_this.userAddress.distidName = itemss.name;
}
})
}
})
}
})
});
},
// 注册 腾讯地图
locationListener() {
let _this = this;
let count = 1;
uni.getSystemInfo({
success(res) {
_this.setData({
phoneHeight: res.windowHeight + 'px'
});
}
});
// #ifdef H5
window.addEventListener(
'message',
function(event) {
// 接收位置信息,用户选择确认位置点后选点组件会触发该事件,回传用户的位置信息
let loc = event.data;
let latlng;
if (count > 1 || _this.counts) {
if (loc && loc.module == 'locationPicker') {
//防止其他应用也会向该页面post信息,需判断module是否为'locationPicker'
console.log('location', loc);
_this.address = loc.poiaddress;
_this.lat = loc.latlng.lat;
_this.lng = loc.latlng.lng;
_this.isOpenLaction = false;
latlng = {
lat: loc.latlng.lat,
lng: loc.latlng.lng
};
_this.getloctions(latlng);
// debugger
}
}
_this.counts = false;
count++;
},
false
);
// #endif
},
radioChange(e) {},
sbformData(e) {
let _this = this,
fromData = e.detail.value;
//定义表单规则
fromData = {
...fromData,
show_addr: fromData.show_addr ? '1' : '0',
show_mobile: fromData.show_mobile ? '1' : '0',
show_wechat: fromData.show_wechat ? '1' : '0',
lat: _this.lat,
lng: _this.lng,
one_class: _this.onelevel,
two_class: _this.twolevel,
logo: _this.avatarLogo
};
let rule = [
{
name: 'name',
checkType: 'string',
checkRule: '1,4',
errorMsg: '姓名应为1-4个字符'
},
{
name: 'mobile',
checkType: 'phoneno',
errorMsg: '请输入正确手机号'
},
{
name: 'wechat',
checkType: 'notnull',
errorMsg: '请输入微信号'
},
{
name: 'company',
checkType: 'notnull',
errorMsg: '公司名字不能为空'
},
{
name: 'branch',
checkType: 'notnull',
errorMsg: '部门内容不能为空'
},
{
name: 'position',
checkType: 'notnull',
errorMsg: '职位内容不能为空'
},
{
name: 'desc',
checkType: 'notnull',
errorMsg: '简介内容不能为空'
},
{
name: 'address',
checkType: 'notnull',
errorMsg: '请输入地址或直接定位'
},
{
name: 'meal_id',
checkType: 'notnull',
errorMsg: '请选择入驻套餐'
},
{
name: 'one_class',
checkType: 'notnull',
errorMsg: '行业内容不能为空'
}
],
checkRes = graceChecker.check(fromData, rule);
if (checkRes) {
uni.showLoading();
fromData.provinceid = _this.userAddress.provinceid;
fromData.cityid = _this.userAddress.cityid;
fromData.countyid = _this.userAddress.countyid;
App._post_form(
'&p=citycard&do=createCityCardApi',
fromData,
res => {
if (res.errno === 0) {
let cityCardData = res.data;
if (cityCardData.paystatus === 1) {
App.navigationTo({
url: `pages/mainPages/payment/payment?orderid=${cityCardData.orderid}&plugin=citycard`
});
} else {
App.navigationTo({
url: `pages/subPages/businesscard/carddetail/renewcarddetail`,
navType: 'rediRect'
});
}
}
},
false,
() => {
uni.hideLoading();
}
);
} else {
uni.showToast({
title: graceChecker.error,
icon: 'none'
});
}
},
openAgreement() {
this.showRule = !this.showRule;
},
// 行业分类确定按钮
checkType(e) {
let _this = this,
catesList = _this.catesList;
if (!!catesList[0][e.target.value[0]]) {
_this.onelevelName = catesList[0][e.target.value[0]].name;
_this.onelevel = catesList[0][e.target.value[0]].id;
}
if (!!catesList[1][e.target.value[1]]) {
_this.twolevelName = catesList[1][e.target.value[1]].name;
_this.twolevel = catesList[1][e.target.value[1]].id;
}
},
// 行业分类二级联动
changeKey(e) {
let _this = this,
listRight = [];
for (let i = 0; i < _this.catesList.length; i++) {
for (let j = 0; j < _this.catesList[i]['length']; j++) {
if (e.target.value == j && e.target.column == 0 && !!_this.catesList[i][j]['childrens']) {
for (let a = 0; a < _this.catesList[i][j]['childrens']['length']; a++) {
listRight.push(_this.catesList[i][j]['childrens'][a]);
}
_this.catesList.splice(1, 2, listRight);
}
}
}
},
uploadImageFiles(requestData) {
let _this = this;
App._post_form(
'&do=uploadFiles',
requestData,
res => {
if (res.errno === 0) {
_this.setData({
avatarLogo: res.data.img
});
}
},
false,
() => {
uni.hideLoading();
}
);
},
// 上传图片
async upImages() {
let _this = this;
_this.upImg = true;
// #ifdef H5
if(App.getClientType() == 2){
let res = await App.browser_upload(1);
uni.showLoading();
let imageUrl = res.tempFilePaths[0],
rnImageData = App._upLoad(imageUrl);
rnImageData.then(options => {
console.log(options, 'options');
let file = options.data.img;
_this.setData({
avatarLogo: file
});
uni.hideLoading();
});
return
}
wxApi.choseImage(res => {
wxApi.uoloadIg(res.localIds[0], data => {
if (data.errMsg === 'uploadImage:ok') {
uni.showLoading({});
let requestData = {
upload_type: 2,
id: data.serverId
};
_this.uploadImageFiles(requestData);
} else {
App.showError('上传失败');
}
});
});
// #endif
// #ifndef H5
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function(res) {
uni.showLoading();
let imageUrl = res.tempFilePaths[0],
rnImageData = App._upLoad(imageUrl);
rnImageData.then(options => {
console.log(options, 'options');
let file = options.data.img;
_this.setData({
avatarLogo: file
});
uni.hideLoading();
});
},
fail: function() {
App.showError('上传失败');
}
});
// #endif
}
},
computed: {
userInfo() {
return uni.getStorageSync('userinfo');
},
avatar() {
return !!this.avatarLogo ? this.avatarLogo : this.imageRoot + 'creatCardAvatar.png';
}
},
components: {
PopManager,
Loadlogo,
jyfParser,
checkCity,
wPickerb
},
onLoad(e) {
let _this = this;
_this.latlngs = uni.getStorageSync('curLoction');
_this.owenscitylist = uni.getStorageSync('cityList');
//#ifdef H5
_this.locationListener();
//#endif
}
};
</script>
<style lang="scss">
page {
background-color: #f8f8f8;
}
.header-Icon {
position: absolute;
left: 80upx;
top: 0;
font-size: 26upx;
}
.header-title {
width: 505upx;
text-align: center;
margin: 30upx auto 100upx;
}
.formData-box {
padding: 0 30upx;
}
.userData-box {
.user-avatar {
position: relative;
width: 140upx;
height: 140upx;
background-size: 140upx 140upx;
background-repeat: no-repeat;
border-radius: 50%;
left: 50%;
transform: translateX(-50%);
top: -60upx;
}
}
.user-name-inputBox {
padding-bottom: 40upx;
margin: 0 30upx;
border-bottom: 1px solid #eeeeee;
.user-name-input {
margin: 0 auto;
width: 200upx;
text-align: center;
}
}
.user-contact-inputBox {
padding: 30upx 0;
.user-contact-input {
margin: 0 auto;
width: 180upx;
text-align: center;
}
}
.enterData-content {
margin: 0 30upx;
.enterData-input-box {
padding: 30upx 0;
}
}
.enterData-textarea textarea {
height: 220upx;
}
.location {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.locationIconClass {
font-size: 32upx;
}
.rightIconClass {
font-size: 24upx;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 0;
}
.iframe-wid-hgt {
width: 100vw;
}
.agreement {
margin-top: 30upx;
.agreementIcon {
font-size: 24upx;
}
.agreementIconText {
> text {
color: #4f6d8c;
}
}
}
.wxParse-box {
border-radius: 20upx;
width: 500upx;
height: 75vh;
padding: 20upx 50upx;
}
.scrollView-parse {
height: 65vh;
}
.m-right40{
margin-right: 40upx;
}
.titile{
// width: 80upx;
min-width: 80upx;
}
.closeRule {
width: 460upx;
height: 80upx;
line-height: 80upx;
background-color: #ff4444;
border-radius: 40upx;
margin: 30upx auto 0;
}
/* #ifndef H5 */
/*swtich样式-start*/
/*swtich整体大小*/
.wx-switch-input {
width: 82upx !important;
height: 40upx !important;
}
/*白色样式(false的样式)*/
.wx-switch-input::before {
width: 80upx !important;
height: 36upx !important;
}
/*绿色样式(true的样式)*/
.wx-switch-input::after {
width: 40upx !important;
height: 36upx !important;
}
/* #endif */
/* #ifdef H5 */
.switchStyle {
height: 60upx;
}
.switchStyle /deep/ .uni-switch-input {
width: 82upx !important;
height: 40upx !important;
}
.switchStyle /deep/ .uni-switch-input::before {
width: 80upx !important;
height: 36upx !important;
}
.switchStyle /deep/ .uni-switch-input::after {
width: 40upx !important;
height: 36upx !important;
}
/* #endif */
.labeStyle:last-child .labeStyle-btm {
margin-bottom: 0;
}
.submit-btn {
background-color: #ff4444;
margin: 40upx 0;
border-radius: 10upx;
height: 80upx;
line-height: 80upx;
}
</style>