处方药可以做网站吗,常用于做网站的软件,做网络推广要做网站吗,深圳二维码网站建设前言 提示#xff1a;这个是一个很小的项目#xff0c;大概30分钟就能搞定 实现方式#xff1a;输入支付代码#xff0c;存储到对应的数据库表中#xff0c;二维码访问一个PHP文件通过id来进行重定向#xff0c;这样就可以使每张二维码都是固定的#xff0c;替换二维码…前言 提示这个是一个很小的项目大概30分钟就能搞定 实现方式输入支付代码存储到对应的数据库表中二维码访问一个PHP文件通过id来进行重定向这样就可以使每张二维码都是固定的替换二维码内容也只需改数据库的即可 文章目录 前言一、设计UI界面二、设计数据库三、设计接口列表接口数据更新接口 四、设计重定向访问页面四、解决跨域问题第一步第二步第三步 总结 提示以下代码需要导入B-ui插件或者在页面顶部直接下载资源即可
一、设计UI界面 index.vue
templateviewview classb-popup v-ifshowPopup :class[directionClass,{b-popup-round:round},{b-popup-animation:animation}]view classb-popup-shade clickshowPopup false/viewview classb-popup-content!-- 你的内容写在这里 --view classb-p-32 stylewidth: 500rpx;height: 300rpx;display: flex;flex-direction: column;justify-content: center;align-items: center;input placeholder填入新的支付代码 v-modelupdate_url stylebackground-color: #ccc;height: 80rpx;width: 487rpx; /view stylemargin-top: 20rpx;button classb-btn b-btn-blue clickupdate__()确认/buttonbutton classb-btn b-btn-red clickshow(false) stylemargin-left: 50rpx;取消/button/view/view/view/view!-- view classb-flex-x b-bg-white b-p-32image src/static/logo.png modeaspectFit classlogo b-radius-8/imageview classb-flex-item b-ml-32view classb-text-B b-text-48 b-text-black支付链接转二维码 v{{BuiVersion}}/viewview classb-font-24 b-mt-8 b-text-black-dd园游会永不打烊/view/view/view --!-- view classb-flex-grow b-ml-32 stylewidth: 680rpx;input typetext classb-form-input placeholder请输入名称 stylewidth: 680rpx; v-modelname/view --!-- view classb-bg-white b-pl-32 b-pr-32 b-pt-24 b-pb-24button classb-btn b-btn-blue b-btn-block b-btn-lg clickupload()上传图片/button/view --view classb-pt-32 b-pr-32 b-pl-32 b-pb-24 b-text-black-dd列表/viewview classb-list-user b-bg-whiteview classb-list-itemv-for(item,index) in list :keyindexview classb-flex-xview classb-icon b-text-black-dimage src/static/tabBar/api.png modewidthFix stylewidth: 50rpx;height: 50rpx;/image/viewview stylefont-size:20rpx;位置{{item.id}}/view/viewview classbtns-boxbutton classb-btn b-btn-blue b-btn-sm clickjumps_edit(item.id)修改URL/buttonbutton classb-btn b-btn-blue b-btn-sm stylemargin-left: 10rpx; clickjumps(item.id)生成/button!-- button classb-btn b-btn-blue b-btn-sm stylemargin-left: 10rpx; clickdelete_(item.id)删/button --/view/view/viewview classb-p-32 b-text-black-dd b-text-c b-text-20view欢迎使用 B-ui /viewview classb-mt-8copy; 园游会永不打烊/view/view/view
/templatescriptexport default {data() {return {select_id:,update_url:,showPopup:false,directionClass:,round:true,animation:true,name:,BuiVersion:,list:[],}},onLoad() {this.BuiVersion uni.Bui.version;this.get_list();},methods: {update__(){let thatthis;uni.request({url: https://*****/update.php, data: {url:that.update_url,id:that.select_id},method: POST,header: {content-type: application/x-www-form-urlencoded //自定义请求头信息},success: (res) {if (res.data.code200) {uni.showToast({title:res.data.msg})} else{uni.showToast({title:res.data.msg})}this.update_url;that.showPopupfalse;}})},show(status true){this.showPopup status;this.update_url;},get_list(){let thatthis;uni.request({url: https://*****/get_list.php, data: {},method: POST,header: {content-type: application/x-www-form-urlencoded //自定义请求头信息},success: (res) {console.log(res.data)that.listres.data.data;}})},jump(path){uni.navigateTo({url:/pages/video/video?pathpath})},jumps(path){console.log(path)uni.navigateTo({url:/pages/qrcode/qrcode?pathpath})},jumps_edit(id){let thatthis;that.select_idid;that.showPopup true;}}}
/scriptstyle langscss.logo{width: 140rpx;height: 140rpx;}.line-top{border-top: #eee solid 1px;}
/styleqrcode.vue
template xlangwxmlview classcontainerview classqrimgview classqrimg-itki-qrcode v-ififShow cidqrcode1 refqrcode :valval :sizesize :unitunit :backgroundbackground :foregroundforeground :pdgroundpdground :iconicon :iconSizeiconsize :lvlv :onvalonval :loadMakeloadMake :usingComponentstrue resultqrR //view!-- view classqrimg-itki-qrcode v-ififShow cidqrcode2 refqrcode2 val第二个二维码 :sizesize :onvalonval :loadMakeloadMake :usingComponentstrue resultqrR //view --/viewview classuni-padding-wrap uni-common-mtview classuni-title设置二维码大小/view/viewview classbody-viewslider :valuesize changesliderchange min50 max500 show-value //viewview classuni-padding-wrapview classbtnsbutton typeprimary tapselectIcon选择二维码图标/buttonbutton typeprimary tapcreatQrcode生成二维码/buttonbutton typeprimary tapsaveQrcode保存到图库/button!-- button typewarn tapclearQrcode清除二维码/buttonbutton typewarn tapifQrcode显示隐藏二维码/button --/view/view/view
/template
script
import tkiQrcode from /components/tki-qrcode/tki-qrcode.vue
export default {data() {return {ifShow: true,val: , // 要生成的二维码值size: 300, // 二维码大小unit: upx, // 单位background: #ffffff, // 背景色foreground: #252625, // 前景色pdground: #252625, // 角标色icon: , // 二维码图标/static/logo.jpgiconsize: 40, // 二维码图标大小lv: 3, // 二维码容错级别 一般不用设置默认就行onval: false, // val值变化时自动重新生成二维码loadMake: true, // 组件加载完成后自动生成二维码src: // 二维码生成后的图片地址或base64}},methods: {sliderchange(e) {this.size e.detail.value},creatQrcode() {this.$refs.qrcode._makeCode()},saveQrcode() {this.$refs.qrcode._saveCode()},qrR(res) {this.src res},clearQrcode() {this.$refs.qrcode._clearCode()this.val },ifQrcode() {this.ifShow !this.ifShow},selectIcon() {let that thisuni.chooseImage({count: 1, //默认9sizeType: [original, compressed], //可以指定是原图还是压缩图默认二者都有sourceType: [album], //从相册选择success: function (res) {that.icon res.tempFilePaths[0]setTimeout(() {that.creatQrcode()}, 100);// console.log(res.tempFilePaths);}});}},components: {tkiQrcode},onLoad(options) {let that this;that.valhttps://******/location.php?idoptions.path},
}
/scriptstyle
/* import ../../../common/icon.css; */
.container {display: flex;flex-direction: column;width: 100%;
}.qrimg {display: flex;justify-content: center;
}
.qrimg-i{margin-right: 10px;
}slider {width: 100%;
}input {width: 100%;margin-bottom: 20upx;
}.btns {display: flex;flex-direction: column;width: 100%;
}button {width: 100%;margin-top: 10upx;
}
/style
二、设计数据库 三、设计接口
列表接口
固定位置在数据库即可前端刷新出来通过id进行操作
get_list.php
?php
// 假设你已经建立了数据库连接 $conn
// 这里我们假设数据库表名为 url_list
include conn.php;
// 查询数据库获取数据
$query SELECT * FROM url_list;
$result $conn-query($query);// 检查查询结果是否成功
if (!$result) {die(json_encode(array(code 500,msg 查询失败,),JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
}// 将查询结果转换为关联数组
$data array();
while ($row mysqli_fetch_assoc($result)) {$data[] $row;
}// 释放查询结果资源
mysqli_free_result($result);// 输出JSON格式的数据
die(json_encode(array(code 200,data $data,msg 查询成功,),JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
);
?
数据更新接口
既然要实现不更改二维码替换内容那数据库的数据需要改变就不得不弄一个能修改的操作
update.php
?php
include conn.php;
if ($_POST) {$url$_POST[url];$id$_POST[id];$sqlUPDATE url_list SET url $url WHERE id $id;$res$conn-query($sql);die(json_encode(array(code 200,msg 更改成功),480)
);
} else {die(json_encode(array(code 100,msg 请求失败),480)
);
}
四、设计重定向访问页面
上述工作都做完了现在就差重定向页面。什么是重定向 重定向是指将一个网页、URL或文件请求从一个位置转发到另一个位置的过程。在互联网和计算机领域重定向是一种常见的技术用于将用户从一个网址或链接导向到另一个网址或链接。 重定向通常有两种类型 服务器端重定向当用户访问一个网页或URL时服务器会检测到这个请求并根据预先设定的规则将用户的请求从原始网址转发到新的目标网址。这个过程是在服务器端完成的用户通常无法察觉到重定向的发生。服务器端重定向是通过HTTP状态码实现的如301永久重定向、302临时重定向等。客户端重定向这种重定向是通过网页上的特定代码通常是JavaScript或HTML的标签来实现的。当用户访问一个网页时网页上的代码会检测到用户的请求并将用户自动导向到新的目标网址。客户端重定向可以通过页面刷新或页面跳转来实现。 重定向在网站管理和维护中有多种用途。一些常见的应用包括网址更改当网站的URL发生变化时可以使用重定向将原始URL导向到新的URL以确保用户仍能够访问到所需内容。域名重定向当网站的域名更改或网站需要多个域名来访问时可以使用重定向将用户从一个域名导向到另一个域名。错误页面处理当用户访问一个不存在的页面或出现错误时可以使用重定向将用户引导到一个有效的页面或者返回一个合适的错误信息。流量管理通过重定向网站管理员可以控制特定页面的访问量将用户导向不同的内容或服务。 总之重定向是一种有用的技术能够为网站提供更好的用户体验和更有效的管理可实现域名跳转。 我们通过对二维码的设置使每个栏位根据id来生成二维码通过传递id给重定向文件然后重定向文件去数据库查询最新的URL来实现跳转
onLoad(options) {let that this;that.valhttps://******/location.php?idoptions.path},location.php
?php
// 重定向的目标链接
include(conn.php);
if ($_GET[id]) {
$id$_GET[id];
$query SELECT url FROM url_list WHERE id $id;
$result $conn-query($query);if ($result-num_rows 0) {// If at least one row is found, extract the id$row $result-fetch_assoc();$url $row[url];$redirect_url $url;// 执行重定向header(Location: . $redirect_url);
} else {// If no data is found, display a messageecho 没有数据;
}// Dont forget to close the database connection after using it
$conn-close();
exit();} else {die(参数不合法);
}?
四、解决跨域问题
第一步
打开manifest.json勾选Https等其他如图
第二步
替换所有的域名http为https
第三步
服务端配置SSL证书设置为强制
总结
以上就是今天记录的内容本次项目很简单是一个新手练手的项目重定向解决办法就是保持协议一致你也可以不按我的来只要统一即可
希望你能喜欢我的其他作品 《记一次云之家签到抓包》 《记一次视频抓包m3u8解密过程》 《抓包部分软件时无网络过代理检测 解决办法 安卓黄鸟httpcanaryvmos》 《Python】记录抓包分析自动领取芝麻HTTP每日免费IP成品教程》 《某课抓包视频 安卓手机黄鸟某课appVirtualXposed虚拟框架》
推荐专栏
《Python爬虫脚本项目实战》
该专栏往期文章 《【Python爬虫项目实战一】获取Chatgpt3.5免费接口文末付代码过Authorization认证》
如果感觉看完文章还不过瘾欢迎查看我的其它专栏 作者对python有很大的兴趣完成过很多独立的项目例如滇医通等等脚本但是由于版权的原因下架了爬虫这一类审核比较严谨稍有不慎就侵权违规了所以在保证质量的同时会对文章进行筛选
如果您对爬虫感兴趣请收藏或者订阅该专栏哦《Python爬虫脚本项目实战》如果你有项目欢迎联系我我会同步教程到本专栏
Python爬虫项目实战系列文章 ⭐⭐欢迎订阅⭐⭐
【Python爬虫项目实战一】获取Chatgpt3.5免费接口文末付代码过Authorization认证 【Python爬虫项目实战二】Chatgpt还原验证算法-解密某宝伪知网数据接口
⭐⭐欢迎订阅⭐⭐
Python爬虫脚本项目实战