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.
 
 
 
 

778 lines
23 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('+avatarLogo+')'}" @click="upImages"></view>
<view class="user-name-inputBox">
<view class="f-28 col-3 t-c m-btm20">真实姓名</view>
<input type="text" :value="cardinfo.name" 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="cardinfo.mobile" 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="cardinfo.wechat" 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="cardinfo.company" 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="cardinfo.branch" 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="cardinfo.position" 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="cardinfo.desc" 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')"
@cancel="onCancel"
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 m-right70 titile">地址</view>
<input type="text" @click="getLocation" 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>
<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 titile">行业</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" :checked="cardinfo.show_mobile==='1'" 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" :checked="cardinfo.show_wechat==='1'" 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" :checked="cardinfo.show_addr==='1'" 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}}天(收费¥{{mealsItem.price}})</view>
</view>
</label>
</radio-group>
</view> -->
<button form-type="submit" class="submit-btn f-28 t-c col-f">保存</button>
</form>
</view>
</block>
<!-- #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'
const graceChecker = require("../../../../components/threeComponents/graceChecker.js");
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'
export default {
data() {
return {
visiblec:false,
loadlogo: false,
phoneHeight: null,
isOpenLaction: false,
meals: [],
catesList: [],
typeIndex: [0, 0],
onelevel: "",
twolevel: "",
onelevelName: "",
twolevelName: "",
lat: "",
lng: "",
address: "",
cardinfo: {},
cardid: null,
avatarLogo: "",
isOpenLaction: false,
userAddress: {
id: '',
name: '',
tel: '',
detailed_address: '',
provinceidName: '',
provinceid:'',
areaidName: '',
countyid:'',
cityid:'',
distidName: '',
status: 0,
lat:'',
lng:'',
},
counts:true,
citytext:'请选择省市区',
owenscitylist:[],
latlngs:{},
userInfo:{},
lblis:{},
schoolText:0
}
},
components: {
Loadlogo,
PopManager,
checkCity,
wPickerb
},
onLoad(e) {
let _this = this;
_this.latlngs = uni.getStorageSync('curLoction');
_this.owenscitylist = uni.getStorageSync('cityList');
_this.cardid = e.id;
_this.getCardPage(e.id)
//#ifdef H5
_this.locationListener()
//#endif
},
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
},
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;
},
visble(){
this.visiblec = true;
},
returnData(e) {
let _this = this;
_this.userAddress = { ..._this.userAddress,
...e
};
console.log(_this.userAddress);
// _this.userAddress.distidName = !_this.userAddress.distidName?'':_this.userAddress.distidName;
},
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;
},
getCardPage(id = 3) {
let _this = this;
App._post_form('&p=citycard&do=createCityCardPage', {
id
}, res => {
if (res.errno === 0) {
let cates = 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.cardinfo.lat)
let latlng = {
lat:res.data.cardinfo.lat,
lng:res.data.cardinfo.lng
}
console.log(latlng)
_this.getloctions(latlng);
setTimeout(()=>{
// _this.userAddress.provinceid = res.data.cardinfo.provinceid;
// _this.userAddress.countyid = res.data.cardinfo.countyid;
// _this.userAddress.cityid = res.data.cardinfo.cityid;
// _this.userAddress.areaidName = '';
// _this.userAddress.provinceidName = '';
// _this.userAddress.distidName = '';
// console.log(_this.$refs.checkCity)
// console.log(_this.$refs.checkCity.userAddress);
_this.userAddress = { ..._this.userAddress,
...res.data.cardinfo
};
// _this.$refs.checkcity.userAddress.provinceid = res.data.cardinfo.provinceid;
// _this.$refs.checkcity.userAddress.countyid = res.data.cardinfo.countyid;
// _this.$refs.checkcity.userAddress.cityid = res.data.cardinfo.cityid;
// _this.$refs.checkcity.userAddress.areaidName = '';
// _this.$refs.checkcity.userAddress.provinceidName = '';
// _this.$refs.checkcity.userAddress.distidName = '';
// console.log(_this.userAddress,'我是傻逼',_this.$refs.checkcity)
})
_this.setData(res.data);
_this.setData({
onelevel: res.data.cardinfo.one_class,
twolevel: res.data.cardinfo.two_class,
onelevelName: res.data.cardinfo.onecatename,
twolevelName: res.data.cardinfo.twocatename,
address: res.data.cardinfo.address,
lat: res.data.cardinfo.lat,
lng: res.data.cardinfo.lng,
avatarLogo: res.data.cardinfo.logo,
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
App.navigationTo({
url: 'pages/subPages2/map/index'
});
//#endif
},
// 注册 腾讯地图
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,count);
_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)
}
}else{
return false
}
count++;
_this.counts = false;
}, false);
// #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.areaidName = '';
_this.userAddress.provinceidName = '';
_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;
}
})
}
})
}
})
return false
});
},
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,
id: _this.cardid,
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: "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 === 0) {
App.showSuccess('修改成功', () => {
uni.navigateBack({
delta: 1
})
})
}
}
}, false, () => {
uni.hideLoading()
})
} else {
uni.showToast({
title: graceChecker.error,
icon: "none"
});
}
},
// 行业分类确定按钮
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;
// #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;
_this.setData({
avatarLogo: file.img
})
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;
_this.setData({
avatarLogo: file.img
})
uni.hideLoading()
})
},
fail: function() {
App.showError('上传失败')
}
});
// #endif
}
},
computed: {
userInfo() {
return uni.getStorageSync('userinfo')
}
},
}
</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;
}
}
.titile{
min-width: 80upx;
}
.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;
}
/* #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: 60upx 0;
border-radius: 10upx;
height: 80upx;
line-height: 80upx;
}
</style>